blob: d6eb246b6200fb51d57d551184c2e74d4bc1baeb [file] [log] [blame]
Philipp Maier680acae2018-03-01 19:13:05 +01001#pragma once
2
3#include <osmocom/core/utils.h>
4#include <osmocom/core/bitvec.h>
5
6#define MAX_BTS_FEATURES 128
7
8/* N. B: always add new features to the end of the list (right before _NUM_BTS_FEAT) to avoid breaking compatibility
9 with BTS compiled against earlier version of this header. Also make sure that the description strings
Pau Espin Pedrol5f2b8e52021-01-29 17:04:14 +010010 osmo_bts_features_descs[] in gsm_data.c are also updated accordingly! */
Philipp Maier680acae2018-03-01 19:13:05 +010011enum osmo_bts_features {
12 BTS_FEAT_HSCSD,
13 BTS_FEAT_GPRS,
14 BTS_FEAT_EGPRS,
15 BTS_FEAT_ECSD,
16 BTS_FEAT_HOPPING,
17 BTS_FEAT_MULTI_TSC,
18 BTS_FEAT_OML_ALERTS,
19 BTS_FEAT_AGCH_PCH_PROP,
20 BTS_FEAT_CBCH,
21 BTS_FEAT_SPEECH_F_V1,
22 BTS_FEAT_SPEECH_H_V1,
23 BTS_FEAT_SPEECH_F_EFR,
24 BTS_FEAT_SPEECH_F_AMR,
25 BTS_FEAT_SPEECH_H_AMR,
Harald Welte994df262019-09-03 16:52:09 +020026 BTS_FEAT_ETWS_PN,
Harald Welte17933342020-06-21 15:32:41 +020027 BTS_FEAT_PAGING_COORDINATION, /* BTS hands CS paging to PCU/PACCH */
Alexander Couzens03a42132020-06-07 22:53:31 +020028 BTS_FEAT_IPV6_NSVC,
Philipp Maieraa718462020-11-15 14:08:01 +010029 BTS_FEAT_ACCH_REP,
Pau Espin Pedrol3e3f3772021-01-29 17:12:14 +010030 BTS_FEAT_CCN, /* Is CCN supported by the cell? TS 44.060 sec 8.8.2 */
Neels Hofmeyr158bc792021-03-27 17:14:57 +010031 BTS_FEAT_VAMOS, /* Is the BTS VAMOS capable? */
Pau Espin Pedrol42bb1252021-05-31 17:11:45 +020032 BTS_FEAT_ABIS_OSMO_PCU, /* BTS supports forwarding data to PCUIF over IPA OML multiplex */
Vadim Yanitskiy1c2a3292021-06-25 19:34:38 +020033 BTS_FEAT_BCCH_POWER_RED,
Pau Espin Pedrold9825c02021-06-29 11:54:30 +020034 BTS_FEAT_DYN_TS_SDCCH8, /* Osmo Dynamic TS supports configured as SDCCH8 */
Philipp Maier58f76d82021-08-30 17:53:36 +020035 BTS_FEAT_ACCH_TEMP_OVP, /* FACCH/SACCH Temporary overpower */
Pau Espin Pedrol30640072022-08-08 13:46:03 +020036 BTS_FEAT_OSMUX, /* Osmux (Osmocom RTP muxing) support */
Max812dfbf2023-01-23 21:19:12 +030037 BTS_FEAT_VBS, /* Voice Broadcast Service support, 3GPP TS 43.069 */
38 BTS_FEAT_VGCS, /* Voice Group Call Service support, 3GPP TS 44.068 */
Philipp Maier680acae2018-03-01 19:13:05 +010039 _NUM_BTS_FEAT
40};
41
42extern const struct value_string osmo_bts_features_descs[];
43
Neels Hofmeyr524b4f82021-04-08 21:12:55 +020044static inline const char *osmo_bts_features_desc(enum osmo_bts_features val)
45{ return get_value_string(osmo_bts_features_descs, val); }
46
47const char *osmo_bts_feature_name(enum osmo_bts_features feature)
48 OSMO_DEPRECATED("Use osmo_bts_features_desc() instead");
Philipp Maier680acae2018-03-01 19:13:05 +010049
Neels Hofmeyr47c7b4f2021-04-02 23:20:09 +020050extern const struct value_string osmo_bts_features_names[];
51
52static inline const char *osmo_bts_features_name(enum osmo_bts_features val)
53{ return get_value_string(osmo_bts_features_names, val); }
54
Philipp Maierbf86d712018-03-05 13:26:44 +010055static inline int osmo_bts_set_feature(struct bitvec *features, enum osmo_bts_features feature)
Philipp Maier680acae2018-03-01 19:13:05 +010056{
57 OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
58 return bitvec_set_bit_pos(features, feature, 1);
59}
60
Vadim Yanitskiy383b3bf2020-05-31 16:03:30 +070061static inline int osmo_bts_unset_feature(struct bitvec *features, enum osmo_bts_features feature)
62{
63 OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
64 return bitvec_set_bit_pos(features, feature, 0);
65}
66
Philipp Maierbf86d712018-03-05 13:26:44 +010067static inline bool osmo_bts_has_feature(const struct bitvec *features, enum osmo_bts_features feature)
Philipp Maier680acae2018-03-01 19:13:05 +010068{
69 OSMO_ASSERT(_NUM_BTS_FEAT < MAX_BTS_FEATURES);
Vadim Yanitskiyf8e153d2020-05-31 16:06:36 +070070 return bitvec_get_bit_pos(features, feature) == ONE;
Philipp Maier680acae2018-03-01 19:13:05 +010071}