Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
|
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. | |
typedef 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. | |
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. | |
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. | |
DHCPv4 server .
typedef void(* net_dhcpv4_lease_cb_t) (struct net_if *iface, struct dhcpv4_addr_slot *lease, void *user_data) |
#include <zephyr/net/dhcpv4_server.h>
Callback used while iterating over active DHCPv4 address leases.
iface | Pointer to the network interface |
lease | Pointer to the DHPCv4 address lease slot |
user_data | A valid pointer to user data or NULL |
typedef 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) |
#include <zephyr/net/dhcpv4_server.h>
Callback used to let application provide an address for a given client ID.
This function is called before assigning an address to a client, and lets the application override the address for a given client. If the callback returns 0, addr needs to be a valid address and will be assigned to the client. If the callback returns anything non-zero, the client will be assigned an address from the pool.
iface | Pointer to the network interface |
client_id | Pointer to client requesting an address |
addr | Address to be assigned to client |
user_data | A valid pointer to user data or NULL |
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.
iface | Pointer to the network interface, can be NULL |
cb | User-supplied callback function to call |
user_data | User specified data |
void net_dhcpv4_server_set_provider_cb | ( | net_dhcpv4_server_provider_cb_t | cb, |
void * | user_data ) |
#include <zephyr/net/dhcpv4_server.h>
Set the callback used to provide addresses to the DHCP server.
cb | User-supplied callback function to call |
user_data | A valid pointer to user data or NULL |
#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.
iface | A valid pointer on an interface |
base_addr | First 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). |
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.
iface | A valid pointer on an interface |