|
INET Framework for OMNeT++/OMNEST
|
Implements a DHCP client.
More...
#include <DhcpClient.h>
|
| 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 NetworkInterface * | chooseInterface () |
| |
| 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 |
| |
| virtual bool | isInitializeStage (int stage) const override |
| |
| virtual bool | isModuleStartStage (int stage) const override |
| |
| virtual bool | isModuleStopStage (int stage) const override |
| |
| 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 () |
| |
Implements a DHCP client.
See NED file for more details.
◆ ClientState
| Enumerator |
|---|
| IDLE | |
| INIT | |
| INIT_REBOOT | |
| REBOOTING | |
| SELECTING | |
| REQUESTING | |
| BOUND | |
| RENEWING | |
| REBINDING | |
◆ DhcpClient()
| inet::DhcpClient::DhcpClient |
( |
| ) |
|
|
inline |
◆ ~DhcpClient()
| inet::DhcpClient::~DhcpClient |
( |
| ) |
|
|
virtual |
◆ bindLease()
| void inet::DhcpClient::bindLease |
( |
| ) |
|
|
protectedvirtual |
311 ipv4Data->setIPAddress(
lease->
ip);
314 std::string banner =
"Got IP " +
lease->
ip.
str();
315 host->bubble(banner.c_str());
325 EV_INFO <<
"The requested IP " <<
lease->
ip <<
"/" <<
lease->
subnetMask <<
" is available. Assigning it to "
326 <<
host->getFullName() <<
"." << endl;
328 Ipv4Route *iroute =
nullptr;
329 for (
int i = 0; i <
irt->getNumRoutes(); i++) {
330 Ipv4Route *
e =
irt->getRoute(i);
336 if (iroute ==
nullptr) {
338 route =
new Ipv4Route();
Referenced by handleDhcpAck().
◆ chooseInterface()
74 IInterfaceTable *ift = getModuleFromPar<IInterfaceTable>(par(
"interfaceTableModule"),
this);
75 const char *interfaceName = par(
"interface");
76 NetworkInterface *
ie =
nullptr;
78 if (strlen(interfaceName) > 0) {
79 ie = ift->findInterfaceByName(interfaceName);
81 throw cRuntimeError(
"Interface \"%s\" does not exist", interfaceName);
85 for (
int i = 0; i < ift->getNumInterfaces(); i++) {
86 NetworkInterface *current = ift->getInterface(i);
87 if (!current->isLoopback()) {
89 throw cRuntimeError(
"Multiple non-loopback interfaces found, please select explicitly which one you want to configure via DHCP");
94 throw cRuntimeError(
"No non-loopback interface found to be configured via DHCP");
98 throw cRuntimeError(
"Refusing to start DHCP on interface \"%s\" that already has an IP address",
ie->
getInterfaceName());
Referenced by handleStartOperation().
◆ finish()
| void inet::DhcpClient::finish |
( |
| ) |
|
|
overrideprotectedvirtual |
◆ getAndCheckMessageTypeName()
| const char * inet::DhcpClient::getAndCheckMessageTypeName |
( |
DhcpMessageType |
type | ) |
|
|
protected |
154 #define CASE(X) case X: \
166 throw cRuntimeError(
"Unknown or invalid DHCP message type %d",
type);
Referenced by handleDhcpMessage().
◆ getStateName()
| const char * inet::DhcpClient::getStateName |
( |
ClientState |
state | ) |
|
|
staticprotected |
◆ handleCrashOperation()
◆ handleDhcpAck()
| void inet::DhcpClient::handleDhcpAck |
( |
const Ptr< const DhcpMessage > & |
msg | ) |
|
|
protectedvirtual |
◆ handleDhcpMessage()
| void inet::DhcpClient::handleDhcpMessage |
( |
Packet * |
packet | ) |
|
|
protectedvirtual |
388 ASSERT(
isUp() &&
ie !=
nullptr);
390 const auto& msg = packet->peekAtFront<DhcpMessage>();
392 EV_WARN <<
"Client received a non-BOOTREPLY message, dropping." << endl;
396 if (msg->getXid() !=
xid) {
397 EV_WARN <<
"Message transaction ID is not valid, dropping." << endl;
404 EV_WARN <<
getAndCheckMessageTypeName(messageType) <<
" message arrived in INIT state. In this state, client does not wait for any message at all, dropping." << endl;
409 EV_INFO <<
"DHCPOFFER message arrived in SELECTING state with IP address: " << msg->getYiaddr() <<
"." << endl;
416 EV_WARN <<
"Client is in SELECTING and the arriving packet is not a DHCPOFFER, dropping." << endl;
421 EV_WARN <<
"We don't accept DHCPOFFERs in REQUESTING state, dropping." << endl;
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;
428 else if (messageType ==
DHCPNAK) {
429 EV_INFO <<
"DHCPNAK message arrived in REQUESTING state. Restarting the configuration process." << endl;
433 EV_WARN <<
getAndCheckMessageTypeName(messageType) <<
" message arrived in REQUESTING state. In this state, client does not expect messages of this type, dropping." << endl;
438 EV_DETAIL <<
"We are in BOUND, discard all DHCP messages." << endl;
444 EV_INFO <<
"DHCPACK message arrived in RENEWING state. The renewing process was successful." << endl;
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;
453 EV_WARN <<
getAndCheckMessageTypeName(messageType) <<
" message arrived in RENEWING state. In this state, client does not expect messages of this type, dropping." << endl;
459 EV_INFO <<
"DHPCNAK message arrived in REBINDING state. The rebinding process was unsuccessful. Restarting the DHCP configuration process." << endl;
463 else if (messageType ==
DHCPACK) {
465 EV_INFO <<
"DHCPACK message arrived in REBINDING state. The rebinding process was successful." << endl;
469 EV_WARN <<
getAndCheckMessageTypeName(messageType) <<
" message arrived in REBINDING state. In this state, client does not expect messages of this type, dropping." << endl;
476 EV_INFO <<
"DHCPACK message arrived in REBOOTING state. Initialization with known IP address was successful." << endl;
479 else if (messageType ==
DHCPNAK) {
480 EV_INFO <<
"DHCPNAK message arrived in REBOOTING. Initialization with known IP address was unsuccessful." << endl;
485 EV_WARN <<
getAndCheckMessageTypeName(messageType) <<
" message arrived in REBOOTING state. In this state, client does not expect messages of this type, dropping." << endl;
490 throw cRuntimeError(
"Unknown or invalid client state %d",
clientState);
Referenced by socketDataArrived().
◆ handleMessageWhenUp()
| void inet::DhcpClient::handleMessageWhenUp |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
Implements inet::OperationalMixin< cSimpleModule >.
180 if (msg->isSelfMessage()) {
183 else if (msg->arrivedOn(
"socketIn")) {
187 throw cRuntimeError(
"Unknown incoming gate: '%s'", msg->getArrivalGate()->getFullName());
◆ handleStartOperation()
◆ handleStopOperation()
◆ handleTimer()
| void inet::DhcpClient::handleTimer |
( |
cMessage * |
msg | ) |
|
|
protectedvirtual |
211 int category = msg->getKind();
225 EV_DETAIL <<
"No DHCP offer received within timeout. Restarting. " << endl;
229 EV_DETAIL <<
"No DHCP ACK received within timeout. Restarting." << endl;
232 else if (category ==
T1) {
233 EV_DETAIL <<
"T1 expired. Starting RENEWING state." << endl;
239 EV_DETAIL <<
"T2 expired. Starting REBINDING state." << endl;
249 else if (category ==
T2) {
251 throw cRuntimeError(
"T2 occurred in wrong state. (T1 must be earlier than T2.)");
254 EV_INFO <<
"Lease has expired. Starting DHCP process in INIT state." << endl;
260 throw cRuntimeError(
"Unknown self message '%s'", msg->getName());
Referenced by handleMessageWhenUp().
◆ initClient()
| void inet::DhcpClient::initClient |
( |
| ) |
|
|
protectedvirtual |
◆ initialize()
| void inet::DhcpClient::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
◆ initRebootedClient()
| void inet::DhcpClient::initRebootedClient |
( |
| ) |
|
|
protectedvirtual |
◆ numInitStages()
| virtual int inet::DhcpClient::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ openSocket()
| void inet::DhcpClient::openSocket |
( |
| ) |
|
|
protectedvirtual |
◆ receiveSignal()
| void inet::DhcpClient::receiveSignal |
( |
cComponent * |
source, |
|
|
simsignal_t |
signalID, |
|
|
cObject * |
obj, |
|
|
cObject * |
details |
|
) |
| |
|
overrideprotectedvirtual |
496 Enter_Method(
"%s", cComponent::getSignalName(signalID));
501 NetworkInterface *associatedIE = check_and_cast_nullable<NetworkInterface *>(obj);
503 EV_INFO <<
"Interface associated, starting DHCP." << endl;
510 throw cRuntimeError(
"Reacting to interface deletions is not implemented in this module");
◆ recordLease()
| void inet::DhcpClient::recordLease |
( |
const Ptr< const DhcpMessage > & |
dhcpACK | ) |
|
|
protectedvirtual |
285 if (!dhcpACK->getYiaddr().isUnspecified()) {
286 Ipv4Address ip = dhcpACK->getYiaddr();
287 EV_DETAIL <<
"DHCPACK arrived with " <<
"IP: " << ip << endl;
291 if (dhcpACK->getOptions().getRouterArraySize() > 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);
305 EV_ERROR <<
"DHCPACK arrived, but no IP address confirmed." << endl;
Referenced by handleDhcpAck().
◆ recordOffer()
| void inet::DhcpClient::recordOffer |
( |
const Ptr< const DhcpMessage > & |
dhcpOffer | ) |
|
|
protectedvirtual |
265 if (!dhcpOffer->getYiaddr().isUnspecified()) {
266 Ipv4Address ip = dhcpOffer->getYiaddr();
269 Ipv4Address serverId = dhcpOffer->getOptions().getServerIdentifier();
274 lease =
new DhcpLease();
280 EV_WARN <<
"DHCPOFFER arrived, but no IP address has been offered. Discarding it and remaining in SELECTING." << endl;
Referenced by handleDhcpMessage().
◆ refreshDisplay()
| void inet::DhcpClient::refreshDisplay |
( |
| ) |
const |
|
overrideprotectedvirtual |
◆ scheduleTimerT1()
| void inet::DhcpClient::scheduleTimerT1 |
( |
| ) |
|
|
protectedvirtual |
◆ scheduleTimerT2()
| void inet::DhcpClient::scheduleTimerT2 |
( |
| ) |
|
|
protectedvirtual |
◆ scheduleTimerTO()
◆ sendDecline()
| void inet::DhcpClient::sendDecline |
( |
Ipv4Address |
declinedIp | ) |
|
|
protectedvirtual |
636 xid = intuniform(0, RAND_MAX);
637 Packet *packet =
new Packet(
"DHCPDECLINE");
638 const auto& decline = makeShared<DhcpMessage>();
640 uint16_t length = 236;
641 decline->setHtype(1);
644 decline->setXid(
xid);
646 decline->setBroadcast(
false);
648 decline->setSname(
"");
649 decline->setFile(
"");
650 auto& options = decline->getOptionsForUpdate();
653 options.setRequestedIp(declinedIp);
659 decline->setChunkLength(
B(length));
661 packet->insertAtBack(decline);
663 EV_INFO <<
"Sending DHCPDECLINE." << endl;
◆ sendDiscover()
| void inet::DhcpClient::sendDiscover |
( |
| ) |
|
|
protectedvirtual |
592 xid = intuniform(0, RAND_MAX);
594 Packet *packet =
new Packet(
"DHCPDISCOVER");
595 const auto& discover = makeShared<DhcpMessage>();
597 uint16_t length = 236;
598 discover->setHtype(1);
599 discover->setHlen(6);
600 discover->setHops(0);
601 discover->setXid(
xid);
602 discover->setSecs(0);
603 discover->setBroadcast(
false);
605 discover->setSname(
"");
606 discover->setFile(
"");
607 auto& options = discover->getOptionsForUpdate();
612 options.setRequestedIp(Ipv4Address());
616 options.setParameterRequestListArraySize(4);
618 options.setParameterRequestList(1,
ROUTER);
619 options.setParameterRequestList(2,
DNS);
620 options.setParameterRequestList(3,
NTP_SRV);
621 length += (2 + options.getParameterRequestListArraySize());
626 discover->setChunkLength(
B(length));
628 packet->insertAtBack(discover);
630 EV_INFO <<
"Sending DHCPDISCOVER." << endl;
Referenced by initClient().
◆ sendRequest()
| void inet::DhcpClient::sendRequest |
( |
| ) |
|
|
protectedvirtual |
517 xid = intuniform(0, RAND_MAX);
519 const auto& request = makeShared<DhcpMessage>();
521 uint16_t length = 236;
522 request->setHtype(1);
525 request->setXid(
xid);
527 request->setBroadcast(
false);
528 request->setYiaddr(Ipv4Address());
529 request->setGiaddr(Ipv4Address());
531 request->setSname(
"");
532 request->setFile(
"");
533 auto& options = request->getOptionsForUpdate();
540 options.setParameterRequestListArraySize(4);
542 options.setParameterRequestList(1,
ROUTER);
543 options.setParameterRequestList(2,
DNS);
544 options.setParameterRequestList(3,
NTP_SRV);
545 length += (2 + options.getParameterRequestListArraySize());
551 options.setRequestedIp(
lease->
ip);
553 request->setCiaddr(Ipv4Address());
555 EV_INFO <<
"Sending DHCPREQUEST asking for IP " <<
lease->
ip <<
" via broadcast." << endl;
560 options.setRequestedIp(
lease->
ip);
562 request->setCiaddr(Ipv4Address());
564 EV_INFO <<
"Sending DHCPREQUEST asking for IP " <<
lease->
ip <<
" via broadcast." << endl;
569 EV_INFO <<
"Sending DHCPREQUEST extending lease for IP " <<
lease->
ip <<
" via unicast to " <<
lease->
serverId <<
"." << endl;
574 EV_INFO <<
"Sending DHCPREQUEST renewing the IP " <<
lease->
ip <<
" via broadcast." << endl;
577 throw cRuntimeError(
"Invalid state");
582 request->setChunkLength(
B(length));
584 Packet *packet =
new Packet(
"DHCPREQUEST");
585 packet->insertAtBack(request);
Referenced by handleDhcpMessage(), handleTimer(), and initRebootedClient().
◆ sendToUdp()
| void inet::DhcpClient::sendToUdp |
( |
Packet * |
msg, |
|
|
int |
srcPort, |
|
|
const L3Address & |
destAddr, |
|
|
int |
destPort |
|
) |
| |
|
protectedvirtual |
◆ socketClosed()
| void inet::DhcpClient::socketClosed |
( |
UdpSocket * |
socket | ) |
|
|
overrideprotectedvirtual |
◆ socketDataArrived()
| void inet::DhcpClient::socketDataArrived |
( |
UdpSocket * |
socket, |
|
|
Packet * |
packet |
|
) |
| |
|
overrideprotectedvirtual |
◆ socketErrorArrived()
Notifies about error indication arrival, indication ownership is transferred to the callee.
Implements inet::UdpSocket::ICallback.
199 EV_WARN <<
"Ignoring UDP error report " << indication->getName() << endl;
◆ unbindLease()
| void inet::DhcpClient::unbindLease |
( |
| ) |
|
|
protectedvirtual |
◆ clientPort
| int inet::DhcpClient::clientPort = -1 |
|
protected |
◆ clientState
◆ host
| cModule* inet::DhcpClient::host = nullptr |
|
protected |
◆ ie
◆ irt
◆ lease
◆ leaseTimer
| cMessage* inet::DhcpClient::leaseTimer = nullptr |
|
protected |
◆ macAddress
◆ numReceived
| int inet::DhcpClient::numReceived = 0 |
|
protected |
◆ numSent
| int inet::DhcpClient::numSent = 0 |
|
protected |
◆ responseTimeout
| int inet::DhcpClient::responseTimeout = 0 |
|
protected |
◆ route
◆ serverPort
| int inet::DhcpClient::serverPort = -1 |
|
protected |
◆ socket
◆ startTime
| simtime_t inet::DhcpClient::startTime |
|
protected |
◆ startTimer
| cMessage* inet::DhcpClient::startTimer = nullptr |
|
protected |
◆ timerT1
| cMessage* inet::DhcpClient::timerT1 = nullptr |
|
protected |
◆ timerT2
| cMessage* inet::DhcpClient::timerT2 = nullptr |
|
protected |
◆ timerTo
| cMessage* inet::DhcpClient::timerTo = nullptr |
|
protected |
◆ xid
| unsigned int inet::DhcpClient::xid = 0 |
|
protected |
The documentation for this class was generated from the following files:
void setOutputGate(cGate *toUdp)
Sets the gate on which to send to UDP.
Definition: UdpSocket.h:117
@ BOUND
Definition: DhcpClient.h:31
cModule * host
Definition: DhcpClient.h:40
unsigned int xid
Definition: DhcpClient.h:51
simtime_t renewalTime
Definition: DhcpLease.h:33
simtime_t startTime
Definition: DhcpClient.h:38
@ RENEWING
Definition: DhcpClient.h:31
virtual void handleDhcpMessage(Packet *packet)
Definition: DhcpClient.cc:386
@ WAIT_OFFER
Definition: DhcpMessage_m.h:153
@ SUBNET_MASK
Definition: DhcpMessage_m.h:124
State operationalState
Definition: OperationalMixin.h:23
virtual bool isUp() const
utility functions
Definition: OperationalMixin.h:66
void bind(int localPort)
Bind the socket to a local port number.
Definition: UdpSocket.cc:34
virtual void sendRequest()
Definition: DhcpClient.cc:514
cMessage * startTimer
Definition: DhcpClient.h:49
void sendTo(Packet *msg, L3Address destAddr, int destPort)
Sends a data packet to the given address and port.
Definition: UdpSocket.cc:69
cMessage * timerTo
Definition: DhcpClient.h:47
virtual void handleTimer(cMessage *msg)
Definition: DhcpClient.cc:209
UdpSocket socket
Definition: DhcpClient.h:37
const MacAddress & getMacAddress() const
Definition: NetworkInterface.h:245
@ MANUAL
manually added static route
Definition: IRoute.h:29
@ IDLE
Definition: DhcpClient.h:31
@ DHCPACK
Definition: DhcpMessage_m.h:88
Ipv4Address gateway
Definition: DhcpLease.h:26
virtual void unbindLease()
Definition: DhcpClient.cc:351
cModule * getContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:40
virtual void initialize(int stage) override
Definition: OperationalMixinImpl.h:26
virtual void scheduleTimerTO(DhcpTimerType type)
Definition: DhcpClient.cc:676
simsignal_t l2AssociatedSignal
Definition: Simsignals.cc:15
removed InterfaceReq
Definition: IUdp-gates.txt:11
const value< double, units::C > e(1.602176487e-19)
virtual void destroy() override
Notify the protocol that the owner of ISocket has destroyed the socket.
Definition: UdpSocket.cc:98
const char * getInterfaceName() const
Definition: NetworkInterface.h:233
@ LEASE_TIMEOUT
Definition: DhcpMessage_m.h:157
virtual void initRebootedClient()
Definition: DhcpClient.cc:379
void printSignalBanner(simsignal_t signalID, const cObject *obj, const cObject *details)
Utility function.
Definition: Simsignals.cc:126
simtime_t leaseTime
Definition: DhcpLease.h:32
const InterfaceProtocolData * getProtocolData(int index) const
Returns the protocol data at the given index.
Definition: NetworkInterface.h:287
@ DHCPDISCOVER
Definition: DhcpMessage_m.h:84
@ INIT
Definition: DhcpClient.h:31
@ WAIT_ACK
Definition: DhcpMessage_m.h:154
@ DHCPRELEASE
Definition: DhcpMessage_m.h:90
virtual void bindLease()
Definition: DhcpClient.cc:308
@ T1
Definition: DhcpMessage_m.h:155
ClientState clientState
Definition: DhcpClient.h:50
@ DHCPDECLINE
Definition: DhcpMessage_m.h:87
void setCallback(ICallback *cb)
Sets a callback object, to be used with processMessage().
Definition: UdpSocket.cc:338
@ T2
Definition: DhcpMessage_m.h:156
@ DHCPOFFER
Definition: DhcpMessage_m.h:85
virtual void recordLease(const Ptr< const DhcpMessage > &dhcpACK)
Definition: DhcpClient.cc:283
virtual NetworkInterface * chooseInterface()
Definition: DhcpClient.cc:72
MacAddress mac
Definition: DhcpLease.h:25
int responseTimeout
Definition: DhcpClient.h:58
virtual void setNetmask(Ipv4Address _netmask)
Definition: Ipv4Route.h:65
static const Ipv4Address ALLONES_ADDRESS
255.255.255.255
Definition: Ipv4Address.h:94
virtual void scheduleTimerT1()
Definition: DhcpClient.cc:683
virtual void setGateway(Ipv4Address _gateway)
Definition: Ipv4Route.h:66
@ ROUTER
Definition: DhcpMessage_m.h:125
int numReceived
Definition: DhcpClient.h:57
simsignal_t interfaceDeletedSignal
Definition: Simsignals.cc:31
intscale< b, 1, 8 > B
Definition: Units.h:1168
int getInterfaceId() const
Definition: NetworkInterface.h:232
@ REQUESTING
Definition: DhcpClient.h:31
int serverPort
Definition: DhcpClient.h:35
virtual void processMessage(cMessage *msg) override
Examines the message, takes ownership, and updates socket state.
Definition: UdpSocket.cc:343
simtime_t rebindTime
Definition: DhcpLease.h:34
@ SELECTING
Definition: DhcpClient.h:31
Ipv4Address serverId
Definition: DhcpLease.h:30
removed type
Definition: IUdp-gates.txt:7
@ DHCPNAK
Definition: DhcpMessage_m.h:89
Ipv4Address dns
Definition: DhcpLease.h:28
@ START_DHCP
Definition: DhcpMessage_m.h:158
INET_API InitStage INITSTAGE_LOCAL
Initialization of local state that don't use or affect other modules includes:
cMessage * leaseTimer
Definition: DhcpClient.h:48
int clientPort
Definition: DhcpClient.h:36
virtual void handleDhcpAck(const Ptr< const DhcpMessage > &msg)
Definition: DhcpClient.cc:667
virtual void close() override
Unbinds the socket.
Definition: UdpSocket.cc:87
std::string str(bool printUnspec=true) const
Returns the string representation of the address (e.g.
Definition: Ipv4Address.cc:98
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
@ INIT_REBOOT
Definition: DhcpClient.h:31
DhcpMessageType
Enum generated from inet/applications/dhcp/DhcpMessage.msg:23 by opp_msgtool.
Definition: DhcpMessage_m.h:83
virtual void initClient()
Definition: DhcpClient.cc:365
double max(const double a, const double b)
Returns the maximum of a and b.
Definition: SctpAssociation.h:266
Ipv4Address ntp
Definition: DhcpLease.h:29
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
const char * getAndCheckMessageTypeName(DhcpMessageType type)
Definition: DhcpClient.cc:151
@ NTP_SRV
Definition: DhcpMessage_m.h:127
virtual void sendDiscover()
Definition: DhcpClient.cc:589
virtual void openSocket()
Definition: DhcpClient.cc:702
virtual bool isOpen() const override
Definition: UdpSocket.h:293
void setBroadcast(bool broadcast)
Set the Broadcast option on the UDP socket.
Definition: UdpSocket.cc:139
Ipv4Route * route
Definition: DhcpClient.h:53
cMessage * timerT2
Definition: DhcpClient.h:46
INET_API InitStage INITSTAGE_APPLICATION_LAYER
Initialization of applications.
@ DNS
Definition: DhcpMessage_m.h:126
virtual void delayActiveOperationFinish(simtime_t timeout)
Definition: OperationalMixinImpl.h:161
DhcpLease * lease
Definition: DhcpClient.h:52
virtual void startActiveOperationExtraTimeOrFinish(simtime_t extraTime)
Definition: OperationalMixinImpl.h:179
#define Enter_Method(...)
Definition: SelfDoc.h:71
NetworkInterface * ie
Definition: DhcpClient.h:41
@ REBOOTING
Definition: DhcpClient.h:31
MacAddress macAddress
Definition: DhcpClient.h:39
virtual void setInterface(NetworkInterface *_interfacePtr) override
Definition: Ipv4Route.h:67
@ DHCPREQUEST
Definition: DhcpMessage_m.h:86
virtual void scheduleTimerT2()
Definition: DhcpClient.cc:689
static const char * getStateName(ClientState state)
Definition: DhcpClient.cc:131
virtual void setDestination(Ipv4Address _dest)
Definition: Ipv4Route.h:64
Ipv4Address ip
Definition: DhcpLease.h:24
cMessage * timerT1
Definition: DhcpClient.h:45
@ BOOTREQUEST
Definition: DhcpMessage_m.h:60
virtual void recordOffer(const Ptr< const DhcpMessage > &dhcpOffer)
Definition: DhcpClient.cc:263
virtual void refreshDisplay() const override
Definition: OperationalMixinImpl.h:200
ModuleRefByPar< IIpv4RoutingTable > irt
Definition: DhcpClient.h:42
Ipv4Address subnetMask
Definition: DhcpLease.h:27
virtual void setSourceType(SourceType _source) override
Definition: Ipv4Route.h:68
@ BOOTREPLY
Definition: DhcpMessage_m.h:61
int numSent
Definition: DhcpClient.h:56
@ DHCPINFORM
Definition: DhcpMessage_m.h:91
virtual void sendToUdp(Packet *msg, int srcPort, const L3Address &destAddr, int destPort)
Definition: DhcpClient.cc:695
@ REBINDING
Definition: DhcpClient.h:31