diff options
author | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-18 23:34:19 +0100 |
---|---|---|
committer | Holger Hans Peter Freyther <zecke@selfish.org> | 2011-01-20 11:49:39 +0100 |
commit | 6e11bee8cf97487d29502dc1a9ef3b7837b48628 (patch) | |
tree | 8378a3231e48180a959d27a1b04987a0ea73b8a2 | |
parent | d8a73e24d280338e7f2e57e1f137ef8fbaa7a255 (diff) |
isup: Attempt to handle a RSC on the exchange
-rw-r--r-- | include/isup_types.h | 5 | ||||
-rw-r--r-- | src/isup.c | 38 |
2 files changed, 43 insertions, 0 deletions
diff --git a/include/isup_types.h b/include/isup_types.h index 6048ce3..622f320 100644 --- a/include/isup_types.h +++ b/include/isup_types.h @@ -30,6 +30,11 @@ struct mtp_link_set; /* This is from Table 4/Q.763 */ #define ISUP_MSG_GRS 0x17 #define ISUP_MSG_GRA 0x29 +#define ISUP_MSG_CGB 0x18 +#define ISUP_MSG_CGBA 0x1A +#define ISUP_MSG_RLC 0x10 +#define ISUP_MSG_RSC 0x12 + struct isup_msg_hdr { uint16_t cic; @@ -61,6 +61,28 @@ static struct msgb *isup_gra_alloc(int cic, int range) return msg; } +static struct msgb *isup_rlc_alloc(int cic) +{ + struct isup_msg_hdr *hdr; + struct msgb *msg; + + msg = msgb_alloc_headroom(4096, 128, "ISUP RSC"); + if (!msg) { + LOGP(DISUP, LOGL_ERROR, "Allocation of GRA message failed.\n"); + return NULL; + } + + msg->l2h = msgb_put(msg, sizeof(*hdr)); + + /* write the ISUP header */ + hdr = (struct isup_msg_hdr *) msg->l2h; + hdr->cic = cic; + hdr->msg_type = ISUP_MSG_RLC; + + msgb_v_put(msg, 0); + return msg; +} + /* this message contains the range */ int isup_parse_grs(const uint8_t *data, uint8_t in_length) { @@ -109,6 +131,19 @@ static int handle_circuit_reset_grs(struct mtp_link_set *link, int sls, int cic, return 0; } +static int handle_circuit_reset(struct mtp_link_set *set, int sls, int cic, + const uint8_t *data, int size) +{ + struct msgb *resp; + + resp = isup_rlc_alloc(cic); + if (!resp) + return -1; + mtp_link_set_submit_isup_data(set, sls, resp->l2h, msgb_l2len(resp)); + msgb_free(resp); + return 0; +} + int mtp_link_set_isup(struct mtp_link_set *link, struct msgb *msg, int sls) { int rc = -1; @@ -132,6 +167,9 @@ int mtp_link_set_isup(struct mtp_link_set *link, struct msgb *msg, int sls) case ISUP_MSG_GRS: rc = handle_circuit_reset_grs(link, sls, hdr->cic, hdr->data, payload_size); break; + case ISUP_MSG_RSC: + rc = handle_circuit_reset(link, sls, hdr->cic, hdr->data, payload_size); + break; default: mtp_link_set_forward_isup(link, msg, sls); rc = 0; |