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:
patacongo
2007-09-02 15:32:03 +00:00
parent 800afcd04d
commit d82d41387b
6 changed files with 148 additions and 58 deletions
+1 -31
View File
@@ -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)
+1 -1
View File
@@ -40,7 +40,7 @@
* Included Files
****************************************************************************/
#include <sys/type.h>
#include <sys/types.h>
/****************************************************************************
* Public Type Definitions