From 6eb7d6c88748a445dde56b697f9faa062658a301 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Tue, 13 Jul 2010 13:48:13 +0200 Subject: [RSL] split rsl_rll_push_l3() L3 LV pushign and rsl_rll_push_hdr() This allows us to generate RSLms messages that have some non-standard IEs between the RSL/RLL common header and the L3 INFO IE. --- src/rsl.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/rsl.c b/src/rsl.c index c002d33e..7bc1712f 100644 --- a/src/rsl.c +++ b/src/rsl.c @@ -38,6 +38,13 @@ void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type) dh->ie_link_id = RSL_IE_LINK_IDENT; } +void rsl_init_cchan_hdr(struct abis_rsl_cchan_hdr *ch, uint8_t msg_type) +{ + ch->c.msg_discr = ABIS_RSL_MDISC_COM_CHAN; + ch->c.msg_type = msg_type; + ch->ie_chan = RSL_IE_CHAN_NR; +} + const struct tlv_definition rsl_att_tlvdef = { .def = { [RSL_IE_CHAN_NR] = { TLV_TYPE_TV }, @@ -277,12 +284,28 @@ int rsl_ccch_conf_to_bs_ccch_sdcch_comb(int ccch_conf) } } +/* Push a RSL RLL header */ +void rsl_rll_push_hdr(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr, + uint8_t link_id, int transparent) +{ + struct abis_rsl_rll_hdr *rh; + + rh = (struct abis_rsl_rll_hdr *) msgb_push(msg, sizeof(*rh)); + rsl_init_rll_hdr(rh, msg_type); + if (transparent) + rh->c.msg_discr |= ABIS_RSL_MDISC_TRANSP; + rh->chan_nr = chan_nr; + rh->link_id = link_id; + + /* set the l2 header pointer */ + msg->l2h = (uint8_t *)rh; +} + /* Push a RSL RLL header with L3_INFO IE */ void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr, uint8_t link_id, int transparent) { uint8_t l3_len = msg->tail - (uint8_t *)msgb_l3(msg); - struct abis_rsl_rll_hdr *rh; /* construct a RSLms RLL message (DATA INDICATION, UNIT DATA * INDICATION) and send it off via RSLms */ @@ -291,15 +314,7 @@ void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr, msgb_tv16_push(msg, RSL_IE_L3_INFO, l3_len); /* Then push the RSL header */ - rh = (struct abis_rsl_rll_hdr *) msgb_push(msg, sizeof(*rh)); - rsl_init_rll_hdr(rh, msg_type); - if (transparent) - rh->c.msg_discr |= ABIS_RSL_MDISC_TRANSP; - rh->chan_nr = chan_nr; - rh->link_id = link_id; - - /* set the l2 header pointer */ - msg->l2h = (uint8_t *)rh; + rsl_rll_push_hdr(msg, msg_type, chan_nr, link_id, transparent); } struct msgb *rsl_rll_simple(uint8_t msg_type, uint8_t chan_nr, -- cgit v1.2.3