Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
DHCPv4 server

DHCPv4 server. More...

Typedefs

typedef 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.
 

Functions

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_stop (struct net_if *iface)
 Stop DHCPv4 server instance on an iface.
 
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.
 

Detailed Description

DHCPv4 server.

Typedef Documentation

◆ net_dhcpv4_lease_cb_t

net_dhcpv4_lease_cb_t

#include <zephyr/net/dhcpv4_server.h>

Callback used while iterating over active DHCPv4 address leases.

Parameters
ifacePointer to the network interface
leasePointer to the DHPCv4 address lease slot
user_dataA valid pointer to user data or NULL

Function Documentation

◆ net_dhcpv4_server_foreach_lease()

int net_dhcpv4_server_foreach_lease ( struct net_if iface,
net_dhcpv4_lease_cb_t  cb,
void *  user_data 
)

#include <zephyr/net/dhcpv4_server.h>

Iterate over all DHCPv4 address leases on a given network interface and call callback for each lease.

In case no network interface is provided (NULL interface pointer), will iterate over all interfaces running DHCPv4 server instance.

Parameters
ifacePointer to the network interface, can be NULL
cbUser-supplied callback function to call
user_dataUser specified data

◆ net_dhcpv4_server_start()

int net_dhcpv4_server_start ( struct net_if iface,
struct in_addr base_addr 
)

#include <zephyr/net/dhcpv4_server.h>

Start DHCPv4 server instance on an iface.

Start DHCPv4 server on a given interface. The server will start listening for DHCPv4 Discover/Request messages on the interface and assign IPv4 addresses from the configured address pool accordingly.

Parameters
ifaceA valid pointer on an interface
base_addrFirst IPv4 address from the DHCPv4 address pool. The number of addresses in the pool is configured statically with Kconfig (CONFIG_NET_DHCPV4_SERVER_ADDR_COUNT).
Returns
0 on success, a negative error code otherwise.

◆ net_dhcpv4_server_stop()

int net_dhcpv4_server_stop ( struct net_if iface)

#include <zephyr/net/dhcpv4_server.h>

Stop DHCPv4 server instance on an iface.

Stop DHCPv4 server on a given interface. DHCPv4 requests will no longer be handled on the interface, and all of the allocations are cleared.

Parameters
ifaceA valid pointer on an interface
Returns
0 on success, a negative error code otherwise.