sockets.c, ip.h, api.h, tcp.h: declare a "struct ip_pcb" which only contains IP_PCB. Add in the netconn's "pcb" union a "struct ip_pcb *ip;" (no size change). Use this new field to access to common pcb fields (ttl, tos, so_options, etc...). Enable to access to these fields with LWIP_TCP=0.

This commit is contained in:
fbernon
2007-09-07 23:47:02 +00:00
parent 75d4c9b446
commit 8205737fdb
5 changed files with 22 additions and 11 deletions

View File

@@ -90,6 +90,10 @@ err_t ip_output_if(struct pbuf *p, struct ip_addr *src, struct ip_addr *dest,
/* link layer address resolution hint */ \
IP_PCB_ADDRHINT
struct ip_pcb {
/* Common members of all PCB types */
IP_PCB;
};
/*
* Option flags per-socket. These are the same like SO_XXX.

View File

@@ -98,6 +98,7 @@ struct netconn {
enum netconn_type type;
enum netconn_state state;
union {
struct ip_pcb *ip;
struct tcp_pcb *tcp;
struct udp_pcb *udp;
struct raw_pcb *raw;

View File

@@ -34,7 +34,7 @@
#include "lwip/opt.h"
/*#if LWIP_TCP*/ /* don't build if not configured for use in lwipopts.h */
#if LWIP_TCP /* don't build if not configured for use in lwipopts.h */
#include "lwip/sys.h"
#include "lwip/mem.h"
@@ -592,6 +592,6 @@ extern struct tcp_pcb *tcp_tmp_pcb; /* Only used for temporary storage. */
}
#endif
/*#endif*/ /* LWIP_TCP */
#endif /* LWIP_TCP */
#endif /* __LWIP_TCP_H__ */