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
diff --git a/include/osmocom/mgcp/mgcp_ep.h b/include/osmocom/mgcp/mgcp_ep.h
index 915f542..2af4aee 100644
--- a/include/osmocom/mgcp/mgcp_ep.h
+++ b/include/osmocom/mgcp/mgcp_ep.h
@@ -50,4 +50,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 c0ee556..9c57e3f 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 68e36da..0b67ec8 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>