43 |
u16_t inet_chksum_pseudo(struct pbuf *p, |
u16_t inet_chksum_pseudo(struct pbuf *p, |
44 |
struct ip_addr *src, struct ip_addr *dest, |
struct ip_addr *src, struct ip_addr *dest, |
45 |
u8_t proto, u16_t proto_len); |
u8_t proto, u16_t proto_len); |
|
|
|
|
#ifdef HTONS |
|
|
#undef HTONS |
|
|
#endif /* HTONS */ |
|
|
#ifdef NTOHS |
|
|
#undef NTOHS |
|
|
#endif /* NTOHS */ |
|
|
#ifdef HTONL |
|
|
#undef HTONL |
|
|
#endif /* HTONL */ |
|
|
#ifdef NTOHL |
|
|
#undef NTOHL |
|
|
#endif /* NTOHL */ |
|
|
|
|
46 |
#ifdef htons |
#ifdef htons |
47 |
#undef htons |
#undef htons |
48 |
#endif /* htons */ |
#endif /* htons */ |
56 |
#undef ntohl |
#undef ntohl |
57 |
#endif /* ntohl */ |
#endif /* ntohl */ |
58 |
|
|
59 |
|
#if BYTE_ORDER == BIG_ENDIAN |
60 |
|
#define htons(x) (x) |
61 |
#ifndef HTONS |
#define ntohs(x) (x) |
62 |
# if BYTE_ORDER == BIG_ENDIAN |
#define htonl(x) (x) |
63 |
# define HTONS(n) (n) |
#define ntohl(x) (x) |
64 |
# else /* BYTE_ORDER == BIG_ENDIAN */ |
#else |
65 |
# define HTONS(n) (((((u16_t)(n) & 0xff)) << 8) | (((u16_t)(n) & 0xff00) >> 8)) |
u16_t htons(u16_t x); |
66 |
# endif /* BYTE_ORDER == BIG_ENDIAN */ |
u16_t ntohs(u16_t x); |
67 |
#endif /* HTONS */ |
u32_t htonl(u32_t x); |
68 |
|
u32_t ntohl(u32_t x); |
69 |
#define htons HTONS |
#endif |
|
#define NTOHS HTONS |
|
|
#define ntohs htons |
|
|
|
|
|
|
|
|
#ifndef HTONL |
|
|
# if BYTE_ORDER == BIG_ENDIAN |
|
|
# define HTONL(n) (n) |
|
|
# else /* BYTE_ORDER == BIG_ENDIAN */ |
|
|
# define HTONL(n) (((((u32_t)(n) & 0xff)) << 24) | \ |
|
|
((((u32_t)(n) & 0xff00)) << 8) | \ |
|
|
((((u32_t)(n) & 0xff0000)) >> 8) | \ |
|
|
((((u32_t)(n) & 0xff000000)) >> 24)) |
|
|
# endif /* BYTE_ORDER == BIG_ENDIAN */ |
|
|
#endif /* HTONL */ |
|
|
|
|
|
|
|
|
#define htonl HTONL |
|
|
#define NTOHL HTONL |
|
|
#define ntohl htonl |
|
70 |
|
|
71 |
#endif /* __LWIP_INET_H__ */ |
#endif /* __LWIP_INET_H__ */ |
72 |
|
|