Tobias Brunner
babe9e4f45
windows: Close correct socket when opening second socket fails in socketpair()
2014-07-02 12:38:44 +02:00
Tobias Brunner
0a26f39a71
windows: Make sure the string returned from ReadConsole() is null terminated
2014-07-02 12:38:44 +02:00
Tobias Brunner
0e48f67562
backtrace: Remove name checks after SymFromAddr() calls
...
The Name member is an array whose address is always defined.
2014-07-02 12:11:59 +02:00
Tobias Brunner
1be2b84124
parser-helper: Ensure file_next() does not remove the sentinel item
2014-07-01 17:58:36 +02:00
Tobias Brunner
e79dbda390
utils: Helper macros to define overloaded macros based on number of arguments
2014-06-30 13:29:26 +02:00
Tobias Brunner
aad072d517
enum: Replace þ with p in Doxygen comments
2014-06-30 13:16:17 +02:00
Tobias Brunner
ed01c1afff
Fixed some typos
2014-06-30 13:16:16 +02:00
Martin Willi
07b57e203b
windows: Include <sys/stat.h> explicitly before overloading memset()/memcpy()
...
fstat() in newer MinGWs is defined as non-static inline. With our new static
inline memset()/memcpy() overloads, this raises a warning. To avoid it,
explicitly include <sys/stat.h> once before defining these overloads.
2014-06-25 16:09:42 +02:00
Tobias Brunner
6d4654b9f9
utils: Add wrappers for memcpy(3), memmove(3) and memset(3)
...
These wrappers guarantee that calls to these functions are noops if the
number of bytes is 0, as calling them with NULL pointers is undefined
according to the C standard, even if the number of bytes is 0 (most
implementations probably ignore the pointers anyway in this case, but
lets make sure).
2014-06-24 15:11:27 +02:00
Tobias Brunner
aba55fdffe
identification: Only use either , or / to separate RDNs
...
If a DN starts with a slash (or whitespace and a slash) slashes will
be used, otherwise commas.
2014-06-18 09:24:03 +02:00
Martin Willi
dff39a4c5b
windows: Declare strerror_s()
...
Older MinGW versions seem to miss this function declaration. Fixes build on
Travis using Ubuntu 12.04.
2014-06-17 15:23:33 +02:00
Martin Willi
1bcf850738
windows: Extend strerror_r/s by extended POSIX errno strings
2014-06-17 15:23:33 +02:00
Martin Willi
c2119cded4
windows: Implement strerror_r using strerror_s
2014-06-17 15:23:33 +02:00
Martin Willi
8b5d41a274
windows: Wrap most Winsock2 Posix functions to set errno
...
While Winsock provides many Posix compatibility functions, they do not set
errno, but use WSAGetLastError() for error reporting. The wrapped functions
derive an errno from WSAGetLastError() on failure.
2014-06-17 15:23:32 +02:00
Martin Willi
8c2c63e09d
backtrace: Use GetModuleInformation/GetModuleFileNameEx directly on Win32
...
The K32 variants are actually needed on 64-bit only.
2014-06-06 16:28:28 +02:00
Martin Willi
cab59c73fc
windows: Use WINAPI call convention for Windows API callbacks
...
For x86_64 it does not actually matter, but for i686 builds the call convention
is different with WINAPI.
2014-06-06 16:28:28 +02:00
Martin Willi
7659f67af3
windows: Provide POSIX supplement errno values missing in MinGW
...
MinGW headers do not define these values, but Windows system headers do.
Windows defines them for POSIX compatibility, we do the same locally.
2014-06-04 15:53:12 +02:00
Martin Willi
2162e50004
windows: Provide shutdown(2) operation aliases mapping to those on Windows
2014-06-04 15:53:12 +02:00
Martin Willi
0c34c1b3af
unit-tests: Support testable functions on Windows, avoid weak GCC symbols
...
Instead of using weak symbols, we use dlsym() on Windows to find an arbitrary
symbol in libtest to detect its linkage. Instead of creating the associated
hashtable in the test runner, we maintain it in libstrongswan, making it
significantly simpler.
2014-06-04 15:53:12 +02:00
Martin Willi
460adb5d09
unit-tests: Seed chunk_hash() only once, but before creating any hashtables
...
Due to the removal of pthread_once, we manually create the seed for
chunk_hash(). With the new testable functions interface, this won't work for
the hashtable initiated using __attribute__((constructor)). Enforce seeding
before creating that hashtable.
2014-06-04 15:53:11 +02:00
Martin Willi
66c0801dc7
utils: Add a wait_sigint() function to wait for SIGINT or equivalent
2014-06-04 15:53:11 +02:00
Martin Willi
1309cb7b1a
chunk: On Windows, use binary mode in chunk_write()
2014-06-04 15:53:10 +02:00
Martin Willi
bc9fd3735d
parser-helper: Detect absolute pathnames and concatenate paths on Windows
2014-06-04 15:53:09 +02:00
Martin Willi
67b3bcd13d
utils: Provide a path_absolute() function to check path for non-relativeness
...
The usually used trivial '/' check won't work on Windows platforms.
2014-06-04 15:53:09 +02:00
Martin Willi
2496eaffde
utils: Return plain drive letter as base/pathname for drive letters on Windows
2014-06-04 15:53:08 +02:00
Martin Willi
8182631bc3
utils: Support Windows path separators in path_basename/dirname
2014-06-04 15:53:08 +02:00
Martin Willi
a43f1e5631
utils: Define a platform directory separator character used in paths
2014-06-04 15:53:08 +02:00
Martin Willi
41bb8ba5d2
windows: Provide a getpass() implementation
2014-06-04 15:53:08 +02:00
Martin Willi
c5447bc2f5
chunk: On Windows, chunk_map() opens files in binary mode
2014-06-04 15:53:08 +02:00
Martin Willi
8120b3c339
windows: Don't redeclare inet_ntop/pton if already defined
2014-06-04 15:53:05 +02:00
Martin Willi
1f3bf4175d
windows: Check for existence of error codes before defining them
2014-06-04 15:53:05 +02:00
Martin Willi
3d50dd47ef
windows: Overload sleep() cancellable when it is defined in <unistd.h>
2014-06-04 15:53:04 +02:00
Martin Willi
efcf249aeb
windows: Provide a close(2) that can close both file handles and sockets
2014-06-04 15:53:04 +02:00
Martin Willi
740404d481
chunk: Fallback to recv() on Windows chunk_from_fd() when operating on socket
2014-06-04 15:53:04 +02:00
Martin Willi
9ff1716029
windows: Don't use function macros to overload send/recv() and friends
...
While the macro versions would not catch non-function invocations, we actually
have to use catch all to support the sender_t.send() function.
2014-06-04 15:53:03 +02:00
Martin Willi
f3c809e615
windows: Provide a strndup(3) replacement
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
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
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
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
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