[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.
diff --git a/include/osmocore/protocol/gsm_08_58.h b/include/osmocore/protocol/gsm_08_58.h
index 7dc3569..5fe332e 100644
--- a/include/osmocore/protocol/gsm_08_58.h
+++ b/include/osmocore/protocol/gsm_08_58.h
@@ -49,6 +49,14 @@
uint8_t data[0];
} __attribute__ ((packed));
+/* Chapter 8.5 */
+struct abis_rsl_cchan_hdr {
+ struct abis_rsl_common_hdr c;
+ uint8_t ie_chan;
+ uint8_t chan_nr;
+ uint8_t data[0];
+} __attribute__ ((packed));
+
/* Chapter 9.1 */
#define ABIS_RSL_MDISC_RLL 0x02
@@ -88,6 +96,7 @@
RSL_MT_PAGING_CMD,
RSL_MT_IMMEDIATE_ASSIGN_CMD,
RSL_MT_SMS_BC_REQ,
+ RSL_MT_CHAN_CONF, /* non-standard element */
/* empty */
RSL_MT_RF_RES_IND = 0x19,
RSL_MT_SACCH_FILL,
diff --git a/include/osmocore/rsl.h b/include/osmocore/rsl.h
index 99b90d6..cd84057 100644
--- a/include/osmocore/rsl.h
+++ b/include/osmocore/rsl.h
@@ -7,6 +7,8 @@
void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type);
+void rsl_init_cchan_hdr(struct abis_rsl_cchan_hdr *ch, uint8_t msg_type);
+
extern const struct tlv_definition rsl_att_tlvdef;
#define rsl_tlv_parse(dec, buf, len) \
tlv_parse(dec, &rsl_att_tlvdef, buf, len, 0, 0)
@@ -22,6 +24,10 @@
/* Section 3.3.2.3 TS 05.02. I think this looks like a table */
int rsl_ccch_conf_to_bs_cc_chans(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);
+
/* 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);
diff --git a/src/rsl.c b/src/rsl.c
index c002d33..7bc1712 100644
--- a/src/rsl.c
+++ b/src/rsl.c
@@ -38,6 +38,13 @@
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,20 +284,12 @@
}
}
-/* 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)
+/* 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)
{
- 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 */
-
- /* Push the L3 IE tag and lengh */
- 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)
@@ -302,6 +301,22 @@
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);
+
+ /* construct a RSLms RLL message (DATA INDICATION, UNIT DATA
+ * INDICATION) and send it off via RSLms */
+
+ /* Push the L3 IE tag and lengh */
+ msgb_tv16_push(msg, RSL_IE_L3_INFO, l3_len);
+
+ /* Then push the RSL header */
+ 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,
uint8_t link_id, int transparent)
{