summaryrefslogtreecommitdiff
path: root/sys/include/ape/netdb.h
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@gmx.de>2013-03-31 18:52:45 +0200
committercinap_lenrek <cinap_lenrek@gmx.de>2013-03-31 18:52:45 +0200
commitb6dc4ba5a44a2ed2a68266598ceb28b7a7d51af2 (patch)
treeb2af773db48a3606bd078055db925dbba6d4ffaa /sys/include/ape/netdb.h
parent9c7e1db701e0e80b42bb5990e2f6839d712bb984 (diff)
ape: initial IPv6 support, inet_pton()/inet_ntop(), getaddrinfo()/getnameinfo()
Diffstat (limited to 'sys/include/ape/netdb.h')
-rw-r--r--sys/include/ape/netdb.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/sys/include/ape/netdb.h b/sys/include/ape/netdb.h
index 5885c3ab3..2f5fd7539 100644
--- a/sys/include/ape/netdb.h
+++ b/sys/include/ape/netdb.h
@@ -114,6 +114,54 @@ extern char *hstrerror(int);
#define __HOST_SVC_NOT_AVAIL 99 /* libc internal use only */
+struct addrinfo {
+ int ai_flags; /* Input flags. */
+ int ai_family; /* Protocol family for socket. */
+ int ai_socktype; /* Socket type. */
+ int ai_protocol; /* Protocol for socket. */
+ int ai_addrlen; /* Length of socket address. */
+ struct sockaddr *ai_addr; /* Socket address for socket. */
+ char *ai_canonname; /* Canonical name for service location. */
+ struct addrinfo *ai_next; /* Pointer to next in list. */
+};
+
+extern int getaddrinfo(char *, char *, struct addrinfo *, struct addrinfo **);
+extern void freeaddrinfo(struct addrinfo *);
+extern int getnameinfo(struct sockaddr *, int, char *, int, char *, int, unsigned int);
+extern char *gai_strerror(int);
+
+/* Possible values for `ai_flags' field in `addrinfo' structure. */
+#define AI_PASSIVE 0x0001 /* Socket address is intended for `bind'. */
+#define AI_CANONNAME 0x0002 /* Request for canonical name. */
+#define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */
+#define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */
+#define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */
+#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose returned address type.. */
+#define AI_NUMERICSERV 0x0400 /* Don't use name resolution. */
+
+/* getnameinfo flags */
+#define NI_NOFQDN 0x0001 /* Only the nodename portion of the FQDN is returned for local hosts. */
+#define NI_NUMERICHOST 0x0002 /* The numeric form of the node's address is returned instead of its name. */
+#define NI_NAMEREQD 0x0004 /* Return an error if the node's name cannot be located in the database. */
+#define NI_NUMERICSERV 0x0008 /* The numeric form of the service address is returned instead of its name. */
+#define NI_NUMERICSCOPE 0x0010 /* For IPv6 addresses, the numeric form of the scope identifier is returned
+ instead of its name. */
+#define NI_DGRAM 0x0020 /* Indicates that the service is a datagram service (SOCK_DGRAM). */
+
+/* Error values for `getaddrinfo' and `getnameinfo' functions. */
+#define EAI_BADFLAGS -1 /* Invalid value for `ai_flags' field */
+#define EAI_NONAME -2 /* NAME or SERVICE is unknown */
+#define EAI_AGAIN -3 /* Temporary failure in name resolution */
+#define EAI_FAIL -4 /* Non-recoverable failure in name resolution */
+#define EAI_NODATA -5 /* No address associated with NAME */
+#define EAI_FAMILY -6 /* `ai_family' not supported */
+#define EAI_SOCKTYPE -7 /* `ai_socktype' not supported */
+#define EAI_SERVICE -8 /* SERVICE not supported for `ai_socktype' */
+#define EAI_ADDRFAMILY -9 /* Address family for NAME not supported */
+#define EAI_MEMORY -10 /* Memory allocation failure */
+#define EAI_SYSTEM -11 /* System error returned in `errno' */
+#define EAI_OVERFLOW -12 /* Argument buffer overflow */
+
#ifdef __cplusplus
}
#endif