A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 // #include "ns3/type-id.h"
27 
28 #include "ns3/lte-mac-sap.h"
29 #include "ns3/lte-rlc-sap.h"
30 #include "ns3/lte-pdcp-sap.h"
31 
32 #include "ns3/net-device.h"
33 
34 
35 namespace ns3 {
36 
40 class LteTestRrc : public Object
41 {
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  static TypeId GetTypeId (void);
51 
52  LteTestRrc (void);
53  virtual ~LteTestRrc (void);
54  virtual void DoDispose (void);
55 
56 
67 
68  void Start ();
69  void Stop ();
70 
71  void SendData (Time at, std::string dataToSend);
72  std::string GetDataReceived (void);
73 
74  // Stats
75  uint32_t GetTxPdus (void);
76  uint32_t GetTxBytes (void);
77  uint32_t GetRxPdus (void);
78  uint32_t GetRxBytes (void);
79 
80  Time GetTxLastTime (void);
81  Time GetRxLastTime (void);
82 
83  void SetArrivalTime (Time arrivalTime);
84  void SetPduSize (uint32_t pduSize);
85 
86  private:
87  // Interface forwarded by LtePdcpSapUser
89 
92 
93  std::string m_receivedData;
94 
95  uint32_t m_txPdus;
96  uint32_t m_txBytes;
97  uint32_t m_rxPdus;
98  uint32_t m_rxBytes;
101 
104  uint32_t m_pduSize;
105 };
106 
108 
112 class LteTestPdcp : public Object
113 {
115 // friend class EnbMacMemberLteEnbCmacSapProvider;
116 // friend class EnbMacMemberLteMacSapProvider<LteTestMac>;
117 // friend class EnbMacMemberFfMacSchedSapUser;
118 // friend class EnbMacMemberFfMacCschedSapUser;
119 // friend class EnbMacMemberLteEnbPhySapUser;
120 
121  public:
122  static TypeId GetTypeId (void);
123 
124  LteTestPdcp (void);
125  virtual ~LteTestPdcp (void);
126  virtual void DoDispose (void);
127 
128 
139 
140  void Start ();
141 
142  void SendData (Time time, std::string dataToSend);
143  std::string GetDataReceived (void);
144 
145  private:
146  // Interface forwarded by LteRlcSapUser
147  virtual void DoReceivePdcpPdu (Ptr<Packet> p);
148 
151 
152  std::string m_receivedData;
153 };
154 
156 
160 class LteTestMac : public Object
161 {
162 // friend class EnbMacMemberLteEnbCmacSapProvider;
164 // friend class EnbMacMemberFfMacSchedSapUser;
165 // friend class EnbMacMemberFfMacCschedSapUser;
166 // friend class EnbMacMemberLteEnbPhySapUser;
167 
168  public:
169  static TypeId GetTypeId (void);
170 
171  LteTestMac (void);
172  virtual ~LteTestMac (void);
173  virtual void DoDispose (void);
174 
175  void SetDevice (Ptr<NetDevice> device);
176 
177  void SendTxOpportunity (Time, uint32_t);
178  std::string GetDataReceived (void);
179 
180  bool Receive (Ptr<NetDevice> nd, Ptr<const Packet> p, uint16_t protocol, const Address& addr);
181 
192 
198 
202  void SetPdcpHeaderPresent (bool present);
203 
207  void SetRlcHeaderType (uint8_t rlcHeaderType);
208 
209  typedef enum {
212  } RlcHeaderType_t;
213 
217  void SetTxOpportunityMode (uint8_t mode);
218 
219  typedef enum {
224 
225  void SetTxOppTime (Time txOppTime);
226  void SetTxOppSize (uint32_t txOppSize);
227 
228  // Stats
229  uint32_t GetTxPdus (void);
230  uint32_t GetTxBytes (void);
231  uint32_t GetRxPdus (void);
232  uint32_t GetRxBytes (void);
233 
234  private:
235  // forwarded from LteMacSapProvider
238 
242 
243  std::string m_receivedData;
244 
248 
250 
251  // TxOpportunity configuration
254  uint32_t m_txOppSize;
255 
256  // Stats
257  uint32_t m_txPdus;
258  uint32_t m_txBytes;
259  uint32_t m_rxPdus;
260  uint32_t m_rxBytes;
261 
262 };
263 
264 } // namespace ns3
265 
266 #endif /* LTE_TEST_MAC_H */