aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-18 23:34:19 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-20 11:49:39 +0100
commit6e11bee8cf97487d29502dc1a9ef3b7837b48628 (patch)
tree8378a3231e48180a959d27a1b04987a0ea73b8a2
parentd8a73e24d280338e7f2e57e1f137ef8fbaa7a255 (diff)
isup: Attempt to handle a RSC on the exchange
-rw-r--r--include/isup_types.h5
-rw-r--r--src/isup.c38
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;
diff --git a/src/isup.c b/src/isup.c
index d57cb7a..1e13fbf 100644
--- a/src/isup.c
+++ b/src/isup.c
@@ -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;