Fixed some issues open after merging 'leon-dhcp'. Added new debugging.

This commit is contained in:
likewise
2003-02-20 13:13:51 +00:00
parent cc31bb9358
commit 37629fc1b6
5 changed files with 132 additions and 245 deletions

View File

@@ -32,208 +32,86 @@
#ifndef __LWIP_DEBUG_H__
#define __LWIP_DEBUG_H__
#include "lwipopts.h"
#include "arch/cc.h"
#ifdef LWIP_DEBUG
/** lower two bits indicate debug level
* - 0 off
* - 1 warning
* - 2 serious
* - 3 severe
*/
#define DBG_MASK_LEVEL 3
/** print only debug messages with this level or higher */
#define DBG_MIN_LEVEL 0
/** flag for DEBUGF to enable the debug message */
#define DBG_ON 0x80U
/** flag for DEBUGF to disable the debug message */
#define DBG_OFF 0x00U
/** flag for DEBUGF to indicate it is a tracing message (to follow program flow) */
#define DBG_TRACE 0x40
/** flag for DEBUGF to indicate it is a state debug message (to follow states) */
#define DBG_STATE 0x20
/** flag for DEBUGF that indicates newly added code, not thoroughly tested yet */
#define DBG_FRESH 0x10
/** flag for DEBUGF to halt after printing this debug message */
#define DBG_HALT 0x08
#define LWIP_ASSERT(x,y) do { if(!(y)) LWIP_PLATFORM_ASSERT(x); } while(0)
#define DEBUGF(debug, x) do { if(debug) LWIP_PLATFORM_DIAG(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)
/* These defines control the amount of debugging output: */
#define MEM_TRACKING
#ifndef LWIP_DEBUG
#ifndef DEMO_DEBUG
#define DEMO_DEBUG 0
#endif
#ifndef ETHARP_DEBUG
#define ETHARP_DEBUG 0
#endif
#ifndef NETIF_DEBUG
#define NETIF_DEBUG 0
#endif
#ifndef PBUF_DEBUG
#define PBUF_DEBUG 0
#endif
#ifndef DELIF_DEBUG
#define DELIF_DEBUG 0
#endif
#ifndef DROPIF_DEBUG
#define DROPIF_DEBUG 0
#endif
#ifndef TUNIF_DEBUG
#define TUNIF_DEBUG 0
#endif
#ifndef UNIXIF_DEBUG
#define UNIXIF_DEBUG 0
#endif
#ifndef TAPIF_DEBUG
#define TAPIF_DEBUG 0
#endif
#ifndef SIO_FIFO_DEBUG
#define SIO_FIFO_DEBUG 0
#endif
#ifndef SLIP_DEBUG
#define SLIP_DEBUG 0
#endif
#ifndef PPP_DEBUG
#define PPP_DEBUG 0
#endif
#ifndef API_LIB_DEBUG
#define API_LIB_DEBUG 0
#endif
#ifndef API_MSG_DEBUG
#define API_MSG_DEBUG 0
#endif
#ifndef SOCKETS_DEBUG
#define SOCKETS_DEBUG 0
#endif
#ifndef ICMP_DEBUG
#define ICMP_DEBUG 0
#endif
#ifndef INET_DEBUG
#define INET_DEBUG 0
#endif
#ifndef IP_DEBUG
#define IP_DEBUG 0
#endif
#ifndef IP_REASS_DEBUG
#define IP_REASS_DEBUG 0
#endif
#ifndef MEM_DEBUG
#define MEM_DEBUG 0
#endif
#ifndef MEMP_DEBUG
#define MEMP_DEBUG 0
#endif
#ifndef SYS_DEBUG
#define SYS_DEBUG 0
#endif
#ifndef TCP_DEBUG
#define TCP_DEBUG 0
#endif
#ifndef TCP_INPUT_DEBUG
#define TCP_INPUT_DEBUG 0
#endif
#ifndef TCP_FR_DEBUG
#define TCP_FR_DEBUG 0
#endif
#ifndef TCP_RTO_DEBUG
#define TCP_RTO_DEBUG 0
#endif
#ifndef TCP_REXMIT_DEBUG
#define TCP_REXMIT_DEBUG 0
#endif
#ifndef TCP_CWND_DEBUG
#define TCP_CWND_DEBUG 0
#endif
#ifndef TCP_WND_DEBUG
#define TCP_WND_DEBUG 0
#endif
#ifndef TCP_OUTPUT_DEBUG
#define TCP_OUTPUT_DEBUG 0
#endif
#ifndef TCP_RST_DEBUG
#define TCP_RST_DEBUG 0
#endif
#ifndef TCP_QLEN_DEBUG
#define TCP_QLEN_DEBUG 0
#endif
#ifndef UDP_DEBUG
#define UDP_DEBUG 0
#endif
#ifndef TCPIP_DEBUG
#define TCPIP_DEBUG 0
#endif
#ifndef TCPDUMP_DEBUG
#define TCPDUMP_DEBUG 0
#endif
#ifndef DHCP_DEBUG
#define DHCP_DEBUG 0
#endif
#define LWIP_ASSERT(x,y)
#define DEBUGF(debug, x)
#define LWIP_ERROR(x)
#define DBG_TYPES_ON 0U
#else /* LWIP_DEBUG */
/* DEBUG is not defined, so we define null macros for LWIP_ASSERT , DEBUGF and LWIP_ERROR */
#define LWIP_ASSERT(x,y)
#define DEBUGF(debug, x)
#define LWIP_ERROR(x)
/* And we define those to be zero: */
#define DEMO_DEBUG 0
#define ETHARP_DEBUG 0
#define NETIF_DEBUG 0
#define PBUF_DEBUG 0
#define DELIF_DEBUG 0
#define DROPIF_DEBUG 0
#define TUNIF_DEBUG 0
#define UNIXIF_DEBUG 0
#define TAPIF_DEBUG 0
#define SIO_FIFO_DEBUG 0
#define PPP_DEBUG 0
#define API_LIB_DEBUG 0
#define API_MSG_DEBUG 0
#define SOCKETS_DEBUG 0
#define ICMP_DEBUG 0
#define INET_DEBUG 0
#define IP_DEBUG 0
#define IP_REASS_DEBUG 0
#define MEM_DEBUG 0
#define MEMP_DEBUG 0
#define SYS_DEBUG 0
#define TCP_DEBUG 0
#define TCP_INPUT_DEBUG 0
#define TCP_FR_DEBUG 0
#define TCP_RTO_DEBUG 0
#define TCP_REXMIT_DEBUG 0
#define TCP_CWND_DEBUG 0
#define TCP_WND_DEBUG 0
#define TCP_OUTPUT_DEBUG 0
#define TCP_RST_DEBUG 0
#define TCP_QLEN_DEBUG 0
#define UDP_DEBUG 0
#define TCPIP_DEBUG 0
#define TCPDUMP_DEBUG 0
#define DHCP_DEBUG 0
/**
* Disable all debug messages
*/
#define DEMO_DEBUG DBG_OFF
#define ETHARP_DEBUG DBG_OFF
#define NETIF_DEBUG DBG_OFF
#define PBUF_DEBUG DBG_OFF
#define DELIF_DEBUG DBG_OFF
#define DROPIF_DEBUG DBG_OFF
#define TUNIF_DEBUG DBG_OFF
#define UNIXIF_DEBUG DBG_OFF
#define TAPIF_DEBUG DBG_OFF
#define SIO_FIFO_DEBUG DBG_OFF
#define PPP_DEBUG DBG_OFF
#define API_LIB_DEBUG DBG_OFF
#define API_MSG_DEBUG DBG_OFF
#define SOCKETS_DEBUG DBG_OFF
#define ICMP_DEBUG DBG_OFF
#define INET_DEBUG DBG_OFF
#define IP_DEBUG DBG_OFF
#define IP_REASS_DEBUG DBG_OFF
#define MEM_DEBUG DBG_OFF
#define MEMP_DEBUG DBG_OFF
#define SYS_DEBUG DBG_OFF
#define TCP_DEBUG DBG_OFF
#define TCP_INPUT_DEBUG DBG_OFF
#define TCP_FR_DEBUG DBG_OFF
#define TCP_RTO_DEBUG DBG_OFF
#define TCP_REXMIT_DEBUG DBG_OFF
#define TCP_CWND_DEBUG DBG_OFF
#define TCP_WND_DEBUG DBG_OFF
#define TCP_OUTPUT_DEBUG DBG_OFF
#define TCP_RST_DEBUG DBG_OFF
#define TCP_QLEN_DEBUG DBG_OFF
#define UDP_DEBUG DBG_OFF
#define TCPIP_DEBUG DBG_OFF
#define TCPDUMP_DEBUG DBG_OFF
#define DHCP_DEBUG DBG_OFF
#endif /* LWIP_DEBUG */

View File

@@ -90,7 +90,7 @@ PACK_STRUCT_END
/** initialize DHCP client */
void dhcp_init(void);
/** start DHCP configuration */
struct dhcp_state *dhcp_start(struct netif *netif);
err_t dhcp_start(struct netif *netif);
/** stop DHCP configuration */
void dhcp_stop(struct netif *netif);
/** enforce lease renewal */
@@ -99,7 +99,7 @@ err_t dhcp_renew(struct netif *netif);
void dhcp_inform(struct netif *netif);
/** if enabled, check whether the offered IP address is not in use, using ARP */
#if DHCP_DOES_ARP_CHECK
#if DHCP_DOES_ARP_CHECK
void dhcp_arp_reply(struct netif *netif, struct ip_addr *addr);
#endif

View File

@@ -50,13 +50,13 @@
/** whether the network interface is 'up'. this is
* a software flag used to control whether this network
* interface is enabled and processes traffic */
#define NETIF_FLAG_UP 1
#define NETIF_FLAG_UP 1U
/** if set, the netif has broadcast capability */
#define NETIF_FLAG_BROADCAST 2
#define NETIF_FLAG_BROADCAST 2U
/** if set, the netif is one end of a point-to-point connection */
#define NETIF_FLAG_POINTTOPOINT 4
#define NETIF_FLAG_POINTTOPOINT 4U
/** if set, the interface is configured using DHCP */
#define NETIF_FLAG_DHCP 8
#define NETIF_FLAG_DHCP 8U
/** generic data structure used for all lwIP network interfaces */
struct netif {