Fix cyclic dependencies by careful re-ordering of #includes.

This is really nasty. Can we forward-declare pointers to structs?
This commit is contained in:
likewise 2004-03-12 00:10:07 +00:00
parent 239c6fe070
commit 82f852abf3
10 changed files with 40 additions and 35 deletions

View File

@ -72,9 +72,9 @@
#include "lwip/stats.h" #include "lwip/stats.h"
#include "lwip/mem.h" #include "lwip/mem.h"
#include "lwip/udp.h" #include "lwip/udp.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/inet.h" #include "lwip/inet.h"
#include "lwip/ip_addr.h"
#include "netif/etharp.h" #include "netif/etharp.h"
#include "lwip/sys.h" #include "lwip/sys.h"

View File

@ -41,14 +41,14 @@ const struct ip_addr ip_addr_broadcast = { 0xffffffffUL };
* as it does not support non-broadcast interfaces. * as it does not support non-broadcast interfaces.
* lwip-devel 18-2-2004 * lwip-devel 18-2-2004
*/ */
#if 0 /* going to replace macro in ip_addr.h */ #if 1 /* going to replace macro in ip_addr.h */
#include "lwip/netif.h" #include "lwip/netif.h"
u8_t ip_addr_isbroadcast(struct ip_addr *addr, netif) u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif)
{ {
/* all ones (broadcast) or all zeroes (old skool broadcast) */ /* all ones (broadcast) or all zeroes (old skool broadcast) */
if (addr->addr == ip_addr_broadcast.ip_addr) || if ((addr->addr == ip_addr_broadcast.addr) ||
addr->addr == ip_addr_any.ip_addr)) (addr->addr == ip_addr_any.addr))
return 1; return 1;
/* no broadcast support on this network interface /* no broadcast support on this network interface
* we cannot proceed matching against broadcast addresses */ * we cannot proceed matching against broadcast addresses */
@ -58,8 +58,8 @@ u8_t ip_addr_isbroadcast(struct ip_addr *addr, netif)
else if (addr->addr == netif->ip_addr.addr) else if (addr->addr == netif->ip_addr.addr)
return 0; return 0;
/* host identifier bits are all ones? => network broadcast address */ /* host identifier bits are all ones? => network broadcast address */
else if (addr->addr & ~netif->netmask.addr == else if ((addr->addr & ~netif->netmask.addr) ==
ip_addr_broadcast.ip_addr & ~netif->netmask.addr) (ip_addr_broadcast.addr & ~netif->netmask.addr))
return 1; return 1;
else else
return 0; return 0;

View File

@ -39,11 +39,10 @@
#include "lwip/opt.h" #include "lwip/opt.h"
#include "lwip/def.h" #include "lwip/def.h"
#include "lwip/netif.h"
#include "lwip/ip_addr.h" #include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/tcp.h" #include "lwip/tcp.h"
struct netif *netif_list = NULL; struct netif *netif_list = NULL;
struct netif *netif_default = NULL; struct netif *netif_default = NULL;

View File

@ -47,8 +47,8 @@
#include "lwip/def.h" #include "lwip/def.h"
#include "lwip/memp.h" #include "lwip/memp.h"
#include "lwip/inet.h" #include "lwip/inet.h"
#include "lwip/netif.h"
#include "lwip/ip_addr.h" #include "lwip/ip_addr.h"
#include "lwip/netif.h"
#include "lwip/raw.h" #include "lwip/raw.h"
#include "lwip/stats.h" #include "lwip/stats.h"

View File

@ -51,6 +51,7 @@
#include "lwip/def.h" #include "lwip/def.h"
#include "lwip/opt.h" #include "lwip/opt.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/mem.h" #include "lwip/mem.h"
#include "lwip/memp.h" #include "lwip/memp.h"

View File

@ -51,6 +51,7 @@
#include "lwip/memp.h" #include "lwip/memp.h"
#include "lwip/sys.h" #include "lwip/sys.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/inet.h" #include "lwip/inet.h"
@ -63,8 +64,6 @@
/* Forward declarations.*/ /* Forward declarations.*/
static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb); static void tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb);
err_t err_t
tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags) tcp_send_ctrl(struct tcp_pcb *pcb, u8_t flags)
{ {

View File

@ -47,10 +47,10 @@
#include "lwip/def.h" #include "lwip/def.h"
#include "lwip/memp.h" #include "lwip/memp.h"
#include "lwip/inet.h" #include "lwip/inet.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#include "lwip/udp.h" #include "lwip/udp.h"
#include "lwip/icmp.h" #include "lwip/icmp.h"
#include "lwip/ip_addr.h"
#include "lwip/stats.h" #include "lwip/stats.h"

View File

@ -37,6 +37,7 @@
#include "lwip/opt.h" #include "lwip/opt.h"
#include "lwip/pbuf.h" #include "lwip/pbuf.h"
#include "lwip/ip_addr.h"
#include "lwip/netif.h" #include "lwip/netif.h"
#define ICMP_ER 0 /* echo reply */ #define ICMP_ER 0 /* echo reply */

View File

@ -34,6 +34,28 @@
#include "lwip/arch.h" #include "lwip/arch.h"
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
struct ip_addr {
PACK_STRUCT_FIELD(u32_t addr);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/epstruct.h"
#endif
/* For compatibility with BSD code */
struct in_addr {
u32_t s_addr;
};
#include "lwip/netif.h"
extern const struct ip_addr ip_addr_any;
extern const struct ip_addr ip_addr_broadcast;
/** IP_ADDR_ can be used as a fixed IP address /** IP_ADDR_ can be used as a fixed IP address
* for the wildcard and the broadcast address * for the wildcard and the broadcast address
*/ */
@ -76,25 +98,6 @@
#define IN_LOOPBACKNET 127 /* official! */ #define IN_LOOPBACKNET 127 /* official! */
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/bpstruct.h"
#endif
PACK_STRUCT_BEGIN
struct ip_addr {
PACK_STRUCT_FIELD(u32_t addr);
} PACK_STRUCT_STRUCT;
PACK_STRUCT_END
#ifdef PACK_STRUCT_USE_INCLUDES
# include "arch/epstruct.h"
#endif
/* For compatibility with BSD code */
struct in_addr {
u32_t s_addr;
};
extern const struct ip_addr ip_addr_any;
extern const struct ip_addr ip_addr_broadcast;
#define IP4_ADDR(ipaddr, a,b,c,d) (ipaddr)->addr = htonl(((u32_t)(a & 0xff) << 24) | ((u32_t)(b & 0xff) << 16) | \ #define IP4_ADDR(ipaddr, a,b,c,d) (ipaddr)->addr = htonl(((u32_t)(a & 0xff) << 24) | ((u32_t)(b & 0xff) << 16) | \
((u32_t)(c & 0xff) << 8) | (u32_t)(d & 0xff)) ((u32_t)(c & 0xff) << 8) | (u32_t)(d & 0xff))
@ -110,13 +113,13 @@ extern const struct ip_addr ip_addr_broadcast;
#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0) #define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0)
#if 1 /* replaced by function in ip_addr.c */ #if 0 /* replaced by function in ip_addr.c */
#define ip_addr_isbroadcast(addr1, mask) (((((addr1)->addr) & ~((mask)->addr)) == \ #define ip_addr_isbroadcast(addr1, mask) (((((addr1)->addr) & ~((mask)->addr)) == \
(0xffffffff & ~((mask)->addr))) || \ (0xffffffff & ~((mask)->addr))) || \
((addr1)->addr == 0xffffffff) || \ ((addr1)->addr == 0xffffffff) || \
((addr1)->addr == 0x00000000)) ((addr1)->addr == 0x00000000))
#else #else
u8_t ip_addr_isbroadcast(struct ip_addr *addr, struct netif *netif); u8_t ip_addr_isbroadcast(struct ip_addr *, struct netif *);
#endif #endif
#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000)) #define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000))

View File

@ -40,7 +40,9 @@
#include "lwip/inet.h" #include "lwip/inet.h"
#include "lwip/pbuf.h" #include "lwip/pbuf.h"
#include "lwip/dhcp.h" #if LWIP_DHCP
# include "lwip/dhcp.h"
#endif
/** must be the maximum of all used hardware address lengths /** must be the maximum of all used hardware address lengths
across all types of interfaces in use */ across all types of interfaces in use */