From de4a07bc496f9267010837edbd135d73a6518fd0 Mon Sep 17 00:00:00 2001 From: Gabor X Toth <*@tg-x.net> Date: Fri, 12 Jul 2013 09:43:07 +0000 Subject: PSYC/social: header for method callbacks --- src/include/gnunet_psyc_lib.h | 26 ++++++++++++++++++++++++++ src/include/gnunet_psyc_service.h | 10 ++++++++++ src/include/gnunet_social_service.h | 14 +++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) diff --git a/src/include/gnunet_psyc_lib.h b/src/include/gnunet_psyc_lib.h index bd8cbf025..50f346048 100644 --- a/src/include/gnunet_psyc_lib.h +++ b/src/include/gnunet_psyc_lib.h @@ -78,6 +78,32 @@ enum GNUNET_PSYC_Type }; +/** + * PSYC state modifier. + */ +struct GNUNET_PSYC_Modifier { + /** + * State operation. + */ + GNUNET_PSYC_Operator oper; + + /** + * Variable name. + */ + const char *name; + + /** + * Size of @a value. + */ + size_t value_size; + + /** + * Value of variable. + */ + const void *value; +}; + + /** * Get the type of variable. * diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h index 6987bab82..4828cc460 100644 --- a/src/include/gnunet_psyc_service.h +++ b/src/include/gnunet_psyc_service.h @@ -155,6 +155,8 @@ struct GNUNET_PSYC_PartHandle; * @param method_name Original method name from PSYC (may be more * specific than the registered method name due to try-and-slice matching). * FIXME: no try-and-slice for methods defined here. + * @param header_length Number of modifiers in header. + * @param header Modifiers present in the message. * @param data_off Byte offset of @a data in the overall data of the method. * @param data_size Number of bytes in @a data. * @param data Data stream given to the method (might not be zero-terminated @@ -178,6 +180,8 @@ typedef int (*GNUNET_PSYC_Method)(void *cls, * @param cls Closure. * @param sender Who transmitted the message. * @param method_name Method name in the join request. + * @param header_length Number of modifiers in header. + * @param header Modifiers present in the message. * @param data_size Number of bytes in @a data. * @param data Data stream given to the method (might not be zero-terminated * if data is binary). @@ -185,6 +189,8 @@ typedef int (*GNUNET_PSYC_Method)(void *cls, typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, const struct GNUNET_PeerIdentity *sender, const char *method_name, + size_t header_length, + GNUNET_PSYC_Modifier *header, size_t data_size, const void *data, struct GNUNET_PSYC_JoinHandle *jh); @@ -196,6 +202,8 @@ typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, * @param cls Closure. * @param sender Who transmitted the message. * @param method_name Method name in the part request. + * @param header_length Number of modifiers in header. + * @param header Modifiers present in the message. * @param data_size Number of bytes in @a data. * @param data Data stream given to the method (might not be zero-terminated * if data is binary). @@ -203,6 +211,8 @@ typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, typedef int (*GNUNET_PSYC_PartCallback)(void *cls, const struct GNUNET_PeerIdentity *sender, const char *method_name, + size_t header_length, + GNUNET_PSYC_Modifier *header, size_t data_size, const void *data, struct GNUNET_PSYC_PartHandle *ph); diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index ea643de5a..1d2b2096c 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h @@ -84,6 +84,8 @@ struct GNUNET_SOCIAL_Slicer; * @param message_id Unique message counter for this message * (unique only in combination with the given sender for * this channel). + * @param header_length Number of modifiers in header. + * @param header Modifiers present in the message. * @param data_off Byte offset of @a data in the overall data of the method. * @param data_size Number of bytes in @a data. * @param data Data stream given to the method (might not be zero-terminated @@ -93,6 +95,8 @@ struct GNUNET_SOCIAL_Slicer; typedef int (*GNUNET_SOCIAL_Method)(void *cls, const char *full_method_name, uint64_t message_id, + size_t header_length, + GNUNET_PSYC_Modifier *header, uint64_t data_off, size_t data_size, const void *data, @@ -172,11 +176,15 @@ GNUNET_SOCIAL_ego_destroy (struct GNUNET_SOCIAL_Ego *ego); * * @param cls Closure. * @param nym Handle for the user who wants to join. + * @param header_length Number of modifiers in header. + * @param header Modifiers present in the message. * @param msg_size Number of bytes in @a msg. * @param msg Payload given on enter (e.g. a password). */ typedef void (*GNUNET_SOCIAL_AnswerDoorCallback)(void *cls, struct GNUNET_SOCIAL_Nym *nym, + size_t header_length, + GNUNET_PSYC_Modifier *header, size_t msg_size, const void *msg); @@ -189,9 +197,13 @@ typedef void (*GNUNET_SOCIAL_AnswerDoorCallback)(void *cls, * * @param cls Closure. * @param nym Handle for the user who left. + * @param header_length Number of modifiers in header. + * @param header Modifiers present in the message. */ typedef void (*GNUNET_SOCIAL_FarewellCallback)(void *cls, - struct GNUNET_SOCIAL_Nym *nym); + struct GNUNET_SOCIAL_Nym *nym, + size_t header_length, + GNUNET_PSYC_Modifier *header); /** -- cgit v1.2.3