From e5fa567869e01c70e992138511cbfc578bcc4588 Mon Sep 17 00:00:00 2001 From: bg- Date: Wed, 4 Apr 2007 11:37:20 +0000 Subject: [PATCH] * htonl and friends. --- core/net/uip.c | 8 +++++++- core/net/uip.h | 11 ++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/net/uip.c b/core/net/uip.c index 643598d8f..8bf516cf3 100644 --- a/core/net/uip.c +++ b/core/net/uip.c @@ -41,7 +41,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: uip.c,v 1.7 2007/03/15 19:41:29 adamdunkels Exp $ + * $Id: uip.c,v 1.8 2007/04/04 11:37:40 bg- Exp $ * */ @@ -1867,6 +1867,12 @@ htons(u16_t val) { return HTONS(val); } + +u32_t +htonl(u32_t val) +{ + return HTONL(val); +} /*---------------------------------------------------------------------------*/ void uip_send(const void *data, int len) diff --git a/core/net/uip.h b/core/net/uip.h index 15a3199c4..134e4bdc2 100644 --- a/core/net/uip.h +++ b/core/net/uip.h @@ -46,7 +46,7 @@ * * This file is part of the uIP TCP/IP stack. * - * $Id: uip.h,v 1.10 2007/03/25 17:16:44 adamdunkels Exp $ + * $Id: uip.h,v 1.11 2007/04/04 11:37:20 bg- Exp $ * */ @@ -1105,8 +1105,10 @@ struct uip_udp_conn *uip_udp_new(const uip_ipaddr_t *ripaddr, u16_t rport); #ifndef HTONS # if UIP_BYTE_ORDER == UIP_BIG_ENDIAN # define HTONS(n) (n) +# define HTONL(n) (n) # else /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ # define HTONS(n) (u16_t)((((u16_t) (n)) << 8) | (((u16_t) (n)) >> 8)) +# define HTONL(n) (((u32_t)HTONS(n) << 16) | HTONS((u32_t)(n) >> 16)) # endif /* UIP_BYTE_ORDER == UIP_BIG_ENDIAN */ #else #error "HTONS already defined!" @@ -1126,6 +1128,13 @@ CCIF u16_t htons(u16_t val); #define ntohs htons #endif +#ifndef htonl +CCIF u32_t htonl(u32_t val); +#endif /* htonl */ +#ifndef ntohl +#define ntohl htonl +#endif + /** @} */ /**