aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-07-15 07:25:07 +0000
committerGabor X Toth <*@tg-x.net>2013-07-15 07:25:07 +0000
commitb6791ebdaa0d5299be3cc9fb5fbdcd5356ededf0 (patch)
tree20d7d8784b93f7b44bae2f32a85986e1570f9c14 /src
parent542c589521241d21e54b040d159c316cec633830 (diff)
downloadgnunet-b6791ebdaa0d5299be3cc9fb5fbdcd5356ededf0.tar.gz
gnunet-b6791ebdaa0d5299be3cc9fb5fbdcd5356ededf0.zip
psyc api: no state events, those are handled in social
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_psyc_service.h69
1 files changed, 19 insertions, 50 deletions
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index 4828cc460..e6d47dc4e 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -178,7 +178,7 @@ typedef int (*GNUNET_PSYC_Method)(void *cls,
178 * Method called from PSYC upon receiving a join request. 178 * Method called from PSYC upon receiving a join request.
179 * 179 *
180 * @param cls Closure. 180 * @param cls Closure.
181 * @param sender Who transmitted the message. 181 * @param peer Peer requesting to join.
182 * @param method_name Method name in the join request. 182 * @param method_name Method name in the join request.
183 * @param header_length Number of modifiers in header. 183 * @param header_length Number of modifiers in header.
184 * @param header Modifiers present in the message. 184 * @param header Modifiers present in the message.
@@ -187,7 +187,7 @@ typedef int (*GNUNET_PSYC_Method)(void *cls,
187 * if data is binary). 187 * if data is binary).
188 */ 188 */
189typedef int (*GNUNET_PSYC_JoinCallback)(void *cls, 189typedef int (*GNUNET_PSYC_JoinCallback)(void *cls,
190 const struct GNUNET_PeerIdentity *sender, 190 const struct GNUNET_PeerIdentity *peer,
191 const char *method_name, 191 const char *method_name,
192 size_t header_length, 192 size_t header_length,
193 GNUNET_PSYC_Modifier *header, 193 GNUNET_PSYC_Modifier *header,
@@ -200,7 +200,7 @@ typedef int (*GNUNET_PSYC_JoinCallback)(void *cls,
200 * Method called from PSYC upon receiving a part request. 200 * Method called from PSYC upon receiving a part request.
201 * 201 *
202 * @param cls Closure. 202 * @param cls Closure.
203 * @param sender Who transmitted the message. 203 * @param peer Peer requesting to leave.
204 * @param method_name Method name in the part request. 204 * @param method_name Method name in the part request.
205 * @param header_length Number of modifiers in header. 205 * @param header_length Number of modifiers in header.
206 * @param header Modifiers present in the message. 206 * @param header Modifiers present in the message.
@@ -209,7 +209,7 @@ typedef int (*GNUNET_PSYC_JoinCallback)(void *cls,
209 * if data is binary). 209 * if data is binary).
210 */ 210 */
211typedef int (*GNUNET_PSYC_PartCallback)(void *cls, 211typedef int (*GNUNET_PSYC_PartCallback)(void *cls,
212 const struct GNUNET_PeerIdentity *sender, 212 const struct GNUNET_PeerIdentity *peer,
213 const char *method_name, 213 const char *method_name,
214 size_t header_length, 214 size_t header_length,
215 GNUNET_PSYC_Modifier *header, 215 GNUNET_PSYC_Modifier *header,
@@ -471,52 +471,25 @@ GNUNET_PSYC_group_member_remove (struct GNUNET_PSYC_Group *group,
471 471
472 472
473/** 473/**
474 * Function called to inform a member about state changes for a channel. 474 * Function called to inform a member about stored state values for a channel.
475 *
476 * Note that (for sets) only the delta is communicated, not the full state.
477 * 475 *
478 * @param cls Closure. 476 * @param cls Closure.
479 * @param full_state_name Full name of the state. 477 * @param name Name of the state variable.
480 * @param type How to interpret the change. 478 * @param value Value of the state variable.
481 * @param state_value Information about the new state. 479 * @param value_size Number of bytes in @a value.
482 * @param state_value_size Number of bytes in @a state_value.
483 */ 480 */
484typedef void (*GNUNET_PSYC_StateCallback)(void *cls, 481typedef void (*GNUNET_PSYC_StateCallback)(void *cls,
485 const char *full_state_name, 482 const char *name,
486 enum GNUNET_PSYC_Operator type, 483 size_t value_size,
487 const void *state_value, 484 const void *value);
488 size_t state_value_size);
489 485
490 486
491/** 487/**
492 * Descriptor for an event handler handling PSYC state updates.
493 */
494struct GNUNET_PSYC_StateHandler
495{
496
497 /**
498 * Name of the state variable this handler calls about, used in try-and-slice matching.
499 */
500 const char *state_name;
501
502 /**
503 * Function to call whenever the respective state changes.
504 */
505 GNUNET_PSYC_StateCallback event_handler;
506
507 /**
508 * Closure for the @a event_handler function.
509 */
510 void *event_handler_cls;
511
512};
513
514/**
515 * Join a PSYC group. 488 * Join a PSYC group.
516 * 489 *
517 * The entity joining is always the local peer. The user must immediately use 490 * The entity joining is always the local peer. The user must immediately use
518 * the GNUNET_PSYC_member_to_origin() (and possibly 491 * the GNUNET_PSYC_member_to_origin() (and possibly
519 * GNUNET_PSYC_member_origin_variable_set()) functions to transmit a @e join_msg to 492 * GNUNET_PSYC_member_variable_set()) functions to transmit a @e join_msg to
520 * the channel; if the join request succeeds, the channel state (and @e recent 493 * the channel; if the join request succeeds, the channel state (and @e recent
521 * method calls) will be replayed to the joining member. There is no explicit 494 * method calls) will be replayed to the joining member. There is no explicit
522 * notification on failure (as the channel may simply take days to approve, a-v/snd 495 * notification on failure (as the channel may simply take days to approve, a-v/snd
@@ -528,8 +501,6 @@ struct GNUNET_PSYC_StateHandler
528 * @param method Function to invoke on messages received from the channel, 501 * @param method Function to invoke on messages received from the channel,
529 * typically at least contains functions for @e join and @e part. 502 * typically at least contains functions for @e join and @e part.
530 * @param method_cls Closure for @a method. 503 * @param method_cls Closure for @a method.
531 * @param state_count Number of @a state_handlers.
532 * @param state_handlers Array of state event handlers.
533 * @return Handle for the member, NULL on error. 504 * @return Handle for the member, NULL on error.
534 */ 505 */
535struct GNUNET_PSYC_Member * 506struct GNUNET_PSYC_Member *
@@ -537,9 +508,7 @@ GNUNET_PSYC_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
537 const struct GNUNET_CRYPTO_EccPublicKey *pub_key, 508 const struct GNUNET_CRYPTO_EccPublicKey *pub_key,
538 const struct GNUNET_PeerIdentity *origin, 509 const struct GNUNET_PeerIdentity *origin,
539 GNUNET_PSYC_Method method, 510 GNUNET_PSYC_Method method,
540 void *method_cls, 511 void *method_cls);
541 unsigned int state_count,
542 struct GNUNET_PSYC_StateHandler *state_handlers);
543 512
544 513
545/** 514/**
@@ -607,15 +576,15 @@ GNUNET_PSYC_member_to_origin (struct GNUNET_PSYC_Member *member,
607 * again with NULL/0 for the @a value. 576 * again with NULL/0 for the @a value.
608 * 577 *
609 * @param member Membership handle. 578 * @param member Membership handle.
610 * @param variable_name Name of the variable to set. 579 * @param name Name of the variable to set.
611 * @param value Value to set for the given variable.
612 * @param value_size Number of bytes in @a value. 580 * @param value_size Number of bytes in @a value.
581 * @param value Value to set for the given variable.
613 */ 582 */
614uint64_t 583uint64_t
615GNUNET_PSYC_member_origin_variable_set (struct GNUNET_PSYC_Member *member, 584GNUNET_PSYC_member_variable_set (struct GNUNET_PSYC_Member *member,
616 const char *variable_name, 585 const char *name,
617 const void *value, 586 size_t value_size,
618 size_t value_size); 587 const void *value);
619 588
620 589
621/** 590/**