Review at  https://gerrit.osmocom.org/6244

ep: move endpoint struct and define to mgcp_ep.h

The endpoint and the define that computes the endpoint number is
defined in mgcp_internal.h. Since we have a dedicated module for
endpoint related code it makes sense to move the endpoint related
parts there.

- move struct mgcp_endpoint to mgcp_ep.h

- move #define ENDPOINT_NUMBER(endp) to mgcp_ep.h

Change-Id: Ibae55e1859bd41e2d1918eda433418b4bf8365fe
---
M include/osmocom/mgcp/mgcp_ep.h
M include/osmocom/mgcp/mgcp_internal.h
M src/libosmo-mgcp/mgcp_ep.c
M src/libosmo-mgcp/mgcp_msg.c
M src/libosmo-mgcp/mgcp_osmux.c
M src/libosmo-mgcp/mgcp_sdp.c
6 files changed, 40 insertions(+), 22 deletions(-)


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

diff --git a/include/osmocom/mgcp/mgcp_ep.h b/include/osmocom/mgcp/mgcp_ep.h
index 7b4ccee..2b7a5d6 100644
--- a/include/osmocom/mgcp/mgcp_ep.h
+++ b/include/osmocom/mgcp/mgcp_ep.h
@@ -60,4 +60,39 @@
 /*! static MGCP endpoint typeset (pre-initalized, read-only) */
 extern const struct mgcp_endpoint_typeset ep_typeset;
 
+/*! MGCP endpoint model */
+struct mgcp_endpoint {
+
+       /*!< Call identifier string (as supplied by the call agant) */
+       char *callid;
+
+       /*!< Local connection options (see mgcp_intermal.h) */
+       struct mgcp_lco local_options;
+
+       /*!< List with connections active on this endpoint */
+       struct llist_head conns;
+
+       /*!< Backpointer to the MGW configuration */
+       struct mgcp_config *cfg;
+
+       /*!< Backpointer to the Trunk specific configuration */
+       struct mgcp_trunk_config *tcfg;
+
+       /*!< Endpoint properties (see above) */
+       const struct mgcp_endpoint_type *type;
+
+       /*!< Last MGCP transmission (in case re-transmission is required) */
+       char *last_trans;
+
+       /*!< Last MGCP response (in case re-transmission is required) */
+       char *last_response;
+
+       /*!< Memorize if this endpoint was choosen by the MGW (wildcarded, true)
+        *   or if the user has choosen the particular endpoint explicitly. */
+       bool wildcarded_crcx;
+};
+
+/*! Extract endpoint number for a given endpoint */
+#define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
+
 void mgcp_release_endp(struct mgcp_endpoint *endp);
diff --git a/include/osmocom/mgcp/mgcp_internal.h 
b/include/osmocom/mgcp/mgcp_internal.h
index 5de28ee..e4009e8 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -245,29 +245,9 @@
 
 struct mgcp_endpoint_type;
 
-struct mgcp_endpoint {
-       char *callid;
-       struct mgcp_lco local_options;
-
-       struct llist_head conns;
-
-       /* backpointer */
-       struct mgcp_config *cfg;
-       struct mgcp_trunk_config *tcfg;
-
-       const struct mgcp_endpoint_type *type;
-
-       /* fields for re-transmission */
-       char *last_trans;
-       char *last_response;
-
-       /* Memorize if this endpoint was choosen by the MGW (wildcarded, true)
-        * or if the user has choosen the particular endpoint explicitly */
-       bool wildcarded_crcx;
-};
 
 
-#define ENDPOINT_NUMBER(endp) abs((int)(endp - endp->tcfg->endpoints))
+
 
 /**
  * Internal structure while parsing a request
diff --git a/src/libosmo-mgcp/mgcp_ep.c b/src/libosmo-mgcp/mgcp_ep.c
index e23d0f1..c2bf78e 100644
--- a/src/libosmo-mgcp/mgcp_ep.c
+++ b/src/libosmo-mgcp/mgcp_ep.c
@@ -21,8 +21,8 @@
  *
  */
 
-#include <osmocom/mgcp/mgcp_ep.h>
 #include <osmocom/mgcp/mgcp_internal.h>
+#include <osmocom/mgcp/mgcp_ep.h>
 
 /* Endpoint typeset definition */
 const struct mgcp_endpoint_typeset ep_typeset = {
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index 4055a0c..034b64f 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -28,6 +28,7 @@
 #include <osmocom/mgcp/mgcp_common.h>
 #include <osmocom/mgcp/mgcp_msg.h>
 #include <osmocom/mgcp/mgcp_conn.h>
+#include <osmocom/mgcp/mgcp_ep.h>
 
 /*! Display an mgcp message on the log output.
  *  \param[in] message mgcp message string
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index d0141f3..1bb7aa6 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -24,6 +24,7 @@
 #include <osmocom/mgcp/mgcp_internal.h>
 #include <osmocom/mgcp/osmux.h>
 #include <osmocom/mgcp/mgcp_conn.h>
+#include <osmocom/mgcp/mgcp_ep.h>
 
 static struct osmo_fd osmux_fd;
 
diff --git a/src/libosmo-mgcp/mgcp_sdp.c b/src/libosmo-mgcp/mgcp_sdp.c
index 666b8c2..1dffbfc 100644
--- a/src/libosmo-mgcp/mgcp_sdp.c
+++ b/src/libosmo-mgcp/mgcp_sdp.c
@@ -24,6 +24,7 @@
 #include <osmocom/mgcp/mgcp.h>
 #include <osmocom/mgcp/mgcp_internal.h>
 #include <osmocom/mgcp/mgcp_msg.h>
+#include <osmocom/mgcp/mgcp_ep.h>
 
 #include <errno.h>
 

-- 
To view, visit https://gerrit.osmocom.org/6244
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibae55e1859bd41e2d1918eda433418b4bf8365fe
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pma...@sysmocom.de>

Reply via email to