blob: 87c7fa8743c0b3c43541d6c66bfdeb95862ce8a2 [file] [log] [blame]
Harald Welte9b455bf2010-03-14 15:45:01 +08001#ifndef _GPRS_SGSN_H
2#define _GPRS_SGSN_H
3
4/* TS 04.08 4.1.3.3 GMM mobility management states on the network side */
5enum gprs_mm_state {
6 GMM_DEREGISTERED, /* 4.1.3.3.1.1 */
7 GMM_COMMON_PROC_INIT, /* 4.1.3.3.1.2 */
8 GMM_REGISTERED_NORMAL, /* 4.1.3.3.2.1 */
9 GMM_REGISTERED_SUSPENDED, /* 4.1.3.3.2.2 */
10 GMM_DEREGISTERED_INIT, /* 4.1.3.3.1.4 */
11};
12
13enum gprs_ciph_algo {
14 GPRS_ALGO_GEA0,
15 GPRS_ALGO_GEA1,
16 GPRS_ALGO_GEA2,
17};
18
19#define MS_RADIO_ACCESS_CAPA
20
21/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */
22struct sgsn_mm_ctx {
23 struct llist_head list;
24
25 char imsi[GSM_IMSI_LENGTH];
26 enum gprs_mm_state mm_state;
27 u_int32_t p_tmsi;
28 u_int32_t p_tmsi_sig;
29 char imei[GSM_IMEI_LENGTH];
30 char msisdn[GSM_EXTENSION_LENGTH];
31 struct gprs_ra_id ra;
32 u_int16_t cell_id;
33 u_int32_t cell_id_age;
34 /* VLR number */
35 u_int32_t new_sgsn_addr;
36 /* Authentication Triplets */
37 /* Kc */
38 /* CKSN */
39 enum gprs_ciph_algo ciph_algo;
40 struct {
41 u_int8_t buf[14]; /* 10.5.5.12a */
42 u_int8_t len;
43 } ms_radio_access_capa;
44 struct {
45 u_int8_t buf[4]; /* 10.5.5.12 */
46 u_int8_t len;
47 } ms_network_capa;
48 u_int16_t drx_parms;
49 int mnrg; /* MS reported to HLR? */
50 int ngaf; /* MS reported to MSC/VLR? */
51 int ppf; /* paging for GPRS + non-GPRS? */
52 /* SMS Parameters */
53 int recovery;
54 u_int8_t radio_prio_sms;
55
56 struct llist_head pdp_list;
57
58 /* Additional bits not present in the GSM TS */
59 u_int32_t tlli;
60 struct timer_list timer;
61 unsigned int T;
62};
63
64enum pdp_ctx_state {
65 PDP_STAE_NONE,
66};
67
68enum pdp_type {
69 PDP_TYPE_NONE,
70};
71
72struct sgsn_pdp_ctx {
73 struct llist_head list;
74
75 unsigned int id;
76 enum pdp_ctx_state state;
77 enum pdp_type type;
78 u_int32_t addresss;
79 char *apn_subscribed;
80 char *apn_used;
81 u_int16_t nsapi;
82 u_int8_t ti; /* transaction identifier */
83 u_int32_t ggsn_in_use;
84 int vplmn_allowed;
85 u_int32_t qos_profile_subscr;
86 u_int32_t qos_profile_req;
87 u_int32_t qos_profile_neg;
88 u_int8_t radio_prio;
89 u_int32_t tx_npdu_nr;
90 u_int32_t rx_npdu_nr;
91 u_int32_t tx_gtp_snd;
92 u_int32_t rx_gtp_snu;
93 u_int32_t charging_id;
94 int reordering_reqd;
95};
96
97/* look-up a SGSN MM context based on TLLI + RAI */
98struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(u_int32_t tlli,
99 const struct gprs_ra_id *raid);
100struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(u_int32_t tmsi);
101struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);
102
103/* Allocate a new SGSN MM context */
104struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(u_int32_t tlli,
105 const struct gprs_ra_id *raid);
106
107#endif /* _GPRS_SGSN_H */