aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-12-10 07:34:01 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-12-10 13:22:46 +0100
commit433ea2f037effc600543823e5b3fa8ec540b989a (patch)
tree0a8a8099e44634645f2850c80b5402da29e77a48 /src
parentc21cfaa023686c0c4ff041199ed6a04e48f79d15 (diff)
isup: Implement handling GRS and GRA messages for ISUP.
Diffstat (limited to 'src')
-rw-r--r--src/isup.c43
-rw-r--r--src/mtp_layer3.c4
2 files changed, 46 insertions, 1 deletions
diff --git a/src/isup.c b/src/isup.c
index a98e4b5..8cb91a9 100644
--- a/src/isup.c
+++ b/src/isup.c
@@ -22,6 +22,8 @@
#include <isup_types.h>
#include <cellmgr_debug.h>
+#include <osmocore/msgb.h>
+
/* this message contains the range */
int isup_parse_grs(const uint8_t *data, uint8_t in_length)
{
@@ -49,3 +51,44 @@ int isup_parse_grs(const uint8_t *data, uint8_t in_length)
return data[0 + ptr + 1];
}
+
+/* Handle incoming ISUP data */
+static int handle_circuit_reset_grs(struct mtp_link *link, int sls,
+ const uint8_t *data, int size)
+{
+ int range;
+
+ range = isup_parse_grs(data, size);
+ if (range < 0)
+ return -1;
+
+ printf("ASKED to reset range: %d\n", range);
+
+ return 0;
+}
+
+int mtp_link_forward_isup(struct mtp_link *link, struct msgb *msg, int sls)
+{
+ int rc = -1;
+ int payload_size;
+ struct isup_msg_hdr *hdr;
+
+ if (msgb_l3len(msg) < sizeof(*hdr)) {
+ LOGP(DISUP, LOGL_ERROR, "ISUP header is too short.\n");
+ return -1;
+ }
+
+ hdr = (struct isup_msg_hdr *) msg->l3h;
+ payload_size = msgb_l3len(msg) - sizeof(*hdr);
+
+ switch (hdr->msg_type) {
+ case ISUP_MSG_GRS:
+ rc = handle_circuit_reset_grs(link, sls, hdr->data, payload_size);
+ break;
+ default:
+ LOGP(DISUP, LOGL_NOTICE, "ISUP msg not handled: 0x%x\n", hdr->msg_type);
+ break;
+ }
+
+ return rc;
+}
diff --git a/src/mtp_layer3.c b/src/mtp_layer3.c
index 7dd3a7f..4490c8b 100644
--- a/src/mtp_layer3.c
+++ b/src/mtp_layer3.c
@@ -22,6 +22,7 @@
#include <mtp_data.h>
#include <mtp_level3.h>
#include <cellmgr_debug.h>
+#include <isup_types.h>
#include <osmocore/talloc.h>
@@ -486,7 +487,8 @@ int mtp_link_data(struct mtp_link *link, struct msgb *msg)
rc = mtp_link_sccp_data(link, hdr, msg, l3_len);
break;
case MTP_SI_MNT_ISUP:
- LOGP(DINP, LOGL_ERROR, "ISUP handling not implemented.\n");
+ msg->l3h = &hdr->data[0];
+ rc = mtp_link_forward_isup(link, msg, MTP_LINK_SLS(hdr->addr));
break;
default:
fprintf(stderr, "Unhandled: %u\n", hdr->ser_ind);