blob: 86c5b0169c52067315cddc16445fa3720f40e446 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm_04_08_gprs.h */
2
Harald Welte64f38c02016-04-20 17:12:24 +02003#ifndef _GSM48_GPRS_H
4#define _GSM48_GPRS_H
5
6#include <stdint.h>
Maxa337b9c2016-06-27 15:51:34 +02007#include <stdbool.h>
Harald Welte64f38c02016-04-20 17:12:24 +02008#include <osmocom/gsm/protocol/gsm_04_08.h>
Maxa337b9c2016-06-27 15:51:34 +02009#include <osmocom/crypt/gprs_cipher.h>
Neels Hofmeyrb2600392018-11-16 00:20:39 +010010#include <osmocom/core/endian.h>
Harald Welte64f38c02016-04-20 17:12:24 +020011
12/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
13#define GSM48_MT_GMM_ATTACH_REQ 0x01
14#define GSM48_MT_GMM_ATTACH_ACK 0x02
15#define GSM48_MT_GMM_ATTACH_COMPL 0x03
16#define GSM48_MT_GMM_ATTACH_REJ 0x04
17#define GSM48_MT_GMM_DETACH_REQ 0x05
18#define GSM48_MT_GMM_DETACH_ACK 0x06
19
20#define GSM48_MT_GMM_RA_UPD_REQ 0x08
21#define GSM48_MT_GMM_RA_UPD_ACK 0x09
22#define GSM48_MT_GMM_RA_UPD_COMPL 0x0a
23#define GSM48_MT_GMM_RA_UPD_REJ 0x0b
24
25#define GSM48_MT_GMM_PTMSI_REALL_CMD 0x10
26#define GSM48_MT_GMM_PTMSI_REALL_COMPL 0x11
27#define GSM48_MT_GMM_AUTH_CIPH_REQ 0x12
28#define GSM48_MT_GMM_AUTH_CIPH_RESP 0x13
29#define GSM48_MT_GMM_AUTH_CIPH_REJ 0x14
Harald Welte82f94ef2016-05-05 23:33:27 +020030#define GSM48_MT_GMM_AUTH_CIPH_FAIL 0x1C
Harald Welte64f38c02016-04-20 17:12:24 +020031#define GSM48_MT_GMM_ID_REQ 0x15
32#define GSM48_MT_GMM_ID_RESP 0x16
33#define GSM48_MT_GMM_STATUS 0x20
34#define GSM48_MT_GMM_INFO 0x21
35
36/* Table 10.4a, GPRS Session Management (GSM) */
37#define GSM48_MT_GSM_ACT_PDP_REQ 0x41
38#define GSM48_MT_GSM_ACT_PDP_ACK 0x42
39#define GSM48_MT_GSM_ACT_PDP_REJ 0x43
40#define GSM48_MT_GSM_REQ_PDP_ACT 0x44
41#define GSM48_MT_GSM_REQ_PDP_ACT_REJ 0x45
42#define GSM48_MT_GSM_DEACT_PDP_REQ 0x46
43#define GSM48_MT_GSM_DEACT_PDP_ACK 0x47
44#define GSM48_MT_GSM_ACT_AA_PDP_REQ 0x50
45#define GSM48_MT_GSM_ACT_AA_PDP_ACK 0x51
46#define GSM48_MT_GSM_ACT_AA_PDP_REJ 0x52
47#define GSM48_MT_GSM_DEACT_AA_PDP_REQ 0x53
48#define GSM48_MT_GSM_DEACT_AA_PDP_ACK 0x54
49#define GSM48_MT_GSM_STATUS 0x55
50
51/* Chapter 10.5.5.2 / Table 10.5.135 */
52#define GPRS_ATT_T_ATTACH 1
53#define GPRS_ATT_T_ATT_WHILE_IMSI 2
54#define GPRS_ATT_T_COMBINED 3
55
56extern const struct value_string *gprs_att_t_strs;
Maxf5f773f2016-07-05 19:17:19 +020057extern const struct value_string gprs_msgt_gmm_names[];
Harald Welte64f38c02016-04-20 17:12:24 +020058
59/* Chapter 10.5.5.5 / Table 10.5.138 */
60#define GPRS_DET_T_MO_GPRS 1
61#define GPRS_DET_T_MO_IMSI 2
62#define GPRS_DET_T_MO_COMBINED 3
63/* Network to MS direction */
64#define GPRS_DET_T_MT_REATT_REQ 1
65#define GPRS_DET_T_MT_REATT_NOTREQ 2
66#define GPRS_DET_T_MT_IMSI 3
67
68extern const struct value_string *gprs_det_t_mo_strs;
69extern const struct value_string *gprs_det_t_mt_strs;
70
71/* Chapter 10.5.5.18 / Table 105.150 */
72#define GPRS_UPD_T_RA 0
73#define GPRS_UPD_T_RA_LA 1
74#define GPRS_UPD_T_RA_LA_IMSI_ATT 2
75#define GPRS_UPD_T_PERIODIC 3
76
77extern const struct value_string *gprs_upd_t_strs;
78
Neels Hofmeyr0318f6b2016-08-29 13:18:56 +020079/* Table 10.4 in 3GPP TS 24.008 (successor to 04.08) */
80#define GSM48_MT_GMM_SERVICE_REQ 0x0c
81#define GSM48_MT_GMM_SERVICE_ACK 0x0d
82#define GSM48_MT_GMM_SERVICE_REJ 0x0e
83
Harald Welte64f38c02016-04-20 17:12:24 +020084enum gsm48_gprs_ie_mm {
85 GSM48_IE_GMM_CIPH_CKSN = 0x08, /* 10.5.1.2 */
86 GSM48_IE_GMM_TIMER_READY = 0x17, /* 10.5.7.3 */
87 GSM48_IE_GMM_ALLOC_PTMSI = 0x18, /* 10.5.1.4 */
88 GSM48_IE_GMM_PTMSI_SIG = 0x19, /* 10.5.5.8 */
89 GSM48_IE_GMM_AUTH_RAND = 0x21, /* 10.5.3.1 */
90 GSM48_IE_GMM_AUTH_SRES = 0x22, /* 10.5.3.2 */
91 GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */
92 GSM48_IE_GMM_CAUSE = 0x25, /* 10.5.5.14 */
93 GSM48_IE_GMM_DRX_PARAM = 0x27, /* 10.5.5.6 */
Harald Welte82f94ef2016-05-05 23:33:27 +020094 GSM48_IE_GMM_AUTN = 0x28, /* 10.5.3.1.1 */
95 GSM48_IE_GMM_AUTH_RES_EXT = 0x29, /* 10.5.3.2.1 */
96 GSM48_IE_GMM_AUTH_FAIL_PAR = 0x30, /* 10.5.3.2.2 */
Harald Welte64f38c02016-04-20 17:12:24 +020097 GSM48_IE_GMM_MS_NET_CAPA = 0x31, /* 10.5.5.12 */
98 GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */
99 GSM48_IE_GMM_PS_LCS_CAPA = 0x33, /* 10.5.5.22 */
100 GSM48_IE_GMM_GMM_MBMS_CTX_ST = 0x35, /* 10.5.7.6 */
101};
102
103enum gsm48_gprs_ie_sm {
104 GSM48_IE_GSM_APN = 0x28, /* 10.5.6.1 */
105 GSM48_IE_GSM_PROTO_CONF_OPT = 0x27, /* 10.5.6.3 */
106 GSM48_IE_GSM_PDP_ADDR = 0x2b, /* 10.5.6.4 */
107 GSM48_IE_GSM_AA_TMR = 0x29, /* 10.5.7.3 */
108 GSM48_IE_GSM_NAME_FULL = 0x43, /* 10.5.3.5a */
109 GSM48_IE_GSM_NAME_SHORT = 0x45, /* 10.5.3.5a */
110 GSM48_IE_GSM_TIMEZONE = 0x46, /* 10.5.3.8 */
111 GSM48_IE_GSM_UTC_AND_TZ = 0x47, /* 10.5.3.9 */
112 GSM48_IE_GSM_LSA_ID = 0x48, /* 10.5.3.11 */
113
114 /* Fake IEs that are not present on the Layer3 air interface,
115 * but which we use to simplify internal APIs */
Holger Hans Peter Freyther5a54dcb2017-07-09 12:46:08 +0200116 OSMO_IE_GSM_CHARG_CHAR = 0xfc,
Harald Welte64f38c02016-04-20 17:12:24 +0200117 OSMO_IE_GSM_REQ_QOS = 0xfd,
118 OSMO_IE_GSM_REQ_PDP_ADDR = 0xfe,
119 OSMO_IE_GSM_SUB_QOS = 0xff,
120};
121
122/* Chapter 9.4.15 / Table 9.4.15 */
123struct gsm48_ra_upd_ack {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100124#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200125 uint8_t force_stby:4, /* 10.5.5.7 */
126 upd_result:4; /* 10.5.5.17 */
127 uint8_t ra_upd_timer; /* 10.5.7.3 */
128 struct gsm48_ra_id ra_id; /* 10.5.5.15 */
129 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100130#elif OSMO_IS_BIG_ENDIAN
131/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
132 uint8_t upd_result:4, force_stby:4;
133 uint8_t ra_upd_timer;
134 struct gsm48_ra_id ra_id;
135 uint8_t data[0];
136#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200137} __attribute__((packed));
138
139/* Chapter 10.5.7.3 */
140enum gsm48_gprs_tmr_unit {
141 GPRS_TMR_2SECONDS = 0 << 5,
142 GPRS_TMR_MINUTE = 1 << 5,
143 GPRS_TMR_6MINUTE = 2 << 5,
144 GPRS_TMR_DEACTIVATED = 7 << 5,
145};
146
147#define GPRS_TMR_UNIT_MASK (7 << 5)
148#define GPRS_TMR_FACT_MASK ((1 << 5)-1)
149
150/* Chapter 9.4.2 / Table 9.4.2 */
151struct gsm48_attach_ack {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100152#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200153 uint8_t att_result:4, /* 10.5.5.7 */
154 force_stby:4; /* 10.5.5.1 */
155 uint8_t ra_upd_timer; /* 10.5.7.3 */
156 uint8_t radio_prio; /* 10.5.7.2 */
157 struct gsm48_ra_id ra_id; /* 10.5.5.15 */
158 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100159#elif OSMO_IS_BIG_ENDIAN
160/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
161 uint8_t force_stby:4, att_result:4;
162 uint8_t ra_upd_timer;
163 uint8_t radio_prio;
164 struct gsm48_ra_id ra_id;
165 uint8_t data[0];
166#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200167} __attribute__((packed));
168
169/* Chapter 9.4.9 / Table 9.4.9 */
170struct gsm48_auth_ciph_req {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100171#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200172 uint8_t ciph_alg:4, /* 10.5.5.3 */
173 imeisv_req:4; /* 10.5.5.10 */
174 uint8_t force_stby:4, /* 10.5.5.7 */
175 ac_ref_nr:4; /* 10.5.5.19 */
176 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100177#elif OSMO_IS_BIG_ENDIAN
178/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
179 uint8_t imeisv_req:4, ciph_alg:4;
180 uint8_t ac_ref_nr:4, force_stby:4;
181 uint8_t data[0];
182#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200183} __attribute__((packed));
184/* optional: TV RAND, TV CKSN */
185
186struct gsm48_auth_ciph_resp {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100187#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200188 uint8_t ac_ref_nr:4,
189 spare:4;
190 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100191#elif OSMO_IS_BIG_ENDIAN
192/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
193 uint8_t spare:4, ac_ref_nr:4;
194 uint8_t data[0];
195#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200196} __attribute__((packed));
197
198/* Chapter 9.5.1 / Table 9.5.1 */
199struct gsm48_act_pdp_ctx_req {
200 uint8_t req_nsapi;
201 uint8_t req_llc_sapi;
202 uint8_t data[0];
203} __attribute__((packed));
204
205/* Chapter 10.5.5.14 / Table 10.5.147 */
206enum gsm48_gmm_cause {
207 GMM_CAUSE_IMSI_UNKNOWN = 0x02,
208 GMM_CAUSE_ILLEGAL_MS = 0x03,
Harald Welte82f94ef2016-05-05 23:33:27 +0200209 GMM_CAUSE_IMEI_NOT_ACCEPTED = 0x05,
Harald Welte64f38c02016-04-20 17:12:24 +0200210 GMM_CAUSE_ILLEGAL_ME = 0x06,
211 GMM_CAUSE_GPRS_NOTALLOWED = 0x07,
212 GMM_CAUSE_GPRS_OTHER_NOTALLOWED = 0x08,
213 GMM_CAUSE_MS_ID_NOT_DERIVED = 0x09,
214 GMM_CAUSE_IMPL_DETACHED = 0x0a,
215 GMM_CAUSE_PLMN_NOTALLOWED = 0x0b,
216 GMM_CAUSE_LA_NOTALLOWED = 0x0c,
217 GMM_CAUSE_ROAMING_NOTALLOWED = 0x0d,
218 GMM_CAUSE_NO_GPRS_PLMN = 0x0e,
Harald Welte82f94ef2016-05-05 23:33:27 +0200219 GMM_CAUSE_NO_SUIT_CELL_IN_LA = 0x0f,
Harald Welte64f38c02016-04-20 17:12:24 +0200220 GMM_CAUSE_MSC_TEMP_NOTREACH = 0x10,
221 GMM_CAUSE_NET_FAIL = 0x11,
Harald Welte82f94ef2016-05-05 23:33:27 +0200222 GMM_CAUSE_MAC_FAIL = 0x14,
223 GMM_CAUSE_SYNC_FAIL = 0x15,
Harald Welte64f38c02016-04-20 17:12:24 +0200224 GMM_CAUSE_CONGESTION = 0x16,
Harald Welte82f94ef2016-05-05 23:33:27 +0200225 GMM_CAUSE_GSM_AUTH_UNACCEPT = 0x17,
226 GMM_CAUSE_NOT_AUTH_FOR_CSG = 0x19,
227 GMM_CAUSE_SMS_VIA_GPRS_IN_RA = 0x1c,
228 GMM_CAUSE_NO_PDP_ACTIVATED = 0x28,
Harald Welte64f38c02016-04-20 17:12:24 +0200229 GMM_CAUSE_SEM_INCORR_MSG = 0x5f,
230 GMM_CAUSE_INV_MAND_INFO = 0x60,
231 GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61,
232 GMM_CAUSE_MSGT_INCOMP_P_STATE = 0x62,
233 GMM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63,
234 GMM_CAUSE_COND_IE_ERR = 0x64,
235 GMM_CAUSE_MSG_INCOMP_P_STATE = 0x65,
236 GMM_CAUSE_PROTO_ERR_UNSPEC = 0x6f,
237};
238
239extern const struct value_string *gsm48_gmm_cause_names;
240
Neels Hofmeyr6ad50aa2019-01-14 20:28:56 +0100241/* 3GPP TS 24.008 10.5.6.6 / Table 10.5.157 */
Harald Welte64f38c02016-04-20 17:12:24 +0200242enum gsm48_gsm_cause {
Daniel Willmann6959e3c2017-05-12 11:20:53 +0200243 GSM_CAUSE_OPER_DET_BARR = 0x08,
244 GSM_CAUSE_MBMS_CAP_INSUF = 0x18,
245 GSM_CAUSE_LLC_SNDCP_FAIL = 0x19,
Harald Welte64f38c02016-04-20 17:12:24 +0200246 GSM_CAUSE_INSUFF_RSRC = 0x1a,
247 GSM_CAUSE_MISSING_APN = 0x1b,
248 GSM_CAUSE_UNKNOWN_PDP = 0x1c,
249 GSM_CAUSE_AUTH_FAILED = 0x1d,
250 GSM_CAUSE_ACT_REJ_GGSN = 0x1e,
251 GSM_CAUSE_ACT_REJ_UNSPEC = 0x1f,
252 GSM_CAUSE_SERV_OPT_NOTSUPP = 0x20,
253 GSM_CAUSE_REQ_SERV_OPT_NOTSUB = 0x21,
254 GSM_CAUSE_SERV_OPT_TEMP_OOO = 0x22,
255 GSM_CAUSE_NSAPI_IN_USE = 0x23,
256 GSM_CAUSE_DEACT_REGULAR = 0x24,
257 GSM_CAUSE_QOS_NOT_ACCEPTED = 0x25,
258 GSM_CAUSE_NET_FAIL = 0x26,
259 GSM_CAUSE_REACT_RQD = 0x27,
260 GSM_CAUSE_FEATURE_NOTSUPP = 0x28,
261 GSM_CAUSE_INVALID_TRANS_ID = 0x51,
262 GSM_CAUSE_SEM_INCORR_MSG = 0x5f,
263 GSM_CAUSE_INV_MAND_INFO = 0x60,
264 GSM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61,
265 GSM_CAUSE_MSGT_INCOMP_P_STATE = 0x62,
266 GSM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63,
267 GSM_CAUSE_COND_IE_ERR = 0x64,
268 GSM_CAUSE_MSG_INCOMP_P_STATE = 0x65,
269 GSM_CAUSE_PROTO_ERR_UNSPEC = 0x6f,
270};
271
272extern const struct value_string *gsm48_gsm_cause_names;
273
274/* Section 6.1.2.2: Session management states on the network side */
275enum gsm48_pdp_state {
276 PDP_S_INACTIVE,
277 PDP_S_ACTIVE_PENDING,
278 PDP_S_ACTIVE,
279 PDP_S_INACTIVE_PENDING,
280 PDP_S_MODIFY_PENDING,
281};
282
283/* Table 10.5.155/3GPP TS 24.008 */
284enum gsm48_pdp_type_org {
285 PDP_TYPE_ORG_ETSI = 0x00,
286 PDP_TYPE_ORG_IETF = 0x01,
287};
288enum gsm48_pdp_type_nr {
289 PDP_TYPE_N_ETSI_RESERVED = 0x00,
290 PDP_TYPE_N_ETSI_PPP = 0x01,
291 PDP_TYPE_N_IETF_IPv4 = 0x21,
292 PDP_TYPE_N_IETF_IPv6 = 0x57,
293};
294
295/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
296enum gsm48_qos_reliab_class {
297 GSM48_QOS_RC_LLC_ACK_RLC_ACK_DATA_PROT = 2,
298 GSM48_QOS_RC_LLC_UN_RLC_ACK_DATA_PROT = 3,
299 GSM48_QOS_RC_LLC_UN_RLC_UN_PROT_DATA = 4,
300 GSM48_QOS_RC_LLC_UN_RLC_UN_DATA_UN = 5,
301};
302
303/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
304enum gsm48_qos_preced_class {
305 GSM48_QOS_PC_HIGH = 1,
306 GSM48_QOS_PC_NORMAL = 2,
307 GSM48_QOS_PC_LOW = 3,
308};
309
310/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
311enum gsm48_qos_peak_tput {
312 GSM48_QOS_PEAK_TPUT_1000bps = 1,
313 GSM48_QOS_PEAK_TPUT_2000bps = 2,
314 GSM48_QOS_PEAK_TPUT_4000bps = 3,
315 GSM48_QOS_PEAK_TPUT_8000bps = 4,
316 GSM48_QOS_PEAK_TPUT_16000bps = 5,
317 GSM48_QOS_PEAK_TPUT_32000bps = 6,
318 GSM48_QOS_PEAK_TPUT_64000bps = 7,
319 GSM48_QOS_PEAK_TPUT_128000bps = 8,
320 GSM48_QOS_PEAK_TPUT_256000bps = 9,
321};
322
323/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
324enum gsm48_qos_mean_tput {
325 GSM48_QOS_MEAN_TPUT_100bph = 1,
326 GSM48_QOS_MEAN_TPUT_200bph = 2,
327 GSM48_QOS_MEAN_TPUT_500bph = 3,
328 GSM48_QOS_MEAN_TPUT_1000bph = 4,
329 GSM48_QOS_MEAN_TPUT_2000bph = 5,
330 GSM48_QOS_MEAN_TPUT_5000bph = 6,
331 GSM48_QOS_MEAN_TPUT_10000bph = 7,
332 GSM48_QOS_MEAN_TPUT_20000bph = 8,
333 GSM48_QOS_MEAN_TPUT_50000bph = 9,
334 GSM48_QOS_MEAN_TPUT_100kbph = 10,
335 GSM48_QOS_MEAN_TPUT_200kbph = 11,
336 GSM48_QOS_MEAN_TPUT_500kbph = 0xc,
337 GSM48_QOS_MEAN_TPUT_1Mbph = 0xd,
338 GSM48_QOS_MEAN_TPUT_2Mbph = 0xe,
339 GSM48_QOS_MEAN_TPUT_5Mbph = 0xf,
340 GSM48_QOS_MEAN_TPUT_10Mbph = 0x10,
341 GSM48_QOS_MEAN_TPUT_20Mbph = 0x11,
342 GSM48_QOS_MEAN_TPUT_50Mbph = 0x12,
343 GSM48_QOS_MEAN_TPUT_BEST_EFFORT = 0x1f,
344};
345
346/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
347enum gsm48_qos_err_sdu {
348 GSM48_QOS_ERRSDU_NODETECT = 1,
349 GSM48_QOS_ERRSDU_YES = 2,
350 GSM48_QOS_ERRSDU_NO = 3,
351};
352
353/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
354enum gsm48_qos_deliv_order {
355 GSM48_QOS_DO_ORDERED = 1,
356 GSM48_QOS_DO_UNORDERED = 2,
357};
358
359/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
360enum gsm48_qos_traf_class {
361 GSM48_QOS_TC_CONVERSATIONAL = 1,
362 GSM48_QOS_TC_STREAMING = 2,
363 GSM48_QOS_TC_INTERACTIVE = 3,
364 GSM48_QOS_TC_BACKGROUND = 4,
365};
366
367/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
368enum gsm48_qos_max_sdu_size {
369 /* values below in 10 octet granularity */
370 GSM48_QOS_MAXSDU_1502 = 0x97,
371 GSM48_QOS_MAXSDU_1510 = 0x98,
372 GSM48_QOS_MAXSDU_1520 = 0x99,
373};
374
375/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
376enum gsm48_qos_max_bitrate {
377 GSM48_QOS_MBRATE_1k = 0x01,
378 GSM48_QOS_MBRATE_63k = 0x3f,
379 GSM48_QOS_MBRATE_64k = 0x40,
380 GSM48_QOS_MBRATE_568k = 0x7f,
381 GSM48_QOS_MBRATE_576k = 0x80,
382 GSM48_QOS_MBRATE_8640k = 0xfe,
383 GSM48_QOS_MBRATE_0k = 0xff,
384};
385
386/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
387enum gsm48_qos_resid_ber {
388 GSM48_QOS_RBER_5e_2 = 0x01,
389 GSM48_QOS_RBER_1e_2 = 0x02,
390 GSM48_QOS_RBER_5e_3 = 0x03,
391 GSM48_QOS_RBER_4e_3 = 0x04,
392 GSM48_QOS_RBER_1e_3 = 0x05,
393 GSM48_QOS_RBER_1e_4 = 0x06,
394 GSM48_QOS_RBER_1e_5 = 0x07,
395 GSM48_QOS_RBER_1e_6 = 0x08,
396 GSM48_QOS_RBER_6e_8 = 0x09,
397};
398
399/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
400enum gsm48_qos_sdu_err {
401 GSM48_QOS_SERR_1e_2 = 0x01,
402 GSM48_QOS_SERR_7e_2 = 0x02,
403 GSM48_QOS_SERR_1e_3 = 0x03,
404 GSM48_QOS_SERR_1e_4 = 0x04,
405 GSM48_QOS_SERR_1e_5 = 0x05,
406 GSM48_QOS_SERR_1e_6 = 0x06,
407 GSM48_QOS_SERR_1e_1 = 0x07,
408};
409
Neels Hofmeyr0318f6b2016-08-29 13:18:56 +0200410/* 3GPP 24.008 / Chapter 10.5.5.20 / Table 10.5.153a */
411enum gsm48_gmm_service_type {
412 GPRS_SERVICE_T_SIGNALLING = 0x00,
413 GPRS_SERVICE_T_DATA = 0x01,
414 GPRS_SERVICE_T_PAGING_RESP = 0x02,
415 GPRS_SERVICE_T_MBMS_MC_SERV = 0x03,
416 GPRS_SERVICE_T_MBMS_BC_SERV = 0x04,
417};
418
419extern const struct value_string *gprs_service_t_strs;
420
Maxa337b9c2016-06-27 15:51:34 +0200421bool gprs_ms_net_cap_gea_supported(const uint8_t *ms_net_cap, uint8_t cap_len,
422 enum gprs_ciph_algo gea);
423
Harald Welte64f38c02016-04-20 17:12:24 +0200424/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
425struct gsm48_qos {
426 /* octet 3 */
427 uint8_t reliab_class:3;
428 uint8_t delay_class:3;
429 uint8_t spare:2;
430 /* octet 4 */
431 uint8_t preced_class:3;
432 uint8_t spare2:1;
433 uint8_t peak_tput:4;
434 /* octet 5 */
435 uint8_t mean_tput:5;
436 uint8_t spare3:3;
437 /* octet 6 */
438 uint8_t deliv_err_sdu:3;
439 uint8_t deliv_order:2;
440 uint8_t traf_class:3;
441 /* octet 7 */
442 uint8_t max_sdu_size;
443 /* octet 8 */
444 uint8_t max_bitrate_up;
445 /* octet 9 */
446 uint8_t max_bitrate_down;
447 /* octet 10 */
448 uint8_t sdu_err_ratio:4;
449 uint8_t resid_ber:4;
450 /* octet 11 */
451 uint8_t handling_prio:2;
452 uint8_t xfer_delay:6;
453 /* octet 12 */
454 uint8_t guar_bitrate_up;
455 /* octet 13 */
456 uint8_t guar_bitrate_down;
457 /* octet 14 */
458 uint8_t src_stats_desc:4;
459 uint8_t sig_ind:1;
460 uint8_t spare5:3;
461 /* octet 15 */
462 uint8_t max_bitrate_down_ext;
463 /* octet 16 */
464 uint8_t guar_bitrate_down_ext;
465};
466
467
468#endif /* _GSM48_GPRS_H */