Select one of the symbols to view example projects that use it.
 
Outline
#define LWIP_HDR_DHCP_H
#include "lwip/opt.h"
#include "lwip/netif.h"
#include "lwip/udp.h"
#define DHCP_COARSE_TIMER_SECS
#define DHCP_COARSE_TIMER_MSECS
#define DHCP_FINE_TIMER_MSECS
#define DHCP_BOOT_FILE_LEN
dhcp_autoip_coop_state_enum_t
dhcp
dhcp_set_struct(struct netif *, struct dhcp *);
#define dhcp_remove_struct
dhcp_cleanup(struct netif *);
dhcp_start(struct netif *);
dhcp_renew(struct netif *);
dhcp_release(struct netif *);
dhcp_stop(struct netif *);
dhcp_release_and_stop(struct netif *);
dhcp_inform(struct netif *);
dhcp_network_changed(struct netif *);
dhcp_arp_reply(struct netif *, const ip4_addr_t *);
dhcp_supplied_address(const struct netif *);
dhcp_coarse_tmr();
dhcp_fine_tmr();
#define netif_dhcp_data
Files
loading...
SourceVuSTM32 Libraries and SamplesLwIPsrc/include/lwip/dhcp.h
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** * @file * DHCP client API *//* ... */ /* * Copyright (c) 2001-2004 Leon Woestenberg <leon.woestenberg@gmx.net> * Copyright (c) 2001-2004 Axon Digital Design B.V., The Netherlands. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. * * This file is part of the lwIP TCP/IP stack. * * Author: Leon Woestenberg <leon.woestenberg@gmx.net> * *//* ... */ #ifndef LWIP_HDR_DHCP_H #define LWIP_HDR_DHCP_H #include "lwip/opt.h" #if LWIP_DHCP /* don't build if not configured for use in lwipopts.h */ #include "lwip/netif.h" #include "lwip/udp.h" #ifdef __cplusplus extern "C" { #endif /** period (in seconds) of the application calling dhcp_coarse_tmr() */ #define DHCP_COARSE_TIMER_SECS 60 /** period (in milliseconds) of the application calling dhcp_coarse_tmr() */ #define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL) /** period (in milliseconds) of the application calling dhcp_fine_tmr() */ #define DHCP_FINE_TIMER_MSECS 500 #define DHCP_BOOT_FILE_LEN 128U /* AutoIP cooperation flags (struct dhcp.autoip_coop_state) */ typedef enum { DHCP_AUTOIP_COOP_STATE_OFF = 0, DHCP_AUTOIP_COOP_STATE_ON = 1 ...} dhcp_autoip_coop_state_enum_t; struct dhcp { /** transaction identifier of last sent request */ u32_t xid; /** track PCB allocation state */ u8_t pcb_allocated; /** current DHCP state machine state */ u8_t state; /** retries of current request */ u8_t tries; #if LWIP_DHCP_AUTOIP_COOP u8_t autoip_coop_state; #endif u8_t subnet_mask_given; u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */ u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */ u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */ u16_t t1_renew_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next renew try */ u16_t t2_rebind_time; /* #ticks with period DHCP_COARSE_TIMER_SECS until next rebind try */ u16_t lease_used; /* #ticks with period DHCP_COARSE_TIMER_SECS since last received DHCP ack */ u16_t t0_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for lease time */ ip_addr_t server_ip_addr; /* dhcp server address that offered this lease (ip_addr_t because passed to UDP) */ ip4_addr_t offered_ip_addr; ip4_addr_t offered_sn_mask; ip4_addr_t offered_gw_addr; u32_t offered_t0_lease; /* lease period (in seconds) */ u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ u32_t offered_t2_rebind; /* recommended rebind time (usually 87.5 of lease period) */ #if LWIP_DHCP_BOOTP_FILE ip4_addr_t offered_si_addr; char boot_file_name[DHCP_BOOT_FILE_LEN];/* ... */ #endif /* LWIP_DHCP_BOOTPFILE */ ...}; void dhcp_set_struct(struct netif *netif, struct dhcp *dhcp); /** Remove a struct dhcp previously set to the netif using dhcp_set_struct() */ #define dhcp_remove_struct(netif) netif_set_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP, NULL) void dhcp_cleanup(struct netif *netif); err_t dhcp_start(struct netif *netif); err_t dhcp_renew(struct netif *netif); err_t dhcp_release(struct netif *netif); void dhcp_stop(struct netif *netif); void dhcp_release_and_stop(struct netif *netif); void dhcp_inform(struct netif *netif); void dhcp_network_changed(struct netif *netif); #if DHCP_DOES_ARP_CHECK void dhcp_arp_reply(struct netif *netif, const ip4_addr_t *addr); #endif u8_t dhcp_supplied_address(const struct netif *netif); /* to be called every minute */ void dhcp_coarse_tmr(void); /* to be called every half second */ void dhcp_fine_tmr(void); #if LWIP_DHCP_GET_NTP_SRV /** This function must exist, in other to add offered NTP servers to * the NTP (or SNTP) engine. * See LWIP_DHCP_MAX_NTP_SERVERS *//* ... */ extern void dhcp_set_ntp_servers(u8_t num_ntp_servers, const ip4_addr_t* ntp_server_addrs);/* ... */ #endif /* LWIP_DHCP_GET_NTP_SRV */ #define netif_dhcp_data(netif) ((struct dhcp*)netif_get_client_data(netif, LWIP_NETIF_CLIENT_DATA_INDEX_DHCP)) #ifdef __cplusplus }extern "C" { ... } #endif /* ... */ #endif /* LWIP_DHCP */ /* ... */ #endif /*LWIP_HDR_DHCP_H*/
Details