From d1c03cbd69eca1587b26e69bb3d520be7a135cef Mon Sep 17 00:00:00 2001 From: likewise Date: Thu, 20 Feb 2003 14:35:40 +0000 Subject: [PATCH] Fixed some issues open after merging 'leon-dhcp'. --- src/core/dhcp.c | 2 -- src/include/lwip/debug.h | 5 +++-- src/include/lwip/dhcp.h | 47 ++++++++++++++++++++-------------------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/core/dhcp.c b/src/core/dhcp.c index 95c4837c..e51e06f4 100644 --- a/src/core/dhcp.c +++ b/src/core/dhcp.c @@ -881,8 +881,6 @@ void dhcp_stop(struct netif *netif) { struct dhcp *dhcp = netif->dhcp; DEBUGF(DHCP_DEBUG, ("dhcp_stop()")); - LWIP_ASSERT("dhcp_stop: dhcp != NULL", dhcp != NULL); - LWIP_ASSERT("dhcp_stop: dhcp->pcb != NULL", dhcp->pcb != NULL); /* netif is DHCP configured? */ if (dhcp != NULL) { diff --git a/src/include/lwip/debug.h b/src/include/lwip/debug.h index 4e61ba89..18a263b7 100644 --- a/src/include/lwip/debug.h +++ b/src/include/lwip/debug.h @@ -59,19 +59,20 @@ /** flag for DEBUGF to halt after printing this debug message */ #define DBG_HALT 0x08 +#ifdef LWIP_DEBUG + #define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0) /** print debug message only if debug message is enabled AND is of correct type * AND is at least DBG_LEVEL */ #define DEBUGF(debug, x) do { if ((debug & DBG_ON) && (debug & DBG_TYPES_ON) && ((debug & DBG_MASK_LEVEL) >= DBG_MIN_LEVEL)) { LWIP_PLATFORM_DIAG(x); if (debug & DBG_HALT) while(1); } } while(0) #define LWIP_ERROR(x) do { LWIP_PLATFORM_DIAG(x); } while(0) -#ifndef LWIP_DEBUG +#else /* LWIP_DEBUG */ #define LWIP_ASSERT(x,y) #define DEBUGF(debug, x) #define LWIP_ERROR(x) - #define DBG_TYPES_ON 0U /** diff --git a/src/include/lwip/dhcp.h b/src/include/lwip/dhcp.h index 8ad722cc..60cd0d5a 100644 --- a/src/include/lwip/dhcp.h +++ b/src/include/lwip/dhcp.h @@ -5,12 +5,11 @@ #define __LWIP_DHCP_H__ #include "udp.h" -#include "lwip/netif.h" #include "lwipopts.h" -// period (in seconds) of the application calling dhcp_coarse_tmr() +/** period (in seconds) of the application calling dhcp_coarse_tmr() */ #define DHCP_COARSE_TIMER_SECS 60 -// period (in milliseconds) of the application calling dhcp_fine_tmr() +/** period (in milliseconds) of the application calling dhcp_fine_tmr() */ #define DHCP_FINE_TIMER_MSECS 500 struct dhcp @@ -32,20 +31,20 @@ struct dhcp /** ingoing msg options length */ u16_t options_in_len; - struct pbuf *p_out; // pbuf of outcoming msg - struct dhcp_msg *msg_out; // outgoing msg - u16_t options_out_len; // outgoing msg options length - 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 - struct ip_addr server_ip_addr; // dhcp server address that offered this lease + struct pbuf *p_out; /* pbuf of outcoming msg */ + struct dhcp_msg *msg_out; /* outgoing msg */ + u16_t options_out_len; /* outgoing msg options length */ + 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 */ + struct ip_addr server_ip_addr; /* dhcp server address that offered this lease */ struct ip_addr offered_ip_addr; struct ip_addr offered_sn_mask; struct ip_addr offered_gw_addr; struct ip_addr offered_bc_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 66% of lease period) + 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 66% of lease period) */ }; /* MUST be compiled with "pack structs" or equivalent! */ @@ -177,30 +176,30 @@ void dhcp_fine_tmr(void); #define DHCP_OPTION_END 255 /** DHCP options */ -#define DHCP_OPTION_REQUESTED_IP 50 // RFC 2132 9.1, requested IP address -#define DHCP_OPTION_LEASE_TIME 51 // RFC 2132 9.2, time in seconds, in 4 bytes -#define DHCP_OPTION_OVERLOAD 52 // RFC2132 9.3, use file and/or sname field for options +#define DHCP_OPTION_REQUESTED_IP 50 /* RFC 2132 9.1, requested IP address */ +#define DHCP_OPTION_LEASE_TIME 51 /* RFC 2132 9.2, time in seconds, in 4 bytes */ +#define DHCP_OPTION_OVERLOAD 52 /* RFC2132 9.3, use file and/or sname field for options */ -#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 */ #define DHCP_OPTION_MESSAGE_TYPE_LEN 1 -#define DHCP_OPTION_SERVER_ID 54 // RFC 2131 9.7, server IP address -#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 // RFC 2131 9.8, requested option types +#define DHCP_OPTION_SERVER_ID 54 /* RFC 2131 9.7, server IP address */ +#define DHCP_OPTION_PARAMETER_REQUEST_LIST 55 /* RFC 2131 9.8, requested option types */ -#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 */ #define DHCP_OPTION_MAX_MSG_SIZE_LEN 2 -#define DHCP_OPTION_T1 58 // T1 renewal time -#define DHCP_OPTION_T2 59 // T2 rebinding time +#define DHCP_OPTION_T1 58 /* T1 renewal time */ +#define DHCP_OPTION_T2 59 /* T2 rebinding time */ #define DHCP_OPTION_CLIENT_ID 61 #define DHCP_OPTION_TFTP_SERVERNAME 66 #define DHCP_OPTION_BOOTFILE 67 -/** possible combinations of overloading the file and sname fields with options */ +/** possible combinations of overloading the file and sname fields with options */ #define DHCP_OVERLOAD_NONE 0 #define DHCP_OVERLOAD_FILE 1 #define DHCP_OVERLOAD_SNAME 2 #define DHCP_OVERLOAD_SNAME_FILE 3 -#endif //__LWIP_DHCP_H__ +#endif /*__LWIP_DHCP_H__*/