[PATCH 01/13] libnetworking: Add prototype for getnameinfo().

Christian Mauderer christian.mauderer at embedded-brains.de
Thu Apr 21 08:49:41 UTC 2016


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

Copy the prototype and necessary defines for getnameinfo() from
current FreeBSD.
---
 cpukit/libnetworking/netdb.h | 47 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/cpukit/libnetworking/netdb.h b/cpukit/libnetworking/netdb.h
index 92e283b..4272902 100644
--- a/cpukit/libnetworking/netdb.h
+++ b/cpukit/libnetworking/netdb.h
@@ -114,6 +114,8 @@ struct	protoent {
 	int	p_proto;	/* protocol # */
 };
 
+struct sockaddr;
+
 /*
  * Error return codes from gethostbyname() and gethostbyaddr()
  * (left in h_errno).
@@ -127,6 +129,49 @@ struct	protoent {
 #define	NO_DATA		4 /* Valid name, no data record of requested type */
 #define	NO_ADDRESS	NO_DATA		/* no address, look for MX record */
 
+/*
+ * Error return codes from getaddrinfo()
+ */
+#if 0
+/* obsoleted */
+#define	EAI_ADDRFAMILY	 1	/* address family for hostname not supported */
+#endif
+#define	EAI_AGAIN	 2	/* temporary failure in name resolution */
+#define	EAI_BADFLAGS	 3	/* invalid value for ai_flags */
+#define	EAI_FAIL	 4	/* non-recoverable failure in name resolution */
+#define	EAI_FAMILY	 5	/* ai_family not supported */
+#define	EAI_MEMORY	 6	/* memory allocation failure */
+#if 0
+/* obsoleted */
+#define	EAI_NODATA	 7	/* no address associated with hostname */
+#endif
+#define	EAI_NONAME	 8	/* hostname nor servname provided, or not known */
+#define	EAI_SERVICE	 9	/* servname not supported for ai_socktype */
+#define	EAI_SOCKTYPE	10	/* ai_socktype not supported */
+#define	EAI_SYSTEM	11	/* system error returned in errno */
+#define	EAI_BADHINTS	12	/* invalid value for hints */
+#define	EAI_PROTOCOL	13	/* resolved protocol is unknown */
+#define	EAI_OVERFLOW	14	/* argument buffer overflow */
+#define	EAI_MAX		15
+
+/*
+ * Constants for getnameinfo()
+ */
+#define	NI_MAXHOST	1025
+#define	NI_MAXSERV	32
+
+/*
+ * Flag values for getnameinfo()
+ */
+#define	NI_NOFQDN	0x00000001
+#define	NI_NUMERICHOST	0x00000002
+#define	NI_NAMEREQD	0x00000004
+#define	NI_NUMERICSERV	0x00000008
+#define	NI_DGRAM	0x00000010
+#if 0 /* obsolete */
+#define NI_WITHSCOPEID	0x00000020
+#endif
+
 __BEGIN_DECLS
 void		endhostent(void);
 void		endnetent(void);
@@ -152,6 +197,8 @@ void		sethostent(int);
 void		setnetent(int);
 void		setprotoent(int);
 void		setservent(int);
+int		getnameinfo(const struct sockaddr *, socklen_t, char *,
+			    size_t, char *, size_t, int);
 
 #ifdef _THREAD_SAFE
 struct hostent* gethostent_r(char* buf, int len);
-- 
1.8.4.5



More information about the devel mailing list