aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÁlvaro Neira Ayuso <anayuso@sysmocom.de>2014-05-23 12:06:56 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-25 13:41:08 +0200
commit72e9bc9edb32e4945855a8d5e8776627e89cc604 (patch)
tree62d1cd71ba379f051c624d1931ec30922a769714
parent399b3fe1b4ab1a8d78ef5bf39d185b3defdf1b5e (diff)
sysmobts: Move the function add_manufacturer_label_id to oml filesysmocom/sysmobts2050/oml-alert-wip
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
-rw-r--r--include/osmo-bts/oml.h2
-rw-r--r--src/common/oml.c23
-rw-r--r--src/osmo-bts-sysmo/Makefile.am2
-rw-r--r--src/osmo-bts-sysmo/misc/sysmobts_misc.c5
-rw-r--r--src/osmo-bts-sysmo/utils.c21
5 files changed, 30 insertions, 23 deletions
diff --git a/include/osmo-bts/oml.h b/include/osmo-bts/oml.h
index 242f5ec..a901559 100644
--- a/include/osmo-bts/oml.h
+++ b/include/osmo-bts/oml.h
@@ -10,6 +10,8 @@ enum oml_message_type {
int oml_init(void);
int down_oml(struct gsm_bts *bts, struct msgb *msg);
+int oml_add_manufacturer_id_label(struct msgb *msg,
+ enum oml_message_type vendor_type);
int oml_check_manuf(struct abis_om_hdr *hdr, size_t msg_size);
int oml_check_msg(struct msgb *msg);
diff --git a/src/common/oml.c b/src/common/oml.c
index 6cb8e56..3f7f472 100644
--- a/src/common/oml.c
+++ b/src/common/oml.c
@@ -160,6 +160,29 @@ struct msgb *oml_msgb_alloc(void)
return msgb_alloc_headroom(1024, 128, "OML");
}
+int oml_add_manufacturer_id_label(struct msgb *msg,
+ enum oml_message_type vendor_type)
+{
+ uint8_t *manuf;
+
+ switch (vendor_type) {
+ case OML_MSG_TYPE_IPA:
+ manuf = msgb_push(msg, 1 + sizeof(ipaccess_magic));
+ manuf[0] = sizeof(ipaccess_magic);
+ memcpy(manuf+1, ipaccess_magic, sizeof(ipaccess_magic));
+ break;
+ case OML_MSG_TYPE_OSMO:
+ manuf = msgb_push(msg, 1 + sizeof(osmocom_magic));
+ manuf[0] = sizeof(osmocom_magic);
+ memcpy(manuf+1, osmocom_magic, sizeof(osmocom_magic));
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
+
int oml_check_manuf(struct abis_om_hdr *hdr, size_t msg_size)
{
if (msg_size < 1) {
diff --git a/src/osmo-bts-sysmo/Makefile.am b/src/osmo-bts-sysmo/Makefile.am
index de70761..2273f4b 100644
--- a/src/osmo-bts-sysmo/Makefile.am
+++ b/src/osmo-bts-sysmo/Makefile.am
@@ -24,7 +24,7 @@ sysmobts_mgr_SOURCES = \
misc/sysmobts_mgr.c misc/sysmobts_misc.c \
misc/sysmobts_par.c misc/sysmobts_nl.c utils.c \
misc/sysmobts_mgr_vty.c
-sysmobts_mgr_LDADD = $(COMMON_LDADD)
+sysmobts_mgr_LDADD = $(top_builddir)/src/common/libbts.a $(COMMON_LDADD)
sysmobts_util_SOURCES = misc/sysmobts_util.c misc/sysmobts_par.c
sysmobts_util_LDADD = $(LIBOSMOCORE_LIBS)
diff --git a/src/osmo-bts-sysmo/misc/sysmobts_misc.c b/src/osmo-bts-sysmo/misc/sysmobts_misc.c
index 06f0c4c..00f3bb9 100644
--- a/src/osmo-bts-sysmo/misc/sysmobts_misc.c
+++ b/src/osmo-bts-sysmo/misc/sysmobts_misc.c
@@ -41,6 +41,9 @@
#include <osmocom/gsm/abis_nm.h>
#include <osmocom/gsm/protocol/ipaccess.h>
+#include <osmo-bts/bts.h>
+#include <osmo-bts/oml.h>
+
#include "utils.h"
#include "btsconfig.h"
#include "sysmobts_misc.h"
@@ -98,7 +101,7 @@ static void add_oml_hdr_msg(struct msgb *msg, uint8_t msg_type,
foh->obj_inst.ts_nr = ts_nr;
if (is_manuf)
- add_manufacturer_id_label(msg, MANUF_ID_OSMO);
+ oml_add_manufacturer_id_label(msg, MANUF_ID_OSMO);
msg->l2h = msgb_push(msg, sizeof(*omh));
omh = (struct abis_om_hdr *) msg->l2h;
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index bd75c81..760c97b 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -187,24 +187,3 @@ int check_ipa_header(struct msgb *msg)
return 0;
}
-
-int add_manufacturer_id_label(struct msgb *msg, enum manuf_type_id type_id)
-{
- uint8_t *manuf;
-
- switch (type_id) {
- case MANUF_ID_IPA:
- manuf = msgb_push(msg, 1 + sizeof(ipaccess_magic));
- manuf[0] = sizeof(ipaccess_magic);
- memcpy(manuf+1, ipaccess_magic, sizeof(ipaccess_magic));
- break;
- case MANUF_ID_OSMO:
- manuf = msgb_push(msg, 1 + sizeof(osmocom_magic));
- manuf[0] = sizeof(osmocom_magic);
- memcpy(manuf+1, osmocom_magic, sizeof(osmocom_magic));
- break;
- default:
- return -1;
- }
- return 0;
-}