Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-11-19 17:29:37 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-11-19 17:29:37 +0400
commit5b56e9b02b58d2d95ab97c184daa29caf2147eed (patch)
tree140333e757003f1951ac777ee6c6d22ffdcaba67 /winsup/cygwin/include/netdb.h
parentff125797e38c9628ae1308973231660a22563309 (diff)
* autoload.cc (IdnToAscii): Define.
(IdnToUnicode): Define. (FreeAddrInfoW): Define. (GetAddrInfoW): Define. (GetNameInfoW): Define. * net.cc: Drop W. Richard STEVENS libgai implementation. (cygwin_freeaddrinfo): Move code from ipv4_freeaddrinfo here. Move definition up in file to avoid forward declaration in ga_duplist. (ga_dup): Take addrinfoW as input. Add parameters to get IDN flags and to set error value. Handle IDN flags and especially AI_CANONIDN. Convert input wchar_t ai_canonname string to multibyte for output. (ga_duplist): Add parameters to get IDN flags and to set error value and propagate to ga_dup. Call cygwin_freeaddrinfo. (gai_errmap): Add comments. Align error strings to GLibc. Add EAI_IDN_ENCODE entry. (get_ipv6_funcs): Remove. (load_ipv6_guard): Remove. (ipv6_inited): Remove. (load_ipv6): Remove. (load_ipv6_funcs): Remove. (cygwin_getaddrinfo): Drop calling load_ipv6. Handle AI_IDN* flags. Convert input strings to wchar_t and call GetAddrInfoW/FreeAddrInfoW. In case hints is NULL, set default ai_flags explicitely to AI_V4MAPPED | AI_ADDRCONFIG, as documented for Glibc. Only add AI_ALL if AI_ADDRCONFIG is not given. Unconditionally add Windows-specific AI_DISABLE_IDN_ENCODING to ai_flags to make IDN behaviour compatible to Glibc even on Windows 8 and later. (cygwin_getnameinfo): Drop calling load_ipv6. Handle NI_IDN* flags. Call GetNameInfoW and convert returned strings from wchar_t to multibyte. * include/netdb.h: Add comments to describe flags and error values. (AI_*): Define all flags using hex values for clearness. (AI_IDN): Define. (AI_CANONIDN): Define. (AI_IDN_ALLOW_UNASSIGNED): Define. (AI_IDN_USE_STD3_ASCII_RULES): Define. (NI_*): Define all flags using hex values for clearness. (NI_IDN): Define. (NI_IDN_ALLOW_UNASSIGNED): Define. (NI_IDN_USE_STD3_ASCII_RULES): Define. (EAI_IDN_ENCODE): Define.
Diffstat (limited to 'winsup/cygwin/include/netdb.h')
-rw-r--r--winsup/cygwin/include/netdb.h87
1 files changed, 55 insertions, 32 deletions
diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h
index e4b85c6a7..863c19348 100644
--- a/winsup/cygwin/include/netdb.h
+++ b/winsup/cygwin/include/netdb.h
@@ -152,38 +152,61 @@ extern __declspec(dllimport) int h_errno;
#define NO_DATA 4 /* Valid name, no data record of requested type */
#define NO_ADDRESS NO_DATA /* no address, look for MX record */
-#define AI_PASSIVE 1
-#define AI_CANONNAME 2
-#define AI_NUMERICHOST 4
-#define AI_NUMERICSERV 8
-#define AI_ALL 256
-#define AI_ADDRCONFIG 1024 /* Only available on Vista. Unchangable default
- on older systems. */
-#define AI_V4MAPPED 2048
-
-#define NI_NOFQDN 1
-#define NI_NUMERICHOST 2
-#define NI_NAMEREQD 4
-#define NI_NUMERICSERV 8
-#define NI_DGRAM 16
-
-#define NI_MAXHOST 1025
-#define NI_MAXSERV 32
-
-#define EAI_ADDRFAMILY 1
-#define EAI_AGAIN 2
-#define EAI_BADFLAGS 3
-#define EAI_FAIL 4
-#define EAI_FAMILY 5
-#define EAI_MEMORY 6
-#define EAI_NODATA 7
-#define EAI_NONAME 8
-#define EAI_SERVICE 9
-#define EAI_SOCKTYPE 10
-#define EAI_SYSTEM 11
-#define EAI_BADHINTS 12
-#define EAI_PROTOCOL 13
-#define EAI_OVERFLOW 14
+/* Flag values for getaddrinfo function. */
+#define AI_PASSIVE 0x1 /* Intend socket address for bind. */
+#define AI_CANONNAME 0x2 /* Return canonical node name. */
+#define AI_NUMERICHOST 0x4 /* Input is address, don't resolve. */
+#define AI_NUMERICSERV 0x8 /* Input is port number, don't resolve. */
+#define AI_ALL 0x100 /* Return v4-mapped and v6 addresses. */
+#define AI_ADDRCONFIG 0x400 /* Only available on Vista. Unchangable default
+ on older systems. */
+#define AI_V4MAPPED 0x800
+/* Glibc extensions. We use numerical values taken by winsock-specific
+ extensions. */
+#define AI_IDN 0x4000 /* Encode IDN input from current local to
+ punycode per RFC 3490. */
+#define AI_CANONIDN 0x8000 /* Convert ai_canonname from punycode to IDN
+ in current locale. */
+#define AI_IDN_ALLOW_UNASSIGNED 0x10000 /* Allow unassigned code points in
+ input string. */
+#define AI_IDN_USE_STD3_ASCII_RULES 0x20000 /* Filter ASCII chars according to
+ STD3 rules. */
+
+/* Flag values for getnameinfo function. */
+#define NI_NOFQDN 0x1 /* Don't lookup hostname. */
+#define NI_NUMERICHOST 0x2 /* Return host address, rather than name. */
+#define NI_NAMEREQD 0x4 /* Not being able to resolve is an error. */
+#define NI_NUMERICSERV 0x8 /* Return port number, rather than name. */
+#define NI_DGRAM 0x10 /* Lookup datagram (UDP) service. */
+/* Glibc extensions. We use numerical values taken by winsock-specific
+ extensions. */
+#define NI_IDN 0x4000 /* Decode name from punycode to IDN in
+ current locale. */
+#define NI_IDN_ALLOW_UNASSIGNED 0x10000 /* Allow unassigned code points in
+ output string. */
+#define NI_IDN_USE_STD3_ASCII_RULES 0x20000 /* Filter ASCII chars according to
+ STD3 rules. */
+
+#define NI_MAXHOST 1025 /* Best effort maximum hostname length. */
+#define NI_MAXSERV 32 /* Best effort maximum service name length. */
+
+/* Error codes returned by getaddrinfo and getnameinfo. */
+#define EAI_ADDRFAMILY 1 /* Address family for hostname not supported */
+#define EAI_AGAIN 2 /* Temporary failure in name resolution */
+#define EAI_BADFLAGS 3 /* Bad 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 */
+#define EAI_NODATA 7 /* No address associated with hostname */
+#define EAI_NONAME 8 /* Name or service 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 */
+#define EAI_BADHINTS 12 /* Invalid value for hints */
+#define EAI_PROTOCOL 13 /* Resolved protocol is unknown */
+#define EAI_OVERFLOW 14 /* An argument buffer overflowed */
+/* Glibc extensions. */
+#define EAI_IDN_ENCODE 15 /* Parameter string not correctly encoded */
#ifndef __INSIDE_CYGWIN_NET__
void endhostent (void);