Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/netinet Define uint{8, 32}_t locally, per XNS5.2/POSIX-20...
details: https://anonhg.NetBSD.org/src/rev/c44ed4c2f7de
branches: trunk
changeset: 526898:c44ed4c2f7de
user: kleink <kleink%NetBSD.org@localhost>
date: Mon May 13 13:34:32 2002 +0000
description:
Define uint{8,32}_t locally, per XNS5.2/POSIX-2001, and use them in this
header where applicable; use private fixed-width integer types otherwise.
diffstat:
sys/netinet/in.h | 42 +++++++++++++++++++++++++++---------------
1 files changed, 27 insertions(+), 15 deletions(-)
diffs (124 lines):
diff -r d372866d0ca2 -r c44ed4c2f7de sys/netinet/in.h
--- a/sys/netinet/in.h Mon May 13 12:43:16 2002 +0000
+++ b/sys/netinet/in.h Mon May 13 13:34:32 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in.h,v 1.57 2002/05/12 23:04:15 kleink Exp $ */
+/* $NetBSD: in.h,v 1.58 2002/05/13 13:34:32 kleink Exp $ */
/*
* Copyright (c) 1982, 1986, 1990, 1993
@@ -43,6 +43,18 @@
#ifndef _NETINET_IN_H_
#define _NETINET_IN_H_
+#include <machine/int_types.h>
+
+#ifndef uint8_t
+typedef __uint8_t uint8_t;
+#define uint8_t __uint8_t
+#endif
+
+#ifndef uint32_t
+typedef __uint32_t uint32_t;
+#define uint32_t __uint32_t
+#endif
+
#include <sys/ansi.h>
#ifndef in_addr_t
@@ -152,32 +164,32 @@
* on these macros not doing byte-swapping.
*/
#ifdef _KERNEL
-#define __IPADDR(x) ((u_int32_t) htonl((u_int32_t)(x)))
+#define __IPADDR(x) ((uint32_t) htonl((uint32_t)(x)))
#else
-#define __IPADDR(x) ((u_int32_t)(x))
+#define __IPADDR(x) ((uint32_t)(x))
#endif
-#define IN_CLASSA(i) (((u_int32_t)(i) & __IPADDR(0x80000000)) == \
+#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \
__IPADDR(0x00000000))
#define IN_CLASSA_NET __IPADDR(0xff000000)
#define IN_CLASSA_NSHIFT 24
#define IN_CLASSA_HOST __IPADDR(0x00ffffff)
#define IN_CLASSA_MAX 128
-#define IN_CLASSB(i) (((u_int32_t)(i) & __IPADDR(0xc0000000)) == \
+#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \
__IPADDR(0x80000000))
#define IN_CLASSB_NET __IPADDR(0xffff0000)
#define IN_CLASSB_NSHIFT 16
#define IN_CLASSB_HOST __IPADDR(0x0000ffff)
#define IN_CLASSB_MAX 65536
-#define IN_CLASSC(i) (((u_int32_t)(i) & __IPADDR(0xe0000000)) == \
+#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \
__IPADDR(0xc0000000))
#define IN_CLASSC_NET __IPADDR(0xffffff00)
#define IN_CLASSC_NSHIFT 8
#define IN_CLASSC_HOST __IPADDR(0x000000ff)
-#define IN_CLASSD(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
+#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
__IPADDR(0xe0000000))
/* These ones aren't really net and host fields, but routing needn't know. */
#define IN_CLASSD_NET __IPADDR(0xf0000000)
@@ -185,12 +197,12 @@
#define IN_CLASSD_HOST __IPADDR(0x0fffffff)
#define IN_MULTICAST(i) IN_CLASSD(i)
-#define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
+#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
__IPADDR(0xf0000000))
-#define IN_BADCLASS(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
+#define IN_BADCLASS(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \
__IPADDR(0xf0000000))
-#define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & __IPADDR(0xffffff00)) == \
+#define IN_LOCAL_GROUP(i) (((uint32_t)(i) & __IPADDR(0xffffff00)) == \
__IPADDR(0xe0000000))
#define INADDR_ANY __IPADDR(0x00000000)
@@ -211,11 +223,11 @@
* Socket address, internet style.
*/
struct sockaddr_in {
- u_int8_t sin_len;
+ uint8_t sin_len;
sa_family_t sin_family;
in_port_t sin_port;
struct in_addr sin_addr;
- int8_t sin_zero[8];
+ __int8_t sin_zero[8];
};
#define INET_ADDRSTRLEN 16
@@ -229,7 +241,7 @@
*/
struct ip_opts {
struct in_addr ip_dst; /* first hop, 0 w/o src rt */
- int8_t ip_opts[40]; /* actually variable in size */
+ __int8_t ip_opts[40]; /* actually variable in size */
};
/*
@@ -279,7 +291,7 @@
#define IP_PORTRANGE_HIGH 1 /* same as DEFAULT (FreeBSD compat) */
#define IP_PORTRANGE_LOW 2 /* use privileged range */
-#if !defined(_XOPEN_SOURCE)
+#if !defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE)
/*
* Definitions for inet sysctl operations.
*
@@ -391,7 +403,7 @@
{ "maxfragpackets", CTLTYPE_INT }, \
{ "grettl", CTLTYPE_INT }, \
}
-#endif /* !_XOPEN_SOURCE */
+#endif /* !_POSIX_C_SOURCE && !_XOPEN_SOURCE */
/* INET6 stuff */
#define __KAME_NETINET_IN_H_INCLUDED_
Home |
Main Index |
Thread Index |
Old Index