DhcpServer¶
Package: inet.applications.dhcp
simple module DhcpServer
Implements the DHCP server protocol. DHCP (Dynamic Host Configuration Protocol), described in RFC 2131, provides configuration parameters to Internet hosts. Requires UDP.
See also: DhcpClient, DhcpMessage
Usage diagram¶
Inheritance diagram¶
Used in compound modules¶
Name |
Type |
Description |
|---|---|---|
compound module |
A network router device with support for multiple routing protocols and network interfaces. Provides the foundation for simulating various types of routers in both wired and wireless networks. |
Extends¶
Name |
Type |
Description |
|---|---|---|
simple module |
Base module for all INET simple modules. |
Parameters¶
Name |
Type |
Default value |
Description |
|---|---|---|---|
displayStringTextFormat |
string |
“” |
Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information |
interfaceTableModule |
string |
The path to the InterfaceTable module |
|
interface |
string |
“” |
Interface to listen on; can be left empty if there is only one non-loopback interface |
numReservedAddresses |
int |
Number of addresses to skip at the start of the network’s address range |
|
maxNumClients |
int |
Maximum number of clients (IPs) allowed to be leased |
|
gateway |
string |
“” |
Gateway to assign, if empty use the interface address |
leaseTime |
int |
Lease time in seconds |
|
startTime |
double |
0s |
Application start time |
stopOperationExtraTime |
double |
-1s |
Extra time after lifecycle stop operation finished |
stopOperationTimeout |
double |
2s |
Timeout value for lifecycle stop operation |
Properties¶
Name |
Value |
Description |
|---|---|---|
class |
DhcpServer |
|
display |
i=block/app2 |
|
lifecycleSupport |
Gates¶
Name |
Direction |
Size |
Description |
|---|---|---|---|
socketIn |
input |
||
socketOut |
output |
Source code¶
//
// Implements the DHCP server protocol. DHCP (Dynamic Host Configuration Protocol),
// described in RFC 2131, provides configuration parameters to Internet hosts.
// Requires UDP.
//
// @see ~DhcpClient, ~DhcpMessage
//
simple DhcpServer extends SimpleModule like IApp
{
parameters:
@class(DhcpServer);
string interfaceTableModule; // The path to the InterfaceTable module
string interface = default(""); // Interface to listen on; can be left empty if there is only one non-loopback interface
int numReservedAddresses; // Number of addresses to skip at the start of the network's address range
int maxNumClients; // Maximum number of clients (IPs) allowed to be leased
string gateway = default(""); // Gateway to assign, if empty use the interface address
int leaseTime @unit(s); // Lease time in seconds
double startTime @unit(s) = default(0s); // Application start time
@display("i=block/app2");
@lifecycleSupport;
double stopOperationExtraTime @unit(s) = default(-1s); // Extra time after lifecycle stop operation finished
double stopOperationTimeout @unit(s) = default(2s); // Timeout value for lifecycle stop operation
gates:
input socketIn @labels(UdpCommand/up);
output socketOut @labels(UdpCommand/down);
}