Zephyr API Documentation  3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
dhcpv4_server.h
Go to the documentation of this file.
1
5/*
6 * Copyright (c) 2024 Nordic Semiconductor ASA
7 *
8 * SPDX-License-Identifier: Apache-2.0
9 */
10
11#ifndef ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_
12#define ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_
13
14#include <zephyr/net/net_ip.h>
15#include <zephyr/sys_clock.h>
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
30struct net_if;
31
32#define DHCPV4_CLIENT_ID_MAX_SIZE 20
33
34enum dhcpv4_server_addr_state {
35 DHCPV4_SERVER_ADDR_FREE,
36 DHCPV4_SERVER_ADDR_RESERVED,
37 DHCPV4_SERVER_ADDR_ALLOCATED,
38 DHCPV4_SERVER_ADDR_DECLINED,
39};
40
41struct dhcpv4_client_id {
42 uint8_t buf[DHCPV4_CLIENT_ID_MAX_SIZE];
43 uint8_t len;
44};
45
46struct dhcpv4_addr_slot {
47 enum dhcpv4_server_addr_state state;
48 struct dhcpv4_client_id client_id;
49 struct in_addr addr;
50 uint32_t lease_time;
51 k_timepoint_t expiry;
52};
53
70int net_dhcpv4_server_start(struct net_if *iface, struct in_addr *base_addr);
71
82int net_dhcpv4_server_stop(struct net_if *iface);
83
92typedef void (*net_dhcpv4_lease_cb_t)(struct net_if *iface,
93 struct dhcpv4_addr_slot *lease,
94 void *user_data);
95
108 void *user_data);
109
114#ifdef __cplusplus
115}
116#endif
117
118#endif /* ZEPHYR_INCLUDE_NET_DHCPV4_SERVER_H_ */
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_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:92
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:151
Kernel timepoint type.
Definition: sys_clock.h:219
Network Interface structure.
Definition: net_if.h:675
Variables needed for system clock.