rrc_proto.h 22.2 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 35
#pragma once

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

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

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

51
char openair_rrc_eNB_init(
52 53
  const module_id_t module_idP);

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

65 66
void rrc_top_cleanup(void);

67
/** \brief Function to update eNB timers every subframe.
68 69 70
@param ctxt_pP  running context
@param enb_index
@param CC_id
71
*/
72 73
RRC_status_t
rrc_rx_tx(
74
  protocol_ctxt_t *const ctxt_pP,
75 76 77 78 79 80 81 82 83 84
  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(
85
  protocol_ctxt_t *const ctxt_pP,
86 87 88
  const uint8_t      enb_index,
  const int          CC_id
);
89 90 91 92

// UE RRC Procedures

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

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

112
int decode_SL_Discovery_Message(
113
  const protocol_ctxt_t *const ctxt_pP,
114
  const uint8_t                eNB_index,
115
  const uint8_t               *Sdu,
116 117
  const uint8_t                Sdu_len);

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

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

/** \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*/
144
int32_t  rrc_ue_establish_srb1(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct LTE_SRB_ToAddMod *SRB_config);
145 146 147 148 149 150 151

/** \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*/
152
int32_t  rrc_ue_establish_srb2(module_id_t module_idP,frame_t frameP, uint8_t eNB_index,struct LTE_SRB_ToAddMod *SRB_config);
153 154 155 156 157 158

/** \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 */
159
int32_t  rrc_ue_establish_drb(module_id_t module_idP,frame_t frameP,uint8_t eNB_index,struct LTE_DRB_ToAddMod *DRB_config);
160 161

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

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

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

193 194 195 196 197 198 199 200 201 202 203

/** \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,
204 205
  LTE_SystemInformationBlockType18_r12_t     *sib18,
  LTE_SystemInformationBlockType19_r12_t     *sib19,
206 207
  LTE_SL_CommConfig_r12_t *sl_CommConfig,
  LTE_SL_DiscConfig_r12_t *sl_DiscConfig);
208 209 210 211 212 213 214

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


215 216 217 218 219 220 221 222
// 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.
223
   \param ctxt_pP Running context
224 225 226
   \param buffer Pointer to SDU
   \param buffer_length length of SDU in bytes
   \param CC_id component carrier index*/
227
int rrc_eNB_decode_ccch(protocol_ctxt_t *const ctxt_pP,
Robert Schmidt's avatar
Robert Schmidt committed
228
                        const uint8_t         *buffer,
229 230
                        int                    buffer_length,
                        const int              CC_id);
231 232

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

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

254 255 256 257 258 259
/**\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(
260 261
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
262 263 264
  const int                    CC_id
);

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

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

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

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

Xenofon Foukas's avatar
Xenofon Foukas committed
305 306 307

void
flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(
308 309
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
310
  const uint8_t ho_state
311
);
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
    size_t                 buffer_size,
317 318 319
    int                    *_size
    //const uint8_t        ho_state
                                                );
320
void
321
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
322

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

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

332 333 334 335 336
/**\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(
337 338
  const protocol_ctxt_t   *const ctxt_pP,
  rrc_eNB_ue_context_t    *const ue_context_pP,
339 340
  uint8_t                  xid,
  uint32_t                 nas_length,
341
  uint8_t                 *nas_buffer
342 343
);

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


laurent's avatar
laurent committed
349 350 351 352

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

353 354 355 356 357 358 359
/**\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);
360

361 362 363 364 365 366
/**\brief RRC NSA UE task.
   \param void *args_p Pointer on arguments to start the task. */
void *recv_msgs_from_nr_ue(void *args_p);

void init_connections_with_nr_ue(void);

367 368 369
void rrc_eNB_process_x2_setup_request(int mod_id, x2ap_setup_req_t *m);

void rrc_eNB_process_x2_setup_response(int mod_id, x2ap_setup_resp_t *m);
370

371
void rrc_eNB_process_handoverPreparationInformation(int mod_id, x2ap_handover_req_t *m);
372

373 374
void rrc_eNB_process_ENDC_x2_setup_request(int mod_id, x2ap_ENDC_setup_req_t *m);

375 376 377 378
/**\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*/
379 380
void
rrc_eNB_generate_RRCConnectionReconfiguration_handover(
381 382 383
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t           *const ue_context_pP,
  uint8_t                *const nas_pdu,
384 385
  const uint32_t                nas_length
);
386

387 388 389 390 391 392 393
/**\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(
394 395
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t           *const ue_context_pP,
396 397
  LTE_SL_DestinationInfoList_r12_t  *destinationInfoList,
  int n_discoveryMessages
398 399 400 401 402 403 404
);

/** \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(
405 406 407
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t         *ue_context_pP,
  LTE_SidelinkUEInformation_r12_t  *sidelinkUEInformation
408 409 410 411 412 413
);

/** \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*/
414
LTE_SL_CommConfig_r12_t rrc_eNB_get_sidelink_commTXPool(
415 416
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
417
  LTE_SL_DestinationInfoList_r12_t  *destinationInfoList
418 419 420 421 422 423
);

/** \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*/
424
LTE_SL_DiscConfig_r12_t rrc_eNB_get_sidelink_discTXPool(
425 426
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t *const ue_context_pP,
427
  int n_discoveryMessages
428 429 430 431 432 433 434
);

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

435
//L2_interface.c
436
int8_t
437
mac_rrc_data_req(
438
  const module_id_t Mod_idP,
439
  const int         CC_id,
440 441
  const frame_t     frameP,
  const rb_id_t     Srb_id,
442
  const rnti_t      rnti,
443
  const uint8_t     Nb_tb,
444
  uint8_t    *const buffer_pP,
445 446 447 448
  const uint8_t     mbsfn_sync_area
);

int8_t
449
mac_rrc_data_ind(
450
  const module_id_t     module_idP,
Bing-Kai Hong's avatar
Bing-Kai Hong committed
451
  const int             CC_id,
452
  const frame_t         frameP,
453
  const sub_frame_t     sub_frameP,
Bing-Kai Hong's avatar
Bing-Kai Hong committed
454
  const int             UE_id,
455 456
  const rnti_t          rntiP,
  const rb_id_t         srb_idP,
457
  const uint8_t        *sduP,
458
  const sdu_size_t      sdu_lenP,
459 460
  const uint8_t         mbsfn_sync_areaP,
  const boolean_t   brOption
461 462 463 464 465 466 467 468 469
);

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,
470
  uint8_t    *const buffer_pP,
471 472 473 474 475 476 477 478 479 480 481 482
  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,
483
  const uint8_t        *sduP,
484
  const sdu_size_t      sdu_lenP,
485 486 487
  const mac_enb_index_t eNB_indexP,
  const uint8_t         mbsfn_sync_areaP
);
488 489 490

void mac_sync_ind( module_id_t Mod_instP, uint8_t status);

491
void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP,
492 493 494 495
                            const int CC_id,
                            const frame_t frameP,
                            const sub_frame_t subframeP,
                            const rnti_t rnti);
496

497
void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP,
498 499 500 501
                                const int CC_id,
                                const frame_t frameP,
                                const sub_frame_t subframeP,
                                const rnti_t rnti);
502

503 504 505 506 507
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);
kaltenbe's avatar
kaltenbe committed
508

509
uint8_t
510
rrc_data_req(
511
  const protocol_ctxt_t   *const ctxt_pP,
512 513 514 515
  const rb_id_t                  rb_idP,
  const mui_t                    muiP,
  const confirm_t                confirmP,
  const sdu_size_t               sdu_size,
516
  uint8_t                 *const buffer_pP,
517 518 519
  const pdcp_transmission_mode_t modeP
);

Cedric Roux's avatar
Cedric Roux committed
520
uint8_t
oai's avatar
oai committed
521

Cedric Roux's avatar
Cedric Roux committed
522
rrc_data_req_ue(
523
  const protocol_ctxt_t   *const ctxt_pP,
Cedric Roux's avatar
Cedric Roux committed
524 525 526 527
  const rb_id_t                  rb_idP,
  const mui_t                    muiP,
  const confirm_t                confirmP,
  const sdu_size_t               sdu_sizeP,
528
  uint8_t                 *const buffer_pP,
Cedric Roux's avatar
Cedric Roux committed
529 530 531
  const pdcp_transmission_mode_t modeP
);

Melissa Elkadi's avatar
Melissa Elkadi committed
532

533
void
534
rrc_data_ind(
535
  const protocol_ctxt_t *const ctxt_pP,
536 537
  const rb_id_t                Srb_id,
  const sdu_size_t             sdu_sizeP,
538
  const uint8_t   *const       buffer_pP
539
);
540

541
void rrc_in_sync_ind(module_id_t module_idP, frame_t frameP, uint16_t eNB_index);
542

543
void rrc_out_of_sync_ind(module_id_t module_idP, frame_t frameP, unsigned short eNB_index);
544

545
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 );
546

547
int decode_BCCH_DLSCH_Message(
548
  const protocol_ctxt_t *const ctxt_pP,
549
  const uint8_t                eNB_index,
550
  uint8_t               *const Sdu,
551 552
  const uint8_t                Sdu_len,
  const uint8_t                rsrq,
553
  const uint8_t                rsrp );
554

555
int decode_BCCH_MBMS_DLSCH_Message(
556
  const protocol_ctxt_t *const ctxt_pP,
557
  const uint8_t                eNB_index,
558
  uint8_t               *const Sdu,
559 560 561 562
  const uint8_t                Sdu_len,
  const uint8_t                rsrq,
  const uint8_t                rsrp );

563
int decode_PCCH_DLSCH_Message(
564
  const protocol_ctxt_t *const ctxt_pP,
565
  const uint8_t                eNB_index,
566
  uint8_t               *const Sdu,
567 568
  const uint8_t                Sdu_len);

569 570
void
ue_meas_filtering(
571
  const protocol_ctxt_t *const ctxt_pP,
572 573 574 575 576
  const uint8_t                eNB_index
);

void
ue_measurement_report_triggering(
577
  protocol_ctxt_t        *const ctxt_pP,
578 579 580 581
  const uint8_t                 eNB_index
);

int
582
mac_eNB_get_rrc_status(
583 584 585 586 587
  const module_id_t Mod_idP,
  const rnti_t      rntiP
);

int
588
mac_UE_get_rrc_status(
589 590 591 592 593 594
  const module_id_t Mod_idP,
  const uint8_t     indexP
);

void
rrc_eNB_generate_UECapabilityEnquiry(
595 596
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP
597 598
);

599 600 601 602 603 604
void
rrc_eNB_generate_NR_UECapabilityEnquiry(
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP
);

605 606
void
rrc_eNB_generate_SecurityModeCommand(
607 608
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t          *const ue_context_pP
609 610 611 612
);

void
rrc_eNB_process_MeasurementReport(
613 614 615
  const protocol_ctxt_t *const ctxt_pP,
  rrc_eNB_ue_context_t        *ue_context_pP,
  const LTE_MeasResults_t   *const measResults2
616 617 618 619
);

void
rrc_eNB_generate_HandoverPreparationInformation(
620
  //const protocol_ctxt_t* const ctxt_pP,
621 622
  rrc_eNB_ue_context_t          *const ue_context_pP,
  uint8_t                     *buffer,
623
  int                          *_size
624
  //LTE_PhysCellId_t targetPhyId
625 626
);

627 628
int
flexran_rrc_eNB_trigger_handover (int mod_id,
629 630 631
                                  const protocol_ctxt_t *const ctxt_pP,
                                  rrc_eNB_ue_context_t  *ue_context_pP,
                                  int target_cell_id);
632

633 634
void
check_handovers(
635
  protocol_ctxt_t *const ctxt_pP
636 637 638 639 640 641 642 643 644 645
);

//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
                );
*/
646

647 648 649 650 651 652 653
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);
654

655 656


657 658
void
rrc_eNB_free_mem_UE_context(
659 660
  const protocol_ctxt_t               *const ctxt_pP,
  struct rrc_eNB_ue_context_s         *const ue_context_pP
661
);
662 663


664 665
void
rrc_eNB_free_UE(
666
  const module_id_t enb_mod_idP,
667
  const struct rrc_eNB_ue_context_s         *const ue_context_pP
668
);
669 670 671 672 673

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

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

674
void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active);
Cedric Roux's avatar
Cedric Roux committed
675 676

void openair_rrc_top_init_ue(
677
  int eMBMS_active,
678
  char *uecap_xer,
679 680
  uint8_t cba_group_active,
  uint8_t HO_active
Cedric Roux's avatar
Cedric Roux committed
681
);
682 683 684 685 686

extern pthread_mutex_t      rrc_release_freelist;
extern RRC_release_list_t   rrc_release_info;
extern pthread_mutex_t      lock_ue_freelist;

687 688 689
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);
Cedric Roux's avatar
Cedric Roux committed
690

691
/** @}*/