38#ifndef DHCP_SERVER_SUPPORT
39 #define DHCP_SERVER_SUPPORT DISABLED
40#elif (DHCP_SERVER_SUPPORT != ENABLED && DHCP_SERVER_SUPPORT != DISABLED)
41 #error DHCP_SERVER_SUPPORT parameter is not valid
45#ifndef DHCP_SERVER_TICK_INTERVAL
46 #define DHCP_SERVER_TICK_INTERVAL 1000
47#elif (DHCP_SERVER_TICK_INTERVAL < 10)
48 #error DHCP_SERVER_TICK_INTERVAL parameter is not valid
52#ifndef DHCP_SERVER_MAX_CLIENTS
53 #define DHCP_SERVER_MAX_CLIENTS 16
54#elif (DHCP_SERVER_MAX_CLIENTS < 1)
55 #error DHCP_SERVER_MAX_CLIENTS parameter is not valid
59#ifndef DHCP_SERVER_DEFAULT_LEASE_TIME
60 #define DHCP_SERVER_DEFAULT_LEASE_TIME 86400
61#elif (DHCP_SERVER_DEFAULT_LEASE_TIME < 1)
62 #error DHCP_SERVER_DEFAULT_LEASE_TIME parameter is not valid
66#ifndef DHCP_SERVER_MAX_DNS_SERVERS
67 #define DHCP_SERVER_MAX_DNS_SERVERS 2
68#elif (DHCP_SERVER_MAX_DNS_SERVERS < 1)
69 #error DHCP_SERVER_MAX_DNS_SERVERS parameter is not valid
73#ifndef DHCP_SERVER_PRIVATE_CONTEXT
74 #define DHCP_SERVER_PRIVATE_CONTEXT
79#define DhcpServerContext struct _DhcpServerContext
150 DHCP_SERVER_PRIVATE_CONTEXT
157error_t dhcpServerInit(DhcpServerContext *context,
160error_t dhcpServerStart(DhcpServerContext *context);
161error_t dhcpServerStop(DhcpServerContext *context);
163void dhcpServerDeinit(DhcpServerContext *context);
DhcpMessageType
DHCP message types.
Definition dhcp_common.h:88
error_t(* DhcpServerParseOptionsCallback)(DhcpServerContext *context, const DhcpMessage *message, size_t length, DhcpMessageType type)
Parse DHCP options callback.
Definition dhcp_server.h:99
void(* DhcpServerAddOptionsCallback)(DhcpServerContext *context, DhcpMessage *message, size_t *length, DhcpMessageType type)
Add DHCP options callback.
Definition dhcp_server.h:91
error_t
Error codes.
Definition error.h:43
uint32_t Ipv4Addr
IPv4 network address.
Definition ipv4.h:267
uint32_t systime_t
System time.
Definition os_port_none.h:90
DHCP binding.
Definition dhcp_server.h:112
MacAddr macAddr
Client's MAC address.
Definition dhcp_server.h:113
Ipv4Addr ipAddr
Client's IPv4 address.
Definition dhcp_server.h:114
bool_t validLease
Valid lease.
Definition dhcp_server.h:115
systime_t timestamp
Timestamp.
Definition dhcp_server.h:116
DHCP server settings.
Definition dhcp_server.h:125
NetInterface * interface
Underlying network interface.
Definition dhcp_server.h:126
bool_t rapidCommit
Quick configuration using rapid commit.
Definition dhcp_server.h:128
DhcpServerAddOptionsCallback addOptionsCallback
Add DHCP options callback.
Definition dhcp_server.h:135
DhcpServerParseOptionsCallback parseOptionsCallback
Parse DHCP options callback.
Definition dhcp_server.h:136
uint_t ipAddrIndex
Index of the IP address assigned to the DHCP server.
Definition dhcp_server.h:127
uint32_t leaseTime
Lease time, in seconds, assigned to the DHCP clients.
Definition dhcp_server.h:129
Ipv4Addr ipAddrRangeMin
Lowest IP address in the pool that is available for dynamic address assignment.
Definition dhcp_server.h:130
Ipv4Addr ipAddrRangeMax
Highest IP address in the pool that is available for dynamic address assignment.
Definition dhcp_server.h:131
Ipv4Addr defaultGateway
Default gateway.
Definition dhcp_server.h:133
Ipv4Addr subnetMask
Subnet mask.
Definition dhcp_server.h:132
DHCP server context.
Definition dhcp_server.h:145
DhcpServerBinding clientBinding[DHCP_SERVER_MAX_CLIENTS]
List of bindings.
Definition dhcp_server.h:149
bool_t running
This flag tells whether the DHCP server is running or not.
Definition dhcp_server.h:147
DhcpServerSettings settings
DHCP server settings.
Definition dhcp_server.h:146
Ipv4Addr nextIpAddr
Next IP address to be assigned.
Definition dhcp_server.h:148