networkDef.h 9.73 KB
Newer Older
nikaeinn's avatar
nikaeinn committed
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
/*******************************************************************************
    OpenAirInterface
    Copyright(c) 1999 - 2014 Eurecom

    OpenAirInterface is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.


    OpenAirInterface is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with OpenAirInterface.The full GNU General Public License is
   included in this distribution in the file called "COPYING". If not,
   see <http://www.gnu.org/licenses/>.

  Contact Information
  OpenAirInterface Admin: openair_admin@eurecom.fr
  OpenAirInterface Tech : openair_tech@eurecom.fr
  OpenAirInterface Dev  : openair4g-devel@eurecom.fr

  Address      : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.

*******************************************************************************/

Cedric Roux's avatar
   
Cedric Roux committed
30
31
/*****************************************************************************

Cedric Roux's avatar
Cedric Roux committed
32
Source      networkDef.h
Cedric Roux's avatar
   
Cedric Roux committed
33

Cedric Roux's avatar
Cedric Roux committed
34
Version     0.1
Cedric Roux's avatar
   
Cedric Roux committed
35

Cedric Roux's avatar
Cedric Roux committed
36
Date        2012/09/21
Cedric Roux's avatar
   
Cedric Roux committed
37

Cedric Roux's avatar
Cedric Roux committed
38
Product     NAS stack
Cedric Roux's avatar
   
Cedric Roux committed
39

Cedric Roux's avatar
Cedric Roux committed
40
Subsystem   include
Cedric Roux's avatar
   
Cedric Roux committed
41

Cedric Roux's avatar
Cedric Roux committed
42
Author      Frederic Maurel
Cedric Roux's avatar
   
Cedric Roux committed
43

Cedric Roux's avatar
Cedric Roux committed
44
Description Contains network's global definitions
Cedric Roux's avatar
   
Cedric Roux committed
45
46
47
48
49
50
51
52
53
54
55
56
57
58

*****************************************************************************/
#ifndef __NETWORKDEF_H__
#define __NETWORKDEF_H__

/****************************************************************************/
/*********************  G L O B A L    C O N S T A N T S  *******************/
/****************************************************************************/

/*
 * ----------------------
 * Network selection mode
 * ----------------------
 */
Cedric Roux's avatar
Cedric Roux committed
59
60
#define NET_PLMN_AUTO           0
#define NET_PLMN_MANUAL         1
Cedric Roux's avatar
   
Cedric Roux committed
61
62
63
64
65
66

/*
 * ---------------------------
 * Network registration status
 * ---------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/* not registered, not currently searching an operator to register to */
#define NET_REG_STATE_OFF       0
/* registered, home network                       */
#define NET_REG_STATE_HN        1
/* not registered, currently trying to attach or searching an operator
 * to register to                         */
#define NET_REG_STATE_ON        2
/* registration denied                        */
#define NET_REG_STATE_DENIED        3
/* unknown (e.g. out of GERAN/UTRAN/E-UTRAN coverage)         */
#define NET_REG_STATE_UNKNOWN       4
/* registered, roaming                        */
#define NET_REG_STATE_ROAMING       5
/* registered for "SMS only", home network                */
#define NET_REG_STATE_SMS_HN        6
/* registered, for "SMS only", roaming                */
#define NET_REG_STATE_SMS_ROAMING   7
/* attached for emergency bearer services only (applicable to UTRAN)  */
#define NET_REG_STATE_EMERGENCY     8
Cedric Roux's avatar
   
Cedric Roux committed
86
87
88
89
90
91

/*
 * ------------------------------------
 * Network access technology indicators
 * ------------------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
92
93
94
95
96
97
98
99
100
#define NET_ACCESS_UNAVAILABLE  (-1)    /* Not available        */
#define NET_ACCESS_GSM      0   /* GSM              */
#define NET_ACCESS_COMPACT  1   /* GSM Compact          */
#define NET_ACCESS_UTRAN    2   /* UTRAN            */
#define NET_ACCESS_EGPRS    3   /* GSM w/EGPRS          */
#define NET_ACCESS_HSDPA    4   /* UTRAN w/HSDPA        */
#define NET_ACCESS_HSUPA    5   /* UTRAN w/HSUPA        */
#define NET_ACCESS_HSDUPA   6   /* UTRAN w/HSDPA and HSUPA  */
#define NET_ACCESS_EUTRAN   7   /* E-UTRAN          */
Cedric Roux's avatar
   
Cedric Roux committed
101
102
103
104
105
106

/*
 * ---------------------------------------
 * Network operator representation formats
 * ---------------------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
107
108
109
#define NET_FORMAT_LONG     0   /* long format alphanumeric */
#define NET_FORMAT_SHORT    1   /* short format alphanumeric    */
#define NET_FORMAT_NUM      2   /* numeric format       */
Cedric Roux's avatar
   
Cedric Roux committed
110

Cedric Roux's avatar
Cedric Roux committed
111
#define NET_FORMAT_MAX_SIZE NET_FORMAT_LONG_SIZE
Cedric Roux's avatar
   
Cedric Roux committed
112
113
114
115
116
117

/*
 * -----------------------------
 * Network operator availability
 * -----------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
118
119
120
121
#define NET_OPER_UNKNOWN    0   /* unknown operator     */
#define NET_OPER_AVAILABLE  1   /* available operator       */
#define NET_OPER_CURRENT    2   /* currently selected operator  */
#define NET_OPER_FORBIDDEN  3   /* forbidden operator       */
Cedric Roux's avatar
   
Cedric Roux committed
122
123
124
125
126
127

/*
 * --------------------------------------
 * Network connection establishment cause
 * --------------------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
128
129
130
131
132
133
#define NET_ESTABLISH_CAUSE_EMERGENCY       0x01
#define NET_ESTABLISH_CAUSE_HIGH_PRIO       0x02
#define NET_ESTABLISH_CAUSE_MT_ACCESS       0x03
#define NET_ESTABLISH_CAUSE_MO_SIGNAL       0x04
#define NET_ESTABLISH_CAUSE_MO_DATA     0x05
#define NET_ESTABLISH_CAUSE_V1020       0x06
Cedric Roux's avatar
   
Cedric Roux committed
134
135
136
137
138
139

/*
 * --------------------------------------
 * Network connection establishment type
 * --------------------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
140
141
142
143
144
#define NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL   0x10
#define NET_ESTABLISH_TYPE_EMERGENCY_CALLS  0x20
#define NET_ESTABLISH_TYPE_ORIGINATING_CALLS    0x30
#define NET_ESTABLISH_TYPE_TERMINATING_CALLS    0x40
#define NET_ESTABLISH_TYPE_MO_CS_FALLBACK   0x50
Cedric Roux's avatar
   
Cedric Roux committed
145
146
147
148
149
150

/*
 * -------------------
 * PDN connection type
 * -------------------
 */
Cedric Roux's avatar
Cedric Roux committed
151
152
153
#define NET_PDN_TYPE_IPV4   0
#define NET_PDN_TYPE_IPV6   1
#define NET_PDN_TYPE_IPV4V6 2
Cedric Roux's avatar
   
Cedric Roux committed
154
155
156
157
158
159
160
161
162
163
164

/****************************************************************************/
/************************  G L O B A L    T Y P E S  ************************/
/****************************************************************************/

/*
 * ---------------------
 * PDN connection status
 * ---------------------
 */
typedef enum {
Cedric Roux's avatar
Cedric Roux committed
165
166
167
168
169
170
171
172
    /* MT = The Mobile Terminal, NW = The Network               */
    NET_PDN_MT_DEFAULT_ACT = 1, /* MT has activated a PDN connection        */
    NET_PDN_NW_DEFAULT_DEACT,   /* NW has deactivated a PDN connection      */
    NET_PDN_MT_DEFAULT_DEACT,   /* MT has deactivated a PDN connection      */
    NET_PDN_NW_DEDICATED_ACT,   /* NW has activated an EPS bearer context   */
    NET_PDN_MT_DEDICATED_ACT,   /* MT has activated an EPS bearer context   */
    NET_PDN_NW_DEDICATED_DEACT, /* NW has deactivated an EPS bearer context */
    NET_PDN_MT_DEDICATED_DEACT, /* MT has deactivated an EPS bearer context */
Cedric Roux's avatar
   
Cedric Roux committed
173
174
175
176
177
178
179
180
} network_pdn_state_t;

/*
 * ---------------------------
 * Network operator identifier
 * ---------------------------
 */
typedef struct {
Cedric Roux's avatar
Cedric Roux committed
181
182
183
#define NET_FORMAT_LONG_SIZE    16  /* Long alphanumeric format     */
#define NET_FORMAT_SHORT_SIZE   8   /* Short alphanumeric format        */
#define NET_FORMAT_NUM_SIZE 6   /* Numeric format (PLMN identifier  */
Cedric Roux's avatar
   
Cedric Roux committed
184
    union {
Cedric Roux's avatar
Cedric Roux committed
185
186
187
        unsigned char alpha_long[NET_FORMAT_LONG_SIZE+1];
        unsigned char alpha_short[NET_FORMAT_SHORT_SIZE+1];
        unsigned char num[NET_FORMAT_NUM_SIZE+1];
Cedric Roux's avatar
   
Cedric Roux committed
188
189
190
191
192
193
194
195
196
    } id;
} network_plmn_t;

/*
 * -------------------------------
 * EPS bearer level QoS parameters
 * -------------------------------
 */
typedef struct {
Cedric Roux's avatar
Cedric Roux committed
197
198
199
200
201
    int gbrUL;      /* Guaranteed Bit Rate for uplink   */
    int gbrDL;      /* Guaranteed Bit Rate for downlink */
    int mbrUL;      /* Maximum Bit Rate for uplink      */
    int mbrDL;      /* Maximum Bit Rate for downlink    */
    int qci;        /* QoS Class Identifier         */
Cedric Roux's avatar
   
Cedric Roux committed
202
203
204
205
206
207
208
209
} network_qos_t;

/*
 * -----------------------------
 * IPv4 packet filter parameters
 * -----------------------------
 */
typedef struct {
Cedric Roux's avatar
Cedric Roux committed
210
211
212
    unsigned char protocol; /* Protocol identifier      */
    unsigned char tos;      /* Type of service      */
#define NET_PACKET_FILTER_IPV4_ADDR_SIZE    4
Cedric Roux's avatar
   
Cedric Roux committed
213
214
215
216
217
218
219
220
221
222
    unsigned char addr[NET_PACKET_FILTER_IPV4_ADDR_SIZE];
    unsigned char mask[NET_PACKET_FILTER_IPV4_ADDR_SIZE];
} network_ipv4_data_t;

/*
 * -----------------------------
 * IPv6 packet filter parameters
 * -----------------------------
 */
typedef struct {
Cedric Roux's avatar
Cedric Roux committed
223
224
225
    unsigned char nh;       /* Next header type     */
    unsigned char tf;       /* Traffic class        */
#define NET_PACKET_FILTER_IPV6_ADDR_SIZE    16
Cedric Roux's avatar
   
Cedric Roux committed
226
227
    unsigned char addr[NET_PACKET_FILTER_IPV6_ADDR_SIZE];
    unsigned char mask[NET_PACKET_FILTER_IPV6_ADDR_SIZE];
Cedric Roux's avatar
Cedric Roux committed
228
229
    unsigned int ipsec;     /* IPSec security parameter index */
    unsigned int fl;        /* Flow label             */
Cedric Roux's avatar
   
Cedric Roux committed
230
231
232
233
234
235
236
237
} network_ipv6_data_t;

/*
 * -------------
 * Packet Filter
 * -------------
 */
typedef struct {
Cedric Roux's avatar
Cedric Roux committed
238
239
240
241
242
243
    unsigned char id;       /* Packet filter identifier */
#define NET_PACKET_FILTER_DOWNLINK  0x01
#define NET_PACKET_FILTER_UPLINK    0x02
#define NET_PACKET_FILTER_BIDIR     0x03
    unsigned char dir;      /* Packet filter direction  */
    unsigned char precedence;   /* Evaluation precedence    */
Cedric Roux's avatar
   
Cedric Roux committed
244
    union {
Cedric Roux's avatar
Cedric Roux committed
245
246
        network_ipv4_data_t ipv4;
        network_ipv6_data_t ipv6;
Cedric Roux's avatar
   
Cedric Roux committed
247
    } data;
Cedric Roux's avatar
Cedric Roux committed
248
249
    unsigned short lport;   /* Local (UE) port number   */
    unsigned short rport;   /* Remote (network) port number */
Cedric Roux's avatar
   
Cedric Roux committed
250
251
252
253
254
255
256
257
258
} network_pkf_t;

/*
 * ---------------------
 * Traffic Flow Template
 * ---------------------
 */
typedef struct {
    int n_pkfs;
Cedric Roux's avatar
Cedric Roux committed
259
260
#define NET_PACKET_FILTER_MAX   16
    network_pkf_t *pkf[NET_PACKET_FILTER_MAX];
Cedric Roux's avatar
   
Cedric Roux committed
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
} network_tft_t;

/*
 * User notification callback, executed whenever a change of status with
 * respect of PDN connection or EPS bearer context is notified by the EPS
 * Session Management sublayer
 */
typedef int (*esm_indication_callback_t) (int, network_pdn_state_t);

/****************************************************************************/
/********************  G L O B A L    V A R I A B L E S  ********************/
/****************************************************************************/

/****************************************************************************/
/******************  E X P O R T E D    F U N C T I O N S  ******************/
/****************************************************************************/

#endif /* __NETWORKDEF_H__*/