aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/include/openbsc/gprs_sgsn.h
blob: 87c7fa8743c0b3c43541d6c66bfdeb95862ce8a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef _GPRS_SGSN_H
#define _GPRS_SGSN_H

/* TS 04.08 4.1.3.3 GMM mobility management states on the network side */
enum gprs_mm_state {
	GMM_DEREGISTERED,		/* 4.1.3.3.1.1 */
	GMM_COMMON_PROC_INIT,		/* 4.1.3.3.1.2 */
	GMM_REGISTERED_NORMAL,		/* 4.1.3.3.2.1 */
	GMM_REGISTERED_SUSPENDED,	/* 4.1.3.3.2.2 */
	GMM_DEREGISTERED_INIT,		/* 4.1.3.3.1.4 */
};

enum gprs_ciph_algo {
	GPRS_ALGO_GEA0,
	GPRS_ALGO_GEA1,
	GPRS_ALGO_GEA2,
};

#define MS_RADIO_ACCESS_CAPA

/* According to TS 03.60, Table 5: SGSN MM and PDP Contexts */
struct sgsn_mm_ctx {
	struct llist_head	list;

	char 			imsi[GSM_IMSI_LENGTH];
	enum gprs_mm_state	mm_state;
	u_int32_t 		p_tmsi;
	u_int32_t 		p_tmsi_sig;
	char 			imei[GSM_IMEI_LENGTH];
	char 			msisdn[GSM_EXTENSION_LENGTH];
	struct gprs_ra_id	ra;
	u_int16_t		cell_id;
	u_int32_t		cell_id_age;
	/* VLR number */
	u_int32_t		new_sgsn_addr;
	/* Authentication Triplets */
	/* Kc */
	/* CKSN */
	enum gprs_ciph_algo	ciph_algo;
	struct {
		u_int8_t	buf[14];	/* 10.5.5.12a */
		u_int8_t	len;
	} ms_radio_access_capa;
	struct {
		u_int8_t	buf[4];		/* 10.5.5.12 */
		u_int8_t	len;
	} ms_network_capa;
	u_int16_t		drx_parms;
	int			mnrg;	/* MS reported to HLR? */
	int			ngaf;	/* MS reported to MSC/VLR? */
	int			ppf;	/* paging for GPRS + non-GPRS? */
	/* SMS Parameters */
	int			recovery;
	u_int8_t		radio_prio_sms;

	struct llist_head	pdp_list;

	/* Additional bits not present in the GSM TS */
	u_int32_t		tlli;
	struct timer_list	timer;
	unsigned int		T;
};

enum pdp_ctx_state {
	PDP_STAE_NONE,
};

enum pdp_type {
	PDP_TYPE_NONE,
};

struct sgsn_pdp_ctx {
	struct llist_head	list;

	unsigned int		id;
	enum pdp_ctx_state	state;
	enum pdp_type		type;
	u_int32_t		addresss;
	char 			*apn_subscribed;
	char 			*apn_used;
	u_int16_t		nsapi;
	u_int8_t		ti;	/* transaction identifier */
	u_int32_t		ggsn_in_use;
	int			vplmn_allowed;
	u_int32_t		qos_profile_subscr;
	u_int32_t		qos_profile_req;
	u_int32_t		qos_profile_neg;
	u_int8_t		radio_prio;
	u_int32_t		tx_npdu_nr;
	u_int32_t		rx_npdu_nr;
	u_int32_t		tx_gtp_snd;
	u_int32_t		rx_gtp_snu;
	u_int32_t		charging_id;
	int			reordering_reqd;
};

/* look-up a SGSN MM context based on TLLI + RAI */
struct sgsn_mm_ctx *sgsn_mm_ctx_by_tlli(u_int32_t tlli,
					const struct gprs_ra_id *raid);
struct sgsn_mm_ctx *sgsn_mm_ctx_by_ptmsi(u_int32_t tmsi);
struct sgsn_mm_ctx *sgsn_mm_ctx_by_imsi(const char *imsi);

/* Allocate a new SGSN MM context */
struct sgsn_mm_ctx *sgsn_mm_ctx_alloc(u_int32_t tlli,
					const struct gprs_ra_id *raid);

#endif /* _GPRS_SGSN_H */