diff options
author | Gabor X Toth <*@tg-x.net> | 2013-09-03 22:33:21 +0000 |
---|---|---|
committer | Gabor X Toth <*@tg-x.net> | 2013-09-03 22:33:21 +0000 |
commit | eb9556bf2983ca19a5cbcf7cf460a0b2509b290a (patch) | |
tree | 285d31e951f7ecf9308b22257adcadd5b07d80ea /src/include | |
parent | 37bafa60a6f0e447cb5b61547404f0902fa7ad41 (diff) | |
download | gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.tar.gz gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.zip |
PSYCstore SQLite backend; API fixes/enhancements
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/gnunet_multicast_service.h | 86 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_psyc_service.h | 47 | ||||
-rw-r--r-- | src/include/gnunet_psycstore_plugin.h | 120 | ||||
-rw-r--r-- | src/include/gnunet_psycstore_service.h | 78 | ||||
-rw-r--r-- | src/include/gnunet_social_service.h | 63 |
6 files changed, 248 insertions, 148 deletions
diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h index e1dec7b85..1c23af2f0 100644 --- a/src/include/gnunet_multicast_service.h +++ b/src/include/gnunet_multicast_service.h | |||
@@ -101,7 +101,7 @@ struct GNUNET_MULTICAST_MessageHeader | |||
101 | * unicast requests from members. Updated at each hop and thus not signed and | 101 | * unicast requests from members. Updated at each hop and thus not signed and |
102 | * not secure. | 102 | * not secure. |
103 | */ | 103 | */ |
104 | uint32_t hop_counter GNUNET_PACKED; | 104 | uint32_t hop_counter; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * ECC signature of the message fragment. | 107 | * ECC signature of the message fragment. |
@@ -118,19 +118,19 @@ struct GNUNET_MULTICAST_MessageHeader | |||
118 | /** | 118 | /** |
119 | * Number of the message fragment, monotonically increasing. | 119 | * Number of the message fragment, monotonically increasing. |
120 | */ | 120 | */ |
121 | uint64_t fragment_id GNUNET_PACKED; | 121 | uint64_t fragment_id; |
122 | 122 | ||
123 | /** | 123 | /** |
124 | * Byte offset of this @e fragment of the @e message. | 124 | * Byte offset of this @e fragment of the @e message. |
125 | */ | 125 | */ |
126 | uint64_t fragment_offset GNUNET_PACKED; | 126 | uint64_t fragment_offset; |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Number of the message this fragment belongs to. | 129 | * Number of the message this fragment belongs to. |
130 | * | 130 | * |
131 | * Set in GNUNET_MULTICAST_origin_to_all(). | 131 | * Set in GNUNET_MULTICAST_origin_to_all(). |
132 | */ | 132 | */ |
133 | uint64_t message_id GNUNET_PACKED; | 133 | uint64_t message_id; |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * Counter that monotonically increases whenever a member parts the group. | 136 | * Counter that monotonically increases whenever a member parts the group. |
@@ -142,15 +142,15 @@ struct GNUNET_MULTICAST_MessageHeader | |||
142 | * is still the same before and after the missed messages, it means that no | 142 | * is still the same before and after the missed messages, it means that no |
143 | * @e join or @e part operations happened during the missed messages. | 143 | * @e join or @e part operations happened during the missed messages. |
144 | */ | 144 | */ |
145 | uint64_t group_generation GNUNET_PACKED; | 145 | uint64_t group_generation; |
146 | 146 | ||
147 | /** | 147 | /** |
148 | * Flags for this message fragment. | 148 | * Flags for this message fragment. |
149 | */ | 149 | */ |
150 | enum GNUNET_MULTICAST_MessageFlags flags GNUNET_PACKED; | 150 | uint32_t flags; |
151 | 151 | ||
152 | /* Followed by message body. */ | 152 | /* Followed by message body. */ |
153 | }; | 153 | } GNUNET_PACKED; |
154 | 154 | ||
155 | GNUNET_NETWORK_STRUCT_END | 155 | GNUNET_NETWORK_STRUCT_END |
156 | 156 | ||
@@ -309,7 +309,7 @@ struct GNUNET_MULTICAST_ReplayHandle; | |||
309 | 309 | ||
310 | /** | 310 | /** |
311 | * Functions with this signature are called whenever the multicast service needs | 311 | * Functions with this signature are called whenever the multicast service needs |
312 | * a message to be replayed. | 312 | * a message fragemnt to be replayed by fragment_id. |
313 | * | 313 | * |
314 | * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE | 314 | * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE |
315 | * (with a message or an error); however, if the origin is destroyed or the | 315 | * (with a message or an error); however, if the origin is destroyed or the |
@@ -331,7 +331,7 @@ typedef void | |||
331 | 331 | ||
332 | /** | 332 | /** |
333 | * Functions with this signature are called whenever the multicast service needs | 333 | * Functions with this signature are called whenever the multicast service needs |
334 | * a message to be replayed. | 334 | * a message fragment to be replayed by message_id and fragment_offset. |
335 | * | 335 | * |
336 | * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE | 336 | * Implementations of this function MUST call GNUNET_MULTICAST_replay() ONCE |
337 | * (with a message or an error); however, if the origin is destroyed or the | 337 | * (with a message or an error); however, if the origin is destroyed or the |
@@ -404,9 +404,9 @@ enum GNUNET_MULTICAST_ReplayErrorCode | |||
404 | * @param ec Error code. | 404 | * @param ec Error code. |
405 | */ | 405 | */ |
406 | void | 406 | void |
407 | GNUNET_MULTICAST_replay (struct GNUNET_MULTICAST_ReplayHandle *rh, | 407 | GNUNET_MULTICAST_replay_response (struct GNUNET_MULTICAST_ReplayHandle *rh, |
408 | const struct GNUNET_MessageHeader *msg, | 408 | const struct GNUNET_MessageHeader *msg, |
409 | enum GNUNET_MULTICAST_ReplayErrorCode ec); | 409 | enum GNUNET_MULTICAST_ReplayErrorCode ec); |
410 | 410 | ||
411 | 411 | ||
412 | /** | 412 | /** |
@@ -417,7 +417,7 @@ GNUNET_MULTICAST_replay (struct GNUNET_MULTICAST_ReplayHandle *rh, | |||
417 | * @param rh Replay session to end. | 417 | * @param rh Replay session to end. |
418 | */ | 418 | */ |
419 | void | 419 | void |
420 | GNUNET_MULTICAST_replay_end (struct GNUNET_MULTICAST_ReplayHandle *rh); | 420 | GNUNET_MULTICAST_replay_response_end (struct GNUNET_MULTICAST_ReplayHandle *rh); |
421 | 421 | ||
422 | 422 | ||
423 | /** | 423 | /** |
@@ -426,9 +426,9 @@ GNUNET_MULTICAST_replay_end (struct GNUNET_MULTICAST_ReplayHandle *rh); | |||
426 | * @see GNUNET_MULTICAST_replay2() | 426 | * @see GNUNET_MULTICAST_replay2() |
427 | */ | 427 | */ |
428 | typedef int | 428 | typedef int |
429 | (*GNUNET_MULTICAST_ReplayTransmitNotify)(void *cls, | 429 | (*GNUNET_MULTICAST_ReplayTransmitNotify) (void *cls, |
430 | size_t *data_size, | 430 | size_t *data_size, |
431 | void *data); | 431 | void *data); |
432 | 432 | ||
433 | 433 | ||
434 | /** | 434 | /** |
@@ -439,9 +439,9 @@ typedef int | |||
439 | * @param notify_cls Closure for @a notify. | 439 | * @param notify_cls Closure for @a notify. |
440 | */ | 440 | */ |
441 | void | 441 | void |
442 | GNUNET_MULTICAST_replay2 (struct GNUNET_MULTICAST_ReplayHandle *rh, | 442 | GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh, |
443 | GNUNET_MULTICAST_ReplayTransmitNotify notify, | 443 | GNUNET_MULTICAST_ReplayTransmitNotify notify, |
444 | void *notify_cls); | 444 | void *notify_cls); |
445 | 445 | ||
446 | 446 | ||
447 | /** | 447 | /** |
@@ -465,7 +465,8 @@ GNUNET_MULTICAST_replay2 (struct GNUNET_MULTICAST_ReplayHandle *rh, | |||
465 | * when restarting the origin. 0 for a new group. | 465 | * when restarting the origin. 0 for a new group. |
466 | * @param join_cb Function called to approve / disapprove joining of a peer. | 466 | * @param join_cb Function called to approve / disapprove joining of a peer. |
467 | * @param test_cb Function multicast can use to test group membership. | 467 | * @param test_cb Function multicast can use to test group membership. |
468 | * @param replay_cb Function that can be called to replay a message. | 468 | * @param replay_frag_cb Function that can be called to replay a message fragment. |
469 | * @param replay_msg_cb Function that can be called to replay a message. | ||
469 | * @param request_cb Function called with message fragments from group members. | 470 | * @param request_cb Function called with message fragments from group members. |
470 | * @param message_cb Function called with the message fragments sent to the | 471 | * @param message_cb Function called with the message fragments sent to the |
471 | * network by GNUNET_MULTICAST_origin_to_all(). These message fragments | 472 | * network by GNUNET_MULTICAST_origin_to_all(). These message fragments |
@@ -486,12 +487,13 @@ GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
486 | void *cls); | 487 | void *cls); |
487 | 488 | ||
488 | /** | 489 | /** |
489 | * Function called to provide data for a transmission from the origin to all members. | 490 | * Function called to provide data for a transmission from the origin to all |
491 | * members. | ||
490 | */ | 492 | */ |
491 | typedef int | 493 | typedef int |
492 | (*GNUNET_MULTICAST_OriginTransmitNotify)(void *cls, | 494 | (*GNUNET_MULTICAST_OriginTransmitNotify) (void *cls, |
493 | size_t *data_size, | 495 | size_t *data_size, |
494 | void *data); | 496 | void *data); |
495 | 497 | ||
496 | 498 | ||
497 | /** | 499 | /** |
@@ -568,15 +570,13 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); | |||
568 | * @a relay (might, for example, contain a user, bind user | 570 | * @a relay (might, for example, contain a user, bind user |
569 | * identity/pseudonym to peer identity, application-level message to | 571 | * identity/pseudonym to peer identity, application-level message to |
570 | * origin, etc.). | 572 | * origin, etc.). |
571 | * @param max_known_fragment_id Largest known message fragment ID to the replay | ||
572 | * service; all messages with IDs larger than this ID will be replayed if | ||
573 | * possible (lower IDs will be considered known and thus only | ||
574 | * be replayed upon explicit request). | ||
575 | * FIXME: needed? can be optional or moved to a separate function. | ||
576 | * @param join_cb Function called to approve / disapprove joining of a peer. | 573 | * @param join_cb Function called to approve / disapprove joining of a peer. |
577 | * @param test_cb Function multicast can use to test group membership. | 574 | * @param test_cb Function multicast can use to test group membership. |
578 | * @param replay_cb Function that can be called to replay messages | 575 | * @param replay_frag_cb Function that can be called to replay message fragments |
579 | * this peer already knows from this group; NULL if this | 576 | * this peer already knows from this group. NULL if this |
577 | * client is unable to support replay. | ||
578 | * @param replay_msg_cb Function that can be called to replay message fragments | ||
579 | * this peer already knows from this group. NULL if this | ||
580 | * client is unable to support replay. | 580 | * client is unable to support replay. |
581 | * @param message_cb Function to be called for all message fragments we | 581 | * @param message_cb Function to be called for all message fragments we |
582 | * receive from the group, excluding those our @a replay_cb | 582 | * receive from the group, excluding those our @a replay_cb |
@@ -597,8 +597,8 @@ GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
597 | GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, | 597 | GNUNET_MULTICAST_ReplayFragmentCallback replay_frag_cb, |
598 | GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, | 598 | GNUNET_MULTICAST_ReplayMessageCallback replay_msg_cb, |
599 | GNUNET_MULTICAST_MessageCallback message_cb, | 599 | GNUNET_MULTICAST_MessageCallback message_cb, |
600 | void *cls); | 600 | void *cls) |
601 | 601 | ; | |
602 | 602 | ||
603 | /** | 603 | /** |
604 | * Handle for a replay request. | 604 | * Handle for a replay request. |
@@ -633,16 +633,10 @@ GNUNET_MULTICAST_member_replay_fragment (struct GNUNET_MULTICAST_Member *member, | |||
633 | * needed and not known to the client. | 633 | * needed and not known to the client. |
634 | * | 634 | * |
635 | * @param member Membership handle. | 635 | * @param member Membership handle. |
636 | * @param fragment_id ID of a message fragment that this client would like to | 636 | * @param message_id ID of the message this client would like to see replayed. |
637 | see replayed. | 637 | * @param fragment_offset Offset of the fragment within the message to replay. |
638 | * @param message_id ID of a message that this client would like to see | ||
639 | * replayed. Typically only one of the @a fragment_id and @a message_id | ||
640 | * is given. Specifying a @a message_id would return the last fragment | ||
641 | * of the message, which allows requesting the preceding fragments of the | ||
642 | * message by looking at the @e fragment_delta header field. | ||
643 | * @param flags Additional flags for the replay request. It is used & defined | 638 | * @param flags Additional flags for the replay request. It is used & defined |
644 | * by the replay callback. E.g. the PSYC service would use this to | 639 | * by the replay callback. |
645 | * implement state synchronization. | ||
646 | * @param result_cb Function to be called for the replayed message. | 640 | * @param result_cb Function to be called for the replayed message. |
647 | * @param result_cb_cls Closure for @a message_cb. | 641 | * @param result_cb_cls Closure for @a message_cb. |
648 | * @return Replay request handle, NULL on error. | 642 | * @return Replay request handle, NULL on error. |
@@ -679,7 +673,7 @@ void | |||
679 | GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member); | 673 | GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member); |
680 | 674 | ||
681 | 675 | ||
682 | /** | 676 | /** |
683 | * Function called to provide data for a transmission from a member to the origin. | 677 | * Function called to provide data for a transmission from a member to the origin. |
684 | * | 678 | * |
685 | * @param cls closure | 679 | * @param cls closure |
@@ -688,9 +682,9 @@ GNUNET_MULTICAST_member_part (struct GNUNET_MULTICAST_Member *member); | |||
688 | * @return number of bytes copied to data | 682 | * @return number of bytes copied to data |
689 | */ | 683 | */ |
690 | typedef int | 684 | typedef int |
691 | (*GNUNET_MULTICAST_MemberTransmitNotify)(void *cls, | 685 | (*GNUNET_MULTICAST_MemberTransmitNotify) (void *cls, |
692 | size_t *data_size, | 686 | size_t *data_size, |
693 | void *data); | 687 | void *data); |
694 | 688 | ||
695 | 689 | ||
696 | /** | 690 | /** |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index f7e65536b..1b231296f 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -1997,7 +1997,7 @@ extern "C" | |||
1997 | /** | 1997 | /** |
1998 | * Multicast message from the origin to all members. | 1998 | * Multicast message from the origin to all members. |
1999 | */ | 1999 | */ |
2000 | #define GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE | 2000 | #define GNUNET_MESSAGE_TYPE_MULTICAST_MESSAGE 700 |
2001 | 2001 | ||
2002 | /** | 2002 | /** |
2003 | * A unicast message from a group member to the origin. | 2003 | * A unicast message from a group member to the origin. |
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h index 8e43b387e..df7a6b4d9 100644 --- a/src/include/gnunet_psyc_service.h +++ b/src/include/gnunet_psyc_service.h | |||
@@ -208,9 +208,9 @@ struct GNUNET_PSYC_JoinHandle; | |||
208 | * @param modifier_count Number of elements in the @a modifiers array. | 208 | * @param modifier_count Number of elements in the @a modifiers array. |
209 | * @param modifiers State modifiers and transient variables for the message. | 209 | * @param modifiers State modifiers and transient variables for the message. |
210 | * @param data_offset Byte offset of @a data in the overall data of the method. | 210 | * @param data_offset Byte offset of @a data in the overall data of the method. |
211 | * @param data_size Number of bytes in @a data. | ||
212 | * @param data Data stream given to the method (might not be zero-terminated | 211 | * @param data Data stream given to the method (might not be zero-terminated |
213 | * if data is binary). | 212 | * if data is binary). |
213 | * @param data_size Number of bytes in @a data. | ||
214 | * @param frag Fragmentation status for the data. | 214 | * @param frag Fragmentation status for the data. |
215 | */ | 215 | */ |
216 | typedef int | 216 | typedef int |
@@ -221,8 +221,8 @@ typedef int | |||
221 | size_t modifier_count, | 221 | size_t modifier_count, |
222 | const struct GNUNET_ENV_Modifier *modifiers, | 222 | const struct GNUNET_ENV_Modifier *modifiers, |
223 | uint64_t data_offset, | 223 | uint64_t data_offset, |
224 | size_t data_size, | ||
225 | const void *data, | 224 | const void *data, |
225 | size_t data_size, | ||
226 | enum GNUNET_PSYC_MessageFlags flags); | 226 | enum GNUNET_PSYC_MessageFlags flags); |
227 | 227 | ||
228 | 228 | ||
@@ -234,9 +234,10 @@ typedef int | |||
234 | * @param method_name Method name in the join request. | 234 | * @param method_name Method name in the join request. |
235 | * @param variable_count Number of elements in the @a variables array. | 235 | * @param variable_count Number of elements in the @a variables array. |
236 | * @param variables Transient variables for the join request. | 236 | * @param variables Transient variables for the join request. |
237 | * @param data_size Number of bytes in @a data. | ||
238 | * @param data Data stream given to the method (might not be zero-terminated | 237 | * @param data Data stream given to the method (might not be zero-terminated |
239 | * if data is binary). | 238 | * if data is binary). |
239 | * @param data_size Number of bytes in @a data. | ||
240 | * @param jh Join handle to use with GNUNET_PSYC_join_decision() | ||
240 | */ | 241 | */ |
241 | typedef int | 242 | typedef int |
242 | (*GNUNET_PSYC_JoinCallback) (void *cls, | 243 | (*GNUNET_PSYC_JoinCallback) (void *cls, |
@@ -244,8 +245,8 @@ typedef int | |||
244 | const char *method_name, | 245 | const char *method_name, |
245 | size_t variable_count, | 246 | size_t variable_count, |
246 | const struct GNUNET_ENV_Modifier *variables, | 247 | const struct GNUNET_ENV_Modifier *variables, |
247 | size_t data_size, | ||
248 | const void *data, | 248 | const void *data, |
249 | size_t data_size, | ||
249 | struct GNUNET_PSYC_JoinHandle *jh); | 250 | struct GNUNET_PSYC_JoinHandle *jh); |
250 | 251 | ||
251 | 252 | ||
@@ -268,8 +269,8 @@ typedef int | |||
268 | * peer identity in this array. | 269 | * peer identity in this array. |
269 | * @param method_name Method name for the message transmitted with the response. | 270 | * @param method_name Method name for the message transmitted with the response. |
270 | * @param env Environment containing transient variables for the message, or NULL. | 271 | * @param env Environment containing transient variables for the message, or NULL. |
271 | * @param data_size Size of @a data. | ||
272 | * @param data Data of the message. | 272 | * @param data Data of the message. |
273 | * @param data_size Size of @a data. | ||
273 | */ | 274 | */ |
274 | void | 275 | void |
275 | GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh, | 276 | GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh, |
@@ -278,8 +279,8 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh, | |||
278 | const struct GNUNET_PeerIdentity *relays, | 279 | const struct GNUNET_PeerIdentity *relays, |
279 | const char *method_name, | 280 | const char *method_name, |
280 | const struct GNUNET_ENV_Environment *env, | 281 | const struct GNUNET_ENV_Environment *env, |
281 | size_t data_size, | 282 | const void *data, |
282 | const void *data); | 283 | size_t data_size); |
283 | 284 | ||
284 | 285 | ||
285 | /** | 286 | /** |
@@ -333,21 +334,20 @@ GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
333 | * @param cls Closure. | 334 | * @param cls Closure. |
334 | * @param message_id Set to the unique message ID that was generated for | 335 | * @param message_id Set to the unique message ID that was generated for |
335 | * this message. | 336 | * this message. |
336 | * @param[in,out] data_size Initially set to the number of bytes available in @a data, | 337 | * @param[in,out] data_size Initially set to the number of bytes available in |
337 | * should be set to the number of bytes written to data (IN/OUT). | 338 | * @a data, should be set to the number of bytes written to data. |
338 | * @param[out] data Where to write the body of the message to give to the method; | 339 | * @param[out] data Where to write the body of the message to give to the |
339 | * function must copy at most @a *data_size bytes to @a data. | 340 | * method. The function must copy at most @a data_size bytes to @a data. |
340 | * @return #GNUNET_SYSERR on error (fatal, aborts transmission) | 341 | * @return #GNUNET_SYSERR on error (fatal, aborts transmission) |
341 | * #GNUNET_NO on success, if more data is to be transmitted later | 342 | * #GNUNET_NO on success, if more data is to be transmitted later |
342 | * (should be used if @a *data_size was not big enough to take all the data) | 343 | * (should be used if @a data_size was not big enough to take all the data) |
343 | * #GNUNET_YES if this completes the transmission (all data supplied) | 344 | * #GNUNET_YES if this completes the transmission (all data supplied) |
344 | */ | 345 | */ |
345 | typedef int | 346 | typedef int |
346 | (*GNUNET_PSYC_MasterTransmitNotify)(void *cls, | 347 | (*GNUNET_PSYC_MasterTransmitNotify) (void *cls, |
347 | uint64_t message_id, | 348 | uint64_t message_id, |
348 | size_t *data_size, | 349 | size_t *data_size, |
349 | void *data); | 350 | void *data); |
350 | |||
351 | 351 | ||
352 | 352 | ||
353 | /** | 353 | /** |
@@ -450,8 +450,8 @@ struct GNUNET_PSYC_Slave; | |||
450 | * @param cls Closure for @a method_cb and @a join_cb. | 450 | * @param cls Closure for @a method_cb and @a join_cb. |
451 | * @param method_name Method name for the join request. | 451 | * @param method_name Method name for the join request. |
452 | * @param env Environment containing transient variables for the request, or NULL. | 452 | * @param env Environment containing transient variables for the request, or NULL. |
453 | * @param data_size Number of bytes in @a data. | ||
454 | * @param data Payload for the join message. | 453 | * @param data Payload for the join message. |
454 | * @param data_size Number of bytes in @a data. | ||
455 | * @return Handle for the slave, NULL on error. | 455 | * @return Handle for the slave, NULL on error. |
456 | */ | 456 | */ |
457 | struct GNUNET_PSYC_Slave * | 457 | struct GNUNET_PSYC_Slave * |
@@ -466,8 +466,8 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
466 | void *cls, | 466 | void *cls, |
467 | const char *method_name, | 467 | const char *method_name, |
468 | const struct GNUNET_ENV_Environment *env, | 468 | const struct GNUNET_ENV_Environment *env, |
469 | size_t data_size, | 469 | const void *data, |
470 | const void *data); | 470 | size_t data_size); |
471 | 471 | ||
472 | 472 | ||
473 | /** | 473 | /** |
@@ -618,7 +618,6 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel, | |||
618 | * @param channel Channel handle. | 618 | * @param channel Channel handle. |
619 | * @param slave_key Identity of channel slave to remove. | 619 | * @param slave_key Identity of channel slave to remove. |
620 | * @param announced_at ID of the message that announced the membership change. | 620 | * @param announced_at ID of the message that announced the membership change. |
621 | * @param effective_since Removal of slave is in effect since this message ID. | ||
622 | */ | 621 | */ |
623 | void | 622 | void |
624 | GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, | 623 | GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, |
@@ -632,14 +631,14 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, | |||
632 | * @param cls Closure. | 631 | * @param cls Closure. |
633 | * @param name Name of the state variable. A NULL value indicates that there | 632 | * @param name Name of the state variable. A NULL value indicates that there |
634 | * are no more state variables to be returned. | 633 | * are no more state variables to be returned. |
635 | * @param value_size Number of bytes in @a value. | ||
636 | * @param value Value of the state variable. | 634 | * @param value Value of the state variable. |
635 | * @param value_size Number of bytes in @a value. | ||
637 | */ | 636 | */ |
638 | typedef void | 637 | typedef void |
639 | (*GNUNET_PSYC_StateCallback) (void *cls, | 638 | (*GNUNET_PSYC_StateCallback) (void *cls, |
640 | const char *name, | 639 | const char *name, |
641 | size_t value_size, | 640 | const void *value, |
642 | const void *value); | 641 | size_t value_size); |
643 | 642 | ||
644 | 643 | ||
645 | /** | 644 | /** |
diff --git a/src/include/gnunet_psycstore_plugin.h b/src/include/gnunet_psycstore_plugin.h index e567de278..69d4bf7fc 100644 --- a/src/include/gnunet_psycstore_plugin.h +++ b/src/include/gnunet_psycstore_plugin.h | |||
@@ -40,7 +40,7 @@ extern "C" | |||
40 | 40 | ||
41 | 41 | ||
42 | /** | 42 | /** |
43 | * @brief struct returned by the initialization function of the plugin | 43 | * Struct returned by the initialization function of the plugin. |
44 | */ | 44 | */ |
45 | struct GNUNET_PSYCSTORE_PluginFunctions | 45 | struct GNUNET_PSYCSTORE_PluginFunctions |
46 | { | 46 | { |
@@ -59,9 +59,9 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
59 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 59 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
60 | */ | 60 | */ |
61 | int | 61 | int |
62 | (*membership_store) (void *cls, | 62 | (*membership_store) (void *cls, |
63 | const struct GNUNET_HashCode *channel_key, | 63 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
64 | const struct GNUNET_HashCode *slave_key, | 64 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
65 | int did_join, | 65 | int did_join, |
66 | uint64_t announced_at, | 66 | uint64_t announced_at, |
67 | uint64_t effective_since, | 67 | uint64_t effective_since, |
@@ -71,7 +71,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
71 | * Test if a member was admitted to the channel at the given message ID. | 71 | * Test if a member was admitted to the channel at the given message ID. |
72 | * | 72 | * |
73 | * @see GNUNET_PSYCSTORE_membership_test() | 73 | * @see GNUNET_PSYCSTORE_membership_test() |
74 | * | 74 | * |
75 | * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not, | 75 | * @return #GNUNET_YES if the member was admitted, #GNUNET_NO if not, |
76 | * #GNUNET_SYSERR if there was en error. | 76 | * #GNUNET_SYSERR if there was en error. |
77 | */ | 77 | */ |
@@ -79,41 +79,42 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
79 | (*membership_test) (void *cls, | 79 | (*membership_test) (void *cls, |
80 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 80 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
81 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, | 81 | const struct GNUNET_CRYPTO_EccPublicKey *slave_key, |
82 | uint64_t message_id, | 82 | uint64_t message_id); |
83 | uint64_t group_generation); | ||
84 | 83 | ||
85 | /** | 84 | /** |
86 | * Store a message fragment sent to a channel. | 85 | * Store a message fragment sent to a channel. |
87 | * | 86 | * |
88 | * @see GNUNET_PSYCSTORE_fragment_store() | 87 | * @see GNUNET_PSYCSTORE_fragment_store() |
89 | * | 88 | * |
90 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 89 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
91 | */ | 90 | */ |
92 | int | 91 | int |
93 | (*fragment_store) (void *cls, | 92 | (*fragment_store) (void *cls, |
94 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 93 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
95 | const struct GNUNET_MULTICAST_MessageHeader *message); | 94 | const struct GNUNET_MULTICAST_MessageHeader *message, |
95 | uint32_t psycstore_flags); | ||
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Set additional flags for a given message. | 98 | * Set additional flags for a given message. |
99 | * | 99 | * |
100 | * They are OR'd with any existing flags set. | ||
101 | * | ||
100 | * @param message_id ID of the message. | 102 | * @param message_id ID of the message. |
101 | * @param flags Flags to add. | 103 | * @param psycstore_flags OR'd GNUNET_PSYCSTORE_MessageFlags. |
102 | * | 104 | * |
103 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 105 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
104 | */ | 106 | */ |
105 | int | 107 | int |
106 | (*fragment_add_flags) (void *cls, | 108 | (*message_add_flags) (void *cls, |
107 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 109 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
108 | uint64_t message_id, | 110 | uint64_t message_id, |
109 | uint64_t multicast_flags, | 111 | uint64_t psycstore_flags); |
110 | uint64_t psyc_flags); | ||
111 | 112 | ||
112 | /** | 113 | /** |
113 | * Retrieve a message fragment by fragment ID. | 114 | * Retrieve a message fragment by fragment ID. |
114 | * | 115 | * |
115 | * @see GNUNET_PSYCSTORE_fragment_get() | 116 | * @see GNUNET_PSYCSTORE_fragment_get() |
116 | * | 117 | * |
117 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 118 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
118 | */ | 119 | */ |
119 | int | 120 | int |
@@ -127,7 +128,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
127 | * Retrieve all fragments of a message. | 128 | * Retrieve all fragments of a message. |
128 | * | 129 | * |
129 | * @see GNUNET_PSYCSTORE_message_get() | 130 | * @see GNUNET_PSYCSTORE_message_get() |
130 | * | 131 | * |
131 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 132 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
132 | */ | 133 | */ |
133 | int | 134 | int |
@@ -142,7 +143,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
142 | * offset. | 143 | * offset. |
143 | * | 144 | * |
144 | * @see GNUNET_PSYCSTORE_message_get_fragment() | 145 | * @see GNUNET_PSYCSTORE_message_get_fragment() |
145 | * | 146 | * |
146 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 147 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
147 | */ | 148 | */ |
148 | int | 149 | int |
@@ -157,7 +158,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
157 | * Retrieve latest values of counters for a channel master. | 158 | * Retrieve latest values of counters for a channel master. |
158 | * | 159 | * |
159 | * @see GNUNET_PSYCSTORE_counters_get_master() | 160 | * @see GNUNET_PSYCSTORE_counters_get_master() |
160 | * | 161 | * |
161 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 162 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
162 | */ | 163 | */ |
163 | int | 164 | int |
@@ -168,10 +169,10 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
168 | uint64_t *group_generation); | 169 | uint64_t *group_generation); |
169 | 170 | ||
170 | /** | 171 | /** |
171 | * Retrieve latest values of counters for a channel slave. | 172 | * Retrieve latest values of counters for a channel slave. |
172 | * | 173 | * |
173 | * @see GNUNET_PSYCSTORE_counters_get_slave() | 174 | * @see GNUNET_PSYCSTORE_counters_get_slave() |
174 | * | 175 | * |
175 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 176 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
176 | */ | 177 | */ |
177 | int | 178 | int |
@@ -183,27 +184,66 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
183 | * Set a state variable to the given value. | 184 | * Set a state variable to the given value. |
184 | * | 185 | * |
185 | * @see GNUNET_PSYCSTORE_state_modify() | 186 | * @see GNUNET_PSYCSTORE_state_modify() |
186 | * | 187 | * |
187 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 188 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
188 | */ | 189 | */ |
189 | int | 190 | int |
190 | (*state_set) (struct GNUNET_PSYCSTORE_Handle *h, | 191 | (*state_set) (void *cls, |
191 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 192 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
192 | const char *name, | 193 | const char *name, |
193 | size_t value_size, | 194 | const void *value, |
194 | const void *value); | 195 | size_t value_size); |
196 | |||
197 | |||
198 | /** | ||
199 | * Reset the state of a channel. | ||
200 | * | ||
201 | * Delete all state variables stored for the given channel. | ||
202 | * | ||
203 | * @see GNUNET_PSYCSTORE_state_reset() | ||
204 | * | ||
205 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
206 | */ | ||
207 | int | ||
208 | (*state_reset) (void *cls, | ||
209 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key); | ||
210 | |||
211 | /** | ||
212 | * Update signed state values from the current ones. | ||
213 | * | ||
214 | * Sets value_signed = value_current for each variable for the given channel. | ||
215 | */ | ||
216 | int | ||
217 | (*state_update_signed) (void *cls, | ||
218 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key); | ||
219 | |||
220 | /** | ||
221 | * Update signed values of state variables in the state store. | ||
222 | * | ||
223 | * @param h Handle for the PSYCstore. | ||
224 | * @param channel_key The channel we are interested in. | ||
225 | * @param message_id Message ID that contained the state @a hash. | ||
226 | * @param hash Hash of the serialized full state. | ||
227 | * @param rcb Callback to call with the result of the operation. | ||
228 | * @param rcb_cls Closure for the callback. | ||
229 | * | ||
230 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
231 | */ | ||
232 | int | ||
233 | (*state_hash_update) (void *cls, | ||
234 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
235 | uint64_t message_id, | ||
236 | const struct GNUNET_HashCode *hash, | ||
237 | GNUNET_PSYCSTORE_ResultCallback rcb, | ||
238 | void *rcb_cls); | ||
195 | 239 | ||
196 | /** | 240 | /** |
197 | * Retrieve a state variable by name. | 241 | * Retrieve a state variable by name (exact match). |
198 | * | 242 | * |
199 | * @param name Name of the variable to retrieve. | ||
200 | * @param[out] value_size Size of value. | ||
201 | * @param[out] value Returned value. | ||
202 | * | ||
203 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 243 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
204 | */ | 244 | */ |
205 | int | 245 | int |
206 | (*state_get) (struct GNUNET_PSYCSTORE_Handle *h, | 246 | (*state_get) (void *cls, |
207 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 247 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
208 | const char *name, | 248 | const char *name, |
209 | GNUNET_PSYCSTORE_StateCallback cb, | 249 | GNUNET_PSYCSTORE_StateCallback cb, |
@@ -213,16 +253,28 @@ struct GNUNET_PSYCSTORE_PluginFunctions | |||
213 | * Retrieve all state variables for a channel with the given prefix. | 253 | * Retrieve all state variables for a channel with the given prefix. |
214 | * | 254 | * |
215 | * @see GNUNET_PSYCSTORE_state_get_all() | 255 | * @see GNUNET_PSYCSTORE_state_get_all() |
216 | * | 256 | * |
217 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 257 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
218 | */ | 258 | */ |
219 | int | 259 | int |
220 | (*state_get_all) (struct GNUNET_PSYCSTORE_Handle *h, | 260 | (*state_get_all) (void *cls, |
221 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 261 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
222 | const char *name, | 262 | const char *name, |
223 | GNUNET_PSYCSTORE_StateCallback cb, | 263 | GNUNET_PSYCSTORE_StateCallback cb, |
224 | void *cb_cls); | 264 | void *cb_cls); |
225 | 265 | ||
266 | |||
267 | /** | ||
268 | * Retrieve all signed state variables for a channel. | ||
269 | * | ||
270 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | ||
271 | */ | ||
272 | int | ||
273 | (*state_get_signed) (void *cls, | ||
274 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | ||
275 | GNUNET_PSYCSTORE_StateCallback cb, | ||
276 | void *cb_cls); | ||
277 | |||
226 | }; | 278 | }; |
227 | 279 | ||
228 | 280 | ||
diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h index bbf5a7d19..fab2594df 100644 --- a/src/include/gnunet_psycstore_service.h +++ b/src/include/gnunet_psycstore_service.h | |||
@@ -45,6 +45,28 @@ extern "C" | |||
45 | */ | 45 | */ |
46 | #define GNUNET_PSYCSTORE_VERSION 0x00000000 | 46 | #define GNUNET_PSYCSTORE_VERSION 0x00000000 |
47 | 47 | ||
48 | /** | ||
49 | * Flags for stored messages. | ||
50 | */ | ||
51 | enum GNUNET_PSYCSTORE_MessageFlags | ||
52 | { | ||
53 | /** | ||
54 | * The message contains state modifiers. | ||
55 | */ | ||
56 | GNUNET_PSYCSTORE_MESSAGE_STATE = 1 << 0, | ||
57 | |||
58 | /** | ||
59 | * The state modifiers have been applied to the state store. | ||
60 | */ | ||
61 | GNUNET_PSYCSTORE_MESSAGE_STATE_APPLIED = 1 << 1, | ||
62 | |||
63 | /** | ||
64 | * The message contains a state hash. | ||
65 | */ | ||
66 | GNUNET_PSYCSTORE_MESSAGE_STATE_HASH = 1 << 2 | ||
67 | }; | ||
68 | |||
69 | |||
48 | /** | 70 | /** |
49 | * Handle for a PSYCstore | 71 | * Handle for a PSYCstore |
50 | */ | 72 | */ |
@@ -157,6 +179,8 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, | |||
157 | * @param h Handle for the PSYCstore. | 179 | * @param h Handle for the PSYCstore. |
158 | * @param channel_key The channel the message belongs to. | 180 | * @param channel_key The channel the message belongs to. |
159 | * @param message Message to store. | 181 | * @param message Message to store. |
182 | * @param psycstore_flags Flags indicating whether the PSYC message contains | ||
183 | * state modifiers. | ||
160 | * @param rcb Callback to call with the result of the operation. | 184 | * @param rcb Callback to call with the result of the operation. |
161 | * @param rcb_cls Closure for the callback. | 185 | * @param rcb_cls Closure for the callback. |
162 | * | 186 | * |
@@ -166,6 +190,7 @@ struct GNUNET_PSYCSTORE_OperationHandle * | |||
166 | GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, | 190 | GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, |
167 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, | 191 | const struct GNUNET_CRYPTO_EccPublicKey *channel_key, |
168 | const struct GNUNET_MULTICAST_MessageHeader *message, | 192 | const struct GNUNET_MULTICAST_MessageHeader *message, |
193 | uint32_t psycstore_flags, | ||
169 | GNUNET_PSYCSTORE_ResultCallback rcb, | 194 | GNUNET_PSYCSTORE_ResultCallback rcb, |
170 | void *rcb_cls); | 195 | void *rcb_cls); |
171 | 196 | ||
@@ -177,12 +202,15 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, | |||
177 | * @param cls Closure. | 202 | * @param cls Closure. |
178 | * @param message The retrieved message fragment. A NULL value indicates that | 203 | * @param message The retrieved message fragment. A NULL value indicates that |
179 | * there are no more results to be returned. | 204 | * there are no more results to be returned. |
180 | * @param flags Message flags indicating fragmentation status. | 205 | * @param flags Flags stored with the message. |
206 | * | ||
207 | * @return #GNUNET_NO to stop calling this callback with further fragments, | ||
208 | * #GNUNET_YES to continue. | ||
181 | */ | 209 | */ |
182 | typedef void | 210 | typedef int |
183 | (*GNUNET_PSYCSTORE_FragmentCallback) (void *cls, | 211 | (*GNUNET_PSYCSTORE_FragmentCallback) (void *cls, |
184 | const struct GNUNET_MULTICAST_MessageHeader *message, | 212 | struct GNUNET_MULTICAST_MessageHeader *message, |
185 | enum GNUNET_PSYC_MessageFlags flags); | 213 | enum GNUNET_PSYCSTORE_MessageFlags flags); |
186 | 214 | ||
187 | 215 | ||
188 | /** | 216 | /** |
@@ -224,7 +252,8 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, | |||
224 | 252 | ||
225 | 253 | ||
226 | /** | 254 | /** |
227 | * Retrieve a fragment of message specified by its message ID and fragment offset. | 255 | * Retrieve a fragment of message specified by its message ID and fragment |
256 | * offset. | ||
228 | * | 257 | * |
229 | * @param h Handle for the PSYCstore. | 258 | * @param h Handle for the PSYCstore. |
230 | * @param channel_key The channel we are interested in. | 259 | * @param channel_key The channel we are interested in. |
@@ -267,7 +296,8 @@ typedef void | |||
267 | * @see GNUNET_PSYCSTORE_counters_get_slave() | 296 | * @see GNUNET_PSYCSTORE_counters_get_slave() |
268 | * | 297 | * |
269 | * @param cls Closure. | 298 | * @param cls Closure. |
270 | * @param max_state_msg_id Latest message ID containing state modifiers that was applied to the state store. Used for the state sync process. | 299 | * @param max_state_msg_id Latest message ID containing state modifiers that was |
300 | * applied to the state store. Used for the state sync process. | ||
271 | */ | 301 | */ |
272 | typedef void | 302 | typedef void |
273 | (*GNUNET_PSYCSTORE_SlaveCountersCallback) (void *cls, | 303 | (*GNUNET_PSYCSTORE_SlaveCountersCallback) (void *cls, |
@@ -343,6 +373,26 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, | |||
343 | 373 | ||
344 | 374 | ||
345 | /** | 375 | /** |
376 | * Reset the state of a channel. | ||
377 | * | ||
378 | * Delete all state variables stored for the given channel. | ||
379 | * | ||
380 | * @param h Handle for the PSYCstore. | ||
381 | * @param channel_key The channel we are interested in. | ||
382 | * @param rcb Callback to call with the result of the operation. | ||
383 | * @param rcb_cls Closure for the callback. | ||
384 | * | ||
385 | * @return Handle that can be used to cancel the operation. | ||
386 | */ | ||
387 | struct GNUNET_PSYCSTORE_Handle * | ||
388 | GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, | ||
389 | const struct GNUNET_CRYPTO_EccPublicKey | ||
390 | *channel_key, | ||
391 | GNUNET_PSYCSTORE_ResultCallback rcb, | ||
392 | void *rcb_cls); | ||
393 | |||
394 | |||
395 | /** | ||
346 | * Update signed values of state variables in the state store. | 396 | * Update signed values of state variables in the state store. |
347 | * | 397 | * |
348 | * @param h Handle for the PSYCstore. | 398 | * @param h Handle for the PSYCstore. |
@@ -368,15 +418,17 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, | |||
368 | * @param cls Closure. | 418 | * @param cls Closure. |
369 | * @param name Name of the state variable. A NULL value indicates that there are no more | 419 | * @param name Name of the state variable. A NULL value indicates that there are no more |
370 | * state variables to be returned. | 420 | * state variables to be returned. |
371 | * @param value_size Number of bytes in @a value. | ||
372 | * @param value Value of the state variable. | 421 | * @param value Value of the state variable. |
373 | t * | 422 | * @param value_size Number of bytes in @a value. |
423 | * | ||
424 | * @return #GNUNET_NO to stop calling this callback with further variables, | ||
425 | * #GNUNET_YES to continue. | ||
374 | */ | 426 | */ |
375 | typedef void | 427 | typedef int |
376 | (*GNUNET_PSYCSTORE_StateCallback) (void *cls, | 428 | (*GNUNET_PSYCSTORE_StateCallback) (void *cls, |
377 | const char *name, | 429 | const char *name, |
378 | size_t value_size, | 430 | const void *value, |
379 | const void *value); | 431 | size_t value_size); |
380 | 432 | ||
381 | 433 | ||
382 | /** | 434 | /** |
@@ -420,10 +472,10 @@ GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h, | |||
420 | /** | 472 | /** |
421 | * Cancel an operation. | 473 | * Cancel an operation. |
422 | * | 474 | * |
423 | * @param oh Handle for the operation to cancel. | 475 | * @param op Handle for the operation to cancel. |
424 | */ | 476 | */ |
425 | void | 477 | void |
426 | GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *oh); | 478 | GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op); |
427 | 479 | ||
428 | 480 | ||
429 | 481 | ||
diff --git a/src/include/gnunet_social_service.h b/src/include/gnunet_social_service.h index abb749b9b..62a221de2 100644 --- a/src/include/gnunet_social_service.h +++ b/src/include/gnunet_social_service.h | |||
@@ -83,21 +83,22 @@ struct GNUNET_SOCIAL_Slicer; | |||
83 | * @param modifier_count Number of elements in the @a modifiers array. | 83 | * @param modifier_count Number of elements in the @a modifiers array. |
84 | * @param modifiers Modifiers present in the message. FIXME: use environment instead? | 84 | * @param modifiers Modifiers present in the message. FIXME: use environment instead? |
85 | * @param data_offset Byte offset of @a data in the overall data of the method. | 85 | * @param data_offset Byte offset of @a data in the overall data of the method. |
86 | * @param data_size Number of bytes in @a data. | ||
87 | * @param data Data stream given to the method (might not be zero-terminated | 86 | * @param data Data stream given to the method (might not be zero-terminated |
88 | * if data is binary). | 87 | * if data is binary). |
88 | * @param data_size Number of bytes in @a data. | ||
89 | * @param flags Message flags indicating fragmentation status. | 89 | * @param flags Message flags indicating fragmentation status. |
90 | */ | 90 | */ |
91 | typedef int (*GNUNET_SOCIAL_Method)(void *cls, | 91 | typedef int |
92 | struct GNUNET_SOCIAL_Nym *nym, | 92 | (*GNUNET_SOCIAL_Method) (void *cls, |
93 | const char *full_method_name, | 93 | struct GNUNET_SOCIAL_Nym *nym, |
94 | uint64_t message_id, | 94 | const char *full_method_name, |
95 | size_t modifier_count, | 95 | uint64_t message_id, |
96 | GNUNET_PSYC_Modifier *modifiers, | 96 | size_t modifier_count, |
97 | uint64_t data_offset, | 97 | GNUNET_PSYC_Modifier *modifiers, |
98 | size_t data_size, | 98 | uint64_t data_offset, |
99 | const void *data, | 99 | const void *data, |
100 | enum GNUNET_PSYC_MessageFlags flags); | 100 | size_t data_size, |
101 | enum GNUNET_PSYC_MessageFlags flags); | ||
101 | 102 | ||
102 | 103 | ||
103 | /** | 104 | /** |
@@ -164,16 +165,17 @@ GNUNET_SOCIAL_slicer_destroy (struct GNUNET_SOCIAL_Slicer *slicer); | |||
164 | * @param method_name Method name in the entry request. | 165 | * @param method_name Method name in the entry request. |
165 | * @param variable_count Number of elements in the @a variables array. | 166 | * @param variable_count Number of elements in the @a variables array. |
166 | * @param variables Variables present in the message. | 167 | * @param variables Variables present in the message. |
167 | * @param data_size Number of bytes in @a data. | ||
168 | * @param data Payload given on enter (e.g. a password). | 168 | * @param data Payload given on enter (e.g. a password). |
169 | * @param data_size Number of bytes in @a data. | ||
169 | */ | 170 | */ |
170 | typedef void (*GNUNET_SOCIAL_AnswerDoorCallback)(void *cls, | 171 | typedef void |
171 | struct GNUNET_SOCIAL_Nym *nym, | 172 | (*GNUNET_SOCIAL_AnswerDoorCallback) (void *cls, |
172 | size_t variable_count, | 173 | struct GNUNET_SOCIAL_Nym *nym, |
173 | const char *method_name, | 174 | size_t variable_count, |
174 | GNUNET_PSYC_Modifier *variables, | 175 | const char *method_name, |
175 | size_t data_size, | 176 | GNUNET_PSYC_Modifier *variables, |
176 | const void *data); | 177 | const void *data, |
178 | size_t data_size); | ||
177 | 179 | ||
178 | 180 | ||
179 | /** | 181 | /** |
@@ -187,10 +189,11 @@ typedef void (*GNUNET_SOCIAL_AnswerDoorCallback)(void *cls, | |||
187 | * @param variable_count Number of elements in the @a variables array. | 189 | * @param variable_count Number of elements in the @a variables array. |
188 | * @param variables Variables present in the message. | 190 | * @param variables Variables present in the message. |
189 | */ | 191 | */ |
190 | typedef void (*GNUNET_SOCIAL_FarewellCallback)(void *cls, | 192 | typedef void |
191 | struct GNUNET_SOCIAL_Nym *nym, | 193 | (*GNUNET_SOCIAL_FarewellCallback) (void *cls, |
192 | size_t variable_count, | 194 | struct GNUNET_SOCIAL_Nym *nym, |
193 | GNUNET_PSYC_Modifier *variables); | 195 | size_t variable_count, |
196 | GNUNET_PSYC_Modifier *variables); | ||
194 | 197 | ||
195 | 198 | ||
196 | /** | 199 | /** |
@@ -258,16 +261,16 @@ GNUNET_SOCIAL_home_eject (struct GNUNET_SOCIAL_Home *home, | |||
258 | * @param nym Handle for the entity that wanted to enter. | 261 | * @param nym Handle for the entity that wanted to enter. |
259 | * @param method_name Method name for the rejection message. | 262 | * @param method_name Method name for the rejection message. |
260 | * @param env Environment containing variables for the message, or NULL. | 263 | * @param env Environment containing variables for the message, or NULL. |
261 | * @param data_size Number of bytes in @a data for method. | ||
262 | * @param data Data for the rejection message to send back. | 264 | * @param data Data for the rejection message to send back. |
265 | * @param data_size Number of bytes in @a data for method. | ||
263 | */ | 266 | */ |
264 | void | 267 | void |
265 | GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home, | 268 | GNUNET_SOCIAL_home_reject_entry (struct GNUNET_SOCIAL_Home *home, |
266 | struct GNUNET_SOCIAL_Nym *nym, | 269 | struct GNUNET_SOCIAL_Nym *nym, |
267 | const char *method_name, | 270 | const char *method_name, |
268 | const struct GNUNET_ENV_Environment *env, | 271 | const struct GNUNET_ENV_Environment *env, |
269 | size_t data_size, | 272 | const void *data, |
270 | const void *data); | 273 | size_t data_size); |
271 | 274 | ||
272 | 275 | ||
273 | /** | 276 | /** |
@@ -403,8 +406,8 @@ GNUNET_SOCIAL_home_leave (struct GNUNET_SOCIAL_Home *home); | |||
403 | * pseudonym's place directly. | 406 | * pseudonym's place directly. |
404 | * @param method_name Method name for the message. | 407 | * @param method_name Method name for the message. |
405 | * @param env Environment containing variables for the message, or NULL. | 408 | * @param env Environment containing variables for the message, or NULL. |
406 | * @param data_size Number of bytes in @a data. | ||
407 | * @param data Payload for the message to give to the enter callback. | 409 | * @param data Payload for the message to give to the enter callback. |
410 | * @param data_size Number of bytes in @a data. | ||
408 | * @param slicer Slicer to use for processing incoming requests from guests. | 411 | * @param slicer Slicer to use for processing incoming requests from guests. |
409 | * @return NULL on errors, otherwise handle to the place. | 412 | * @return NULL on errors, otherwise handle to the place. |
410 | */ | 413 | */ |
@@ -414,8 +417,8 @@ GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
414 | char *address, | 417 | char *address, |
415 | const char *method_name, | 418 | const char *method_name, |
416 | const struct GNUNET_ENV_Environment *env, | 419 | const struct GNUNET_ENV_Environment *env, |
417 | size_t data_size, | ||
418 | const void *data, | 420 | const void *data, |
421 | size_t data_size, | ||
419 | struct GNUNET_SOCIAL_Slicer *slicer); | 422 | struct GNUNET_SOCIAL_Slicer *slicer); |
420 | 423 | ||
421 | /** | 424 | /** |
@@ -429,8 +432,8 @@ GNUNET_SOCIAL_place_enter (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
429 | * @param relays Relays for the underlying multicast group. | 432 | * @param relays Relays for the underlying multicast group. |
430 | * @param method_name Method name for the message. | 433 | * @param method_name Method name for the message. |
431 | * @param env Environment containing variables for the message, or NULL. | 434 | * @param env Environment containing variables for the message, or NULL. |
432 | * @param data_size Number of bytes in @a data. | ||
433 | * @param data Payload for the message to give to the enter callback. | 435 | * @param data Payload for the message to give to the enter callback. |
436 | * @param data_size Number of bytes in @a data. | ||
434 | * @param slicer Slicer to use for processing incoming requests from guests. | 437 | * @param slicer Slicer to use for processing incoming requests from guests. |
435 | * @return NULL on errors, otherwise handle to the place. | 438 | * @return NULL on errors, otherwise handle to the place. |
436 | */ | 439 | */ |
@@ -443,8 +446,8 @@ GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
443 | struct GNUNET_PeerIdentity *relays, | 446 | struct GNUNET_PeerIdentity *relays, |
444 | const char *method_name, | 447 | const char *method_name, |
445 | const struct GNUNET_ENV_Environment *env, | 448 | const struct GNUNET_ENV_Environment *env, |
446 | size_t data_size, | ||
447 | const void *data, | 449 | const void *data, |
450 | size_t data_size, | ||
448 | struct GNUNET_SOCIAL_Slicer *slicer); | 451 | struct GNUNET_SOCIAL_Slicer *slicer); |
449 | 452 | ||
450 | 453 | ||