diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2012-04-11 13:21:25 -0700 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2012-04-11 13:25:11 -0700 |
commit | 2778766d678b147fc079d67dee036346381b4764 (patch) | |
tree | da44507f62fb9c8cd078cf25f6dc24107e56af34 /src/usocket.c | |
parent | 3a8ba90dfb0c2eb224f317dd692ede426691e72a (diff) | |
download | luasocket-2778766d678b147fc079d67dee036346381b4764.tar.gz luasocket-2778766d678b147fc079d67dee036346381b4764.tar.bz2 luasocket-2778766d678b147fc079d67dee036346381b4764.zip |
Preliminary IPv6 support for v2.1
Diffstat (limited to 'src/usocket.c')
-rw-r--r-- | src/usocket.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/src/usocket.c b/src/usocket.c index 1ba1043..5201b7b 100644 --- a/src/usocket.c +++ b/src/usocket.c | |||
@@ -6,7 +6,7 @@ | |||
6 | * The penalty of calling select to avoid busy-wait is only paid when | 6 | * The penalty of calling select to avoid busy-wait is only paid when |
7 | * the I/O call fail in the first place. | 7 | * the I/O call fail in the first place. |
8 | * | 8 | * |
9 | * RCS ID: $Id$ | 9 | * RCS ID: $Id: usocket.c,v 1.38 2007/10/13 23:55:20 diego Exp $ |
10 | \*=========================================================================*/ | 10 | \*=========================================================================*/ |
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <signal.h> | 12 | #include <signal.h> |
@@ -368,3 +368,24 @@ const char *socket_ioerror(p_socket ps, int err) { | |||
368 | (void) ps; | 368 | (void) ps; |
369 | return socket_strerror(err); | 369 | return socket_strerror(err); |
370 | } | 370 | } |
371 | |||
372 | const char *socket_gaistrerror(int err) { | ||
373 | if (err == 0) return NULL; | ||
374 | switch (err) { | ||
375 | case EAI_AGAIN: return "temporary failure in name resolution"; | ||
376 | case EAI_BADFLAGS: return "invalid value for ai_flags"; | ||
377 | case EAI_BADHINTS: return "invalid value for hints"; | ||
378 | case EAI_FAIL: return "non-recoverable failure in name resolution"; | ||
379 | case EAI_FAMILY: return "ai_family not supported"; | ||
380 | case EAI_MEMORY: return "memory allocation failure"; | ||
381 | case EAI_NONAME: | ||
382 | return "hostname or servname not provided, or not known"; | ||
383 | case EAI_OVERFLOW: return "argument buffer overflow"; | ||
384 | case EAI_PROTOCOL: return "resolved protocol is unknown"; | ||
385 | case EAI_SERVICE: return "servname not supported for socktype"; | ||
386 | case EAI_SOCKTYPE: return "ai_socktype not supported"; | ||
387 | case EAI_SYSTEM: return strerror(errno); | ||
388 | default: return "unknown error"; | ||
389 | } | ||
390 | } | ||
391 | |||