/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2011, 2012 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
* Copyright (c) 2015, Danilo Abrignani
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Nicola Baldo <
[email protected]>
* Marco Miozzo <
[email protected]>
* Manuel Requena <
[email protected]>
* Danilo Abrignani <
[email protected]> (Carrier Aggregation - GSoC 2015)
*/
#ifndef LTE_ENB_RRC_H
#define LTE_ENB_RRC_H
#include <ns3/nstime.h>
#include <ns3/object.h>
#include <ns3/traced-callback.h>
#include <ns3/event-id.h>
#include <ns3/lte-enb-cmac-sap.h>
#include <ns3/lte-mac-sap.h>
#include <ns3/ff-mac-sched-sap.h>
#include <ns3/ff-mac-csched-sap.h>
#include <ns3/lte-pdcp-sap.h>
#include <ns3/epc-x2-sap.h>
#include <ns3/epc-enb-s1-sap.h>
#include <ns3/lte-handover-management-sap.h>
#include <ns3/lte-ccm-rrc-sap.h>
#include <ns3/lte-enb-cphy-sap.h>
#include <ns3/lte-rrc-sap.h>
#include <ns3/lte-anr-sap.h>
#include <ns3/lte-ffr-rrc-sap.h>
#include <map>
#include <set>
#include <ns3/component-carrier-enb.h>
#include <vector>
namespace ns3 {
class LteRadioBearerInfo;
class LteSignalingRadioBearerInfo;
class LteDataRadioBearerInfo;
class LteEnbRrc;
class Packet;
/**
* \ingroup lte
* Manages all the radio bearer information possessed by the ENB RRC for a
* single UE.
*/
class UeManager : public Object
{
friend class LtePdcpSpecificLtePdcpSapUser<UeManager>;
public:
/**
* The state of the UeManager at the eNB RRC
*
*/
enum State
{
INITIAL_RANDOM_ACCESS = 0,
CONNECTION_SETUP,
CONNECTION_REJECTED,
CONNECTED_NORMALLY,
CONNECTION_RECONFIGURATION,
CONNECTION_REESTABLISHMENT,
HANDOVER_PREPARATION,
HANDOVER_JOINING,
HANDOVER_PATH_SWITCH,
HANDOVER_LEAVING,
NUM_STATES
};
UeManager ();
/**
* UeManager constructor
*
* \param rrc pointer to the LteEnbRrc holding this UeManager
* \param rnti RNTI of the UE
* \param s initial state of the UeManager
*
* \return
*/
UeManager (Ptr<LteEnbRrc> rrc, uint16_t rnti, State s);
virtual ~UeManager (void);
// inherited from Object
protected:
virtual void DoInitialize ();
virtual void DoDispose ();
public:
static TypeId GetTypeId (void);
/**
* Set the identifiers of the source eNB for the case where a UE
* joins the current eNB as part of a handover procedure
*
* \param sourceCellId
* \param sourceX2apId
*/
void SetSource (uint16_t sourceCellId, uint16_t sourceX2apId);
/**
* Set the IMSI
*
* \param imsi the IMSI
*/
void SetImsi (uint64_t imsi);
/**
* Setup a new data radio bearer, including both the configuration
* within the eNB and the necessary RRC signaling with the UE
*
* \param bearer the QoS characteristics of the bearer
* \param bearerId the EPS bearer identifier
* \param gtpTeid S1-bearer GTP tunnel endpoint identifier, see 36.423 9.2.1
* \param transportLayerAddress IP Address of the SGW, see 36.423 9.2.1
*
*/
void SetupDataRadioBearer (EpsBearer bearer, uint8_t bearerId, uint32_t gtpTeid, Ipv4Address transportLayerAddress);
/**
* Start all configured data radio bearers. It is safe to call this
* method if any bearer had been already started previously.
*
*/
void RecordDataRadioBearersToBeStarted ();
/**
* Start the data radio bearers that have been previously recorded
* to be started using RecordDataRadioBearersToBeStarted()
*
*/
void StartDataRadioBearers ();
/**
*
* Release a given radio bearer
*
* \param drbid the data radio bearer id of the bearer to be released
*/
void ReleaseDataRadioBearer (uint8_t drbid);
/**
* schedule an RRC Connection Reconfiguration procedure with the UE
*
*/
void ScheduleRrcConnectionReconfiguration ();
/**
* Start the handover preparation and send the handover request
*
* \param cellId id of the target cell
*/
void PrepareHandover (uint16_t cellId);
/**
* take the necessary actions in response to the reception of an X2 HANDOVER REQUEST ACK message
*
* \param params
*/
void RecvHandoverRequestAck (EpcX2SapUser::HandoverRequestAckParams params);
/**
*
* \return the HandoverPreparationInfo sent by the source eNB to the
* target eNB in the X2-based handover procedure
*/
LteRrcSap::RadioResourceConfigDedicated GetRadioResourceConfigForHandoverPreparationInfo ();
/**
*
* \return retrieve the data that the target eNB needs to send to the source
* eNB as the Handover Command in the X2-based handover
* procedure.
*
* \note mobility control info is not expected to be filled in
* (shall be filled in by the caller).
*/
LteRrcSap::RrcConnectionReconfiguration GetRrcConnectionReconfigurationForHandover ();
/**
* Send a data packet over the appropriate Data Radio Bearer
*
* \param bid the corresponding EPS Bearer ID
* \param p the packet
*/
void SendData (uint8_t bid, Ptr<Packet> p);
/**
*
* \return a list of ERAB-to-be-setup items to be put in a X2 HO REQ message
*/
std::vector<EpcX2Sap::ErabToBeSetupItem> GetErabList ();
/**
* send the UE CONTEXT RELEASE X2 message to the source eNB, thus
* successfully terminating an X2 handover procedure
*
*/
void SendUeContextRelease ();
/**
* Take the necessary actions in response to the reception of an X2 HO preparation failure message
*
* \param cellId id of the target cell
*/
void RecvHandoverPreparationFailure (uint16_t cellId);
/**
* Take the necessary actions in response to the reception of an X2 SN STATUS TRANSFER message
*
* \param params the SN STATUS
*/
void RecvSnStatusTransfer (EpcX2SapUser::SnStatusTransferParams params);
/**
* Take the necessary actions in response to the reception of an X2 UE CONTEXT RELEASE message
*
* \param params the SN STATUS
*/
void RecvUeContextRelease (EpcX2SapUser::UeContextReleaseParams params);
// METHODS FORWARDED FROM ENB RRC SAP ///////////////////////////////////////
/// Part of the RRC protocol. Implement the LteEnbRrcSapProvider::CompleteSetupUe interface.
void CompleteSetupUe (LteEnbRrcSapProvider::CompleteSetupUeParameters params);
/// Part of the RRC protocol. Implement the LteEnbRrcSapProvider::RecvRrcConnectionRequest interface.
void RecvRrcConnectionRequest (LteRrcSap::RrcConnectionRequest msg);
/// Part of the RRC protocol. Implement the LteEnbRrcSapProvider::RecvRrcConnectionSetupCompleted interface.
void RecvRrcConnectionSetupCompleted (LteRrcSap::RrcConnectionSetupCompleted msg);
/// Part of the RRC protocol. Implement the LteEnbRrcSapProvider::RecvRrcConnectionReconfigurationCompleted interface.
void RecvRrcConnectionReconfigurationCompleted (LteRrcSap::RrcConnectionReconfigurationCompleted msg);
/// Part of the RRC protocol. Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentRequest interface.
void RecvRrcConnectionReestablishmentRequest (LteRrcSap::RrcConnectionReestablishmentRequest msg);
/// Part of the RRC protocol. Implement the LteEnbRrcSapProvider::RecvRrcConnectionReestablishmentComplete interface.
void RecvRrcConnectionReestablishmentComplete (LteRrcSap::RrcConnectionRee
评论0