4 #ifndef __LWIP_DHCP_H__
5 #define __LWIP_DHCP_H__
19 #define DHCP_COARSE_TIMER_SECS 60
21 #define DHCP_COARSE_TIMER_MSECS (DHCP_COARSE_TIMER_SECS * 1000UL)
23 #define DHCP_FINE_TIMER_MSECS 500
25 #define DHCP_CHADDR_LEN 16U
26 #define DHCP_SNAME_LEN 64U
27 #define DHCP_FILE_LEN 128U
36 struct dhcp_msg *msg_in;
41 #if LWIP_DHCP_AUTOIP_COOP
42 u8_t autoip_coop_state;
44 u8_t subnet_mask_given;
47 struct dhcp_msg *msg_out;
48 u16_t options_out_len;
49 u16_t request_timeout;
57 u32_t offered_t0_lease;
58 u32_t offered_t1_renew;
59 u32_t offered_t2_rebind;
62 #if LWIP_DHCP_BOOTP_FILE
64 char boot_file_name[DHCP_FILE_LEN];
69 #ifdef PACK_STRUCT_USE_INCLUDES
70 # include "arch/bpstruct.h"
91 #define DHCP_MIN_OPTIONS_LEN 68U
93 #if ((defined(DHCP_OPTIONS_LEN)) && (DHCP_OPTIONS_LEN < DHCP_MIN_OPTIONS_LEN))
94 # undef DHCP_OPTIONS_LEN
97 #if (!defined(DHCP_OPTIONS_LEN))
99 # define DHCP_OPTIONS_LEN DHCP_MIN_OPTIONS_LEN
104 #ifdef PACK_STRUCT_USE_INCLUDES
105 # include "arch/epstruct.h"
108 void dhcp_set_struct(
struct netif *
netif,
struct dhcp *dhcp);
110 #define dhcp_remove_struct(netif) do { (netif)->dhcp = NULL; } while(0)
123 void dhcp_network_changed(
struct netif *
netif);
126 #if DHCP_DOES_ARP_CHECK
131 void dhcp_coarse_tmr(
void);
133 void dhcp_fine_tmr(
void);
136 #define DHCP_OP_OFS 0
137 #define DHCP_HTYPE_OFS 1
138 #define DHCP_HLEN_OFS 2
139 #define DHCP_HOPS_OFS 3
140 #define DHCP_XID_OFS 4
141 #define DHCP_SECS_OFS 8
142 #define DHCP_FLAGS_OFS 10
143 #define DHCP_CIADDR_OFS 12
144 #define DHCP_YIADDR_OFS 16
145 #define DHCP_SIADDR_OFS 20
146 #define DHCP_GIADDR_OFS 24
147 #define DHCP_CHADDR_OFS 28
148 #define DHCP_SNAME_OFS 44
149 #define DHCP_FILE_OFS 108
150 #define DHCP_MSG_LEN 236
152 #define DHCP_COOKIE_OFS DHCP_MSG_LEN
153 #define DHCP_OPTIONS_OFS (DHCP_MSG_LEN + 4)
155 #define DHCP_CLIENT_PORT 68
156 #define DHCP_SERVER_PORT 67
160 #define DHCP_REQUESTING 1
162 #define DHCP_REBOOTING 3
163 #define DHCP_REBINDING 4
164 #define DHCP_RENEWING 5
165 #define DHCP_SELECTING 6
166 #define DHCP_INFORMING 7
167 #define DHCP_CHECKING 8
168 #define DHCP_PERMANENT 9
169 #define DHCP_BOUND 10
171 #define DHCP_BACKING_OFF 12
174 #define DHCP_AUTOIP_COOP_STATE_OFF 0
175 #define DHCP_AUTOIP_COOP_STATE_ON 1
177 #define DHCP_BOOTREQUEST 1
178 #define DHCP_BOOTREPLY 2
181 #define DHCP_DISCOVER 1
183 #define DHCP_REQUEST 3
184 #define DHCP_DECLINE 4
187 #define DHCP_RELEASE 7
188 #define DHCP_INFORM 8
191 #define DHCP_HTYPE_ETH 1
193 #define DHCP_MAGIC_COOKIE 0x63825363UL
198 #define DHCP_OPTION_PAD 0
199 #define DHCP_OPTION_SUBNET_MASK 1
200 #define DHCP_OPTION_ROUTER 3
201 #define DHCP_OPTION_DNS_SERVER 6
202 #define DHCP_OPTION_HOSTNAME 12
203 #define DHCP_OPTION_IP_TTL 23
204 #define DHCP_OPTION_MTU 26
205 #define DHCP_OPTION_BROADCAST 28
206 #define DHCP_OPTION_TCP_TTL 37
207 #define DHCP_OPTION_END 255
210 #define DHCP_OPTION_REQUESTED_IP 50
211 #define DHCP_OPTION_LEASE_TIME 51
212 #define DHCP_OPTION_OVERLOAD 52
214 #define DHCP_OPTION_MESSAGE_TYPE 53
215 #define DHCP_OPTION_MESSAGE_TYPE_LEN 1
217 #define DHCP_OPTION_SERVER_ID 54
218 #define DHCP_OPTION_PARAMETER_REQUEST_LIST 55
220 #define DHCP_OPTION_MAX_MSG_SIZE 57
221 #define DHCP_OPTION_MAX_MSG_SIZE_LEN 2
223 #define DHCP_OPTION_T1 58
224 #define DHCP_OPTION_T2 59
225 #define DHCP_OPTION_US 60
226 #define DHCP_OPTION_CLIENT_ID 61
227 #define DHCP_OPTION_TFTP_SERVERNAME 66
228 #define DHCP_OPTION_BOOTFILE 67
231 #define DHCP_OVERLOAD_NONE 0
232 #define DHCP_OVERLOAD_FILE 1
233 #define DHCP_OVERLOAD_SNAME 2
234 #define DHCP_OVERLOAD_SNAME_FILE 3