neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/35246?usp=email )


Change subject: client: move some items to internal header
......................................................................

client: move some items to internal header

There is an upcoming modification of structs mgcp_msg and mgcp_response.
When it is public API, it needs to be kept backwards compatible.

But no libosmo-mgcp caller (in the osmocom-cni world) has used these
structs in years and years. All libosmo-mgcp-client users should use the
higher level osmo_mgcpc_* API only.

Move this legacy API to a private header, so we no longer need to worry
about compatibility there.

Related: OS#6171
Related: I798e02c6663376d3d52f4a74fc4b32411ce95bed
Change-Id: I6d8bdda5c2ffa236e94a0b6111de4dbfac923187
---
M TODO-RELEASE
M include/osmocom/mgcp_client/mgcp_client.h
M include/osmocom/mgcp_client/mgcp_client_internal.h
M src/libosmo-mgcp-client/mgcp_client_fsm.c
4 files changed, 99 insertions(+), 65 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/46/35246/1

diff --git a/TODO-RELEASE b/TODO-RELEASE
index c5a3b36..82368ff 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -24,3 +24,14 @@
 # If any interfaces have been removed or changed since the last public 
release, a=0.
 #
 #library               what            description / commit summary line
+libosmo-mgcp-client    remove public API       These public API items have not 
been called by any of our osmo-programs
+                                               for many years. Any sane caller 
of libosmo-mgcp-client should use the
+                                               higher level osmo_mgcpc_* API 
instead. Move these to a private header:
+                                               struct mgcp_response_head
+                                               struct mgcp_response
+                                               struct mgcp_msg
+                                               mgcp_response_parse_params()
+                                               mgcp_client_tx()
+                                               mgcp_client_cancel()
+                                               mgcp_msg_gen()
+                                               mgcp_msg_trans_id()
diff --git a/include/osmocom/mgcp_client/mgcp_client.h 
b/include/osmocom/mgcp_client/mgcp_client.h
index 9a0611a..a96ae19 100644
--- a/include/osmocom/mgcp_client/mgcp_client.h
+++ b/include/osmocom/mgcp_client/mgcp_client.h
@@ -79,28 +79,6 @@
        unsigned int pt;
 };

-struct mgcp_response_head {
-       int response_code;
-       mgcp_trans_id_t trans_id;
-       char comment[MGCP_COMMENT_MAXLEN];
-       char conn_id[MGCP_CONN_ID_MAXLEN];
-       char endpoint[MGCP_ENDPOINT_MAXLEN];
-       bool x_osmo_osmux_use;
-       uint8_t x_osmo_osmux_cid;
-};
-
-struct mgcp_response {
-       char *body;
-       struct mgcp_response_head head;
-       uint16_t audio_port;
-       char audio_ip[INET6_ADDRSTRLEN];
-       unsigned int ptime;
-       enum mgcp_codecs codecs[MGCP_MAX_CODECS];
-       unsigned int codecs_len;
-       struct ptmap ptmap[MGCP_MAX_CODECS];
-       unsigned int ptmap_len;
-};
-
 enum mgcp_verb {
        MGCP_VERB_CRCX,
        MGCP_VERB_MDCX,
@@ -109,37 +87,6 @@
        MGCP_VERB_RSIP,
 };

-#define MGCP_MSG_PRESENCE_ENDPOINT     0x0001
-#define MGCP_MSG_PRESENCE_CALL_ID      0x0002
-#define MGCP_MSG_PRESENCE_CONN_ID      0x0004
-#define MGCP_MSG_PRESENCE_AUDIO_IP     0x0008
-#define MGCP_MSG_PRESENCE_AUDIO_PORT   0x0010
-#define MGCP_MSG_PRESENCE_CONN_MODE    0x0020
-#define MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID 0x4000
-#define MGCP_MSG_PRESENCE_X_OSMO_IGN   0x8000
-
-struct mgcp_msg {
-       enum mgcp_verb verb;
-       /* See MGCP_MSG_PRESENCE_* constants */
-       uint32_t presence;
-       char endpoint[MGCP_ENDPOINT_MAXLEN];
-       unsigned int call_id;
-       char *conn_id;
-       uint16_t audio_port;
-       char *audio_ip;
-       enum mgcp_connection_mode conn_mode;
-       unsigned int ptime;
-       enum mgcp_codecs codecs[MGCP_MAX_CODECS];
-       unsigned int codecs_len;
-       struct ptmap ptmap[MGCP_MAX_CODECS];
-       unsigned int ptmap_len;
-       uint32_t x_osmo_ign;
-       bool x_osmo_osmux_use;
-       int x_osmo_osmux_cid; /* -1 is wildcard */
-       bool param_present;
-       struct mgcp_codec_param param;
-};
-
 struct mgcp_client_conf *mgcp_client_conf_alloc(void *ctx);
 void mgcp_client_conf_init(struct mgcp_client_conf *conf) 
OSMO_DEPRECATED_OUTSIDE_LIBOSMOMGCPCLIENT("use mgcp_client_conf_alloc() (or 
even better, switch to the mgcp_client_pool API!)");
 void mgcp_client_vty_init(void *talloc_ctx, int node, struct mgcp_client_conf 
*conf);
@@ -161,20 +108,8 @@
 const char *mgcp_client_e1_epname(void *ctx, const struct mgcp_client *mgcp, 
uint8_t trunk_id, uint8_t ts,
                                  uint8_t rate, uint8_t offset);

-/* Invoked when an MGCP response is received or sending failed.  When the
- * response is passed as NULL, this indicates failure during transmission. */
-typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void 
*priv);
-int mgcp_response_parse_params(struct mgcp_response *r);
-
-int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
-                  mgcp_response_cb_t response_cb, void *priv);
-int mgcp_client_cancel(struct mgcp_client *mgcp, mgcp_trans_id_t trans_id);
-
 enum mgcp_connection_mode;

-struct msgb *mgcp_msg_gen(struct mgcp_client *mgcp, struct mgcp_msg *mgcp_msg);
-mgcp_trans_id_t mgcp_msg_trans_id(struct msgb *msg);
-
 extern const struct value_string mgcp_client_connection_mode_strs[];
 static inline const char *mgcp_client_cmode_name(enum mgcp_connection_mode 
mode)
 {
diff --git a/include/osmocom/mgcp_client/mgcp_client_internal.h 
b/include/osmocom/mgcp_client/mgcp_client_internal.h
index d0ae76b..bea49cd 100644
--- a/include/osmocom/mgcp_client/mgcp_client_internal.h
+++ b/include/osmocom/mgcp_client/mgcp_client_internal.h
@@ -22,6 +22,32 @@
        bool conn_up;
 };

+struct mgcp_response_head {
+       int response_code;
+       mgcp_trans_id_t trans_id;
+       char comment[MGCP_COMMENT_MAXLEN];
+       char conn_id[MGCP_CONN_ID_MAXLEN];
+       char endpoint[MGCP_ENDPOINT_MAXLEN];
+       bool x_osmo_osmux_use;
+       uint8_t x_osmo_osmux_cid;
+};
+
+struct mgcp_response {
+       char *body;
+       struct mgcp_response_head head;
+       uint16_t audio_port;
+       char audio_ip[INET6_ADDRSTRLEN];
+       unsigned int ptime;
+       enum mgcp_codecs codecs[MGCP_MAX_CODECS];
+       unsigned int codecs_len;
+       struct ptmap ptmap[MGCP_MAX_CODECS];
+       unsigned int ptmap_len;
+};
+
+/* Invoked when an MGCP response is received or sending failed.  When the
+ * response is passed as NULL, this indicates failure during transmission. */
+typedef void (* mgcp_response_cb_t )(struct mgcp_response *response, void 
*priv);
+
 struct mgcp_response_pending {
        struct llist_head entry;

@@ -37,3 +63,43 @@
                                        mgcp_trans_id_t trans_id,
                                        mgcp_response_cb_t response_cb,
                                        void *priv);
+
+#define MGCP_MSG_PRESENCE_ENDPOINT     0x0001
+#define MGCP_MSG_PRESENCE_CALL_ID      0x0002
+#define MGCP_MSG_PRESENCE_CONN_ID      0x0004
+#define MGCP_MSG_PRESENCE_AUDIO_IP     0x0008
+#define MGCP_MSG_PRESENCE_AUDIO_PORT   0x0010
+#define MGCP_MSG_PRESENCE_CONN_MODE    0x0020
+#define MGCP_MSG_PRESENCE_X_OSMO_OSMUX_CID 0x4000
+#define MGCP_MSG_PRESENCE_X_OSMO_IGN   0x8000
+
+struct mgcp_msg {
+       enum mgcp_verb verb;
+       /* See MGCP_MSG_PRESENCE_* constants */
+       uint32_t presence;
+       char endpoint[MGCP_ENDPOINT_MAXLEN];
+       unsigned int call_id;
+       char *conn_id;
+       uint16_t audio_port;
+       char *audio_ip;
+       enum mgcp_connection_mode conn_mode;
+       unsigned int ptime;
+       enum mgcp_codecs codecs[MGCP_MAX_CODECS];
+       unsigned int codecs_len;
+       struct ptmap ptmap[MGCP_MAX_CODECS];
+       unsigned int ptmap_len;
+       uint32_t x_osmo_ign;
+       bool x_osmo_osmux_use;
+       int x_osmo_osmux_cid; /* -1 is wildcard */
+       bool param_present;
+       struct mgcp_codec_param param;
+};
+
+int mgcp_response_parse_params(struct mgcp_response *r);
+
+int mgcp_client_tx(struct mgcp_client *mgcp, struct msgb *msg,
+                  mgcp_response_cb_t response_cb, void *priv);
+int mgcp_client_cancel(struct mgcp_client *mgcp, mgcp_trans_id_t trans_id);
+
+struct msgb *mgcp_msg_gen(struct mgcp_client *mgcp, struct mgcp_msg *mgcp_msg);
+mgcp_trans_id_t mgcp_msg_trans_id(struct msgb *msg);
diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c 
b/src/libosmo-mgcp-client/mgcp_client_fsm.c
index 432ad84..14aacd1 100644
--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -19,6 +19,7 @@
  */

 #include <osmocom/mgcp_client/mgcp_client.h>
+#include <osmocom/mgcp_client/mgcp_client_internal.h>
 #include <osmocom/mgcp_client/mgcp_client_fsm.h>
 #include <osmocom/core/utils.h>
 #include <osmocom/core/fsm.h>

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/35246?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I6d8bdda5c2ffa236e94a0b6111de4dbfac923187
Gerrit-Change-Number: 35246
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to