Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 1 | #pragma once |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 4 | #include <osmocom/core/utils.h> |
Harald Welte | ea19c97 | 2011-06-26 14:47:16 +0200 | [diff] [blame] | 5 | #include <osmocom/core/msgb.h> |
Pablo Neira Ayuso | 8341934 | 2011-03-22 16:36:13 +0100 | [diff] [blame] | 6 | #include <osmocom/gsm/protocol/gsm_08_58.h> |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 7 | |
Harald Welte | e881b1b | 2011-08-17 18:52:30 +0200 | [diff] [blame] | 8 | /*! \defgroup rsl RSL |
| 9 | * @{ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 10 | * \file rsl.h */ |
Harald Welte | e881b1b | 2011-08-17 18:52:30 +0200 | [diff] [blame] | 11 | |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 12 | void rsl_init_rll_hdr(struct abis_rsl_rll_hdr *dh, uint8_t msg_type); |
| 13 | |
Harald Welte | 6eb7d6c | 2010-07-13 13:48:13 +0200 | [diff] [blame] | 14 | void rsl_init_cchan_hdr(struct abis_rsl_cchan_hdr *ch, uint8_t msg_type); |
| 15 | |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 16 | extern const struct tlv_definition rsl_att_tlvdef; |
Harald Welte | e881b1b | 2011-08-17 18:52:30 +0200 | [diff] [blame] | 17 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 18 | /*! Parse RSL TLV structure using \ref tlv_parse */ |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 19 | #define rsl_tlv_parse(dec, buf, len) \ |
| 20 | tlv_parse(dec, &rsl_att_tlvdef, buf, len, 0, 0) |
| 21 | |
Harald Welte | fad5752 | 2015-12-13 11:56:36 +0100 | [diff] [blame] | 22 | extern const struct tlv_definition rsl_ipac_eie_tlvdef; |
| 23 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 24 | /*! Parse RSL IPAC EIE TLV structure using \ref tlv_parse */ |
Harald Welte | fad5752 | 2015-12-13 11:56:36 +0100 | [diff] [blame] | 25 | #define rsl_ipac_eie_tlv_parse(dec, buf, len) \ |
| 26 | tlv_parse(dec, &rsl_ipac_eie_tlvdef, buf, len, 0, 0) |
| 27 | |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 28 | /* encode channel number as per Section 9.3.1 */ |
| 29 | uint8_t rsl_enc_chan_nr(uint8_t type, uint8_t subch, uint8_t timeslot); |
Harald Welte | ecf9dd0 | 2010-03-04 14:27:48 +0100 | [diff] [blame] | 30 | /* decode channel number as per Section 9.3.1 */ |
| 31 | int rsl_dec_chan_nr(uint8_t chan_nr, uint8_t *type, uint8_t *subch, uint8_t *timeslot); |
Sylvain Munaut | 27af075 | 2010-07-25 12:25:17 +0200 | [diff] [blame] | 32 | /* Turns channel number into a string */ |
| 33 | const char *rsl_chan_nr_str(uint8_t chan_nr); |
| 34 | |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 35 | |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 36 | const char *rsl_err_name(uint8_t err); |
Harald Welte | 52b4abd | 2010-03-25 12:11:38 +0800 | [diff] [blame] | 37 | const char *rsl_rlm_cause_name(uint8_t err); |
Harald Welte | cf7e5da | 2011-06-23 20:43:13 +0200 | [diff] [blame] | 38 | const char *rsl_msg_name(uint8_t err); |
Harald Welte | a24026a | 2011-09-02 12:26:50 +0200 | [diff] [blame] | 39 | const char *rsl_ipac_msg_name(uint8_t msg_type); |
Neels Hofmeyr | 0167e3f | 2016-06-06 18:10:38 +0200 | [diff] [blame] | 40 | const char *rsl_or_ipac_msg_name(uint8_t msg_type); |
Harald Welte | d284cd9 | 2010-03-01 21:58:31 +0100 | [diff] [blame] | 41 | |
| 42 | /* Section 3.3.2.3 TS 05.02. I think this looks like a table */ |
| 43 | int rsl_ccch_conf_to_bs_cc_chans(int ccch_conf); |
| 44 | |
Harald Welte | 6eb7d6c | 2010-07-13 13:48:13 +0200 | [diff] [blame] | 45 | /* Push a RSL RLL header */ |
| 46 | void rsl_rll_push_hdr(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr, |
| 47 | uint8_t link_id, int transparent); |
| 48 | |
Harald Welte | f08eabf | 2010-03-02 21:59:20 +0100 | [diff] [blame] | 49 | /* Push a RSL RLL header with L3_INFO IE */ |
Harald Welte | eb8bf39 | 2010-03-04 10:32:09 +0100 | [diff] [blame] | 50 | void rsl_rll_push_l3(struct msgb *msg, uint8_t msg_type, uint8_t chan_nr, |
| 51 | uint8_t link_id, int transparent); |
Harald Welte | f08eabf | 2010-03-02 21:59:20 +0100 | [diff] [blame] | 52 | |
| 53 | /* Allocate msgb and fill with simple RSL RLL header */ |
| 54 | struct msgb *rsl_rll_simple(uint8_t msg_type, uint8_t chan_nr, |
Harald Welte | eb8bf39 | 2010-03-04 10:32:09 +0100 | [diff] [blame] | 55 | uint8_t link_id, int transparent); |
Harald Welte | e881b1b | 2011-08-17 18:52:30 +0200 | [diff] [blame] | 56 | |
Neels Hofmeyr | 4739076 | 2016-07-18 23:54:01 +0200 | [diff] [blame] | 57 | extern const struct value_string rsl_act_type_names[]; |
| 58 | |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 59 | /*! Return a human readable name for GSM 08.58 RSL_ACT_* constants. */ |
Neels Hofmeyr | 4739076 | 2016-07-18 23:54:01 +0200 | [diff] [blame] | 60 | static inline const char *rsl_act_type_name(uint8_t act_type) |
| 61 | { |
| 62 | return get_value_string(rsl_act_type_names, act_type); |
| 63 | } |
| 64 | |
Sylvain Munaut | dca7d2c | 2012-04-18 21:53:23 +0200 | [diff] [blame] | 65 | /*! @} */ |