[osmo-bts PATCH 1/2] oml: Add support com.ipacces and org.osmocom manufacturer type

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/OpenBSC@lists.osmocom.org/.

Alvaro Neira Ayuso anayuso at sysmocom.de
Tue May 20 16:16:56 UTC 2014


From: Álvaro Neira Ayuso <anayuso at sysmocom.de>

This patch allows to add the osmocom manufacturer id label in the
manufacturer message. Before of this patch, everytime we have added
ipaccess because we had only one kind of manufacturer message.

And I have moved the code that we have used for adding this manufacturer ID
label to the function oml_fom_ack_nack because we only add the manufacturer
Id label in this function now.

Signed-off-by: Alvaro Neira Ayuso <anayuso at sysmocom.de>
---
 src/common/oml.c |   27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/common/oml.c b/src/common/oml.c
index b7c12f7..42e4e80 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -93,6 +93,7 @@ static struct tlv_definition abis_nm_att_tlvdef_ipa = {
 
 /* ip.access nanoBTS specific commands */
 static const char ipaccess_magic[] = "com.ipaccess";
+static const char osmocom_magic[] = "org.osmocom";
 static int oml_ipa_set_attr(struct gsm_bts *bts, struct msgb *msg);
 
 /*
@@ -163,13 +164,6 @@ int oml_send_msg(struct msgb *msg, int is_manuf)
 {
 	struct abis_om_hdr *omh;
 
-	if (is_manuf) {
-		/* length byte, string + 0 termination */
-		uint8_t *manuf = msgb_push(msg, 1 + sizeof(ipaccess_magic));
-		manuf[0] = strlen(ipaccess_magic)+1;
-		memcpy(manuf+1, ipaccess_magic, strlen(ipaccess_magic));
-	}
-
 	/* Push the main OML header and send it off */
 	omh = (struct abis_om_hdr *) msgb_push(msg, sizeof(*omh));
 	if (is_manuf)
@@ -321,6 +315,7 @@ int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause)
 	struct msgb *msg;
 	struct abis_om_fom_hdr *foh;
 	int is_manuf = 0;
+	uint8_t *manuf;
 
 	msg = oml_msgb_alloc();
 	if (!msg)
@@ -349,6 +344,24 @@ int oml_fom_ack_nack(struct msgb *old_msg, uint8_t cause)
 		foh->msg_type++; /* ack */
 	}
 
+	if (is_manuf) {
+		if (strncmp(osmocom_magic, (const char *)old_oh->data + 1,
+			    sizeof(osmocom_magic)) == 0) {
+			manuf = msgb_push(msg, 1 + sizeof(osmocom_magic));
+			manuf[0] = sizeof(osmocom_magic);
+			memcpy(manuf+1, osmocom_magic, sizeof(osmocom_magic));
+		} else if (strncmp(ipaccess_magic,
+				   (const char *)old_oh->data + 1,
+			    sizeof(ipaccess_magic)) == 0) {
+			manuf = msgb_push(msg, 1 + sizeof(ipaccess_magic));
+			manuf[0] = sizeof(ipaccess_magic);
+			memcpy(manuf+1, ipaccess_magic, sizeof(ipaccess_magic));
+		} else {
+			LOGP(DOML, LOGL_ERROR, "Unknown manufacturer label.\n");
+			return -1;
+		}
+	}
+
 	return oml_send_msg(msg, is_manuf);
 }
 
-- 
1.7.10.4





More information about the OpenBSC mailing list