]> granicus.if.org Git - libevent/commitdiff
a program to print out the error strings for winsock errors
authorPatrick Pelletier <code@funwithsoftware.org>
Fri, 8 Feb 2013 01:06:49 +0000 (17:06 -0800)
committerPatrick Pelletier <code@funwithsoftware.org>
Fri, 15 Feb 2013 02:22:12 +0000 (18:22 -0800)
test/Makefile.nmake
test/print-winsock-errors.c [new file with mode: 0644]

index 09b9e879e25cd8d6bf12ff126bccaba596db21d8..f4372b5c9397bf2871a659bbd006eb88fbe32eb2 100644 (file)
@@ -24,11 +24,13 @@ REGRESS_OBJS=regress.obj regress_buffer.obj regress_http.obj regress_dns.obj \
 
 OTHER_OBJS=test-init.obj test-eof.obj test-weof.obj test-time.obj \
        bench.obj bench_cascade.obj bench_http.obj bench_httpclient.obj \
-       test-changelist.obj
+       test-changelist.obj \
+       print-winsock-errors.obj
 
 PROGRAMS=regress.exe \
        test-init.exe test-eof.exe test-weof.exe test-time.exe \
-       test-changelist.exe
+       test-changelist.exe \
+       print-winsock-errors.exe
 
 # Disabled for now:
 #      bench.exe bench_cascade.exe bench_http.exe bench_httpclient.exe
@@ -52,6 +54,9 @@ test-weof.exe: test-weof.obj
 test-time.exe: test-time.obj
        $(CC) $(CFLAGS) $(LIBS) test-time.obj
 
+print-winsock-errors.exe: print-winsock-errors.obj
+       $(CC) $(CFLAGS) $(LIBS) print-winsock-errors.obj
+
 bench.exe: bench.obj
        $(CC) $(CFLAGS) $(LIBS) bench.obj
 bench_cascade.exe: bench_cascade.obj
diff --git a/test/print-winsock-errors.c b/test/print-winsock-errors.c
new file mode 100644 (file)
index 0000000..5064d0b
--- /dev/null
@@ -0,0 +1,61 @@
+#include <winsock2.h>
+#include <windows.h>
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "event2/util.h"
+#include "event2/thread.h"
+
+#define E(x) printf (#x " -> \"%s\"\n", evutil_socket_error_to_string (x));
+
+int main (int argc, char **argv)
+{
+  evthread_use_windows_threads ();
+
+  E(WSAEINTR);
+  E(WSAEACCES);
+  E(WSAEFAULT);
+  E(WSAEINVAL);
+  E(WSAEMFILE);
+  E(WSAEWOULDBLOCK);
+  E(WSAEINPROGRESS);
+  E(WSAEALREADY);
+  E(WSAENOTSOCK);
+  E(WSAEDESTADDRREQ);
+  E(WSAEMSGSIZE);
+  E(WSAEPROTOTYPE);
+  E(WSAENOPROTOOPT);
+  E(WSAEPROTONOSUPPORT);
+  E(WSAESOCKTNOSUPPORT);
+  E(WSAEOPNOTSUPP);
+  E(WSAEPFNOSUPPORT);
+  E(WSAEAFNOSUPPORT);
+  E(WSAEADDRINUSE);
+  E(WSAEADDRNOTAVAIL);
+  E(WSAENETDOWN);
+  E(WSAENETUNREACH);
+  E(WSAENETRESET);
+  E(WSAECONNABORTED);
+  E(WSAECONNRESET);
+  E(WSAENOBUFS);
+  E(WSAEISCONN);
+  E(WSAENOTCONN);
+  E(WSAESHUTDOWN);
+  E(WSAETIMEDOUT);
+  E(WSAECONNREFUSED);
+  E(WSAEHOSTDOWN);
+  E(WSAEHOSTUNREACH);
+  E(WSAEPROCLIM);
+  E(WSASYSNOTREADY);
+  E(WSAVERNOTSUPPORTED);
+  E(WSANOTINITIALISED);
+  E(WSAEDISCON);
+  E(WSATYPE_NOT_FOUND);
+  E(WSAHOST_NOT_FOUND);
+  E(WSATRY_AGAIN);
+  E(WSANO_RECOVERY);
+  E(WSANO_DATA);
+
+  return EXIT_SUCCESS;
+}