A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
dhcp-client.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2011 UPB
3 * Copyright (c) 2017 NITK Surathkal
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: Radu Lupu <rlupu@elcom.pub.ro>
19 * Ankit Deepak <adadeepak8@gmail.com>
20 * Deepti Rajagopal <deeptir96@gmail.com>
21 *
22 *
23 */
24
25#include "dhcp-client.h"
26
27#include "dhcp-header.h"
28
29#include "ns3/ipv4-routing-table-entry.h"
30#include "ns3/ipv4-static-routing-helper.h"
31#include "ns3/ipv4.h"
32#include "ns3/log.h"
33#include "ns3/pointer.h"
34#include "ns3/random-variable-stream.h"
35#include "ns3/string.h"
36
37namespace ns3
38{
39
40NS_LOG_COMPONENT_DEFINE("DhcpClient");
42
43TypeId
45{
46 static TypeId tid =
47 TypeId("ns3::DhcpClient")
49 .AddConstructor<DhcpClient>()
50 .SetGroupName("Internet-Apps")
51 .AddAttribute("RTRS",
52 "Time for retransmission of Discover message",
56 .AddAttribute("Collect",
57 "Time for which offer collection starts",
61 .AddAttribute("ReRequest",
62 "Time after which request will be resent to next server",
63 TimeValue(Seconds(10)),
66 .AddAttribute("Transactions",
67 "The possible value of transaction numbers",
68 StringValue("ns3::UniformRandomVariable[Min=0.0|Max=1000000.0]"),
70 MakePointerChecker<RandomVariableStream>())
71 .AddTraceSource("NewLease",
72 "Get a NewLease",
74 "ns3::Ipv4Address::TracedCallback")
75 .AddTraceSource("ExpireLease",
76 "A lease expires",
78 "ns3::Ipv4Address::TracedCallback");
79 return tid;
80}
81
83{
84 NS_LOG_FUNCTION(this);
86 m_socket = nullptr;
94 m_firstBoot = true;
95}
96
98{
99 NS_LOG_FUNCTION(this << netDevice);
100 m_device = netDevice;
102 m_socket = nullptr;
108 m_timeout = EventId();
110 m_firstBoot = true;
111}
112
114{
115 NS_LOG_FUNCTION(this);
116}
117
120{
121 return m_device;
122}
123
124void
126{
127 m_device = netDevice;
128}
129
132{
133 return m_server;
134}
135
136void
138{
139 NS_LOG_FUNCTION(this);
140
141 m_device = nullptr;
142
143 // Stop all the timers
151
153}
154
155int64_t
157{
158 NS_LOG_FUNCTION(this << stream);
159 m_ran->SetStream(stream);
160 return 1;
161}
162
163void
165{
166 NS_LOG_FUNCTION(this);
167
168 m_remoteAddress = Ipv4Address("255.255.255.255");
169 m_myAddress = Ipv4Address("0.0.0.0");
170 m_gateway = Ipv4Address("0.0.0.0");
171 Ptr<Ipv4> ipv4 = GetNode()->GetObject<Ipv4>();
172 uint32_t ifIndex = ipv4->GetInterfaceForDevice(m_device);
173
174 // We need to cleanup the type from the stored chaddr, or later we'll fail to compare it.
175 // Moreover, the length is always 16, because chaddr is 16 bytes.
176 Address myAddress = m_device->GetAddress();
177 NS_LOG_INFO("My address is " << myAddress);
178 uint8_t addr[Address::MAX_SIZE];
179 std::memset(addr, 0, Address::MAX_SIZE);
180 uint32_t len = myAddress.CopyTo(addr);
181 NS_ASSERT_MSG(len <= 16, "DHCP client can not handle a chaddr larger than 16 bytes");
182 m_chaddr.CopyFrom(addr, 16);
183 NS_LOG_INFO("My m_chaddr is " << m_chaddr);
184
185 bool found = false;
186 for (uint32_t i = 0; i < ipv4->GetNAddresses(ifIndex); i++)
187 {
188 if (ipv4->GetAddress(ifIndex, i).GetLocal() == m_myAddress)
189 {
190 found = true;
191 }
192 }
193 if (!found)
194 {
195 ipv4->AddAddress(ifIndex, Ipv4InterfaceAddress(Ipv4Address("0.0.0.0"), Ipv4Mask("/0")));
196 }
197 if (!m_socket)
198 {
199 TypeId tid = TypeId::LookupByName("ns3::UdpSocketFactory");
204 m_socket->Bind(local);
205 }
207
208 if (m_firstBoot)
209 {
210 m_device->AddLinkChangeCallback(MakeCallback(&DhcpClient::LinkStateHandler, this));
211 m_firstBoot = false;
212 }
213 Boot();
214}
215
216void
218{
219 NS_LOG_FUNCTION(this);
220
221 // Stop all the timers
229
230 Ptr<Ipv4> ipv4 = GetNode()->GetObject<Ipv4>();
231
232 int32_t ifIndex = ipv4->GetInterfaceForDevice(m_device);
233 for (uint32_t i = 0; i < ipv4->GetNAddresses(ifIndex); i++)
234 {
235 if (ipv4->GetAddress(ifIndex, i).GetLocal() == m_myAddress)
236 {
237 ipv4->RemoveAddress(ifIndex, i);
238 break;
239 }
240 }
241
243 m_socket->Close();
244}
245
246void
248{
249 NS_LOG_FUNCTION(this);
250
251 if (m_device->IsLinkUp())
252 {
253 NS_LOG_INFO("Link up at " << Simulator::Now().As(Time::S));
256 }
257 else
258 {
259 NS_LOG_INFO("Link down at " << Simulator::Now().As(Time::S)); // reinitialization
260
261 // Stop all the timers
269
271 MakeNullCallback<void, Ptr<Socket>>()); // stop receiving on this socket !!!
272
273 Ptr<Ipv4> ipv4MN = GetNode()->GetObject<Ipv4>();
274 int32_t ifIndex = ipv4MN->GetInterfaceForDevice(m_device);
275
276 for (uint32_t i = 0; i < ipv4MN->GetNAddresses(ifIndex); i++)
277 {
278 if (ipv4MN->GetAddress(ifIndex, i).GetLocal() == m_myAddress)
279 {
280 ipv4MN->RemoveAddress(ifIndex, i);
281 break;
282 }
283 }
284
285 Ipv4StaticRoutingHelper ipv4RoutingHelper;
286 Ptr<Ipv4StaticRouting> staticRouting = ipv4RoutingHelper.GetStaticRouting(ipv4MN);
287 uint32_t i;
288 for (i = 0; i < staticRouting->GetNRoutes(); i++)
289 {
290 if (staticRouting->GetRoute(i).GetGateway() == m_gateway)
291 {
292 staticRouting->RemoveRoute(i);
293 break;
294 }
295 }
296
297 m_state = 0;
298 m_myAddress = Ipv4Address("0.0.0.0");
299 m_gateway = Ipv4Address("0.0.0.0");
300 }
301}
302
303void
305{
306 NS_LOG_FUNCTION(this << socket);
307
308 Address from;
309 Ptr<Packet> packet = m_socket->RecvFrom(from);
310 DhcpHeader header;
311 if (packet->RemoveHeader(header) == 0)
312 {
313 return;
314 }
315 if (header.GetChaddr() != m_chaddr)
316 {
317 return;
318 }
319 if (m_state == WAIT_OFFER && header.GetType() == DhcpHeader::DHCPOFFER)
320 {
321 OfferHandler(header);
322 }
323 if (m_state == WAIT_ACK && header.GetType() == DhcpHeader::DHCPACK)
324 {
326 AcceptAck(header, from);
327 }
328 if (m_state == WAIT_ACK && header.GetType() == DhcpHeader::DHCPNACK)
329 {
331 Boot();
332 }
333}
334
335void
337{
338 NS_LOG_FUNCTION(this);
339
340 DhcpHeader header;
341 Ptr<Packet> packet;
342 packet = Create<Packet>();
343 header.ResetOpt();
345 header.SetTran(m_tran);
347 header.SetTime();
348 header.SetChaddr(m_chaddr);
349 packet->AddHeader(header);
350
351 if ((m_socket->SendTo(packet,
352 0,
353 InetSocketAddress(Ipv4Address("255.255.255.255"), DHCP_PEER_PORT))) >= 0)
354 {
355 NS_LOG_INFO("DHCP DISCOVER sent");
356 }
357 else
358 {
359 NS_LOG_INFO("Error while sending DHCP DISCOVER to " << m_remoteAddress);
360 }
362 m_offered = false;
364}
365
366void
368{
369 NS_LOG_FUNCTION(this << header);
370
371 m_offerList.push_back(header);
372 if (!m_offered)
373 {
375 m_offered = true;
377 }
378}
379
380void
382{
383 NS_LOG_FUNCTION(this);
384
385 if (m_offerList.empty())
386 {
387 Boot();
388 return;
389 }
390
391 DhcpHeader header = m_offerList.front();
392 m_offerList.pop_front();
393 m_lease = Time(Seconds(header.GetLease()));
394 m_renew = Time(Seconds(header.GetRenew()));
395 m_rebind = Time(Seconds(header.GetRebind()));
396 m_offeredAddress = header.GetYiaddr();
397 m_myMask = Ipv4Mask(header.GetMask());
398 m_server = header.GetDhcps();
399 m_gateway = header.GetRouter();
400 m_offerList.clear();
401 m_offered = false;
402 Request();
403}
404
405void
407{
408 NS_LOG_FUNCTION(this);
409
410 DhcpHeader header;
411 Ptr<Packet> packet;
412 if (m_state != REFRESH_LEASE)
413 {
414 packet = Create<Packet>();
415 header.ResetOpt();
417 header.SetTime();
418 header.SetTran(m_tran);
419 header.SetReq(m_offeredAddress);
420 header.SetChaddr(m_chaddr);
421 packet->AddHeader(header);
422 m_socket->SendTo(packet,
423 0,
424 InetSocketAddress(Ipv4Address("255.255.255.255"), DHCP_PEER_PORT));
427 }
428 else
429 {
430 uint32_t addr = m_myAddress.Get();
431 packet = Create<Packet>((uint8_t*)&addr, sizeof(addr));
432 header.ResetOpt();
434 header.SetTran(m_tran);
435 header.SetTime();
437 header.SetReq(m_myAddress);
439 header.SetChaddr(m_chaddr);
440 packet->AddHeader(header);
442 {
443 NS_LOG_INFO("DHCP REQUEST sent");
444 }
445 else
446 {
447 NS_LOG_INFO("Error while sending DHCP REQ to " << m_remoteAddress);
448 }
450 }
451}
452
453void
455{
456 NS_LOG_FUNCTION(this << header << from);
457
461
462 NS_LOG_INFO("DHCP ACK received");
463 Ptr<Ipv4> ipv4 = GetNode()->GetObject<Ipv4>();
464 int32_t ifIndex = ipv4->GetInterfaceForDevice(m_device);
465
467 {
468 for (uint32_t i = 0; i < ipv4->GetNAddresses(ifIndex); i++)
469 {
470 if (ipv4->GetAddress(ifIndex, i).GetLocal() == m_myAddress)
471 {
472 NS_LOG_LOGIC("Got a new address (" << m_offeredAddress
473 << "), removing old one: " << m_myAddress);
474 ipv4->RemoveAddress(ifIndex, i);
475 break;
476 }
477 }
478
479 ipv4->AddAddress(ifIndex, Ipv4InterfaceAddress(m_offeredAddress, m_myMask));
480 ipv4->SetUp(ifIndex);
481 }
482
483 InetSocketAddress remote =
485 m_socket->Connect(remote);
487 {
489 if (m_myAddress != Ipv4Address("0.0.0.0"))
490 {
492 }
493 }
495 Ipv4StaticRoutingHelper ipv4RoutingHelper;
496 Ptr<Ipv4StaticRouting> staticRouting = ipv4RoutingHelper.GetStaticRouting(ipv4);
497 if (m_gateway == Ipv4Address("0.0.0.0"))
498 {
500 }
501
502 staticRouting->SetDefaultRoute(m_gateway, ifIndex, 0);
503
505 NS_LOG_INFO("Current DHCP Server is " << m_remoteAddress);
506
507 m_offerList.clear();
512}
513
514void
516{
517 NS_LOG_FUNCTION(this);
518
523
524 Ptr<Ipv4> ipv4MN = GetNode()->GetObject<Ipv4>();
525 int32_t ifIndex = ipv4MN->GetInterfaceForDevice(m_device);
526
527 for (uint32_t i = 0; i < ipv4MN->GetNAddresses(ifIndex); i++)
528 {
529 if (ipv4MN->GetAddress(ifIndex, i).GetLocal() == m_myAddress)
530 {
531 ipv4MN->RemoveAddress(ifIndex, i);
532 break;
533 }
534 }
536 Ipv4StaticRoutingHelper ipv4RoutingHelper;
537 Ptr<Ipv4StaticRouting> staticRouting = ipv4RoutingHelper.GetStaticRouting(ipv4MN);
538 uint32_t i;
539 for (i = 0; i < staticRouting->GetNRoutes(); i++)
540 {
541 if (staticRouting->GetRoute(i).GetGateway() == m_gateway)
542 {
543 staticRouting->RemoveRoute(i);
544 break;
545 }
546 }
548}
549
550} // Namespace ns3
a polymophic address class
Definition: address.h:101
uint32_t CopyFrom(const uint8_t *buffer, uint8_t len)
Definition: address.cc:106
static constexpr uint32_t MAX_SIZE
The maximum size of a byte buffer which can be stored in an Address instance.
Definition: address.h:107
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
Definition: address.cc:86
The base class for all ns3 applications.
Definition: application.h:62
void DoDispose() override
Destructor implementation.
Definition: application.cc:86
Ptr< Node > GetNode() const
Definition: application.cc:108
EventId m_requestEvent
Address refresh event.
Definition: dhcp-client.h:158
Ipv4Address m_gateway
Address of the gateway.
Definition: dhcp-client.h:157
static TypeId GetTypeId()
Get the type ID.
Definition: dhcp-client.cc:44
Ipv4Mask m_myMask
Mask of the address assigned.
Definition: dhcp-client.h:155
Time m_rebind
Store the rebind time of address.
Definition: dhcp-client.h:167
void SetDhcpClientNetDevice(Ptr< NetDevice > netDevice)
Set the NetDevice DHCP should work on.
Definition: dhcp-client.cc:125
void LinkStateHandler()
Handles changes in LinkState.
Definition: dhcp-client.cc:247
void DoDispose() override
Destructor implementation.
Definition: dhcp-client.cc:137
uint32_t m_tran
Stores the current transaction number to be used.
Definition: dhcp-client.h:174
void RemoveAndStart()
Remove the current DHCP information and restart the process.
Definition: dhcp-client.cc:515
Ptr< Socket > m_socket
Socket for remote communication.
Definition: dhcp-client.h:150
bool m_firstBoot
First boot (used to add the link state change callback)
Definition: dhcp-client.h:148
Time m_collect
Time for which client should collect offers.
Definition: dhcp-client.h:171
Address m_chaddr
chaddr of the interface (stored as an Address for convenience).
Definition: dhcp-client.h:154
@ WAIT_OFFER
State of a client that waits for the offer.
Definition: dhcp-client.h:95
@ WAIT_ACK
State of a client that waits for acknowledgment.
Definition: dhcp-client.h:97
@ REFRESH_LEASE
State of a client that needs to refresh the lease.
Definition: dhcp-client.h:96
void StopApplication() override
Application specific shutdown code.
Definition: dhcp-client.cc:217
Ptr< NetDevice > m_device
NetDevice pointer.
Definition: dhcp-client.h:149
EventId m_timeout
The timeout period.
Definition: dhcp-client.h:163
Ptr< RandomVariableStream > m_ran
Uniform random variable for transaction ID.
Definition: dhcp-client.h:169
EventId m_rebindEvent
Message rebind event.
Definition: dhcp-client.h:161
static const int DHCP_PEER_PORT
DHCP server port.
Definition: dhcp-client.h:100
std::list< DhcpHeader > m_offerList
Stores all the offers given to the client.
Definition: dhcp-client.h:173
Ptr< NetDevice > GetDhcpClientNetDevice()
Get the the NetDevice DHCP should work on.
Definition: dhcp-client.cc:119
Ipv4Address m_server
Address of the DHCP server.
Definition: dhcp-client.h:156
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this Application object.
Definition: dhcp-client.cc:156
EventId m_nextOfferEvent
Message next offer event.
Definition: dhcp-client.h:162
void StartApplication() override
Application specific startup code.
Definition: dhcp-client.cc:164
void Boot()
Sends DHCP DISCOVER and changes the client state to WAIT_OFFER.
Definition: dhcp-client.cc:336
bool m_offered
Specify if the client has got any offer.
Definition: dhcp-client.h:172
void OfferHandler(DhcpHeader header)
Stores DHCP offers in m_offerList.
Definition: dhcp-client.cc:367
void Request()
Sends the DHCP REQUEST message and changes the client state to WAIT_ACK.
Definition: dhcp-client.cc:406
TracedCallback< const Ipv4Address & > m_expiry
Trace of lease expire.
Definition: dhcp-client.h:176
TracedCallback< const Ipv4Address & > m_newLease
Trace of new lease.
Definition: dhcp-client.h:175
Ipv4Address GetDhcpServer()
Get the IPv4Address of current DHCP server.
Definition: dhcp-client.cc:131
uint8_t m_state
State of the DHCP client.
Definition: dhcp-client.h:147
EventId m_discoverEvent
Message retransmission event.
Definition: dhcp-client.h:159
EventId m_refreshEvent
Message refresh event.
Definition: dhcp-client.h:160
Ipv4Address m_myAddress
Address assigned to the client.
Definition: dhcp-client.h:153
Time m_rtrs
Defining the time for retransmission.
Definition: dhcp-client.h:170
~DhcpClient() override
Definition: dhcp-client.cc:113
void Select()
Selects an OFFER from m_offerList.
Definition: dhcp-client.cc:381
Time m_nextoffer
Time to try the next offer (if request gets no reply)
Definition: dhcp-client.h:168
Ipv4Address m_remoteAddress
Initially set to 255.255.255.255 to start DHCP.
Definition: dhcp-client.h:151
void NetHandler(Ptr< Socket > socket)
Handles incoming packets from the network.
Definition: dhcp-client.cc:304
void AcceptAck(DhcpHeader header, Address from)
Receives the DHCP ACK and configures IP address of the client.
Definition: dhcp-client.cc:454
Ipv4Address m_offeredAddress
Address offered to the client.
Definition: dhcp-client.h:152
Time m_renew
Store the renew time of address.
Definition: dhcp-client.h:166
EventId m_collectEvent
Offer collection event.
Definition: dhcp-client.h:164
Time m_lease
Store the lease time of address.
Definition: dhcp-client.h:165
BOOTP header with DHCP messages supports the following options: Subnet Mask (1), Address Request (50)...
Definition: dhcp-header.h:85
uint32_t GetLease() const
Return the lease time of the IPv4Address.
Definition: dhcp-header.cc:234
void SetTime()
Set the time when message is sent.
Definition: dhcp-header.cc:113
void ResetOpt()
Reset the BOOTP options.
Definition: dhcp-header.cc:274
Ipv4Address GetRouter() const
Return the Ipv4Address of gateway to be used.
Definition: dhcp-header.cc:217
void SetType(uint8_t type)
Set the type of BOOTP and DHCP messages.
Definition: dhcp-header.cc:76
@ DHCPACK
Code for DHCP ACK.
Definition: dhcp-header.h:123
@ DHCPOFFER
Code for DHCP Offer.
Definition: dhcp-header.h:121
@ DHCPDISCOVER
Code for DHCP Discover.
Definition: dhcp-header.h:120
@ DHCPREQ
Code for DHCP Request.
Definition: dhcp-header.h:122
@ DHCPNACK
Code for DHCP NACK.
Definition: dhcp-header.h:124
void SetTran(uint32_t tran)
Set the transaction ID.
Definition: dhcp-header.cc:101
Address GetChaddr()
Get the Address of the client.
Definition: dhcp-header.cc:135
Ipv4Address GetDhcps() const
Get the information about the DHCP server.
Definition: dhcp-header.cc:166
uint32_t GetMask() const
Return the mask of the network.
Definition: dhcp-header.cc:200
uint8_t GetType() const
Return the type of DHCP message.
Definition: dhcp-header.cc:88
void SetReq(Ipv4Address addr)
Set the Ipv4Address requested by the client.
Definition: dhcp-header.cc:172
Ipv4Address GetYiaddr() const
Get the IPv4Address of the client.
Definition: dhcp-header.cc:149
uint32_t GetRebind() const
Return the Rebind time of the address.
Definition: dhcp-header.cc:268
void SetChaddr(Address addr)
Set the Address of the device.
Definition: dhcp-header.cc:119
uint32_t GetRenew() const
Return the Renewal time of the address.
Definition: dhcp-header.cc:251
An identifier for simulation events.
Definition: event-id.h:55
void Cancel()
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:55
an Inet address class
Ipv4Address GetIpv4() const
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:42
uint32_t Get() const
Get the host-order 32-bit IP address.
static Ipv4Address GetAny()
Access to the IPv4 forwarding table, interfaces, and configuration.
Definition: ipv4.h:80
a class to store IPv4 address information on an interface
a class to represent an Ipv4 address mask
Definition: ipv4-address.h:257
Helper class that adds ns3::Ipv4StaticRouting objects.
Ptr< Ipv4StaticRouting > GetStaticRouting(Ptr< Ipv4 > ipv4) const
Try and find the static routing protocol as either the main routing protocol or in the list of routin...
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
Definition: object.h:522
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
virtual double GetValue()=0
Get the next random value drawn from the distribution.
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:571
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:208
virtual Ptr< Packet > RecvFrom(uint32_t maxSize, uint32_t flags, Address &fromAddress)=0
Read a single packet from the socket and retrieve the sender address.
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
virtual void BindToNetDevice(Ptr< NetDevice > netdevice)
Bind a socket to specific device.
Definition: socket.cc:327
void SetRecvCallback(Callback< void, Ptr< Socket > > receivedData)
Notify application when new data is available to be read.
Definition: socket.cc:128
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition: socket.cc:72
virtual int Close()=0
Close a socket.
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
virtual int SendTo(Ptr< Packet > p, uint32_t flags, const Address &toAddress)=0
Send data to a specified peer.
Hold variables of type string.
Definition: string.h:56
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
@ S
second
Definition: nstime.h:116
AttributeValue implementation for Time.
Definition: nstime.h:1413
a unique identifier for an interface.
Definition: type-id.h:59
static TypeId LookupByName(std::string name)
Get a TypeId by name.
Definition: type-id.cc:836
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:932
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Definition: pointer.h:259
Ptr< const AttributeChecker > MakeTimeChecker()
Helper to make an unbounded Time checker.
Definition: nstime.h:1434
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Definition: nstime.h:1414
Callback< R, Args... > MakeNullCallback()
Definition: callback.h:747
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1326
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:704