\doxysection{gsm\+\_\+utils.\+h}
\label{gsm__utils_8h_source}\index{include/osmocom/gsm/gsm\_utils.h@{include/osmocom/gsm/gsm\_utils.h}}
\textbf{ Go to the documentation of this file.}
\begin{DoxyCode}{0}
\DoxyCodeLine{1 }
\DoxyCodeLine{3 \textcolor{comment}{/*}}
\DoxyCodeLine{4 \textcolor{comment}{ * (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de>}}
\DoxyCodeLine{5 \textcolor{comment}{ * (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>}}
\DoxyCodeLine{6 \textcolor{comment}{ * (C) 2009-\/2010 by Harald Welte <laforge@gnumonks.org>}}
\DoxyCodeLine{7 \textcolor{comment}{ *}}
\DoxyCodeLine{8 \textcolor{comment}{ * All Rights Reserved}}
\DoxyCodeLine{9 \textcolor{comment}{ *}}
\DoxyCodeLine{10 \textcolor{comment}{ * This program is free software; you can redistribute it and/or modify}}
\DoxyCodeLine{11 \textcolor{comment}{ * it under the terms of the GNU General Public License as published by}}
\DoxyCodeLine{12 \textcolor{comment}{ * the Free Software Foundation; either version 2 of the License, or}}
\DoxyCodeLine{13 \textcolor{comment}{ * (at your option) any later version.}}
\DoxyCodeLine{14 \textcolor{comment}{ *}}
\DoxyCodeLine{15 \textcolor{comment}{ * This program is distributed in the hope that it will be useful,}}
\DoxyCodeLine{16 \textcolor{comment}{ * but WITHOUT ANY WARRANTY; without even the implied warranty of}}
\DoxyCodeLine{17 \textcolor{comment}{ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the}}
\DoxyCodeLine{18 \textcolor{comment}{ * GNU General Public License for more details.}}
\DoxyCodeLine{19 \textcolor{comment}{ *}}
\DoxyCodeLine{20 \textcolor{comment}{ */}}
\DoxyCodeLine{21 }
\DoxyCodeLine{22 \textcolor{preprocessor}{\#pragma once}}
\DoxyCodeLine{23 }
\DoxyCodeLine{24 \textcolor{preprocessor}{\#include <stddef.h>}}
\DoxyCodeLine{25 \textcolor{preprocessor}{\#include <stdint.h>}}
\DoxyCodeLine{26 }
\DoxyCodeLine{27 \textcolor{preprocessor}{\#include <osmocom/core/defs.h>}}
\DoxyCodeLine{28 \textcolor{preprocessor}{\#include <osmocom/core/utils.h>}}
\DoxyCodeLine{29 }
\DoxyCodeLine{30 \textcolor{preprocessor}{\#define ADD\_MODULO(sum, delta, modulo) do \{     \(\backslash\)}}
\DoxyCodeLine{31 \textcolor{preprocessor}{        if ((sum += delta) >= modulo)           \(\backslash\)}}
\DoxyCodeLine{32 \textcolor{preprocessor}{                sum -\/= modulo;                  \(\backslash\)}}
\DoxyCodeLine{33 \textcolor{preprocessor}{        \} while (0)}}
\DoxyCodeLine{34 }
\DoxyCodeLine{35 \textcolor{preprocessor}{\#define GSM\_MAX\_FN      (26*51*2048)}}
\DoxyCodeLine{36 \textcolor{preprocessor}{\#define GSM\_FN\_UNSET    0xFFFFFFFF}}
\DoxyCodeLine{37 }
\DoxyCodeLine{38 \textcolor{comment}{/* Max length of random identifier which can be requested via osmo\_get\_rand\_id() */}}
\DoxyCodeLine{39 \textcolor{preprocessor}{\#define OSMO\_MAX\_RAND\_ID\_LEN 16}}
\DoxyCodeLine{40 }
\DoxyCodeLine{41 \textcolor{keyword}{struct }gsm\_time \{}
\DoxyCodeLine{42         uint32\_t        fn;   \textcolor{comment}{/* FN count */}}
\DoxyCodeLine{43         uint16\_t        t1;   \textcolor{comment}{/* FN div (26*51) */}}
\DoxyCodeLine{44         uint8\_t         t2;   \textcolor{comment}{/* FN modulo 26 */}}
\DoxyCodeLine{45         uint8\_t         t3;   \textcolor{comment}{/* FN modulo 51 */}}
\DoxyCodeLine{46         uint8\_t         tc;}
\DoxyCodeLine{47 \};}
\DoxyCodeLine{48 }
\DoxyCodeLine{49 \textcolor{keyword}{enum} gsm\_band \{}
\DoxyCodeLine{50         GSM\_BAND\_850        = 1,}
\DoxyCodeLine{51         GSM\_BAND\_900        = 2,}
\DoxyCodeLine{52         GSM\_BAND\_1800      = 4,}
\DoxyCodeLine{53         GSM\_BAND\_1900      = 8,}
\DoxyCodeLine{54         GSM\_BAND\_450        = 0x10,}
\DoxyCodeLine{55         GSM\_BAND\_480        = 0x20,}
\DoxyCodeLine{56         GSM\_BAND\_750        = 0x40,}
\DoxyCodeLine{57         GSM\_BAND\_810        = 0x80,}
\DoxyCodeLine{58 \};}
\DoxyCodeLine{59 }
\DoxyCodeLine{60 \textcolor{keyword}{const} \textcolor{keywordtype}{char} *gsm\_band\_name(\textcolor{keyword}{enum} gsm\_band band);}
\DoxyCodeLine{61 \textcolor{keyword}{enum} gsm\_band gsm\_band\_parse(\textcolor{keyword}{const} \textcolor{keywordtype}{char} *mhz);}
\DoxyCodeLine{62 }
\DoxyCodeLine{63 \textcolor{keywordtype}{int} osmo\_get\_rand\_id(uint8\_t *out, \textcolor{keywordtype}{size\_t} len);}
\DoxyCodeLine{64 }
\DoxyCodeLine{79 \textcolor{keywordtype}{int} gsm\_7bit\_decode\_n(\textcolor{keywordtype}{char} *decoded, \textcolor{keywordtype}{size\_t} n, \textcolor{keyword}{const} uint8\_t *user\_data, uint8\_t length);}
\DoxyCodeLine{80 }
\DoxyCodeLine{86 \textcolor{keywordtype}{int} gsm\_7bit\_decode\_n\_ussd(\textcolor{keywordtype}{char} *decoded, \textcolor{keywordtype}{size\_t} n, \textcolor{keyword}{const} uint8\_t *user\_data, uint8\_t length);}
\DoxyCodeLine{87 }
\DoxyCodeLine{100 \textcolor{keywordtype}{int} gsm\_7bit\_encode\_n(uint8\_t *result, \textcolor{keywordtype}{size\_t} n, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *data, \textcolor{keywordtype}{int} *octets\_written);}
\DoxyCodeLine{101 }
\DoxyCodeLine{107 \textcolor{keywordtype}{int} gsm\_7bit\_encode\_n\_ussd(uint8\_t *result, \textcolor{keywordtype}{size\_t} n, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *data, \textcolor{keywordtype}{int} *octets\_written);}
\DoxyCodeLine{108 }
\DoxyCodeLine{109 \textcolor{comment}{/* the four functions below are helper functions and here for the unit test */}}
\DoxyCodeLine{110 \textcolor{keywordtype}{int} gsm\_septets2octets(uint8\_t *result, \textcolor{keyword}{const} uint8\_t *rdata, uint8\_t septet\_len, uint8\_t padding)}
\DoxyCodeLine{111         OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}This function is unable to handle more than 255 septets, "{}}}
\DoxyCodeLine{112                         \textcolor{stringliteral}{"{}use gsm\_septet\_pack() instead."{}});}
\DoxyCodeLine{113 \textcolor{keywordtype}{int} gsm\_septet\_pack(uint8\_t *result, \textcolor{keyword}{const} uint8\_t *rdata, \textcolor{keywordtype}{size\_t} septet\_len, uint8\_t padding);}
\DoxyCodeLine{114 \textcolor{keywordtype}{int} gsm\_septet\_encode(uint8\_t *result, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *data);}
\DoxyCodeLine{115 uint8\_t gsm\_get\_octet\_len(\textcolor{keyword}{const} uint8\_t sept\_len);}
\DoxyCodeLine{116 \textcolor{keywordtype}{int} gsm\_7bit\_decode\_n\_hdr(\textcolor{keywordtype}{char} *decoded, \textcolor{keywordtype}{size\_t} n, \textcolor{keyword}{const} uint8\_t *user\_data, uint8\_t length, uint8\_t ud\_hdr\_ind);}
\DoxyCodeLine{117 }
\DoxyCodeLine{118 \textcolor{keywordtype}{int} ms\_class\_gmsk\_dbm(\textcolor{keyword}{enum} gsm\_band band, \textcolor{keywordtype}{int} ms\_class);}
\DoxyCodeLine{119 \textcolor{keywordtype}{int} ms\_pwr\_ctl\_lvl(\textcolor{keyword}{enum} gsm\_band band, \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} dbm);}
\DoxyCodeLine{120 \textcolor{keywordtype}{int} ms\_pwr\_dbm(\textcolor{keyword}{enum} gsm\_band band, uint8\_t lvl);}
\DoxyCodeLine{121 }
\DoxyCodeLine{122 \textcolor{comment}{/* According to TS 05.08 Chapter 8.1.4 */}}
\DoxyCodeLine{123 \textcolor{keywordtype}{int} rxlev2dbm(uint8\_t rxlev);}
\DoxyCodeLine{124 uint8\_t dbm2rxlev(\textcolor{keywordtype}{int} dbm);}
\DoxyCodeLine{125 }
\DoxyCodeLine{126 \textcolor{comment}{/* According to GSM 04.08 Chapter 10.5.1.6 */}}
\DoxyCodeLine{127 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} ms\_cm2\_a5n\_support(uint8\_t *cm2, \textcolor{keywordtype}{unsigned} n) \{}
\DoxyCodeLine{128         \textcolor{keywordflow}{switch} (n) \{}
\DoxyCodeLine{129                 \textcolor{keywordflow}{case} 0: \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{130                 \textcolor{keywordflow}{case} 1: \textcolor{keywordflow}{return} (cm2[0] \& (1<<3)) ? 0 : 1;}
\DoxyCodeLine{131                 \textcolor{keywordflow}{case} 2: \textcolor{keywordflow}{return} (cm2[2] \& (1<<0)) ? 1 : 0;}
\DoxyCodeLine{132                 \textcolor{keywordflow}{case} 3: \textcolor{keywordflow}{return} (cm2[2] \& (1<<1)) ? 1 : 0;}
\DoxyCodeLine{133                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{134                         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{135         \}}
\DoxyCodeLine{136 \}}
\DoxyCodeLine{137 }
\DoxyCodeLine{138 \textcolor{comment}{/* According to GSM 04.08 Chapter 10.5.1.7 */}}
\DoxyCodeLine{139 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} ms\_cm3\_a5n\_support(uint8\_t *cm3, \textcolor{keywordtype}{unsigned} n) \{}
\DoxyCodeLine{140         \textcolor{keywordflow}{switch} (n) \{}
\DoxyCodeLine{141                 \textcolor{keywordflow}{case} 4: \textcolor{keywordflow}{return} (cm3[0] \& (1<<0)) ? 1 : 0;}
\DoxyCodeLine{142                 \textcolor{keywordflow}{case} 5: \textcolor{keywordflow}{return} (cm3[0] \& (1<<1)) ? 1 : 0;}
\DoxyCodeLine{143                 \textcolor{keywordflow}{case} 6: \textcolor{keywordflow}{return} (cm3[0] \& (1<<2)) ? 1 : 0;}
\DoxyCodeLine{144                 \textcolor{keywordflow}{case} 7: \textcolor{keywordflow}{return} (cm3[0] \& (1<<3)) ? 1 : 0;}
\DoxyCodeLine{145                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{146                         \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{147         \}}
\DoxyCodeLine{148 \}}
\DoxyCodeLine{149 }
\DoxyCodeLine{150 \textcolor{comment}{/* According to GSM 04.08 Chapter 10.5.2.29 */}}
\DoxyCodeLine{151 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} rach\_max\_trans\_val2raw(\textcolor{keywordtype}{int} val) \{ \textcolor{keywordflow}{return} (val >> 1) \& 3; \}}
\DoxyCodeLine{152 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{int} rach\_max\_trans\_raw2val(\textcolor{keywordtype}{int} raw) \{}
\DoxyCodeLine{153         \textcolor{keyword}{const} \textcolor{keywordtype}{int} tbl[4] = \{ 1, 2, 4, 7 \};}
\DoxyCodeLine{154         \textcolor{keywordflow}{return} tbl[raw \& 3];}
\DoxyCodeLine{155 \}}
\DoxyCodeLine{156 \textcolor{keyword}{static} \textcolor{keyword}{inline} uint8\_t rach\_tx\_integer\_raw2val(uint8\_t raw) \{}
\DoxyCodeLine{157         \textcolor{keyword}{const} \textcolor{keywordtype}{int} tbl[6] = \{ 14, 16, 20, 25, 32, 50 \};}
\DoxyCodeLine{158         raw \&= 0x0f;}
\DoxyCodeLine{159         \textcolor{keywordflow}{if} (raw <= 9)}
\DoxyCodeLine{160                 \textcolor{keywordflow}{return} raw + 3;}
\DoxyCodeLine{161         \textcolor{keywordflow}{return} tbl[raw -\/ 10];}
\DoxyCodeLine{162 \}}
\DoxyCodeLine{163 }
\DoxyCodeLine{164 \textcolor{preprocessor}{\#define ARFCN\_PCS       0x8000}}
\DoxyCodeLine{165 \textcolor{preprocessor}{\#define ARFCN\_UPLINK    0x4000}}
\DoxyCodeLine{166 \textcolor{preprocessor}{\#define ARFCN\_FLAG\_MASK 0xf000  }\textcolor{comment}{/* Reserve the upper 5 bits for flags */}\textcolor{preprocessor}{}}
\DoxyCodeLine{167 }
\DoxyCodeLine{168 \textcolor{keywordtype}{int} gsm\_arfcn2band\_rc(uint16\_t arfcn, \textcolor{keyword}{enum} gsm\_band *band);}
\DoxyCodeLine{169 \textcolor{keyword}{enum} gsm\_band gsm\_arfcn2band(uint16\_t arfcn) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use gsm\_arfcn2band\_rc() instead"{}});}
\DoxyCodeLine{170 }
\DoxyCodeLine{171 \textcolor{comment}{/* Convert an ARFCN to the frequency in MHz * 10 */}}
\DoxyCodeLine{172 uint16\_t gsm\_arfcn2freq10(uint16\_t arfcn, \textcolor{keywordtype}{int} uplink);}
\DoxyCodeLine{173 }
\DoxyCodeLine{174 \textcolor{comment}{/* Convert a Frequency in MHz * 10 to ARFCN */}}
\DoxyCodeLine{175 uint16\_t gsm\_freq102arfcn(uint16\_t freq10, \textcolor{keywordtype}{int} uplink);}
\DoxyCodeLine{176 }
\DoxyCodeLine{177 \textcolor{comment}{/* Convert from frame number to GSM time */}}
\DoxyCodeLine{178 \textcolor{keywordtype}{void} gsm\_fn2gsmtime(\textcolor{keyword}{struct} gsm\_time *time, uint32\_t fn);}
\DoxyCodeLine{179 }
\DoxyCodeLine{180 \textcolor{comment}{/* Parse GSM Frame Number into printable string */}}
\DoxyCodeLine{181 \textcolor{keywordtype}{char} *gsm\_fn\_as\_gsmtime\_str(uint32\_t fn);}
\DoxyCodeLine{182 }
\DoxyCodeLine{183 \textcolor{comment}{/* Convert from GSM time to frame number */}}
\DoxyCodeLine{184 uint32\_t gsm\_gsmtime2fn(\textcolor{keyword}{const} \textcolor{keyword}{struct} gsm\_time *time);}
\DoxyCodeLine{185 }
\DoxyCodeLine{186 \textcolor{comment}{/* Returns static buffer with string representation of a GSM Time */}}
\DoxyCodeLine{187 \textcolor{keywordtype}{char} *osmo\_dump\_gsmtime(\textcolor{keyword}{const} \textcolor{keyword}{struct} gsm\_time *tm);}
\DoxyCodeLine{188 \textcolor{keywordtype}{char} *osmo\_dump\_gsmtime\_buf(\textcolor{keywordtype}{char} *buf, \textcolor{keywordtype}{size\_t} buf\_len, \textcolor{keyword}{const} \textcolor{keyword}{struct} gsm\_time *tm);}
\DoxyCodeLine{189 \textcolor{keywordtype}{char} *osmo\_dump\_gsmtime\_c(\textcolor{keyword}{const} \textcolor{keywordtype}{void} *ctx, \textcolor{keyword}{const} \textcolor{keyword}{struct} gsm\_time *tm);}
\DoxyCodeLine{190 }
\DoxyCodeLine{191 \textcolor{comment}{/* Reduced Frame Number (3GPP TS 44.018 §10.5.2.38) */}}
\DoxyCodeLine{192 \textcolor{preprocessor}{\#define GSM\_RFN\_MODULUS 42432}}
\DoxyCodeLine{193 uint32\_t gsm\_rfn2fn(uint16\_t rfn, uint32\_t curr\_fn);}
\DoxyCodeLine{194 \textcolor{keyword}{static} \textcolor{keyword}{inline} uint16\_t gsm\_fn2rfn(uint32\_t fn)}
\DoxyCodeLine{195 \{}
\DoxyCodeLine{196         \textcolor{keywordflow}{return} fn \% GSM\_RFN\_MODULUS;}
\DoxyCodeLine{197 \}}
\DoxyCodeLine{198 }
\DoxyCodeLine{199 \textcolor{comment}{/* GSM TS 03.03 Chapter 2.6 */}}
\DoxyCodeLine{200 \textcolor{keyword}{enum} gprs\_tlli\_type \{}
\DoxyCodeLine{201         TLLI\_LOCAL,}
\DoxyCodeLine{202         TLLI\_FOREIGN,}
\DoxyCodeLine{203         TLLI\_RANDOM,}
\DoxyCodeLine{204         TLLI\_AUXILIARY,}
\DoxyCodeLine{205         TLLI\_RESERVED,}
\DoxyCodeLine{206         TLLI\_G\_RNTI,}
\DoxyCodeLine{207         TLLI\_RAND\_G\_RNTI,}
\DoxyCodeLine{208 \};}
\DoxyCodeLine{209 }
\DoxyCodeLine{210 \textcolor{comment}{/* TS 03.03 Chapter 2.6 */}}
\DoxyCodeLine{211 \textcolor{keywordtype}{int} gprs\_tlli\_type(uint32\_t tlli);}
\DoxyCodeLine{212 }
\DoxyCodeLine{213 uint32\_t gprs\_tmsi2tlli(uint32\_t p\_tmsi, \textcolor{keyword}{enum} gprs\_tlli\_type type);}
\DoxyCodeLine{214 uint32\_t gprs\_tlli2tmsi(uint32\_t tlli);}
\DoxyCodeLine{215 }
\DoxyCodeLine{216 \textcolor{comment}{/* Osmocom internal, not part of any gsm spec */}}
\DoxyCodeLine{217 \textcolor{keyword}{enum} gsm\_phys\_chan\_config \{}
\DoxyCodeLine{218         GSM\_PCHAN\_NONE,}
\DoxyCodeLine{219         GSM\_PCHAN\_CCCH,}
\DoxyCodeLine{220         GSM\_PCHAN\_CCCH\_SDCCH4,}
\DoxyCodeLine{221         GSM\_PCHAN\_TCH\_F,}
\DoxyCodeLine{222         GSM\_PCHAN\_TCH\_H,}
\DoxyCodeLine{223         GSM\_PCHAN\_SDCCH8\_SACCH8C,}
\DoxyCodeLine{224         GSM\_PCHAN\_PDCH,           \textcolor{comment}{/* GPRS PDCH */}}
\DoxyCodeLine{225         GSM\_PCHAN\_TCH\_F\_PDCH,       \textcolor{comment}{/* TCH/F if used, PDCH otherwise */}}
\DoxyCodeLine{226         GSM\_PCHAN\_UNKNOWN,}
\DoxyCodeLine{227         GSM\_PCHAN\_CCCH\_SDCCH4\_CBCH,}
\DoxyCodeLine{228         GSM\_PCHAN\_SDCCH8\_SACCH8C\_CBCH,}
\DoxyCodeLine{229         GSM\_PCHAN\_OSMO\_DYN,}
\DoxyCodeLine{230         \_GSM\_PCHAN\_MAX}
\DoxyCodeLine{231 \};}
\DoxyCodeLine{232 \textcolor{comment}{/* Backward compatibility with older naming: */}}
\DoxyCodeLine{233 \textcolor{preprocessor}{\#define GSM\_PCHAN\_TCH\_F\_TCH\_H\_PDCH GSM\_PCHAN\_OSMO\_DYN}}
\DoxyCodeLine{234 }
\DoxyCodeLine{235 \textcolor{comment}{/* Osmocom internal, not part of any gsm spec */}}
\DoxyCodeLine{236 \textcolor{keyword}{enum} gsm\_chan\_t \{}
\DoxyCodeLine{237         GSM\_LCHAN\_NONE,}
\DoxyCodeLine{238         GSM\_LCHAN\_SDCCH,}
\DoxyCodeLine{239         GSM\_LCHAN\_TCH\_F,}
\DoxyCodeLine{240         GSM\_LCHAN\_TCH\_H,}
\DoxyCodeLine{241         GSM\_LCHAN\_UNKNOWN,}
\DoxyCodeLine{242         GSM\_LCHAN\_CCCH,}
\DoxyCodeLine{243         GSM\_LCHAN\_PDTCH,}
\DoxyCodeLine{244         GSM\_LCHAN\_CBCH,}
\DoxyCodeLine{245         \_GSM\_LCHAN\_MAX}
\DoxyCodeLine{246 \};}
\DoxyCodeLine{247 }
\DoxyCodeLine{248 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string gsm\_chan\_t\_names[];}
\DoxyCodeLine{249 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *gsm\_chan\_t\_name(\textcolor{keyword}{enum} gsm\_chan\_t val)}
\DoxyCodeLine{250 \{ \textcolor{keywordflow}{return} get\_value\_string(gsm\_chan\_t\_names, val); \}}
\DoxyCodeLine{251 }
\DoxyCodeLine{252 \textcolor{comment}{/* Deprectated functions */}}
\DoxyCodeLine{253 \textcolor{comment}{/* Limit encoding and decoding to use no more than this amount of buffer bytes */}}
\DoxyCodeLine{254 \textcolor{preprocessor}{\#define GSM\_7BIT\_LEGACY\_MAX\_BUFFER\_SIZE  0x10000}}
\DoxyCodeLine{255 }
\DoxyCodeLine{256 \textcolor{keywordtype}{int} gsm\_7bit\_decode(\textcolor{keywordtype}{char} *decoded, \textcolor{keyword}{const} uint8\_t *user\_data, uint8\_t length) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use gsm\_7bit\_decode\_n() instead"{}});}
\DoxyCodeLine{257 \textcolor{keywordtype}{int} gsm\_7bit\_decode\_ussd(\textcolor{keywordtype}{char} *decoded, \textcolor{keyword}{const} uint8\_t *user\_data, uint8\_t length) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use gsm\_7bit\_decode\_n\_ussd() instead"{}});}
\DoxyCodeLine{258 \textcolor{keywordtype}{int} gsm\_7bit\_encode(uint8\_t *result, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *data) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use gsm\_7bit\_encode\_n() instead"{}});}
\DoxyCodeLine{259 \textcolor{keywordtype}{int} gsm\_7bit\_encode\_ussd(uint8\_t *result, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *data, \textcolor{keywordtype}{int} *octets\_written) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use gsm\_7bit\_encode\_n\_ussd() instead"{}});}
\DoxyCodeLine{260 \textcolor{keywordtype}{int} gsm\_7bit\_encode\_oct(uint8\_t *result, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *data, \textcolor{keywordtype}{int} *octets\_written) OSMO\_DEPRECATED(\textcolor{stringliteral}{"{}Use gsm\_7bit\_encode\_n() instead"{}});}
\DoxyCodeLine{261 }
\DoxyCodeLine{262 \textcolor{keyword}{enum} osmo\_rat\_type \{}
\DoxyCodeLine{263         OSMO\_RAT\_UNKNOWN = 0,}
\DoxyCodeLine{264         OSMO\_RAT\_GERAN\_A,}
\DoxyCodeLine{265         OSMO\_RAT\_UTRAN\_IU,}
\DoxyCodeLine{266         OSMO\_RAT\_EUTRAN\_SGS,}
\DoxyCodeLine{267 }
\DoxyCodeLine{268         \textcolor{comment}{/* keep this last */}}
\DoxyCodeLine{269         OSMO\_RAT\_COUNT}
\DoxyCodeLine{270 \};}
\DoxyCodeLine{271 }
\DoxyCodeLine{272 \textcolor{keyword}{extern} \textcolor{keyword}{const} \textcolor{keyword}{struct }value\_string osmo\_rat\_type\_names[];}
\DoxyCodeLine{273 \textcolor{keyword}{inline} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *osmo\_rat\_type\_name(\textcolor{keyword}{enum} osmo\_rat\_type val)}
\DoxyCodeLine{274 \{ \textcolor{keywordflow}{return} get\_value\_string(osmo\_rat\_type\_names, val); \}}

\end{DoxyCode}
