11#ifndef ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_
12#define ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_
34#define DHCPV4_CLIENT_ID_MAX_SIZE 20
36enum dhcpv4_server_addr_state {
37 DHCPV4_SERVER_ADDR_FREE,
38 DHCPV4_SERVER_ADDR_RESERVED,
39 DHCPV4_SERVER_ADDR_ALLOCATED,
40 DHCPV4_SERVER_ADDR_DECLINED,
43struct dhcpv4_client_id {
44 uint8_t buf[DHCPV4_CLIENT_ID_MAX_SIZE];
48struct dhcpv4_addr_slot {
49 enum dhcpv4_server_addr_state
state;
50 struct dhcpv4_client_id client_id;
95 struct dhcpv4_addr_slot *lease,
128 const struct dhcpv4_client_id *client_id,
void net_dhcpv4_server_set_provider_cb(net_dhcpv4_server_provider_cb_t cb, void *user_data)
Set the callback used to provide addresses to the DHCP server.
int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr)
Start DHCPv4 server instance on an iface.
int(* net_dhcpv4_server_provider_cb_t)(struct net_if *iface, const struct dhcpv4_client_id *client_id, struct in_addr *addr, void *user_data)
Callback used to let application provide an address for a given client ID.
Definition dhcpv4_server.h:127
int net_dhcpv4_server_foreach_lease(struct net_if *iface, net_dhcpv4_lease_cb_t cb, void *user_data)
Iterate over all DHCPv4 address leases on a given network interface and call callback for each lease.
int net_dhcpv4_server_stop(struct net_if *iface)
Stop DHCPv4 server instance on an iface.
void(* net_dhcpv4_lease_cb_t)(struct net_if *iface, struct dhcpv4_addr_slot *lease, void *user_data)
Callback used while iterating over active DHCPv4 address leases.
Definition dhcpv4_server.h:94
IPv6 and IPv4 definitions.
state
Definition parser_state.h:29
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
IPv4 address struct.
Definition net_ip.h:154
Kernel timepoint type.
Definition sys_clock.h:219
Network Interface structure.
Definition net_if.h:690
Variables needed for system clock.