aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-10-06 23:36:22 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-10-06 23:36:22 +0800
commit088601004cdd89a3c4b3f2856806fd95a7ca91cb (patch)
treebe7604971ee1ec7fc2bf28d0b8e6eb2628f597c7 /openbsc
parent55982ca9a73b29db09a711db70ff90f6f8f4ee0b (diff)
gsm_04_80: Require libosmocore for creating USSD messages
Use the libosmocore to create USSD messages, increase the minimum version of libosmocore, add header files, remove the code. Conflicts: openbsc/configure.in openbsc/include/openbsc/gsm_04_80.h openbsc/src/gsm_04_08.c openbsc/src/gsm_04_80.c
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/configure.in2
-rw-r--r--openbsc/include/openbsc/gsm_04_80.h6
-rw-r--r--openbsc/src/gsm_04_08.c1
-rw-r--r--openbsc/src/gsm_04_80.c140
4 files changed, 3 insertions, 146 deletions
diff --git a/openbsc/configure.in b/openbsc/configure.in
index 9e639ffb1..07a471dd8 100644
--- a/openbsc/configure.in
+++ b/openbsc/configure.in
@@ -15,7 +15,7 @@ dnl checks for libraries
AC_SEARCH_LIBS(crypt, crypt,
[LIBCRYPT="-lcrypt"; AC_DEFINE([VTY_CRYPT_PW], [], [Use crypt functionality of vty.])])
-PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.15)
+PKG_CHECK_MODULES(LIBOSMOCORE, libosmocore >= 0.1.22)
PKG_CHECK_MODULES(LIBOSMOSCCP, libosmo-sccp >= 0.0.3)
dnl checks for header files
diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h
index 41e8e11c0..83f327526 100644
--- a/openbsc/include/openbsc/gsm_04_80.h
+++ b/openbsc/include/openbsc/gsm_04_80.h
@@ -19,12 +19,6 @@ int gsm0480_send_ussd_response(const struct msgb *in_msg, const char* response_t
int gsm0480_send_ussd_reject(const struct msgb *msg,
const struct ussd_request *request);
-struct msgb *gsm0480_create_notifySS(const char *text);
-struct msgb *gsm0480_create_unstructuredSS_Notify(int alertLevel, const char *text);
-
-int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id);
-int gsm0480_wrap_facility(struct msgb *msg);
-
int gsm0480_send_ussdNotify(struct gsm_lchan *lchan, int level, const char *text);
int gsm0480_send_releaseComplete(struct gsm_lchan *lchan);
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 5c5c5c1a1..cc4714807 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -52,6 +52,7 @@
#include <openbsc/transaction.h>
#include <openbsc/ussd.h>
#include <openbsc/silent_call.h>
+#include <osmocore/gsm0480.h>
void *tall_locop_ctx;
diff --git a/openbsc/src/gsm_04_80.c b/openbsc/src/gsm_04_80.c
index e881a8763..39c1f95f3 100644
--- a/openbsc/src/gsm_04_80.c
+++ b/openbsc/src/gsm_04_80.c
@@ -36,6 +36,7 @@
#include <osmocore/gsm_utils.h>
#include <openbsc/gsm_04_08.h>
#include <openbsc/gsm_04_80.h>
+#include <osmocore/gsm0480.h>
/* Forward declarations */
static int parse_ussd(u_int8_t *ussd, struct ussd_request *req);
@@ -244,116 +245,6 @@ static int parse_process_uss_req(u_int8_t *uss_req_data, u_int8_t length,
return rc;
}
-struct msgb *gsm0480_create_notifySS(const char *text)
-{
- struct msgb *msg;
- uint8_t *data, *tmp_len;
- uint8_t *seq_len_ptr, *cal_len_ptr, *opt_len_ptr, *nam_len_ptr;
- int len;
-
- len = strlen(text);
- if (len < 1 || len > 160)
- return NULL;
-
- msg = gsm48_msgb_alloc();
- if (!msg)
- return NULL;
-
- msgb_put_u8(msg, GSM_0480_SEQUENCE_TAG);
- seq_len_ptr = msgb_put(msg, 1);
-
- /* ss_code for CNAP { */
- msgb_put_u8(msg, 0x81);
- msgb_put_u8(msg, 1);
- msgb_put_u8(msg, 0x19);
- /* } ss_code */
-
-
- /* nameIndicator { */
- msgb_put_u8(msg, 0xB4);
- nam_len_ptr = msgb_put(msg, 1);
-
- /* callingName { */
- msgb_put_u8(msg, 0xA0);
- opt_len_ptr = msgb_put(msg, 1);
- msgb_put_u8(msg, 0xA0);
- cal_len_ptr = msgb_put(msg, 1);
-
- /* namePresentationAllowed { */
- /* add the DCS value */
- msgb_put_u8(msg, 0x80);
- msgb_put_u8(msg, 1);
- msgb_put_u8(msg, 0x0F);
-
- /* add the lengthInCharacters */
- msgb_put_u8(msg, 0x81);
- msgb_put_u8(msg, 1);
- msgb_put_u8(msg, strlen(text));
-
- /* add the actual string */
- msgb_put_u8(msg, 0x82);
- tmp_len = msgb_put(msg, 1);
- data = msgb_put(msg, 0);
- len = gsm_7bit_encode(data, text);
- tmp_len[0] = len;
- msgb_put(msg, len);
-
- /* }; namePresentationAllowed */
-
- cal_len_ptr[0] = 3 + 3 + 2 + len;
- opt_len_ptr[0] = cal_len_ptr[0] + 2;
- /* }; callingName */
-
- nam_len_ptr[0] = opt_len_ptr[0] + 2;
- /* ); nameIndicator */
-
- /* write the lengths... */
- seq_len_ptr[0] = 3 + nam_len_ptr[0] + 2;
-
- return msg;
-}
-
-struct msgb *gsm0480_create_unstructuredSS_Notify(int alertPattern, const char *text)
-{
- struct msgb *msg;
- uint8_t *seq_len_ptr, *ussd_len_ptr, *data;
- int len;
-
- msg = gsm48_msgb_alloc();
- if (!msg)
- return NULL;
-
- /* SEQUENCE { */
- msgb_put_u8(msg, GSM_0480_SEQUENCE_TAG);
- seq_len_ptr = msgb_put(msg, 1);
-
- /* DCS { */
- msgb_put_u8(msg, ASN1_OCTET_STRING_TAG);
- msgb_put_u8(msg, 1);
- msgb_put_u8(msg, 0x0F);
- /* } DCS */
-
- /* USSD-String { */
- msgb_put_u8(msg, ASN1_OCTET_STRING_TAG);
- ussd_len_ptr = msgb_put(msg, 1);
- data = msgb_put(msg, 0);
- len = gsm_7bit_encode(data, text);
- msgb_put(msg, len);
- ussd_len_ptr[0] = len;
- /* USSD-String } */
-
- /* alertingPattern { */
- msgb_put_u8(msg, ASN1_OCTET_STRING_TAG);
- msgb_put_u8(msg, 1);
- msgb_put_u8(msg, alertPattern);
- /* } alertingPattern */
-
- seq_len_ptr[0] = 3 + 2 + ussd_len_ptr[0] + 3;
- /* } SEQUENCE */
-
- return msg;
-}
-
/* Send response to a mobile-originated ProcessUnstructuredSS-Request */
int gsm0480_send_ussd_response(const struct msgb *in_msg, const char *response_text,
const struct ussd_request *req)
@@ -407,35 +298,6 @@ int gsm0480_send_ussd_response(const struct msgb *in_msg, const char *response_t
return gsm48_sendmsg(msg, NULL);
}
-/* wrap an invoke around it... the other way around
- *
- * 1.) Invoke Component tag
- * 2.) Invoke ID Tag
- * 3.) Operation
- * 4.) Data
- */
-int gsm0480_wrap_invoke(struct msgb *msg, int op, int link_id)
-{
- /* 3. operation */
- msgb_push_TLV1(msg, GSM0480_OPERATION_CODE, op);
-
- /* 2. invoke id tag */
- msgb_push_TLV1(msg, GSM0480_COMPIDTAG_INVOKE_ID, link_id);
-
- /* 1. component tag */
- msgb_wrap_with_TL(msg, GSM0480_CTYPE_INVOKE);
-
- return 0;
-}
-
-/* wrap the GSM 04.08 Facility IE around it */
-int gsm0480_wrap_facility(struct msgb *msg)
-{
- msgb_wrap_with_TL(msg, GSM0480_IE_FACILITY);
-
- return 0;
-}
-
int gsm0480_send_ussd_reject(const struct msgb *in_msg,
const struct ussd_request *req)
{