s1ap_eNB_encoder.c 24.1 KB
Newer Older
1
2
3
4
5
/*
 * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The OpenAirInterface Software Alliance licenses this file to You under
Cedric Roux's avatar
Cedric Roux committed
6
 * the OAI Public License, Version 1.1  (the "License"); you may not use this file
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 * except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.openairinterface.org/?page_id=698
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *-------------------------------------------------------------------------------
 * For more information about the OpenAirInterface (OAI) Software Alliance:
 *      contact@openairinterface.org
 */

Cedric Roux's avatar
 
Cedric Roux committed
22
23
/*! \file s1ap_eNB_encoder.c
 * \brief s1ap pdu encode procedures for eNB
24
25
26
 * \author Sebastien ROUX and Navid Nikaein
 * \email navid.nikaein@eurecom.fr
 * \date 2013 - 2015
Cedric Roux's avatar
 
Cedric Roux committed
27
28
29
30
31
 * \version 0.1
 */

#include <stdio.h>
#include <string.h>
32
33
#include <stdint.h>

34
35
#include "assertions.h"

36
37
38
#include "conversions.h"

#include "intertask_interface.h"
Cedric Roux's avatar
 
Cedric Roux committed
39
40
41
42
43
44

#include "s1ap_common.h"
#include "s1ap_ies_defs.h"
#include "s1ap_eNB_encoder.h"

static inline int s1ap_eNB_encode_initiating(s1ap_message *message,
45
46
    uint8_t **buffer,
    uint32_t *len);
47

Cedric Roux's avatar
 
Cedric Roux committed
48
static inline int s1ap_eNB_encode_successfull_outcome(s1ap_message *message,
49
    uint8_t **buffer, uint32_t *len);
50

Cedric Roux's avatar
 
Cedric Roux committed
51
static inline int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *message,
52
    uint8_t **buffer, uint32_t *len);
53
54

static inline int s1ap_eNB_encode_s1_setup_request(
55
  S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs, uint8_t **buffer, uint32_t *length);
56
57

static inline int s1ap_eNB_encode_trace_failure(S1ap_TraceFailureIndicationIEs_t
58
59
    *trace_failure_ies_p, uint8_t **buffer,
    uint32_t *length);
60
61

static inline int s1ap_eNB_encode_initial_ue_message(S1ap_InitialUEMessageIEs_t
62
63
    *initialUEmessageIEs_p, uint8_t **buffer,
    uint32_t *length);
64
65

static inline int s1ap_eNB_encode_uplink_nas_transport(S1ap_UplinkNASTransportIEs_t
66
    *uplinkNASTransportIEs,
Cedric Roux's avatar
 
Cedric Roux committed
67
68
    uint8_t **buffer,
    uint32_t *length);
69

70
71
72
73
74
static inline int s1ap_eNB_encode_ue_capability_info_indication(
  S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs,
  uint8_t **buffer,
  uint32_t *length);

Cedric Roux's avatar
 
Cedric Roux committed
75
static inline int s1ap_eNB_encode_initial_context_setup_response(
76
77
78
  S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
  uint8_t **buffer,
  uint32_t *length);
Cedric Roux's avatar
 
Cedric Roux committed
79

80
81
static inline
int s1ap_eNB_encode_nas_non_delivery(
82
83
84
  S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs,
  uint8_t                            **buffer,
  uint32_t                            *length);
85

gauthier's avatar
gauthier committed
86
87
static inline
int s1ap_eNB_encode_ue_context_release_complete(
88
89
90
  S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs,
  uint8_t                           **buffer,
  uint32_t                           *length);
gauthier's avatar
gauthier committed
91

gauthier's avatar
gauthier committed
92
93
static inline
int s1ap_eNB_encode_ue_context_release_request(
94
95
96
  S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs,
  uint8_t                              **buffer,
  uint32_t                              *length);
gauthier's avatar
gauthier committed
97

98
99
100
101
102
static inline
int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t  *E_RABSetupResponseIEs,
					 uint8_t                              **buffer,
					 uint32_t                              *length);

103
104
105
106
107
108
109
110
111
112
static inline
int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t  *E_RABModifyResponseIEs,
           uint8_t                              **buffer,
           uint32_t                              *length);

static inline
int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t  *s1ap_E_RABReleaseResponseIEs,
                     uint8_t                              **buffer,
                     uint32_t                              *length);

Cedric Roux's avatar
 
Cedric Roux committed
113
114
int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len)
{
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
  DevAssert(message != NULL);
  DevAssert(buffer != NULL);
  DevAssert(len != NULL);

  switch(message->direction) {
  case S1AP_PDU_PR_initiatingMessage:
    return s1ap_eNB_encode_initiating(message, buffer, len);

  case S1AP_PDU_PR_successfulOutcome:
    return s1ap_eNB_encode_successfull_outcome(message, buffer, len);

  case S1AP_PDU_PR_unsuccessfulOutcome:
    return s1ap_eNB_encode_unsuccessfull_outcome(message, buffer, len);

  default:
    S1AP_DEBUG("Unknown message outcome (%d) or not implemented",
               (int)message->direction);
    break;
  }

  return -1;
Cedric Roux's avatar
 
Cedric Roux committed
136
137
138
}

static inline
139
int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p,
140
                               uint8_t **buffer, uint32_t *len)
Cedric Roux's avatar
 
Cedric Roux committed
141
{
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
  int ret = -1;
  MessageDef *message_p;
  char       *message_string = NULL;
  size_t      message_string_size;
  MessagesIds message_id;

  DevAssert(s1ap_message_p != NULL);

  message_string = calloc(10000, sizeof(char));

  s1ap_string_total_size = 0;

  switch(s1ap_message_p->procedureCode) {
  case S1ap_ProcedureCode_id_S1Setup:
    ret = s1ap_eNB_encode_s1_setup_request(
            &s1ap_message_p->msg.s1ap_S1SetupRequestIEs, buffer, len);
    s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_S1_SETUP_LOG;
    break;

  case S1ap_ProcedureCode_id_uplinkNASTransport:
    ret = s1ap_eNB_encode_uplink_nas_transport(
            &s1ap_message_p->msg.s1ap_UplinkNASTransportIEs, buffer, len);
    s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_UPLINK_NAS_LOG;
    break;

  case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
    ret = s1ap_eNB_encode_ue_capability_info_indication(
            &s1ap_message_p->msg.s1ap_UECapabilityInfoIndicationIEs, buffer, len);
    s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_UE_CAPABILITY_IND_LOG;
    break;

  case S1ap_ProcedureCode_id_initialUEMessage:
    ret = s1ap_eNB_encode_initial_ue_message(
            &s1ap_message_p->msg.s1ap_InitialUEMessageIEs, buffer, len);
    s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
    break;

  case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
    ret = s1ap_eNB_encode_nas_non_delivery(
            &s1ap_message_p->msg.s1ap_NASNonDeliveryIndication_IEs, buffer, len);
    s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp,
        message_string, s1ap_message_p);
    message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
    break;

  case S1ap_ProcedureCode_id_UEContextReleaseRequest:
    ret = s1ap_eNB_encode_ue_context_release_request(
            &s1ap_message_p->msg.s1ap_UEContextReleaseRequestIEs, buffer, len);
    s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp,
        message_string, s1ap_message_p);
    message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
    break;


  default:
    S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
               (int)s1ap_message_p->procedureCode);
    return ret;
    break;
  }
206

207
  message_string_size = strlen(message_string);
208

209
210
211
  message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
  message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size;
  memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
212

213
  itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
214

215
216
217
  free(message_string);

  return ret;
Cedric Roux's avatar
 
Cedric Roux committed
218
219
220
}

static inline
221
int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
222
                                        uint8_t **buffer, uint32_t *len)
Cedric Roux's avatar
 
Cedric Roux committed
223
{
224
225
226
227
228
  int ret = -1;
  MessageDef *message_p;
  char       *message_string = NULL;
  size_t      message_string_size;
  MessagesIds message_id;
229

230
  DevAssert(s1ap_message_p != NULL);
231

232
  message_string = calloc(10000, sizeof(char));
233

234
235
  s1ap_string_total_size = 0;
  message_string_size = strlen(message_string);
gauthier's avatar
gauthier committed
236

237

238
239
240
  switch(s1ap_message_p->procedureCode) {
  case S1ap_ProcedureCode_id_InitialContextSetup:
    ret = s1ap_eNB_encode_initial_context_setup_response(
gauthier's avatar
gauthier committed
241
242
            &s1ap_message_p->msg.s1ap_InitialContextSetupResponseIEs, buffer, len);

243
244
245
246
247
248
249
250
    s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
    message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
    memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size);
    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
    free(message_string);
    break;
251

252
253
254
255
256
257
258
259
260
261
262
  case S1ap_ProcedureCode_id_UEContextRelease:
    ret = s1ap_eNB_encode_ue_context_release_complete(
            &s1ap_message_p->msg.s1ap_UEContextReleaseCompleteIEs, buffer, len);
    s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG;
    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
    message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = message_string_size;
    memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, message_string, message_string_size);
    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
    free(message_string);
    break;
263

264
265
266
267
268
269
270
271
272
273
274
275
276
  case S1ap_ProcedureCode_id_E_RABSetup:

    ret = s1ap_eNB_encode_e_rab_setup_response (
           &s1ap_message_p->msg.s1ap_E_RABSetupResponseIEs, buffer, len);
    //s1ap_xer_print_s1ap_e_rabsetupresponse (s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id =  S1AP_E_RAB_SETUP_RESPONSE_LOG ;
    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
    message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = message_string_size;
    memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, message_string, message_string_size);
    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
    free(message_string);
    S1AP_INFO("E_RABSetup successful message\n");
    break;
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302

  case S1ap_ProcedureCode_id_E_RABModify:
    ret = s1ap_eNB_encode_e_rab_modify_response (
           &s1ap_message_p->msg.s1ap_E_RABModifyResponseIEs, buffer, len);
    message_id =  S1AP_E_RAB_MODIFY_RESPONSE_LOG ;
    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
    message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = message_string_size;
    memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, message_string, message_string_size);
    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
    free(message_string);
    S1AP_INFO("E_RABModify successful message\n");
    break;

  case S1ap_ProcedureCode_id_E_RABRelease:
    ret = s1ap_eNB_encode_e_rab_release_response (
           &s1ap_message_p->msg.s1ap_E_RABReleaseResponseIEs, buffer, len);
    s1ap_xer_print_s1ap_e_rabreleaseresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id =  S1AP_E_RAB_RELEASE_RESPONSE_LOG ;
    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
    message_p->ittiMsg.s1ap_e_rab_release_response_log.size = message_string_size;
    memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, message_string, message_string_size);
    itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
    free(message_string);
    S1AP_INFO("E_RAB Release successful message\n");
    break;

303
  default:
304
    S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n",
305
               (int)s1ap_message_p->procedureCode);
306
    return ret;
307
308
309
310
311
    break;
  }


  return ret;
Cedric Roux's avatar
 
Cedric Roux committed
312
313
314
}

static inline
315
int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *s1ap_message_p,
Cedric Roux's avatar
 
Cedric Roux committed
316
317
    uint8_t **buffer, uint32_t *len)
{
318
319
320
321
322
  int ret = -1;
  MessageDef *message_p;
  char       *message_string = NULL;
  size_t      message_string_size;
  MessagesIds message_id;
323

324
  DevAssert(s1ap_message_p != NULL);
325

326
  message_string = calloc(10000, sizeof(char));
327

328
329
330
331
332
333
334
335
336
  s1ap_string_total_size = 0;

  switch(s1ap_message_p->procedureCode) {
  case S1ap_ProcedureCode_id_InitialContextSetup:
    //             ret = s1ap_encode_s1ap_initialcontextsetupfailureies(
    //                 &s1ap_message_p->ittiMsg.s1ap_InitialContextSetupFailureIEs, buffer, len);
    s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, s1ap_message_p);
    message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
    break;
337

338
339
340
  default:
    S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
               (int)s1ap_message_p->procedureCode);
341
    return ret;
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    break;
  }

  message_string_size = strlen(message_string);

  message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
  message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
  memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size);

  itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);

  free(message_string);

  return ret;
Cedric Roux's avatar
 
Cedric Roux committed
356
357
358
359
}

static inline
int s1ap_eNB_encode_ue_capability_info_indication(
360
361
362
  S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs,
  uint8_t                             **buffer,
  uint32_t                             *length)
Cedric Roux's avatar
 
Cedric Roux committed
363
{
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
  S1ap_UECapabilityInfoIndication_t  ueCapabilityInfoIndication;
  S1ap_UECapabilityInfoIndication_t *ueCapabilityInfoIndication_p =
    &ueCapabilityInfoIndication;

  memset((void *)ueCapabilityInfoIndication_p, 0,  sizeof(ueCapabilityInfoIndication));

  if (s1ap_encode_s1ap_uecapabilityinfoindicationies(
        ueCapabilityInfoIndication_p, ueCapabilityInfoIndicationIEs) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_UECapabilityInfoIndication,
                                          S1ap_Criticality_ignore,
                                          &asn_DEF_S1ap_UECapabilityInfoIndication,
                                          ueCapabilityInfoIndication_p);
Cedric Roux's avatar
 
Cedric Roux committed
381
382
383
}

static inline
384
int s1ap_eNB_encode_uplink_nas_transport(
385
386
387
  S1ap_UplinkNASTransportIEs_t *uplinkNASTransportIEs,
  uint8_t                     **buffer,
  uint32_t                     *length)
Cedric Roux's avatar
 
Cedric Roux committed
388
{
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
  S1ap_UplinkNASTransport_t  uplinkNASTransport;
  S1ap_UplinkNASTransport_t *uplinkNASTransport_p = &uplinkNASTransport;

  memset((void *)uplinkNASTransport_p, 0, sizeof(uplinkNASTransport));

  if (s1ap_encode_s1ap_uplinknastransporties(
        uplinkNASTransport_p, uplinkNASTransportIEs) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_uplinkNASTransport,
                                          S1ap_Criticality_ignore,
                                          &asn_DEF_S1ap_UplinkNASTransport,
                                          uplinkNASTransport_p);
Cedric Roux's avatar
 
Cedric Roux committed
405
406
}

407
408
static inline
int s1ap_eNB_encode_nas_non_delivery(
409
410
411
  S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs,
  uint8_t                            **buffer,
  uint32_t                            *length)
412
{
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
  S1ap_NASNonDeliveryIndication_t  nasNonDeliveryIndication;
  S1ap_NASNonDeliveryIndication_t *nasNonDeliveryIndication_p = &nasNonDeliveryIndication;

  memset((void *)nasNonDeliveryIndication_p, 0, sizeof(nasNonDeliveryIndication));

  if (s1ap_encode_s1ap_nasnondeliveryindication_ies(
        nasNonDeliveryIndication_p, nasNonDeliveryIndicationIEs) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_NASNonDeliveryIndication,
                                          S1ap_Criticality_ignore,
                                          &asn_DEF_S1ap_NASNonDeliveryIndication,
                                          nasNonDeliveryIndication_p);
429
430
}

Cedric Roux's avatar
 
Cedric Roux committed
431
static inline
432
int s1ap_eNB_encode_s1_setup_request(
433
434
435
  S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs,
  uint8_t                 **buffer,
  uint32_t                 *length)
Cedric Roux's avatar
 
Cedric Roux committed
436
{
437
438
  S1ap_S1SetupRequest_t  s1SetupRequest;
  S1ap_S1SetupRequest_t *s1SetupRequest_p = &s1SetupRequest;
Cedric Roux's avatar
 
Cedric Roux committed
439

440
  memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest));
Cedric Roux's avatar
 
Cedric Roux committed
441

442
443
444
445
446
447
448
449
450
451
  if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_S1Setup,
                                          S1ap_Criticality_reject,
                                          &asn_DEF_S1ap_S1SetupRequest,
                                          s1SetupRequest_p);
Cedric Roux's avatar
 
Cedric Roux committed
452
453
454
}

static inline
455
int s1ap_eNB_encode_initial_ue_message(
456
457
458
  S1ap_InitialUEMessageIEs_t *initialUEmessageIEs_p,
  uint8_t                   **buffer,
  uint32_t                   *length)
Cedric Roux's avatar
 
Cedric Roux committed
459
{
460
461
462
463
464
465
466
467
468
469
470
471
472
  S1ap_InitialUEMessage_t  initialUEMessage;
  S1ap_InitialUEMessage_t *initialUEMessage_p = &initialUEMessage;

  memset((void *)initialUEMessage_p, 0, sizeof(initialUEMessage));

  if (s1ap_encode_s1ap_initialuemessageies(
        initialUEMessage_p, initialUEmessageIEs_p) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_initialUEMessage,
473
                                          S1ap_Criticality_ignore,
474
475
                                          &asn_DEF_S1ap_InitialUEMessage,
                                          initialUEMessage_p);
Cedric Roux's avatar
 
Cedric Roux committed
476
477
478
}

static inline
479
int s1ap_eNB_encode_trace_failure(
480
481
482
  S1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p,
  uint8_t                         **buffer,
  uint32_t                         *length)
Cedric Roux's avatar
 
Cedric Roux committed
483
{
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
  S1ap_TraceFailureIndication_t  trace_failure;
  S1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure;

  memset((void *)trace_failure_p, 0, sizeof(trace_failure));

  if (s1ap_encode_s1ap_tracefailureindicationies(
        trace_failure_p, trace_failure_ies_p) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_TraceFailureIndication,
                                          S1ap_Criticality_reject,
                                          &asn_DEF_S1ap_TraceFailureIndication,
                                          trace_failure_p);
Cedric Roux's avatar
 
Cedric Roux committed
500
501
502
503
}

static inline
int s1ap_eNB_encode_initial_context_setup_response(
504
505
506
  S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs,
  uint8_t                              **buffer,
  uint32_t                              *length)
Cedric Roux's avatar
 
Cedric Roux committed
507
{
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
  S1ap_InitialContextSetupResponse_t  initial_context_setup_response;
  S1ap_InitialContextSetupResponse_t *initial_context_setup_response_p =
    &initial_context_setup_response;

  memset((void *)initial_context_setup_response_p, 0,
         sizeof(initial_context_setup_response));

  if (s1ap_encode_s1ap_initialcontextsetupresponseies(
        initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) {
    return -1;
  }

  return s1ap_generate_successfull_outcome(buffer,
         length,
         S1ap_ProcedureCode_id_InitialContextSetup,
         S1ap_Criticality_reject,
         &asn_DEF_S1ap_InitialContextSetupResponse,
         initial_context_setup_response_p);
Cedric Roux's avatar
 
Cedric Roux committed
526
}
gauthier's avatar
gauthier committed
527
528
529

static inline
int s1ap_eNB_encode_ue_context_release_complete(
530
531
532
  S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs,
  uint8_t                              **buffer,
  uint32_t                              *length)
gauthier's avatar
gauthier committed
533
{
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
  S1ap_UEContextReleaseComplete_t  ue_context_release_complete;
  S1ap_UEContextReleaseComplete_t *ue_context_release_complete_p =
    &ue_context_release_complete;

  memset((void *)ue_context_release_complete_p, 0,
         sizeof(ue_context_release_complete));

  if (s1ap_encode_s1ap_uecontextreleasecompleteies(
        ue_context_release_complete_p, s1ap_UEContextReleaseCompleteIEs) < 0) {
    return -1;
  }

  return s1ap_generate_successfull_outcome(buffer,
         length,
         S1ap_ProcedureCode_id_UEContextRelease,
         S1ap_Criticality_reject,
         &asn_DEF_S1ap_UEContextReleaseComplete,
         ue_context_release_complete_p);
gauthier's avatar
gauthier committed
552
553
}

gauthier's avatar
gauthier committed
554
555
static inline
int s1ap_eNB_encode_ue_context_release_request(
556
557
558
  S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs,
  uint8_t                              **buffer,
  uint32_t                              *length)
gauthier's avatar
gauthier committed
559
{
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
  S1ap_UEContextReleaseRequest_t  ue_context_release_request;
  S1ap_UEContextReleaseRequest_t *ue_context_release_request_p =
    &ue_context_release_request;

  memset((void *)ue_context_release_request_p, 0,
         sizeof(ue_context_release_request));

  if (s1ap_encode_s1ap_uecontextreleaserequesties(
        ue_context_release_request_p, s1ap_UEContextReleaseRequestIEs) < 0) {
    return -1;
  }

  return s1ap_generate_initiating_message(buffer,
                                          length,
                                          S1ap_ProcedureCode_id_UEContextReleaseRequest,
                                          S1ap_Criticality_reject,
                                          &asn_DEF_S1ap_UEContextReleaseRequest,
                                          ue_context_release_request_p);
gauthier's avatar
gauthier committed
578
579
}

580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
static inline
int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t  *s1ap_E_RABSetupResponseIEs,
					 uint8_t                              **buffer,
					 uint32_t                              *length)
{
  S1ap_E_RABSetupResponse_t  e_rab_setup_response;
  S1ap_E_RABSetupResponse_t  *e_rab_setup_response_p = &e_rab_setup_response;
  
  memset((void *)e_rab_setup_response_p, 0,
         sizeof(e_rab_setup_response));

  if (s1ap_encode_s1ap_e_rabsetupresponseies (e_rab_setup_response_p, s1ap_E_RABSetupResponseIEs) < 0) {
    return -1;
  }
  
  return s1ap_generate_successfull_outcome(buffer,
         length,
         S1ap_ProcedureCode_id_E_RABSetup,
         S1ap_Criticality_reject,
         &asn_DEF_S1ap_E_RABSetupResponse,
         e_rab_setup_response_p);
}
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646

static inline
int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t  *s1ap_E_RABModifyResponseIEs,
           uint8_t                              **buffer,
           uint32_t                              *length)
{
  S1ap_E_RABModifyResponse_t  e_rab_modify_response;
  S1ap_E_RABModifyResponse_t  *e_rab_modify_response_p = &e_rab_modify_response;

  memset((void *)e_rab_modify_response_p, 0,
         sizeof(e_rab_modify_response));

  if (s1ap_encode_s1ap_e_rabmodifyresponseies (e_rab_modify_response_p, s1ap_E_RABModifyResponseIEs) < 0) {
    return -1;
  }

  return s1ap_generate_successfull_outcome(buffer,
         length,
         S1ap_ProcedureCode_id_E_RABModify,
         S1ap_Criticality_reject,
         &asn_DEF_S1ap_E_RABModifyResponse,
         e_rab_modify_response_p);
}
static inline
int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t  *s1ap_E_RABReleaseResponseIEs,
                     uint8_t                              **buffer,
                     uint32_t                              *length)
{
    S1ap_E_RABReleaseResponse_t  e_rab_release_response;
    S1ap_E_RABReleaseResponse_t  *e_rab_release_response_p = &e_rab_release_response;

  memset((void *)e_rab_release_response_p, 0,
         sizeof(e_rab_release_response));

  if (s1ap_encode_s1ap_e_rabreleaseresponseies (e_rab_release_response_p, s1ap_E_RABReleaseResponseIEs) < 0) {
    return -1;
  }

  return s1ap_generate_successfull_outcome(buffer,
         length,
         S1ap_ProcedureCode_id_E_RABRelease,
         S1ap_Criticality_reject,
         &asn_DEF_S1ap_E_RABReleaseResponse,
         e_rab_release_response_p);
}