diff options
-rw-r--r-- | src/isup.c | 43 | ||||
-rw-r--r-- | src/mtp_layer3.c | 4 |
2 files changed, 46 insertions, 1 deletions
@@ -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); |