def.h: Provide hton* / ntoh* functions to users by default for compatibility (can be turned off)

Add note to UPGRADING document
This commit is contained in:
Dirk Ziegelmeier 2016-10-06 13:13:10 +02:00
parent 13fb616bb2
commit 05419912e0
2 changed files with 12 additions and 0 deletions

View File

@ -49,6 +49,10 @@ with newer versions.
* Added generalized abstraction for itoa(), strnicmp(), stricmp() and strnstr() * Added generalized abstraction for itoa(), strnicmp(), stricmp() and strnstr()
in def.h (to be overridden in cc.h) instead of config in def.h (to be overridden in cc.h) instead of config
options for netbiosns, httpd, dns, etc. ... options for netbiosns, httpd, dns, etc. ...
* New abstraction for hton* and ntoh* functions in def.h.
To override them, use the following in cc.h:
#define lwip_htons(x) <your_htons>
#define lwip_htonl(x) <your_htonl>
+++ new options: +++ new options:
* TODO * TODO

View File

@ -92,6 +92,14 @@ u32_t lwip_htonl(u32_t x);
#endif #endif
#define lwip_ntohl(x) lwip_htonl(x) #define lwip_ntohl(x) lwip_htonl(x)
/* Provide usual function names as macros for users, but this can be turned off */
#ifndef LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
#define htons(x) lwip_htons(x)
#define ntohs(x) lwip_ntohs(x)
#define htonl(x) lwip_htonl(x)
#define ntohl(x) lwip_ntohl(x)
#endif
/* These macros should be calculated by the preprocessor and are used /* These macros should be calculated by the preprocessor and are used
with compile-time constants only (so that there is no little-endian with compile-time constants only (so that there is no little-endian
overhead at runtime). */ overhead at runtime). */