s1ap_messages_types.h 8.19 KB
Newer Older
1
2
3
#ifndef S1AP_MESSAGES_TYPES_H_
#define S1AP_MESSAGES_TYPES_H_

4
5
6
7
//-------------------------------------------------------------------------------------------//
// Defines to access message fields.

#define S1AP_NAS_FIRST_REQ(mSGpTR)              (mSGpTR)->msg.s1ap_nas_first_req
winckel's avatar
RRC:    
winckel committed
8
9
10
11
12
13
#define S1AP_UPLINK_NAS(mSGpTR)                 (mSGpTR)->msg.s1ap_uplink_nas
#define S1AP_UE_CAPABILITIES_IND(mSGpTR)        (mSGpTR)->msg.s1ap_ue_cap_info_ind
#define S1AP_INITIAL_CONTEXT_SETUP_RESP(mSGpTR) (mSGpTR)->msg.s1ap_initial_context_setup_resp

#define S1AP_DOWNLINK_NAS(mSGpTR)               (mSGpTR)->msg.s1ap_downlink_nas
#define S1AP_INITIAL_CONTEXT_SETUP_REQ(mSGpTR)  (mSGpTR)->msg.s1ap_initial_context_setup_req
14
15
16

//-------------------------------------------------------------------------------------------//

winckel's avatar
RRC:    
winckel committed
17
typedef enum cell_type_e {
18
19
    CELL_MACRO_ENB,
    CELL_HOME_ENB
winckel's avatar
RRC:    
winckel committed
20
} cell_type_t;
21

winckel's avatar
RRC:    
winckel committed
22
typedef enum paging_drx_e {
23
24
25
26
27
28
    PAGING_DRX_32  = 0x0,
    PAGING_DRX_64  = 0x1,
    PAGING_DRX_128 = 0x2,
    PAGING_DRX_256 = 0x3,
} paging_drx_t;

winckel's avatar
RRC:    
winckel committed
29
typedef struct net_ip_address_s {
30
31
32
33
34
35
    unsigned ipv4:1;
    unsigned ipv6:1;
    char ipv4_address[16];
    char ipv6_address[40];
} net_ip_address_t;

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
typedef uint64_t bitrate_t;

typedef struct {
    bitrate_t br_ul;
    bitrate_t br_dl;
} ambr_t;

typedef enum priority_level_s {
    PRIORITY_LEVEL_SPARE       = 0,
    PRIORITY_LEVEL_HIGHEST     = 1,
    PRIORITY_LEVEL_LOWEST      = 14,
    PRIORITY_LEVEL_NO_PRIORITY = 15,
} priority_level_t;

typedef enum {
    PRE_EMPTION_CAPABILITY_ENABLED  = 0,
    PRE_EMPTION_CAPABILITY_DISABLED = 1,
    PRE_EMPTION_CAPABILITY_MAX,
} pre_emp_capability_t;

typedef enum {
    PRE_EMPTION_VULNERABILITY_ENABLED  = 0,
    PRE_EMPTION_VULNERABILITY_DISABLED = 1,
    PRE_EMPTION_VULNERABILITY_MAX,
} pre_emp_vulnerability_t;

typedef struct {
    priority_level_t        priority_level;
    pre_emp_capability_t    pre_emp_capability;
    pre_emp_vulnerability_t pre_emp_vulnerability;
} allocation_retention_priority_t;

typedef struct security_capabilities_s {
    uint16_t encryption_algorithms;
    uint16_t integrity_algorithms;
} security_capabilities_t;

Cedric Roux's avatar
Cedric Roux committed
73
74
75
76
77
78
79
80
81
82
/* Maximum number of e-rabs to be setup/deleted in a single message.
 * Even if only one bearer will be modified by message.
 */
#define S1AP_MAX_E_RAB  11

/* Length of the transport layer address string
 * 160 bits / 8 bits by char.
 */
#define S1AP_TRANSPORT_LAYER_ADDRESS_SIZE (160 / 8)

83
84
#define S1AP_MAX_NB_MME_IP_ADDRESS 10

85
86
87
88
89
90
/* Security key length used within eNB
 * Even if only 16 bytes will be effectively used,
 * the key length is 32 bytes (256 bits)
 */
#define SECURITY_KEY_LENGTH 32

91
92
93
94
95
/* Provides the establishment cause for the RRC connection request as provided
 * by the upper layers. W.r.t. the cause value names: highPriorityAccess
 * concerns AC11..AC15, ‘mt’ stands for ‘Mobile Terminating’ and ‘mo’ for
 * 'Mobile Originating'. Defined in TS 36.331.
 */
winckel's avatar
RRC:    
winckel committed
96
typedef enum rrc_establishment_cause_e {
97
98
99
100
101
102
103
104
    RRC_CAUSE_EMERGENCY        = 0x0,
    RRC_CAUSE_HIGH_PRIO_ACCESS = 0x1,
    RRC_CAUSE_MT_ACCESS        = 0x2,
    RRC_CAUSE_MO_SIGNALLING    = 0x3,
    RRC_CAUSE_MO_DATA          = 0x4,
    RRC_CAUSE_LAST
} rrc_establishment_cause_t;

winckel's avatar
RRC:    
winckel committed
105
typedef struct s1ap_gummei_s {
106
107
108
109
    uint16_t mcc;
    uint16_t mnc;
    uint8_t  mme_code;
    uint16_t mme_group_id;
winckel's avatar
RRC:    
winckel committed
110
} s1ap_gummei_t;
111

winckel's avatar
RRC:    
winckel committed
112
typedef struct s_tmsi_s {
113
114
115
116
    uint8_t  mme_code;
    uint32_t m_tmsi;
} s_tmsi_t;

winckel's avatar
RRC:    
winckel committed
117
118
119
120
121
122
123
124
125
126
typedef enum ue_identities_presenceMask_e {
  UE_IDENTITIES_NONE = 0,
  UE_IDENTITIES_s_tmsi = 1 << 1,
  UE_IDENTITIES_gummei = 1 << 2,
} ue_identities_presenceMask_t;

typedef struct ue_identity_s {
    ue_identities_presenceMask_t presenceMask;
    s_tmsi_t s_tmsi;
    s1ap_gummei_t gummei;
127
128
} ue_identity_t;

winckel's avatar
RRC:    
winckel committed
129
typedef struct nas_pdu_s {
130
131
132
133
134
135
    /* Octet string data */
    uint8_t  *buffer;
    /* Length of the octet string */
    uint32_t  length;
} nas_pdu_t, ue_radio_cap_t;

winckel's avatar
RRC:    
winckel committed
136
typedef struct transport_layer_addr_s {
137
    /* Length of the transport layer address buffer in bits. S1AP layer received a
Cedric Roux's avatar
Cedric Roux committed
138
139
140
141
142
143
144
145
     * bit string<1..160> containing one of the following addresses: ipv4,
     * ipv6, or ipv4 and ipv6. The layer doesn't interpret the buffer but
     * silently forward it to S1-U.
     */
    uint8_t length;
    uint8_t buffer[20];
} transport_layer_addr_t;

winckel's avatar
RRC:    
winckel committed
146
typedef struct e_rab_level_qos_parameter_s {
Cedric Roux's avatar
Cedric Roux committed
147
    uint8_t qci;
148
149

    allocation_retention_priority_t allocation_retention_priority;
Cedric Roux's avatar
Cedric Roux committed
150
151
} e_rab_level_qos_parameter_t;

winckel's avatar
RRC:    
winckel committed
152
typedef struct e_rab_s {
Cedric Roux's avatar
Cedric Roux committed
153
154
155
156
157
158
159
160
161
162
163
164
    /* Unique e_rab_id for the UE. */
    uint8_t                     e_rab_id;
    /* Quality of service for this e_rab */
    e_rab_level_qos_parameter_t qos;
    /* The NAS PDU should be forwarded by the RRC layer to the NAS layer */
    nas_pdu_t                   nas_pdu;
    /* The transport layer address for the IP packets */
    transport_layer_addr_t      sgw_addr;
    /* S-GW Tunnel endpoint identifier */
    uint32_t                    gtp_teid;
} e_rab_t;

winckel's avatar
RRC:    
winckel committed
165
typedef struct e_rab_setup_s {
Cedric Roux's avatar
Cedric Roux committed
166
167
168
169
170
171
172
173
174
175
    /* Unique e_rab_id for the UE. */
    uint8_t e_rab_id;

    /* The transport layer address for the IP packets */
    transport_layer_addr_t eNB_addr;

    /* S-GW Tunnel endpoint identifier */
    uint32_t gtp_teid;
} e_rab_setup_t;

winckel's avatar
RRC:    
winckel committed
176
typedef struct e_rab_failed_s {
Cedric Roux's avatar
Cedric Roux committed
177
178
179
180
181
    /* Unique e_rab_id for the UE. */
    uint8_t e_rab_id;
    /* Cause of the failure */
    //     cause_t cause;
} e_rab_failed_t;
182

winckel's avatar
RRC:    
winckel committed
183
typedef struct s1ap_register_eNB_s {
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
    /* Unique eNB_id to identify the eNB within EPC.
     * For macro eNB ids this field should be 20 bits long.
     * For home eNB ids this field should be 28 bits long.
     */
    uint32_t eNB_id;
    /* The type of the cell */
    enum cell_type_e cell_type;

    /* Optional name for the cell
     * NOTE: the name can be NULL (i.e no name) and will be cropped to 150
     * characters.
     */
    char *eNB_name;

    /* Tracking area code */
    uint16_t tac;

    /* Mobile Country Code
     * Mobile Network Code
     */
    uint16_t mcc;
    uint16_t mnc;

    /* Default Paging DRX of the eNB as defined in TS 36.304 */
    paging_drx_t default_drx;

    /* The eNB IP address to bind */
    net_ip_address_t enb_ip_address;

    /* Nb of MME to connect to */
    uint8_t          nb_mme;
    /* List of MME to connect to */
    net_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS];
} s1ap_register_eNB_t;

219
220
221
222
223
/* The NAS First Req is the first message exchanged between RRC and S1AP
 * for an UE.
 * The rnti uniquely identifies an UE within a cell. Later the enb_ue_s1ap_id
 * will be the unique identifier used between RRC and S1AP.
 */
winckel's avatar
RRC:    
winckel committed
224
typedef struct s1ap_nas_first_req_s {
225
226
    /* UE id for initial connection to S1AP */
    uint16_t ue_initial_id;
227
228
229
230
231
232
233
234
235
236
237
238
239

    /* Establishment cause as sent by UE */
    rrc_establishment_cause_t establishment_cause;

    /* NAS PDU */
    nas_pdu_t nas_pdu;

    /* If this flag is set S1AP layer is expecting the GUMMEI. If = 0,
     * the temporary s-tmsi is used.
     */
    ue_identity_t ue_identity;
} s1ap_nas_first_req_t;

winckel's avatar
RRC:    
winckel committed
240
typedef struct s1ap_uplink_nas_s {
241
242
243
244
245
246
247
248
249
    /* Unique UE identifier within an eNB */
    unsigned eNB_ue_s1ap_id:24;

    /* NAS pdu */
    nas_pdu_t nas_pdu;
} s1ap_uplink_nas_t;

typedef s1ap_uplink_nas_t s1ap_downlink_nas_t;

winckel's avatar
RRC:    
winckel committed
250
typedef struct s1ap_initial_context_setup_req_s {
Cedric Roux's avatar
Cedric Roux committed
251
252
    unsigned eNB_ue_s1ap_id:24;

253
254
255
256
257
258
259
260
261
    /* UE aggregate maximum bitrate */
    ambr_t ue_ambr;

    /* Security algorithms */
    security_capabilities_t security_capabilities;

    /* Security key */
    uint8_t security_key[SECURITY_KEY_LENGTH];

Cedric Roux's avatar
Cedric Roux committed
262
263
264
265
266
267
    /* Number of e_rab to be setup in the list */
    uint8_t  nb_of_e_rabs;
    /* list of e_rab to be setup by RRC layers */
    e_rab_t  e_rab_param[S1AP_MAX_E_RAB];
} s1ap_initial_context_setup_req_t;

winckel's avatar
RRC:    
winckel committed
268
typedef struct s1ap_initial_context_setup_resp_s {
Cedric Roux's avatar
Cedric Roux committed
269
270
271
272
273
274
275
276
277
278
279
280
281
    unsigned  eNB_ue_s1ap_id:24;

    /* Number of e_rab setup-ed in the list */
    uint8_t       nb_of_e_rabs;
    /* list of e_rab setup-ed by RRC layers */
    e_rab_setup_t e_rabs[S1AP_MAX_E_RAB];

    /* Number of e_rab failed to be setup in list */
    uint8_t        nb_of_e_rabs_failed;
    /* list of e_rabs that failed to be setup */
    e_rab_failed_t e_rabs_failed[S1AP_MAX_E_RAB];
} s1ap_initial_context_setup_resp_t;

winckel's avatar
RRC:    
winckel committed
282
typedef struct s1ap_ue_cap_info_ind_s {
Cedric Roux's avatar
Cedric Roux committed
283
284
285
286
    unsigned  eNB_ue_s1ap_id:24;
    ue_radio_cap_t ue_radio_cap;
} s1ap_ue_cap_info_ind_t;

287
#endif /* S1AP_MESSAGES_TYPES_H_ */