aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2014-12-29 17:09:11 +0100
committerHarald Welte <laforge@gnumonks.org>2014-12-29 17:09:11 +0100
commit783d073a370191cdb9cba0f205ded50459663500 (patch)
tree4a439940c51f54ad69852b471594b98deb598482 /src
parenta19717a7c50dededf0c8ec8ccb347c1c5d019382 (diff)
add gsm0341_test to generate SMSCB hex strings
Those hex strings can then be copy+pasted into the OSmoNITB VTY
Diffstat (limited to 'src')
-rw-r--r--src/gsm/Makefile.am2
-rw-r--r--src/gsm/gsm0341.c56
-rw-r--r--src/gsm/libosmogsm.map2
3 files changed, 59 insertions, 1 deletions
diff --git a/src/gsm/Makefile.am b/src/gsm/Makefile.am
index 828aa50..f119a74 100644
--- a/src/gsm/Makefile.am
+++ b/src/gsm/Makefile.am
@@ -20,7 +20,7 @@ libosmogsm_la_SOURCES = a5.c rxlev_stat.c tlv_parser.c comp128.c comp128v23.c \
auth_core.c auth_comp128v1.c auth_comp128v23.c \
auth_milenage.c milenage/aes-encblock.c \
milenage/aes-internal.c milenage/aes-internal-enc.c \
- milenage/milenage.c gan.c ipa.c
+ milenage/milenage.c gan.c ipa.c gsm0341.c
libosmogsm_la_LDFLAGS = $(LTLDFLAGS_OSMOGSM) -version-info $(LIBVERSION) -no-undefined
libosmogsm_la_LIBADD = $(top_builddir)/src/libosmocore.la
diff --git a/src/gsm/gsm0341.c b/src/gsm/gsm0341.c
new file mode 100644
index 0000000..c6526c2
--- /dev/null
+++ b/src/gsm/gsm0341.c
@@ -0,0 +1,56 @@
+/*
+ * (C) 2014 by Harald Welte <laforge@gnumonks.org>
+ * All Rights Reserved
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ */
+
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <osmocom/core/talloc.h>
+#include <osmocom/gsm/protocol/gsm_03_41.h>
+
+struct gsm341_ms_message *
+gsm0341_build_msg(void *ctx, uint8_t geo_scope, uint8_t msg_code,
+ uint8_t update, uint16_t msg_id, uint8_t dcs,
+ uint8_t page_total, uint8_t page_cur,
+ uint8_t *data, uint8_t len)
+{
+ struct gsm341_ms_message *cbmsg;
+
+ if (len > 88)
+ return NULL;
+
+ cbmsg = talloc_zero_size(ctx, sizeof(*cbmsg)+len);
+ if (!cbmsg)
+ return NULL;
+
+ cbmsg->serial.code_hi = (msg_code >> 4) & 0xF;
+ cbmsg->serial.gs = geo_scope;
+ cbmsg->serial.update = update;
+ cbmsg->serial.code_lo = msg_code & 0xF;
+ cbmsg->msg_id = msg_id;
+ cbmsg->dcs.group = dcs >> 4;
+ cbmsg->dcs.language = dcs & 0xF;
+ cbmsg->page.total = page_total;
+ cbmsg->page.current = page_cur;
+ memcpy(cbmsg->data, data, len);
+
+ return cbmsg;
+}
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index d82c8a0..02c8884 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -38,6 +38,8 @@ gprs_cipher_supported;
gprs_tlli_type;
gprs_tmsi2tlli;
+gsm0341_build_msg;
+
gsm0480_create_notifySS;
gsm0480_create_unstructuredSS_Notify;
gsm0480_create_ussd_resp;