Skip to content

Instantly share code, notes, and snippets.

@amatus
Last active August 17, 2016 23:04
Show Gist options
  • Save amatus/ba9c247a330eaa8933174091a473fe49 to your computer and use it in GitHub Desktop.
Save amatus/ba9c247a330eaa8933174091a473fe49 to your computer and use it in GitHub Desktop.
#define GNUNET_MQ_hd_fixed_size(name,code,str,ctx) \
({ \
void (*_cb)(void *cls, const str *msg) = &handle_##name; \
((struct GNUNET_MQ_MessageHandler) { \
NULL, (GNUNET_MQ_MessageCallback) _cb, \
(ctx), (code), sizeof (str) }); \
})
#define GNUNET_MQ_hd_var_size(name,code,str,ctx) \
({ \
int (*_mv)(void *cls, const str *msg) = &check_##name; \
void (*_cb)(void *cls, const str *msg) = &handle_##name; \
((struct GNUNET_MQ_MessageHandler) \
{ (GNUNET_MQ_MessageValidationCallback) _mv, \
(GNUNET_MQ_MessageCallback) _cb, \
(ctx), (code), sizeof (str) }); \
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment