A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 {
48 
49 public:
50  static TypeId GetTypeId (void);
51 
52  LteUeMac ();
53  virtual ~LteUeMac ();
54  virtual void DoDispose (void);
55 
59 
65 
71 
78  void DoSubframeIndication (uint32_t frameNo, uint32_t subframeNo);
79 
88  int64_t AssignStreams (int64_t stream);
89 
90 private:
91  // forwarded from MAC SAP
94 
95  // forwarded from UE CMAC SAP
98  void DoStartNonContentionBasedRandomAccessProcedure (uint16_t rnti, uint8_t rapId, uint8_t prachMask);
99  void DoAddLc (uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser* msu);
100  void DoRemoveLc (uint8_t lcId);
101  void DoReset ();
102 
103  // forwarded from PHY SAP
104  void DoReceivePhyPdu (Ptr<Packet> p);
106 
107  // internal methods
109  void SendRaPreamble (bool contention);
111  void RecvRaResponse (BuildRarListElement_s raResponse);
112  void RaResponseTimeout (bool contention);
113  void SendReportBufferStatus (void);
115 
116 private:
117 
118  struct LcInfo
119  {
122  };
123 
124  std::map <uint8_t, LcInfo> m_lcInfoMap;
125 
127 
130 
133 
134  std::map <uint8_t, LteMacSapProvider::ReportBufferStatusParameters> m_ulBsrReceived; // BSR received from RLC (the last one)
135 
136 
139 
140  bool m_freshUlBsr; // true when a BSR has been received in the last TTI
141 
143  std::vector < Ptr<PacketBurst> > m_miUlHarqProcessesPacket; // Packets under trasmission of the UL HARQ processes
144  std::vector < uint8_t > m_miUlHarqProcessesPacketTimer; // timer for packet life in the buffer
145 
146  uint16_t m_rnti;
147 
150  uint8_t m_raPreambleId;
155 
156  uint32_t m_frameNo;
157  uint32_t m_subframeNo;
158  uint8_t m_raRnti;
160 };
161 
162 } // namespace ns3
163 
164 #endif // LTE_UE_MAC_ENTITY
void DoStartNonContentionBasedRandomAccessProcedure(uint16_t rnti, uint8_t rapId, uint8_t prachMask)
Definition: lte-ue-mac.cc:482
LteUeCmacSapProvider::LogicalChannelConfig lcConfig
Definition: lte-ue-mac.h:120
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
void DoReset()
Definition: lte-ue-mac.cc:513
uint8_t m_raPreambleId
Definition: lte-ue-mac.h:150
void SendRaPreamble(bool contention)
Definition: lte-ue-mac.cc:376
void StartWaitingForRaResponse()
Definition: lte-ue-mac.cc:398
void DoReceivePhyPdu(Ptr< Packet > p)
Definition: lte-ue-mac.cc:536
Ptr< UniformRandomVariable > m_raPreambleUniformVariable
Definition: lte-ue-mac.h:154
LteUePhySapUser * m_uePhySapUser
Definition: lte-ue-mac.h:132
void RaResponseTimeout(bool contention)
Definition: lte-ue-mac.cc:436
See section 4.3.10 buildRARListElement.
void DoAddLc(uint8_t lcId, LteUeCmacSapProvider::LogicalChannelConfig lcConfig, LteMacSapUser *msu)
Definition: lte-ue-mac.cc:493
void SetLteUePhySapProvider(LteUePhySapProvider *s)
Set the PHY SAP Provider.
Definition: lte-ue-mac.cc:253
LteMacSapUser * macSapUser
Definition: lte-ue-mac.h:121
Service Access Point (SAP) offered by the PHY to the MAC.
void DoStartContentionBasedRandomAccessProcedure()
Definition: lte-ue-mac.cc:470
void SendReportBufferStatus(void)
Definition: lte-ue-mac.cc:314
virtual ~LteUeMac()
Definition: lte-ue-mac.cc:229
void DoRemoveLc(uint8_t lcId)
Definition: lte-ue-mac.cc:505
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:66
std::vector< uint8_t > m_miUlHarqProcessesPacketTimer
Definition: lte-ue-mac.h:144
void SetLteUeCmacSapUser(LteUeCmacSapUser *s)
Definition: lte-ue-mac.cc:266
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Definition: lte-ue-mac.cc:279
uint8_t m_harqProcessId
Definition: lte-ue-mac.h:142
uint32_t m_frameNo
Definition: lte-ue-mac.h:156
bool m_waitingForRaResponse
Definition: lte-ue-mac.h:159
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Definition: lte-ue-mac.cc:292
Ptr< SampleEmitter > s
uint16_t m_rnti
Definition: lte-ue-mac.h:146
LteUeCmacSapProvider * m_cmacSapProvider
Definition: lte-ue-mac.h:129
uint8_t m_raRnti
Definition: lte-ue-mac.h:158
std::vector< Ptr< PacketBurst > > m_miUlHarqProcessesPacket
Definition: lte-ue-mac.h:143
LteUeCmacSapProvider * GetLteUeCmacSapProvider(void)
Definition: lte-ue-mac.cc:272
Service Access Point (SAP) offered by the UE MAC to the UE RRC.
void DoConfigureRach(LteUeCmacSapProvider::RachConfig rc)
Definition: lte-ue-mac.cc:462
void DoSubframeIndication(uint32_t frameNo, uint32_t subframeNo)
Forwarded from LteUePhySapUser: trigger the start from a new frame.
Definition: lte-ue-mac.cc:766
void DoReceiveLteControlMessage(Ptr< LteControlMessage > msg)
Definition: lte-ue-mac.cc:551
std::map< uint8_t, LcInfo > m_lcInfoMap
Definition: lte-ue-mac.h:124
LteUePhySapUser * GetLteUePhySapUser()
Get the PHY SAP user.
Definition: lte-ue-mac.cc:247
LteMacSapProvider * GetLteMacSapProvider(void)
Definition: lte-ue-mac.cc:260
uint16_t m_backoffParameter
Definition: lte-ue-mac.h:152
static TypeId GetTypeId(void)
Definition: lte-ue-mac.cc:194
LteMacSapProvider * m_macSapProvider
Definition: lte-ue-mac.h:126
Service Access Point (SAP) offered by the UE MAC to the UE RRC.
LteUePhySapProvider * m_uePhySapProvider
Definition: lte-ue-mac.h:131
bool m_freshUlBsr
Definition: lte-ue-mac.h:140
void RandomlySelectAndSendRaPreamble()
Definition: lte-ue-mac.cc:364
void RecvRaResponse(BuildRarListElement_s raResponse)
Definition: lte-ue-mac.cc:405
uint8_t m_preambleTransmissionCounter
Definition: lte-ue-mac.h:151
an identifier for simulation events.
Definition: event-id.h:46
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:94
EventId m_noRaResponseReceivedEvent
Definition: lte-ue-mac.h:153
bool m_rachConfigured
Definition: lte-ue-mac.h:148
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
Definition: lte-ue-mac.cc:235
LteUeCmacSapProvider::RachConfig m_rachConfig
Definition: lte-ue-mac.h:149
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
Time m_bsrPeriodicity
Definition: lte-ue-mac.h:137
uint32_t m_subframeNo
Definition: lte-ue-mac.h:157
std::map< uint8_t, LteMacSapProvider::ReportBufferStatusParameters > m_ulBsrReceived
Definition: lte-ue-mac.h:134
a base class which provides memory management and object aggregation
Definition: object.h:64
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:782
a unique identifier for an interface.
Definition: type-id.h:49
void RefreshHarqProcessesPacketBuffer(void)
Definition: lte-ue-mac.cc:741
LteUeCmacSapUser * m_cmacSapUser
Definition: lte-ue-mac.h:128
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:45