Change in osmo-mgw[master]: endp: add name generator function for E1 endpoints

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
Tue Jun 9 14:26:41 UTC 2020


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


Change subject: endp: add name generator function for E1 endpoints
......................................................................

endp: add name generator function for E1 endpoints

Currently the endpoint name that is generated for an E1 endpoint is not
correct. Lets add an endpoint name generator function that derives a
full endpoint name for a given E1 index

Change-Id: I70e0c3f96aa3947165f9926666815ee5614c8f57
Related: OS#2547
---
M src/libosmo-mgcp/mgcp_endp.c
1 file changed, 23 insertions(+), 4 deletions(-)



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

diff --git a/src/libosmo-mgcp/mgcp_endp.c b/src/libosmo-mgcp/mgcp_endp.c
index e357010..0eeda08 100644
--- a/src/libosmo-mgcp/mgcp_endp.c
+++ b/src/libosmo-mgcp/mgcp_endp.c
@@ -41,6 +41,26 @@
 		 MGCP_ENDPOINT_PREFIX_VIRTUAL_TRUNK, index, domain);
 }
 
+/* Generate E1 endpoint name from given numeric parameters */
+static void gen_e1_epname(char *epname, uint8_t trunk_nr, uint8_t ts_nr,
+			  uint8_t ss_nr)
+{
+	static const uint8_t rates[] =
+	    { 32, 32, 16, 16, 16, 16, 8, 8, 8, 8, 8, 8, 8, 8 };
+	static const uint8_t offsets[] =
+	    { 0, 4, 0, 2, 4, 6, 0, 1, 2, 3, 4, 5, 6, 7 };
+	unsigned int rate;
+	unsigned int offset;
+
+	OSMO_ASSERT(ss_nr < sizeof(rates));
+
+	rate = rates[ss_nr];
+	offset = offsets[ss_nr];
+
+	snprintf(epname, MGCP_ENDPOINT_MAXLEN, "%s%u/s-%u/su%u-%u",
+		 MGCP_ENDPOINT_PREFIX_E1_TRUNK, trunk_nr, ts_nr, rate, offset);
+}
+
 /*! allocate an endpoint and set default values.
  *  \param[in] trunk configuration
  *  \returns endpoint on success, NULL on failure */
@@ -64,10 +84,9 @@
 		gen_virtual_epname(ep_name_buf, trunk->cfg->domain, index);
 		break;
 	case MGCP_TRUNK_E1:
-		/* FIXME: E1 trunk implementation is work in progress, this endpoint
-		 * name is incomplete (subslots) */
-		snprintf(ep_name_buf, sizeof(ep_name_buf), "%s-1/%x",
-			 MGCP_ENDPOINT_PREFIX_E1_TRUNK, index);
+		gen_e1_epname(ep_name_buf, trunk->trunk_nr, index / 14, index % 14);
+
+		/* FIXME: remove this message when E1 support is complete */
 		LOGP(DLMGCP, LOGL_FATAL, "E1 trunks not implemented!\n");
 		break;
 	default:

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I70e0c3f96aa3947165f9926666815ee5614c8f57
Gerrit-Change-Number: 18745
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/20200609/6626b4af/attachment.htm>


More information about the gerrit-log mailing list