diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-05-15 00:12:19 +0800 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2010-05-15 00:12:19 +0800 |
commit | 565b355c8216bc4847b68ddcbd03aa4e813fca59 (patch) | |
tree | 7bd48d09c5932cf997f08ee7e06885092307d3fb /openbsc/src | |
parent | be9201a2729fa0ed214c0a93905d766004014f3d (diff) |
[bsc_msc] Move the id get response into the bsc_msc.c
Create the message in a common place and then it can be used
by tools having an a link or such.
Diffstat (limited to 'openbsc/src')
-rw-r--r-- | openbsc/src/bsc_msc.c | 22 | ||||
-rw-r--r-- | openbsc/src/bsc_msc_ip.c | 11 |
2 files changed, 24 insertions, 9 deletions
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c index 141609a6b..3ecd13170 100644 --- a/openbsc/src/bsc_msc.c +++ b/openbsc/src/bsc_msc.c @@ -22,6 +22,7 @@ #include <openbsc/bsc_msc.h> #include <openbsc/debug.h> +#include <openbsc/ipaccess.h> #include <osmocore/write_queue.h> #include <osmocore/talloc.h> @@ -239,3 +240,24 @@ void bsc_msc_schedule_connect(struct bsc_msc_connection *con) con->reconnect_timer.data = con; bsc_schedule_timer(&con->reconnect_timer, 5, 0); } + +struct msgb *bsc_msc_id_get_resp(const char *token) +{ + struct msgb *msg; + + if (!token) { + LOGP(DMSC, LOGL_ERROR, "No token specified.\n"); + return NULL; + } + + msg = msgb_alloc_headroom(4096, 128, "id resp"); + if (!msg) { + LOGP(DMSC, LOGL_ERROR, "Failed to create the message.\n"); + return NULL; + } + + msg->l2h = msgb_v_put(msg, IPAC_MSGT_ID_RESP); + msgb_l16tv_put(msg, strlen(token) + 1, + IPAC_IDTAG_UNITNAME, (u_int8_t *) token); + return msg; +} diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c index 0a7aa0dec..bfd9138ee 100644 --- a/openbsc/src/bsc_msc_ip.c +++ b/openbsc/src/bsc_msc_ip.c @@ -869,16 +869,9 @@ static void send_id_get_response(int fd) return; } - if (!bsc_gsmnet->bsc_token) { - LOGP(DMSC, LOGL_ERROR, "The bsc token is not set.\n"); + msg = bsc_msc_id_get_resp(bsc_gsmnet->bsc_token); + if (!msg) return; - } - - msg = msgb_alloc_headroom(4096, 128, "id resp"); - - msg->l2h = msgb_v_put(msg, IPAC_MSGT_ID_RESP); - msgb_l16tv_put(msg, strlen(bsc_gsmnet->bsc_token) + 1, - IPAC_IDTAG_UNITNAME, (u_int8_t *) bsc_gsmnet->bsc_token); msc_queue_write(msg, IPAC_PROTO_IPACCESS); } |