33 |
#include "lwip/ip_addr.h" |
#include "lwip/ip_addr.h" |
34 |
#include "lwip/inet.h" |
#include "lwip/inet.h" |
35 |
|
|
36 |
/*-----------------------------------------------------------------------------------*/ |
|
37 |
int |
int |
38 |
ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2, |
ip_addr_maskcmp(struct ip_addr *addr1, struct ip_addr *addr2, |
39 |
struct ip_addr *mask) |
struct ip_addr *mask) |
44 |
(addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3])); |
(addr1->addr[3] & mask->addr[3]) == (addr2->addr[3] & mask->addr[3])); |
45 |
|
|
46 |
} |
} |
47 |
/*-----------------------------------------------------------------------------------*/ |
|
48 |
int |
int |
49 |
ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2) |
ip_addr_cmp(struct ip_addr *addr1, struct ip_addr *addr2) |
50 |
{ |
{ |
53 |
addr1->addr[2] == addr2->addr[2] && |
addr1->addr[2] == addr2->addr[2] && |
54 |
addr1->addr[3] == addr2->addr[3]); |
addr1->addr[3] == addr2->addr[3]); |
55 |
} |
} |
56 |
/*-----------------------------------------------------------------------------------*/ |
|
57 |
void |
void |
58 |
ip_addr_set(struct ip_addr *dest, struct ip_addr *src) |
ip_addr_set(struct ip_addr *dest, struct ip_addr *src) |
59 |
{ |
{ |
63 |
dest->addr[2] = src->addr[2]; |
dest->addr[2] = src->addr[2]; |
64 |
dest->addr[3] = src->addr[3];*/ |
dest->addr[3] = src->addr[3];*/ |
65 |
} |
} |
66 |
/*-----------------------------------------------------------------------------------*/ |
|
67 |
int |
int |
68 |
ip_addr_isany(struct ip_addr *addr) |
ip_addr_isany(struct ip_addr *addr) |
69 |
{ |
{ |
71 |
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); |
return((addr->addr[0] | addr->addr[1] | addr->addr[2] | addr->addr[3]) == 0); |
72 |
} |
} |
73 |
|
|
74 |
/*-----------------------------------------------------------------------------------*/ |
|
75 |
/*#if IP_DEBUG*/ |
/*#if IP_DEBUG*/ |
76 |
void |
void |
77 |
ip_addr_debug_print(struct ip_addr *addr) |
ip_addr_debug_print(struct ip_addr *addr) |
87 |
ntohl(addr->addr[3]) & 0xffff); |
ntohl(addr->addr[3]) & 0xffff); |
88 |
} |
} |
89 |
/*#endif*/ /* IP_DEBUG */ |
/*#endif*/ /* IP_DEBUG */ |
90 |
/*-----------------------------------------------------------------------------------*/ |
|