5 |
#define __LWIP_DHCP_H__ |
#define __LWIP_DHCP_H__ |
6 |
|
|
7 |
#include "udp.h" |
#include "udp.h" |
|
#include "lwip/netif.h" |
|
8 |
#include "lwipopts.h" |
#include "lwipopts.h" |
9 |
|
|
10 |
// period (in seconds) of the application calling dhcp_coarse_tmr() |
/** period (in seconds) of the application calling dhcp_coarse_tmr() */ |
11 |
#define DHCP_COARSE_TIMER_SECS 60 |
#define DHCP_COARSE_TIMER_SECS 60 |
12 |
// period (in milliseconds) of the application calling dhcp_fine_tmr() |
/** period (in milliseconds) of the application calling dhcp_fine_tmr() */ |
13 |
#define DHCP_FINE_TIMER_MSECS 500 |
#define DHCP_FINE_TIMER_MSECS 500 |
14 |
|
|
15 |
struct dhcp |
struct dhcp |
31 |
/** ingoing msg options length */ |
/** ingoing msg options length */ |
32 |
u16_t options_in_len; |
u16_t options_in_len; |
33 |
|
|
34 |
struct pbuf *p_out; // pbuf of outcoming msg |
struct pbuf *p_out; /* pbuf of outcoming msg */ |
35 |
struct dhcp_msg *msg_out; // outgoing msg |
struct dhcp_msg *msg_out; /* outgoing msg */ |
36 |
u16_t options_out_len; // outgoing msg options length |
u16_t options_out_len; /* outgoing msg options length */ |
37 |
u16_t request_timeout; // #ticks with period DHCP_FINE_TIMER_SECS for request timeout |
u16_t request_timeout; /* #ticks with period DHCP_FINE_TIMER_SECS for request timeout */ |
38 |
u16_t t1_timeout; // #ticks with period DHCP_COARSE_TIMER_SECS for renewal time |
u16_t t1_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for renewal time */ |
39 |
u16_t t2_timeout; // #ticks with period DHCP_COARSE_TIMER_SECS for rebind time |
u16_t t2_timeout; /* #ticks with period DHCP_COARSE_TIMER_SECS for rebind time */ |
40 |
struct ip_addr server_ip_addr; // dhcp server address that offered this lease |
struct ip_addr server_ip_addr; /* dhcp server address that offered this lease */ |
41 |
struct ip_addr offered_ip_addr; |
struct ip_addr offered_ip_addr; |
42 |
struct ip_addr offered_sn_mask; |
struct ip_addr offered_sn_mask; |
43 |
struct ip_addr offered_gw_addr; |
struct ip_addr offered_gw_addr; |
44 |
struct ip_addr offered_bc_addr; |
struct ip_addr offered_bc_addr; |
45 |
u32_t offered_t0_lease; // lease period (in seconds) |
u32_t offered_t0_lease; /* lease period (in seconds) */ |
46 |
u32_t offered_t1_renew; // recommended renew time (usually 50% of lease period) |
u32_t offered_t1_renew; /* recommended renew time (usually 50% of lease period) */ |
47 |
u32_t offered_t2_rebind; // recommended rebind time (usually 66% of lease period) |
u32_t offered_t2_rebind; /* recommended rebind time (usually 66% of lease period) */ |
48 |
}; |
}; |
49 |
|
|
50 |
/* MUST be compiled with "pack structs" or equivalent! */ |
/* MUST be compiled with "pack structs" or equivalent! */ |
176 |
#define DHCP_OPTION_END 255 |
#define DHCP_OPTION_END 255 |
177 |
|
|
178 |
/** DHCP options */ |
/** DHCP options */ |
179 |
#define DHCP_OPTION_REQUESTED_IP 50 // RFC 2132 9.1, requested IP address |
#define DHCP_OPTION_REQUESTED_IP 50 /* RFC 2132 9.1, requested IP address */ |
180 |
#define DHCP_OPTION_LEASE_TIME 51 // RFC 2132 9.2, time in seconds, in 4 bytes |
#define DHCP_OPTION_LEASE_TIME 51 /* RFC 2132 9.2, time in seconds, in 4 bytes */ |
181 |
#define DHCP_OPTION_OVERLOAD 52 // RFC2132 9.3, use file and/or sname field for options |
#define DHCP_OPTION_OVERLOAD 52 /* RFC2132 9.3, use file and/or sname field for options */ |
182 |
|
|
183 |
#define DHCP_OPTION_MESSAGE_TYPE 53 // RFC 2132 9.6, important for DHCP |
#define DHCP_OPTION_MESSAGE_TYPE 53 /* RFC 2132 9.6, important for DHCP */ |
184 |
#define DHCP_OPTION_MESSAGE_TYPE_LEN 1 |
#define DHCP_OPTION_MESSAGE_TYPE_LEN 1 |
185 |
|
|
186 |
|
|
187 |
#define DHCP_OPTION_SERVER_ID 54 // RFC 2131 9.7, server IP address |
#define DHCP_OPTION_SERVER_ID 54 /* RFC 2131 9.7, server IP address */ |
188 |
#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 // RFC 2131 9.8, requested option types |
#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 /* RFC 2131 9.8, requested option types */ |
189 |
|
|
190 |
#define DHCP_OPTION_MAX_MSG_SIZE 57 // RFC 2131 9.10, message size accepted >= 576 |
#define DHCP_OPTION_MAX_MSG_SIZE 57 /* RFC 2131 9.10, message size accepted >= 576 */ |
191 |
#define DHCP_OPTION_MAX_MSG_SIZE_LEN 2 |
#define DHCP_OPTION_MAX_MSG_SIZE_LEN 2 |
192 |
|
|
193 |
#define DHCP_OPTION_T1 58 // T1 renewal time |
#define DHCP_OPTION_T1 58 /* T1 renewal time */ |
194 |
#define DHCP_OPTION_T2 59 // T2 rebinding time |
#define DHCP_OPTION_T2 59 /* T2 rebinding time */ |
195 |
#define DHCP_OPTION_CLIENT_ID 61 |
#define DHCP_OPTION_CLIENT_ID 61 |
196 |
#define DHCP_OPTION_TFTP_SERVERNAME 66 |
#define DHCP_OPTION_TFTP_SERVERNAME 66 |
197 |
#define DHCP_OPTION_BOOTFILE 67 |
#define DHCP_OPTION_BOOTFILE 67 |
198 |
|
|
199 |
/** possible combinations of overloading the file and sname fields with options */ |
/** possible combinations of overloading the file and sname fields with options */ |
200 |
#define DHCP_OVERLOAD_NONE 0 |
#define DHCP_OVERLOAD_NONE 0 |
201 |
#define DHCP_OVERLOAD_FILE 1 |
#define DHCP_OVERLOAD_FILE 1 |
202 |
#define DHCP_OVERLOAD_SNAME 2 |
#define DHCP_OVERLOAD_SNAME 2 |
203 |
#define DHCP_OVERLOAD_SNAME_FILE 3 |
#define DHCP_OVERLOAD_SNAME_FILE 3 |
204 |
|
|
205 |
#endif //__LWIP_DHCP_H__ |
#endif /*__LWIP_DHCP_H__*/ |