Change in osmo-mgw[master]: mgcp_endp: add function to claim an endpoint

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

dexter gerrit-no-reply at lists.osmocom.org
Mon Jul 6 17:24:41 UTC 2020


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-mgw/+/19166 )


Change subject: mgcp_endp: add function to claim an endpoint
......................................................................

mgcp_endp: add function to claim an endpoint

At the moment where the first CRCX writes the CALLID to the endp struct
the endpoint is marked as "serving a call", which could also be
described as a "claimed" state. Lets have a function to do that. This
way we also create an entry point where the endpoint could call some
type specific initalization functions.

Change-Id: I402ac43dffd2c85789e4f0308a540e227063cc28
Related: OS#2659
---
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/mgcp_endp.c
M src/libosmo-mgcp/mgcp_protocol.c
3 files changed, 15 insertions(+), 1 deletion(-)



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

diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index 879947b..22a1b81 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -109,6 +109,7 @@
 
 struct mgcp_endpoint *mgcp_endp_alloc(struct mgcp_trunk *trunk, unsigned int index);
 void mgcp_endp_release(struct mgcp_endpoint *endp);
+void mgcp_endp_claim(struct mgcp_endpoint *endp, const char *callid);
 struct mgcp_endpoint *mgcp_endp_by_name_trunk(int *cause, const char *epname,
 					      const struct mgcp_trunk *trunk);
 struct mgcp_endpoint *mgcp_endp_by_name(int *cause, const char *epname,
diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index eac5832..d745aff 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -151,6 +151,19 @@
 	endp->wildcarded_req = false;
 }
 
+/*! claim endpoint, sets callid and initializes endpoint.
+ *  \param[in] endp endpoint to release */
+void mgcp_endp_claim(struct mgcp_endpoint *endp, const char *callid)
+{
+	/* TODO: Make this function more intelligent, it should run the
+	 * call id checks we currently have in protocol.c directly here. */
+
+	/* Set the callid, creation of another connection will only be possible
+	 * when the callid matches up. (Connections are distinguished by their
+	 * connection ids) */
+	endp->callid = talloc_strdup(endp, callid);
+}
+
 /* Check if the endpoint name contains the prefix (e.g. "rtpbridge/" or
  * "ds/e1-") and write the epname without the prefix back to the memory
  * pointed at by epname. (per trunk the prefix is the same for all endpoints,
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index f2fc20c..5d9509a 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -855,7 +855,7 @@
 	/* Set the callid, creation of another connection will only be possible
 	 * when the callid matches up. (Connections are distinguished by their
 	 * connection ids) */
-	endp->callid = talloc_strdup(trunk->endpoints, callid);
+	mgcp_endp_claim(endp, callid);
 
 	snprintf(conn_name, sizeof(conn_name), "%s", callid);
 	_conn = mgcp_conn_alloc(trunk->endpoints, endp, MGCP_CONN_TYPE_RTP, conn_name);

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I402ac43dffd2c85789e4f0308a540e227063cc28
Gerrit-Change-Number: 19166
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200706/da972885/attachment.htm>


More information about the gerrit-log mailing list