blob: 2671aafb1b66656b7bb10505edc3a62bd7dfb810 [file] [log] [blame]
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02001/*! \file gsm_04_08_gprs.h */
2
Vadim Yanitskiy395db202022-09-28 23:51:42 +07003#pragma once
Harald Welte64f38c02016-04-20 17:12:24 +02004
5#include <stdint.h>
Maxa337b9c2016-06-27 15:51:34 +02006#include <stdbool.h>
Harald Welte64f38c02016-04-20 17:12:24 +02007#include <osmocom/gsm/protocol/gsm_04_08.h>
Maxa337b9c2016-06-27 15:51:34 +02008#include <osmocom/crypt/gprs_cipher.h>
Neels Hofmeyrb2600392018-11-16 00:20:39 +01009#include <osmocom/core/endian.h>
Harald Welte64f38c02016-04-20 17:12:24 +020010
11/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
12#define GSM48_MT_GMM_ATTACH_REQ 0x01
13#define GSM48_MT_GMM_ATTACH_ACK 0x02
14#define GSM48_MT_GMM_ATTACH_COMPL 0x03
15#define GSM48_MT_GMM_ATTACH_REJ 0x04
16#define GSM48_MT_GMM_DETACH_REQ 0x05
17#define GSM48_MT_GMM_DETACH_ACK 0x06
18
19#define GSM48_MT_GMM_RA_UPD_REQ 0x08
20#define GSM48_MT_GMM_RA_UPD_ACK 0x09
21#define GSM48_MT_GMM_RA_UPD_COMPL 0x0a
22#define GSM48_MT_GMM_RA_UPD_REJ 0x0b
23
24#define GSM48_MT_GMM_PTMSI_REALL_CMD 0x10
25#define GSM48_MT_GMM_PTMSI_REALL_COMPL 0x11
26#define GSM48_MT_GMM_AUTH_CIPH_REQ 0x12
27#define GSM48_MT_GMM_AUTH_CIPH_RESP 0x13
28#define GSM48_MT_GMM_AUTH_CIPH_REJ 0x14
Harald Welte82f94ef2016-05-05 23:33:27 +020029#define GSM48_MT_GMM_AUTH_CIPH_FAIL 0x1C
Harald Welte64f38c02016-04-20 17:12:24 +020030#define GSM48_MT_GMM_ID_REQ 0x15
31#define GSM48_MT_GMM_ID_RESP 0x16
32#define GSM48_MT_GMM_STATUS 0x20
33#define GSM48_MT_GMM_INFO 0x21
34
35/* Table 10.4a, GPRS Session Management (GSM) */
36#define GSM48_MT_GSM_ACT_PDP_REQ 0x41
37#define GSM48_MT_GSM_ACT_PDP_ACK 0x42
38#define GSM48_MT_GSM_ACT_PDP_REJ 0x43
39#define GSM48_MT_GSM_REQ_PDP_ACT 0x44
40#define GSM48_MT_GSM_REQ_PDP_ACT_REJ 0x45
41#define GSM48_MT_GSM_DEACT_PDP_REQ 0x46
42#define GSM48_MT_GSM_DEACT_PDP_ACK 0x47
43#define GSM48_MT_GSM_ACT_AA_PDP_REQ 0x50
44#define GSM48_MT_GSM_ACT_AA_PDP_ACK 0x51
45#define GSM48_MT_GSM_ACT_AA_PDP_REJ 0x52
46#define GSM48_MT_GSM_DEACT_AA_PDP_REQ 0x53
47#define GSM48_MT_GSM_DEACT_AA_PDP_ACK 0x54
48#define GSM48_MT_GSM_STATUS 0x55
49
50/* Chapter 10.5.5.2 / Table 10.5.135 */
51#define GPRS_ATT_T_ATTACH 1
52#define GPRS_ATT_T_ATT_WHILE_IMSI 2
53#define GPRS_ATT_T_COMBINED 3
54
55extern const struct value_string *gprs_att_t_strs;
Maxf5f773f2016-07-05 19:17:19 +020056extern const struct value_string gprs_msgt_gmm_names[];
Harald Welte64f38c02016-04-20 17:12:24 +020057
58/* Chapter 10.5.5.5 / Table 10.5.138 */
59#define GPRS_DET_T_MO_GPRS 1
60#define GPRS_DET_T_MO_IMSI 2
61#define GPRS_DET_T_MO_COMBINED 3
62/* Network to MS direction */
63#define GPRS_DET_T_MT_REATT_REQ 1
64#define GPRS_DET_T_MT_REATT_NOTREQ 2
65#define GPRS_DET_T_MT_IMSI 3
66
67extern const struct value_string *gprs_det_t_mo_strs;
68extern const struct value_string *gprs_det_t_mt_strs;
69
70/* Chapter 10.5.5.18 / Table 105.150 */
71#define GPRS_UPD_T_RA 0
72#define GPRS_UPD_T_RA_LA 1
73#define GPRS_UPD_T_RA_LA_IMSI_ATT 2
74#define GPRS_UPD_T_PERIODIC 3
75
76extern const struct value_string *gprs_upd_t_strs;
77
Neels Hofmeyr0318f6b2016-08-29 13:18:56 +020078/* Table 10.4 in 3GPP TS 24.008 (successor to 04.08) */
79#define GSM48_MT_GMM_SERVICE_REQ 0x0c
80#define GSM48_MT_GMM_SERVICE_ACK 0x0d
81#define GSM48_MT_GMM_SERVICE_REJ 0x0e
82
Harald Welte64f38c02016-04-20 17:12:24 +020083enum gsm48_gprs_ie_mm {
84 GSM48_IE_GMM_CIPH_CKSN = 0x08, /* 10.5.1.2 */
Pau Espin Pedrol550fdf82023-04-25 18:37:36 +020085 GSM48_IE_GMM_PTMSI_TYPE = 0x0e, /* 10.5.5.29 */
Neels Hofmeyra9c29b42023-05-12 00:02:21 +020086 GSM48_IE_GMM_TMSI_BASED_NRI_C = 0x10, /* 10.5.5.31 */
Harald Welte64f38c02016-04-20 17:12:24 +020087 GSM48_IE_GMM_TIMER_READY = 0x17, /* 10.5.7.3 */
88 GSM48_IE_GMM_ALLOC_PTMSI = 0x18, /* 10.5.1.4 */
89 GSM48_IE_GMM_PTMSI_SIG = 0x19, /* 10.5.5.8 */
90 GSM48_IE_GMM_AUTH_RAND = 0x21, /* 10.5.3.1 */
91 GSM48_IE_GMM_AUTH_SRES = 0x22, /* 10.5.3.2 */
92 GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */
93 GSM48_IE_GMM_CAUSE = 0x25, /* 10.5.5.14 */
Pau Espin Pedrol547a65a2023-07-18 17:35:27 +020094 GSM48_IE_GMM_RX_NPDU_NUM_LIST = 0x26, /* 10.5.5.11 */
Harald Welte64f38c02016-04-20 17:12:24 +020095 GSM48_IE_GMM_DRX_PARAM = 0x27, /* 10.5.5.6 */
Harald Welte82f94ef2016-05-05 23:33:27 +020096 GSM48_IE_GMM_AUTN = 0x28, /* 10.5.3.1.1 */
97 GSM48_IE_GMM_AUTH_RES_EXT = 0x29, /* 10.5.3.2.1 */
Pau Espin Pedrol5e79a302023-04-13 13:46:25 +020098 GSM48_IE_GMM_TIMER_T3302 = 0x2A, /* 10.5.7.4 */
Harald Welte82f94ef2016-05-05 23:33:27 +020099 GSM48_IE_GMM_AUTH_FAIL_PAR = 0x30, /* 10.5.3.2.2 */
Harald Welte64f38c02016-04-20 17:12:24 +0200100 GSM48_IE_GMM_MS_NET_CAPA = 0x31, /* 10.5.5.12 */
101 GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */
102 GSM48_IE_GMM_PS_LCS_CAPA = 0x33, /* 10.5.5.22 */
103 GSM48_IE_GMM_GMM_MBMS_CTX_ST = 0x35, /* 10.5.7.6 */
Pau Espin Pedrol5e79a302023-04-13 13:46:25 +0200104 GSM48_IE_GMM_TIMER_T3346 = 0x3A, /* 10.5.7.4 */
Pau Espin Pedrolbfcce402020-11-26 19:28:55 +0100105 GSM48_IE_GMM_NET_FEAT_SUPPORT = 0xB0, /* 10.5.5.23 */
Harald Welte64f38c02016-04-20 17:12:24 +0200106};
107
108enum gsm48_gprs_ie_sm {
Pau Espin Pedrolec7d5022023-03-28 18:16:12 +0200109 GSM48_IE_GSM_RADIO_PRIO = 0x08, /* 10.5.7.2 */
110 GSM48_IE_GSM_DEV_PROP = 0x0C, /* 10.5.7.8 */
Harald Welte64f38c02016-04-20 17:12:24 +0200111 GSM48_IE_GSM_APN = 0x28, /* 10.5.6.1 */
112 GSM48_IE_GSM_PROTO_CONF_OPT = 0x27, /* 10.5.6.3 */
113 GSM48_IE_GSM_PDP_ADDR = 0x2b, /* 10.5.6.4 */
114 GSM48_IE_GSM_AA_TMR = 0x29, /* 10.5.7.3 */
Pau Espin Pedrolec7d5022023-03-28 18:16:12 +0200115 GSM48_IE_GSM_QOS = 0x30, /* 10.5.6.5 */
116 GSM48_IE_GSM_TFT = 0x31, /* 10.5.6.12 */
117 GSM48_IE_GSM_LLC_SAPI = 0x32, /* 10.5.6.9 */
118 GSM48_IE_GSM_MBIFOM_CONT = 0x33, /* 10.5.6.21 */
119 GSM48_IE_GSM_PFI = 0x34, /* 10.5.6.11 */
Harald Welte64f38c02016-04-20 17:12:24 +0200120 GSM48_IE_GSM_NAME_FULL = 0x43, /* 10.5.3.5a */
121 GSM48_IE_GSM_NAME_SHORT = 0x45, /* 10.5.3.5a */
122 GSM48_IE_GSM_TIMEZONE = 0x46, /* 10.5.3.8 */
123 GSM48_IE_GSM_UTC_AND_TZ = 0x47, /* 10.5.3.9 */
124 GSM48_IE_GSM_LSA_ID = 0x48, /* 10.5.3.11 */
Pau Espin Pedrolec7d5022023-03-28 18:16:12 +0200125 GSM48_IE_GSM_EXT_QOS = 0x5C, /* 10.5.6.5B */
126 GSM48_IE_GSM_EXT_PROTO_CONF_OPT = 0x7B, /* 10.5.6.3a */
Harald Welte64f38c02016-04-20 17:12:24 +0200127
128 /* Fake IEs that are not present on the Layer3 air interface,
129 * but which we use to simplify internal APIs */
Holger Hans Peter Freyther5a54dcb2017-07-09 12:46:08 +0200130 OSMO_IE_GSM_CHARG_CHAR = 0xfc,
Harald Welte64f38c02016-04-20 17:12:24 +0200131 OSMO_IE_GSM_REQ_QOS = 0xfd,
132 OSMO_IE_GSM_REQ_PDP_ADDR = 0xfe,
133 OSMO_IE_GSM_SUB_QOS = 0xff,
134};
135
136/* Chapter 9.4.15 / Table 9.4.15 */
137struct gsm48_ra_upd_ack {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100138#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200139 uint8_t force_stby:4, /* 10.5.5.7 */
140 upd_result:4; /* 10.5.5.17 */
141 uint8_t ra_upd_timer; /* 10.5.7.3 */
142 struct gsm48_ra_id ra_id; /* 10.5.5.15 */
143 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100144#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +0100145/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100146 uint8_t upd_result:4, force_stby:4;
147 uint8_t ra_upd_timer;
148 struct gsm48_ra_id ra_id;
149 uint8_t data[0];
150#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200151} __attribute__((packed));
152
153/* Chapter 10.5.7.3 */
154enum gsm48_gprs_tmr_unit {
155 GPRS_TMR_2SECONDS = 0 << 5,
156 GPRS_TMR_MINUTE = 1 << 5,
157 GPRS_TMR_6MINUTE = 2 << 5,
158 GPRS_TMR_DEACTIVATED = 7 << 5,
159};
160
161#define GPRS_TMR_UNIT_MASK (7 << 5)
162#define GPRS_TMR_FACT_MASK ((1 << 5)-1)
163
164/* Chapter 9.4.2 / Table 9.4.2 */
165struct gsm48_attach_ack {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100166#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200167 uint8_t att_result:4, /* 10.5.5.7 */
168 force_stby:4; /* 10.5.5.1 */
169 uint8_t ra_upd_timer; /* 10.5.7.3 */
170 uint8_t radio_prio; /* 10.5.7.2 */
171 struct gsm48_ra_id ra_id; /* 10.5.5.15 */
172 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100173#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +0100174/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100175 uint8_t force_stby:4, att_result:4;
176 uint8_t ra_upd_timer;
177 uint8_t radio_prio;
178 struct gsm48_ra_id ra_id;
179 uint8_t data[0];
180#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200181} __attribute__((packed));
182
183/* Chapter 9.4.9 / Table 9.4.9 */
184struct gsm48_auth_ciph_req {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100185#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200186 uint8_t ciph_alg:4, /* 10.5.5.3 */
187 imeisv_req:4; /* 10.5.5.10 */
188 uint8_t force_stby:4, /* 10.5.5.7 */
189 ac_ref_nr:4; /* 10.5.5.19 */
190 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100191#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +0100192/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100193 uint8_t imeisv_req:4, ciph_alg:4;
194 uint8_t ac_ref_nr:4, force_stby:4;
195 uint8_t data[0];
196#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200197} __attribute__((packed));
198/* optional: TV RAND, TV CKSN */
199
200struct gsm48_auth_ciph_resp {
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100201#if OSMO_IS_LITTLE_ENDIAN
Harald Welte64f38c02016-04-20 17:12:24 +0200202 uint8_t ac_ref_nr:4,
203 spare:4;
204 uint8_t data[0];
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100205#elif OSMO_IS_BIG_ENDIAN
Oliver Smith0b5c09b2023-02-17 10:35:38 +0100206/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
Neels Hofmeyrb2600392018-11-16 00:20:39 +0100207 uint8_t spare:4, ac_ref_nr:4;
208 uint8_t data[0];
209#endif
Harald Welte64f38c02016-04-20 17:12:24 +0200210} __attribute__((packed));
211
212/* Chapter 9.5.1 / Table 9.5.1 */
213struct gsm48_act_pdp_ctx_req {
214 uint8_t req_nsapi;
215 uint8_t req_llc_sapi;
216 uint8_t data[0];
217} __attribute__((packed));
218
219/* Chapter 10.5.5.14 / Table 10.5.147 */
220enum gsm48_gmm_cause {
221 GMM_CAUSE_IMSI_UNKNOWN = 0x02,
222 GMM_CAUSE_ILLEGAL_MS = 0x03,
Harald Welte82f94ef2016-05-05 23:33:27 +0200223 GMM_CAUSE_IMEI_NOT_ACCEPTED = 0x05,
Harald Welte64f38c02016-04-20 17:12:24 +0200224 GMM_CAUSE_ILLEGAL_ME = 0x06,
225 GMM_CAUSE_GPRS_NOTALLOWED = 0x07,
226 GMM_CAUSE_GPRS_OTHER_NOTALLOWED = 0x08,
227 GMM_CAUSE_MS_ID_NOT_DERIVED = 0x09,
228 GMM_CAUSE_IMPL_DETACHED = 0x0a,
229 GMM_CAUSE_PLMN_NOTALLOWED = 0x0b,
230 GMM_CAUSE_LA_NOTALLOWED = 0x0c,
231 GMM_CAUSE_ROAMING_NOTALLOWED = 0x0d,
232 GMM_CAUSE_NO_GPRS_PLMN = 0x0e,
Harald Welte82f94ef2016-05-05 23:33:27 +0200233 GMM_CAUSE_NO_SUIT_CELL_IN_LA = 0x0f,
Harald Welte64f38c02016-04-20 17:12:24 +0200234 GMM_CAUSE_MSC_TEMP_NOTREACH = 0x10,
235 GMM_CAUSE_NET_FAIL = 0x11,
Harald Welte82f94ef2016-05-05 23:33:27 +0200236 GMM_CAUSE_MAC_FAIL = 0x14,
237 GMM_CAUSE_SYNC_FAIL = 0x15,
Harald Welte64f38c02016-04-20 17:12:24 +0200238 GMM_CAUSE_CONGESTION = 0x16,
Harald Welte82f94ef2016-05-05 23:33:27 +0200239 GMM_CAUSE_GSM_AUTH_UNACCEPT = 0x17,
240 GMM_CAUSE_NOT_AUTH_FOR_CSG = 0x19,
241 GMM_CAUSE_SMS_VIA_GPRS_IN_RA = 0x1c,
242 GMM_CAUSE_NO_PDP_ACTIVATED = 0x28,
Harald Welte64f38c02016-04-20 17:12:24 +0200243 GMM_CAUSE_SEM_INCORR_MSG = 0x5f,
244 GMM_CAUSE_INV_MAND_INFO = 0x60,
245 GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61,
246 GMM_CAUSE_MSGT_INCOMP_P_STATE = 0x62,
247 GMM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63,
248 GMM_CAUSE_COND_IE_ERR = 0x64,
249 GMM_CAUSE_MSG_INCOMP_P_STATE = 0x65,
250 GMM_CAUSE_PROTO_ERR_UNSPEC = 0x6f,
251};
252
253extern const struct value_string *gsm48_gmm_cause_names;
254
Neels Hofmeyr6ad50aa2019-01-14 20:28:56 +0100255/* 3GPP TS 24.008 10.5.6.6 / Table 10.5.157 */
Harald Welte64f38c02016-04-20 17:12:24 +0200256enum gsm48_gsm_cause {
Daniel Willmann6959e3c2017-05-12 11:20:53 +0200257 GSM_CAUSE_OPER_DET_BARR = 0x08,
258 GSM_CAUSE_MBMS_CAP_INSUF = 0x18,
259 GSM_CAUSE_LLC_SNDCP_FAIL = 0x19,
Harald Welte64f38c02016-04-20 17:12:24 +0200260 GSM_CAUSE_INSUFF_RSRC = 0x1a,
261 GSM_CAUSE_MISSING_APN = 0x1b,
262 GSM_CAUSE_UNKNOWN_PDP = 0x1c,
263 GSM_CAUSE_AUTH_FAILED = 0x1d,
264 GSM_CAUSE_ACT_REJ_GGSN = 0x1e,
265 GSM_CAUSE_ACT_REJ_UNSPEC = 0x1f,
266 GSM_CAUSE_SERV_OPT_NOTSUPP = 0x20,
267 GSM_CAUSE_REQ_SERV_OPT_NOTSUB = 0x21,
268 GSM_CAUSE_SERV_OPT_TEMP_OOO = 0x22,
269 GSM_CAUSE_NSAPI_IN_USE = 0x23,
270 GSM_CAUSE_DEACT_REGULAR = 0x24,
271 GSM_CAUSE_QOS_NOT_ACCEPTED = 0x25,
272 GSM_CAUSE_NET_FAIL = 0x26,
273 GSM_CAUSE_REACT_RQD = 0x27,
274 GSM_CAUSE_FEATURE_NOTSUPP = 0x28,
275 GSM_CAUSE_INVALID_TRANS_ID = 0x51,
276 GSM_CAUSE_SEM_INCORR_MSG = 0x5f,
277 GSM_CAUSE_INV_MAND_INFO = 0x60,
278 GSM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61,
279 GSM_CAUSE_MSGT_INCOMP_P_STATE = 0x62,
280 GSM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63,
281 GSM_CAUSE_COND_IE_ERR = 0x64,
282 GSM_CAUSE_MSG_INCOMP_P_STATE = 0x65,
283 GSM_CAUSE_PROTO_ERR_UNSPEC = 0x6f,
284};
285
286extern const struct value_string *gsm48_gsm_cause_names;
287
288/* Section 6.1.2.2: Session management states on the network side */
289enum gsm48_pdp_state {
290 PDP_S_INACTIVE,
291 PDP_S_ACTIVE_PENDING,
292 PDP_S_ACTIVE,
293 PDP_S_INACTIVE_PENDING,
294 PDP_S_MODIFY_PENDING,
295};
296
Pau Espin Pedrolf196b882024-01-19 18:02:05 +0100297/* TS 24.008 Table 10.5.155/3GPP */
Harald Welte64f38c02016-04-20 17:12:24 +0200298enum gsm48_pdp_type_org {
299 PDP_TYPE_ORG_ETSI = 0x00,
300 PDP_TYPE_ORG_IETF = 0x01,
Pau Espin Pedrolf196b882024-01-19 18:02:05 +0100301 PDP_TYPE_ORG_EMPTY = 0x0f,
Harald Welte64f38c02016-04-20 17:12:24 +0200302};
303enum gsm48_pdp_type_nr {
304 PDP_TYPE_N_ETSI_RESERVED = 0x00,
305 PDP_TYPE_N_ETSI_PPP = 0x01,
306 PDP_TYPE_N_IETF_IPv4 = 0x21,
307 PDP_TYPE_N_IETF_IPv6 = 0x57,
Keith3f431342021-09-29 21:04:37 +0200308 PDP_TYPE_N_IETF_IPv4v6 = 0x8D,
Harald Welte64f38c02016-04-20 17:12:24 +0200309};
Pau Espin Pedrolf196b882024-01-19 18:02:05 +0100310/* TS 24.008 10.5.6.4 "Packet data protocol address" value
311 * Note: This can be reused for 3GPP TS 29.060 7.7.27 "End User Address"
312 * with minor changes in the values, like spare being 1111 instead.
313*/
314struct gsm48_pdp_address {
315#if OSMO_IS_LITTLE_ENDIAN
316uint8_t organization:4, /* enum gsm48_pdp_type_org */
317 spare:4; /* 0000 */
318#elif OSMO_IS_BIG_ENDIAN
319/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
320uint8_t spare:4, organization:4;
321#endif
322uint8_t type; /* enum gsm48_pdp_type_nr */
323 union {
324 /* PDP_TYPE_ORG_ETSI */
325 union {
326 } etsi;
327 /* PDP_TYPE_ORG_IETF */
328 union {
329 /* PDP_TYPE_N_IETF_IPv4 */
330 uint32_t v4;
331
332 /* PDP_TYPE_N_IETF_IPv6 */
333 uint8_t v6[16];
334
335 /* PDP_TYPE_N_IETF_IPv4v6 */
336 struct {
337 uint32_t v4;
338 uint8_t v6[16];
339 } __attribute__ ((packed)) v4v6;
340 } ietf;
341 };
342} __attribute__ ((packed));
Harald Welte64f38c02016-04-20 17:12:24 +0200343
344/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
345enum gsm48_qos_reliab_class {
346 GSM48_QOS_RC_LLC_ACK_RLC_ACK_DATA_PROT = 2,
347 GSM48_QOS_RC_LLC_UN_RLC_ACK_DATA_PROT = 3,
348 GSM48_QOS_RC_LLC_UN_RLC_UN_PROT_DATA = 4,
349 GSM48_QOS_RC_LLC_UN_RLC_UN_DATA_UN = 5,
350};
351
352/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
353enum gsm48_qos_preced_class {
354 GSM48_QOS_PC_HIGH = 1,
355 GSM48_QOS_PC_NORMAL = 2,
356 GSM48_QOS_PC_LOW = 3,
357};
358
359/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
360enum gsm48_qos_peak_tput {
361 GSM48_QOS_PEAK_TPUT_1000bps = 1,
362 GSM48_QOS_PEAK_TPUT_2000bps = 2,
363 GSM48_QOS_PEAK_TPUT_4000bps = 3,
364 GSM48_QOS_PEAK_TPUT_8000bps = 4,
365 GSM48_QOS_PEAK_TPUT_16000bps = 5,
366 GSM48_QOS_PEAK_TPUT_32000bps = 6,
367 GSM48_QOS_PEAK_TPUT_64000bps = 7,
368 GSM48_QOS_PEAK_TPUT_128000bps = 8,
369 GSM48_QOS_PEAK_TPUT_256000bps = 9,
370};
371
372/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
373enum gsm48_qos_mean_tput {
374 GSM48_QOS_MEAN_TPUT_100bph = 1,
375 GSM48_QOS_MEAN_TPUT_200bph = 2,
376 GSM48_QOS_MEAN_TPUT_500bph = 3,
377 GSM48_QOS_MEAN_TPUT_1000bph = 4,
378 GSM48_QOS_MEAN_TPUT_2000bph = 5,
379 GSM48_QOS_MEAN_TPUT_5000bph = 6,
380 GSM48_QOS_MEAN_TPUT_10000bph = 7,
381 GSM48_QOS_MEAN_TPUT_20000bph = 8,
382 GSM48_QOS_MEAN_TPUT_50000bph = 9,
383 GSM48_QOS_MEAN_TPUT_100kbph = 10,
384 GSM48_QOS_MEAN_TPUT_200kbph = 11,
385 GSM48_QOS_MEAN_TPUT_500kbph = 0xc,
386 GSM48_QOS_MEAN_TPUT_1Mbph = 0xd,
387 GSM48_QOS_MEAN_TPUT_2Mbph = 0xe,
388 GSM48_QOS_MEAN_TPUT_5Mbph = 0xf,
389 GSM48_QOS_MEAN_TPUT_10Mbph = 0x10,
390 GSM48_QOS_MEAN_TPUT_20Mbph = 0x11,
391 GSM48_QOS_MEAN_TPUT_50Mbph = 0x12,
392 GSM48_QOS_MEAN_TPUT_BEST_EFFORT = 0x1f,
393};
394
395/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
396enum gsm48_qos_err_sdu {
397 GSM48_QOS_ERRSDU_NODETECT = 1,
398 GSM48_QOS_ERRSDU_YES = 2,
399 GSM48_QOS_ERRSDU_NO = 3,
400};
401
402/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
403enum gsm48_qos_deliv_order {
404 GSM48_QOS_DO_ORDERED = 1,
405 GSM48_QOS_DO_UNORDERED = 2,
406};
407
408/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
409enum gsm48_qos_traf_class {
410 GSM48_QOS_TC_CONVERSATIONAL = 1,
411 GSM48_QOS_TC_STREAMING = 2,
412 GSM48_QOS_TC_INTERACTIVE = 3,
413 GSM48_QOS_TC_BACKGROUND = 4,
414};
415
416/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
417enum gsm48_qos_max_sdu_size {
418 /* values below in 10 octet granularity */
419 GSM48_QOS_MAXSDU_1502 = 0x97,
420 GSM48_QOS_MAXSDU_1510 = 0x98,
421 GSM48_QOS_MAXSDU_1520 = 0x99,
422};
423
424/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
425enum gsm48_qos_max_bitrate {
426 GSM48_QOS_MBRATE_1k = 0x01,
427 GSM48_QOS_MBRATE_63k = 0x3f,
428 GSM48_QOS_MBRATE_64k = 0x40,
429 GSM48_QOS_MBRATE_568k = 0x7f,
430 GSM48_QOS_MBRATE_576k = 0x80,
431 GSM48_QOS_MBRATE_8640k = 0xfe,
432 GSM48_QOS_MBRATE_0k = 0xff,
433};
434
435/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
436enum gsm48_qos_resid_ber {
437 GSM48_QOS_RBER_5e_2 = 0x01,
438 GSM48_QOS_RBER_1e_2 = 0x02,
439 GSM48_QOS_RBER_5e_3 = 0x03,
440 GSM48_QOS_RBER_4e_3 = 0x04,
441 GSM48_QOS_RBER_1e_3 = 0x05,
442 GSM48_QOS_RBER_1e_4 = 0x06,
443 GSM48_QOS_RBER_1e_5 = 0x07,
444 GSM48_QOS_RBER_1e_6 = 0x08,
445 GSM48_QOS_RBER_6e_8 = 0x09,
446};
447
448/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
449enum gsm48_qos_sdu_err {
450 GSM48_QOS_SERR_1e_2 = 0x01,
451 GSM48_QOS_SERR_7e_2 = 0x02,
452 GSM48_QOS_SERR_1e_3 = 0x03,
453 GSM48_QOS_SERR_1e_4 = 0x04,
454 GSM48_QOS_SERR_1e_5 = 0x05,
455 GSM48_QOS_SERR_1e_6 = 0x06,
456 GSM48_QOS_SERR_1e_1 = 0x07,
457};
458
Neels Hofmeyr0318f6b2016-08-29 13:18:56 +0200459/* 3GPP 24.008 / Chapter 10.5.5.20 / Table 10.5.153a */
460enum gsm48_gmm_service_type {
461 GPRS_SERVICE_T_SIGNALLING = 0x00,
462 GPRS_SERVICE_T_DATA = 0x01,
463 GPRS_SERVICE_T_PAGING_RESP = 0x02,
464 GPRS_SERVICE_T_MBMS_MC_SERV = 0x03,
465 GPRS_SERVICE_T_MBMS_BC_SERV = 0x04,
466};
467
468extern const struct value_string *gprs_service_t_strs;
469
Maxa337b9c2016-06-27 15:51:34 +0200470bool gprs_ms_net_cap_gea_supported(const uint8_t *ms_net_cap, uint8_t cap_len,
471 enum gprs_ciph_algo gea);
472
Harald Welte64f38c02016-04-20 17:12:24 +0200473/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
474struct gsm48_qos {
475 /* octet 3 */
476 uint8_t reliab_class:3;
477 uint8_t delay_class:3;
478 uint8_t spare:2;
479 /* octet 4 */
480 uint8_t preced_class:3;
481 uint8_t spare2:1;
482 uint8_t peak_tput:4;
483 /* octet 5 */
484 uint8_t mean_tput:5;
485 uint8_t spare3:3;
486 /* octet 6 */
487 uint8_t deliv_err_sdu:3;
488 uint8_t deliv_order:2;
489 uint8_t traf_class:3;
490 /* octet 7 */
491 uint8_t max_sdu_size;
492 /* octet 8 */
493 uint8_t max_bitrate_up;
494 /* octet 9 */
495 uint8_t max_bitrate_down;
496 /* octet 10 */
497 uint8_t sdu_err_ratio:4;
498 uint8_t resid_ber:4;
499 /* octet 11 */
500 uint8_t handling_prio:2;
501 uint8_t xfer_delay:6;
502 /* octet 12 */
503 uint8_t guar_bitrate_up;
504 /* octet 13 */
505 uint8_t guar_bitrate_down;
506 /* octet 14 */
507 uint8_t src_stats_desc:4;
508 uint8_t sig_ind:1;
509 uint8_t spare5:3;
510 /* octet 15 */
511 uint8_t max_bitrate_down_ext;
512 /* octet 16 */
513 uint8_t guar_bitrate_down_ext;
514};