blob: 4a1da3a63208df23017776cef1fc4b7d9e078a89 [file] [log] [blame]
Sylvain Munaut12ba7782014-06-16 10:13:40 +02001#pragma once
Harald Welted284cd92010-03-01 21:58:31 +01002
3#include <stdint.h>
Pablo Neira Ayuso83419342011-03-22 16:36:13 +01004#include <osmocom/core/utils.h>
Harald Welteea19c972011-06-26 14:47:16 +02005#include <osmocom/core/msgb.h>
Pablo Neira Ayuso83419342011-03-22 16:36:13 +01006#include <osmocom/gsm/protocol/gsm_08_58.h>
Harald Welted284cd92010-03-01 21:58:31 +01007
Harald Welte84bd3332017-10-16 15:32:06 +02008/*! \defgroup rsl A-bis RSL
Harald Weltee881b1b2011-08-17 18:52:30 +02009 * @{
Neels Hofmeyr17518fe2017-06-20 04:35:06 +020010 * \file rsl.h */
Harald Weltee881b1b2011-08-17 18:52:30 +020011
Harald Welted284cd92010-03-01 21:58:31 +010012void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type);
13
Harald Welte6eb7d6c2010-07-13 13:48:13 +020014void rsl_init_cchan_hdr(struct abis_rsl_cchan_hdr *ch, uint8_t msg_type);
15
Harald Welted284cd92010-03-01 21:58:31 +010016extern const struct tlv_definition rsl_att_tlvdef;
Harald Weltee881b1b2011-08-17 18:52:30 +020017
Neels Hofmeyr87e45502017-06-20 00:17:59 +020018/*! Parse RSL TLV structure using \ref tlv_parse */
Harald Welted284cd92010-03-01 21:58:31 +010019#define rsl_tlv_parse(dec, buf, len) \
20 tlv_parse(dec, &rsl_att_tlvdef, buf, len, 0, 0)
21
Harald Weltefad57522015-12-13 11:56:36 +010022extern const struct tlv_definition rsl_ipac_eie_tlvdef;
23
Neels Hofmeyr87e45502017-06-20 00:17:59 +020024/*! Parse RSL IPAC EIE TLV structure using \ref tlv_parse */
Harald Weltefad57522015-12-13 11:56:36 +010025#define rsl_ipac_eie_tlv_parse(dec, buf, len) \
26 tlv_parse(dec, &rsl_ipac_eie_tlvdef, buf, len, 0, 0)
27
Harald Welted284cd92010-03-01 21:58:31 +010028/* encode channel number as per Section 9.3.1 */
29uint8_t rsl_enc_chan_nr(uint8_t type, uint8_t subch, uint8_t timeslot);
Harald Welteecf9dd02010-03-04 14:27:48 +010030/* decode channel number as per Section 9.3.1 */
31int rsl_dec_chan_nr(uint8_t chan_nr, uint8_t *type, uint8_t *subch, uint8_t *timeslot);
Sylvain Munaut27af0752010-07-25 12:25:17 +020032/* Turns channel number into a string */
Harald Welte4a62eda2019-03-18 18:27:00 +010033char *rsl_chan_nr_str_buf(char *buf, size_t buf_len, uint8_t chan_nr);
Sylvain Munaut27af0752010-07-25 12:25:17 +020034const char *rsl_chan_nr_str(uint8_t chan_nr);
35
Harald Welted284cd92010-03-01 21:58:31 +010036
Harald Welted284cd92010-03-01 21:58:31 +010037const char *rsl_err_name(uint8_t err);
Harald Welte52b4abd2010-03-25 12:11:38 +080038const char *rsl_rlm_cause_name(uint8_t err);
Harald Weltecf7e5da2011-06-23 20:43:13 +020039const char *rsl_msg_name(uint8_t err);
Harald Weltea24026a2011-09-02 12:26:50 +020040const char *rsl_ipac_msg_name(uint8_t msg_type);
Neels Hofmeyr0167e3f2016-06-06 18:10:38 +020041const char *rsl_or_ipac_msg_name(uint8_t msg_type);
Harald Welted284cd92010-03-01 21:58:31 +010042
43/* Section 3.3.2.3 TS 05.02. I think this looks like a table */
44int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf);
45
Harald Welte6eb7d6c2010-07-13 13:48:13 +020046/* Push a RSL RLL header */
47void rsl_rll_push_hdr(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
48 uint8_t link_id, int transparent);
49
Harald Weltef08eabf2010-03-02 21:59:20 +010050/* Push a RSL RLL header with L3_INFO IE */
Harald Welteeb8bf392010-03-04 10:32:09 +010051void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr,
52 uint8_t link_id, int transparent);
Harald Weltef08eabf2010-03-02 21:59:20 +010053
54/* Allocate msgb and fill with simple RSL RLL header */
55struct msgb *rsl_rll_simple(uint8_t msg_type, uint8_t chan_nr,
Harald Welteeb8bf392010-03-04 10:32:09 +010056 uint8_t link_id, int transparent);
Harald Weltee881b1b2011-08-17 18:52:30 +020057
Neels Hofmeyr47390762016-07-18 23:54:01 +020058extern const struct value_string rsl_act_type_names[];
59
Neels Hofmeyr87e45502017-06-20 00:17:59 +020060/*! Return a human readable name for GSM 08.58 RSL_ACT_* constants. */
Neels Hofmeyr47390762016-07-18 23:54:01 +020061static inline const char *rsl_act_type_name(uint8_t act_type)
62{
63 return get_value_string(rsl_act_type_names, act_type);
64}
65
Sylvain Munautdca7d2c2012-04-18 21:53:23 +020066/*! @} */