Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 1 | /*! \file gsm_utils.h |
| 2 | * GSM utility functions, e.g. coding and decoding. */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 3 | /* |
| 4 | * (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de> |
| 5 | * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org> |
Harald Welte | aebe08c | 2010-03-04 10:39:17 +0100 | [diff] [blame] | 6 | * (C) 2009-2010 by Harald Welte <laforge@gnumonks.org> |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 7 | * |
| 8 | * All Rights Reserved |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 20 | */ |
| 21 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 22 | #pragma once |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 23 | |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 24 | #include <stddef.h> |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 25 | #include <stdint.h> |
| 26 | |
Jacob Erlbeck | 6b26218 | 2013-08-14 12:26:27 +0200 | [diff] [blame] | 27 | #include <osmocom/core/defs.h> |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 28 | #include <osmocom/core/utils.h> |
Jacob Erlbeck | 3f69ceb | 2013-08-12 18:31:59 +0200 | [diff] [blame] | 29 | |
Sylvain Munaut | 221030f | 2010-04-27 21:48:40 +0200 | [diff] [blame] | 30 | #define ADD_MODULO(sum, delta, modulo) do { \ |
| 31 | if ((sum += delta) >= modulo) \ |
| 32 | sum -= modulo; \ |
| 33 | } while (0) |
| 34 | |
| 35 | #define GSM_MAX_FN (26*51*2048) |
Max | a9a9ce6 | 2022-11-20 23:26:04 +0300 | [diff] [blame] | 36 | #define GSM_FN_UNSET 0xFFFFFFFF |
Sylvain Munaut | 221030f | 2010-04-27 21:48:40 +0200 | [diff] [blame] | 37 | |
Max | 4b2b0cc | 2017-07-10 14:32:48 +0200 | [diff] [blame] | 38 | /* Max length of random identifier which can be requested via osmo_get_rand_id() */ |
| 39 | #define OSMO_MAX_RAND_ID_LEN 16 |
| 40 | |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 41 | struct gsm_time { |
| 42 | uint32_t fn; /* FN count */ |
| 43 | uint16_t t1; /* FN div (26*51) */ |
| 44 | uint8_t t2; /* FN modulo 26 */ |
| 45 | uint8_t t3; /* FN modulo 51 */ |
| 46 | uint8_t tc; |
| 47 | }; |
| 48 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 49 | enum gsm_band { |
| 50 | GSM_BAND_850 = 1, |
| 51 | GSM_BAND_900 = 2, |
| 52 | GSM_BAND_1800 = 4, |
| 53 | GSM_BAND_1900 = 8, |
| 54 | GSM_BAND_450 = 0x10, |
| 55 | GSM_BAND_480 = 0x20, |
| 56 | GSM_BAND_750 = 0x40, |
| 57 | GSM_BAND_810 = 0x80, |
| 58 | }; |
| 59 | |
Harald Welte | cbc8062 | 2010-03-22 08:28:44 +0800 | [diff] [blame] | 60 | const char *gsm_band_name(enum gsm_band band); |
Harald Welte | aebe08c | 2010-03-04 10:39:17 +0100 | [diff] [blame] | 61 | enum gsm_band gsm_band_parse(const char *mhz); |
| 62 | |
Max | 4b2b0cc | 2017-07-10 14:32:48 +0200 | [diff] [blame] | 63 | int osmo_get_rand_id(uint8_t *out, size_t len); |
| 64 | |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 65 | /*! |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 66 | * Decode a sequence of GSM 03.38 encoded 7 bit characters. |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 67 | * |
| 68 | * \param decoded The destination buffer for the decoded characters. |
| 69 | * \param n A maximum of n chars is written (incl. terminating \0). |
| 70 | * Requires n >= 1. |
| 71 | * \param user_data A pointer to the start of the packed 7bit character |
| 72 | * sequence. |
Neels Hofmeyr | cda9885 | 2016-02-29 09:56:26 +0100 | [diff] [blame] | 73 | * \param length The length of the input sequence in septets, for |
| 74 | * example pass octet_length*8/7. |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 75 | * |
| 76 | * \returns the number of (8 bit) chars written excluding the terminating \0. |
| 77 | * This is the same like strlen(decoded). |
| 78 | */ |
| 79 | int gsm_7bit_decode_n(char *decoded, size_t n, const uint8_t *user_data, uint8_t length); |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 80 | |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 81 | /*! |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 82 | * Decode a sequence of 7 bit characters (USSD encoding). |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 83 | * |
| 84 | * \see gsm_7bit_encode_n() |
| 85 | */ |
| 86 | int gsm_7bit_decode_n_ussd(char *decoded, size_t n, const uint8_t *user_data, uint8_t length); |
| 87 | |
Jacob Erlbeck | 3f69ceb | 2013-08-12 18:31:59 +0200 | [diff] [blame] | 88 | /*! |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 89 | * Encode a text string into GSM 03.38 encoded 7 bit characters. |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 90 | * |
| 91 | * \param result The destination buffer for the packed 7 bit sequence. |
| 92 | * \param n A maximum of n octets is written. |
| 93 | * \param data A pointer to the start of the \0 terminated 8 bit character |
| 94 | * string. |
| 95 | * \param octets_written Iff not NULL, *octets_written will be set to the |
| 96 | * number of octets written to the result buffer. |
| 97 | * |
| 98 | * \returns the number of septets that have been created. |
| 99 | */ |
| 100 | int gsm_7bit_encode_n(uint8_t *result, size_t n, const char *data, int *octets_written); |
| 101 | |
| 102 | /*! |
Neels Hofmeyr | 87e4550 | 2017-06-20 00:17:59 +0200 | [diff] [blame] | 103 | * Encode a text string into GSM 03.38 encoded 7 bit characters (USSD encoding). |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 104 | * |
| 105 | * \see gsm_7bit_decode_n() |
| 106 | */ |
| 107 | int gsm_7bit_encode_n_ussd(uint8_t *result, size_t n, const char *data, int *octets_written); |
| 108 | |
| 109 | /* the four functions below are helper functions and here for the unit test */ |
Vadim Yanitskiy | 943133c | 2021-01-30 01:31:32 +0100 | [diff] [blame] | 110 | int gsm_septets2octets(uint8_t *result, const uint8_t *rdata, uint8_t septet_len, uint8_t padding) |
| 111 | OSMO_DEPRECATED("This function is unable to handle more than 255 septets, " |
| 112 | "use gsm_septet_pack() instead."); |
| 113 | int gsm_septet_pack(uint8_t *result, const uint8_t *rdata, size_t septet_len, uint8_t padding); |
Dennis Wehrle | 291e613 | 2011-07-24 20:14:13 +0200 | [diff] [blame] | 114 | int gsm_septet_encode(uint8_t *result, const char *data); |
| 115 | uint8_t gsm_get_octet_len(const uint8_t sept_len); |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 116 | int gsm_7bit_decode_n_hdr(char *decoded, size_t n, const uint8_t *user_data, uint8_t length, uint8_t ud_hdr_ind); |
Dennis Wehrle | 291e613 | 2011-07-24 20:14:13 +0200 | [diff] [blame] | 117 | |
Pau Espin Pedrol | e40b963 | 2019-10-31 15:38:30 +0100 | [diff] [blame] | 118 | int ms_class_gmsk_dbm(enum gsm_band band, int ms_class); |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 119 | int ms_pwr_ctl_lvl(enum gsm_band band, unsigned int dbm); |
| 120 | int ms_pwr_dbm(enum gsm_band band, uint8_t lvl); |
| 121 | |
Bhaskar | 6b30f92 | 2013-05-16 17:35:49 +0530 | [diff] [blame] | 122 | /* According to TS 05.08 Chapter 8.1.4 */ |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 123 | int rxlev2dbm(uint8_t rxlev); |
| 124 | uint8_t dbm2rxlev(int dbm); |
| 125 | |
Sylvain Munaut | 4f58549 | 2010-06-09 13:38:56 +0200 | [diff] [blame] | 126 | /* According to GSM 04.08 Chapter 10.5.1.6 */ |
Max | 402b9b0 | 2016-04-21 14:58:30 +0200 | [diff] [blame] | 127 | static inline int ms_cm2_a5n_support(uint8_t *cm2, unsigned n) { |
Sylvain Munaut | 4f58549 | 2010-06-09 13:38:56 +0200 | [diff] [blame] | 128 | switch (n) { |
| 129 | case 0: return 1; |
| 130 | case 1: return (cm2[0] & (1<<3)) ? 0 : 1; |
| 131 | case 2: return (cm2[2] & (1<<0)) ? 1 : 0; |
| 132 | case 3: return (cm2[2] & (1<<1)) ? 1 : 0; |
| 133 | default: |
| 134 | return 0; |
| 135 | } |
| 136 | } |
| 137 | |
Max | 402b9b0 | 2016-04-21 14:58:30 +0200 | [diff] [blame] | 138 | /* According to GSM 04.08 Chapter 10.5.1.7 */ |
| 139 | static inline int ms_cm3_a5n_support(uint8_t *cm3, unsigned n) { |
| 140 | switch (n) { |
| 141 | case 4: return (cm3[0] & (1<<0)) ? 1 : 0; |
| 142 | case 5: return (cm3[0] & (1<<1)) ? 1 : 0; |
| 143 | case 6: return (cm3[0] & (1<<2)) ? 1 : 0; |
| 144 | case 7: return (cm3[0] & (1<<3)) ? 1 : 0; |
| 145 | default: |
| 146 | return 0; |
| 147 | } |
| 148 | } |
| 149 | |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 150 | /* According to GSM 04.08 Chapter 10.5.2.29 */ |
| 151 | static inline int rach_max_trans_val2raw(int val) { return (val >> 1) & 3; } |
| 152 | static inline int rach_max_trans_raw2val(int raw) { |
| 153 | const int tbl[4] = { 1, 2, 4, 7 }; |
| 154 | return tbl[raw & 3]; |
| 155 | } |
Pau Espin Pedrol | 1dac875 | 2022-04-26 17:32:33 +0200 | [diff] [blame] | 156 | static inline uint8_t rach_tx_integer_raw2val(uint8_t raw) { |
| 157 | const int tbl[6] = { 14, 16, 20, 25, 32, 50 }; |
| 158 | raw &= 0x0f; |
| 159 | if (raw <= 9) |
| 160 | return raw + 3; |
| 161 | return tbl[raw - 10]; |
| 162 | } |
Harald Welte | ec8b450 | 2010-02-20 20:34:29 +0100 | [diff] [blame] | 163 | |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 164 | #define ARFCN_PCS 0x8000 |
| 165 | #define ARFCN_UPLINK 0x4000 |
Sylvain Munaut | 2a471ee | 2010-11-13 17:51:37 +0100 | [diff] [blame] | 166 | #define ARFCN_FLAG_MASK 0xf000 /* Reserve the upper 5 bits for flags */ |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 167 | |
Pau Espin Pedrol | c877251 | 2018-11-16 12:59:46 +0100 | [diff] [blame] | 168 | int gsm_arfcn2band_rc(uint16_t arfcn, enum gsm_band *band); |
| 169 | enum gsm_band gsm_arfcn2band(uint16_t arfcn) OSMO_DEPRECATED("Use gsm_arfcn2band_rc() instead"); |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 170 | |
| 171 | /* Convert an ARFCN to the frequency in MHz * 10 */ |
| 172 | uint16_t gsm_arfcn2freq10(uint16_t arfcn, int uplink); |
| 173 | |
Sylvain Munaut | 5572031 | 2012-12-11 23:44:41 +0100 | [diff] [blame] | 174 | /* Convert a Frequency in MHz * 10 to ARFCN */ |
| 175 | uint16_t gsm_freq102arfcn(uint16_t freq10, int uplink); |
| 176 | |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 177 | /* Convert from frame number to GSM time */ |
| 178 | void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn); |
| 179 | |
Philipp Maier | b808da4 | 2017-06-26 10:50:28 +0200 | [diff] [blame] | 180 | /* Parse GSM Frame Number into printable string */ |
| 181 | char *gsm_fn_as_gsmtime_str(uint32_t fn); |
| 182 | |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 183 | /* Convert from GSM time to frame number */ |
Pau Espin Pedrol | 3e5609a | 2023-03-06 13:59:40 +0100 | [diff] [blame] | 184 | uint32_t gsm_gsmtime2fn(const struct gsm_time *time); |
Harald Welte | 622b718 | 2010-03-07 17:50:21 +0100 | [diff] [blame] | 185 | |
Pau Espin Pedrol | 363130f | 2017-07-03 10:42:42 +0200 | [diff] [blame] | 186 | /* Returns static buffer with string representation of a GSM Time */ |
| 187 | char *osmo_dump_gsmtime(const struct gsm_time *tm); |
Harald Welte | 4a62eda | 2019-03-18 18:27:00 +0100 | [diff] [blame] | 188 | char *osmo_dump_gsmtime_buf(char *buf, size_t buf_len, const struct gsm_time *tm); |
Harald Welte | 179f357 | 2019-03-18 18:38:47 +0100 | [diff] [blame] | 189 | char *osmo_dump_gsmtime_c(const void *ctx, const struct gsm_time *tm); |
Pau Espin Pedrol | 363130f | 2017-07-03 10:42:42 +0200 | [diff] [blame] | 190 | |
Pau Espin Pedrol | aea78a2 | 2023-08-11 20:33:38 +0200 | [diff] [blame] | 191 | /* Reduced Frame Number (3GPP TS 44.018 ยง10.5.2.38) */ |
| 192 | #define GSM_RFN_MODULUS 42432 |
| 193 | uint32_t gsm_rfn2fn(uint16_t rfn, uint32_t curr_fn); |
| 194 | static inline uint16_t gsm_fn2rfn(uint32_t fn) |
| 195 | { |
| 196 | return fn % GSM_RFN_MODULUS; |
| 197 | } |
| 198 | |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 199 | /* GSM TS 03.03 Chapter 2.6 */ |
Harald Welte | c226317 | 2010-06-01 10:47:07 +0200 | [diff] [blame] | 200 | enum gprs_tlli_type { |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 201 | TLLI_LOCAL, |
| 202 | TLLI_FOREIGN, |
| 203 | TLLI_RANDOM, |
| 204 | TLLI_AUXILIARY, |
| 205 | TLLI_RESERVED, |
Harald Welte | 1f6aad1 | 2015-08-15 19:51:45 +0200 | [diff] [blame] | 206 | TLLI_G_RNTI, |
| 207 | TLLI_RAND_G_RNTI, |
Harald Welte | a1c4f76 | 2010-05-01 11:59:42 +0200 | [diff] [blame] | 208 | }; |
| 209 | |
| 210 | /* TS 03.03 Chapter 2.6 */ |
| 211 | int gprs_tlli_type(uint32_t tlli); |
| 212 | |
Harald Welte | c226317 | 2010-06-01 10:47:07 +0200 | [diff] [blame] | 213 | uint32_t gprs_tmsi2tlli(uint32_t p_tmsi, enum gprs_tlli_type type); |
| 214 | |
Harald Welte | 11c7193 | 2011-05-24 17:15:12 +0200 | [diff] [blame] | 215 | /* Osmocom internal, not part of any gsm spec */ |
| 216 | enum gsm_phys_chan_config { |
| 217 | GSM_PCHAN_NONE, |
| 218 | GSM_PCHAN_CCCH, |
| 219 | GSM_PCHAN_CCCH_SDCCH4, |
| 220 | GSM_PCHAN_TCH_F, |
| 221 | GSM_PCHAN_TCH_H, |
| 222 | GSM_PCHAN_SDCCH8_SACCH8C, |
| 223 | GSM_PCHAN_PDCH, /* GPRS PDCH */ |
| 224 | GSM_PCHAN_TCH_F_PDCH, /* TCH/F if used, PDCH otherwise */ |
| 225 | GSM_PCHAN_UNKNOWN, |
Harald Welte | 1b12d16 | 2014-12-28 13:37:01 +0100 | [diff] [blame] | 226 | GSM_PCHAN_CCCH_SDCCH4_CBCH, |
| 227 | GSM_PCHAN_SDCCH8_SACCH8C_CBCH, |
Pau Espin Pedrol | 45dc9d0 | 2021-06-28 12:12:53 +0200 | [diff] [blame] | 228 | GSM_PCHAN_OSMO_DYN, |
Harald Welte | 11c7193 | 2011-05-24 17:15:12 +0200 | [diff] [blame] | 229 | _GSM_PCHAN_MAX |
| 230 | }; |
Pau Espin Pedrol | 45dc9d0 | 2021-06-28 12:12:53 +0200 | [diff] [blame] | 231 | /* Backward compatibility with older naming: */ |
| 232 | #define GSM_PCHAN_TCH_F_TCH_H_PDCH GSM_PCHAN_OSMO_DYN |
Harald Welte | 11c7193 | 2011-05-24 17:15:12 +0200 | [diff] [blame] | 233 | |
| 234 | /* Osmocom internal, not part of any gsm spec */ |
| 235 | enum gsm_chan_t { |
| 236 | GSM_LCHAN_NONE, |
| 237 | GSM_LCHAN_SDCCH, |
| 238 | GSM_LCHAN_TCH_F, |
| 239 | GSM_LCHAN_TCH_H, |
| 240 | GSM_LCHAN_UNKNOWN, |
| 241 | GSM_LCHAN_CCCH, |
Harald Welte | 81cd54a | 2012-04-19 23:18:43 +0200 | [diff] [blame] | 242 | GSM_LCHAN_PDTCH, |
Harald Welte | 1b12d16 | 2014-12-28 13:37:01 +0100 | [diff] [blame] | 243 | GSM_LCHAN_CBCH, |
Harald Welte | 11c7193 | 2011-05-24 17:15:12 +0200 | [diff] [blame] | 244 | _GSM_LCHAN_MAX |
| 245 | }; |
| 246 | |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 247 | extern const struct value_string gsm_chan_t_names[]; |
Vadim Yanitskiy | 412a4bb | 2019-05-02 14:31:44 +0200 | [diff] [blame] | 248 | static inline const char *gsm_chan_t_name(enum gsm_chan_t val) |
Philipp Maier | b066305 | 2018-09-25 13:05:40 +0200 | [diff] [blame] | 249 | { return get_value_string(gsm_chan_t_names, val); } |
Max | fb348ee | 2016-03-30 21:14:53 +0200 | [diff] [blame] | 250 | |
Jacob Erlbeck | 1d7f3b5 | 2013-08-12 17:07:53 +0200 | [diff] [blame] | 251 | /* Deprectated functions */ |
Jacob Erlbeck | 26cbd45 | 2014-01-07 13:39:24 +0100 | [diff] [blame] | 252 | /* Limit encoding and decoding to use no more than this amount of buffer bytes */ |
| 253 | #define GSM_7BIT_LEGACY_MAX_BUFFER_SIZE 0x10000 |
| 254 | |
Jacob Erlbeck | 3f69ceb | 2013-08-12 18:31:59 +0200 | [diff] [blame] | 255 | int gsm_7bit_decode(char *decoded, const uint8_t *user_data, uint8_t length) OSMO_DEPRECATED("Use gsm_7bit_decode_n() instead"); |
| 256 | int gsm_7bit_decode_ussd(char *decoded, const uint8_t *user_data, uint8_t length) OSMO_DEPRECATED("Use gsm_7bit_decode_n_ussd() instead"); |
| 257 | int gsm_7bit_encode(uint8_t *result, const char *data) OSMO_DEPRECATED("Use gsm_7bit_encode_n() instead"); |
| 258 | int gsm_7bit_encode_ussd(uint8_t *result, const char *data, int *octets_written) OSMO_DEPRECATED("Use gsm_7bit_encode_n_ussd() instead"); |
| 259 | int gsm_7bit_encode_oct(uint8_t *result, const char *data, int *octets_written) OSMO_DEPRECATED("Use gsm_7bit_encode_n() instead"); |
Neels Hofmeyr | 5b5c349 | 2018-12-26 18:03:17 +0100 | [diff] [blame] | 260 | |
| 261 | enum osmo_rat_type { |
| 262 | OSMO_RAT_UNKNOWN = 0, |
| 263 | OSMO_RAT_GERAN_A, |
| 264 | OSMO_RAT_UTRAN_IU, |
Neels Hofmeyr | 0d39a8d | 2019-01-04 04:37:00 +0100 | [diff] [blame] | 265 | OSMO_RAT_EUTRAN_SGS, |
Neels Hofmeyr | 5b5c349 | 2018-12-26 18:03:17 +0100 | [diff] [blame] | 266 | |
| 267 | /* keep this last */ |
| 268 | OSMO_RAT_COUNT |
| 269 | }; |
| 270 | |
| 271 | extern const struct value_string osmo_rat_type_names[]; |
| 272 | inline static const char *osmo_rat_type_name(enum osmo_rat_type val) |
| 273 | { return get_value_string(osmo_rat_type_names, val); } |