48 #ifndef LWIP_HDR_DEF_H
49 #define LWIP_HDR_DEF_H
65 #define LWIP_MAX(x , y) (((x) > (y)) ? (x) : (y))
66 #define LWIP_MIN(x , y) (((x) < (y)) ? (x) : (y))
69 #define LWIP_ARRAYSIZE(x) (sizeof(x)/sizeof((x)[0]))
72 #define LWIP_MAKEU32(a,b,c,d) (((u32_t)((a) & 0xff) << 24) | \
73 ((u32_t)((b) & 0xff) << 16) | \
74 ((u32_t)((c) & 0xff) << 8) | \
81 #define NULL ((void *)0)
85 #if BYTE_ORDER == BIG_ENDIAN
86 #define lwip_htons(x) ((u16_t)(x))
87 #define lwip_ntohs(x) ((u16_t)(x))
88 #define lwip_htonl(x) ((u32_t)(x))
89 #define lwip_ntohl(x) ((u32_t)(x))
90 #define PP_HTONS(x) ((u16_t)(x))
91 #define PP_NTOHS(x) ((u16_t)(x))
92 #define PP_HTONL(x) ((u32_t)(x))
93 #define PP_NTOHL(x) ((u32_t)(x))
98 #define lwip_ntohs(x) lwip_htons(x)
103 #define lwip_ntohl(x) lwip_htonl(x)
108 #define PP_HTONS(x) ((u16_t)((((x) & (u16_t)0x00ffU) << 8) | (((x) & (u16_t)0xff00U) >> 8)))
109 #define PP_NTOHS(x) PP_HTONS(x)
110 #define PP_HTONL(x) ((((x) & (u32_t)0x000000ffUL) << 24) | \
111 (((x) & (u32_t)0x0000ff00UL) << 8) | \
112 (((x) & (u32_t)0x00ff0000UL) >> 8) | \
113 (((x) & (u32_t)0xff000000UL) >> 24))
114 #define PP_NTOHL(x) PP_HTONL(x)
118 #ifndef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
119 #define htons(x) lwip_htons(x)
120 #define ntohs(x) lwip_ntohs(x)
121 #define htonl(x) lwip_htonl(x)
122 #define ntohl(x) lwip_ntohl(x)
133 void lwip_itoa(
char* result,
size_t bufsize,
int number);
135 #ifndef lwip_strnicmp
137 int lwip_strnicmp(
const char* str1,
const char* str2,
size_t len);
145 char*
lwip_strnstr(
const char* buffer,
const char* token,
size_t n);
#define lwip_htons(x)
Definition: def.h:86
#define lwip_htonl(x)
Definition: def.h:88
uint32_t u32_t
Definition: arch.h:129
uint16_t u16_t
Definition: arch.h:127
int lwip_stricmp(const char *str1, const char *str2)
Definition: def.c:128
int lwip_strnicmp(const char *str1, const char *str2, size_t len)
Definition: def.c:163
char * lwip_strnstr(const char *buffer, const char *token, size_t n)
Definition: def.c:105
void lwip_itoa(char *result, size_t bufsize, int number)
Definition: def.c:199