aboutsummaryrefslogtreecommitdiff
path: root/src/psyc
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-18 14:59:27 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-18 14:59:27 +0000
commitc654ca8072bc5768bd01c6b0d6db303b0d4e5025 (patch)
tree1d2929c0e15efe6835fa2e98cb8070a4646ae346 /src/psyc
parent02eef607379528f1a28c8593dd98e233fcbefd69 (diff)
downloadgnunet-c654ca8072bc5768bd01c6b0d6db303b0d4e5025.tar.gz
gnunet-c654ca8072bc5768bd01c6b0d6db303b0d4e5025.zip
-doxygen fixes
Diffstat (limited to 'src/psyc')
-rw-r--r--src/psyc/psyc_api.c120
1 files changed, 61 insertions, 59 deletions
diff --git a/src/psyc/psyc_api.c b/src/psyc/psyc_api.c
index 6f1c9707b..51902dd1a 100644
--- a/src/psyc/psyc_api.c
+++ b/src/psyc/psyc_api.c
@@ -207,7 +207,7 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc);
207/** 207/**
208 * Reschedule a connect attempt to the service. 208 * Reschedule a connect attempt to the service.
209 * 209 *
210 * @param h transport service to reconnect 210 * @param c channel to reconnect
211 */ 211 */
212static void 212static void
213reschedule_connect (struct GNUNET_PSYC_Channel *c) 213reschedule_connect (struct GNUNET_PSYC_Channel *c)
@@ -237,13 +237,13 @@ reschedule_connect (struct GNUNET_PSYC_Channel *c)
237/** 237/**
238 * Schedule transmission of the next message from our queue. 238 * Schedule transmission of the next message from our queue.
239 * 239 *
240 * @param h PSYC handle 240 * @param ch PSYC channel handle
241 */ 241 */
242static void 242static void
243transmit_next (struct GNUNET_PSYC_Channel *c); 243transmit_next (struct GNUNET_PSYC_Channel *ch);
244 244
245 245
246void 246static void
247master_transmit_data (struct GNUNET_PSYC_Master *mst) 247master_transmit_data (struct GNUNET_PSYC_Master *mst)
248{ 248{
249 struct GNUNET_PSYC_Channel *ch = &mst->ch; 249 struct GNUNET_PSYC_Channel *ch = &mst->ch;
@@ -295,11 +295,16 @@ master_transmit_data (struct GNUNET_PSYC_Master *mst)
295 * @param msg message received, NULL on timeout or fatal error 295 * @param msg message received, NULL on timeout or fatal error
296 */ 296 */
297static void 297static void
298message_handler (void *cls, const struct GNUNET_MessageHeader *msg) 298message_handler (void *cls,
299 const struct GNUNET_MessageHeader *msg)
299{ 300{
301 // YUCK! => please have disjoint message handlers...
300 struct GNUNET_PSYC_Channel *ch = cls; 302 struct GNUNET_PSYC_Channel *ch = cls;
301 struct GNUNET_PSYC_Master *mst = cls; 303 struct GNUNET_PSYC_Master *mst = cls;
302 struct GNUNET_PSYC_Slave *slv = cls; 304 struct GNUNET_PSYC_Slave *slv = cls;
305 struct CountersResult *cres;
306 struct TransmitAck *tack;
307
303 308
304 if (NULL == msg) 309 if (NULL == msg)
305 { 310 {
@@ -333,9 +338,6 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
333 return; 338 return;
334 } 339 }
335 340
336 struct CountersResult *cres;
337 struct TransmitAck *tack;
338
339 switch (type) 341 switch (type)
340 { 342 {
341 case GNUNET_MESSAGE_TYPE_PSYC_MASTER_START_ACK: 343 case GNUNET_MESSAGE_TYPE_PSYC_MASTER_START_ACK:
@@ -382,6 +384,7 @@ message_handler (void *cls, const struct GNUNET_MessageHeader *msg)
382 GNUNET_TIME_UNIT_FOREVER_REL); 384 GNUNET_TIME_UNIT_FOREVER_REL);
383} 385}
384 386
387
385/** 388/**
386 * Transmit next message to service. 389 * Transmit next message to service.
387 * 390 *
@@ -430,7 +433,7 @@ send_next_message (void *cls, size_t size, void *buf)
430/** 433/**
431 * Schedule transmission of the next message from our queue. 434 * Schedule transmission of the next message from our queue.
432 * 435 *
433 * @param h PSYC handle. 436 * @param ch PSYC handle.
434 */ 437 */
435static void 438static void
436transmit_next (struct GNUNET_PSYC_Channel *ch) 439transmit_next (struct GNUNET_PSYC_Channel *ch)
@@ -485,13 +488,13 @@ reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
485/** 488/**
486 * Disconnect from the PSYC service. 489 * Disconnect from the PSYC service.
487 * 490 *
488 * @param cls Channel handle. 491 * @param c Channel handle to disconnect
489 * @param tc Scheduler context.
490 */ 492 */
491static void 493static void
492disconnect (void *c) 494disconnect (void *c)
493{ 495{
494 struct GNUNET_PSYC_Channel *ch = c; 496 struct GNUNET_PSYC_Channel *ch = c;
497
495 GNUNET_assert (NULL != ch); 498 GNUNET_assert (NULL != ch);
496 if (ch->transmit_head != ch->transmit_tail) 499 if (ch->transmit_head != ch->transmit_tail)
497 { 500 {
@@ -546,7 +549,8 @@ disconnect (void *c)
546 * Used to automate join decisions. 549 * Used to automate join decisions.
547 * @param method Function to invoke on messages received from slaves. 550 * @param method Function to invoke on messages received from slaves.
548 * @param join_cb Function to invoke when a peer wants to join. 551 * @param join_cb Function to invoke when a peer wants to join.
549 * @param cls Closure for @a method and @a join_cb. 552 * @param master_started_cb Function to invoke after the channel master started.
553 * @param cls Closure for @a master_started_cb and @a join_cb.
550 * @return Handle for the channel master, NULL on error. 554 * @return Handle for the channel master, NULL on error.
551 */ 555 */
552struct GNUNET_PSYC_Master * 556struct GNUNET_PSYC_Master *
@@ -588,10 +592,10 @@ GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg,
588 * @param master PSYC channel master to stop. 592 * @param master PSYC channel master to stop.
589 */ 593 */
590void 594void
591GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *mst) 595GNUNET_PSYC_master_stop (struct GNUNET_PSYC_Master *master)
592{ 596{
593 disconnect (mst); 597 disconnect (master);
594 GNUNET_free (mst); 598 GNUNET_free (master);
595} 599}
596 600
597 601
@@ -633,7 +637,7 @@ GNUNET_PSYC_join_decision (struct GNUNET_PSYC_JoinHandle *jh,
633 637
634/* FIXME: split up value into <64K chunks and transmit the continuations in 638/* FIXME: split up value into <64K chunks and transmit the continuations in
635 * MOD_CONT msgs */ 639 * MOD_CONT msgs */
636int 640static int
637send_modifier (void *cls, struct GNUNET_ENV_Modifier *mod) 641send_modifier (void *cls, struct GNUNET_ENV_Modifier *mod)
638{ 642{
639 struct GNUNET_PSYC_Channel *ch = cls; 643 struct GNUNET_PSYC_Channel *ch = cls;
@@ -658,7 +662,7 @@ send_modifier (void *cls, struct GNUNET_ENV_Modifier *mod)
658/** 662/**
659 * Send a message to call a method to all members in the PSYC channel. 663 * Send a message to call a method to all members in the PSYC channel.
660 * 664 *
661 * @param mst Handle to the PSYC channel. 665 * @param master Handle to the PSYC channel.
662 * @param method_name Which method should be invoked. 666 * @param method_name Which method should be invoked.
663 * @param env Environment containing state operations and transient variables 667 * @param env Environment containing state operations and transient variables
664 * for the message, or NULL. 668 * for the message, or NULL.
@@ -669,15 +673,15 @@ send_modifier (void *cls, struct GNUNET_ENV_Modifier *mod)
669 * queued). 673 * queued).
670 */ 674 */
671struct GNUNET_PSYC_MasterTransmitHandle * 675struct GNUNET_PSYC_MasterTransmitHandle *
672GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *mst, 676GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *master,
673 const char *method_name, 677 const char *method_name,
674 const struct GNUNET_ENV_Environment *env, 678 const struct GNUNET_ENV_Environment *env,
675 GNUNET_PSYC_MasterTransmitNotify notify, 679 GNUNET_PSYC_MasterTransmitNotify notify,
676 void *notify_cls, 680 void *notify_cls,
677 enum GNUNET_PSYC_MasterTransmitFlags flags) 681 enum GNUNET_PSYC_MasterTransmitFlags flags)
678{ 682{
679 GNUNET_assert (NULL != mst); 683 GNUNET_assert (NULL != master);
680 struct GNUNET_PSYC_Channel *ch = &mst->ch; 684 struct GNUNET_PSYC_Channel *ch = &master->ch;
681 if (GNUNET_NO != ch->in_transmit) 685 if (GNUNET_NO != ch->in_transmit)
682 return NULL; 686 return NULL;
683 ch->in_transmit = GNUNET_YES; 687 ch->in_transmit = GNUNET_YES;
@@ -696,15 +700,15 @@ GNUNET_PSYC_master_transmit (struct GNUNET_PSYC_Master *mst,
696 memcpy (&pmeth[1], method_name, size); 700 memcpy (&pmeth[1], method_name, size);
697 701
698 GNUNET_CONTAINER_DLL_insert_tail (ch->transmit_head, ch->transmit_tail, op); 702 GNUNET_CONTAINER_DLL_insert_tail (ch->transmit_head, ch->transmit_tail, op);
699 GNUNET_ENV_environment_iterate (env, send_modifier, mst); 703 GNUNET_ENV_environment_iterate (env, send_modifier, master);
700 transmit_next (ch); 704 transmit_next (ch);
701 705
702 mst->tmit = GNUNET_malloc (sizeof (*mst->tmit)); 706 master->tmit = GNUNET_malloc (sizeof (*master->tmit));
703 mst->tmit->master = mst; 707 master->tmit->master = master;
704 mst->tmit->notify = notify; 708 master->tmit->notify = notify;
705 mst->tmit->notify_cls = notify_cls; 709 master->tmit->notify_cls = notify_cls;
706 mst->tmit->status = GNUNET_PSYC_DATA_CONT; 710 master->tmit->status = GNUNET_PSYC_DATA_CONT;
707 return mst->tmit; 711 return master->tmit;
708} 712}
709 713
710 714
@@ -728,12 +732,10 @@ GNUNET_PSYC_master_transmit_resume (struct GNUNET_PSYC_MasterTransmitHandle *th)
728void 732void
729GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th) 733GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th)
730{ 734{
731 struct GNUNET_PSYC_Master *mst = th->master; 735 struct GNUNET_PSYC_Master *master = th->master;
732 struct GNUNET_PSYC_Channel *ch = &mst->ch; 736 struct GNUNET_PSYC_Channel *ch = &master->ch;
733 if (GNUNET_NO != ch->in_transmit) 737 if (GNUNET_NO != ch->in_transmit)
734 return; 738 return;
735
736
737} 739}
738 740
739 741
@@ -758,8 +760,10 @@ GNUNET_PSYC_master_transmit_cancel (struct GNUNET_PSYC_MasterTransmitHandle *th)
758 * as relays and used to join the group at. 760 * as relays and used to join the group at.
759 * @param method Function to invoke on messages received from the channel, 761 * @param method Function to invoke on messages received from the channel,
760 * typically at least contains functions for @e join and @e part. 762 * typically at least contains functions for @e join and @e part.
761 * @param join_cb Function to invoke when a peer wants to join. 763 * @param join_cb function invoked once we have joined with the current
762 * @param cls Closure for @a method_cb and @a join_cb. 764 * message ID of the channel
765 * @param slave_joined_cb Function to invoke when a peer wants to join.
766 * @param cls Closure for @a method_cb and @a slave_joined_cb.
763 * @param method_name Method name for the join request. 767 * @param method_name Method name for the join request.
764 * @param env Environment containing transient variables for the request, or NULL. 768 * @param env Environment containing transient variables for the request, or NULL.
765 * @param data Payload for the join message. 769 * @param data Payload for the join message.
@@ -810,15 +814,15 @@ GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
810 * Part a PSYC channel. 814 * Part a PSYC channel.
811 * 815 *
812 * Will terminate the connection to the PSYC service. Polite clients should 816 * Will terminate the connection to the PSYC service. Polite clients should
813 * first explicitly send a @e part request (via GNUNET_PSYC_slave_transmit()). 817 * first explicitly send a part request (via GNUNET_PSYC_slave_transmit()).
814 * 818 *
815 * @param slv Slave handle. 819 * @param slave Slave handle.
816 */ 820 */
817void 821void
818GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slv) 822GNUNET_PSYC_slave_part (struct GNUNET_PSYC_Slave *slave)
819{ 823{
820 disconnect (slv); 824 disconnect (slave);
821 GNUNET_free (slv); 825 GNUNET_free (slave);
822} 826}
823 827
824 828
@@ -914,20 +918,20 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave)
914 * correctly; not doing so correctly will result in either denying other slaves 918 * correctly; not doing so correctly will result in either denying other slaves
915 * access or offering access to channel data to non-members. 919 * access or offering access to channel data to non-members.
916 * 920 *
917 * @param ch Channel handle. 921 * @param channel Channel handle.
918 * @param slave_key Identity of channel slave to add. 922 * @param slave_key Identity of channel slave to add.
919 * @param announced_at ID of the message that announced the membership change. 923 * @param announced_at ID of the message that announced the membership change.
920 * @param effective_since Addition of slave is in effect since this message ID. 924 * @param effective_since Addition of slave is in effect since this message ID.
921 */ 925 */
922void 926void
923GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *ch, 927GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel,
924 const struct GNUNET_CRYPTO_EddsaPublicKey 928 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
925 *slave_key,
926 uint64_t announced_at, 929 uint64_t announced_at,
927 uint64_t effective_since) 930 uint64_t effective_since)
928{ 931{
929 struct ChannelSlaveAdd *slvadd; 932 struct ChannelSlaveAdd *slvadd;
930 struct OperationHandle *op = GNUNET_malloc (sizeof (*op) + sizeof (*slvadd)); 933 struct OperationHandle *op = GNUNET_malloc (sizeof (*op) + sizeof (*slvadd));
934
931 slvadd = (struct ChannelSlaveAdd *) &op[1]; 935 slvadd = (struct ChannelSlaveAdd *) &op[1];
932 op->msg = (struct GNUNET_MessageHeader *) slvadd; 936 op->msg = (struct GNUNET_MessageHeader *) slvadd;
933 937
@@ -935,9 +939,10 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *ch,
935 slvadd->header.size = htons (sizeof (*slvadd)); 939 slvadd->header.size = htons (sizeof (*slvadd));
936 slvadd->announced_at = GNUNET_htonll (announced_at); 940 slvadd->announced_at = GNUNET_htonll (announced_at);
937 slvadd->effective_since = GNUNET_htonll (effective_since); 941 slvadd->effective_since = GNUNET_htonll (effective_since);
938 942 GNUNET_CONTAINER_DLL_insert_tail (channel->transmit_head,
939 GNUNET_CONTAINER_DLL_insert_tail (ch->transmit_head, ch->transmit_tail, op); 943 channel->transmit_tail,
940 transmit_next (ch); 944 op);
945 transmit_next (channel);
941} 946}
942 947
943 948
@@ -958,27 +963,27 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *ch,
958 * denying members access or offering access to channel data to 963 * denying members access or offering access to channel data to
959 * non-members. 964 * non-members.
960 * 965 *
961 * @param ch Channel handle. 966 * @param channel Channel handle.
962 * @param slave_key Identity of channel slave to remove. 967 * @param slave_key Identity of channel slave to remove.
963 * @param announced_at ID of the message that announced the membership change. 968 * @param announced_at ID of the message that announced the membership change.
964 */ 969 */
965void 970void
966GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *ch, 971GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel,
967 const struct GNUNET_CRYPTO_EddsaPublicKey 972 const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key,
968 *slave_key,
969 uint64_t announced_at) 973 uint64_t announced_at)
970{ 974{
971 struct ChannelSlaveRemove *slvrm; 975 struct ChannelSlaveRemove *slvrm;
972 struct OperationHandle *op = GNUNET_malloc (sizeof (*op) + sizeof (*slvrm)); 976 struct OperationHandle *op = GNUNET_malloc (sizeof (*op) + sizeof (*slvrm));
977
973 slvrm = (struct ChannelSlaveRemove *) &op[1]; 978 slvrm = (struct ChannelSlaveRemove *) &op[1];
974 op->msg = (struct GNUNET_MessageHeader *) slvrm; 979 op->msg = (struct GNUNET_MessageHeader *) slvrm;
975
976 slvrm->header.type = GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM; 980 slvrm->header.type = GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM;
977 slvrm->header.size = htons (sizeof (*slvrm)); 981 slvrm->header.size = htons (sizeof (*slvrm));
978 slvrm->announced_at = GNUNET_htonll (announced_at); 982 slvrm->announced_at = GNUNET_htonll (announced_at);
979 983 GNUNET_CONTAINER_DLL_insert_tail (channel->transmit_head,
980 GNUNET_CONTAINER_DLL_insert_tail (ch->transmit_head, ch->transmit_tail, op); 984 channel->transmit_tail,
981 transmit_next (ch); 985 op);
986 transmit_next (channel);
982} 987}
983 988
984 989
@@ -990,24 +995,21 @@ GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *ch,
990 * 995 *
991 * To get the latest message, use 0 for both the start and end message ID. 996 * To get the latest message, use 0 for both the start and end message ID.
992 * 997 *
993 * @param ch Which channel should be replayed? 998 * @param channel Which channel should be replayed?
994 * @param start_message_id Earliest interesting point in history. 999 * @param start_message_id Earliest interesting point in history.
995 * @param end_message_id Last (exclusive) interesting point in history. 1000 * @param end_message_id Last (exclusive) interesting point in history.
996 * @param method Function to invoke on messages received from the story. 1001 * @param method Function to invoke on messages received from the story.
997 * @param finish_cb Function to call when the requested story has been fully 1002 * @param finish_cb Function to call when the requested story has been fully
998 * told (counting message IDs might not suffice, as some messages 1003 * told (counting message IDs might not suffice, as some messages
999 * might be secret and thus the listener would not know the story is 1004 * might be secret and thus the listener would not know the story is
1000 * finished without being told explicitly) 1005 * finished without being told explicitly) once this function
1001{
1002 return NULL;
1003} once this function
1004 * has been called, the client must not call 1006 * has been called, the client must not call
1005 * GNUNET_PSYC_channel_story_tell_cancel() anymore. 1007 * GNUNET_PSYC_channel_story_tell_cancel() anymore.
1006 * @param cls Closure for the callbacks. 1008 * @param cls Closure for the callbacks.
1007 * @return Handle to cancel story telling operation. 1009 * @return Handle to cancel story telling operation.
1008 */ 1010 */
1009struct GNUNET_PSYC_Story * 1011struct GNUNET_PSYC_Story *
1010GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *ch, 1012GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *channel,
1011 uint64_t start_message_id, 1013 uint64_t start_message_id,
1012 uint64_t end_message_id, 1014 uint64_t end_message_id,
1013 GNUNET_PSYC_Method method, 1015 GNUNET_PSYC_Method method,