aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 18:52:05 +0800
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-06-15 20:24:19 +0800
commitf76e7ef5e1528a33a7f314e78a5b029a76ff2282 (patch)
tree4586d45d1941161365487b23625f9ba7643aaf65
parent52c4ba0309fda93ec77b2c763e7ff5d7c84cc2a2 (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.
-rw-r--r--openbsc/include/openbsc/bsc_msc.h2
-rw-r--r--openbsc/src/bsc_msc.c22
2 files changed, 24 insertions, 0 deletions
diff --git a/openbsc/include/openbsc/bsc_msc.h b/openbsc/include/openbsc/bsc_msc.h
index 041de256e..9b75def9a 100644
--- a/openbsc/include/openbsc/bsc_msc.h
+++ b/openbsc/include/openbsc/bsc_msc.h
@@ -45,4 +45,6 @@ void bsc_msc_schedule_connect(struct bsc_msc_connection *);
void bsc_msc_lost(struct bsc_msc_connection *);
+struct msgb *bsc_msc_id_get_resp(const char *token);
+
#endif
diff --git a/openbsc/src/bsc_msc.c b/openbsc/src/bsc_msc.c
index 2902f2903..5ee267a2f 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>
@@ -237,4 +238,25 @@ void bsc_msc_schedule_connect(struct bsc_msc_connection *con)
con->reconnect_timer.cb = reconnect_msc;
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;
} \ No newline at end of file