[PATCH 20/27] libnetworking: Import current arpa/inet.h

Christian Mauderer christian.mauderer at embedded-brains.de
Fri Jun 24 09:38:39 UTC 2016


From: Christian Mauderer <Christian.Mauderer at embedded-brains.de>

Import the arpa/inet.h from current FreeBSD. Necessary due to changes in
in.h.
---
 cpukit/libnetworking/arpa/inet.h | 50 ++++++++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 7 deletions(-)

diff --git a/cpukit/libnetworking/arpa/inet.h b/cpukit/libnetworking/arpa/inet.h
index 6ea7e70..d71c927 100644
--- a/cpukit/libnetworking/arpa/inet.h
+++ b/cpukit/libnetworking/arpa/inet.h
@@ -51,24 +51,34 @@
 
 /*%
  *	@(#)inet.h	8.1 (Berkeley) 6/2/93
- * $FreeBSD: src/include/arpa/inet.h,v 1.33 2010/07/06 03:48:46 maxim Exp $
+ *	$Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $
+ * $FreeBSD: head/include/arpa/inet.h 269867 2014-08-12 12:36:06Z ume $
  */
 
-
 #ifndef _ARPA_INET_H_
 #define	_ARPA_INET_H_
 
 /* External definitions for functions in inet(3). */
 
 #include <sys/cdefs.h>
-#include <rtems/bsdnet/_types.h>
+#include <sys/_types.h>
 
 /* Required for byteorder(3) functions. */
-#include <rtems/endian.h>
+#include <machine/endian.h>
 
 #define	INET_ADDRSTRLEN		16
 #define	INET6_ADDRSTRLEN	46
 
+#ifndef _UINT16_T_DECLARED
+typedef	__uint16_t	uint16_t;
+#define	_UINT16_T_DECLARED
+#endif
+
+#ifndef _UINT32_T_DECLARED
+typedef	__uint32_t	uint32_t;
+#define	_UINT32_T_DECLARED
+#endif
+
 #ifndef _IN_ADDR_T_DECLARED
 typedef	uint32_t	in_addr_t;
 #define	_IN_ADDR_T_DECLARED
@@ -79,6 +89,13 @@ typedef	uint16_t	in_port_t;
 #define	_IN_PORT_T_DECLARED
 #endif
 
+#if __BSD_VISIBLE
+#ifndef _SIZE_T_DECLARED
+typedef	__size_t	size_t;
+#define	_SIZE_T_DECLARED
+#endif
+#endif
+
 /*
  * XXX socklen_t is used by a POSIX.1-2001 interface, but not required by
  * POSIX.1-2001.
@@ -95,7 +112,6 @@ struct in_addr {
 #define	_STRUCT_IN_ADDR_DECLARED
 #endif
 
-#if !defined(__rtems__)	/* RTEMS -- Why rename these? */
 /* XXX all new diversions!! argh!! */
 #if __BSD_VISIBLE
 #define	inet_addr		__inet_addr
@@ -116,11 +132,18 @@ struct in_addr {
 #define	inet_nsap_addr		__inet_nsap_addr
 #define	inet_nsap_ntoa		__inet_nsap_ntoa
 #endif /* __BSD_VISIBLE */
-#endif /* __rtems__ */
 
 __BEGIN_DECLS
+#ifndef _BYTEORDER_PROTOTYPED
+#define	_BYTEORDER_PROTOTYPED
+uint32_t	 htonl(uint32_t);
+uint16_t	 htons(uint16_t);
+uint32_t	 ntohl(uint32_t);
+uint16_t	 ntohs(uint16_t);
+#endif
+
 in_addr_t	 inet_addr(const char *);
-char		*inet_ntoa(struct in_addr);
+/*const*/ char	*inet_ntoa(struct in_addr);
 const char	*inet_ntop(int, const void * __restrict, char * __restrict,
 		    socklen_t);
 int		 inet_pton(int, const char * __restrict, void * __restrict);
@@ -134,9 +157,22 @@ in_addr_t	 inet_netof(struct in_addr);
 in_addr_t	 inet_network(const char *);
 char		*inet_net_ntop(int, const void *, int, char *, size_t);
 int		 inet_net_pton(int, const char *, void *, size_t);
+char		*inet_ntoa_r(struct in_addr, char *buf, socklen_t size);
+char		*inet_cidr_ntop(int, const void *, int, char *, size_t);
+int		 inet_cidr_pton(int, const char *, void *, int *);
 unsigned	 inet_nsap_addr(const char *, unsigned char *, int);
 char		*inet_nsap_ntoa(int, const unsigned char *, char *);
 #endif /* __BSD_VISIBLE */
 __END_DECLS
 
+#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
+
 #endif /* !_ARPA_INET_H_ */
+
+/*! \file */
-- 
1.8.4.5




More information about the devel mailing list