aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-sysmo/utils.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-25 13:42:13 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-05-25 13:48:33 +0200
commit0e2b6244184a1c030252667765a0587073575d23 (patch)
tree3e9a850e6ea4ac59f1e10c7694d280a5fd3811ba /src/osmo-bts-sysmo/utils.c
parent7996134d2afb8098eb750433b20185bde21e0023 (diff)
sysmobts: Revert all sysmobts-mgr related changes
Harald is right and that the code is generally not ready for inclusion. I fell victim of trying to finish it while the code is not ready at all. It is better to re-introduce the patches in a smaller and more tested way. The right way would have been a branch were ready things are split-off the main/wip commit until everything is ready. Revert "sysmobts: Have a common prefix for the enum" This reverts commit 44980347f308fe5bbe48a933dbc81b82b53d310a. Revert "utils: Used the enum manuf_type_id in the parameter of add_manufacturer_id_label" This reverts commit 7d36e5ed46b630203167fc9d5d28e0087fdbd394. Revert "utils: Classify the OML message using the return type" This reverts commit afee0b7929a00500f9c204f3bc7e12f72451e832. Revert "sysmobts: Do not access out of bound string" This reverts commit f5f41e805195c8c3294a9e6a68b10f975fbabbbd. Revert "sysmobts: Separate IPA and OML check into two methods" This reverts commit 13a224063dfcee0be529fba1c8fb9be9c1fb261e. Revert "screenrc: osmobts-mgr now needs a config file" This reverts commit 0a1699ff8a5462c167c24e8b28186abb26331698. Revert "make sure osmobts-mgr.cfg file is included in tarballs" This reverts commit 14c60b425f8146f6a392d2d3de2979c817cd975e. Revert "sysmobts-mgr: Add VTY support for configuring it" This reverts commit c5fedd24c96a4ef6d7a0c0ed3c70d6ef0abd5c17. Revert "sysmobts: Add beginnings of an OML router and create Failure Messages in the sysmobts-manager" This reverts commit c6ab90b27006ff2d1fdfb0b1d7fc01e1dd4a696d.
Diffstat (limited to 'src/osmo-bts-sysmo/utils.c')
-rw-r--r--src/osmo-bts-sysmo/utils.c166
1 files changed, 0 insertions, 166 deletions
diff --git a/src/osmo-bts-sysmo/utils.c b/src/osmo-bts-sysmo/utils.c
index 01e6f973..af1e5d29 100644
--- a/src/osmo-bts-sysmo/utils.c
+++ b/src/osmo-bts-sysmo/utils.c
@@ -27,9 +27,6 @@
#include <osmo-bts/gsm_data.h>
#include <osmo-bts/logging.h>
-#include <osmocom/core/msgb.h>
-#include <osmocom/gsm/protocol/ipaccess.h>
-
#include "femtobts.h"
#include "l1_if.h"
@@ -150,166 +147,3 @@ int sysmobts_get_power_trx(struct gsm_bts_trx *trx)
return power_transmitter;
}
-
-void prepend_oml_ipa_header(struct msgb *msg)
-{
- struct ipaccess_head *hh;
-
- hh = (struct ipaccess_head *) msgb_push(msg, sizeof(*hh));
- hh->proto = IPAC_PROTO_OML;
- hh->len = htons(msg->len - sizeof(struct ipaccess_head));
-}
-
-/**
- * \brief Check that the data in \param msg is a proper OML message
- *
- * This function verifies that the data in \param in msg is a proper
- * OML message and can be handled by later functions. In the successful
- * case the msg->l2h will now point to the OML header and the msg->l3h
- * will point to the FOM header. The value of l2h/l3h is undefined in
- * case the verification of the \param msg is failing.
- *
- * \param msg The message to analyze. msg->len starting from msg->data
- * will be analyzed.
- * \return This function returns the msg with the l2h/l3h pointers in the right
- * direction on success and on failure, in the case that the msg doesn't contain
- * the OML header or the OML header values aren't the expect, the function
- * doesn't set the l2h and l3h. In the case that the msg don't contains the FOM
- * header or the FOM header values aren't the expect, the function set the l2h
- * but doesn't set the l3h.
- */
-
-int check_oml_msg(struct msgb *msg)
-{
- struct abis_om_hdr *omh;
- int abis_oml_hdr_len;
- char label_id[255];
-
- abis_oml_hdr_len = sizeof(struct abis_om_hdr);
-
- if (msg->len < abis_oml_hdr_len) {
- LOGP(DL1C, LOGL_ERROR, "Om header insufficient space %d %d\n",
- msg->len, abis_oml_hdr_len);
- return -1;
- }
-
- msg->l2h = msg->data;
-
- omh = (struct abis_om_hdr *) msg->l2h;
-
- if (omh->mdisc != ABIS_OM_MDISC_FOM &&
- omh->mdisc != ABIS_OM_MDISC_MANUF) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect om mdisc value %x\n",
- omh->mdisc);
- return -1;
- }
-
- if (omh->placement != ABIS_OM_PLACEMENT_ONLY) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect om placement value %x %x\n",
- omh->placement, ABIS_OM_PLACEMENT_ONLY);
- return -1;
- }
-
- if (omh->sequence != 0) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect om sequence value %d\n",
- omh->sequence);
- return -1;
- }
-
- if (omh->length != sizeof(struct abis_om_fom_hdr)) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect om length value %d %d\n",
- omh->length, sizeof(struct abis_om_fom_hdr));
- return -1;
- }
-
- if (omh->mdisc == ABIS_OM_MDISC_MANUF) {
- abis_oml_hdr_len += sizeof(ipaccess_magic);
-
- if (msg->len < abis_oml_hdr_len) {
- LOGP(DL1C, LOGL_ERROR,
- "ID manuf label insufficient space %d %d\n",
- msg->len, abis_oml_hdr_len);
- return -1;
- }
- }
-
- abis_oml_hdr_len += sizeof(struct abis_om_fom_hdr);
-
- if (msg->len < abis_oml_hdr_len) {
- LOGP(DL1C, LOGL_ERROR, "Fom header insufficient space %d %d\n",
- msg->len, abis_oml_hdr_len);
- return -1;
- }
-
- msg->l3h = msg->data + sizeof(struct abis_om_hdr);
-
- if (omh->mdisc == ABIS_OM_MDISC_MANUF) {
- strncpy(label_id, (const char *) msg->l3h + 1,
- sizeof(ipaccess_magic));
-
- if (strncmp(ipaccess_magic, label_id,
- sizeof(ipaccess_magic)) == 0) {
- msg->l3h = msg->l3h + sizeof(ipaccess_magic) + 1;
- return OML_MSG_TYPE_IPA;
- } else if (strncmp(osmocom_magic, label_id,
- sizeof(osmocom_magic)) == 0) {
- msg->l3h = msg->l3h + sizeof(osmocom_magic) + 1;
- return OML_MSG_TYPE_OSMO;
- } else {
- msg->l3h = NULL;
- LOGP(DL1C, LOGL_ERROR,
- "Manuf Label Unknown %s\n", label_id);
- return -1;
- }
- }
-
- return OML_MSG_TYPE_ETSI;
-}
-
-int check_ipa_header(struct msgb *msg)
-{
- struct ipaccess_head *hh;
-
- if (msg->len < sizeof(struct ipaccess_head)) {
- LOGP(DL1C, LOGL_ERROR, "Ipa header insufficient space %d %d\n",
- msg->len, sizeof(struct ipaccess_head));
- return -1;
- }
-
- hh = (struct ipaccess_head *)msg->data;
-
- if (hh->proto != IPAC_PROTO_OML) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect ipa header protocol %x %x\n",
- hh->proto, IPAC_PROTO_OML);
- return -1;
- }
-
- if (ntohs(hh->len) != msg->len - sizeof(struct ipaccess_head)) {
- LOGP(DL1C, LOGL_ERROR, "Incorrect ipa header msg size %d %d\n",
- ntohs(hh->len), msg->len - sizeof(struct ipaccess_head));
- return -1;
- }
-
- 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;
-}