as_message.h 22.5 KB
Newer Older
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
/*
 * Copyright (c) 2015, EURECOM (www.eurecom.fr)
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 *    this list of conditions and the following disclaimer in the documentation
 *    and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * The views and conclusions contained in the software and documentation are those
 * of the authors and should not be interpreted as representing official policies,
 * either expressed or implied, of the FreeBSD Project.
 */
nikaeinn's avatar
nikaeinn committed
29
30


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

Cedric Roux's avatar
Cedric Roux committed
33
Source      as_message.h
Cedric Roux's avatar
 
Cedric Roux committed
34

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

Cedric Roux's avatar
Cedric Roux committed
37
Date        2012/10/18
Cedric Roux's avatar
 
Cedric Roux committed
38

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

Cedric Roux's avatar
Cedric Roux committed
41
Subsystem   Application Programming Interface
Cedric Roux's avatar
 
Cedric Roux committed
42

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

Cedric Roux's avatar
Cedric Roux committed
45
46
47
Description Defines the messages supported by the Access Stratum sublayer
        protocol (usually RRC and S1AP for E-UTRAN) and functions used
        to encode and decode
Cedric Roux's avatar
 
Cedric Roux committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61

*****************************************************************************/
#ifndef __AS_MESSAGE_H__
#define __AS_MESSAGE_H__

#include "commonDef.h"
#include "networkDef.h"

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

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
62
 *              Access Stratum message types
Cedric Roux's avatar
 
Cedric Roux committed
63
64
 * --------------------------------------------------------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
65
66
67
68
#define AS_REQUEST  0x0100
#define AS_RESPONSE 0x0200
#define AS_INDICATION   0x0400
#define AS_CONFIRM  0x0800
Cedric Roux's avatar
 
Cedric Roux committed
69
70
71

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
72
 *          Access Stratum message identifiers
Cedric Roux's avatar
 
Cedric Roux committed
73
74
75
76
 * --------------------------------------------------------------------------
 */

/* Broadcast information */
Cedric Roux's avatar
Cedric Roux committed
77
78
#define AS_BROADCAST_INFO       0x01
#define AS_BROADCAST_INFO_IND       (AS_BROADCAST_INFO | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
79
80

/* Cell information relevant for cell selection processing */
Cedric Roux's avatar
Cedric Roux committed
81
82
83
84
#define AS_CELL_INFO            0x02
#define AS_CELL_INFO_REQ        (AS_CELL_INFO | AS_REQUEST)
#define AS_CELL_INFO_CNF        (AS_CELL_INFO | AS_CONFIRM)
#define AS_CELL_INFO_IND        (AS_CELL_INFO | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
85
86

/* Paging information */
Cedric Roux's avatar
Cedric Roux committed
87
88
89
#define AS_PAGING           0x03
#define AS_PAGING_REQ           (AS_PAGING | AS_REQUEST)
#define AS_PAGING_IND           (AS_PAGING | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
90
91

/* NAS signalling connection establishment */
Cedric Roux's avatar
Cedric Roux committed
92
93
94
95
96
#define AS_NAS_ESTABLISH        0x04
#define AS_NAS_ESTABLISH_REQ        (AS_NAS_ESTABLISH | AS_REQUEST)
#define AS_NAS_ESTABLISH_IND        (AS_NAS_ESTABLISH | AS_INDICATION)
#define AS_NAS_ESTABLISH_RSP        (AS_NAS_ESTABLISH | AS_RESPONSE)
#define AS_NAS_ESTABLISH_CNF        (AS_NAS_ESTABLISH | AS_CONFIRM)
Cedric Roux's avatar
 
Cedric Roux committed
97
98

/* NAS signalling connection release */
Cedric Roux's avatar
Cedric Roux committed
99
100
101
#define AS_NAS_RELEASE          0x05
#define AS_NAS_RELEASE_REQ      (AS_NAS_RELEASE | AS_REQUEST)
#define AS_NAS_RELEASE_IND      (AS_NAS_RELEASE | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
102
103

/* Uplink information transfer */
Cedric Roux's avatar
Cedric Roux committed
104
105
106
107
#define AS_UL_INFO_TRANSFER     0x06
#define AS_UL_INFO_TRANSFER_REQ     (AS_UL_INFO_TRANSFER | AS_REQUEST)
#define AS_UL_INFO_TRANSFER_CNF     (AS_UL_INFO_TRANSFER | AS_CONFIRM)
#define AS_UL_INFO_TRANSFER_IND     (AS_UL_INFO_TRANSFER | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
108
109

/* Downlink information transfer */
Cedric Roux's avatar
Cedric Roux committed
110
111
112
113
#define AS_DL_INFO_TRANSFER     0x07
#define AS_DL_INFO_TRANSFER_REQ     (AS_DL_INFO_TRANSFER | AS_REQUEST)
#define AS_DL_INFO_TRANSFER_CNF     (AS_DL_INFO_TRANSFER | AS_CONFIRM)
#define AS_DL_INFO_TRANSFER_IND     (AS_DL_INFO_TRANSFER | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
114
115

/* Radio Access Bearer establishment */
Cedric Roux's avatar
Cedric Roux committed
116
117
118
119
120
#define AS_RAB_ESTABLISH        0x08
#define AS_RAB_ESTABLISH_REQ        (AS_RAB_ESTABLISH | AS_REQUEST)
#define AS_RAB_ESTABLISH_IND        (AS_RAB_ESTABLISH | AS_INDICATION)
#define AS_RAB_ESTABLISH_RSP        (AS_RAB_ESTABLISH | AS_RESPONSE)
#define AS_RAB_ESTABLISH_CNF        (AS_RAB_ESTABLISH | AS_CONFIRM)
Cedric Roux's avatar
 
Cedric Roux committed
121
122

/* Radio Access Bearer release */
Cedric Roux's avatar
Cedric Roux committed
123
124
125
#define AS_RAB_RELEASE          0x09
#define AS_RAB_RELEASE_REQ      (AS_RAB_RELEASE | AS_REQUEST)
#define AS_RAB_RELEASE_IND      (AS_RAB_RELEASE | AS_INDICATION)
Cedric Roux's avatar
 
Cedric Roux committed
126

127
128
129
130
131
132
133
134
135
136
137
/* NAS Cause */
#define EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED (8)
#define EPS_SERVICES_NOT_ALLOWED                      (7)
#define PLMN_NOT_ALLOWED                              (11)
#define TRACKING_AREA_NOT_ALLOWED                     (12)
#define ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA     (13)
#define EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN         (14)
#define NO_SUITABLE_CELLS_IN_TRACKING_AREA            (15)
#define NETWORK_FAILURE                               (17)
#define ESM_FAILURE                                   (19)

Cedric Roux's avatar
Cedric Roux committed
138
typedef enum nas_cause_s {
139
140
141
142
143
144
145
146
147
  NAS_CAUSE_EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED,
  NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED                  = EPS_SERVICES_NOT_ALLOWED,
  NAS_CAUSE_PLMN_NOT_ALLOWED                          = PLMN_NOT_ALLOWED,
  NAS_CAUSE_TRACKING_AREA_NOT_ALLOWED                 = TRACKING_AREA_NOT_ALLOWED,
  NAS_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA = ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA,
  NAS_CAUSE_EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN     = EPS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN,
  NAS_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA        = NO_SUITABLE_CELLS_IN_TRACKING_AREA,
  NAS_CAUSE_NETWORK_FAILURE                           = NETWORK_FAILURE,
  NAS_CAUSE_ESM_FAILURE                               = ESM_FAILURE
Cedric Roux's avatar
Cedric Roux committed
148
149
} nas_cause_t;

Cedric Roux's avatar
 
Cedric Roux committed
150
151
/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
152
 *          Access Stratum message global parameters
Cedric Roux's avatar
 
Cedric Roux committed
153
154
155
156
 * --------------------------------------------------------------------------
 */

/* Error code */
Cedric Roux's avatar
Cedric Roux committed
157
typedef enum nas_error_code_s {
158
159
160
161
  AS_SUCCESS = 1, /* Success code, transaction is going on    */
  AS_TERMINATED_NAS,  /* Transaction terminated by NAS        */
  AS_TERMINATED_AS,   /* Transaction terminated by AS         */
  AS_FAILURE      /* Failure code                 */
Cedric Roux's avatar
Cedric Roux committed
162
} nas_error_code_t;
Cedric Roux's avatar
 
Cedric Roux committed
163
164

/* Core network domain */
Cedric Roux's avatar
Cedric Roux committed
165
typedef enum core_network_s {
166
167
  AS_PS = 1,      /* Packet-Switched  */
  AS_CS       /* Circuit-Switched */
Cedric Roux's avatar
Cedric Roux committed
168
} core_network_t;
Cedric Roux's avatar
 
Cedric Roux committed
169
170

/* SAE Temporary Mobile Subscriber Identity */
Cedric Roux's avatar
Cedric Roux committed
171
typedef struct as_stmsi_s {
172
173
  uint8_t MMEcode;    /* MME code that allocated the GUTI     */
  uint32_t m_tmsi;    /* M-Temporary Mobile Subscriber Identity   */
Cedric Roux's avatar
 
Cedric Roux committed
174
175
176
} as_stmsi_t;

/* Dedicated NAS information */
Cedric Roux's avatar
Cedric Roux committed
177
typedef struct as_nas_info_s {
178
  uint32_t length;    /* Length of the NAS information data       */
179
  Byte_t* data;   /* Dedicated NAS information data container */
Cedric Roux's avatar
 
Cedric Roux committed
180
181
182
} as_nas_info_t;

/* Radio Access Bearer identity */
183
typedef uint8_t as_rab_id_t;
Cedric Roux's avatar
 
Cedric Roux committed
184
185
186
187
188
189
190

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

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
191
 *              Broadcast information
Cedric Roux's avatar
 
Cedric Roux committed
192
193
194
195
196
197
198
199
 * --------------------------------------------------------------------------
 */

/*
 * AS->NAS - Broadcast information indication
 * AS may asynchronously report to NAS available PLMNs within specific
 * location area
 */
Cedric Roux's avatar
Cedric Roux committed
200
201
typedef struct broadcast_info_ind_s {
#define PLMN_LIST_MAX_SIZE  6
202
203
204
  PLMN_LIST_T(PLMN_LIST_MAX_SIZE) plmnIDs; /* List of PLMN identifiers */
  ci_t cellID;    /* Identity of the cell serving the listed PLMNs */
  tac_t tac;      /* Code of the tracking area the cell belongs to */
Cedric Roux's avatar
 
Cedric Roux committed
205
206
207
208
} broadcast_info_ind_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
209
 *     Cell information relevant for cell selection processing
Cedric Roux's avatar
 
Cedric Roux committed
210
211
212
213
 * --------------------------------------------------------------------------
 */

/* Radio access technologies supported by the network */
Cedric Roux's avatar
Cedric Roux committed
214
215
216
217
218
219
220
221
#define AS_GSM              (1 << NET_ACCESS_GSM)
#define AS_COMPACT          (1 << NET_ACCESS_COMPACT)
#define AS_UTRAN            (1 << NET_ACCESS_UTRAN)
#define AS_EGPRS            (1 << NET_ACCESS_EGPRS)
#define AS_HSDPA            (1 << NET_ACCESS_HSDPA)
#define AS_HSUPA            (1 << NET_ACCESS_HSUPA)
#define AS_HSDUPA           (1 << NET_ACCESS_HSDUPA)
#define AS_EUTRAN           (1 << NET_ACCESS_EUTRAN)
Cedric Roux's avatar
 
Cedric Roux committed
222

223
224
225
226
227
228
229
230
/*
 * NAS->AS -K_eNB refresh request
 * NAS request AS to refresh its KeNB key
 */
typedef struct kenb_refresh_req_s {
  Byte_t kenb[32];
} kenb_refresh_req_t;

Cedric Roux's avatar
 
Cedric Roux committed
231
232
233
234
235
/*
 * NAS->AS - Cell Information request
 * NAS request AS to search for a suitable cell belonging to the selected
 * PLMN to camp on.
 */
Cedric Roux's avatar
Cedric Roux committed
236
typedef struct cell_info_req_s {
237
238
  plmn_t plmnID;  /* Selected PLMN identity           */
  Byte_t rat;     /* Bitmap - set of radio access technologies    */
Cedric Roux's avatar
 
Cedric Roux committed
239
240
241
242
243
244
245
} cell_info_req_t;

/*
 * AS->NAS - Cell Information confirm
 * AS search for a suitable cell and respond to NAS. If found, the cell
 * is selected to camp on.
 */
Cedric Roux's avatar
Cedric Roux committed
246
typedef struct cell_info_cnf_s {
247
  uint8_t errCode;    /* Error code                     */
248
249
250
  ci_t cellID;    /* Identity of the cell serving the selected PLMN */
  tac_t tac;      /* Code of the tracking area the cell belongs to  */
  AcT_t rat;      /* Radio access technology supported by the cell  */
251
252
  uint8_t rsrq;   /* Reference signal received quality         */
  uint8_t rsrp;   /* Reference signal received power       */
Cedric Roux's avatar
 
Cedric Roux committed
253
254
255
256
257
258
} cell_info_cnf_t;

/*
 * AS->NAS - Cell Information indication
 * AS may change cell selection if a more suitable cell is found.
 */
Cedric Roux's avatar
Cedric Roux committed
259
typedef struct cell_info_ind_s {
260
261
  ci_t cellID;    /* Identity of the new serving cell      */
  tac_t tac;      /* Code of the tracking area the cell belongs to */
Cedric Roux's avatar
 
Cedric Roux committed
262
263
264
265
} cell_info_ind_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
266
 *              Paging information
Cedric Roux's avatar
 
Cedric Roux committed
267
268
269
270
 * --------------------------------------------------------------------------
 */

/* Paging cause */
Cedric Roux's avatar
Cedric Roux committed
271
typedef enum paging_cause_s {
272
273
  AS_CONNECTION_ESTABLISH,    /* Establish NAS signalling connection  */
  AS_EPS_ATTACH,      /* Perform local detach and initiate EPS
Cedric Roux's avatar
Cedric Roux committed
274
                 * attach procedure         */
275
  AS_CS_FALLBACK      /* Inititate CS fallback procedure  */
Cedric Roux's avatar
Cedric Roux committed
276
} paging_cause_t;
Cedric Roux's avatar
 
Cedric Roux committed
277
278
279
280
281
282

/*
 * NAS->AS - Paging Information request
 * NAS requests the AS that NAS signalling messages or user data is pending
 * to be sent.
 */
Cedric Roux's avatar
Cedric Roux committed
283
typedef struct paging_req_s {
284
  as_stmsi_t s_tmsi;  /* UE identity                  */
285
  uint8_t CN_domain;  /* Core network domain              */
Cedric Roux's avatar
 
Cedric Roux committed
286
287
288
289
290
291
} paging_req_t;

/*
 * AS->NAS - Paging Information indication
 * AS reports to the NAS that appropriate procedure has to be initiated.
 */
Cedric Roux's avatar
Cedric Roux committed
292
typedef struct paging_ind_s {
293
  paging_cause_t cause;  /* Paging cause                 */
Cedric Roux's avatar
 
Cedric Roux committed
294
295
296
297
} paging_ind_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
298
 *          NAS signalling connection establishment
Cedric Roux's avatar
 
Cedric Roux committed
299
300
301
302
 * --------------------------------------------------------------------------
 */

/* Cause of RRC connection establishment */
303
typedef enum as_cause_s {
304
305
306
307
308
309
310
  AS_CAUSE_UNKNOWN    = 0,
  AS_CAUSE_EMERGENCY  = NET_ESTABLISH_CAUSE_EMERGENCY,
  AS_CAUSE_HIGH_PRIO  = NET_ESTABLISH_CAUSE_HIGH_PRIO,
  AS_CAUSE_MT_ACCESS  = NET_ESTABLISH_CAUSE_MT_ACCESS,
  AS_CAUSE_MO_SIGNAL  = NET_ESTABLISH_CAUSE_MO_SIGNAL,
  AS_CAUSE_MO_DATA    = NET_ESTABLISH_CAUSE_MO_DATA,
  AS_CAUSE_V1020      = NET_ESTABLISH_CAUSE_V1020
311
} as_cause_t;
Cedric Roux's avatar
 
Cedric Roux committed
312
313

/* Type of the call associated to the RRC connection establishment */
314
typedef enum as_call_type_s {
315
316
317
318
319
  AS_TYPE_ORIGINATING_SIGNAL  = NET_ESTABLISH_TYPE_ORIGINATING_SIGNAL,
  AS_TYPE_EMERGENCY_CALLS     = NET_ESTABLISH_TYPE_EMERGENCY_CALLS,
  AS_TYPE_ORIGINATING_CALLS   = NET_ESTABLISH_TYPE_ORIGINATING_CALLS,
  AS_TYPE_TERMINATING_CALLS   = NET_ESTABLISH_TYPE_TERMINATING_CALLS,
  AS_TYPE_MO_CS_FALLBACK      = NET_ESTABLISH_TYPE_MO_CS_FALLBACK
320
} as_call_type_t;
Cedric Roux's avatar
 
Cedric Roux committed
321
322
323
324
325
326

/*
 * NAS->AS - NAS signalling connection establishment request
 * NAS requests the AS to perform the RRC connection establishment procedure
 * to transfer initial NAS message to the network while UE is in IDLE mode.
 */
Cedric Roux's avatar
Cedric Roux committed
327
typedef struct nas_establish_req_s {
328
329
330
331
332
  as_cause_t      cause;          /* RRC connection establishment cause   */
  as_call_type_t  type;           /* RRC associated call type             */
  as_stmsi_t      s_tmsi;         /* UE identity                          */
  plmn_t          plmnID;         /* Selected PLMN identity               */
  as_nas_info_t   initialNasMsg;  /* Initial NAS message to transfer      */
Cedric Roux's avatar
 
Cedric Roux committed
333
334
335
336
337
338
} nas_establish_req_t;

/*
 * AS->NAS - NAS signalling connection establishment indication
 * AS transfers the initial NAS message to the NAS.
 */
Cedric Roux's avatar
Cedric Roux committed
339
typedef struct nas_establish_ind_s {
340
  uint32_t      UEid;          /* UE lower layer identifier               */
341
  tac_t         tac;           /* Code of the tracking area the initiating
Cedric Roux's avatar
Cedric Roux committed
342
                                  * UE belongs to                           */
343
344
  as_cause_t    asCause;       /* Establishment cause                     */
  as_nas_info_t initialNasMsg; /* Initial NAS message to transfer         */
Cedric Roux's avatar
 
Cedric Roux committed
345
346
347
348
349
350
351
} nas_establish_ind_t;

/*
 * NAS->AS - NAS signalling connection establishment response
 * NAS responds to the AS that initial answer message has to be provided to
 * the UE.
 */
Cedric Roux's avatar
Cedric Roux committed
352
typedef struct nas_establish_rsp_s {
353
  uint32_t         UEid;         /* UE lower layer identifier   */
354
355
356
  as_stmsi_t       s_tmsi;       /* UE identity                 */
  nas_error_code_t errCode;      /* Transaction status          */
  as_nas_info_t    nasMsg;       /* NAS message to transfer     */
357
  uint32_t         nas_ul_count; /* UL NAS COUNT                */
358
359
  uint16_t         selected_encryption_algorithm;
  uint16_t         selected_integrity_algorithm;
Cedric Roux's avatar
 
Cedric Roux committed
360
361
362
363
364
365
} nas_establish_rsp_t;

/*
 * AS->NAS - NAS signalling connection establishment confirm
 * AS transfers the initial answer message to the NAS.
 */
Cedric Roux's avatar
Cedric Roux committed
366
typedef struct nas_establish_cnf_s {
367
  uint32_t         UEid;            /* UE lower layer identifier   */
368
369
  nas_error_code_t errCode;         /* Transaction status          */
  as_nas_info_t    nasMsg;          /* NAS message to transfer     */
370
  uint32_t         ul_nas_count;
371
372
  uint16_t         selected_encryption_algorithm;
  uint16_t         selected_integrity_algorithm;
Cedric Roux's avatar
 
Cedric Roux committed
373
374
375
376
} nas_establish_cnf_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
377
 *          NAS signalling connection release
Cedric Roux's avatar
 
Cedric Roux committed
378
379
380
381
 * --------------------------------------------------------------------------
 */

/* Release cause */
Cedric Roux's avatar
Cedric Roux committed
382
typedef enum release_cause_s {
383
384
  AS_AUTHENTICATION_FAILURE = 1,  /* Authentication procedure failed   */
  AS_DETACH                       /* Detach requested                  */
Cedric Roux's avatar
Cedric Roux committed
385
} release_cause_t;
Cedric Roux's avatar
 
Cedric Roux committed
386
387
388
389
390

/*
 * NAS->AS - NAS signalling connection release request
 * NAS requests the termination of the connection with the UE.
 */
Cedric Roux's avatar
Cedric Roux committed
391
typedef struct nas_release_req_s {
392
  uint32_t UEid;          /* UE lower layer identifier    */
393
394
  as_stmsi_t s_tmsi;      /* UE identity                  */
  release_cause_t cause;  /* Release cause                */
Cedric Roux's avatar
 
Cedric Roux committed
395
396
397
398
399
400
} nas_release_req_t;

/*
 * AS->NAS - NAS signalling connection release indication
 * AS reports that connection has been terminated by the network.
 */
Cedric Roux's avatar
Cedric Roux committed
401
typedef struct nas_release_ind_s {
402
  release_cause_t cause;      /* Release cause            */
Cedric Roux's avatar
 
Cedric Roux committed
403
404
405
406
} nas_release_ind_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
407
 *              NAS information transfer
Cedric Roux's avatar
 
Cedric Roux committed
408
409
410
411
412
413
414
415
 * --------------------------------------------------------------------------
 */

/*
 * NAS->AS - Uplink data transfer request
 * NAS requests the AS to transfer uplink information to the NAS that
 * operates at the network side.
 */
Cedric Roux's avatar
Cedric Roux committed
416
typedef struct ul_info_transfer_req_s {
417
  uint32_t UEid;      /* UE lower layer identifier        */
418
419
  as_stmsi_t s_tmsi;      /* UE identity              */
  as_nas_info_t nasMsg;   /* Uplink NAS message           */
Cedric Roux's avatar
 
Cedric Roux committed
420
421
422
423
424
425
426
} ul_info_transfer_req_t;

/*
 * AS->NAS - Uplink data transfer confirm
 * AS immediately notifies the NAS whether uplink information has been
 * successfully sent to the network or not.
 */
Cedric Roux's avatar
Cedric Roux committed
427
typedef struct ul_info_transfer_cnf_s {
428
  uint32_t         UEid;      /* UE lower layer identifier        */
429
  nas_error_code_t errCode;   /* Transaction status               */
Cedric Roux's avatar
 
Cedric Roux committed
430
431
432
433
434
435
436
} ul_info_transfer_cnf_t;

/*
 * AS->NAS - Uplink data transfer indication
 * AS delivers the uplink information message to the NAS that operates
 * at the network side.
 */
Cedric Roux's avatar
Cedric Roux committed
437
typedef struct ul_info_transfer_ind_s {
438
  uint32_t UEid;          /* UE lower layer identifier        */
439
  as_nas_info_t nasMsg;   /* Uplink NAS message           */
Cedric Roux's avatar
 
Cedric Roux committed
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
} ul_info_transfer_ind_t;

/*
 * NAS->AS - Downlink data transfer request
 * NAS requests the AS to transfer downlink information to the NAS that
 * operates at the UE side.
 */
typedef ul_info_transfer_req_t dl_info_transfer_req_t;

/*
 * AS->NAS - Downlink data transfer confirm
 * AS immediately notifies the NAS whether downlink information has been
 * successfully sent to the network or not.
 */
typedef ul_info_transfer_cnf_t dl_info_transfer_cnf_t;

/*
 * AS->NAS - Downlink data transfer indication
 * AS delivers the downlink information message to the NAS that operates
 * at the UE side.
 */
typedef ul_info_transfer_ind_t dl_info_transfer_ind_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
465
 *          Radio Access Bearer establishment
Cedric Roux's avatar
 
Cedric Roux committed
466
467
468
469
470
471
472
473
474
475
476
 * --------------------------------------------------------------------------
 */

/* TODO: Quality of Service parameters */
typedef struct {} as_qos_t;

/*
 * NAS->AS - Radio access bearer establishment request
 * NAS requests the AS to allocate transmission resources to radio access
 * bearer initialized at the network side.
 */
Cedric Roux's avatar
Cedric Roux committed
477
typedef struct rab_establish_req_s {
478
479
480
  as_stmsi_t s_tmsi;      /* UE identity                      */
  as_rab_id_t rabID;      /* Radio access bearer identity     */
  as_qos_t QoS;           /* Requested Quality of Service     */
Cedric Roux's avatar
 
Cedric Roux committed
481
482
483
484
485
486
} rab_establish_req_t;

/*
 * AS->NAS - Radio access bearer establishment indication
 * AS notifies the NAS that specific radio access bearer has to be setup.
 */
Cedric Roux's avatar
Cedric Roux committed
487
typedef struct rab_establish_ind_s {
488
  as_rab_id_t rabID;      /* Radio access bearer identity     */
Cedric Roux's avatar
 
Cedric Roux committed
489
490
491
492
493
494
495
} rab_establish_ind_t;

/*
 * NAS->AS - Radio access bearer establishment response
 * NAS responds to AS whether the specified radio access bearer has been
 * successfully setup or not.
 */
Cedric Roux's avatar
Cedric Roux committed
496
typedef struct rab_establish_rsp_s {
497
498
499
  as_stmsi_t       s_tmsi;        /* UE identity                      */
  as_rab_id_t      rabID;         /* Radio access bearer identity     */
  nas_error_code_t errCode;       /* Transaction status               */
Cedric Roux's avatar
 
Cedric Roux committed
500
501
502
503
504
505
506
} rab_establish_rsp_t;

/*
 * AS->NAS - Radio access bearer establishment confirm
 * AS notifies NAS whether the specified radio access bearer has been
 * successfully setup at the UE side or not.
 */
Cedric Roux's avatar
Cedric Roux committed
507
typedef struct rab_establish_cnf_s {
508
509
  as_rab_id_t rabID;          /* Radio access bearer identity     */
  nas_error_code_t errCode;   /* Transaction status               */
Cedric Roux's avatar
 
Cedric Roux committed
510
511
512
513
} rab_establish_cnf_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
514
 *              Radio Access Bearer release
Cedric Roux's avatar
 
Cedric Roux committed
515
516
517
518
519
520
521
522
 * --------------------------------------------------------------------------
 */

/*
 * NAS->AS - Radio access bearer release request
 * NAS requests the AS to release transmission resources previously allocated
 * to specific radio access bearer at the network side.
 */
Cedric Roux's avatar
Cedric Roux committed
523
typedef struct rab_release_req_s {
524
525
  as_stmsi_t s_tmsi;      /* UE identity                      */
  as_rab_id_t rabID;      /* Radio access bearer identity     */
Cedric Roux's avatar
 
Cedric Roux committed
526
527
528
529
530
531
} rab_release_req_t;

/*
 * AS->NAS - Radio access bearer release indication
 * AS notifies NAS that specific radio access bearer has been released.
 */
Cedric Roux's avatar
Cedric Roux committed
532
typedef struct rab_release_ind_s {
533
  as_rab_id_t rabID;      /* Radio access bearer identity     */
Cedric Roux's avatar
 
Cedric Roux committed
534
535
536
537
} rab_release_ind_t;

/*
 * --------------------------------------------------------------------------
Cedric Roux's avatar
Cedric Roux committed
538
 *  Structure of the AS messages handled by the network sublayer
Cedric Roux's avatar
 
Cedric Roux committed
539
540
 * --------------------------------------------------------------------------
 */
Cedric Roux's avatar
Cedric Roux committed
541
typedef struct as_message_s {
542
  uint16_t msgID;
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
  union {
    broadcast_info_ind_t broadcast_info_ind;
    cell_info_req_t cell_info_req;
    cell_info_cnf_t cell_info_cnf;
    cell_info_ind_t cell_info_ind;
    paging_req_t paging_req;
    paging_ind_t paging_ind;
    nas_establish_req_t nas_establish_req;
    nas_establish_ind_t nas_establish_ind;
    nas_establish_rsp_t nas_establish_rsp;
    nas_establish_cnf_t nas_establish_cnf;
    nas_release_req_t nas_release_req;
    nas_release_ind_t nas_release_ind;
    ul_info_transfer_req_t ul_info_transfer_req;
    ul_info_transfer_cnf_t ul_info_transfer_cnf;
    ul_info_transfer_ind_t ul_info_transfer_ind;
    dl_info_transfer_req_t dl_info_transfer_req;
    dl_info_transfer_cnf_t dl_info_transfer_cnf;
    dl_info_transfer_ind_t dl_info_transfer_ind;
    rab_establish_req_t rab_establish_req;
    rab_establish_ind_t rab_establish_ind;
    rab_establish_rsp_t rab_establish_rsp;
    rab_establish_cnf_t rab_establish_cnf;
    rab_release_req_t rab_release_req;
    rab_release_ind_t rab_release_ind;
  } __attribute__((__packed__)) msg;
Cedric Roux's avatar
 
Cedric Roux committed
569
570
571
572
573
574
575
576
577
578
} as_message_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  ******************/
/****************************************************************************/

579
int as_message_decode(const char* buffer, as_message_t* msg, int length);
Cedric Roux's avatar
 
Cedric Roux committed
580

581
int as_message_encode(char* buffer, as_message_t* msg, int length);
Cedric Roux's avatar
 
Cedric Roux committed
582
583

/* Implemented in the network_api.c body file */
584
int as_message_send(as_message_t* as_msg);
Cedric Roux's avatar
 
Cedric Roux committed
585
586

#endif /* __AS_MESSAGE_H__*/