aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/utils.h
Commit message (Collapse)AuthorAgeFilesLines
* utils: Include stdint.hTobias Brunner2017-09-191-0/+1
| | | | | | | | | Recent releases of glibc don't include the full stdint.h header in some network headers included by utils.h. So uintptr_t might not be defined. Since we use fixed width integers, including the latter, all over the place we make sure the complete file is included. Fixes #2425.
* utils: Add helper macros to read variadic arguments into local variablesTobias Brunner2017-05-261-2/+46
|
* utils: Fix definition of BYTE_ORDER with MinGWTobias Brunner2016-08-241-1/+5
|
* utils: Provide a fallback for sigwaitinfo() if neededTobias Brunner2015-11-131-1/+15
| | | | | Apparently, not available on Mac OS X 10.10 Yosemite. We don't provide this on Windows.
* android: Replace AndroidConfigLocal.h with a header in utils/compatTobias Brunner2015-11-121-0/+3
|
* utils: Clean up includesMartin Willi2015-04-161-27/+27
|
* align: Move min/max/padding/alignment functions to separate filesMartin Willi2015-04-161-61/+1
|
* time: Move time related functions to separate filesMartin Willi2015-04-161-66/+1
|
* object: Move OO programming helper macros to a separate header fileMartin Willi2015-04-161-106/+1
|
* status: Move status_t type and functions to separate filesMartin Willi2015-04-161-82/+1
|
* path: Move path related utility functions to separate filesMartin Willi2015-04-161-52/+1
|
* tty: Move tty related functions to separate filesMartin Willi2015-04-161-40/+1
|
* memory: Move memory manipulation related functions to separate filesMartin Willi2015-04-161-158/+1
|
* string: Move string related utility functions to separate filesMartin Willi2015-04-161-78/+1
|
* byteorder: Move byte order related functions to separate header fileMartin Willi2015-04-161-136/+1
|
* types: Use generic type definitions to separate header fileMartin Willi2015-04-161-62/+1
|
* atomics: Move atomics/recounting support to separate filesMartin Willi2015-04-161-95/+1
|
* utils: Provide aligning variants of INIT/INIT_EXTRA macrosMartin Willi2015-04-151-0/+29
|
* utils: Add malloc/free wrappers returning aligned dataMartin Willi2015-04-151-0/+18
| | | | | | | | | | | | | While we could use posix_memalign(3), that is not fully portable. Further, it might be difficult on some platforms to properly catch it in leak-detective, which results in invalid free()s when releasing such memory. We instead use a simple wrapper, which allocates larger data, and saves the padding size in the allocated header. This requires that memory is released using a dedicated function. To reduce the risk of invalid free() when working on corrupted data, we fill up all the padding with the padding length, and verify it during free_align().
* utils: Provide an INIT_EXTRA() macro, that allocates extra data to INIT()Martin Willi2015-04-151-0/+15
|
* utils: Define MAX_(U)INT_TYPE to the maximum size integer type availableMartin Willi2015-04-141-0/+6
|
* utils: Typedef int128_t and u_int128_t types if supportedMartin Willi2015-04-141-0/+11
|
* utils: Add a constant time memeq() variant for cryptographic purposesMartin Willi2015-04-141-0/+5
|
* windows: Move the compatibility header to the compat subfolderMartin Willi2014-11-211-1/+1
|
* apple: Introduce a central compatibility header with all __APPLE__ quirksMartin Willi2014-11-211-0/+3
|
* windows: Provide a poll(2) wrapper calling WSAPoll()Martin Willi2014-11-211-0/+1
|
* utils: Check if the parameter passed to countof() is actually an array typeMartin Willi2014-08-251-1/+2
| | | | This should avoid errors such as the one fixed with 118b2879.
* utils: Add some initial build time assertion macrosMartin Willi2014-08-251-0/+14
| | | | | These are useful to assert constants during build time. We evaluate the expression to 0 when valid, so we can safely use the evaluated value.
* utils: Undefine mem{cpy,move,set} if set before defining themMartin Willi2014-07-071-0/+9
| | | | | Some platforms, such as OS X, use macros for these functions. Undefine them to avoid compiler warnings.
* utils: Helper macros to define overloaded macros based on number of argumentsTobias Brunner2014-06-301-0/+26
|
* utils: Add wrappers for memcpy(3), memmove(3) and memset(3)Tobias Brunner2014-06-241-1/+33
| | | | | | | | 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).
* utils: Add a wait_sigint() function to wait for SIGINT or equivalentMartin Willi2014-06-041-0/+5
|
* utils: Provide a path_absolute() function to check path for non-relativenessMartin Willi2014-06-041-0/+8
| | | | The usually used trivial '/' check won't work on Windows platforms.
* utils: Define a platform directory separator character used in pathsMartin Willi2014-06-041-0/+9
|
* windows: Provide a sched_yield() implementationMartin Willi2014-06-041-0/+1
|
* windows: Add utils_init/deinit functions to initialize Winsock2Martin Willi2014-06-041-0/+10
|
* windows: Add a common Windows header for platform specific wrappersMartin Willi2014-06-031-2/+11
| | | | | Include some more basic system headers in utils.h, so we can use that common header on the different platforms.
* enum: Don't directly include enum.hMartin Willi2014-05-161-3/+3
| | | | | To allow enum.h to depend on utils.h definitions, avoid its direct inclusion. Instead include utils.h, which includes enum.h as well.
* utils: Provide a CALLBACK macro, similar to METHOD, but for void* callbacksMartin Willi2014-05-071-0/+13
| | | | | | Using the same mechanism as the METHOD macro, the CALLBACK macro defines a hybrid function signature. It strictly uses a weak void* for the first function parameter, in contrast to the dynamic METHOD object "this" type.
* utils: Enable __atomic* built-ins based on the GCC versionTobias Brunner2014-05-041-0/+7
| | | | | | | | | | | This solves a problem with GNAT when compiling charon-tkm as __atomic* built-ins are only provided in GCC 4.7 and newer. Currently GNAT 4.6 and GCC 4.7.2 is shipped with Debian wheezy (stable), as used in the testing environment. So while the configure script correctly detected the __atomic* built-ins, and defined HAVE_GCC_ATOMIC_OPERATIONS, this define turned out to be incorrect when charon-tkm was later built with GNAT.
* utils: Use GCC's __atomic built-ins if availableTobias Brunner2014-04-241-1/+20
| | | | | | | | These are available since GCC 4.7 and will eventually replace the __sync operations. They support the memory model defined by C++11. For instance, by using __ATOMIC_RELAXED for some operations on the reference counters we can avoid memory barriers, which are required by __sync operations (whose memory model essentially is __ATOMIC_SEQ_CST).
* utils: Add ref_cur() to retrieve the current value of a reference counterTobias Brunner2014-04-241-2/+11
| | | | | | | | | | On many architectures it is safe to read the value directly (those using cache coherency protocols, and with atomic loads for 32-bit values) but it is not if that's not the case or if we ever decide to make refcount_t 64-bit (load not atomic on x86). So make sure the operation is actually atomic and that users do not have to care about the size of refcount_t.
* utils: Add memrchr(3) replacement for platforms that don't support itTobias Brunner2014-02-261-0/+14
| | | | For instance, on Mac OS X memrchr(3) is not provided by the C library.
* utils: Add thread-safe variants of dirname(3) and basename(3)Tobias Brunner2014-02-241-1/+27
|
* utils: Move thread-safe strerror replacement to a separate fileTobias Brunner2014-02-241-17/+1
| | | | | For some utils _GNU_SOURCE might be needed but that conflicts with the signature of strerror_r(3).
* Fixed some typosTobias Brunner2014-02-181-3/+3
|
* utils: Add strreplace functionTobias Brunner2014-01-231-1/+15
|
* utils: Include stdio.h for fmemopen() replacementTobias Brunner2013-10-291-0/+1
| | | | | This might now be required because Vstr is not necessarily required anymore, which means stdio.h might not be pulled in by prinf_hook.h.
* utils: Fix check for fmemopen() fallback implementationMartin Willi2013-10-241-1/+2
|
* utils: Provide a fmemopen(3) fallback using BSD funopen()Martin Willi2013-10-241-0/+15
|