diff options
| author | Mike Barcroft <mike@FreeBSD.org> | 2002-02-18 20:35:27 +0000 |
|---|---|---|
| committer | Mike Barcroft <mike@FreeBSD.org> | 2002-02-18 20:35:27 +0000 |
| commit | fd8e4ebc8c18caec3eefac6527831f9ee6a92959 (patch) | |
| tree | 970c36894ee638248ec810bd7570ac8aabb5eaf5 /include | |
| parent | 3e1ce344baebe1f56863d29d656549c93a464ded (diff) | |
Notes
Diffstat (limited to 'include')
| -rw-r--r-- | include/arpa/inet.h | 22 | ||||
| -rw-r--r-- | include/rpc/xdr.h | 8 |
2 files changed, 20 insertions, 10 deletions
diff --git a/include/arpa/inet.h b/include/arpa/inet.h index 7ac95e59423c..3ac128d1ed9a 100644 --- a/include/arpa/inet.h +++ b/include/arpa/inet.h @@ -47,9 +47,7 @@ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. - */ - -/* + * * @(#)inet.h 8.1 (Berkeley) 6/2/93 * From: Id: inet.h,v 8.5 1997/01/29 08:48:09 vixie Exp $ * $FreeBSD$ @@ -63,6 +61,9 @@ #include <sys/cdefs.h> #include <machine/ansi.h> +/* Required for byteorder(3) functions. */ +#include <machine/endian.h> + #ifndef _IN_ADDR_T_DECLARED_ typedef __uint32_t in_addr_t; #define _IN_ADDR_T_DECLARED_ @@ -114,14 +115,23 @@ struct in_addr { #define inet_nsap_ntoa __inet_nsap_ntoa #endif /* !_POSIX_SOURCE */ +#ifndef _BYTEORDER_FUNC_DEFINED +#define _BYTEORDER_FUNC_DEFINED +#define htonl(x) __htonl(x) +#define htons(x) __htons(x) +#define ntohl(x) __ntohl(x) +#define ntohs(x) __ntohs(x) +#endif + __BEGIN_DECLS +__uint32_t htonl(__uint32_t); +__uint16_t htons(__uint16_t); in_addr_t inet_addr __P((const char *)); char *inet_ntoa __P((struct in_addr)); const char *inet_ntop __P((int, const void *, char *, socklen_t)); int inet_pton __P((int, const char *, void *)); -/* - * XXX missing: ntohl() family. - */ +__uint32_t ntohl(__uint32_t); +__uint16_t ntohs(__uint16_t); /* Nonstandard functions. */ #ifndef _POSIX_SOURCE diff --git a/include/rpc/xdr.h b/include/rpc/xdr.h index d38aa4989e6f..9867b252152b 100644 --- a/include/rpc/xdr.h +++ b/include/rpc/xdr.h @@ -261,13 +261,13 @@ struct xdr_discrim { * N.B. and frozen for all time: each data type here uses 4 bytes * of external representation. */ -#define IXDR_GET_INT32(buf) ((int32_t)ntohl((u_int32_t)*(buf)++)) -#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v)) +#define IXDR_GET_INT32(buf) ((int32_t)__ntohl((u_int32_t)*(buf)++)) +#define IXDR_PUT_INT32(buf, v) (*(buf)++ =(int32_t)__htonl((u_int32_t)v)) #define IXDR_GET_U_INT32(buf) ((u_int32_t)IXDR_GET_INT32(buf)) #define IXDR_PUT_U_INT32(buf, v) IXDR_PUT_INT32((buf), ((int32_t)(v))) -#define IXDR_GET_LONG(buf) ((long)ntohl((u_int32_t)*(buf)++)) -#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)htonl((u_int32_t)v)) +#define IXDR_GET_LONG(buf) ((long)__ntohl((u_int32_t)*(buf)++)) +#define IXDR_PUT_LONG(buf, v) (*(buf)++ =(int32_t)__htonl((u_int32_t)v)) #define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf)) #define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf)) |
