Encode the network name int the MM info messages in GSM 7bit alphabet.
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 98f2d56..03fe010 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -35,6 +35,7 @@
#include <openbsc/tlv.h>
#include <openbsc/debug.h>
#include <openbsc/gsm_data.h>
+#include <openbsc/gsm_utils.h>
#include <openbsc/gsm_subscriber.h>
#include <openbsc/gsm_04_11.h>
#include <openbsc/gsm_04_08.h>
@@ -1335,7 +1336,7 @@
struct gsm_network *net = lchan->ts->trx->bts->network;
u_int8_t *ptr8;
u_int16_t *ptr16;
- int name_len;
+ int name_len, name_pad;
int i;
#if 0
time_t cur_t;
@@ -1350,6 +1351,7 @@
gh->msg_type = GSM48_MT_MM_INFO;
if (net->name_long) {
+#if 0
name_len = strlen(net->name_long);
/* 10.5.3.5a */
ptr8 = msgb_put(msg, 3);
@@ -1363,9 +1365,24 @@
/* FIXME: Use Cell Broadcast, not UCS-2, since
* UCS-2 is only supported by later revisions of the spec */
+#endif
+ name_len = (strlen(net->name_long)*7)/8;
+ name_pad = (8 - strlen(net->name_long)*7)%8;
+ if (name_pad > 0)
+ name_len++;
+ /* 10.5.3.5a */
+ ptr8 = msgb_put(msg, 3);
+ ptr8[0] = GSM48_IE_NAME_LONG;
+ ptr8[1] = name_len +1;
+ ptr8[2] = 0x80 | name_pad; /* Cell Broadcast DCS, no CI */
+
+ ptr8 = msgb_put(msg, name_len);
+ gsm_7bit_encode(ptr8, net->name_long);
+
}
if (net->name_short) {
+#if 0
name_len = strlen(net->name_short);
/* 10.5.3.5a */
ptr8 = (u_int8_t *) msgb_put(msg, 3);
@@ -1376,6 +1393,20 @@
ptr16 = (u_int16_t *) msgb_put(msg, name_len*2);
for (i = 0; i < name_len; i++)
ptr16[i] = htons(net->name_short[i]);
+#endif
+ name_len = (strlen(net->name_short)*7)/8;
+ name_pad = (8 - strlen(net->name_short)*7)%8;
+ if (name_pad > 0)
+ name_len++;
+ /* 10.5.3.5a */
+ ptr8 = (u_int8_t *) msgb_put(msg, 3);
+ ptr8[0] = GSM48_IE_NAME_SHORT;
+ ptr8[1] = name_len +1;
+ ptr8[2] = 0x80 | name_pad; /* Cell Broadcast DCS, no CI */
+
+ ptr8 = msgb_put(msg, name_len);
+ gsm_7bit_encode(ptr8, net->name_short);
+
}
#if 0
@@ -1397,6 +1428,8 @@
ptr8[7] |= 0x80;
#endif
+ DEBUGP(DMM, "-> MM INFO\n");
+
return gsm48_sendmsg(msg, NULL);
}