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/gnunet_multicast_service.h | |
parent | 37bafa60a6f0e447cb5b61547404f0902fa7ad41 (diff) | |
download | gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.tar.gz gnunet-eb9556bf2983ca19a5cbcf7cf460a0b2509b290a.zip |
PSYCstore SQLite backend; API fixes/enhancements
Diffstat (limited to 'src/include/gnunet_multicast_service.h')
-rw-r--r-- | src/include/gnunet_multicast_service.h | 86 |
1 files changed, 40 insertions, 46 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 | /** |