A Discrete-Event Network Simulator
API
lte-test-entities.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: Manuel Requena <manuel.requena@cttc.es>
19  */
20 
21 #ifndef LTE_TEST_ENTITIES_H
22 #define LTE_TEST_ENTITIES_H
23 
24 #include "ns3/simulator.h"
25 #include "ns3/test.h"
26 
27 #include "ns3/lte-mac-sap.h"
28 #include "ns3/lte-rlc-sap.h"
29 #include "ns3/lte-pdcp-sap.h"
30 
31 #include "ns3/net-device.h"
32 #include <ns3/epc-enb-s1-sap.h>
33 
34 namespace ns3 {
35 
42 class LteTestRrc : public Object
43 {
46 // friend class EnbMacMemberLteEnbCmacSapProvider;
47 // friend class EnbMacMemberLteMacSapProvider<LteTestMac>;
48 // friend class EnbMacMemberFfMacSchedSapUser;
49 // friend class EnbMacMemberFfMacCschedSapUser;
50 // friend class EnbMacMemberLteEnbPhySapUser;
51 
52  public:
57  static TypeId GetTypeId (void);
58 
59  LteTestRrc (void);
60  virtual ~LteTestRrc (void);
61  virtual void DoDispose (void);
62 
63 
74 
76  void Start ();
78  void Stop ();
79 
85  void SendData (Time at, std::string dataToSend);
90  std::string GetDataReceived (void);
91 
92  // Stats
97  uint32_t GetTxPdus (void);
102  uint32_t GetTxBytes (void);
107  uint32_t GetRxPdus (void);
112  uint32_t GetRxBytes (void);
113 
118  Time GetTxLastTime (void);
123  Time GetRxLastTime (void);
124 
129  void SetArrivalTime (Time arrivalTime);
134  void SetPduSize (uint32_t pduSize);
135 
140  void SetDevice (Ptr<NetDevice> device);
141 
142  private:
148 
151 
152  std::string m_receivedData;
153 
154  uint32_t m_txPdus;
155  uint32_t m_txBytes;
156  uint32_t m_rxPdus;
157  uint32_t m_rxBytes;
160 
163  uint32_t m_pduSize;
164 
166 };
167 
169 
176 class LteTestPdcp : public Object
177 {
180 
181  public:
186  static TypeId GetTypeId (void);
187 
188  LteTestPdcp (void);
189  virtual ~LteTestPdcp (void);
190  virtual void DoDispose (void);
191 
192 
203 
205  void Start ();
206 
212  void SendData (Time time, std::string dataToSend);
217  std::string GetDataReceived (void);
218 
219  private:
224  virtual void DoReceivePdcpPdu (Ptr<Packet> p);
225 
228 
229  std::string m_receivedData;
230 };
231 
233 
240 class LteTestMac : public Object
241 {
242 // friend class EnbMacMemberLteEnbCmacSapProvider;
245 // friend class EnbMacMemberFfMacSchedSapUser;
246 // friend class EnbMacMemberFfMacCschedSapUser;
247 // friend class EnbMacMemberLteEnbPhySapUser;
248 
249  public:
254  static TypeId GetTypeId (void);
255 
256  LteTestMac (void);
257  virtual ~LteTestMac (void);
258  virtual void DoDispose (void);
259 
264  void SetDevice (Ptr<NetDevice> device);
265 
271  void SendTxOpportunity (Time time, uint32_t bytes);
276  std::string GetDataReceived (void);
277 
286  bool Receive (Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr);
287 
298 
304 
309  void SetPdcpHeaderPresent (bool present);
310 
315  void SetRlcHeaderType (uint8_t rlcHeaderType);
316 
318  typedef enum {
321  } RlcHeaderType_t;
322 
327  void SetTxOpportunityMode (uint8_t mode);
328 
330  typedef enum {
333  RANDOM_MODE = 2
335 
340  void SetTxOppTime (Time txOppTime);
345  void SetTxOppSize (uint32_t txOppSize);
346 
347  // Stats
352  uint32_t GetTxPdus (void);
357  uint32_t GetTxBytes (void);
362  uint32_t GetRxPdus (void);
367  uint32_t GetRxBytes (void);
368 
369  private:
370  // forwarded from LteMacSapProvider
381 
385 
386  std::string m_receivedData;
387 
388  uint8_t m_rlcHeaderType;
391 
393 
394  // TxOpportunity configuration
397  uint32_t m_txOppSize;
398  std::list<EventId> m_nextTxOppList;
399 
400  // Stats
401  uint32_t m_txPdus;
402  uint32_t m_txBytes;
403  uint32_t m_rxPdus;
404  uint32_t m_rxBytes;
405 
406 };
407 
408 
409 
416 class EpcTestRrc : public Object
417 {
419  friend class MemberEpcEnbS1SapUser<EpcTestRrc>;
420 
421 public:
422  EpcTestRrc ();
423  virtual ~EpcTestRrc ();
424 
425  // inherited from Object
426  virtual void DoDispose (void);
431  static TypeId GetTypeId (void);
432 
439 
445 
446 private:
447 
448  // S1 SAP methods
464 
467 
468 
469 };
470 
471 
472 } // namespace ns3
473 
474 #endif /* LTE_TEST_MAC_H */
a polymophic address class
Definition: address.h:91
EnbMacMemberLteMacSapProvider class.
Definition: lte-mac-sap.h:191
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
This class implements the Service Access Point (SAP) between the LteEnbRrc and the EpcEnbApplication.
RRC stub providing a testing S1 SAP user to be used with the EpcEnbApplication.
EpcEnbS1SapUser * m_s1SapUser
S1 SAP user.
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
void SetS1SapProvider(EpcEnbS1SapProvider *s)
Set the S1 SAP Provider.
void DoPathSwitchRequestAcknowledge(EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters params)
Path switch request acknowledge function.
EpcEnbS1SapProvider * m_s1SapProvider
S1 SAP provider.
EpcEnbS1SapUser * GetS1SapUser()
void DoInitialContextSetupRequest(EpcEnbS1SapUser::InitialContextSetupRequestParameters params)
Initial context setup request.
void DoDataRadioBearerSetupRequest(EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params)
Data radio bearer setup request.
An identifier for simulation events.
Definition: event-id.h:54
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:37
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition: lte-mac-sap.h:96
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
Definition: lte-pdcp-sap.h:36
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
Definition: lte-pdcp-sap.h:70
LtePdcpSpecificLtePdcpSapUser class.
Definition: lte-pdcp-sap.h:134
Service Access Point (SAP) offered by the UM-RLC and AM-RLC entities to the PDCP entity See 3GPP 36....
Definition: lte-rlc-sap.h:36
Service Access Point (SAP) offered by the UM-RLC and AM-RLC entities to the PDCP entity See 3GPP 36....
Definition: lte-rlc-sap.h:68
LteRlcSpecificLteRlcSapUser class.
Definition: lte-rlc-sap.h:125
This class implements a testing loopback MAC layer.
TxOpportunityMode_t
Transmit opportunity mode enumeration.
uint32_t GetTxPdus(void)
Get the transmit PDUs.
void SendTxOpportunity(Time time, uint32_t bytes)
Send transmit opportunity function.
RlcHeaderType_t
RCL Header Type enumeration.
uint8_t m_txOpportunityMode
transmit opportunity mode
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
virtual void DoDispose(void)
Destructor implementation.
uint32_t GetRxBytes(void)
Get the receive bytes.
uint32_t m_txOppSize
transmit opportunity size
void SetPdcpHeaderPresent(bool present)
Set PDCP header present function.
uint32_t m_rxBytes
the number of receive bytes
void SetLteMacLoopback(Ptr< LteTestMac > s)
Set the other side of the MAC Loopback.
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters params)
Transmit PDU.
void SetTxOppSize(uint32_t txOppSize)
Set transmit opportunity time.
void DoReportBufferStatus(LteMacSapProvider::ReportBufferStatusParameters params)
Report buffer status function.
std::list< EventId > m_nextTxOppList
next transmit opportunity list
Time m_txOppTime
transmit opportunity time
static TypeId GetTypeId(void)
Get the type ID.
std::string m_receivedData
the received data string
EventId m_nextTxOpp
next transmit opportunity event
bool m_pdcpHeaderPresent
PDCP header present?
uint32_t GetRxPdus(void)
Get the receive PDUs.
LteMacSapUser * m_macSapUser
MAC SAP user.
bool Receive(Ptr< NetDevice > nd, Ptr< const Packet > p, uint16_t protocol, const Address &addr)
the Receive function
void SetDevice(Ptr< NetDevice > device)
Set the device function.
LteMacSapProvider * GetLteMacSapProvider(void)
Get the MAC SAP provider.
void SetRlcHeaderType(uint8_t rlcHeaderType)
Set RLC header type.
uint8_t m_rlcHeaderType
RLC header type.
uint32_t m_rxPdus
the number of receive PDUs
std::string GetDataReceived(void)
Get data received function.
void SetTxOppTime(Time txOppTime)
Set transmit opportunity time.
uint32_t GetTxBytes(void)
Get the transmit bytes.
LteMacSapProvider * m_macSapProvider
MAC SAP provider.
uint32_t m_txPdus
the number of transmit PDUs
void SetTxOpportunityMode(uint8_t mode)
Set transmit opportunity mode.
virtual ~LteTestMac(void)
Ptr< LteTestMac > m_macLoopback
MAC loopback.
uint32_t m_txBytes
the number of transmit bytes
Ptr< NetDevice > m_device
the device
This class implements a testing PDCP entity.
LteRlcSapProvider * m_rlcSapProvider
RLC SAP provider.
LteRlcSapUser * GetLteRlcSapUser(void)
Get the RLC SAP user.
virtual ~LteTestPdcp(void)
void SetLteRlcSapProvider(LteRlcSapProvider *s)
Set the RLC SAP provider.
virtual void DoReceivePdcpPdu(Ptr< Packet > p)
Interface forwarded by LteRlcSapUser.
LteRlcSapUser * m_rlcSapUser
RLC SAP user.
void Start()
Start function.
virtual void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
std::string GetDataReceived(void)
Get data received function.
void SendData(Time time, std::string dataToSend)
Send data function.
std::string m_receivedData
the received data
This class implements a testing RRC entity.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t GetTxBytes(void)
Get the transmit bytes.
void SendData(Time at, std::string dataToSend)
Send data function.
Time GetRxLastTime(void)
Get the last receive time.
uint32_t m_rxPdus
number of receive PDUs
uint32_t m_pduSize
PDU size.
void SetDevice(Ptr< NetDevice > device)
Set the device.
Time m_arrivalTime
next arrival time
LtePdcpSapUser * m_pdcpSapUser
PDCP SAP user.
void SetLtePdcpSapProvider(LtePdcpSapProvider *s)
Set the PDCP SAP provider.
void Stop()
Stop function.
Time m_rxLastTime
last reeive time
uint32_t m_rxBytes
number of receive bytes
uint32_t m_txBytes
number of transmit bytes
void Start()
Start function.
uint32_t GetRxBytes(void)
Get the receive bytes.
Time GetTxLastTime(void)
Get the last transmit time.
Time m_txLastTime
last transmit time
std::string GetDataReceived(void)
Get data received function.
void SetArrivalTime(Time arrivalTime)
Set the arrival time.
std::string m_receivedData
the received data
uint32_t m_txPdus
number of transmit PDUs
void SetPduSize(uint32_t pduSize)
Set the PDU size.
virtual void DoDispose(void)
Destructor implementation.
virtual void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Interface forwarded by LtePdcpSapUser.
LtePdcpSapUser * GetLtePdcpSapUser(void)
Get the PDCP SAP user.
uint32_t GetTxPdus(void)
Get the transmit PDUs.
EventId m_nextPdu
next PDU event
uint32_t GetRxPdus(void)
Get the receive PDUs.
LtePdcpSapProvider * m_pdcpSapProvider
PDCP SAP provider.
Ptr< NetDevice > m_device
the device
virtual ~LteTestRrc(void)
Template for the implementation of the EpcEnbS1SapUser as a member of an owner class of type C to whi...
A base class which provides memory management and object aggregation.
Definition: object.h:88
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Parameters passed to DataRadioBearerSetupRequest ()
Parameters passed to InitialContextSetupRequest ()
PathSwitchRequestAcknowledgeParameters structure.
Parameters for LteMacSapProvider::ReportBufferStatus.
Definition: lte-mac-sap.h:68
Parameters for LteMacSapProvider::TransmitPdu.
Definition: lte-mac-sap.h:46
Parameters for LtePdcpSapUser::ReceivePdcpSdu.
Definition: lte-pdcp-sap.h:78