A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
epc-test-s1u-uplink.cc
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008,2009 INRIA, UDCAST
4  * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation;
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * The original version of UdpClient is by Amine Ismail
20  * <amine.ismail@sophia.inria.fr> <amine.ismail@udcast.com>
21  * The rest of the code (including modifying UdpClient into
22  * EpsBearerTagUdpClient) is by Nicola Baldo <nbaldo@cttc.es>
23  */
24 
25 
26 
27 #include "ns3/simulator.h"
28 #include "ns3/log.h"
29 #include "ns3/test.h"
30 #include "ns3/epc-helper.h"
31 #include "ns3/epc-enb-application.h"
32 #include "ns3/packet-sink-helper.h"
33 #include "ns3/point-to-point-helper.h"
34 #include "ns3/csma-helper.h"
35 #include "ns3/internet-stack-helper.h"
36 #include "ns3/ipv4-address-helper.h"
37 #include "ns3/inet-socket-address.h"
38 #include "ns3/packet-sink.h"
39 #include <ns3/ipv4-static-routing-helper.h>
40 #include <ns3/ipv4-static-routing.h>
41 #include <ns3/ipv4-interface.h>
42 #include <ns3/mac48-address.h>
43 #include "ns3/seq-ts-header.h"
44 #include "ns3/eps-bearer-tag.h"
45 #include "ns3/arp-cache.h"
46 #include "ns3/boolean.h"
47 #include "ns3/uinteger.h"
48 #include "ns3/config.h"
49 #include "lte-test-entities.h"
50 
51 namespace ns3 {
52 
53 
54 
55 NS_LOG_COMPONENT_DEFINE ("EpcTestS1uUplink");
56 
57 /*
58  * A Udp client. Sends UDP packet carrying sequence number and time
59  * stamp but also including the EpsBearerTag. This tag is normally
60  * generated by the LteEnbNetDevice when forwarding packet in the
61  * uplink. But in this test we don't have the LteEnbNetDevice, because
62  * we test the S1-U interface with simpler devices to make sure it
63  * just works.
64  *
65  */
67 {
68 public:
69  static TypeId
70  GetTypeId (void);
71 
73  EpsBearerTagUdpClient (uint16_t rnti, uint8_t bid);
74 
75  virtual ~EpsBearerTagUdpClient ();
76 
82  void SetRemote (Ipv4Address ip, uint16_t port);
83 
84 protected:
85  virtual void DoDispose (void);
86 
87 private:
88 
89  virtual void StartApplication (void);
90  virtual void StopApplication (void);
91 
92  void ScheduleTransmit (Time dt);
93  void Send (void);
94 
95  uint32_t m_count;
96  Time m_interval;
97  uint32_t m_size;
98 
99  uint32_t m_sent;
100  Ptr<Socket> m_socket;
101  Ipv4Address m_peerAddress;
102  uint16_t m_peerPort;
103  EventId m_sendEvent;
104 
105  uint16_t m_rnti;
106  uint8_t m_bid;
107 
108 };
109 
110 
111 
112 TypeId
113 EpsBearerTagUdpClient::GetTypeId (void)
114 {
115  static TypeId tid = TypeId ("ns3::EpsBearerTagUdpClient")
117  .AddConstructor<EpsBearerTagUdpClient> ()
118  .AddAttribute ("MaxPackets",
119  "The maximum number of packets the application will send",
120  UintegerValue (100),
121  MakeUintegerAccessor (&EpsBearerTagUdpClient::m_count),
122  MakeUintegerChecker<uint32_t> ())
123  .AddAttribute ("Interval",
124  "The time to wait between packets", TimeValue (Seconds (1.0)),
125  MakeTimeAccessor (&EpsBearerTagUdpClient::m_interval),
126  MakeTimeChecker ())
127  .AddAttribute (
128  "RemoteAddress",
129  "The destination Ipv4Address of the outbound packets",
130  Ipv4AddressValue (),
131  MakeIpv4AddressAccessor (&EpsBearerTagUdpClient::m_peerAddress),
132  MakeIpv4AddressChecker ())
133  .AddAttribute ("RemotePort", "The destination port of the outbound packets",
134  UintegerValue (100),
135  MakeUintegerAccessor (&EpsBearerTagUdpClient::m_peerPort),
136  MakeUintegerChecker<uint16_t> ())
137  .AddAttribute ("PacketSize",
138  "Size of packets generated. The minimum packet size is 12 bytes which is the size of the header carrying the sequence number and the time stamp.",
139  UintegerValue (1024),
140  MakeUintegerAccessor (&EpsBearerTagUdpClient::m_size),
141  MakeUintegerChecker<uint32_t> ())
142  ;
143  return tid;
144 }
145 
146 EpsBearerTagUdpClient::EpsBearerTagUdpClient ()
147  : m_rnti (0),
148  m_bid (0)
149 {
151  m_sent = 0;
152  m_socket = 0;
153  m_sendEvent = EventId ();
154 }
155 
156 EpsBearerTagUdpClient::EpsBearerTagUdpClient (uint16_t rnti, uint8_t bid)
157  : m_rnti (rnti),
158  m_bid (bid)
159 {
161  m_sent = 0;
162  m_socket = 0;
163  m_sendEvent = EventId ();
164 }
165 
166 EpsBearerTagUdpClient::~EpsBearerTagUdpClient ()
167 {
169 }
170 
171 void
173 {
174  m_peerAddress = ip;
175  m_peerPort = port;
176 }
177 
178 void
180 {
183 }
184 
185 void
187 {
189 
190  if (m_socket == 0)
191  {
192  TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory");
193  m_socket = Socket::CreateSocket (GetNode (), tid);
194  m_socket->Bind ();
195  m_socket->Connect (InetSocketAddress (m_peerAddress, m_peerPort));
196  }
197 
198  m_socket->SetRecvCallback (MakeNullCallback<void, Ptr<Socket> > ());
199  m_sendEvent = Simulator::Schedule (Seconds (0.0), &EpsBearerTagUdpClient::Send, this);
200 }
201 
202 void
204 {
206  Simulator::Cancel (m_sendEvent);
207 }
208 
209 void
210 EpsBearerTagUdpClient::Send (void)
211 {
213  NS_ASSERT (m_sendEvent.IsExpired ());
214  SeqTsHeader seqTs;
215  seqTs.SetSeq (m_sent);
216  Ptr<Packet> p = Create<Packet> (m_size-(8+4)); // 8+4 : the size of the seqTs header
217  p->AddHeader (seqTs);
218 
219  EpsBearerTag tag (m_rnti, m_bid);
220  p->AddPacketTag (tag);
221 
222  if ((m_socket->Send (p)) >= 0)
223  {
224  ++m_sent;
225  NS_LOG_INFO ("TraceDelay TX " << m_size << " bytes to "
226  << m_peerAddress << " Uid: " << p->GetUid ()
227  << " Time: " << (Simulator::Now ()).GetSeconds ());
228 
229  }
230  else
231  {
232  NS_LOG_INFO ("Error while sending " << m_size << " bytes to "
233  << m_peerAddress);
234  }
235 
236  if (m_sent < m_count)
237  {
238  m_sendEvent = Simulator::Schedule (m_interval, &EpsBearerTagUdpClient::Send, this);
239  }
240 }
241 
242 
243 
245 {
246  UeUlTestData (uint32_t n, uint32_t s, uint16_t r, uint8_t l);
247 
248  uint32_t numPkts;
249  uint32_t pktSize;
250  uint16_t rnti;
251  uint8_t bid;
252 
253  Ptr<PacketSink> serverApp;
254  Ptr<Application> clientApp;
255 };
256 
257  UeUlTestData::UeUlTestData (uint32_t n, uint32_t s, uint16_t r, uint8_t l)
258  : numPkts (n),
259  pktSize (s),
260  rnti (r),
261  bid (l)
262 {
263 }
264 
266 {
267  std::vector<UeUlTestData> ues;
268 };
269 
270 
272 {
273 public:
274  EpcS1uUlTestCase (std::string name, std::vector<EnbUlTestData> v);
275  virtual ~EpcS1uUlTestCase ();
276 
277 private:
278  virtual void DoRun (void);
279  std::vector<EnbUlTestData> m_enbUlTestData;
280 };
281 
282 
283 EpcS1uUlTestCase::EpcS1uUlTestCase (std::string name, std::vector<EnbUlTestData> v)
284  : TestCase (name),
285  m_enbUlTestData (v)
286 {
287 }
288 
289 EpcS1uUlTestCase::~EpcS1uUlTestCase ()
290 {
291 }
292 
293 void
295 {
296  Ptr<EpcHelper> epcHelper = CreateObject<EpcHelper> ();
297  Ptr<Node> pgw = epcHelper->GetPgwNode ();
298 
299  // allow jumbo packets
300  Config::SetDefault ("ns3::CsmaNetDevice::Mtu", UintegerValue (30000));
301  Config::SetDefault ("ns3::PointToPointNetDevice::Mtu", UintegerValue (30000));
302  epcHelper->SetAttribute ("S1uLinkMtu", UintegerValue (30000));
303 
304  // Create a single RemoteHost
305  NodeContainer remoteHostContainer;
306  remoteHostContainer.Create (1);
307  Ptr<Node> remoteHost = remoteHostContainer.Get (0);
308  InternetStackHelper internet;
309  internet.Install (remoteHostContainer);
310 
311  // Create the internet
312  PointToPointHelper p2ph;
313  p2ph.SetDeviceAttribute ("DataRate", DataRateValue (DataRate ("100Gb/s")));
314  NetDeviceContainer internetDevices = p2ph.Install (pgw, remoteHost);
315  Ipv4AddressHelper ipv4h;
316  ipv4h.SetBase ("1.0.0.0", "255.0.0.0");
317  Ipv4InterfaceContainer internetNodesIpIfaceContainer = ipv4h.Assign (internetDevices);
318 
319  // setup default gateway for the remote hosts
320  Ipv4StaticRoutingHelper ipv4RoutingHelper;
321  Ptr<Ipv4StaticRouting> remoteHostStaticRouting = ipv4RoutingHelper.GetStaticRouting (remoteHost->GetObject<Ipv4> ());
322 
323  // hardcoded UE addresses for now
324  remoteHostStaticRouting->AddNetworkRouteTo (Ipv4Address ("7.0.0.0"), Ipv4Mask ("255.255.255.0"), 1);
325 
326 
327 
328  uint16_t udpSinkPort = 1234;
329 
330  NodeContainer enbs;
331  uint16_t cellIdCounter = 0;
332 
333  for (std::vector<EnbUlTestData>::iterator enbit = m_enbUlTestData.begin ();
334  enbit < m_enbUlTestData.end ();
335  ++enbit)
336  {
337  Ptr<Node> enb = CreateObject<Node> ();
338  enbs.Add (enb);
339 
340  // we test EPC without LTE, hence we use:
341  // 1) a CSMA network to simulate the cell
342  // 2) a raw socket opened on the CSMA device to simulate the LTE socket
343 
344  uint16_t cellId = ++cellIdCounter;
345 
346  NodeContainer ues;
347  ues.Create (enbit->ues.size ());
348 
349  NodeContainer cell;
350  cell.Add (ues);
351  cell.Add (enb);
352 
353  CsmaHelper csmaCell;
354  NetDeviceContainer cellDevices = csmaCell.Install (cell);
355 
356  // the eNB's CSMA NetDevice acting as an LTE NetDevice.
357  Ptr<NetDevice> enbDevice = cellDevices.Get (cellDevices.GetN () - 1);
358 
359  // Note that the EpcEnbApplication won't care of the actual NetDevice type
360  epcHelper->AddEnb (enb, enbDevice, cellId);
361 
362  // Plug test RRC entity
363  Ptr<EpcEnbApplication> enbApp = enb->GetApplication (0)->GetObject<EpcEnbApplication> ();
364  NS_ASSERT_MSG (enbApp != 0, "cannot retrieve EpcEnbApplication");
365  Ptr<EpcTestRrc> rrc = CreateObject<EpcTestRrc> ();
366  rrc->SetS1SapProvider (enbApp->GetS1SapProvider ());
367  enbApp->SetS1SapUser (rrc->GetS1SapUser ());
368 
369  // we install the IP stack on UEs only
370  InternetStackHelper internet;
371  internet.Install (ues);
372 
373  // assign IP address to UEs, and install applications
374  for (uint32_t u = 0; u < ues.GetN (); ++u)
375  {
376  Ptr<NetDevice> ueLteDevice = cellDevices.Get (u);
377  Ipv4InterfaceContainer ueIpIface = epcHelper->AssignUeIpv4Address (NetDeviceContainer (ueLteDevice));
378 
379  Ptr<Node> ue = ues.Get (u);
380 
381  // disable IP Forwarding on the UE. This is because we use
382  // CSMA broadcast MAC addresses for this test. The problem
383  // won't happen with a LteUeNetDevice.
384  Ptr<Ipv4> ueIpv4 = ue->GetObject<Ipv4> ();
385  ueIpv4->SetAttribute ("IpForward", BooleanValue (false));
386 
387  // tell the UE to route all packets to the GW
388  Ptr<Ipv4StaticRouting> ueStaticRouting = ipv4RoutingHelper.GetStaticRouting (ueIpv4);
389  Ipv4Address gwAddr = epcHelper->GetUeDefaultGatewayAddress ();
390  NS_LOG_INFO ("GW address: " << gwAddr);
391  ueStaticRouting->SetDefaultRoute (gwAddr, 1);
392 
393  // since the UEs in this test use CSMA with IP enabled, and
394  // the eNB uses CSMA but without IP, we fool the UE's ARP
395  // cache into thinking that the IP address of the GW can be
396  // reached by sending a CSMA packet to the broadcast
397  // address, so the eNB will get it.
398  int32_t ueLteIpv4IfIndex = ueIpv4->GetInterfaceForDevice (ueLteDevice);
399  Ptr<Ipv4L3Protocol> ueIpv4L3Protocol = ue->GetObject<Ipv4L3Protocol> ();
400  Ptr<Ipv4Interface> ueLteIpv4Iface = ueIpv4L3Protocol->GetInterface (ueLteIpv4IfIndex);
401  Ptr<ArpCache> ueArpCache = ueLteIpv4Iface->GetArpCache ();
402  ueArpCache->SetAliveTimeout (Seconds (1000));
403  ArpCache::Entry* arpCacheEntry = ueArpCache->Add (gwAddr);
404  arpCacheEntry->MarkWaitReply(0);
405  arpCacheEntry->MarkAlive (Mac48Address::GetBroadcast ());
406 
407 
408  PacketSinkHelper packetSinkHelper ("ns3::UdpSocketFactory",
409  InetSocketAddress (Ipv4Address::GetAny (), udpSinkPort));
410  ApplicationContainer sinkApp = packetSinkHelper.Install (remoteHost);
411  sinkApp.Start (Seconds (1.0));
412  sinkApp.Stop (Seconds (10.0));
413  enbit->ues[u].serverApp = sinkApp.Get (0)->GetObject<PacketSink> ();
414 
415  Time interPacketInterval = Seconds (0.01);
416  Ptr<EpsBearerTagUdpClient> client = CreateObject<EpsBearerTagUdpClient> (enbit->ues[u].rnti, enbit->ues[u].bid);
417  client->SetAttribute ("RemoteAddress", Ipv4AddressValue (internetNodesIpIfaceContainer.GetAddress (1)));
418  client->SetAttribute ("RemotePort", UintegerValue (udpSinkPort));
419  client->SetAttribute ("MaxPackets", UintegerValue (enbit->ues[u].numPkts));
420  client->SetAttribute ("Interval", TimeValue (interPacketInterval));
421  client->SetAttribute ("PacketSize", UintegerValue (enbit->ues[u].pktSize));
422  ue->AddApplication (client);
423  ApplicationContainer clientApp;
424  clientApp.Add (client);
425  clientApp.Start (Seconds (2.0));
426  clientApp.Stop (Seconds (10.0));
427  enbit->ues[u].clientApp = client;
428 
429  uint64_t imsi = u+1;
430  epcHelper->AddUe (ueLteDevice, imsi);
431  epcHelper->ActivateEpsBearer (ueLteDevice, imsi, EpcTft::Default (), EpsBearer (EpsBearer::NGBR_VIDEO_TCP_DEFAULT));
432  enbApp->GetS1SapProvider ()->InitialUeMessage (imsi, (uint16_t) imsi);
433 
434  // need this since all sinks are installed in the same node
435  ++udpSinkPort;
436  }
437 
438  }
439 
440  Simulator::Run ();
441 
442  for (std::vector<EnbUlTestData>::iterator enbit = m_enbUlTestData.begin ();
443  enbit < m_enbUlTestData.end ();
444  ++enbit)
445  {
446  for (std::vector<UeUlTestData>::iterator ueit = enbit->ues.begin ();
447  ueit < enbit->ues.end ();
448  ++ueit)
449  {
450  NS_TEST_ASSERT_MSG_EQ (ueit->serverApp->GetTotalRx (), (ueit->numPkts) * (ueit->pktSize), "wrong total received bytes");
451  }
452  }
453 
455 }
456 
457 
458 
459 
460 
465 {
466 public:
468 
469 } g_epcS1uUlTestSuiteInstance;
470 
471 EpcS1uUlTestSuite::EpcS1uUlTestSuite ()
472  : TestSuite ("epc-s1u-uplink", SYSTEM)
473 {
474  std::vector<EnbUlTestData> v1;
475  EnbUlTestData e1;
476  UeUlTestData f1 (1, 100, 1, 1);
477  e1.ues.push_back (f1);
478  v1.push_back (e1);
479  AddTestCase (new EpcS1uUlTestCase ("1 eNB, 1UE", v1), TestCase::QUICK);
480 
481 
482  std::vector<EnbUlTestData> v2;
483  EnbUlTestData e2;
484  UeUlTestData f2_1 (1, 100, 1, 1);
485  e2.ues.push_back (f2_1);
486  UeUlTestData f2_2 (2, 200, 2, 1);
487  e2.ues.push_back (f2_2);
488  v2.push_back (e2);
489  AddTestCase (new EpcS1uUlTestCase ("1 eNB, 2UEs", v2), TestCase::QUICK);
490 
491 
492  std::vector<EnbUlTestData> v3;
493  v3.push_back (e1);
494  v3.push_back (e2);
495  AddTestCase (new EpcS1uUlTestCase ("2 eNBs", v3), TestCase::QUICK);
496 
497 
498  EnbUlTestData e3;
499  UeUlTestData f3_1 (3, 50, 1, 1);
500  e3.ues.push_back (f3_1);
501  UeUlTestData f3_2 (5, 1472, 2, 1);
502  e3.ues.push_back (f3_2);
503  UeUlTestData f3_3 (1, 1, 3, 1);
504  e3.ues.push_back (f3_2);
505  std::vector<EnbUlTestData> v4;
506  v4.push_back (e3);
507  v4.push_back (e1);
508  v4.push_back (e2);
509  AddTestCase (new EpcS1uUlTestCase ("3 eNBs", v4), TestCase::QUICK);
510 
511  std::vector<EnbUlTestData> v5;
512  EnbUlTestData e5;
513  UeUlTestData f5 (10, 3000, 1, 1);
514  e5.ues.push_back (f5);
515  v5.push_back (e5);
516  AddTestCase (new EpcS1uUlTestCase ("1 eNB, 10 pkts 3000 bytes each", v5), TestCase::QUICK);
517 
518  std::vector<EnbUlTestData> v6;
519  EnbUlTestData e6;
520  UeUlTestData f6 (50, 3000, 1, 1);
521  e6.ues.push_back (f6);
522  v6.push_back (e6);
523  AddTestCase (new EpcS1uUlTestCase ("1 eNB, 50 pkts 3000 bytes each", v6), TestCase::QUICK);
524 
525  std::vector<EnbUlTestData> v7;
526  EnbUlTestData e7;
527  UeUlTestData f7 (10, 15000, 1, 1);
528  e7.ues.push_back (f7);
529  v7.push_back (e7);
530  AddTestCase (new EpcS1uUlTestCase ("1 eNB, 10 pkts 15000 bytes each", v7), TestCase::QUICK);
531 
532  std::vector<EnbUlTestData> v8;
533  EnbUlTestData e8;
534  UeUlTestData f8 (100, 15000, 1, 1);
535  e8.ues.push_back (f8);
536  v8.push_back (e8);
537  AddTestCase (new EpcS1uUlTestCase ("1 eNB, 100 pkts 15000 bytes each", v8), TestCase::QUICK);
538 
539 }
540 
541 
542 
543 } // namespace ns3
544 
holds a vector of ns3::Application pointers.
uint32_t AddApplication(Ptr< Application > application)
Definition: node.cc:148
keep track of time unit.
Definition: nstime.h:149
an Inet address class
static Ipv4Address GetAny(void)
Hold a bool native type.
Definition: boolean.h:38
ArpCache::Entry * Add(Ipv4Address to)
Add an Ipv4Address to this ARP cache.
Definition: arp-cache.cc:258
holds a vector of std::pair of Ptr<Ipv4> and interface index.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
NetDeviceContainer Install(NodeContainer c)
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:210
void Add(ApplicationContainer other)
Append the contents of another ApplicationContainer to the end of this container. ...
A suite of tests to run.
Definition: test.h:962
static Ptr< EpcTft > Default()
Definition: epc-tft.cc:141
#define NS_ASSERT(condition)
Definition: assert.h:64
static void Run(void)
Definition: simulator.cc:157
#define NS_LOG_COMPONENT_DEFINE(name)
Definition: log.h:122
aggregate IP/TCP/UDP functionality to existing Nodes.
NetDeviceContainer Install(Ptr< Node > node) const
Definition: csma-helper.cc:215
#define NS_LOG_INFO(msg)
Definition: log.h:264
A helper to make it easier to instantiate an ns3::PacketSinkApplication on a set of nodes...
static void Cancel(const EventId &id)
Definition: simulator.cc:267
#define NS_LOG_FUNCTION_NOARGS()
Definition: log.h:275
Build a set of PointToPointNetDevice objects.
encapsulates test code
Definition: test.h:834
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Definition: simulator.h:820
virtual void StopApplication(void)
Application specific shutdown code.
void SetDeviceAttribute(std::string name, const AttributeValue &value)
uint32_t GetN(void) const
Get the number of Ptr<Node> stored in this container.
uint32_t GetN(void) const
Get the number of Ptr<NetDevice> stored in this container.
Class for representing data rates.
Definition: data-rate.h:71
virtual void DoRun(void)
Implementation to actually run this test case.
Ptr< Application > GetApplication(uint32_t index) const
Definition: node.cc:159
void SetRemote(Ipv4Address ip, uint16_t port)
set the remote address and port
The base class for all ns3 applications.
Definition: application.h:61
hold objects of type ns3::Time
Definition: nstime.h:700
void MarkWaitReply(Ptr< Packet > waiting)
Definition: arp-cache.cc:334
Hold an unsigned integer type.
Definition: uinteger.h:46
holds a vector of ns3::NetDevice pointers
Ptr< Node > GetNode() const
Definition: application.cc:103
static Mac48Address GetBroadcast(void)
void SetRecvCallback(Callback< void, Ptr< Socket > >)
Notify application when new data is available to be read.
Definition: socket.cc:127
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
Definition: socket.cc:70
void Start(Time start)
Arrange for all of the Applications in this container to Start() at the Time given as a parameter...
static void Destroy(void)
Definition: simulator.cc:121
Packet header for Udp client/server application The header is made of a 32bits sequence number follow...
Definition: seq-ts-header.h:35
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
Access to the Ipv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:75
virtual void DoDispose(void)
Definition: application.cc:82
void SetDefault(std::string name, const AttributeValue &value)
Definition: config.cc:667
Implement the Ipv4 layer.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
keep track of a set of node pointers.
Ptr< Application > Get(uint32_t i) const
Get the Ptr<Application> stored in this container at a given index.
void MarkAlive(Address macAddress)
Definition: arp-cache.cc:307
Callback< R > MakeNullCallback(void)
Definition: callback.h:781
void Install(std::string nodeName) const
A record that that holds information about an ArpCache entry.
Definition: arp-cache.h:116
hold objects of type ns3::Ipv4Address
static Time Now(void)
Definition: simulator.cc:179
void AddTestCase(TestCase *testCase) NS_DEPRECATED
Add an individual test case to this test suite.
Definition: test.cc:172
build a set of CsmaNetDevice objects
Definition: csma-helper.h:46
#define NS_ASSERT_MSG(condition, message)
Definition: assert.h:86
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:38
void Stop(Time stop)
Arrange for all of the Applications in this container to Stop() at the Time given as a parameter...
Ipv4InterfaceContainer Assign(const NetDeviceContainer &c)
Assign IP addresses to the net devices specified in the container based on the current network prefix...
Time Seconds(double seconds)
create ns3::Time instances in units of seconds.
Definition: nstime.h:586
void Add(NodeContainer other)
Append the contents of another NodeContainer to the end of this container.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
an identifier for simulation events.
Definition: event-id.h:46
Helper class that adds ns3::Ipv4StaticRouting objects.
hold objects of type ns3::DataRate
Ptr< Node > Get(uint32_t i) const
Get the Ptr<Node> stored in this container at a given index.
void SetSeq(uint32_t seq)
ApplicationContainer Install(NodeContainer c) const
A helper class to make life easier while doing simple IPv4 address assignment in scripts.
void Create(uint32_t n)
Create n nodes and append pointers to them to the end of this NodeContainer.
Receive and consume traffic generated to an IP address and port.
Definition: packet-sink.h:68
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
bool IsExpired(void) const
Definition: event-id.cc:53
Ptr< T > GetObject(void) const
Definition: object.h:332
a unique identifier for an interface.
Definition: type-id.h:44
TypeId SetParent(TypeId tid)
Definition: type-id.cc:471
void SetBase(Ipv4Address network, Ipv4Mask mask, Ipv4Address base="0.0.0.1")
Set the base network number, network mask and base address.
virtual void StartApplication(void)
Application specific startup code.
static TypeId LookupByName(std::string name)
Definition: type-id.cc:415
Ipv4Address GetAddress(uint32_t i, uint32_t j=0) const