diff options
author | Martin Willi <martin@revosec.ch> | 2014-05-07 15:12:09 +0200 |
---|---|---|
committer | Martin Willi <martin@revosec.ch> | 2014-05-07 15:12:09 +0200 |
commit | 954c63a4bc6d12b5a6a9b5e4fa010be9c1727163 (patch) | |
tree | 29652983aa269592955c7f3fc9e229b5f3e4a544 /src/libstrongswan/utils/utils.h | |
parent | dba3c649da9eae16b82e502eddb7efe11f3e3ae4 (diff) | |
parent | 4787523cc32553dd569ba9f643532aaae64a8b24 (diff) | |
download | strongswan-954c63a4bc6d12b5a6a9b5e4fa010be9c1727163.tar.bz2 strongswan-954c63a4bc6d12b5a6a9b5e4fa010be9c1727163.tar.xz |
Merge branch 'vici'
Introduces the vici plugin providing a Versatile IKE Configuration Interface
to configure, monitor and control the IKE daemon charon over a stable IPC
socket interface.
Diffstat (limited to 'src/libstrongswan/utils/utils.h')
-rw-r--r-- | src/libstrongswan/utils/utils.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/utils.h b/src/libstrongswan/utils/utils.h index 75b31ec1b..53bfceda6 100644 --- a/src/libstrongswan/utils/utils.h +++ b/src/libstrongswan/utils/utils.h @@ -204,6 +204,19 @@ static inline bool memeq(const void *x, const void *y, size_t len) static ret name(this, ##__VA_ARGS__) /** + * Callback declaration/definition macro, allowing casted first parameter. + * + * This is very similar to METHOD, but instead of casting the first parameter + * to a public interface, it uses a void*. This allows type safe definition + * of a callback function, while using the real type for the first parameter. + */ +#define CALLBACK(name, ret, param1, ...) \ + static ret _cb_##name(union {void *_generic; param1;} \ + __attribute__((transparent_union)), ##__VA_ARGS__); \ + static typeof(_cb_##name) *name = (typeof(_cb_##name)*)_cb_##name; \ + static ret _cb_##name(param1, ##__VA_ARGS__) + +/** * Architecture independent bitfield definition helpers (at least with GCC). * * Defines a bitfield with a type t and a fixed size of bitfield members, e.g.: |