Embedded TCP/IP stack  4.7.0
fnet_dhcp_srv.h
1 /**************************************************************************
2 *
3 * Copyright 2017-2018 by Andrey Butok. FNET Community.
4 *
5 ***************************************************************************
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may
8 * not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 ***************************************************************************
20 *
21 * FNET DHCPv4 Server API.
22 *
23 ***************************************************************************/
24 
25 #ifndef _FNET_DHCP_SRV_H_
26 
27 #define _FNET_DHCP_SRV_H_
28 
29 #if FNET_CFG_DHCP_SRV || defined(__DOXYGEN__)
30 
48 /**************************************************************************/
51 typedef struct
52 {
58  fnet_uint32_t lease_time;
64 #if FNET_CFG_DNS
65  fnet_ip4_addr_t dns;
67 #endif
69 
70 /**************************************************************************/
73 typedef struct
74 {
79 
80 /**************************************************************************/
84 typedef void *fnet_dhcp_srv_desc_t;
85 
86 #if defined(__cplusplus)
87 extern "C" {
88 #endif
89 
90 /***************************************************************************/
112 
113 /***************************************************************************/
128 
129 /***************************************************************************/
150 
151 /***************************************************************************/
167 
168 /***************************************************************************/
187 
188 
189 #if defined(__cplusplus)
190 }
191 #endif
192 
195 #endif /* FNET_CFG_DHCP_SRV */
196 
197 #endif /* _FNET_DHCP_SRV_H_ */
fnet_time_t lease_time
Lease time (in seconds).
Definition: fnet_dhcp_srv.h:77
fnet_bool_t fnet_dhcp_srv_get_addr_pool_info(fnet_dhcp_srv_desc_t desc, fnet_index_t n, fnet_dhcp_srv_addr_pool_info_t *addr_info)
Retrieves an address pool information.
fnet_uint32_t fnet_time_t
Unsigned integer type representing time uinits. It can be seconds or milliseconds.
Definition: fnet_timer.h:64
fnet_uint32_t lease_time
Default lease time in seconds. If it is set to 0, the FNET_CFG_DHCP_SRV_LEASE_TIME value is used...
Definition: fnet_dhcp_srv.h:58
fnet_netif_desc_t netif
Network interface descriptor to be used by the DHCP server.
Definition: fnet_dhcp_srv.h:53
fnet_ip4_addr_t subnet_mask
Subnet mask. If it is set to INADDR_ANY, a subnet mask of the netif interface is used.
Definition: fnet_dhcp_srv.h:60
fnet_bool_t fnet_dhcp_srv_is_enabled(fnet_dhcp_srv_desc_t desc)
Detects if the DHCP server service is enabled or disabled.
fnet_ip4_addr_t gateway
Gateway IPv4 address. If it is set to INADDR_ANY, a gateway address of the netif interface is used...
Definition: fnet_dhcp_srv.h:62
unsigned long fnet_size_t
Unsigned integer type representing the size in bytes.
Definition: fnet_stdlib.h:55
Initialization parameters for the fnet_dhcp_srv_init() function.
Definition: fnet_dhcp_srv.h:51
Address pool information structure.
Definition: fnet_dhcp_srv.h:73
fnet_ip4_addr_t ip_addr_pool_start
The first allocated IPv4 address in the DHCPv4 server pool. The address pool size is defined by ip_...
Definition: fnet_dhcp_srv.h:54
fnet_bool_t
Boolean type.
Definition: fnet_stdlib.h:80
fnet_ip4_addr_t client_ip4_addr
Client IPv4 address allocated by the DHCPv4 server.
Definition: fnet_dhcp_srv.h:76
fnet_dhcp_srv_desc_t fnet_dhcp_srv_get_by_netif(fnet_netif_desc_t netif)
Looks for a DHCP Server assigned to the specified network interface.
fnet_size_t ip_addr_pool_size
Size of the address pool. It may not be set a value more than FNET_CFG_DHCP_SRV_ADDR_POOL_SIZE. If it is set to 0, the FNET_CFG_DHCP_SRV_ADDR_POOL_SIZE value is used.
Definition: fnet_dhcp_srv.h:56
unsigned int fnet_index_t
Unsigned integer type representing the index.
Definition: fnet_stdlib.h:70
fnet_uint32_t fnet_ip4_addr_t
32-bit IPv4 address type.
Definition: fnet_ip4.h:35
fnet_mac_addr_t client_mac_addr
Client-identifier (MAC address)
Definition: fnet_dhcp_srv.h:75
void * fnet_netif_desc_t
Network interface descriptor.
Definition: fnet_netif.h:68
fnet_uint8_t fnet_mac_addr_t[6]
Media Access Control (MAC) address type.
Definition: fnet_eth.h:57
void * fnet_dhcp_srv_desc_t
DHCPv4 server descriptor.
Definition: fnet_dhcp_srv.h:84
void fnet_dhcp_srv_release(fnet_dhcp_srv_desc_t desc)
Releases the DHCPv4 server service.
fnet_dhcp_srv_desc_t fnet_dhcp_srv_init(fnet_dhcp_srv_params_t *params)
Initializes the DHCPv4 server service.

© 2005-2020 by Andrej Butok. http://fnet.sourceforge.net