INET Framework for OMNeT++/OMNEST
inet::DhcpClient Class Reference

Implements a DHCP client. More...

#include <DhcpClient.h>

Inheritance diagram for inet::DhcpClient:
inet::ApplicationBase inet::UdpSocket::ICallback inet::OperationalBase inet::OperationalMixin< cSimpleModule > inet::ILifecycle

Public Member Functions

 DhcpClient ()
 
virtual ~DhcpClient ()
 
- Public Member Functions inherited from inet::ApplicationBase
 ApplicationBase ()
 
- Public Member Functions inherited from inet::OperationalMixin< cSimpleModule >
virtual ~OperationalMixin ()
 }@ More...
 
- Public Member Functions inherited from inet::ILifecycle
virtual ~ILifecycle ()
 
- Public Member Functions inherited from inet::UdpSocket::ICallback
virtual ~ICallback ()
 

Protected Types

enum  ClientState {
  IDLE, INIT, INIT_REBOOT, REBOOTING,
  SELECTING, REQUESTING, BOUND, RENEWING,
  REBINDING
}
 
- Protected Types inherited from inet::OperationalMixin< cSimpleModule >
enum  State
 

Protected Member Functions

virtual int numInitStages () const override
 
virtual void initialize (int stage) override
 
virtual void finish () override
 
virtual void handleMessageWhenUp (cMessage *msg) override
 
virtual void scheduleTimerTO (DhcpTimerType type)
 
virtual void scheduleTimerT1 ()
 
virtual void scheduleTimerT2 ()
 
const char * getAndCheckMessageTypeName (DhcpMessageType type)
 
virtual void refreshDisplay () const override
 
virtual void openSocket ()
 
virtual void handleDhcpMessage (Packet *packet)
 
virtual void handleTimer (cMessage *msg)
 
virtual void receiveSignal (cComponent *source, simsignal_t signalID, cObject *obj, cObject *details) override
 
virtual void sendToUdp (Packet *msg, int srcPort, const L3Address &destAddr, int destPort)
 
virtual void sendDiscover ()
 
virtual void sendRequest ()
 
virtual void sendDecline (Ipv4Address declinedIp)
 
virtual void recordLease (const Ptr< const DhcpMessage > &dhcpACK)
 
virtual void recordOffer (const Ptr< const DhcpMessage > &dhcpOffer)
 
virtual void bindLease ()
 
virtual void unbindLease ()
 
virtual void initClient ()
 
virtual void initRebootedClient ()
 
virtual void handleDhcpAck (const Ptr< const DhcpMessage > &msg)
 
virtual NetworkInterfacechooseInterface ()
 
virtual void socketDataArrived (UdpSocket *socket, Packet *packet) override
 Notifies about data arrival, packet ownership is transferred to the callee. More...
 
virtual void socketErrorArrived (UdpSocket *socket, Indication *indication) override
 Notifies about error indication arrival, indication ownership is transferred to the callee. More...
 
virtual void socketClosed (UdpSocket *socket) override
 Notifies about socket closed, indication ownership is transferred to the callee. More...
 
virtual void handleStartOperation (LifecycleOperation *operation) override
 
virtual void handleStopOperation (LifecycleOperation *operation) override
 
virtual void handleCrashOperation (LifecycleOperation *operation) override
 
- Protected Member Functions inherited from inet::ApplicationBase
virtual bool isInitializeStage (int stage) const override
 
virtual bool isModuleStartStage (int stage) const override
 
virtual bool isModuleStopStage (int stage) const override
 
- Protected Member Functions inherited from inet::OperationalMixin< cSimpleModule >
virtual int numInitStages () const override
 
virtual void refreshDisplay () const override
 
virtual void handleMessage (cMessage *msg) override
 
virtual void handleMessageWhenDown (cMessage *msg)
 
virtual bool handleOperationStage (LifecycleOperation *operation, IDoneCallback *doneCallback) override
 Perform one stage of a lifecycle operation. More...
 
virtual State getInitialOperationalState () const
 Returns initial operational state: OPERATING or NOT_OPERATING. More...
 
virtual void handleActiveOperationTimeout (cMessage *message)
 
virtual bool isUp () const
 utility functions More...
 
virtual bool isDown () const
 
virtual void setOperationalState (State newState)
 
virtual void scheduleOperationTimeout (simtime_t timeout)
 
virtual void setupActiveOperation (LifecycleOperation *operation, IDoneCallback *doneCallback, State)
 
virtual void delayActiveOperationFinish (simtime_t timeout)
 
virtual void startActiveOperationExtraTime (simtime_t delay=SIMTIME_ZERO)
 
virtual void startActiveOperationExtraTimeOrFinish (simtime_t extraTime)
 
virtual void finishActiveOperation ()
 

Static Protected Member Functions

static const char * getStateName (ClientState state)
 

Protected Attributes

int serverPort = -1
 
int clientPort = -1
 
UdpSocket socket
 
simtime_t startTime
 
MacAddress macAddress
 
cModule * host = nullptr
 
NetworkInterfaceie = nullptr
 
ModuleRefByPar< IIpv4RoutingTableirt
 
cMessage * timerT1 = nullptr
 
cMessage * timerT2 = nullptr
 
cMessage * timerTo = nullptr
 
cMessage * leaseTimer = nullptr
 
cMessage * startTimer = nullptr
 
ClientState clientState = INIT
 
unsigned int xid = 0
 
DhcpLeaselease = nullptr
 
Ipv4Routeroute = nullptr
 
int numSent = 0
 
int numReceived = 0
 
int responseTimeout = 0
 
- Protected Attributes inherited from inet::OperationalMixin< cSimpleModule >
State operationalState
 
simtime_t lastChange
 
Operation activeOperation
 
cMessage * activeOperationTimeout
 
cMessage * activeOperationExtraTimer
 

Detailed Description

Implements a DHCP client.

See NED file for more details.

Member Enumeration Documentation

◆ ClientState

Enumerator
IDLE 
INIT 
INIT_REBOOT 
REBOOTING 
SELECTING 
REQUESTING 
BOUND 
RENEWING 
REBINDING 

Constructor & Destructor Documentation

◆ DhcpClient()

inet::DhcpClient::DhcpClient ( )
inline
171 {}

◆ ~DhcpClient()

inet::DhcpClient::~DhcpClient ( )
virtual
22 {
23  cancelAndDelete(timerT1);
24  cancelAndDelete(timerTo);
25  cancelAndDelete(timerT2);
26  cancelAndDelete(leaseTimer);
27  cancelAndDelete(startTimer);
28  delete lease;
29 }

Member Function Documentation

◆ bindLease()

void inet::DhcpClient::bindLease ( )
protectedvirtual
309 {
310  auto ipv4Data = ie->getProtocolDataForUpdate<Ipv4InterfaceData>();
311  ipv4Data->setIPAddress(lease->ip);
312  ipv4Data->setNetmask(lease->subnetMask);
313 
314  std::string banner = "Got IP " + lease->ip.str();
315  host->bubble(banner.c_str());
316 
317  /*
318  The client SHOULD perform a final check on the parameters (ping, Arp).
319  If the client detects that the address is already in use:
320  EV_INFO << "The offered IP " << lease->ip << " is not available." << endl;
321  sendDecline(lease->ip);
322  initClient();
323  */
324 
325  EV_INFO << "The requested IP " << lease->ip << "/" << lease->subnetMask << " is available. Assigning it to "
326  << host->getFullName() << "." << endl;
327 
328  Ipv4Route *iroute = nullptr;
329  for (int i = 0; i < irt->getNumRoutes(); i++) {
330  Ipv4Route *e = irt->getRoute(i);
331  if (routeMatches(e, Ipv4Address(), Ipv4Address(), lease->gateway, 0, ie->getInterfaceName())) {
332  iroute = e;
333  break;
334  }
335  }
336  if (iroute == nullptr) {
337  // create gateway route
338  route = new Ipv4Route();
339  route->setDestination(Ipv4Address());
340  route->setNetmask(Ipv4Address());
344  irt->addRoute(route);
345  }
346 
347  // update the routing table
348  rescheduleAfter(lease->leaseTime, leaseTimer);
349 }

Referenced by handleDhcpAck().

◆ chooseInterface()

NetworkInterface * inet::DhcpClient::chooseInterface ( )
protectedvirtual
73 {
74  IInterfaceTable *ift = getModuleFromPar<IInterfaceTable>(par("interfaceTableModule"), this);
75  const char *interfaceName = par("interface");
76  NetworkInterface *ie = nullptr;
77 
78  if (strlen(interfaceName) > 0) {
79  ie = ift->findInterfaceByName(interfaceName);
80  if (ie == nullptr)
81  throw cRuntimeError("Interface \"%s\" does not exist", interfaceName);
82  }
83  else {
84  // there should be exactly one non-loopback interface that we want to configure
85  for (int i = 0; i < ift->getNumInterfaces(); i++) {
86  NetworkInterface *current = ift->getInterface(i);
87  if (!current->isLoopback()) {
88  if (ie)
89  throw cRuntimeError("Multiple non-loopback interfaces found, please select explicitly which one you want to configure via DHCP");
90  ie = current;
91  }
92  }
93  if (!ie)
94  throw cRuntimeError("No non-loopback interface found to be configured via DHCP");
95  }
96 
97  if (!ie->getProtocolData<Ipv4InterfaceData>()->getIPAddress().isUnspecified())
98  throw cRuntimeError("Refusing to start DHCP on interface \"%s\" that already has an IP address", ie->getInterfaceName());
99  return ie;
100 }

Referenced by handleStartOperation().

◆ finish()

void inet::DhcpClient::finish ( )
overrideprotectedvirtual
103 {
104  cancelEvent(timerT1);
105  cancelEvent(timerTo);
106  cancelEvent(timerT2);
107  cancelEvent(leaseTimer);
108  cancelEvent(startTimer);
109 }

◆ getAndCheckMessageTypeName()

const char * inet::DhcpClient::getAndCheckMessageTypeName ( DhcpMessageType  type)
protected
152 {
153  switch (type) {
154 #define CASE(X) case X: \
155  return #X;
157  CASE(DHCPOFFER);
158  CASE(DHCPREQUEST);
159  CASE(DHCPDECLINE);
160  CASE(DHCPACK);
161  CASE(DHCPNAK);
162  CASE(DHCPRELEASE);
163  CASE(DHCPINFORM);
164 
165  default:
166  throw cRuntimeError("Unknown or invalid DHCP message type %d", type);
167 #undef CASE
168  }
169 }

Referenced by handleDhcpMessage().

◆ getStateName()

const char * inet::DhcpClient::getStateName ( ClientState  state)
staticprotected
132 {
133  switch (state) {
134 #define CASE(X) case X: \
135  return #X;
136  CASE(INIT);
137  CASE(INIT_REBOOT);
138  CASE(REBOOTING);
139  CASE(SELECTING);
140  CASE(REQUESTING);
141  CASE(BOUND);
142  CASE(RENEWING);
143  CASE(REBINDING);
144 
145  default:
146  return "???";
147 #undef CASE
148  }
149 }

Referenced by refreshDisplay().

◆ handleCrashOperation()

void inet::DhcpClient::handleCrashOperation ( LifecycleOperation operation)
overrideprotectedvirtual

Implements inet::OperationalMixin< cSimpleModule >.

734 {
735  cancelEvent(timerT1);
736  cancelEvent(timerT2);
737  cancelEvent(timerTo);
738  cancelEvent(leaseTimer);
739  cancelEvent(startTimer);
740  ie = nullptr;
741 
742  if (operation->getRootModule() != getContainingNode(this)) // closes socket when the application crashed only
743  socket.destroy(); // TODO in real operating systems, program crash detected by OS and OS closes sockets of crashed programs.
744 }

◆ handleDhcpAck()

void inet::DhcpClient::handleDhcpAck ( const Ptr< const DhcpMessage > &  msg)
protectedvirtual
668 {
669  recordLease(msg);
670  cancelEvent(timerTo);
671  scheduleTimerT1();
672  scheduleTimerT2();
673  bindLease();
674 }

Referenced by handleDhcpMessage().

◆ handleDhcpMessage()

void inet::DhcpClient::handleDhcpMessage ( Packet packet)
protectedvirtual
387 {
388  ASSERT(isUp() && ie != nullptr);
389 
390  const auto& msg = packet->peekAtFront<DhcpMessage>();
391  if (msg->getOp() != BOOTREPLY) {
392  EV_WARN << "Client received a non-BOOTREPLY message, dropping." << endl;
393  return;
394  }
395 
396  if (msg->getXid() != xid) {
397  EV_WARN << "Message transaction ID is not valid, dropping." << endl;
398  return;
399  }
400 
401  DhcpMessageType messageType = msg->getOptions().getMessageType();
402  switch (clientState) {
403  case INIT:
404  EV_WARN << getAndCheckMessageTypeName(messageType) << " message arrived in INIT state. In this state, client does not wait for any message at all, dropping." << endl;
405  break;
406 
407  case SELECTING:
408  if (messageType == DHCPOFFER) {
409  EV_INFO << "DHCPOFFER message arrived in SELECTING state with IP address: " << msg->getYiaddr() << "." << endl;
412  recordOffer(msg);
413  sendRequest(); // we accept the first offer
414  }
415  else
416  EV_WARN << "Client is in SELECTING and the arriving packet is not a DHCPOFFER, dropping." << endl;
417  break;
418 
419  case REQUESTING:
420  if (messageType == DHCPOFFER) {
421  EV_WARN << "We don't accept DHCPOFFERs in REQUESTING state, dropping." << endl; // remains in REQUESTING
422  }
423  else if (messageType == DHCPACK) {
424  EV_INFO << "DHCPACK message arrived in REQUESTING state. The requested IP address is available in the server's pool of addresses." << endl;
425  handleDhcpAck(msg);
426  clientState = BOUND;
427  }
428  else if (messageType == DHCPNAK) {
429  EV_INFO << "DHCPNAK message arrived in REQUESTING state. Restarting the configuration process." << endl;
430  initClient();
431  }
432  else {
433  EV_WARN << getAndCheckMessageTypeName(messageType) << " message arrived in REQUESTING state. In this state, client does not expect messages of this type, dropping." << endl;
434  }
435  break;
436 
437  case BOUND:
438  EV_DETAIL << "We are in BOUND, discard all DHCP messages." << endl; // remain in BOUND
439  break;
440 
441  case RENEWING:
442  if (messageType == DHCPACK) {
443  handleDhcpAck(msg);
444  EV_INFO << "DHCPACK message arrived in RENEWING state. The renewing process was successful." << endl;
445  clientState = BOUND;
446  }
447  else if (messageType == DHCPNAK) {
448  EV_INFO << "DHPCNAK message arrived in RENEWING state. The renewing process was unsuccessful. Restarting the DHCP configuration process." << endl;
449  unbindLease();
450  initClient();
451  }
452  else {
453  EV_WARN << getAndCheckMessageTypeName(messageType) << " message arrived in RENEWING state. In this state, client does not expect messages of this type, dropping." << endl;
454  }
455  break;
456 
457  case REBINDING:
458  if (messageType == DHCPNAK) {
459  EV_INFO << "DHPCNAK message arrived in REBINDING state. The rebinding process was unsuccessful. Restarting the DHCP configuration process." << endl;
460  unbindLease();
461  initClient();
462  }
463  else if (messageType == DHCPACK) {
464  handleDhcpAck(msg);
465  EV_INFO << "DHCPACK message arrived in REBINDING state. The rebinding process was successful." << endl;
466  clientState = BOUND;
467  }
468  else {
469  EV_WARN << getAndCheckMessageTypeName(messageType) << " message arrived in REBINDING state. In this state, client does not expect messages of this type, dropping." << endl;
470  }
471  break;
472 
473  case REBOOTING:
474  if (messageType == DHCPACK) {
475  handleDhcpAck(msg);
476  EV_INFO << "DHCPACK message arrived in REBOOTING state. Initialization with known IP address was successful." << endl;
477  clientState = BOUND;
478  }
479  else if (messageType == DHCPNAK) {
480  EV_INFO << "DHCPNAK message arrived in REBOOTING. Initialization with known IP address was unsuccessful." << endl;
481  unbindLease();
482  initClient();
483  }
484  else {
485  EV_WARN << getAndCheckMessageTypeName(messageType) << " message arrived in REBOOTING state. In this state, client does not expect messages of this type, dropping." << endl;
486  }
487  break;
488 
489  default:
490  throw cRuntimeError("Unknown or invalid client state %d", clientState);
491  }
492 }

Referenced by socketDataArrived().

◆ handleMessageWhenUp()

void inet::DhcpClient::handleMessageWhenUp ( cMessage *  msg)
overrideprotectedvirtual

Implements inet::OperationalMixin< cSimpleModule >.

179 {
180  if (msg->isSelfMessage()) {
181  handleTimer(msg);
182  }
183  else if (msg->arrivedOn("socketIn")) {
184  socket.processMessage(msg);
185  }
186  else
187  throw cRuntimeError("Unknown incoming gate: '%s'", msg->getArrivalGate()->getFullName());
188 }

◆ handleStartOperation()

void inet::DhcpClient::handleStartOperation ( LifecycleOperation operation)
overrideprotectedvirtual

Implements inet::OperationalMixin< cSimpleModule >.

710 {
711  simtime_t start = std::max(startTime, simTime());
712  ie = chooseInterface();
714  scheduleAt(start, startTimer);
715 }

◆ handleStopOperation()

void inet::DhcpClient::handleStopOperation ( LifecycleOperation operation)
overrideprotectedvirtual

Implements inet::OperationalMixin< cSimpleModule >.

718 {
719  cancelEvent(timerT1);
720  cancelEvent(timerT2);
721  cancelEvent(timerTo);
722  cancelEvent(leaseTimer);
723  cancelEvent(startTimer);
724  ie = nullptr;
725 
726  // TODO Client should send DHCPRELEASE to the server. However, the correct operation
727  // of DHCP does not depend on the transmission of DHCPRELEASE messages.
728 
729  socket.close();
730  delayActiveOperationFinish(par("stopOperationTimeout"));
731 }

◆ handleTimer()

void inet::DhcpClient::handleTimer ( cMessage *  msg)
protectedvirtual
210 {
211  int category = msg->getKind();
212 
213  if (category == START_DHCP) {
214  openSocket();
215  if (lease) {
218  }
219  else { // we have no lease from the previous DHCP process
220  clientState = INIT;
221  initClient();
222  }
223  }
224  else if (category == WAIT_OFFER) {
225  EV_DETAIL << "No DHCP offer received within timeout. Restarting. " << endl;
226  initClient();
227  }
228  else if (category == WAIT_ACK) {
229  EV_DETAIL << "No DHCP ACK received within timeout. Restarting." << endl;
230  initClient();
231  }
232  else if (category == T1) {
233  EV_DETAIL << "T1 expired. Starting RENEWING state." << endl;
236  sendRequest();
237  }
238  else if (category == T2 && clientState == RENEWING) {
239  EV_DETAIL << "T2 expired. Starting REBINDING state." << endl;
241  cancelEvent(timerT1);
242  cancelEvent(timerT2);
243  cancelEvent(timerTo);
244 // cancelEvent(leaseTimer);
245 
246  sendRequest();
248  }
249  else if (category == T2) {
250  // T1 < T2 always holds by definition and when T1 expires client will move to RENEWING
251  throw cRuntimeError("T2 occurred in wrong state. (T1 must be earlier than T2.)");
252  }
253  else if (category == LEASE_TIMEOUT) {
254  EV_INFO << "Lease has expired. Starting DHCP process in INIT state." << endl;
255  unbindLease();
256  clientState = INIT;
257  initClient();
258  }
259  else
260  throw cRuntimeError("Unknown self message '%s'", msg->getName());
261 }

Referenced by handleMessageWhenUp().

◆ initClient()

void inet::DhcpClient::initClient ( )
protectedvirtual
366 {
367  EV_INFO << "Starting DHCP configuration process." << endl;
368 
369  cancelEvent(timerT1);
370  cancelEvent(timerT2);
371  cancelEvent(timerTo);
372  cancelEvent(leaseTimer);
373 
374  sendDiscover();
377 }

Referenced by handleDhcpMessage(), handleTimer(), and receiveSignal().

◆ initialize()

void inet::DhcpClient::initialize ( int  stage)
overrideprotectedvirtual

Reimplemented from inet::OperationalMixin< cSimpleModule >.

32 {
34 
35  if (stage == INITSTAGE_LOCAL) {
36  timerT1 = new cMessage("T1 Timer", T1);
37  timerT2 = new cMessage("T2 Timer", T2);
38  timerTo = new cMessage("DHCP Timeout");
39  leaseTimer = new cMessage("Lease Timeout", LEASE_TIMEOUT);
40  startTimer = new cMessage("Starting DHCP", START_DHCP);
41  startTime = par("startTime");
42  numSent = 0;
43  numReceived = 0;
44  xid = 0;
45  responseTimeout = 60; // response timeout in seconds RFC 2131, 4.4.3
46 
47  WATCH(numSent);
48  WATCH(numReceived);
49  WATCH(clientState);
50  WATCH(xid);
51 
52  // DHCP UDP ports
53  clientPort = 68; // client
54  serverPort = 67; // server
55  // get the routing table to update and subscribe it to the blackboard
56  irt.reference(this, "routingTableModule", true);
57  // set client to idle state
58  clientState = IDLE;
59  // get the interface to configure
60  }
61  else if (stage == INITSTAGE_APPLICATION_LAYER) {
62  // get the hostname
63  host = getContainingNode(this);
64  // for a wireless interface subscribe the association event to start the DHCP protocol
65  host->subscribe(l2AssociatedSignal, this);
66  host->subscribe(interfaceDeletedSignal, this);
67  socket.setCallback(this);
68  socket.setOutputGate(gate("socketOut"));
69  }
70 }

◆ initRebootedClient()

void inet::DhcpClient::initRebootedClient ( )
protectedvirtual
380 {
381  sendRequest();
384 }

Referenced by handleTimer().

◆ numInitStages()

virtual int inet::DhcpClient::numInitStages ( ) const
inlineoverrideprotectedvirtual
61 { return NUM_INIT_STAGES; }

◆ openSocket()

void inet::DhcpClient::openSocket ( )
protectedvirtual
703 {
705  socket.setBroadcast(true);
706  EV_INFO << "DHCP server bound to port " << serverPort << "." << endl;
707 }

Referenced by handleTimer().

◆ receiveSignal()

void inet::DhcpClient::receiveSignal ( cComponent *  source,
simsignal_t  signalID,
cObject *  obj,
cObject *  details 
)
overrideprotectedvirtual
495 {
496  Enter_Method("%s", cComponent::getSignalName(signalID));
497  printSignalBanner(signalID, obj, details);
498 
499  // host associated. link is up. change the state to init.
500  if (signalID == l2AssociatedSignal) {
501  NetworkInterface *associatedIE = check_and_cast_nullable<NetworkInterface *>(obj);
502  if (associatedIE && ie == associatedIE && clientState != IDLE) {
503  EV_INFO << "Interface associated, starting DHCP." << endl;
504  unbindLease();
505  initClient();
506  }
507  }
508  else if (signalID == interfaceDeletedSignal) {
509  if (isUp())
510  throw cRuntimeError("Reacting to interface deletions is not implemented in this module");
511  }
512 }

◆ recordLease()

void inet::DhcpClient::recordLease ( const Ptr< const DhcpMessage > &  dhcpACK)
protectedvirtual
284 {
285  if (!dhcpACK->getYiaddr().isUnspecified()) {
286  Ipv4Address ip = dhcpACK->getYiaddr();
287  EV_DETAIL << "DHCPACK arrived with " << "IP: " << ip << endl;
288 
289  lease->subnetMask = dhcpACK->getOptions().getSubnetMask();
290 
291  if (dhcpACK->getOptions().getRouterArraySize() > 0)
292  lease->gateway = dhcpACK->getOptions().getRouter(0);
293  if (dhcpACK->getOptions().getDnsArraySize() > 0)
294  lease->dns = dhcpACK->getOptions().getDns(0);
295  if (dhcpACK->getOptions().getNtpArraySize() > 0)
296  lease->ntp = dhcpACK->getOptions().getNtp(0);
297 
298  lease->leaseTime = dhcpACK->getOptions().getLeaseTime();
299  lease->renewalTime = dhcpACK->getOptions().getRenewalTime();
300  lease->rebindTime = dhcpACK->getOptions().getRebindingTime();
301 
302 // std::cout << lease->leaseTime << " " << lease->renewalTime << " " << lease->rebindTime << endl;
303  }
304  else
305  EV_ERROR << "DHCPACK arrived, but no IP address confirmed." << endl;
306 }

Referenced by handleDhcpAck().

◆ recordOffer()

void inet::DhcpClient::recordOffer ( const Ptr< const DhcpMessage > &  dhcpOffer)
protectedvirtual
264 {
265  if (!dhcpOffer->getYiaddr().isUnspecified()) {
266  Ipv4Address ip = dhcpOffer->getYiaddr();
267 
268 // Byte serverIdB = dhcpOffer->getOptions().get(SERVER_ID);
269  Ipv4Address serverId = dhcpOffer->getOptions().getServerIdentifier();
270 
271  // minimal information to configure the interface
272  // create the lease to request
273  delete lease;
274  lease = new DhcpLease();
275  lease->ip = ip;
276  lease->mac = macAddress;
277  lease->serverId = serverId;
278  }
279  else
280  EV_WARN << "DHCPOFFER arrived, but no IP address has been offered. Discarding it and remaining in SELECTING." << endl;
281 }

Referenced by handleDhcpMessage().

◆ refreshDisplay()

void inet::DhcpClient::refreshDisplay ( ) const
overrideprotectedvirtual
172 {
174 
175  getDisplayString().setTagArg("t", 0, getStateName(clientState));
176 }

◆ scheduleTimerT1()

void inet::DhcpClient::scheduleTimerT1 ( )
protectedvirtual
684 {
685  // cancel the previous T1
686  rescheduleAfter(lease->renewalTime, timerT1); // RFC 2131 4.4.5
687 }

Referenced by handleDhcpAck().

◆ scheduleTimerT2()

void inet::DhcpClient::scheduleTimerT2 ( )
protectedvirtual
690 {
691  // cancel the previous T2
692  rescheduleAfter(lease->rebindTime, timerT2); // RFC 2131 4.4.5
693 }

Referenced by handleDhcpAck().

◆ scheduleTimerTO()

void inet::DhcpClient::scheduleTimerTO ( DhcpTimerType  type)
protectedvirtual
677 {
678  // cancel the previous timeout
679  timerTo->setKind(type);
680  rescheduleAfter(responseTimeout, timerTo);
681 }

Referenced by handleDhcpMessage(), handleTimer(), initClient(), and initRebootedClient().

◆ sendDecline()

void inet::DhcpClient::sendDecline ( Ipv4Address  declinedIp)
protectedvirtual
635 {
636  xid = intuniform(0, RAND_MAX);
637  Packet *packet = new Packet("DHCPDECLINE");
638  const auto& decline = makeShared<DhcpMessage>();
639  decline->setOp(BOOTREQUEST);
640  uint16_t length = 236; // packet size without the options field
641  decline->setHtype(1); // ethernet
642  decline->setHlen(6); // hardware Address length (6 octets)
643  decline->setHops(0);
644  decline->setXid(xid); // transaction id
645  decline->setSecs(0); // 0 seconds from transaction started
646  decline->setBroadcast(false); // unicast
647  decline->setChaddr(macAddress); // my MAC address
648  decline->setSname(""); // no server name given
649  decline->setFile(""); // no file given
650  auto& options = decline->getOptionsForUpdate();
651  options.setMessageType(DHCPDECLINE);
652  length += 3;
653  options.setRequestedIp(declinedIp);
654  length += 6;
655 
656  // magic cookie and the end field
657  length += 5;
658 
659  decline->setChunkLength(B(length));
660 
661  packet->insertAtBack(decline);
662 
663  EV_INFO << "Sending DHCPDECLINE." << endl;
665 }

◆ sendDiscover()

void inet::DhcpClient::sendDiscover ( )
protectedvirtual
590 {
591  // setting the xid
592  xid = intuniform(0, RAND_MAX);
593 // std::cout << xid << endl;
594  Packet *packet = new Packet("DHCPDISCOVER");
595  const auto& discover = makeShared<DhcpMessage>();
596  discover->setOp(BOOTREQUEST);
597  uint16_t length = 236; // packet size without the options field
598  discover->setHtype(1); // ethernet
599  discover->setHlen(6); // hardware Address lenght (6 octets)
600  discover->setHops(0);
601  discover->setXid(xid); // transaction id
602  discover->setSecs(0); // 0 seconds from transaction started
603  discover->setBroadcast(false); // unicast
604  discover->setChaddr(macAddress); // my mac address
605  discover->setSname(""); // no server name given
606  discover->setFile(""); // no file given
607  auto& options = discover->getOptionsForUpdate();
608  options.setMessageType(DHCPDISCOVER);
609  length += 3;
610  options.setClientIdentifier(macAddress);
611  length += 9;
612  options.setRequestedIp(Ipv4Address());
613  //length += 6; not added because unspecified
614 
615  // set the parameters to request
616  options.setParameterRequestListArraySize(4);
617  options.setParameterRequestList(0, SUBNET_MASK);
618  options.setParameterRequestList(1, ROUTER);
619  options.setParameterRequestList(2, DNS);
620  options.setParameterRequestList(3, NTP_SRV);
621  length += (2 + options.getParameterRequestListArraySize());
622 
623  // magic cookie and the end field
624  length += 5;
625 
626  discover->setChunkLength(B(length));
627 
628  packet->insertAtBack(discover);
629 
630  EV_INFO << "Sending DHCPDISCOVER." << endl;
632 }

Referenced by initClient().

◆ sendRequest()

void inet::DhcpClient::sendRequest ( )
protectedvirtual
515 {
516  // setting the xid
517  xid = intuniform(0, RAND_MAX); // generating a new xid for each transmission
518 
519  const auto& request = makeShared<DhcpMessage>();
520  request->setOp(BOOTREQUEST);
521  uint16_t length = 236; // packet size without the options field
522  request->setHtype(1); // ethernet
523  request->setHlen(6); // hardware Address length (6 octets)
524  request->setHops(0);
525  request->setXid(xid); // transaction id
526  request->setSecs(0); // 0 seconds from transaction started
527  request->setBroadcast(false); // unicast
528  request->setYiaddr(Ipv4Address()); // no 'your IP' addr
529  request->setGiaddr(Ipv4Address()); // no DHCP Gateway Agents
530  request->setChaddr(macAddress); // my mac address;
531  request->setSname(""); // no server name given
532  request->setFile(""); // no file given
533  auto& options = request->getOptionsForUpdate();
534  options.setMessageType(DHCPREQUEST);
535  length += 3;
536  options.setClientIdentifier(macAddress);
537  length += 9;
538 
539  // set the parameters to request
540  options.setParameterRequestListArraySize(4);
541  options.setParameterRequestList(0, SUBNET_MASK);
542  options.setParameterRequestList(1, ROUTER);
543  options.setParameterRequestList(2, DNS);
544  options.setParameterRequestList(3, NTP_SRV);
545  length += (2 + options.getParameterRequestListArraySize());
546 
547  L3Address destAddr;
548 
549  // RFC 4.3.6 Table 4
550  if (clientState == INIT_REBOOT) {
551  options.setRequestedIp(lease->ip);
552  length += 6;
553  request->setCiaddr(Ipv4Address()); // zero
554  destAddr = Ipv4Address::ALLONES_ADDRESS;
555  EV_INFO << "Sending DHCPREQUEST asking for IP " << lease->ip << " via broadcast." << endl;
556  }
557  else if (clientState == REQUESTING) {
558  options.setServerIdentifier(lease->serverId);
559  length += 6;
560  options.setRequestedIp(lease->ip);
561  length += 6;
562  request->setCiaddr(Ipv4Address()); // zero
563  destAddr = Ipv4Address::ALLONES_ADDRESS;
564  EV_INFO << "Sending DHCPREQUEST asking for IP " << lease->ip << " via broadcast." << endl;
565  }
566  else if (clientState == RENEWING) {
567  request->setCiaddr(lease->ip); // the client IP
568  destAddr = lease->serverId;
569  EV_INFO << "Sending DHCPREQUEST extending lease for IP " << lease->ip << " via unicast to " << lease->serverId << "." << endl;
570  }
571  else if (clientState == REBINDING) {
572  request->setCiaddr(lease->ip); // the client IP
573  destAddr = Ipv4Address::ALLONES_ADDRESS;
574  EV_INFO << "Sending DHCPREQUEST renewing the IP " << lease->ip << " via broadcast." << endl;
575  }
576  else
577  throw cRuntimeError("Invalid state");
578 
579  // magic cookie and the end field
580  length += 5;
581 
582  request->setChunkLength(B(length));
583 
584  Packet *packet = new Packet("DHCPREQUEST");
585  packet->insertAtBack(request);
586  sendToUdp(packet, clientPort, destAddr, serverPort);
587 }

Referenced by handleDhcpMessage(), handleTimer(), and initRebootedClient().

◆ sendToUdp()

void inet::DhcpClient::sendToUdp ( Packet msg,
int  srcPort,
const L3Address destAddr,
int  destPort 
)
protectedvirtual
696 {
697  EV_INFO << "Sending packet " << msg << endl;
698  msg->addTagIfAbsent<InterfaceReq>()->setInterfaceId(ie->getInterfaceId());
699  socket.sendTo(msg, destAddr, destPort);
700 }

Referenced by sendDecline(), sendDiscover(), and sendRequest().

◆ socketClosed()

void inet::DhcpClient::socketClosed ( UdpSocket socket)
overrideprotectedvirtual

Notifies about socket closed, indication ownership is transferred to the callee.

Implements inet::UdpSocket::ICallback.

204 {
205  if (operationalState == State::STOPPING_OPERATION && !socket.isOpen())
206  startActiveOperationExtraTimeOrFinish(par("stopOperationExtraTime"));
207 }

◆ socketDataArrived()

void inet::DhcpClient::socketDataArrived ( UdpSocket socket,
Packet packet 
)
overrideprotectedvirtual

Notifies about data arrival, packet ownership is transferred to the callee.

Implements inet::UdpSocket::ICallback.

191 {
192  // process incoming packet
193  handleDhcpMessage(packet);
194  delete packet;
195 }

◆ socketErrorArrived()

void inet::DhcpClient::socketErrorArrived ( UdpSocket socket,
Indication indication 
)
overrideprotectedvirtual

Notifies about error indication arrival, indication ownership is transferred to the callee.

Implements inet::UdpSocket::ICallback.

198 {
199  EV_WARN << "Ignoring UDP error report " << indication->getName() << endl;
200  delete indication;
201 }

◆ unbindLease()

void inet::DhcpClient::unbindLease ( )
protectedvirtual
352 {
353  EV_INFO << "Unbinding lease on " << ie->getInterfaceName() << "." << endl;
354 
355  cancelEvent(timerT1);
356  cancelEvent(timerT2);
357  cancelEvent(timerTo);
358  cancelEvent(leaseTimer);
359 
360  irt->deleteRoute(route);
361  ie->getProtocolDataForUpdate<Ipv4InterfaceData>()->setIPAddress(Ipv4Address());
362  ie->getProtocolDataForUpdate<Ipv4InterfaceData>()->setNetmask(Ipv4Address::ALLONES_ADDRESS);
363 }

Referenced by handleDhcpMessage(), handleTimer(), and receiveSignal().

Member Data Documentation

◆ clientPort

int inet::DhcpClient::clientPort = -1
protected

◆ clientState

◆ host

cModule* inet::DhcpClient::host = nullptr
protected

Referenced by bindLease(), and initialize().

◆ ie

◆ irt

ModuleRefByPar<IIpv4RoutingTable> inet::DhcpClient::irt
protected

Referenced by bindLease(), initialize(), and unbindLease().

◆ lease

DhcpLease* inet::DhcpClient::lease = nullptr
protected

◆ leaseTimer

cMessage* inet::DhcpClient::leaseTimer = nullptr
protected

◆ macAddress

MacAddress inet::DhcpClient::macAddress
protected

◆ numReceived

int inet::DhcpClient::numReceived = 0
protected

Referenced by initialize().

◆ numSent

int inet::DhcpClient::numSent = 0
protected

Referenced by initialize().

◆ responseTimeout

int inet::DhcpClient::responseTimeout = 0
protected

Referenced by initialize(), and scheduleTimerTO().

◆ route

Ipv4Route* inet::DhcpClient::route = nullptr
protected

Referenced by bindLease(), and unbindLease().

◆ serverPort

int inet::DhcpClient::serverPort = -1
protected

◆ socket

◆ startTime

simtime_t inet::DhcpClient::startTime
protected

Referenced by handleStartOperation(), and initialize().

◆ startTimer

cMessage* inet::DhcpClient::startTimer = nullptr
protected

◆ timerT1

cMessage* inet::DhcpClient::timerT1 = nullptr
protected

◆ timerT2

cMessage* inet::DhcpClient::timerT2 = nullptr
protected

◆ timerTo

◆ xid

unsigned int inet::DhcpClient::xid = 0
protected

The documentation for this class was generated from the following files:
inet::UdpSocket::setOutputGate
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UdpSocket.h:117
inet::DhcpClient::BOUND
@ BOUND
Definition: DhcpClient.h:31
inet::DhcpClient::host
cModule * host
Definition: DhcpClient.h:40
inet::DhcpClient::xid
unsigned int xid
Definition: DhcpClient.h:51
inet::DhcpLease::renewalTime
simtime_t renewalTime
Definition: DhcpLease.h:33
inet::DhcpClient::startTime
simtime_t startTime
Definition: DhcpClient.h:38
inet::DhcpClient::RENEWING
@ RENEWING
Definition: DhcpClient.h:31
inet::DhcpClient::handleDhcpMessage
virtual void handleDhcpMessage(Packet *packet)
Definition: DhcpClient.cc:386
inet::WAIT_OFFER
@ WAIT_OFFER
Definition: DhcpMessage_m.h:153
inet::SUBNET_MASK
@ SUBNET_MASK
Definition: DhcpMessage_m.h:124
inet::OperationalMixin< cSimpleModule >::operationalState
State operationalState
Definition: OperationalMixin.h:23
inet::OperationalMixin< cSimpleModule >::isUp
virtual bool isUp() const
utility functions
Definition: OperationalMixin.h:66
inet::UdpSocket::bind
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
inet::DhcpClient::sendRequest
virtual void sendRequest()
Definition: DhcpClient.cc:514
inet::DhcpClient::startTimer
cMessage * startTimer
Definition: DhcpClient.h:49
inet::UdpSocket::sendTo
void sendTo(Packet *msg, L3Address destAddr, int destPort)
Sends a data packet to the given address and port.
Definition: UdpSocket.cc:69
inet::DhcpClient::timerTo
cMessage * timerTo
Definition: DhcpClient.h:47
inet::DhcpClient::handleTimer
virtual void handleTimer(cMessage *msg)
Definition: DhcpClient.cc:209
inet::DhcpClient::socket
UdpSocket socket
Definition: DhcpClient.h:37
inet::NetworkInterface::getMacAddress
const MacAddress & getMacAddress() const
Definition: NetworkInterface.h:245
inet::IRoute::MANUAL
@ MANUAL
manually added static route
Definition: IRoute.h:29
inet::DhcpClient::IDLE
@ IDLE
Definition: DhcpClient.h:31
inet::DHCPACK
@ DHCPACK
Definition: DhcpMessage_m.h:88
inet::DhcpLease::gateway
Ipv4Address gateway
Definition: DhcpLease.h:26
inet::DhcpClient::unbindLease
virtual void unbindLease()
Definition: DhcpClient.cc:351
inet::getContainingNode
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
inet::OperationalMixin< cSimpleModule >::initialize
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
inet::DhcpClient::scheduleTimerTO
virtual void scheduleTimerTO(DhcpTimerType type)
Definition: DhcpClient.cc:676
inet::l2AssociatedSignal
simsignal_t l2AssociatedSignal
Definition: Simsignals.cc:15
InterfaceReq
removed InterfaceReq
Definition: IUdp-gates.txt:11
inet::units::constants::e
const value< double, units::C > e(1.602176487e-19)
inet::UdpSocket::destroy
virtual void destroy() override
Notify the protocol that the owner of ISocket has destroyed the socket.
Definition: UdpSocket.cc:98
inet::NetworkInterface::getInterfaceName
const char * getInterfaceName() const
Definition: NetworkInterface.h:233
inet::LEASE_TIMEOUT
@ LEASE_TIMEOUT
Definition: DhcpMessage_m.h:157
inet::DhcpClient::initRebootedClient
virtual void initRebootedClient()
Definition: DhcpClient.cc:379
inet::printSignalBanner
void printSignalBanner(simsignal_t signalID, const cObject *obj, const cObject *details)
Utility function.
Definition: Simsignals.cc:126
inet::DhcpLease::leaseTime
simtime_t leaseTime
Definition: DhcpLease.h:32
inet::NetworkInterface::getProtocolData
const InterfaceProtocolData * getProtocolData(int index) const
Returns the protocol data at the given index.
Definition: NetworkInterface.h:287
inet::DHCPDISCOVER
@ DHCPDISCOVER
Definition: DhcpMessage_m.h:84
inet::DhcpClient::INIT
@ INIT
Definition: DhcpClient.h:31
inet::WAIT_ACK
@ WAIT_ACK
Definition: DhcpMessage_m.h:154
inet::DHCPRELEASE
@ DHCPRELEASE
Definition: DhcpMessage_m.h:90
inet::DhcpClient::bindLease
virtual void bindLease()
Definition: DhcpClient.cc:308
inet::T1
@ T1
Definition: DhcpMessage_m.h:155
inet::DhcpClient::clientState
ClientState clientState
Definition: DhcpClient.h:50
inet::DHCPDECLINE
@ DHCPDECLINE
Definition: DhcpMessage_m.h:87
inet::UdpSocket::setCallback
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: UdpSocket.cc:338
inet::T2
@ T2
Definition: DhcpMessage_m.h:156
inet::DHCPOFFER
@ DHCPOFFER
Definition: DhcpMessage_m.h:85
inet::DhcpClient::recordLease
virtual void recordLease(const Ptr< const DhcpMessage > &dhcpACK)
Definition: DhcpClient.cc:283
inet::DhcpClient::chooseInterface
virtual NetworkInterface * chooseInterface()
Definition: DhcpClient.cc:72
inet::DhcpLease::mac
MacAddress mac
Definition: DhcpLease.h:25
inet::DhcpClient::responseTimeout
int responseTimeout
Definition: DhcpClient.h:58
inet::Ipv4Route::setNetmask
virtual void setNetmask(Ipv4Address _netmask)
Definition: Ipv4Route.h:65
inet::Ipv4Address::ALLONES_ADDRESS
static const Ipv4Address ALLONES_ADDRESS
255.255.255.255
Definition: Ipv4Address.h:94
inet::DhcpClient::scheduleTimerT1
virtual void scheduleTimerT1()
Definition: DhcpClient.cc:683
inet::Ipv4Route::setGateway
virtual void setGateway(Ipv4Address _gateway)
Definition: Ipv4Route.h:66
inet::ROUTER
@ ROUTER
Definition: DhcpMessage_m.h:125
inet::DhcpClient::numReceived
int numReceived
Definition: DhcpClient.h:57
inet::interfaceDeletedSignal
simsignal_t interfaceDeletedSignal
Definition: Simsignals.cc:31
inet::units::units::B
intscale< b, 1, 8 > B
Definition: Units.h:1168
inet::NetworkInterface::getInterfaceId
int getInterfaceId() const
Definition: NetworkInterface.h:232
inet::DhcpClient::REQUESTING
@ REQUESTING
Definition: DhcpClient.h:31
inet::DhcpClient::serverPort
int serverPort
Definition: DhcpClient.h:35
inet::UdpSocket::processMessage
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
inet::DhcpLease::rebindTime
simtime_t rebindTime
Definition: DhcpLease.h:34
inet::DhcpClient::SELECTING
@ SELECTING
Definition: DhcpClient.h:31
inet::DhcpLease::serverId
Ipv4Address serverId
Definition: DhcpLease.h:30
type
removed type
Definition: IUdp-gates.txt:7
inet::DHCPNAK
@ DHCPNAK
Definition: DhcpMessage_m.h:89
inet::DhcpLease::dns
Ipv4Address dns
Definition: DhcpLease.h:28
inet::START_DHCP
@ START_DHCP
Definition: DhcpMessage_m.h:158
inet::INITSTAGE_LOCAL
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
inet::DhcpClient::leaseTimer
cMessage * leaseTimer
Definition: DhcpClient.h:48
inet::DhcpClient::clientPort
int clientPort
Definition: DhcpClient.h:36
inet::DhcpClient::handleDhcpAck
virtual void handleDhcpAck(const Ptr< const DhcpMessage > &msg)
Definition: DhcpClient.cc:667
inet::UdpSocket::close
virtual void close() override
Unbinds the socket.
Definition: UdpSocket.cc:87
inet::Ipv4Address::str
std::string str(bool printUnspec=true) const
Returns the string representation of the address (e.g.
Definition: Ipv4Address.cc:98
NUM_INIT_STAGES
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
inet::DhcpClient::INIT_REBOOT
@ INIT_REBOOT
Definition: DhcpClient.h:31
inet::DhcpMessageType
DhcpMessageType
Enum generated from inet/applications/dhcp/DhcpMessage.msg:23 by opp_msgtool.
Definition: DhcpMessage_m.h:83
inet::DhcpClient::initClient
virtual void initClient()
Definition: DhcpClient.cc:365
inet::sctp::max
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
inet::DhcpLease::ntp
Ipv4Address ntp
Definition: DhcpLease.h:29
inet::NetworkInterface::getProtocolDataForUpdate
T * getProtocolDataForUpdate()
Returns the protocol data for the provided type or throws an exception if no such protocol data is fo...
Definition: NetworkInterface.h:320
inet::DhcpClient::getAndCheckMessageTypeName
const char * getAndCheckMessageTypeName(DhcpMessageType type)
Definition: DhcpClient.cc:151
inet::NTP_SRV
@ NTP_SRV
Definition: DhcpMessage_m.h:127
inet::DhcpClient::sendDiscover
virtual void sendDiscover()
Definition: DhcpClient.cc:589
inet::DhcpClient::openSocket
virtual void openSocket()
Definition: DhcpClient.cc:702
inet::UdpSocket::isOpen
virtual bool isOpen() const override
Definition: UdpSocket.h:293
inet::UdpSocket::setBroadcast
void setBroadcast(bool broadcast)
Set the Broadcast option on the UDP socket.
Definition: UdpSocket.cc:139
inet::DhcpClient::route
Ipv4Route * route
Definition: DhcpClient.h:53
inet::DhcpClient::timerT2
cMessage * timerT2
Definition: DhcpClient.h:46
inet::INITSTAGE_APPLICATION_LAYER
INET_API InitStage INITSTAGE_APPLICATION_LAYER
Initialization of applications.
inet::DNS
@ DNS
Definition: DhcpMessage_m.h:126
inet::OperationalMixin< cSimpleModule >::delayActiveOperationFinish
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
inet::DhcpClient::lease
DhcpLease * lease
Definition: DhcpClient.h:52
inet::OperationalMixin< cSimpleModule >::startActiveOperationExtraTimeOrFinish
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::DhcpClient::ie
NetworkInterface * ie
Definition: DhcpClient.h:41
inet::DhcpClient::REBOOTING
@ REBOOTING
Definition: DhcpClient.h:31
inet::DhcpClient::macAddress
MacAddress macAddress
Definition: DhcpClient.h:39
inet::Ipv4Route::setInterface
virtual void setInterface(NetworkInterface *_interfacePtr) override
Definition: Ipv4Route.h:67
inet::DHCPREQUEST
@ DHCPREQUEST
Definition: DhcpMessage_m.h:86
inet::DhcpClient::scheduleTimerT2
virtual void scheduleTimerT2()
Definition: DhcpClient.cc:689
inet::DhcpClient::getStateName
static const char * getStateName(ClientState state)
Definition: DhcpClient.cc:131
inet::Ipv4Route::setDestination
virtual void setDestination(Ipv4Address _dest)
Definition: Ipv4Route.h:64
inet::DhcpLease::ip
Ipv4Address ip
Definition: DhcpLease.h:24
inet::DhcpClient::timerT1
cMessage * timerT1
Definition: DhcpClient.h:45
inet::BOOTREQUEST
@ BOOTREQUEST
Definition: DhcpMessage_m.h:60
inet::DhcpClient::recordOffer
virtual void recordOffer(const Ptr< const DhcpMessage > &dhcpOffer)
Definition: DhcpClient.cc:263
CASE
#define CASE(X)
inet::OperationalMixin< cSimpleModule >::refreshDisplay
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
inet::DhcpClient::irt
ModuleRefByPar< IIpv4RoutingTable > irt
Definition: DhcpClient.h:42
inet::DhcpLease::subnetMask
Ipv4Address subnetMask
Definition: DhcpLease.h:27
inet::Ipv4Route::setSourceType
virtual void setSourceType(SourceType _source) override
Definition: Ipv4Route.h:68
inet::BOOTREPLY
@ BOOTREPLY
Definition: DhcpMessage_m.h:61
inet::DhcpClient::numSent
int numSent
Definition: DhcpClient.h:56
inet::DHCPINFORM
@ DHCPINFORM
Definition: DhcpMessage_m.h:91
inet::DhcpClient::sendToUdp
virtual void sendToUdp(Packet *msg, int srcPort, const L3Address &destAddr, int destPort)
Definition: DhcpClient.cc:695
inet::DhcpClient::REBINDING
@ REBINDING
Definition: DhcpClient.h:31