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