aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-17 17:35:57 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-17 17:35:57 +0800
commitd42c3f25a683ab64b957b713ad930244a04b372c (patch)
treeb31fdf358f55c1b18be24d40010460f69ed0df21 /openbsc
parent3f122bed1e3b4b8da367751468eed5e48126c8da (diff)
bsc_api: Remove the lchan from the USSD code...
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/include/openbsc/gsm_04_80.h12
-rw-r--r--openbsc/include/openbsc/ussd.h2
-rw-r--r--openbsc/src/gsm_04_08.c2
-rw-r--r--openbsc/src/gsm_04_80.c18
-rw-r--r--openbsc/src/ussd.c14
5 files changed, 25 insertions, 23 deletions
diff --git a/openbsc/include/openbsc/gsm_04_80.h b/openbsc/include/openbsc/gsm_04_80.h
index b5ab1c6ea..b56f3f498 100644
--- a/openbsc/include/openbsc/gsm_04_80.h
+++ b/openbsc/include/openbsc/gsm_04_80.h
@@ -6,6 +6,8 @@
#define MAX_LEN_USSD_STRING 31
+struct gsm_subscriber_connection;
+
struct ussd_request {
char text[MAX_LEN_USSD_STRING + 1];
u_int8_t transaction_id;
@@ -14,9 +16,11 @@ struct ussd_request {
int gsm0480_decode_ussd_request(const struct msgb *msg,
struct ussd_request *request);
-int gsm0480_send_ussd_response(const struct msgb *in_msg, const char* response_text,
- const struct ussd_request *req);
-int gsm0480_send_ussd_reject(const struct msgb *msg,
- const struct ussd_request *request);
+int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
+ const struct msgb *in_msg, const char* response_text,
+ const struct ussd_request *req);
+int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
+ const struct msgb *msg,
+ const struct ussd_request *request);
#endif
diff --git a/openbsc/include/openbsc/ussd.h b/openbsc/include/openbsc/ussd.h
index 63ea31c5e..6f80d23d8 100644
--- a/openbsc/include/openbsc/ussd.h
+++ b/openbsc/include/openbsc/ussd.h
@@ -5,6 +5,6 @@
#include <osmocore/msgb.h>
-int handle_rcv_ussd(struct msgb *msg);
+int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg);
#endif
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index 8dece0b32..f87406aed 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -3113,7 +3113,7 @@ int gsm0408_dispatch(struct gsm_subscriber_connection *conn, struct msgb *msg)
"GSM 04.08 discriminator 0x%02x\n", pdisc);
break;
case GSM48_PDISC_NC_SS:
- rc = handle_rcv_ussd(msg);
+ rc = handle_rcv_ussd(conn, msg);
break;
default:
LOGP(DRLL, LOGL_NOTICE, "Unknown "
diff --git a/openbsc/src/gsm_04_80.c b/openbsc/src/gsm_04_80.c
index 7d6679b75..e5f05f30c 100644
--- a/openbsc/src/gsm_04_80.c
+++ b/openbsc/src/gsm_04_80.c
@@ -246,8 +246,9 @@ static int parse_process_uss_req(u_int8_t *uss_req_data, u_int8_t length,
}
/* 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)
+int gsm0480_send_ussd_response(struct gsm_subscriber_connection *conn,
+ const struct msgb *in_msg, const char *response_text,
+ const struct ussd_request *req)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
@@ -258,8 +259,6 @@ int gsm0480_send_ussd_response(const struct msgb *in_msg, const char *response_t
if (((strlen(response_text) * 7) % 8) != 0)
response_len += 1;
- msg->lchan = in_msg->lchan;
-
/* First put the payload text into the message */
ptr8 = msgb_put(msg, response_len);
gsm_7bit_encode(ptr8, response_text);
@@ -295,17 +294,16 @@ int gsm0480_send_ussd_response(const struct msgb *in_msg, const char *response_t
| (1<<7); /* TI direction = 1 */
gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
- return gsm0808_submit_dtap(&msg->lchan->conn, msg, 0);
+ return gsm0808_submit_dtap(conn, msg, 0);
}
-int gsm0480_send_ussd_reject(const struct msgb *in_msg,
- const struct ussd_request *req)
+int gsm0480_send_ussd_reject(struct gsm_subscriber_connection *conn,
+ const struct msgb *in_msg,
+ const struct ussd_request *req)
{
struct msgb *msg = gsm48_msgb_alloc();
struct gsm48_hdr *gh;
- msg->lchan = in_msg->lchan;
-
/* First insert the problem code */
msgb_push_TLV1(msg, GSM_0480_PROBLEM_CODE_TAG_GENERAL,
GSM_0480_GEN_PROB_CODE_UNRECOGNISED);
@@ -325,5 +323,5 @@ int gsm0480_send_ussd_reject(const struct msgb *in_msg,
gh->proto_discr |= req->transaction_id | (1<<7); /* TI direction = 1 */
gh->msg_type = GSM0480_MTYPE_RELEASE_COMPLETE;
- return gsm0808_submit_dtap(&msg->lchan->conn, msg, 0);
+ return gsm0808_submit_dtap(conn, msg, 0);
}
diff --git a/openbsc/src/ussd.c b/openbsc/src/ussd.c
index 547691965..7f1489915 100644
--- a/openbsc/src/ussd.c
+++ b/openbsc/src/ussd.c
@@ -38,11 +38,11 @@
const char USSD_TEXT_OWN_NUMBER[] = "*#100#";
/* Forward declarations of network-specific handler functions */
-static int send_own_number(const struct msgb *msg, const struct ussd_request *req);
+static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ussd_request *req);
/* Entrypoint - handler function common to all mobile-originated USSDs */
-int handle_rcv_ussd(struct msgb *msg)
+int handle_rcv_ussd(struct gsm_subscriber_connection *conn, struct msgb *msg)
{
struct ussd_request req;
@@ -52,20 +52,20 @@ int handle_rcv_ussd(struct msgb *msg)
if (strstr(USSD_TEXT_OWN_NUMBER, req.text) != NULL) {
DEBUGP(DMM, "USSD: Own number requested\n");
- return send_own_number(msg, &req);
+ return send_own_number(conn, msg, &req);
} else {
DEBUGP(DMM, "Unhandled USSD %s\n", req.text);
- return gsm0480_send_ussd_reject(msg, &req);
+ return gsm0480_send_ussd_reject(conn, msg, &req);
}
}
/* A network-specific handler function */
-static int send_own_number(const struct msgb *msg, const struct ussd_request *req)
+static int send_own_number(struct gsm_subscriber_connection *conn, const struct msgb *msg, const struct ussd_request *req)
{
- char *own_number = msg->lchan->conn.subscr->extension;
+ char *own_number = conn->subscr->extension;
char response_string[GSM_EXTENSION_LENGTH + 20];
/* Need trailing CR as EOT character */
snprintf(response_string, sizeof(response_string), "Your extension is %s\r", own_number);
- return gsm0480_send_ussd_response(msg, response_string, req);
+ return gsm0480_send_ussd_response(conn, msg, response_string, req);
}