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);