aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_psyc_service.h
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-08-15 10:09:33 +0000
committerGabor X Toth <*@tg-x.net>2013-08-15 10:09:33 +0000
commit9b731d2b45c2ddc2ea24de7a0c87a672a6856f3a (patch)
tree70d1ad32b0500fb38af21e6916665c509090f269 /src/include/gnunet_psyc_service.h
parent5e7b0418545ff38967a2d2edc0ebab8e8030f336 (diff)
downloadgnunet-9b731d2b45c2ddc2ea24de7a0c87a672a6856f3a.tar.gz
gnunet-9b731d2b45c2ddc2ea24de7a0c87a672a6856f3a.zip
psycstore: added state_hash_update() and counters_get(); psyc: async state_get*(); multicast: membership test & replay params
Diffstat (limited to 'src/include/gnunet_psyc_service.h')
-rw-r--r--src/include/gnunet_psyc_service.h101
1 files changed, 59 insertions, 42 deletions
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index 5f48f7f34..273aa26f4 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -304,6 +304,11 @@ enum GNUNET_PSYC_MasterTransmitFlags
304 * transmitting this message. 304 * transmitting this message.
305 */ 305 */
306 GNUNET_PSYC_MASTER_TRANSMIT_INC_GROUP_GEN = 1 << 1, 306 GNUNET_PSYC_MASTER_TRANSMIT_INC_GROUP_GEN = 1 << 1,
307
308 /**
309 * Add PSYC header variable with the hash of the current channel state.
310 */
311 GNUNET_PSYC_MASTER_TRANSMIT_ADD_STATE_HASH = 1 << 2
307}; 312};
308 313
309 314
@@ -564,9 +569,10 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel,
564 * Function called to inform a member about stored state values for a channel. 569 * Function called to inform a member about stored state values for a channel.
565 * 570 *
566 * @param cls Closure. 571 * @param cls Closure.
567 * @param name Name of the state variable. 572 * @param name Name of the state variable. A NULL value indicates that there
568 * @param value Value of the state variable. 573 * are no more state variables to be returned.
569 * @param value_size Number of bytes in @a value. 574 * @param value_size Number of bytes in @a value.
575 * @param value Value of the state variable.
570 */ 576 */
571typedef void 577typedef void
572(*GNUNET_PSYC_StateCallback) (void *cls, 578(*GNUNET_PSYC_StateCallback) (void *cls,
@@ -575,6 +581,15 @@ typedef void
575 const void *value); 581 const void *value);
576 582
577 583
584/**
585 * Function called when a requested operation has finished.
586 *
587 * @param cls Closure.
588 */
589typedef void
590(*GNUNET_PSYC_FinishCallback) (void *cls);
591
592
578/** 593/**
579 * Handle to a story telling operation. 594 * Handle to a story telling operation.
580 */ 595 */
@@ -593,14 +608,13 @@ struct GNUNET_PSYC_Story;
593 * @param start_message_id Earliest interesting point in history. 608 * @param start_message_id Earliest interesting point in history.
594 * @param end_message_id Last (exclusive) interesting point in history. 609 * @param end_message_id Last (exclusive) interesting point in history.
595 * @param method Function to invoke on messages received from the story. 610 * @param method Function to invoke on messages received from the story.
596 * @param method_cls Closure for @a method.
597 * @param finish_cb Function to call when the requested story has been fully 611 * @param finish_cb Function to call when the requested story has been fully
598 * told (counting message IDs might not suffice, as some messages 612 * told (counting message IDs might not suffice, as some messages
599 * might be secret and thus the listener would not know the story is 613 * might be secret and thus the listener would not know the story is
600 * finished without being told explicitly); once this function 614 * finished without being told explicitly); once this function
601 * has been called, the client must not call 615 * has been called, the client must not call
602 * GNUNET_PSYC_channel_story_tell_cancel() anymore. 616 * GNUNET_PSYC_channel_story_tell_cancel() anymore.
603 * @param finish_cb_cls Closure to finish_cb. 617 * @param cls Closure for the callbacks.
604 * @return Handle to cancel story telling operation. 618 * @return Handle to cancel story telling operation.
605 */ 619 */
606struct GNUNET_PSYC_Story * 620struct GNUNET_PSYC_Story *
@@ -608,9 +622,8 @@ GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *channel,
608 uint64_t start_message_id, 622 uint64_t start_message_id,
609 uint64_t end_message_id, 623 uint64_t end_message_id,
610 GNUNET_PSYC_Method method, 624 GNUNET_PSYC_Method method,
611 void *method_cls, 625 GNUNET_PSYC_FinishCallback *finish_cb,
612 void (*finish_cb)(void *), 626 void *cls);
613 void *finish_cb_cls);
614 627
615 628
616/** 629/**
@@ -624,57 +637,61 @@ GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *channel,
624void 637void
625GNUNET_PSYC_channel_story_tell_cancel (struct GNUNET_PSYC_Story *story); 638GNUNET_PSYC_channel_story_tell_cancel (struct GNUNET_PSYC_Story *story);
626 639
640struct GNUNET_PSYC_StateQuery;
641
627 642
628/** 643/**
629 * Call the given callback on all matching values (including variables) in the 644 * Return all channel state variables whose name matches a given prefix.
630 * channel state.
631 *
632 * The callback is invoked synchronously on all matching states (as the state is
633 * fully replicated in the library in this process; channel states should be
634 * small, large data is to be passed as streaming data to methods).
635 * 645 *
636 * A name matches if it includes the @a state_name prefix, thus requesting the 646 * A name matches if it starts with the given @a name_prefix, thus requesting the
637 * empty state ("") will match all values; requesting "_a_b" will also return 647 * empty prefix ("") will match all values; requesting "_a_b" will also return
638 * values stored under "_a_b_c". 648 * values stored under "_a_b_c".
639 * 649 *
650 * The @a state_cb is invoked on all matching state variables asynchronously, as
651 * the state is stored in and retrieved from the PSYCstore,
652 *
640 * @param channel Channel handle. 653 * @param channel Channel handle.
641 * @param state_name Name of the state to query (full name 654 * @param name_prefix Prefix of the state variable name to match.
642 * might be longer, this is only the prefix that must match). 655 * @param cb Function to call with the matching state variables.
643 * @param cb Function to call on the matching state values. 656 * @param cb_cls Closure for the callbacks.
644 * @param cb_cls Closure for @a cb. 657 * @return Handle that can be used to cancel the query operation.
645 * @return Message ID for which the state was returned (last seen 658 */
646 * message ID). 659struct GNUNET_PSYC_StateQuery *
647 */
648uint64_t
649GNUNET_PSYC_channel_state_get_all (struct GNUNET_PSYC_Channel *channel, 660GNUNET_PSYC_channel_state_get_all (struct GNUNET_PSYC_Channel *channel,
650 const char *state_name, 661 const char *name_prefix,
651 GNUNET_PSYC_StateCallback cb, 662 GNUNET_PSYC_StateCallback cb,
652 void *cb_cls); 663 void *cb_cls);
653 664
654 665
655/** 666/**
656 * Obtain the current value of the best-matching value in the state 667 * Retrieve the best matching channel state variable.
657 * (including variables).
658 *
659 * Note that variables are only valid during a #GNUNET_PSYC_Method invocation, as
660 * variables are only valid for the duration of a method invocation.
661 * 668 *
662 * If the requested variable name does not have an exact state in 669 * If the requested variable name is not present in the state, the nearest
663 * the state, the nearest less-specific name is matched; for example, 670 * less-specific name is matched; for example, requesting "_a_b" will match "_a"
664 * requesting "_a_b" will match "_a" if "_a_b" does not exist. 671 * if "_a_b" does not exist.
665 * 672 *
666 * @param channel Channel handle. 673 * @param channel Channel handle.
667 * @param variable_name Name of the variable to query. 674 * @param full_name Full name of the requested variable, the actual variable
668 * @param[out] return_value_size Set to number of bytes in variable, 675 * returned might have a shorter name..
669 * needed as variables might contain binary data and 676 * @param cb Function called once when a matching state variable is found.
670 * might also not be 0-terminated; set to 0 on errors. 677 * Not called if there's no matching state variable.
671 * @return NULL on error (no matching state or variable), pointer 678 * @param cb_cls Closure for the callbacks.
672 * to the respective value otherwise. 679 * @return Handle that can be used to cancel the query operation.
673 */ 680 */
674const void * 681struct GNUNET_PSYC_StateQuery *
675GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel, 682GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel,
676 const char *variable_name, 683 const char *full_name,
677 size_t *return_value_size); 684 GNUNET_PSYC_StateCallback cb,
685 void *cb_cls);
686
687
688/**
689 * Cancel a state query operation.
690 *
691 * @param query Handle for the operation to cancel.
692 */
693void
694GNUNET_PSYC_channel_state_get_cancel (struct GNUNET_PSYC_StateQuery *query);
678 695
679 696
680#if 0 /* keep Emacsens' auto-indent happy */ 697#if 0 /* keep Emacsens' auto-indent happy */