A Discrete-Event Network Simulator
API
lte-enb-component-carrier-manager.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Danilo Abrignani
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Danilo Abrignani <danilo.abrignani@unibo.it>
18  *
19  */
20 
22 
23 #include "lte-common.h"
24 
25 #include <ns3/log.h>
26 
27 namespace ns3
28 {
29 
30 NS_LOG_COMPONENT_DEFINE("LteEnbComponentCarrierManager");
31 NS_OBJECT_ENSURE_REGISTERED(LteEnbComponentCarrierManager);
32 
34 {
35 }
36 
38 {
39 }
40 
41 TypeId
43 {
44  static TypeId tid =
45  TypeId("ns3::LteEnbComponentCarrierManager").SetParent<Object>().SetGroupName("Lte");
46  return tid;
47 }
48 
49 void
51 {
52 }
53 
54 void
56 {
57  NS_LOG_FUNCTION(this << s);
58  m_ccmRrcSapUser = s;
59 }
60 
63 {
64  NS_LOG_FUNCTION(this);
65  return m_ccmRrcSapProvider;
66 }
67 
70 {
71  NS_LOG_FUNCTION(this);
72  return m_macSapProvider;
73 }
74 
77 {
78  NS_LOG_FUNCTION(this);
79  return m_ccmMacSapUser;
80 }
81 
82 bool
84 {
85  NS_LOG_FUNCTION(this);
86  bool res = false;
87  auto it = m_macSapProvidersMap.find(componentCarrierId);
88  if ((uint16_t)componentCarrierId > m_noOfComponentCarriers)
89  {
90  NS_FATAL_ERROR("Inconsistent componentCarrierId or you didn't call "
91  "SetNumberOfComponentCarriers before calling this method");
92  }
93  if (it != m_macSapProvidersMap.end())
94  {
95  NS_FATAL_ERROR("Tried to allocated an existing componentCarrierId");
96  }
97  else
98  {
99  m_macSapProvidersMap.insert(
100  std::pair<uint8_t, LteMacSapProvider*>(componentCarrierId, sap));
101  res = true;
102  }
103  return res;
104 }
105 
106 bool
109 {
110  NS_LOG_FUNCTION(this);
111  bool res = false;
112  auto it = m_ccmMacSapProviderMap.find(componentCarrierId);
113 
114  if (it == m_ccmMacSapProviderMap.end())
115  {
116  m_ccmMacSapProviderMap.insert(
117  std::pair<uint8_t, LteCcmMacSapProvider*>(componentCarrierId, sap));
118  }
119 
120  res = true;
121  return res;
122 }
123 
124 void
126 {
127  NS_LOG_FUNCTION(this);
128  NS_ABORT_MSG_IF(noOfComponentCarriers < MIN_NO_CC || noOfComponentCarriers > MAX_NO_CC,
129  "Number of component carriers should be greater than 0 and less than 6");
130  m_noOfComponentCarriers = noOfComponentCarriers;
131  // Set the number of component carriers in eNB RRC
132  m_ccmRrcSapUser->SetNumberOfComponentCarriers(noOfComponentCarriers);
133 }
134 
135 } // end of namespace ns3
Service Access Point (SAP) offered by the component carrier manager (CCM) by MAC to CCM.
Service Access Point (SAP) offered by MAC to the component carrier manager (CCM).
Service Access Point (SAP) offered by the Component Carrier Manager (CCM) instance to the eNodeB RRC ...
Service Access Point (SAP) offered by the eNodeB RRC instance to the component carrier manager (CCM) ...
virtual void SetNumberOfComponentCarriers(uint16_t noOfComponentCarriers)=0
Set the number of component carriers.
virtual LteCcmMacSapUser * GetLteCcmMacSapUser()
This function returns a pointer to the LteCcmMacSapUser interface, which is used by MAC to communicat...
LteCcmRrcSapProvider * m_ccmRrcSapProvider
A pointer to the SAP interface of the CCM instance to receive API calls from the eNodeB RRC instance.
virtual LteMacSapProvider * GetLteMacSapProvider()
Returns the pointer to the LteMacSapProvider interface, the provider of MAC, which is this new archit...
LteMacSapProvider * m_macSapProvider
A pointer to main SAP interface of the MAC instance, which is in this case handled by CCM.
std::map< uint8_t, LteMacSapProvider * > m_macSapProvidersMap
A map of pointers to real SAP interfaces of MAC instances.
virtual LteCcmRrcSapProvider * GetLteCcmRrcSapProvider()
Export the "provider" part of the ComponentCarrier Management SAP interface.
virtual bool SetMacSapProvider(uint8_t componentCarrierId, LteMacSapProvider *sap)
Set LteMacSapProvider interface for the MAC object of the specified component carrier.
virtual void SetNumberOfComponentCarriers(uint16_t noOfComponentCarriers)
Sets the total number of component carriers.
void DoDispose() override
Destructor implementation.
uint16_t m_noOfComponentCarriers
The number component of carriers that are supported by this eNb.
std::map< uint8_t, LteCcmMacSapProvider * > m_ccmMacSapProviderMap
A map of pointers to the SAP interfaces of CCM instance that provides the CCM specific functionalitie...
virtual bool SetCcmMacSapProviders(uint8_t componentCarrierId, LteCcmMacSapProvider *sap)
Set LteCcmMacSapProvider interface for the MAC object of the specified component carrier.
virtual void SetLteCcmRrcSapUser(LteCcmRrcSapUser *s)
Set the "user" part of the ComponentCarrier Management SAP interface that this ComponentCarrier algor...
LteCcmMacSapUser * m_ccmMacSapUser
LteCcmMacSapUser is extended version of LteMacSapUser interface.
LteCcmRrcSapUser * m_ccmRrcSapUser
A pointer to SAP interface of RRC instance, i.e.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
A base class which provides memory management and object aggregation.
Definition: object.h:89
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:931
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Every class exported by the ns3 library is enclosed in the ns3 namespace.
constexpr uint32_t MAX_NO_CC
Maximum number of carrier components allowed by 3GPP up to R13.
Definition: lte-common.h:39