A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
lte-test-entities.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Manuel Requena <manuel.requena@cttc.es>
7 */
8
9#ifndef LTE_TEST_ENTITIES_H
10#define LTE_TEST_ENTITIES_H
11
12#include "ns3/lte-mac-sap.h"
13#include "ns3/lte-pdcp-sap.h"
14#include "ns3/lte-rlc-sap.h"
15#include "ns3/net-device.h"
16#include "ns3/simulator.h"
17#include "ns3/test.h"
18#include <ns3/epc-enb-s1-sap.h>
19
20namespace ns3
21{
22
23/**
24 * \ingroup lte-test
25 *
26 * \brief This class implements a testing RRC entity
27 */
28class LteTestRrc : public Object
29{
30 /// allow LtePdcpSpecificLtePdcpSapUser<LteTestRrc> class friend access
32 // friend class EnbMacMemberLteEnbCmacSapProvider;
33 // friend class EnbMacMemberLteMacSapProvider<LteTestMac>;
34 // friend class EnbMacMemberFfMacSchedSapUser;
35 // friend class EnbMacMemberFfMacCschedSapUser;
36 // friend class EnbMacMemberLteEnbPhySapUser;
37
38 public:
39 /**
40 * \brief Get the type ID.
41 * \return the object TypeId
42 */
43 static TypeId GetTypeId();
44
45 LteTestRrc();
46 ~LteTestRrc() override;
47 void DoDispose() override;
48
49 /**
50 * \brief Set the PDCP SAP provider
51 * \param s a pointer to the PDCP SAP provider
52 */
54 /**
55 * \brief Get the PDCP SAP user
56 * \return a pointer to the SAP user of the RLC
57 */
59
60 /// Start function
61 void Start();
62 /// Stop function
63 void Stop();
64
65 /**
66 * \brief Send data function
67 * \param at the time to send
68 * \param dataToSend the data to send
69 */
70 void SendData(Time at, std::string dataToSend);
71 /**
72 * \brief Get data received function
73 * \returns the received data string
74 */
75 std::string GetDataReceived();
76
77 // Stats
78 /**
79 * \brief Get the transmit PDUs
80 * \return the number of transmit PDUS
81 */
83 /**
84 * \brief Get the transmit bytes
85 * \return the number of bytes transmitted
86 */
88 /**
89 * \brief Get the receive PDUs
90 * \return the number of receive PDUS
91 */
93 /**
94 * \brief Get the receive bytes
95 * \return the number of bytes received
96 */
98
99 /**
100 * \brief Get the last transmit time
101 * \return the time of the last transmit
102 */
104 /**
105 * \brief Get the last receive time
106 * \return the time of the last receive
107 */
109
110 /**
111 * \brief Set the arrival time
112 * \param arrivalTime the arrival time
113 */
114 void SetArrivalTime(Time arrivalTime);
115 /**
116 * \brief Set the PDU size
117 * \param pduSize the PDU size
118 */
119 void SetPduSize(uint32_t pduSize);
120
121 /**
122 * \brief Set the device
123 * \param device the device
124 */
125 void SetDevice(Ptr<NetDevice> device);
126
127 private:
128 /**
129 * Interface forwarded by LtePdcpSapUser
130 * \param params the LtePdcpSapUser::ReceivePdcpSduParameters
131 */
133
134 LtePdcpSapUser* m_pdcpSapUser; ///< PDCP SAP user
135 LtePdcpSapProvider* m_pdcpSapProvider; ///< PDCP SAP provider
136
137 std::string m_receivedData; ///< the received data
138
139 uint32_t m_txPdus; ///< number of transmit PDUs
140 uint32_t m_txBytes; ///< number of transmit bytes
141 uint32_t m_rxPdus; ///< number of receive PDUs
142 uint32_t m_rxBytes; ///< number of receive bytes
143 Time m_txLastTime; ///< last transmit time
144 Time m_rxLastTime; ///< last reeive time
145
146 EventId m_nextPdu; ///< next PDU event
147 Time m_arrivalTime; ///< next arrival time
148 uint32_t m_pduSize; ///< PDU size
149
150 Ptr<NetDevice> m_device; ///< the device
151};
152
153/////////////////////////////////////////////////////////////////////
154
155/**
156 * \ingroup lte-test
157 *
158 * \brief This class implements a testing PDCP entity
159 */
160class LteTestPdcp : public Object
161{
162 /// allow LteRlcSpecificLteRlcSapUser<LteTestPdcp> class friend access
164
165 public:
166 /**
167 * \brief Get the type ID.
168 * \return the object TypeId
169 */
170 static TypeId GetTypeId();
171
172 LteTestPdcp();
173 ~LteTestPdcp() override;
174 void DoDispose() override;
175
176 /**
177 * \brief Set the RLC SAP provider
178 * \param s a pointer to the RLC SAP provider
179 */
181 /**
182 * \brief Get the RLC SAP user
183 * \return a pointer to the SAP user of the RLC
184 */
186
187 /// Start function
188 void Start();
189
190 /**
191 * \brief Send data function
192 * \param time the time to send
193 * \param dataToSend the data to send
194 */
195 void SendData(Time time, std::string dataToSend);
196 /**
197 * \brief Get data received function
198 * \returns the received data string
199 */
200 std::string GetDataReceived();
201
202 private:
203 /**
204 * Interface forwarded by LteRlcSapUser
205 * \param p the PDCP PDU packet received
206 */
207 virtual void DoReceivePdcpPdu(Ptr<Packet> p);
208
209 LteRlcSapUser* m_rlcSapUser; ///< RLC SAP user
210 LteRlcSapProvider* m_rlcSapProvider; ///< RLC SAP provider
211
212 std::string m_receivedData; ///< the received data
213};
214
215/////////////////////////////////////////////////////////////////////
216
217/**
218 * \ingroup lte-test
219 *
220 * \brief This class implements a testing loopback MAC layer
221 */
222class LteTestMac : public Object
223{
224 // friend class EnbMacMemberLteEnbCmacSapProvider;
225 /// allow EnbMacMemberLteMacSapProvider<LteTestMac> class friend access
227 // friend class EnbMacMemberFfMacSchedSapUser;
228 // friend class EnbMacMemberFfMacCschedSapUser;
229 // friend class EnbMacMemberLteEnbPhySapUser;
230
231 public:
232 /**
233 * \brief Get the type ID.
234 * \return the object TypeId
235 */
236 static TypeId GetTypeId();
237
238 LteTestMac();
239 ~LteTestMac() override;
240 void DoDispose() override;
241
242 /**
243 * \brief Set the device function
244 * \param device the device
245 */
246 void SetDevice(Ptr<NetDevice> device);
247
248 /**
249 * \brief Send transmit opportunity function
250 * \param time the time
251 * \param bytes the number of bytes
252 */
253 void SendTxOpportunity(Time time, uint32_t bytes);
254 /**
255 * \brief Get data received function
256 * \returns the received data string
257 */
258 std::string GetDataReceived();
259
260 /**
261 * \brief the Receive function
262 * \param nd the device
263 * \param p the packet
264 * \param protocol the protocol
265 * \param addr the address
266 * \returns true if successful
267 */
268 bool Receive(Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr);
269
270 /**
271 * \brief Set the MAC SAP user
272 * \param s a pointer to the MAC SAP user
273 */
275 /**
276 * \brief Get the MAC SAP provider
277 * \return a pointer to the SAP provider of the MAC
278 */
280
281 /**
282 * \brief Set the other side of the MAC Loopback
283 * \param s a pointer to the other side of the MAC loopback
284 */
286
287 /**
288 * \brief Set PDCP header present function
289 * \param present true iif PDCP header present
290 */
291 void SetPdcpHeaderPresent(bool present);
292
293 /**
294 * \brief Set RLC header type
295 * \param rlcHeaderType the RLC header type
296 */
297 void SetRlcHeaderType(uint8_t rlcHeaderType);
298
299 /// RCL Header Type enumeration
305
306 /**
307 * Set transmit opportunity mode
308 * \param mode the transmit opportunity mode
309 */
310 void SetTxOpportunityMode(uint8_t mode);
311
312 /// Transmit opportunity mode enumeration
319
320 /**
321 * Set transmit opportunity time
322 * \param txOppTime the transmit opportunity time
323 */
324 void SetTxOppTime(Time txOppTime);
325 /**
326 * Set transmit opportunity time
327 * \param txOppSize the transmit opportunity size
328 */
329 void SetTxOppSize(uint32_t txOppSize);
330
331 // Stats
332 /**
333 * \brief Get the transmit PDUs
334 * \return the number of transmit PDUS
335 */
337 /**
338 * \brief Get the transmit bytes
339 * \return the number of bytes transmitted
340 */
342 /**
343 * \brief Get the receive PDUs
344 * \return the number of receive PDUS
345 */
347 /**
348 * \brief Get the receive bytes
349 * \return the number of bytes received
350 */
352
353 private:
354 // forwarded from LteMacSapProvider
355 /**
356 * Transmit PDU
357 * \param params LteMacSapProvider::TransmitPduParameters
358 */
360 /**
361 * Report buffer status function
362 * \param params LteMacSapProvider::ReportBufferStatusParameters
363 */
365
366 LteMacSapProvider* m_macSapProvider; ///< MAC SAP provider
367 LteMacSapUser* m_macSapUser; ///< MAC SAP user
369
370 std::string m_receivedData; ///< the received data string
371
372 uint8_t m_rlcHeaderType; ///< RLC header type
373 bool m_pdcpHeaderPresent; ///< PDCP header present?
374 uint8_t m_txOpportunityMode; ///< transmit opportunity mode
375
376 Ptr<NetDevice> m_device; ///< the device
377
378 // TxOpportunity configuration
379 EventId m_nextTxOpp; ///< next transmit opportunity event
380 Time m_txOppTime; ///< transmit opportunity time
381 uint32_t m_txOppSize; ///< transmit opportunity size
382 std::list<EventId> m_nextTxOppList; ///< next transmit opportunity list
383
384 // Stats
385 uint32_t m_txPdus; ///< the number of transmit PDUs
386 uint32_t m_txBytes; ///< the number of transmit bytes
387 uint32_t m_rxPdus; ///< the number of receive PDUs
388 uint32_t m_rxBytes; ///< the number of receive bytes
389};
390
391/**
392 * \ingroup lte-test
393 *
394 * \brief RRC stub providing a testing S1 SAP user to be used with the EpcEnbApplication
395 */
396class EpcTestRrc : public Object
397{
398 /// allow MemberEpcEnbS1SapUser<EpcTestRrc> class friend access
399 friend class MemberEpcEnbS1SapUser<EpcTestRrc>;
400
401 public:
402 EpcTestRrc();
403 ~EpcTestRrc() override;
404
405 // inherited from Object
406 void DoDispose() override;
407 /**
408 * \brief Get the type ID.
409 * \return the object TypeId
410 */
411 static TypeId GetTypeId();
412
413 /**
414 * Set the S1 SAP Provider
415 *
416 * \param s the S1 SAP Provider
417 */
419
420 /**
421 *
422 * \return the S1 SAP user
423 */
425
426 private:
427 // S1 SAP methods
428 /**
429 * Initial context setup request
430 * \param params EpcEnbS1SapUser::InitialContextSetupRequestParameters
431 */
433 /**
434 * Data radio bearer setup request
435 * \param params EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters
436 */
439 /**
440 * Path switch request acknowledge function
441 * \param params EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters
442 */
445
447 EpcEnbS1SapUser* m_s1SapUser; ///< S1 SAP user
448};
449
450} // namespace ns3
451
452#endif /* LTE_TEST_MAC_H */
a polymophic address class
Definition address.h:90
EnbMacMemberLteMacSapProvider class.
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.
static TypeId GetTypeId()
Get the type ID.
void SetS1SapProvider(EpcEnbS1SapProvider *s)
Set the S1 SAP Provider.
void DoPathSwitchRequestAcknowledge(EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters params)
Path switch request acknowledge function.
void DoDispose() override
Destructor implementation.
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:45
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition lte-mac-sap.h:25
Service Access Point (SAP) offered by the MAC to the RLC See Femto Forum MAC Scheduler Interface Spec...
Definition lte-mac-sap.h:85
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
Service Access Point (SAP) offered by the PDCP entity to the RRC entity See 3GPP 36....
LtePdcpSpecificLtePdcpSapUser class.
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:25
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:56
LteRlcSpecificLteRlcSapUser class.
This class implements a testing loopback MAC layer.
TxOpportunityMode_t
Transmit opportunity mode enumeration.
uint32_t GetTxPdus()
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.
uint32_t GetRxPdus()
Get the receive PDUs.
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.
uint32_t GetRxBytes()
Get the receive bytes.
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
LteMacSapProvider * GetLteMacSapProvider()
Get the MAC SAP provider.
std::string GetDataReceived()
Get data received function.
std::string m_receivedData
the received data string
EventId m_nextTxOpp
next transmit opportunity event
bool m_pdcpHeaderPresent
PDCP header present?
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.
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
static TypeId GetTypeId()
Get the type ID.
void DoDispose() override
Destructor implementation.
void SetTxOppTime(Time txOppTime)
Set transmit opportunity time.
LteMacSapProvider * m_macSapProvider
MAC SAP provider.
uint32_t m_txPdus
the number of transmit PDUs
void SetTxOpportunityMode(uint8_t mode)
Set transmit opportunity mode.
Ptr< LteTestMac > m_macLoopback
MAC loopback.
uint32_t m_txBytes
the number of transmit bytes
uint32_t GetTxBytes()
Get the transmit bytes.
Ptr< NetDevice > m_device
the device
This class implements a testing PDCP entity.
std::string GetDataReceived()
Get data received function.
LteRlcSapProvider * m_rlcSapProvider
RLC SAP provider.
void SetLteRlcSapProvider(LteRlcSapProvider *s)
Set the RLC SAP provider.
virtual void DoReceivePdcpPdu(Ptr< Packet > p)
Interface forwarded by LteRlcSapUser.
void DoDispose() override
Destructor implementation.
LteRlcSapUser * m_rlcSapUser
RLC SAP user.
LteRlcSapUser * GetLteRlcSapUser()
Get the RLC SAP user.
void Start()
Start function.
void SendData(Time time, std::string dataToSend)
Send data function.
std::string m_receivedData
the received data
static TypeId GetTypeId()
Get the type ID.
This class implements a testing RRC entity.
void SendData(Time at, std::string dataToSend)
Send data function.
uint32_t GetTxPdus()
Get the transmit PDUs.
uint32_t GetRxPdus()
Get the receive PDUs.
uint32_t m_rxPdus
number of receive PDUs
uint32_t m_pduSize
PDU size.
static TypeId GetTypeId()
Get the type ID.
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 DoDispose() override
Destructor implementation.
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.
Time m_txLastTime
last transmit time
void SetArrivalTime(Time arrivalTime)
Set the arrival time.
std::string m_receivedData
the received data
uint32_t m_txPdus
number of transmit PDUs
uint32_t GetTxBytes()
Get the transmit bytes.
LtePdcpSapUser * GetLtePdcpSapUser()
Get the PDCP SAP user.
void SetPduSize(uint32_t pduSize)
Set the PDU size.
Time GetRxLastTime()
Get the last receive time.
virtual void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
Interface forwarded by LtePdcpSapUser.
EventId m_nextPdu
next PDU event
std::string GetDataReceived()
Get data received function.
LtePdcpSapProvider * m_pdcpSapProvider
PDCP SAP provider.
Time GetTxLastTime()
Get the last transmit time.
Ptr< NetDevice > m_device
the device
uint32_t GetRxBytes()
Get the receive bytes.
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:78
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Definition nstime.h:94
a unique identifier for an interface.
Definition type-id.h:48
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:58
Parameters for LteMacSapProvider::TransmitPdu.
Definition lte-mac-sap.h:34
Parameters for LtePdcpSapUser::ReceivePdcpSdu.