mirror of
https://github.com/apache/nuttx.git
synced 2026-05-20 12:33:27 +08:00
Add ntohs&l() and htons&l
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@324 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
+1
-31
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <nuttx/config.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <net/uip/uipopt.h>
|
||||
|
||||
/****************************************************************************
|
||||
@@ -1125,37 +1126,6 @@ struct uip_udp_conn *uip_udp_new(uip_ipaddr_t *ripaddr, uint16 rport);
|
||||
|
||||
#define uip_ipaddr4(addr) (htons(((uint16 *)(addr))[1]) & 0xff)
|
||||
|
||||
/* Convert 16-bit quantity from host byte order to network byte order.
|
||||
*
|
||||
* This macro is primarily used for converting constants from host
|
||||
* byte order to network byte order. For converting variables to
|
||||
* network byte order, use the htons() function instead.
|
||||
*/
|
||||
|
||||
#ifndef HTONS
|
||||
# if UIP_BYTE_ORDER == UIP_BIG_ENDIAN
|
||||
# define HTONS(n) (n)
|
||||
# else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
|
||||
# define HTONS(n) (uint16)((((uint16) (n)) << 8) | (((uint16) (n)) >> 8))
|
||||
# endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */
|
||||
#else
|
||||
#error "HTONS already defined!"
|
||||
#endif /* HTONS */
|
||||
|
||||
/* Convert 16-bit quantity from host byte order to network byte order.
|
||||
*
|
||||
* This function is primarily used for converting variables from host
|
||||
* byte order to network byte order. For converting constants to
|
||||
* network byte order, use the HTONS() macro instead.
|
||||
*/
|
||||
|
||||
#ifndef htons
|
||||
uint16 htons(uint16 val);
|
||||
#endif /* htons */
|
||||
#ifndef ntohs
|
||||
#define ntohs htons
|
||||
#endif
|
||||
|
||||
/* This function is called user code to set up the wait */
|
||||
|
||||
#define uip_event_wait(waitflags) uip_event_timedwait(waitflags,0)
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <sys/type.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
|
||||
Reference in New Issue
Block a user