Martin Willi
8f3a3656d3
sha1: Include <library.h> instead of directly including <arpa/inet.h>
...
On Windows we don't have <arpa/inet.h>
2014-06-04 15:53:02 +02:00
Martin Willi
2dbb719b76
x509: Undef OCSP_RESPONSE from <wincrypt.h> before using it
2014-06-04 15:53:02 +02:00
Martin Willi
4163421f91
plugins: Don't link with -rdynamic on Windows
2014-06-04 15:53:02 +02:00
Martin Willi
110e42361e
unit-tests: Uninline dlopen() and friends, make more dynamic, fix dlerror()
...
As the error string contains a newline, we have to remove that before
returning the string.
2014-06-04 15:53:02 +02:00
Martin Willi
204098a752
thread-value: Immediately cleanup all Windows TLS values on destroy
2014-06-04 15:53:02 +02:00
Martin Willi
9dec601f30
windows: Prevent queueing of multiple thread cancel APCs
...
This avoids any races during cleanup invocation if multiple cancel() requests
come in.
2014-06-04 15:53:01 +02:00
Martin Willi
0fa9c95811
windows: Provide a complete native Windows threading backend
2014-06-04 15:53:01 +02:00
Martin Willi
a48570a046
windows: Provide a cancellable usleep(), but with ms resolution only
2014-06-04 15:53:01 +02:00
Martin Willi
986a577097
windows: Add a sleep function acting as cancellation point
2014-06-04 15:53:01 +02:00
Martin Willi
266ee0a190
windows: Provide a sched_yield() implementation
2014-06-04 15:53:01 +02:00
Martin Willi
4de7401a98
windows: Provide a time_monotonic() based on GetTickCount64()
2014-06-04 15:53:01 +02:00
Martin Willi
965e846cc3
library: Change init/deinit order to allow utils to depend on threading
2014-06-04 15:53:01 +02:00
Martin Willi
c46cee6f6d
chunk: Don't depend on pthread directly
2014-06-04 15:53:00 +02:00
Martin Willi
f1c9653e04
utils: Don't directly depend on pthread
2014-06-04 15:53:00 +02:00
Martin Willi
eb94f58595
strerror: Don't directly depend on pthread
2014-06-04 15:53:00 +02:00
Martin Willi
a506b922f3
windows: Provide a strdup variant safe when passing zero-length strings
2014-06-04 15:53:00 +02:00
Martin Willi
d8e56dfe32
unit-tests: Don't test Unix socket stream/services on Windows
2014-06-04 15:53:00 +02:00
Martin Willi
adaa9f3942
unit-tests: Use send/recv on socket in watcher tests
...
Windows does not support read/write on sockets.
2014-06-04 15:53:00 +02:00
Martin Willi
aa5b49c037
stream: Separate TCP/Unix stream helpers from stream/service implementations
...
This allows us to disable Unix sockets cleanly on Windows. Replaces some
read/write calls with recv/send counterparts, as Winsock does not like
read/writes.
2014-06-04 15:53:00 +02:00
Martin Willi
93f78d8225
watcher: Add Windows support
...
Instead of a pipe we use a TCP socketpair (can't select() a _pipe()), and
Windsock2 send/recv functions instead of read/write.
Currently supported (and required) are file descriptors provided by Winsock
only; we might use a separate mechanism for traditional file handles if
required (or switch to Windows events and WaitForMultipleObjects) for a future
version.
2014-06-04 15:52:59 +02:00
Martin Willi
df0769299a
windows: Map WSAGetLastError() to errno failures in wrapped send/recv/from/to
2014-06-04 15:52:59 +02:00
Martin Willi
20021277f2
windows: Add send/recv and sendto/recvfrom wrappers supporting MSG_DONTWAIT
2014-06-04 15:52:59 +02:00
Martin Willi
82fcb80276
windows: Implement socketpair() using TCP sockets
2014-06-04 15:52:59 +02:00
Martin Willi
87a79e6a03
windows: Add utils_init/deinit functions to initialize Winsock2
2014-06-04 15:52:59 +02:00
Martin Willi
fb81820796
windows: Provide a setenv() wrapper
2014-06-04 15:52:59 +02:00
Martin Willi
7458952575
unit-tests: Use Windows path for chunk tests, and socket functions if required
2014-06-04 15:52:59 +02:00
Martin Willi
a8c86599e4
unit-tests: Don't depend on sockaddr_un to test invalid host_t family
2014-06-04 15:52:59 +02:00
Martin Willi
4aaf0320d0
unit-tests: Add support for Windows build
...
Instead of signals we catch Windows exceptions. Currently not supported are
timers, which is more a convenience thing anyway.
2014-06-04 15:52:58 +02:00
Martin Willi
a2216a2868
windows: Fix up PRI* printf formatters when building against own backend
2014-06-04 15:52:58 +02:00
Martin Willi
95a8d53dbe
windows: Use localtime/gmtime to implement _r variants
...
The _s variants and friends do not seem to work on Windows 7 and always fail.
2014-06-04 15:52:58 +02:00
Martin Willi
a4719c5767
asn1: Return a zeroed ASN1 time if gmtime_r() conversion fails
2014-06-04 15:52:58 +02:00
Martin Willi
8f129319ff
utils: Printf() defined time output should gmtime/localtime_r() fail
2014-06-04 15:52:58 +02:00
Martin Willi
087e02e47e
backtrace: Inline esc() helper, making it available to all build variants
2014-06-04 15:52:58 +02:00
Martin Willi
2127831cda
backtrace: Support backtraces on Windows without DbgHelp
...
While DbgHelp provides a convenient API to create backtraces, any executable
linking against DbgHelp gets a more than a significant slow down. Further, it
can only lookup global symbols, as it expects PDB files we can't produce with a
MinGW build.
With some core Kernel32.dll functionality, we can capture stack traces much
faster. Together with the optional libbfd, we can print very fine backtraces.
When --enable-bfd-backtraces is used on Windows, a libbfd.dll is required for
the build. Such a DLL can be created from the binutils sources using:
# build binutils with mingw...
# extract archive members from binutils libraries
x86_64-w64-mingw32-ar x $BINUTILS/bfd/.libs/libbfd.a
x86_64-w64-mingw32-ar x $BINUTILS/intl/libintl.a
x86_64-w64-mingw32-ar x $BINUTILS/libiberty/libiberty.a
# create self-contained libbfd.a, with index
x86_64-w64-mingw32-ar qs libbfd.a *.o
# create DLL from static library
x86_64-w64-mingw32-dlltool -e libbfd.o -l libbfd.lib libbfd.a
x86_64-w64-mingw32-gcc -shared libbfd.a libbfd.o -o libbfd.dll
2014-06-04 15:52:58 +02:00
Martin Willi
a7e943a640
backtrace: Add DbgHelp based Windows support for creating/printing backtraces
2014-06-04 15:52:57 +02:00
Martin Willi
1f2b8c8c80
printf-hook-builtin: Support Windows console colors using TTY escape codes
2014-06-04 15:52:57 +02:00
Martin Willi
71bf82d474
windows: Link libstrongswan against ws2_32.dll
2014-06-04 15:52:57 +02:00
Martin Willi
e7f3ceb7c8
capabilities: Add build support for Windows
...
We might extend it in the future using some Windows rights management.
2014-06-04 15:52:57 +02:00
Martin Willi
d3c30b356c
windows: Use _getmaxstdio as replacement for syscall(_SC_OPEN_MAX)
2014-06-03 12:24:35 +02:00
Martin Willi
a3f7dfc1ca
windows: replace mkdir() with Windows _mkdir() variant
2014-06-03 12:24:35 +02:00
Martin Willi
c6b588bf06
thread: Add a Windows pthread variant to print thread identifiers
2014-06-03 12:24:34 +02:00
Martin Willi
2e6c203bad
windows: Provide wrappers for dlopen() function family
2014-06-03 12:24:34 +02:00
Martin Willi
40a924090e
crl: Undefine <wincrypt.h>'s CRL_REASON_* and use our enum values instead
2014-06-03 12:24:34 +02:00
Martin Willi
43c5388470
tun-device: Rearrange headers to build properly when tun devices not supported
2014-06-03 12:24:34 +02:00
Martin Willi
922ee2c529
windows: Add a common Windows header for platform specific wrappers
...
Include some more basic system headers in utils.h, so we can use that common
header on the different platforms.
2014-06-03 12:24:34 +02:00
Tobias Brunner
e14507cb71
curl: Don't set CURLOPT_FAILONERROR
...
With the strongTNC REST API some errors will actually be accompanied by
a response we want to receive completely.
2014-05-31 20:37:55 +02:00
Tobias Brunner
b9dfeb5de4
unit-tests: Sync threads with main thread in test_cleanup_cancel()
...
Without synchronization threads could get canceled before they could
disable their cancelability.
2014-05-19 16:06:52 +02:00
Tobias Brunner
271c2dd24e
soup: Add support to retrieve the response code
2014-05-19 14:29:48 +02:00
Tobias Brunner
350c1dead9
unit-tests: Allow some HTTP write operations to fail
...
Because CURLOPT_FAILONERROR is enabled in the curl plugin an error code
will often (not always) cause the client to close the TCP connection
before the server has written the complete response.
2014-05-19 14:28:45 +02:00
Tobias Brunner
703a0b4c3e
curl: Add support to return the response code
2014-05-19 14:28:40 +02:00