dhcp: covert DHCP_OPTION_IDX_* from defines to enum (mainly to ease offset calculation)

This commit is contained in:
sg 2016-12-14 21:56:39 +01:00
parent cd5dfa2bc5
commit 53b9f2a5bd

View File

@ -108,21 +108,23 @@
* This might be moved into the struct dhcp (not necessarily since * This might be moved into the struct dhcp (not necessarily since
* lwIP is single-threaded and the array is only used while in recv * lwIP is single-threaded and the array is only used while in recv
* callback). */ * callback). */
#define DHCP_OPTION_IDX_OVERLOAD 0 enum dhcp_option_idx {
#define DHCP_OPTION_IDX_MSG_TYPE 1 DHCP_OPTION_IDX_OVERLOAD = 0,
#define DHCP_OPTION_IDX_SERVER_ID 2 DHCP_OPTION_IDX_MSG_TYPE,
#define DHCP_OPTION_IDX_LEASE_TIME 3 DHCP_OPTION_IDX_SERVER_ID,
#define DHCP_OPTION_IDX_T1 4 DHCP_OPTION_IDX_LEASE_TIME,
#define DHCP_OPTION_IDX_T2 5 DHCP_OPTION_IDX_T1,
#define DHCP_OPTION_IDX_SUBNET_MASK 6 DHCP_OPTION_IDX_T2,
#define DHCP_OPTION_IDX_ROUTER 7 DHCP_OPTION_IDX_SUBNET_MASK,
#define DHCP_OPTION_IDX_DNS_SERVER 8 DHCP_OPTION_IDX_ROUTER,
DHCP_OPTION_IDX_DNS_SERVER,
DHCP_OPTION_IDX_DNS_SERVER_LAST = DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS - 1,
#if LWIP_DHCP_GET_NTP_SRV #if LWIP_DHCP_GET_NTP_SRV
#define DHCP_OPTION_IDX_NTP_SERVER (DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS) DHCP_OPTION_IDX_NTP_SERVER,
#define DHCP_OPTION_IDX_MAX (DHCP_OPTION_IDX_NTP_SERVER + LWIP_DHCP_MAX_NTP_SERVERS) DHCP_OPTION_IDX_NTP_SERVER_LAST = DHCP_OPTION_IDX_NTP_SERVER + LWIP_DHCP_MAX_NTP_SERVERS - 1,
#else /* LWIP_DHCP_GET_NTP_SRV */
#define DHCP_OPTION_IDX_MAX (DHCP_OPTION_IDX_DNS_SERVER + DNS_MAX_SERVERS)
#endif /* LWIP_DHCP_GET_NTP_SRV */ #endif /* LWIP_DHCP_GET_NTP_SRV */
DHCP_OPTION_IDX_MAX
};
/** Holds the decoded option values, only valid while in dhcp_recv. /** Holds the decoded option values, only valid while in dhcp_recv.
@todo: move this into struct dhcp? */ @todo: move this into struct dhcp? */