utils: Classify the OML message using the return type

Classify the OML message and return the manufacturer type
or an error. Currently ETSI, ip.access and Osmocom are known.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
This commit is contained in:
Álvaro Neira Ayuso 2014-05-20 07:42:24 +02:00 committed by Holger Hans Peter Freyther
parent f5f41e8051
commit afee0b7929
2 changed files with 13 additions and 5 deletions

View File

@ -248,12 +248,14 @@ int check_oml_msg(struct msgb *msg)
sizeof(ipaccess_magic));
if (strncmp(ipaccess_magic, label_id,
sizeof(ipaccess_magic)) == 0)
sizeof(ipaccess_magic)) == 0) {
msg->l3h = msg->l3h + sizeof(ipaccess_magic) + 1;
else if (strncmp(osmocom_magic, label_id,
sizeof(osmocom_magic)) == 0)
return OML_MSG_TYPE_IPA;
} else if (strncmp(osmocom_magic, label_id,
sizeof(osmocom_magic)) == 0) {
msg->l3h = msg->l3h + sizeof(osmocom_magic) + 1;
else {
return OML_MSG_TYPE_OSMO;
} else {
msg->l3h = NULL;
LOGP(DL1C, LOGL_ERROR,
"Manuf Label Unknown %s\n", label_id);
@ -261,7 +263,7 @@ int check_oml_msg(struct msgb *msg)
}
}
return 0;
return OML_MSG_TYPE_ETSI;
}
int check_ipa_header(struct msgb *msg)

View File

@ -21,6 +21,12 @@ enum manuf_type_id {
OSMOCOM_MANUF_ID,
};
enum oml_message_type {
OML_MSG_TYPE_ETSI,
OML_MSG_TYPE_IPA,
OML_MSG_TYPE_OSMO,
};
static const char osmocom_magic[] = "org.osmocom";
static const char ipaccess_magic[] = "com.ipaccess";