A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
lte-test-entities.h
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 
39 class LteTestRrc : public Object
40 {
41  friend class LtePdcpSpecificLtePdcpSapUser<LteTestRrc>;
42 // friend class EnbMacMemberLteEnbCmacSapProvider;
43 // friend class EnbMacMemberLteMacSapProvider<LteTestMac>;
44 // friend class EnbMacMemberFfMacSchedSapUser;
45 // friend class EnbMacMemberFfMacCschedSapUser;
46 // friend class EnbMacMemberLteEnbPhySapUser;
47 
48  public:
49  static TypeId GetTypeId (void);
50 
51  LteTestRrc (void);
52  virtual ~LteTestRrc (void);
53  virtual void DoDispose (void);
54 
55 
66 
67  void Start ();
68  void Stop ();
69 
70  void SendData (Time at, std::string dataToSend);
71  std::string GetDataReceived (void);
72 
73  // Stats
74  uint32_t GetTxPdus (void);
75  uint32_t GetTxBytes (void);
76  uint32_t GetRxPdus (void);
77  uint32_t GetRxBytes (void);
78 
79  Time GetTxLastTime (void);
80  Time GetRxLastTime (void);
81 
82  void SetArrivalTime (Time arrivalTime);
83  void SetPduSize (uint32_t pduSize);
84 
85  private:
86  // Interface forwarded by LtePdcpSapUser
88 
89  LtePdcpSapUser* m_pdcpSapUser;
90  LtePdcpSapProvider* m_pdcpSapProvider;
91 
92  std::string m_receivedData;
93 
94  uint32_t m_txPdus;
95  uint32_t m_txBytes;
96  uint32_t m_rxPdus;
97  uint32_t m_rxBytes;
98  Time m_txLastTime;
99  Time m_rxLastTime;
100 
101  EventId m_nextPdu;
102  Time m_arrivalTime;
103  uint32_t m_pduSize;
104 };
105 
107 
111 class LteTestPdcp : public Object
112 {
113  friend class LteRlcSpecificLteRlcSapUser<LteTestPdcp>;
114 
115  public:
116  static TypeId GetTypeId (void);
117 
118  LteTestPdcp (void);
119  virtual ~LteTestPdcp (void);
120  virtual void DoDispose (void);
121 
122 
133 
134  void Start ();
135 
136  void SendData (Time time, std::string dataToSend);
137  std::string GetDataReceived (void);
138 
139  private:
140  // Interface forwarded by LteRlcSapUser
141  virtual void DoReceivePdcpPdu (Ptr<Packet> p);
142 
143  LteRlcSapUser* m_rlcSapUser;
144  LteRlcSapProvider* m_rlcSapProvider;
145 
146  std::string m_receivedData;
147 };
148 
150 
154 class LteTestMac : public Object
155 {
156 // friend class EnbMacMemberLteEnbCmacSapProvider;
157  friend class EnbMacMemberLteMacSapProvider<LteTestMac>;
158 // friend class EnbMacMemberFfMacSchedSapUser;
159 // friend class EnbMacMemberFfMacCschedSapUser;
160 // friend class EnbMacMemberLteEnbPhySapUser;
161 
162  public:
163  static TypeId GetTypeId (void);
164 
165  LteTestMac (void);
166  virtual ~LteTestMac (void);
167  virtual void DoDispose (void);
168 
169  void SetDevice (Ptr<NetDevice> device);
170 
171  void SendTxOpportunity (Time, uint32_t);
172  std::string GetDataReceived (void);
173 
174  bool Receive (Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr);
175 
186 
192 
196  void SetPdcpHeaderPresent (bool present);
197 
201  void SetRlcHeaderType (uint8_t rlcHeaderType);
202 
203  typedef enum {
204  UM_RLC_HEADER = 0,
205  AM_RLC_HEADER = 1,
206  } RlcHeaderType_t;
207 
211  void SetTxOpportunityMode (uint8_t mode);
212 
213  typedef enum {
214  MANUAL_MODE = 0,
215  AUTOMATIC_MODE = 1,
216  RANDOM_MODE = 2
217  } TxOpportunityMode_t;
218 
219  void SetTxOppTime (Time txOppTime);
220  void SetTxOppSize (uint32_t txOppSize);
221 
222  // Stats
223  uint32_t GetTxPdus (void);
224  uint32_t GetTxBytes (void);
225  uint32_t GetRxPdus (void);
226  uint32_t GetRxBytes (void);
227 
228  private:
229  // forwarded from LteMacSapProvider
231  void DoReportBufferStatus (LteMacSapProvider::ReportBufferStatusParameters);
232 
233  LteMacSapProvider* m_macSapProvider;
234  LteMacSapUser* m_macSapUser;
235  Ptr<LteTestMac> m_macLoopback;
236 
237  std::string m_receivedData;
238 
239  uint8_t m_rlcHeaderType;
240  bool m_pdcpHeaderPresent;
241  uint8_t m_txOpportunityMode;
242 
243  Ptr<NetDevice> m_device;
244 
245  // TxOpportunity configuration
246  EventId m_nextTxOpp;
247  Time m_txOppTime;
248  uint32_t m_txOppSize;
249 
250  // Stats
251  uint32_t m_txPdus;
252  uint32_t m_txBytes;
253  uint32_t m_rxPdus;
254  uint32_t m_rxBytes;
255 
256 };
257 
258 
259 
264 class EpcTestRrc : public Object
265 {
266  friend class MemberEpcEnbS1SapUser<EpcTestRrc>;
267 
268 public:
269  EpcTestRrc ();
270  virtual ~EpcTestRrc ();
271 
272  // inherited from Object
273  virtual void DoDispose (void);
274  static TypeId GetTypeId (void);
275 
282 
288 
289 private:
290 
291  // S1 SAP methods
292  void DoDataRadioBearerSetupRequest (EpcEnbS1SapUser::DataRadioBearerSetupRequestParameters params);
293  void DoPathSwitchRequestAcknowledge (EpcEnbS1SapUser::PathSwitchRequestAcknowledgeParameters params);
294 
295  EpcEnbS1SapProvider* m_s1SapProvider;
296  EpcEnbS1SapUser* m_s1SapUser;
297 
298 
299 };
300 
301 
302 } // namespace ns3
303 
304 #endif /* LTE_TEST_MAC_H */
keep track of time unit.
Definition: nstime.h:149
virtual void DoDispose(void)
virtual void DoDispose(void)
void SetLteMacLoopback(Ptr< LteTestMac > s)
Set the other side of the MAC Loopback.
virtual void DoReceivePdcpSdu(LtePdcpSapUser::ReceivePdcpSduParameters params)
a polymophic address class
Definition: address.h:86
void SetLteMacSapUser(LteMacSapUser *s)
Set the MAC SAP user.
LtePdcpSapUser * GetLtePdcpSapUser(void)
Get the PDCP SAP user.
void SetLteRlcSapProvider(LteRlcSapProvider *s)
Set the RLC SAP provider.
void SetS1SapProvider(EpcEnbS1SapProvider *s)
EpcEnbS1SapUser * GetS1SapUser()
LteMacSapProvider * GetLteMacSapProvider(void)
Get the MAC SAP provider.
virtual void DoDispose(void)
virtual void DoDispose(void)
an identifier for simulation events.
Definition: event-id.h:46
void DoTransmitPdu(LteMacSapProvider::TransmitPduParameters)
a base class which provides memory management and object aggregation
Definition: object.h:63
a unique identifier for an interface.
Definition: type-id.h:44
virtual void DoReceivePdcpPdu(Ptr< Packet > p)
void SetLtePdcpSapProvider(LtePdcpSapProvider *s)
Set the PDCP SAP provider.
LteRlcSapUser * GetLteRlcSapUser(void)
Get the RLC SAP user.