Change in osmo-mgw[master]: mgcp_endp: make wildcarded detection separate

laforge gerrit-no-reply at lists.osmocom.org
Wed Jul 14 19:17:01 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/24939 )

Change subject: mgcp_endp: make wildcarded detection separate
......................................................................

mgcp_endp: make wildcarded detection separate

osmo-mgw currently does only a very simple detection method for
wildcarded requests, but it makes sense to split this detection
off into a separate function so that it can be used from different code
locations and we still have it at one place only.

Change-Id: I27018c01afb8acabfcf5d435c996cc9806e52d6b
Related: SYS#5535
---
M include/osmocom/mgcp/mgcp_endp.h
M src/libosmo-mgcp/mgcp_endp.c
2 files changed, 14 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved



diff --git a/include/osmocom/mgcp/mgcp_endp.h b/include/osmocom/mgcp/mgcp_endp.h
index 8d19b44..db1a897 100644
--- a/include/osmocom/mgcp/mgcp_endp.h
+++ b/include/osmocom/mgcp/mgcp_endp.h
@@ -134,6 +134,7 @@
 void mgcp_endp_release(struct mgcp_endpoint *endp);
 int mgcp_endp_claim(struct mgcp_endpoint *endp, const char *callid);
 void mgcp_endp_update(struct mgcp_endpoint *endp);
+bool mgcp_endp_is_wildcarded(const char *epname);
 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 9ebdd8e..ddfd6cf 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -237,6 +237,18 @@
 	return NULL;
 }
 
+/*! Check if the given epname refers to a wildcarded request or to a specific
+ *  endpoint.
+ *  \param[in] epname endpoint name to check
+ *  \returns true if epname refers to wildcarded request, else false. */
+bool mgcp_endp_is_wildcarded(const char *epname)
+{
+	if (strstr(epname, "*"))
+		return true;
+
+	return false;
+}
+
 /*! Find an endpoint by its name on a specified trunk.
  *  \param[out] cause pointer to store cause code, can be NULL.
  *  \param[in] epname endpoint name to lookup.
@@ -253,7 +265,7 @@
 	/* At the moment we only support a primitive ('*'-only) method of
 	 * wildcarded endpoint searches that picks the next free endpoint on
 	 * a trunk. */
-	if (strstr(epname, "*")) {
+	if (mgcp_endp_is_wildcarded(epname)) {
 		endp = find_free_endpoint(trunk);
 		if (endp) {
 			LOGPENDP(endp, DLMGCP, LOGL_DEBUG,

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I27018c01afb8acabfcf5d435c996cc9806e52d6b
Gerrit-Change-Number: 24939
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210714/20d54b59/attachment.htm>


More information about the gerrit-log mailing list