rrc_proto.h 21.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
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
 */

22 23 24
/*! \file proto.h
 * \brief RRC functions prototypes for eNB and UE
 * \author Navid Nikaein and Raymond Knopp
25
 * \date 2010 - 2014
26 27
 * \email navid.nikaein@eurecom.fr
 * \version 1.0
28

29 30 31
 */
/** \addtogroup _rrc
 *  @{
32 33
 */

34
#include "RRC/LTE/rrc_defs.h"
Cedric Roux's avatar
Cedric Roux committed
35
#include "x2ap_messages_types.h"
Xenofon Foukas's avatar
Xenofon Foukas committed
36
#include "flexran_agent_extern.h"
37

38 39 40
//main.c
int rrc_init_global_param(void);
int L3_xface_init(void);
Raymond Knopp's avatar
 
Raymond Knopp committed
41
void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,uint8_t HO_enabled);
42

43
char
44
openair_rrc_eNB_configuration(
45
  const module_id_t enb_mod_idP,
46
  RrcConfigurationReq *configuration
47
);
48

49
char openair_rrc_eNB_init(
50 51
  const module_id_t module_idP);

52
char openair_rrc_ue_init(
53 54
  const module_id_t module_idP,
  const uint8_t CH_IDX);
55
void rrc_config_buffer(SRB_INFO *srb_info, uint8_t Lchan_type, uint8_t Role);
56 57
void
openair_rrc_on(
58
  const protocol_ctxt_t *const ctxt_pP);
59 60
void
openair_rrc_on_ue(
61
  const protocol_ctxt_t *const ctxt_pP);
62

63 64
void rrc_top_cleanup(void);

65
/** \brief Function to update eNB timers every subframe.  
66 67 68
@param ctxt_pP  running context
@param enb_index
@param CC_id
69
*/
70 71
RRC_status_t
rrc_rx_tx(
72
  protocol_ctxt_t *const ctxt_pP,
73 74 75 76 77 78 79 80 81 82
  const int          CC_id
);

/** \brief Function to update timers every subframe.  For UE it updates T300,T304 and T310.
@param ctxt_pP  running context
@param enb_index
@param CC_id
*/
RRC_status_t
rrc_rx_tx_ue(
83
  protocol_ctxt_t *const ctxt_pP,
84 85 86
  const uint8_t      enb_index,
  const int          CC_id
);
87 88 89 90

// UE RRC Procedures

/** \brief Decodes DL-CCCH message and invokes appropriate routine to handle the message
91
    \param ctxt_pP Running context
92 93
    \param Srb_info Pointer to SRB_INFO structure (SRB0)
    \param eNB_index Index of corresponding eNB/CH*/
94
int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *const Srb_info, const uint8_t eNB_index );
95 96

/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message
97
    \param ctxt_pP Running context
98 99
    \param Srb_id Index of Srb (1,2)
    \param buffer_pP Pointer to received SDU
100 101 102
    \param eNB_index Index of corresponding eNB/CH*/
void
rrc_ue_decode_dcch(
103
  const protocol_ctxt_t *const ctxt_pP,
104
  const rb_id_t                Srb_id,
105
  const uint8_t         *const Buffer,
106 107
  const uint8_t                eNB_indexP
);
108

109
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
110
int decode_SL_Discovery_Message(
111
  const protocol_ctxt_t *const ctxt_pP,
112
  const uint8_t                eNB_index,
113
  const uint8_t               *Sdu,
114 115 116
  const uint8_t                Sdu_len);
#endif

117
/** \brief Generate/Encodes RRCConnnectionRequest message at UE
118
    \param ctxt_pP Running context
119
    \param eNB_index Index of corresponding eNB/CH*/
120 121
void
rrc_ue_generate_RRCConnectionRequest(
122
  const protocol_ctxt_t *const ctxt_pP,
123 124
  const uint8_t                eNB_index
);
125

126
/** \brief process the received rrcConnectionReconfiguration message at UE
127
    \param ctxt_pP Running context
128 129
    \param *rrcConnectionReconfiguration pointer to the sturcture
    \param eNB_index Index of corresponding eNB/CH*/
130 131
void
rrc_ue_process_rrcConnectionReconfiguration(
132 133
  const protocol_ctxt_t *const       ctxt_pP,
  LTE_RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,
134 135
  uint8_t eNB_index
);
136 137 138 139 140 141 142

/** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure.  Configures RLC/PDCP accordingly
    \param module_idP Instance ID of UE
    \param frame Frame index
    \param eNB_index Index of corresponding eNB/CH
    \param SRB_config Pointer to SRB_ToAddMod IE from configuration
    @returns 0 on success*/
143
int32_t  rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct LTE_SRB_ToAddMod *SRB_config);
144 145 146 147 148 149 150

/** \brief Establish SRB2 based on configuration in SRB_ToAddMod structure.  Configures RLC/PDCP accordingly
    \param module_idP Instance ID of UE
    \param frame Frame index
    \param eNB_index Index of corresponding eNB/CH
    \param SRB_config Pointer to SRB_ToAddMod IE from configuration
    @returns 0 on success*/
151
int32_t  rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,struct LTE_SRB_ToAddMod *SRB_config);
152 153 154 155 156 157

/** \brief Establish a DRB according to DRB_ToAddMod structure
    \param module_idP Instance ID of UE
    \param eNB_index Index of corresponding CH/eNB
    \param DRB_config Pointer to DRB_ToAddMod IE from configuration
    @returns 0 on success */
158
int32_t  rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct LTE_DRB_ToAddMod *DRB_config);
159 160

/** \brief Process MobilityControlInfo Message to proceed with handover and configure PHY/MAC
161
    \param ctxt_pP Running context
162 163 164
    \param eNB_index Index of corresponding CH/eNB
    \param mobilityControlInfo Pointer to mobilityControlInfo
*/
165 166
void
rrc_ue_process_mobilityControlInfo(
167
  const protocol_ctxt_t *const       ctxt_pP,
168
  const uint8_t                      eNB_index,
169
  struct LTE_MobilityControlInfo *const mobilityControlInfo
170
);
171 172

/** \brief Process a measConfig Message and configure PHY/MAC
173
    \param  ctxt_pP    Running context
174 175
    \param eNB_index Index of corresponding CH/eNB
    \param  measConfig Pointer to MeasConfig  IE from configuration*/
176 177
void
rrc_ue_process_measConfig(
178
  const protocol_ctxt_t *const       ctxt_pP,
179
  const uint8_t                      eNB_index,
180
  LTE_MeasConfig_t *const               measConfig
181
);
182 183

/** \brief Process a RadioResourceConfigDedicated Message and configure PHY/MAC
184
    \param ctxt_pP Running context
185 186
    \param eNB_index Index of corresponding CH/eNB
    \param radioResourceConfigDedicated Pointer to RadioResourceConfigDedicated IE from configuration*/
187
void rrc_ue_process_radioResourceConfigDedicated(
188
  const protocol_ctxt_t *const ctxt_pP,
189
  uint8_t eNB_index,
190
  LTE_RadioResourceConfigDedicated_t *radioResourceConfigDedicated);
191

192 193 194 195 196 197 198 199 200 201 202

/** \brief Process a RadioResourceConfig and configure PHY/MAC for SL communication/discovery
    \param Mod_idP
    \param eNB_index Index of corresponding CH/eNB
    \param sib18 Pointer to SIB18 from SI message
    \param sib19 Pointer to SIB19 from SI message
    \param sl_CommConfig Pointer to SL_CommConfig RRCConnectionConfiguration
    \param sl_DiscConfig Pointer to SL_DiscConfig RRCConnectionConfiguration */
void rrc_ue_process_sidelink_radioResourceConfig(
  module_id_t Mod_idP,
  uint8_t eNB_index,
203 204
  LTE_SystemInformationBlockType18_r12_t     *sib18,
  LTE_SystemInformationBlockType19_r12_t     *sib19,
205 206
  LTE_SL_CommConfig_r12_t *sl_CommConfig,
  LTE_SL_DiscConfig_r12_t *sl_DiscConfig);
207 208 209 210 211 212 213

/** \brief Init control socket to listen to incoming packets from ProSe App
 *
 */
void rrc_control_socket_init(void);


214 215 216 217 218 219 220 221
// eNB/CH RRC Procedures

/**\brief Function to get the next transaction identifier.
   \param module_idP Instance ID for CH/eNB
   \return a transaction identifier*/
uint8_t rrc_eNB_get_next_transaction_identifier(module_id_t module_idP);

/**\brief Entry routine to decode a UL-CCCH-Message.  Invokes PER decoder and parses message.
222
   \param ctxt_pP Running context
223 224 225 226
   \param buffer Pointer to SDU
   \param buffer_length length of SDU in bytes
   \param CC_id component carrier index*/
int rrc_eNB_decode_ccch(protocol_ctxt_t* const ctxt_pP,
Robert Schmidt's avatar
Robert Schmidt committed
227
                        const uint8_t         *buffer,
228 229
                        int                    buffer_length,
                        const int              CC_id);
230 231

/**\brief Entry routine to decode a UL-DCCH-Message.  Invokes PER decoder and parses message.
232
   \param ctxt_pP Context
233 234
   \param Rx_sdu Pointer Received Message
   \param sdu_size Size of incoming SDU*/
235 236
int
rrc_eNB_decode_dcch(
237
  const protocol_ctxt_t *const ctxt_pP,
238
  const rb_id_t                Srb_id,
239
  const uint8_t    *const      Rx_sdu,
240 241
  const sdu_size_t             sdu_sizeP
);
242 243

/**\brief Generate the RRCConnectionSetup based on information coming from RRM
244 245 246 247
   \param ctxt_pP       Running context
   \param ue_context_pP UE context*/
void
rrc_eNB_generate_RRCConnectionSetup(
248 249
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
250
  const int                    CC_id
251
);
252

253 254 255 256 257 258
/**\brief Generate RRCConnectionReestablishmentReject
   \param ctxt_pP       Running context
   \param ue_context_pP UE context
   \param CC_id         Component Carrier ID*/
void
rrc_eNB_generate_RRCConnectionReestablishmentReject(
259 260
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
261 262 263
  const int                    CC_id
);

264
/**\brief Process the RRCConnectionSetupComplete based on information coming from UE
265 266
   \param ctxt_pP       Running context
   \param ue_context_pP RRC UE context
267
   \param rrcConnectionSetupComplete Pointer to RRCConnectionSetupComplete message*/
268 269
void
rrc_eNB_process_RRCConnectionSetupComplete(
270 271 272
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t        *ue_context_pP,
  LTE_RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete
273
);
274 275

/**\brief Process the RRCConnectionReconfigurationComplete based on information coming from UE
276 277
   \param ctxt_pP       Running context
   \param ue_context_pP RRC UE context
278 279 280
   \param rrcConnectionReconfigurationComplete Pointer to RRCConnectionReconfigurationComplete message
   \param xid         the transaction id for the rrcconnectionreconfiguration procedure
*/
281 282
void
rrc_eNB_process_RRCConnectionReconfigurationComplete(
283 284
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t        *ue_context_pP,
285
  const uint8_t xid
286
);
287

288
/**\brief Generate the RRCConnectionRelease
289 290 291 292
   \param ctxt_pP Running context
   \param ue_context_pP UE context of UE receiving the message*/
void
rrc_eNB_generate_RRCConnectionRelease(
293 294
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP
295 296 297 298
);

void
rrc_eNB_generate_defaultRRCConnectionReconfiguration(
299 300
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP,
301 302
  const uint8_t                ho_state
);
303

Xenofon Foukas's avatar
Xenofon Foukas committed
304 305 306

void
flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(
307 308
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
Xenofon Foukas's avatar
Xenofon Foukas committed
309
							     const uint8_t ho_state,
310 311
  agent_reconf_rrc *trig_param
);
312
void
313 314 315
rrc_eNB_generate_HO_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
    rrc_eNB_ue_context_t  *const ue_context_pP,
    uint8_t               *buffer,
316 317 318 319
                                                 int                    *_size
                                                 //const uint8_t        ho_state
                                                 );
void
320
rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s *ue_context_p, protocol_ctxt_t *const ctxt_pP);
Xenofon Foukas's avatar
Xenofon Foukas committed
321

322 323
int freq_to_arfcn10(int band, unsigned long freq);

324 325
void
rrc_eNB_generate_dedeicatedRRCConnectionReconfiguration(
326 327
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP,
328 329 330
  const uint8_t                ho_state
);

331 332 333 334 335
/**\brief release Data Radio Bearer between ENB and UE
   \param ctxt_pP Running context
   \param ue_context_pP UE context of UE receiving the message*/
void
rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(
336 337
  const protocol_ctxt_t   *const ctxt_pP,
  rrc_eNB_ue_context_t    *const ue_context_pP,
338 339
  uint8_t                  xid,
  uint32_t                 nas_length,
340
  uint8_t                 *nas_buffer
341 342
);

343
void 
344 345
rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t *const ctxt_pP,
                          rrc_eNB_ue_context_t  *ue_context_pP);
346 347


laurent's avatar
laurent committed
348 349 350 351

void  rrc_enb_init(void);
void *rrc_enb_process_itti_msg(void *);

352 353 354 355 356 357 358
/**\brief RRC eNB task.
   \param void *args_p Pointer on arguments to start the task. */
void *rrc_enb_task(void *args_p);

/**\brief RRC UE task.
   \param void *args_p Pointer on arguments to start the task. */
void *rrc_ue_task(void *args_p);
359

360

361 362
void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_req_t *m);

363 364 365 366
/**\brief Generate/decode the handover RRCConnectionReconfiguration at eNB
   \param module_idP Instance ID for eNB/CH
   \param frame Frame index
   \param ue_module_idP Index of UE transmitting the messages*/
367 368
void
rrc_eNB_generate_RRCConnectionReconfiguration_handover(
369 370 371
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t           *const ue_context_pP,
  uint8_t                *const nas_pdu,
372 373
  const uint32_t                nas_length
);
374

375 376 377 378 379 380 381
/**\brief Generate/decode the RRCConnectionReconfiguration for Sidelink at eNB
   \param ctxt_pP       Running context
   \param ue_context_pP RRC UE context
   \param destinationInfoList List of the destinations
   \param n_discoveryMessages Number of discovery messages*/
int
rrc_eNB_generate_RRCConnectionReconfiguration_Sidelink(
382 383
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t           *const ue_context_pP,
384
      LTE_SL_DestinationInfoList_r12_t  *destinationInfoList,
385 386 387 388 389 390 391 392
      int n_discoveryMessages
);

/** \brief process the received SidelinkUEInformation message at eNB
    \param ctxt_pP Running context
    \param sidelinkUEInformation sidelinkUEInformation message from UE*/
uint8_t
rrc_eNB_process_SidelinkUEInformation(
393 394 395
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t         *ue_context_pP,
  LTE_SidelinkUEInformation_r12_t  *sidelinkUEInformation
396 397 398 399 400 401
);

/** \brief Get a Resource Pool to transmit SL communication
    \param ctxt_pP Running context
    \param ue_context_pP UE context
    \param destinationInfoList Pointer to the list of SL destinations*/
402
LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool(
403 404
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
405
      LTE_SL_DestinationInfoList_r12_t  *destinationInfoList
406 407 408 409 410 411
);

/** \brief Get a Resource Pool for Discovery
    \param ctxt_pP Running context
    \param ue_context_pP UE context
    \param n_discoveryMessages Number of discovery messages*/
412
LTE_SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool(
413 414
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
415 416 417 418 419 420 421 422
      int n_discoveryMessages
);

/** \brief Process request from control socket
 *  \param arg
 */
void *rrc_control_socket_thread_fct(void *arg);

423
//L2_interface.c
424
int8_t
425
mac_rrc_data_req(
426
  const module_id_t Mod_idP,
427
  const int         CC_id,
428 429
  const frame_t     frameP,
  const rb_id_t     Srb_id,
430
  const rnti_t      rnti,
431
  const uint8_t     Nb_tb,
432
  uint8_t    *const buffer_pP,
433 434 435 436
  const uint8_t     mbsfn_sync_area
);

int8_t
437
mac_rrc_data_ind(
438
  const module_id_t     module_idP,
Bing-Kai Hong's avatar
Bing-Kai Hong committed
439
  const int             CC_id,
440
  const frame_t         frameP,
441
  const sub_frame_t     sub_frameP,
Bing-Kai Hong's avatar
Bing-Kai Hong committed
442
  const int             UE_id,
443 444
  const rnti_t          rntiP,
  const rb_id_t         srb_idP,
445
  const uint8_t        *sduP,
446
  const sdu_size_t      sdu_lenP,
447
  const uint8_t         mbsfn_sync_areaP
448
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
449 450
  , const boolean_t		brOption
#endif
451 452 453 454 455 456 457 458 459
);

int8_t
mac_rrc_data_req_ue(
  const module_id_t Mod_idP,
  const int         CC_id,
  const frame_t     frameP,
  const rb_id_t     Srb_id,
  const uint8_t     Nb_tb,
460
  uint8_t    *const buffer_pP,
461 462 463 464 465 466 467 468 469 470 471 472
  const mac_enb_index_t eNB_indexP,
  const uint8_t     mbsfn_sync_area
);

int8_t
mac_rrc_data_ind_ue(
  const module_id_t     module_idP,
  const int         CC_id,
  const frame_t         frameP,
  const sub_frame_t     sub_frameP,
  const rnti_t          rntiP,
  const rb_id_t         srb_idP,
473
  const uint8_t        *sduP,
474
  const sdu_size_t      sdu_lenP,
475 476 477
  const mac_enb_index_t eNB_indexP,
  const uint8_t         mbsfn_sync_areaP
);
478 479 480

void mac_sync_ind( module_id_t Mod_instP, uint8_t status);

481 482
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
			    const int CC_id,
483 484 485 486
			    const frame_t frameP,
			    const sub_frame_t subframeP,
			    const rnti_t rnti);

487 488 489 490 491 492
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
                const int CC_id,
                const frame_t frameP,
                const sub_frame_t subframeP,
                const rnti_t rnti);

kaltenbe's avatar
kaltenbe committed
493 494 495 496 497 498
void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, 
			    const int CC_id, 
			    const frame_t frameP,
			    const sub_frame_t subframeP,
			    const rnti_t rnti);

499
uint8_t
500
rrc_data_req(
501
  const protocol_ctxt_t   *const ctxt_pP,
502 503 504 505
  const rb_id_t                  rb_idP,
  const mui_t                    muiP,
  const confirm_t                confirmP,
  const sdu_size_t               sdu_size,
506
  uint8_t                 *const buffer_pP,
507 508 509
  const pdcp_transmission_mode_t modeP
);

Cedric Roux's avatar
Cedric Roux committed
510
uint8_t
oai's avatar
oai committed
511

Cedric Roux's avatar
Cedric Roux committed
512
rrc_data_req_ue(
513
  const protocol_ctxt_t   *const ctxt_pP,
Cedric Roux's avatar
Cedric Roux committed
514 515 516 517
  const rb_id_t                  rb_idP,
  const mui_t                    muiP,
  const confirm_t                confirmP,
  const sdu_size_t               sdu_sizeP,
518
  uint8_t                 *const buffer_pP,
Cedric Roux's avatar
Cedric Roux committed
519 520 521
  const pdcp_transmission_mode_t modeP
);

oai's avatar
oai committed
522

523
void
524
rrc_data_ind(
525
  const protocol_ctxt_t *const ctxt_pP,
526 527
  const rb_id_t                Srb_id,
  const sdu_size_t             sdu_sizeP,
528
  const uint8_t   *const       buffer_pP
529
);
530

531
void rrc_in_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t eNB_index);
532

533
void rrc_out_of_sync_ind(module_id_t module_idP, frame_t frameP, unsigned short eNB_index);
534

535
int decode_MCCH_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t *const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area );
536

537
int decode_BCCH_DLSCH_Message(
538
  const protocol_ctxt_t *const ctxt_pP,
539
  const uint8_t                eNB_index,
540
  uint8_t               *const Sdu,
541 542
  const uint8_t                Sdu_len,
  const uint8_t                rsrq,
543
  const uint8_t                rsrp );
544

545
int decode_PCCH_DLSCH_Message(
546
  const protocol_ctxt_t *const ctxt_pP,
547
  const uint8_t                eNB_index,
548
  uint8_t               *const Sdu,
549 550
  const uint8_t                Sdu_len);

551 552
void
ue_meas_filtering(
553
  const protocol_ctxt_t *const ctxt_pP,
554 555 556 557 558
  const uint8_t                eNB_index
);

void
ue_measurement_report_triggering(
559
  protocol_ctxt_t        *const ctxt_pP,
560 561 562 563
  const uint8_t                 eNB_index
);

int
564
mac_eNB_get_rrc_status(
565 566 567 568 569
  const module_id_t Mod_idP,
  const rnti_t      rntiP
);

int
570
mac_UE_get_rrc_status(
571 572 573 574 575 576
  const module_id_t Mod_idP,
  const uint8_t     indexP
);

void
rrc_eNB_generate_UECapabilityEnquiry(
577 578
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP
579 580 581 582
);

void
rrc_eNB_generate_SecurityModeCommand(
583 584
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP
585 586 587 588
);

void
rrc_eNB_process_MeasurementReport(
589 590 591
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t        *ue_context_pP,
  const LTE_MeasResults_t   *const measResults2
592 593 594 595
);

void
rrc_eNB_generate_HandoverPreparationInformation(
596
  //const protocol_ctxt_t* const ctxt_pP,
597 598
  rrc_eNB_ue_context_t          *const ue_context_pP,
  uint8_t                     *buffer,
599
  int                          *_size
600
  //LTE_PhysCellId_t targetPhyId
601 602 603 604
);

void
check_handovers(
605
  protocol_ctxt_t *const ctxt_pP
606 607 608 609 610 611 612 613 614 615
);

//void rrc_ue_process_ueCapabilityEnquiry(uint8_t module_idP,uint32_t frame,UECapabilityEnquiry_t *UECapabilityEnquiry,uint8_t eNB_index);
/*void
rrc_ue_process_securityModeCommand(
                const protocol_ctxt_t* const ctxt_pP,
                SecurityModeCommand_t *const securityModeCommand,
                const uint8_t                eNB_index
                );
*/
616

617 618 619 620 621 622 623
void rrc_eNB_emulation_notify_ue_module_id(
  const module_id_t ue_module_idP,
  const rnti_t      rntiP,
  const uint8_t     cell_identity_byte0P,
  const uint8_t     cell_identity_byte1P,
  const uint8_t     cell_identity_byte2P,
  const uint8_t     cell_identity_byte3P);
624

625 626


627 628
void
rrc_eNB_free_mem_UE_context(
629 630
  const protocol_ctxt_t               *const ctxt_pP,
  struct rrc_eNB_ue_context_s         *const ue_context_pP
631
);
632 633


634 635
void
rrc_eNB_free_UE(
636
		const module_id_t enb_mod_idP,
637
  const struct rrc_eNB_ue_context_s         *const ue_context_pP
638
);
639 640 641 642 643

long binary_search_int(int elements[], long numElem, int value);

long binary_search_float(float elements[], long numElem, float value);

644
void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active);
Cedric Roux's avatar
Cedric Roux committed
645 646 647

void openair_rrc_top_init_ue(
                        int eMBMS_active,
648
  char *uecap_xer,
Cedric Roux's avatar
Cedric Roux committed
649 650 651
                        uint8_t cba_group_active,
                        uint8_t HO_active
);
652 653
pthread_mutex_t      rrc_release_freelist;
RRC_release_list_t rrc_release_info;
654 655 656 657 658
pthread_mutex_t      lock_ue_freelist;
void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti);
void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag);
void release_UE_in_freeList(module_id_t mod_id);

659
/** @}*/