blob: f35d11b60f0740135125077ed7764acad5eb6f5c [file] [log] [blame]
Harald Welte64f38c02016-04-20 17:12:24 +02001#ifndef _GSM48_GPRS_H
2#define _GSM48_GPRS_H
3
4#include <stdint.h>
5#include <osmocom/gsm/protocol/gsm_04_08.h>
6
7/* Table 10.4 / 10.4a, GPRS Mobility Management (GMM) */
8#define GSM48_MT_GMM_ATTACH_REQ 0x01
9#define GSM48_MT_GMM_ATTACH_ACK 0x02
10#define GSM48_MT_GMM_ATTACH_COMPL 0x03
11#define GSM48_MT_GMM_ATTACH_REJ 0x04
12#define GSM48_MT_GMM_DETACH_REQ 0x05
13#define GSM48_MT_GMM_DETACH_ACK 0x06
14
15#define GSM48_MT_GMM_RA_UPD_REQ 0x08
16#define GSM48_MT_GMM_RA_UPD_ACK 0x09
17#define GSM48_MT_GMM_RA_UPD_COMPL 0x0a
18#define GSM48_MT_GMM_RA_UPD_REJ 0x0b
19
20#define GSM48_MT_GMM_PTMSI_REALL_CMD 0x10
21#define GSM48_MT_GMM_PTMSI_REALL_COMPL 0x11
22#define GSM48_MT_GMM_AUTH_CIPH_REQ 0x12
23#define GSM48_MT_GMM_AUTH_CIPH_RESP 0x13
24#define GSM48_MT_GMM_AUTH_CIPH_REJ 0x14
25#define GSM48_MT_GMM_ID_REQ 0x15
26#define GSM48_MT_GMM_ID_RESP 0x16
27#define GSM48_MT_GMM_STATUS 0x20
28#define GSM48_MT_GMM_INFO 0x21
29
30/* Table 10.4a, GPRS Session Management (GSM) */
31#define GSM48_MT_GSM_ACT_PDP_REQ 0x41
32#define GSM48_MT_GSM_ACT_PDP_ACK 0x42
33#define GSM48_MT_GSM_ACT_PDP_REJ 0x43
34#define GSM48_MT_GSM_REQ_PDP_ACT 0x44
35#define GSM48_MT_GSM_REQ_PDP_ACT_REJ 0x45
36#define GSM48_MT_GSM_DEACT_PDP_REQ 0x46
37#define GSM48_MT_GSM_DEACT_PDP_ACK 0x47
38#define GSM48_MT_GSM_ACT_AA_PDP_REQ 0x50
39#define GSM48_MT_GSM_ACT_AA_PDP_ACK 0x51
40#define GSM48_MT_GSM_ACT_AA_PDP_REJ 0x52
41#define GSM48_MT_GSM_DEACT_AA_PDP_REQ 0x53
42#define GSM48_MT_GSM_DEACT_AA_PDP_ACK 0x54
43#define GSM48_MT_GSM_STATUS 0x55
44
45/* Chapter 10.5.5.2 / Table 10.5.135 */
46#define GPRS_ATT_T_ATTACH 1
47#define GPRS_ATT_T_ATT_WHILE_IMSI 2
48#define GPRS_ATT_T_COMBINED 3
49
50extern const struct value_string *gprs_att_t_strs;
51
52/* Chapter 10.5.5.5 / Table 10.5.138 */
53#define GPRS_DET_T_MO_GPRS 1
54#define GPRS_DET_T_MO_IMSI 2
55#define GPRS_DET_T_MO_COMBINED 3
56/* Network to MS direction */
57#define GPRS_DET_T_MT_REATT_REQ 1
58#define GPRS_DET_T_MT_REATT_NOTREQ 2
59#define GPRS_DET_T_MT_IMSI 3
60
61extern const struct value_string *gprs_det_t_mo_strs;
62extern const struct value_string *gprs_det_t_mt_strs;
63
64/* Chapter 10.5.5.18 / Table 105.150 */
65#define GPRS_UPD_T_RA 0
66#define GPRS_UPD_T_RA_LA 1
67#define GPRS_UPD_T_RA_LA_IMSI_ATT 2
68#define GPRS_UPD_T_PERIODIC 3
69
70extern const struct value_string *gprs_upd_t_strs;
71
72enum gsm48_gprs_ie_mm {
73 GSM48_IE_GMM_CIPH_CKSN = 0x08, /* 10.5.1.2 */
74 GSM48_IE_GMM_TIMER_READY = 0x17, /* 10.5.7.3 */
75 GSM48_IE_GMM_ALLOC_PTMSI = 0x18, /* 10.5.1.4 */
76 GSM48_IE_GMM_PTMSI_SIG = 0x19, /* 10.5.5.8 */
77 GSM48_IE_GMM_AUTH_RAND = 0x21, /* 10.5.3.1 */
78 GSM48_IE_GMM_AUTH_SRES = 0x22, /* 10.5.3.2 */
79 GSM48_IE_GMM_IMEISV = 0x23, /* 10.5.1.4 */
80 GSM48_IE_GMM_CAUSE = 0x25, /* 10.5.5.14 */
81 GSM48_IE_GMM_DRX_PARAM = 0x27, /* 10.5.5.6 */
82 GSM48_IE_GMM_MS_NET_CAPA = 0x31, /* 10.5.5.12 */
83 GSM48_IE_GMM_PDP_CTX_STATUS = 0x32, /* 10.5.7.1 */
84 GSM48_IE_GMM_PS_LCS_CAPA = 0x33, /* 10.5.5.22 */
85 GSM48_IE_GMM_GMM_MBMS_CTX_ST = 0x35, /* 10.5.7.6 */
86};
87
88enum gsm48_gprs_ie_sm {
89 GSM48_IE_GSM_APN = 0x28, /* 10.5.6.1 */
90 GSM48_IE_GSM_PROTO_CONF_OPT = 0x27, /* 10.5.6.3 */
91 GSM48_IE_GSM_PDP_ADDR = 0x2b, /* 10.5.6.4 */
92 GSM48_IE_GSM_AA_TMR = 0x29, /* 10.5.7.3 */
93 GSM48_IE_GSM_NAME_FULL = 0x43, /* 10.5.3.5a */
94 GSM48_IE_GSM_NAME_SHORT = 0x45, /* 10.5.3.5a */
95 GSM48_IE_GSM_TIMEZONE = 0x46, /* 10.5.3.8 */
96 GSM48_IE_GSM_UTC_AND_TZ = 0x47, /* 10.5.3.9 */
97 GSM48_IE_GSM_LSA_ID = 0x48, /* 10.5.3.11 */
98
99 /* Fake IEs that are not present on the Layer3 air interface,
100 * but which we use to simplify internal APIs */
101 OSMO_IE_GSM_REQ_QOS = 0xfd,
102 OSMO_IE_GSM_REQ_PDP_ADDR = 0xfe,
103 OSMO_IE_GSM_SUB_QOS = 0xff,
104};
105
106/* Chapter 9.4.15 / Table 9.4.15 */
107struct gsm48_ra_upd_ack {
108 uint8_t force_stby:4, /* 10.5.5.7 */
109 upd_result:4; /* 10.5.5.17 */
110 uint8_t ra_upd_timer; /* 10.5.7.3 */
111 struct gsm48_ra_id ra_id; /* 10.5.5.15 */
112 uint8_t data[0];
113} __attribute__((packed));
114
115/* Chapter 10.5.7.3 */
116enum gsm48_gprs_tmr_unit {
117 GPRS_TMR_2SECONDS = 0 << 5,
118 GPRS_TMR_MINUTE = 1 << 5,
119 GPRS_TMR_6MINUTE = 2 << 5,
120 GPRS_TMR_DEACTIVATED = 7 << 5,
121};
122
123#define GPRS_TMR_UNIT_MASK (7 << 5)
124#define GPRS_TMR_FACT_MASK ((1 << 5)-1)
125
126/* Chapter 9.4.2 / Table 9.4.2 */
127struct gsm48_attach_ack {
128 uint8_t att_result:4, /* 10.5.5.7 */
129 force_stby:4; /* 10.5.5.1 */
130 uint8_t ra_upd_timer; /* 10.5.7.3 */
131 uint8_t radio_prio; /* 10.5.7.2 */
132 struct gsm48_ra_id ra_id; /* 10.5.5.15 */
133 uint8_t data[0];
134} __attribute__((packed));
135
136/* Chapter 9.4.9 / Table 9.4.9 */
137struct gsm48_auth_ciph_req {
138 uint8_t ciph_alg:4, /* 10.5.5.3 */
139 imeisv_req:4; /* 10.5.5.10 */
140 uint8_t force_stby:4, /* 10.5.5.7 */
141 ac_ref_nr:4; /* 10.5.5.19 */
142 uint8_t data[0];
143} __attribute__((packed));
144/* optional: TV RAND, TV CKSN */
145
146struct gsm48_auth_ciph_resp {
147 uint8_t ac_ref_nr:4,
148 spare:4;
149 uint8_t data[0];
150} __attribute__((packed));
151
152/* Chapter 9.5.1 / Table 9.5.1 */
153struct gsm48_act_pdp_ctx_req {
154 uint8_t req_nsapi;
155 uint8_t req_llc_sapi;
156 uint8_t data[0];
157} __attribute__((packed));
158
159/* Chapter 10.5.5.14 / Table 10.5.147 */
160enum gsm48_gmm_cause {
161 GMM_CAUSE_IMSI_UNKNOWN = 0x02,
162 GMM_CAUSE_ILLEGAL_MS = 0x03,
163 GMM_CAUSE_ILLEGAL_ME = 0x06,
164 GMM_CAUSE_GPRS_NOTALLOWED = 0x07,
165 GMM_CAUSE_GPRS_OTHER_NOTALLOWED = 0x08,
166 GMM_CAUSE_MS_ID_NOT_DERIVED = 0x09,
167 GMM_CAUSE_IMPL_DETACHED = 0x0a,
168 GMM_CAUSE_PLMN_NOTALLOWED = 0x0b,
169 GMM_CAUSE_LA_NOTALLOWED = 0x0c,
170 GMM_CAUSE_ROAMING_NOTALLOWED = 0x0d,
171 GMM_CAUSE_NO_GPRS_PLMN = 0x0e,
172 GMM_CAUSE_MSC_TEMP_NOTREACH = 0x10,
173 GMM_CAUSE_NET_FAIL = 0x11,
174 GMM_CAUSE_CONGESTION = 0x16,
175 GMM_CAUSE_SEM_INCORR_MSG = 0x5f,
176 GMM_CAUSE_INV_MAND_INFO = 0x60,
177 GMM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61,
178 GMM_CAUSE_MSGT_INCOMP_P_STATE = 0x62,
179 GMM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63,
180 GMM_CAUSE_COND_IE_ERR = 0x64,
181 GMM_CAUSE_MSG_INCOMP_P_STATE = 0x65,
182 GMM_CAUSE_PROTO_ERR_UNSPEC = 0x6f,
183};
184
185extern const struct value_string *gsm48_gmm_cause_names;
186
187/* Chapter 10.4.6.6 / Table 10.5.157 */
188enum gsm48_gsm_cause {
189 GSM_CAUSE_INSUFF_RSRC = 0x1a,
190 GSM_CAUSE_MISSING_APN = 0x1b,
191 GSM_CAUSE_UNKNOWN_PDP = 0x1c,
192 GSM_CAUSE_AUTH_FAILED = 0x1d,
193 GSM_CAUSE_ACT_REJ_GGSN = 0x1e,
194 GSM_CAUSE_ACT_REJ_UNSPEC = 0x1f,
195 GSM_CAUSE_SERV_OPT_NOTSUPP = 0x20,
196 GSM_CAUSE_REQ_SERV_OPT_NOTSUB = 0x21,
197 GSM_CAUSE_SERV_OPT_TEMP_OOO = 0x22,
198 GSM_CAUSE_NSAPI_IN_USE = 0x23,
199 GSM_CAUSE_DEACT_REGULAR = 0x24,
200 GSM_CAUSE_QOS_NOT_ACCEPTED = 0x25,
201 GSM_CAUSE_NET_FAIL = 0x26,
202 GSM_CAUSE_REACT_RQD = 0x27,
203 GSM_CAUSE_FEATURE_NOTSUPP = 0x28,
204 GSM_CAUSE_INVALID_TRANS_ID = 0x51,
205 GSM_CAUSE_SEM_INCORR_MSG = 0x5f,
206 GSM_CAUSE_INV_MAND_INFO = 0x60,
207 GSM_CAUSE_MSGT_NOTEXIST_NOTIMPL = 0x61,
208 GSM_CAUSE_MSGT_INCOMP_P_STATE = 0x62,
209 GSM_CAUSE_IE_NOTEXIST_NOTIMPL = 0x63,
210 GSM_CAUSE_COND_IE_ERR = 0x64,
211 GSM_CAUSE_MSG_INCOMP_P_STATE = 0x65,
212 GSM_CAUSE_PROTO_ERR_UNSPEC = 0x6f,
213};
214
215extern const struct value_string *gsm48_gsm_cause_names;
216
217/* Section 6.1.2.2: Session management states on the network side */
218enum gsm48_pdp_state {
219 PDP_S_INACTIVE,
220 PDP_S_ACTIVE_PENDING,
221 PDP_S_ACTIVE,
222 PDP_S_INACTIVE_PENDING,
223 PDP_S_MODIFY_PENDING,
224};
225
226/* Table 10.5.155/3GPP TS 24.008 */
227enum gsm48_pdp_type_org {
228 PDP_TYPE_ORG_ETSI = 0x00,
229 PDP_TYPE_ORG_IETF = 0x01,
230};
231enum gsm48_pdp_type_nr {
232 PDP_TYPE_N_ETSI_RESERVED = 0x00,
233 PDP_TYPE_N_ETSI_PPP = 0x01,
234 PDP_TYPE_N_IETF_IPv4 = 0x21,
235 PDP_TYPE_N_IETF_IPv6 = 0x57,
236};
237
238/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
239enum gsm48_qos_reliab_class {
240 GSM48_QOS_RC_LLC_ACK_RLC_ACK_DATA_PROT = 2,
241 GSM48_QOS_RC_LLC_UN_RLC_ACK_DATA_PROT = 3,
242 GSM48_QOS_RC_LLC_UN_RLC_UN_PROT_DATA = 4,
243 GSM48_QOS_RC_LLC_UN_RLC_UN_DATA_UN = 5,
244};
245
246/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
247enum gsm48_qos_preced_class {
248 GSM48_QOS_PC_HIGH = 1,
249 GSM48_QOS_PC_NORMAL = 2,
250 GSM48_QOS_PC_LOW = 3,
251};
252
253/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
254enum gsm48_qos_peak_tput {
255 GSM48_QOS_PEAK_TPUT_1000bps = 1,
256 GSM48_QOS_PEAK_TPUT_2000bps = 2,
257 GSM48_QOS_PEAK_TPUT_4000bps = 3,
258 GSM48_QOS_PEAK_TPUT_8000bps = 4,
259 GSM48_QOS_PEAK_TPUT_16000bps = 5,
260 GSM48_QOS_PEAK_TPUT_32000bps = 6,
261 GSM48_QOS_PEAK_TPUT_64000bps = 7,
262 GSM48_QOS_PEAK_TPUT_128000bps = 8,
263 GSM48_QOS_PEAK_TPUT_256000bps = 9,
264};
265
266/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
267enum gsm48_qos_mean_tput {
268 GSM48_QOS_MEAN_TPUT_100bph = 1,
269 GSM48_QOS_MEAN_TPUT_200bph = 2,
270 GSM48_QOS_MEAN_TPUT_500bph = 3,
271 GSM48_QOS_MEAN_TPUT_1000bph = 4,
272 GSM48_QOS_MEAN_TPUT_2000bph = 5,
273 GSM48_QOS_MEAN_TPUT_5000bph = 6,
274 GSM48_QOS_MEAN_TPUT_10000bph = 7,
275 GSM48_QOS_MEAN_TPUT_20000bph = 8,
276 GSM48_QOS_MEAN_TPUT_50000bph = 9,
277 GSM48_QOS_MEAN_TPUT_100kbph = 10,
278 GSM48_QOS_MEAN_TPUT_200kbph = 11,
279 GSM48_QOS_MEAN_TPUT_500kbph = 0xc,
280 GSM48_QOS_MEAN_TPUT_1Mbph = 0xd,
281 GSM48_QOS_MEAN_TPUT_2Mbph = 0xe,
282 GSM48_QOS_MEAN_TPUT_5Mbph = 0xf,
283 GSM48_QOS_MEAN_TPUT_10Mbph = 0x10,
284 GSM48_QOS_MEAN_TPUT_20Mbph = 0x11,
285 GSM48_QOS_MEAN_TPUT_50Mbph = 0x12,
286 GSM48_QOS_MEAN_TPUT_BEST_EFFORT = 0x1f,
287};
288
289/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
290enum gsm48_qos_err_sdu {
291 GSM48_QOS_ERRSDU_NODETECT = 1,
292 GSM48_QOS_ERRSDU_YES = 2,
293 GSM48_QOS_ERRSDU_NO = 3,
294};
295
296/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
297enum gsm48_qos_deliv_order {
298 GSM48_QOS_DO_ORDERED = 1,
299 GSM48_QOS_DO_UNORDERED = 2,
300};
301
302/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
303enum gsm48_qos_traf_class {
304 GSM48_QOS_TC_CONVERSATIONAL = 1,
305 GSM48_QOS_TC_STREAMING = 2,
306 GSM48_QOS_TC_INTERACTIVE = 3,
307 GSM48_QOS_TC_BACKGROUND = 4,
308};
309
310/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
311enum gsm48_qos_max_sdu_size {
312 /* values below in 10 octet granularity */
313 GSM48_QOS_MAXSDU_1502 = 0x97,
314 GSM48_QOS_MAXSDU_1510 = 0x98,
315 GSM48_QOS_MAXSDU_1520 = 0x99,
316};
317
318/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
319enum gsm48_qos_max_bitrate {
320 GSM48_QOS_MBRATE_1k = 0x01,
321 GSM48_QOS_MBRATE_63k = 0x3f,
322 GSM48_QOS_MBRATE_64k = 0x40,
323 GSM48_QOS_MBRATE_568k = 0x7f,
324 GSM48_QOS_MBRATE_576k = 0x80,
325 GSM48_QOS_MBRATE_8640k = 0xfe,
326 GSM48_QOS_MBRATE_0k = 0xff,
327};
328
329/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
330enum gsm48_qos_resid_ber {
331 GSM48_QOS_RBER_5e_2 = 0x01,
332 GSM48_QOS_RBER_1e_2 = 0x02,
333 GSM48_QOS_RBER_5e_3 = 0x03,
334 GSM48_QOS_RBER_4e_3 = 0x04,
335 GSM48_QOS_RBER_1e_3 = 0x05,
336 GSM48_QOS_RBER_1e_4 = 0x06,
337 GSM48_QOS_RBER_1e_5 = 0x07,
338 GSM48_QOS_RBER_1e_6 = 0x08,
339 GSM48_QOS_RBER_6e_8 = 0x09,
340};
341
342/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
343enum gsm48_qos_sdu_err {
344 GSM48_QOS_SERR_1e_2 = 0x01,
345 GSM48_QOS_SERR_7e_2 = 0x02,
346 GSM48_QOS_SERR_1e_3 = 0x03,
347 GSM48_QOS_SERR_1e_4 = 0x04,
348 GSM48_QOS_SERR_1e_5 = 0x05,
349 GSM48_QOS_SERR_1e_6 = 0x06,
350 GSM48_QOS_SERR_1e_1 = 0x07,
351};
352
353/* Figure 10.5.138/24.008 / Chapter 10.5.6.5 */
354struct gsm48_qos {
355 /* octet 3 */
356 uint8_t reliab_class:3;
357 uint8_t delay_class:3;
358 uint8_t spare:2;
359 /* octet 4 */
360 uint8_t preced_class:3;
361 uint8_t spare2:1;
362 uint8_t peak_tput:4;
363 /* octet 5 */
364 uint8_t mean_tput:5;
365 uint8_t spare3:3;
366 /* octet 6 */
367 uint8_t deliv_err_sdu:3;
368 uint8_t deliv_order:2;
369 uint8_t traf_class:3;
370 /* octet 7 */
371 uint8_t max_sdu_size;
372 /* octet 8 */
373 uint8_t max_bitrate_up;
374 /* octet 9 */
375 uint8_t max_bitrate_down;
376 /* octet 10 */
377 uint8_t sdu_err_ratio:4;
378 uint8_t resid_ber:4;
379 /* octet 11 */
380 uint8_t handling_prio:2;
381 uint8_t xfer_delay:6;
382 /* octet 12 */
383 uint8_t guar_bitrate_up;
384 /* octet 13 */
385 uint8_t guar_bitrate_down;
386 /* octet 14 */
387 uint8_t src_stats_desc:4;
388 uint8_t sig_ind:1;
389 uint8_t spare5:3;
390 /* octet 15 */
391 uint8_t max_bitrate_down_ext;
392 /* octet 16 */
393 uint8_t guar_bitrate_down_ext;
394};
395
396
397#endif /* _GSM48_GPRS_H */