40 |
#define IP_ADDR_ANY ((struct ip_addr *)&ip_addr_any) |
#define IP_ADDR_ANY ((struct ip_addr *)&ip_addr_any) |
41 |
#define IP_ADDR_BROADCAST ((struct ip_addr *)&ip_addr_broadcast) |
#define IP_ADDR_BROADCAST ((struct ip_addr *)&ip_addr_broadcast) |
42 |
|
|
43 |
#define INADDR_NONE ((u32_t) 0xffffffff) /* 255.255.255.255 */ |
#define INADDR_NONE ((u32_t) 0xffffffff) /* 255.255.255.255 */ |
44 |
#define INADDR_LOOPBACK ((u32_t) 0x7f000001) /* 127.0.0.1 */ |
#define INADDR_LOOPBACK ((u32_t) 0x7f000001) /* 127.0.0.1 */ |
45 |
|
|
46 |
/* Definitions of the bits in an Internet address integer. |
/* Definitions of the bits in an Internet address integer. |
47 |
|
|
48 |
On subnets, host and network parts are found according to |
On subnets, host and network parts are found according to |
49 |
the subnet mask, not these masks. */ |
the subnet mask, not these masks. */ |
50 |
|
|
51 |
#define IN_CLASSA(a) ((((u32_t)(a)) & 0x80000000) == 0) |
#define IN_CLASSA(a) ((((u32_t)(a)) & 0x80000000) == 0) |
52 |
#define IN_CLASSA_NET 0xff000000 |
#define IN_CLASSA_NET 0xff000000 |
53 |
#define IN_CLASSA_NSHIFT 24 |
#define IN_CLASSA_NSHIFT 24 |
54 |
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) |
#define IN_CLASSA_HOST (0xffffffff & ~IN_CLASSA_NET) |
55 |
#define IN_CLASSA_MAX 128 |
#define IN_CLASSA_MAX 128 |
56 |
|
|
57 |
#define IN_CLASSB(a) ((((u32_t)(a)) & 0xc0000000) == 0x80000000) |
#define IN_CLASSB(a) ((((u32_t)(a)) & 0xc0000000) == 0x80000000) |
58 |
#define IN_CLASSB_NET 0xffff0000 |
#define IN_CLASSB_NET 0xffff0000 |
59 |
#define IN_CLASSB_NSHIFT 16 |
#define IN_CLASSB_NSHIFT 16 |
60 |
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) |
#define IN_CLASSB_HOST (0xffffffff & ~IN_CLASSB_NET) |
61 |
#define IN_CLASSB_MAX 65536 |
#define IN_CLASSB_MAX 65536 |
62 |
|
|
63 |
#define IN_CLASSC(a) ((((u32_t)(a)) & 0xe0000000) == 0xc0000000) |
#define IN_CLASSC(a) ((((u32_t)(a)) & 0xe0000000) == 0xc0000000) |
64 |
#define IN_CLASSC_NET 0xffffff00 |
#define IN_CLASSC_NET 0xffffff00 |
65 |
#define IN_CLASSC_NSHIFT 8 |
#define IN_CLASSC_NSHIFT 8 |
66 |
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) |
#define IN_CLASSC_HOST (0xffffffff & ~IN_CLASSC_NET) |
67 |
|
|
68 |
#define IN_CLASSD(a) (((u32_t)(a) & 0xf0000000) == 0xe0000000) |
#define IN_CLASSD(a) (((u32_t)(a) & 0xf0000000) == 0xe0000000) |
69 |
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ |
#define IN_CLASSD_NET 0xf0000000 /* These ones aren't really */ |
90 |
|
|
91 |
/* For compatibility with BSD code */ |
/* For compatibility with BSD code */ |
92 |
struct in_addr { |
struct in_addr { |
93 |
u32_t s_addr; |
u32_t s_addr; |
94 |
}; |
}; |
95 |
|
|
96 |
extern const struct ip_addr ip_addr_any; |
extern const struct ip_addr ip_addr_any; |
111 |
#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0) |
#define ip_addr_isany(addr1) ((addr1) == NULL || (addr1)->addr == 0) |
112 |
|
|
113 |
#define ip_addr_isbroadcast(addr1, mask) (((((addr1)->addr) & ~((mask)->addr)) == \ |
#define ip_addr_isbroadcast(addr1, mask) (((((addr1)->addr) & ~((mask)->addr)) == \ |
114 |
(0xffffffff & ~((mask)->addr))) || \ |
(0xffffffff & ~((mask)->addr))) || \ |
115 |
((addr1)->addr == 0xffffffff) || \ |
((addr1)->addr == 0xffffffff) || \ |
116 |
((addr1)->addr == 0x00000000)) |
((addr1)->addr == 0x00000000)) |
117 |
|
|
118 |
|
|
119 |
#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000)) |
#define ip_addr_ismulticast(addr1) (((addr1)->addr & ntohl(0xf0000000)) == ntohl(0xe0000000)) |
120 |
|
|
121 |
|
|
122 |
#define ip_addr_debug_print(ipaddr) DEBUGF(LWIP_DEBUG, ("%d.%d.%d.%d", \ |
#define ip_addr_debug_print(ipaddr) DEBUGF(LWIP_DEBUG, ("%d.%d.%d.%d", \ |
123 |
(u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff, \ |
(u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff, \ |
124 |
(u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff, \ |
(u8_t)(ntohl((ipaddr)->addr) >> 16) & 0xff, \ |
125 |
(u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff, \ |
(u8_t)(ntohl((ipaddr)->addr) >> 8) & 0xff, \ |
126 |
(u8_t)ntohl((ipaddr)->addr) & 0xff)) |
(u8_t)ntohl((ipaddr)->addr) & 0xff)) |
127 |
|
|
128 |
|
|
129 |
#define ip4_addr1(ipaddr) ((u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff) |
#define ip4_addr1(ipaddr) ((u8_t)(ntohl((ipaddr)->addr) >> 24) & 0xff) |