/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see .
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file rlc.h
* \brief This file, and only this file must be included by external code that interact with RLC layer.
* \author GAUTHIER Lionel
* \date 2010-2011
* \version
* \note
* \bug
* \warning
*/
/** @defgroup _rlc_impl_ RLC
* @ingroup _oai2
* @{
*/
#ifndef __RLC_H__
# define __RLC_H__
# include "platform_types.h"
# include "platform_constants.h"
# include "hashtable.h"
# include "rlc_am.h"
# include "rlc_um.h"
# include "rlc_tm.h"
# include "rlc_am_structs.h"
# include "rlc_tm_structs.h"
# include "rlc_um_structs.h"
# include "asn1_constants.h"
# include "UTIL/LOG/log.h"
# include "mem_block.h"
# include "PHY/defs.h"
# include "RLC-Config.h"
# include "DRB-ToAddMod.h"
# include "DRB-ToAddModList.h"
# include "SRB-ToAddMod.h"
# include "SRB-ToAddModList.h"
#ifdef Rel10
#include "PMCH-InfoList-r9.h"
#endif
#ifdef CMAKER
typedef uint64_t hash_key_t;
#define HASHTABLE_NOT_A_KEY_VALUE ((uint64_t)-1)
#endif
//-----------------------------------------------------------------------------
# ifdef RLC_MAC_C
# define private_rlc_mac(x) x
# define public_rlc_mac(x) x
# else
# define private_rlc_mac(x)
# define public_rlc_mac(x) extern x
# endif
# ifdef RLC_MPLS_C
# define private_rlc_mpls(x) x
# define public_rlc_mpls(x) x
# else
# define private_rlc_mpls(x)
# define public_rlc_mpls(x) extern x
# endif
# ifdef RLC_RRC_C
# define private_rlc_rrc(x) x
# define public_rlc_rrc(x) x
# else
# define private_rlc_rrc(x)
# define public_rlc_rrc(x) extern x
# endif
# ifdef RLC_C
# define private_rlc(x) x
# define protected_rlc(x) x
# define public_rlc(x) x
# else
# define private_rlc(x)
# if defined(RLC_MAC_C) || defined(RLC_MPLS_C) || defined(RLC_RRC_C) || defined(RLC_AM_C) || defined(RLC_TM_C) || defined(RLC_UM_C) || defined (PDCP_C)
# define protected_rlc(x) extern x
# else
# define protected_rlc(x)
# endif
# define public_rlc(x) extern x
# endif
//-----------------------------------------------------------------------------
#define RLC_OP_STATUS_OK 1
#define RLC_OP_STATUS_BAD_PARAMETER 22
#define RLC_OP_STATUS_INTERNAL_ERROR 2
#define RLC_OP_STATUS_OUT_OF_RESSOURCES 3
#define RLC_MUI_UNDEFINED (mui_t)0
#define RLC_RB_UNALLOCATED (rb_id_t)0
#define RLC_LC_UNALLOCATED (logical_chan_id_t)0
//-----------------------------------------------------------------------------
// PUBLIC RLC CONSTANTS
//-----------------------------------------------------------------------------
typedef enum rlc_confirm_e {
RLC_SDU_CONFIRM_NO = 0,
RLC_SDU_CONFIRM_YES = 1,
} rlc_confirm_t;
typedef enum rlc_mode_e {
RLC_MODE_NONE = 0,
RLC_MODE_AM = 1,
RLC_MODE_UM = 2,
RLC_MODE_TM = 4
} rlc_mode_t;
/*! \struct rlc_info_t
* \brief Structure containing RLC protocol configuration parameters.
*/
typedef volatile struct {
rlc_mode_t rlc_mode;
union {
rlc_am_info_t rlc_am_info; /*!< \sa rlc_am.h. */
rlc_tm_info_t rlc_tm_info; /*!< \sa rlc_tm.h. */
rlc_um_info_t rlc_um_info; /*!< \sa rlc_um.h. */
} rlc;
} rlc_info_t;
/*! \struct mac_rlc_status_resp_t
* \brief Primitive exchanged between RLC and MAC informing about the buffer occupancy of the RLC protocol instance.
*/
typedef struct {
rlc_buffer_occupancy_t bytes_in_buffer; /*!< \brief Bytes buffered in RLC protocol instance. */
rlc_buffer_occupancy_t pdus_in_buffer; /*!< \brief Number of PDUs buffered in RLC protocol instance (OBSOLETE). */
frame_t head_sdu_creation_time; /*!< \brief Head SDU creation time. */
sdu_size_t head_sdu_remaining_size_to_send; /*!< \brief remaining size of sdu: could be the total size or the remaining size of already segmented sdu */
boolean_t head_sdu_is_segmented; /*!< \brief 0 if head SDU has not been segmented, 1 if already segmented */
} mac_rlc_status_resp_t;
/*! \struct mac_rlc_max_rx_header_size_t
* \brief Usefull only for debug scenario where we connect 2 RLC protocol instances without the help of the MAC .
*/
typedef struct {
union {
struct rlc_am_rx_pdu_management dummy1;
struct rlc_tm_rx_pdu_management dummy2;
//struct rlc_um_rx_pdu_management dummy3;
struct mac_tb_ind dummy4;
struct mac_rx_tb_management dummy5;
} dummy;
} mac_rlc_max_rx_header_size_t;
//-----------------------------------------------------------------------------
// PRIVATE INTERNALS OF RLC
//-----------------------------------------------------------------------------
#define RLC_MAX_MBMS_LC (maxSessionPerPMCH * maxServiceCount)
#define RLC_MAX_LC ((max_val_DRB_Identity+1)* NUMBER_OF_UE_MAX)
protected_rlc(void (*rlc_rrc_data_ind)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
const uint8_t * const sduP);)
protected_rlc(void (*rlc_rrc_data_conf)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const mui_t muiP,
const rlc_tx_status_t statusP);)
typedef void (rrc_data_ind_cb_t)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
const uint8_t * const sduP);
typedef void (rrc_data_conf_cb_t)(
const protocol_ctxt_t* const ctxtP,
const rb_id_t rb_idP,
const mui_t muiP,
const rlc_tx_status_t statusP);
/*! \struct rlc_t
* \brief Structure to be instanciated to allocate memory for RLC protocol instances.
*/
typedef struct rlc_union_s {
rlc_mode_t mode;
union {
rlc_am_entity_t am;
rlc_um_entity_t um;
rlc_tm_entity_t tm;
} rlc;
} rlc_union_t;
typedef struct rlc_mbms_s {
rb_id_t rb_id;
module_id_t instanciated_instance;
rlc_um_entity_t um;
} rlc_mbms_t;
typedef struct rlc_mbms_id_s {
mbms_service_id_t service_id;
mbms_session_id_t session_id;
} rlc_mbms_id_t;
#if !defined(Rel10)
# if !defined(maxServiceCount)
//unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB
# define maxServiceCount 1
# endif
# if !defined(maxSessionPerPMCH)
//unused arrays rlc_mbms_array_ue rlc_mbms_array_eNB
# define maxSessionPerPMCH 1
# endif
#endif
//public_rlc(rlc_mbms_t rlc_mbms_array_ue[NUMBER_OF_UE_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
//public_rlc(rlc_mbms_t rlc_mbms_array_eNB[NUMBER_OF_eNB_MAX][maxServiceCount][maxSessionPerPMCH];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_ue[NUMBER_OF_UE_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
public_rlc(rlc_mbms_id_t rlc_mbms_lcid2service_session_id_eNB[NUMBER_OF_eNB_MAX][RLC_MAX_MBMS_LC];) // some constants from openair2/RRC/LITE/MESSAGES/asn1_constants.h
#define rlc_mbms_enb_get_lcid_by_rb_id(Enb_mOD,rB_iD) rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD]
;
#define rlc_mbms_enb_set_lcid_by_rb_id(Enb_mOD,rB_iD,lOG_cH_iD) do { \
rlc_mbms_rbid2lcid_eNB[Enb_mOD][rB_iD] = lOG_cH_iD; \
} while (0);
#define rlc_mbms_ue_get_lcid_by_rb_id(uE_mOD,rB_iD) rlc_mbms_rbid2lcid_ue[uE_mOD][rB_iD]
#define rlc_mbms_ue_set_lcid_by_rb_id(uE_mOD,rB_iD,lOG_cH_iD) do { \
AssertFatal(rB_iD