A Discrete-Event Network Simulator
API
lte-ue-mac.h
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Nicola Baldo <nbaldo@cttc.es>
19  * Author: Marco Miozzo <mmiozzo@cttc.es>
20  */
21 
22 #ifndef LTE_UE_MAC_ENTITY_H
23 #define LTE_UE_MAC_ENTITY_H
24 
25 
26 
27 #include <map>
28 
29 #include <ns3/lte-mac-sap.h>
30 #include <ns3/lte-ue-cmac-sap.h>
31 #include <ns3/lte-ue-phy-sap.h>
32 #include <ns3/nstime.h>
33 #include <ns3/event-id.h>
34 #include <vector>
35 #include <ns3/packet.h>
36 #include <ns3/packet-burst.h>
37 
38 
39 namespace ns3 {
40 
41 class UniformRandomVariable;
42 
43 class LteUeMac : public Object
44 {
51 
52 public:
57  static TypeId GetTypeId (void);
58 
59  LteUeMac ();
60  virtual ~LteUeMac ();
61  virtual void DoDispose (void);
62 
78 
83  void SetComponentCarrierId (uint8_t index);
84 
90 
96 
103  void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
104 
113  int64_t AssignStreams (int64_t stream);
114 
115 private:
116  // forwarded from MAC SAP
129 
130  // forwarded from UE CMAC SAP
146  void DoSetRnti (uint16_t rnti);
154  void DoStartNonContentionBasedRandomAccessProcedure (uint16_t rnti, uint8_t rapId, uint8_t prachMask);
162  void DoAddLc (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu);
168  void DoRemoveLc (uint8_t lcId);
170  void DoReset ();
171 
172  // forwarded from PHY SAP
178  void DoReceivePhyPdu (Ptr<Packet> p);
185 
186  // internal methods
194  void SendRaPreamble (bool contention);
202  void RecvRaResponse (BuildRarListElement_s raResponse);
208  void RaResponseTimeout (bool contention);
210  void SendReportBufferStatus (void);
213 
216 
217 private:
218 
220  struct LcInfo
221  {
224  };
225 
226  std::map <uint8_t, LcInfo> m_lcInfoMap;
227 
229 
232 
235 
236  std::map <uint8_t, LteMacSapProvider::ReportBufferStatusParameters> m_ulBsrReceived;
237 
238 
241 
243 
244  uint8_t m_harqProcessId;
245  std::vector < Ptr<PacketBurst> > m_miUlHarqProcessesPacket;
246  std::vector < uint8_t > m_miUlHarqProcessesPacketTimer;
247 
248  uint16_t m_rnti;
249 
252  uint8_t m_raPreambleId;
257 
258  uint32_t m_frameNo;
259  uint32_t m_subframeNo;
260  uint8_t m_raRnti;
262 };
263 
264 } // namespace ns3
265 
266 #endif // LTE_UE_MAC_ENTITY
void DoStartNonContentionBasedRandomAccessProcedure(uint16_t rnti, uint8_t rapId, uint8_t prachMask)
Start non contention based random access procedure function.
Definition: lte-ue-mac.cc:526
LteUeCmacSapProvider::LogicalChannelConfig lcConfig
logical channel config
Definition: lte-ue-mac.h:222
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
void DoReset()
Reset function.
Definition: lte-ue-mac.cc:557
uint8_t m_raPreambleId
RA preamble ID.
Definition: lte-ue-mac.h:252
void SendRaPreamble(bool contention)
Send RA preamble function.
Definition: lte-ue-mac.cc:407
void StartWaitingForRaResponse()
Start waiting for RA response function.
Definition: lte-ue-mac.cc:429
void DoReceivePhyPdu(Ptr< Packet > p)
Receive Phy PDU function.
Definition: lte-ue-mac.cc:582
Ptr< UniformRandomVariable > m_raPreambleUniformVariable
RA preamble random variable.
Definition: lte-ue-mac.h:256
LteUePhySapUser * m_uePhySapUser
UE Phy SAP user.
Definition: lte-ue-mac.h:234
void DoSetRnti(uint16_t rnti)
Set RNTI.
Definition: lte-ue-mac.cc:518
UeMemberLteMacSapProvider class.
Definition: lte-ue-mac.cc:124
void RaResponseTimeout(bool contention)
RA response timeout function.
Definition: lte-ue-mac.cc:472
See section 4.3.10 buildRARListElement.
void DoAddLc(uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser *msu)
Add LC function.
Definition: lte-ue-mac.cc:537
void SetLteUePhySapProvider(LteUePhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-ue-mac.cc:279
LteMacSapUser * macSapUser
MAC SAP user.
Definition: lte-ue-mac.h:223
Service Access Point (SAP) offered by the PHY to the MAC.
UeMemberLteUeCmacSapProvider class.
Definition: lte-ue-mac.cc:52
void DoStartContentionBasedRandomAccessProcedure()
Start contention based random access procedure function.
Definition: lte-ue-mac.cc:506
void SendReportBufferStatus(void)
Send report buffer status.
Definition: lte-ue-mac.cc:345
virtual ~LteUeMac()
Definition: lte-ue-mac.cc:255
void DoRemoveLc(uint8_t lcId)
Remove LC function.
Definition: lte-ue-mac.cc:549
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:67
std::vector< uint8_t > m_miUlHarqProcessesPacketTimer
timer for packet life in the buffer
Definition: lte-ue-mac.h:246
void SetLteUeCmacSapUser(LteUeCmacSapUser *s)
Set the LTE UE CMAC SAP user.
Definition: lte-ue-mac.cc:292
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU function.
Definition: lte-ue-mac.cc:310
uint8_t m_harqProcessId
HARQ process ID.
Definition: lte-ue-mac.h:244
uint32_t m_frameNo
frame number
Definition: lte-ue-mac.h:258
bool m_waitingForRaResponse
waiting for RA response
Definition: lte-ue-mac.h:261
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report buffers status function.
Definition: lte-ue-mac.cc:323
uint16_t m_rnti
RNTI.
Definition: lte-ue-mac.h:248
LteUeCmacSapProvider * m_cmacSapProvider
CMAC SAP provider.
Definition: lte-ue-mac.h:231
uint8_t m_raRnti
RA RNTI.
Definition: lte-ue-mac.h:260
std::vector< Ptr< PacketBurst > > m_miUlHarqProcessesPacket
Packets under transmission of the UL HARQ processes.
Definition: lte-ue-mac.h:245
LteUeCmacSapProvider * GetLteUeCmacSapProvider(void)
Get the LTE CMAC SAP provider.
Definition: lte-ue-mac.cc:298
Service Access Point (SAP) offered by the UE MAC to the UE RRC.
void SetComponentCarrierId(uint8_t index)
Set the component carried ID.
Definition: lte-ue-mac.cc:304
void DoConfigureRach(LteUeCmacSapProvider::RachConfig rc)
Configure RACH function.
Definition: lte-ue-mac.cc:498
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Forwarded from LteUePhySapUser: trigger the start from a new frame.
Definition: lte-ue-mac.cc:818
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Receive LTE control message function.
Definition: lte-ue-mac.cc:603
std::map< uint8_t, LcInfo > m_lcInfoMap
logical channel info map
Definition: lte-ue-mac.h:226
LteUePhySapUser * GetLteUePhySapUser()
Get the PHY SAP user.
Definition: lte-ue-mac.cc:273
Every class exported by the ns3 library is enclosed in the ns3 namespace.
LteMacSapProvider * GetLteMacSapProvider(void)
Get the LTE MAC SAP provider.
Definition: lte-ue-mac.cc:286
uint16_t m_backoffParameter
backoff parameter
Definition: lte-ue-mac.h:254
static TypeId GetTypeId(void)
Get the type ID.
Definition: lte-ue-mac.cc:218
LteMacSapProvider * m_macSapProvider
MAC SAP provider.
Definition: lte-ue-mac.h:228
Service Access Point (SAP) offered by the UE MAC to the UE RRC.
LteUePhySapProvider * m_uePhySapProvider
UE Phy SAP provider.
Definition: lte-ue-mac.h:233
uint8_t m_componentCarrierId
component carrier Id –> used to address sap
Definition: lte-ue-mac.h:215
Time m_bsrLast
BSR last.
Definition: lte-ue-mac.h:240
bool m_freshUlBsr
true when a BSR has been received in the last TTI
Definition: lte-ue-mac.h:242
void RandomlySelectAndSendRaPreamble()
Randomly sleect and send RA preamble function.
Definition: lte-ue-mac.cc:395
void RecvRaResponse(BuildRarListElement_s raResponse)
Receive the RA response function.
Definition: lte-ue-mac.cc:436
uint8_t m_preambleTransmissionCounter
preamble tranamission counter
Definition: lte-ue-mac.h:253
An identifier for simulation events.
Definition: event-id.h:53
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:95
EventId m_noRaResponseReceivedEvent
no RA response received event ID
Definition: lte-ue-mac.h:255
bool m_rachConfigured
is RACH configured?
Definition: lte-ue-mac.h:250
virtual void DoDispose(void)
Destructor implementation.
Definition: lte-ue-mac.cc:261
LteUeCmacSapProvider::RachConfig m_rachConfig
RACH configuration.
Definition: lte-ue-mac.h:251
Service Access Point (SAP) offered by the UE-PHY to the UE-MAC.
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:36
LcInfo structure.
Definition: lte-ue-mac.h:220
Time m_bsrPeriodicity
BSR periodicity.
Definition: lte-ue-mac.h:239
UeMemberLteUePhySapUser.
Definition: lte-ue-mac.cc:166
uint32_t m_subframeNo
subframe number
Definition: lte-ue-mac.h:259
std::map< uint8_t, LteMacSapProvider::ReportBufferStatusParameters > m_ulBsrReceived
BSR received from RLC (the last one)
Definition: lte-ue-mac.h:236
A base class which provides memory management and object aggregation.
Definition: object.h:87
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
Definition: lte-ue-mac.cc:835
a unique identifier for an interface.
Definition: type-id.h:58
void RefreshHarqProcessesPacketBuffer(void)
Refresh HARQ processes packet buffer function.
Definition: lte-ue-mac.cc:793
LteUeCmacSapUser * m_cmacSapUser
CMAC SAP user.
Definition: lte-ue-mac.h:230
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45