aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_psyc_service.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-06-11 08:07:18 +0000
committerChristian Grothoff <christian@grothoff.org>2013-06-11 08:07:18 +0000
commit8c980d8ca66c5606a42790e33d8d1eb86b7c48a3 (patch)
tree54da48ac6dd6e707205e9627b411832bc095b4fc /src/include/gnunet_psyc_service.h
parent481360a6b6c106f51a687f2cee60ecc2b744724d (diff)
downloadgnunet-8c980d8ca66c5606a42790e33d8d1eb86b7c48a3.tar.gz
gnunet-8c980d8ca66c5606a42790e33d8d1eb86b7c48a3.zip
-cleaning
Diffstat (limited to 'src/include/gnunet_psyc_service.h')
-rw-r--r--src/include/gnunet_psyc_service.h96
1 files changed, 46 insertions, 50 deletions
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index 1dd831740..20b261e9c 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -250,7 +250,7 @@ typedef int (*GNUNET_PSYC_ChannelReadyNotify)(void *cls,
250 uint64_t message_id, 250 uint64_t message_id,
251 uint64_t group_generation, 251 uint64_t group_generation,
252 size_t *data_size, 252 size_t *data_size,
253 char *data); 253 void *data);
254 254
255 255
256/** 256/**
@@ -377,11 +377,13 @@ GNUNET_PSYC_group_member_kick (struct GNUNET_PSYC_Group *group,
377 * @param full_state_name full name of the state 377 * @param full_state_name full name of the state
378 * @param type how to interpret the change 378 * @param type how to interpret the change
379 * @param state_value information about the new state 379 * @param state_value information about the new state
380 * @param state_value_size number of bytes in 'state_value'
380 */ 381 */
381typedef void (*GNUNET_PSYC_StateCallback)(void *cls, 382typedef void (*GNUNET_PSYC_StateCallback)(void *cls,
382 const char *full_state_name, 383 const char *full_state_name,
383 enum GNUNET_PSYC_Operator type, 384 enum GNUNET_PSYC_Operator type,
384 const struct GNUNET_PSYC_Argument *state_value); 385 const void *state_value,
386 size_t state_value_size);
385 387
386 388
387/** 389/**
@@ -405,28 +407,18 @@ struct GNUNET_PSYC_StateHandler
405 */ 407 */
406 void *event_handler_cls; 408 void *event_handler_cls;
407 409
408 /**
409 * Description of the kind of state that the handler expects to see.
410 * Non-matching state updates will be ignored (but logged). Note
411 * that the state_types of all states with the same state name
412 * prefix should be identical. For state types, the
413 * 'GNUNET_PSYC_AF_STREAMABLE' and 'GNUNET_PSYC_AF_SET_STREAMABLE'
414 * flags must never be set (as the channel state should be small
415 * enough to (easily) fit into the memory of all PSYC members).
416 */
417 struct GNUNET_PSYC_ArgumentDescriptor state_type;
418
419}; 410};
420 411
421 412
422/** 413/**
423 * Join a PSYC group. The entity joining is always the local peer. 414 * Join a PSYC group. The entity joining is always the local peer.
424 * This will send a 'join_msg' to the channel; if it succeeds, the 415 * The user must immediately use the 'GNUNET_PSYC_member_send_to_host'
425 * channel state (and 'recent' method calls) will be replayed to the 416 * (and possibly 'GNUNET_PSYC_member_host_variable_set') functions to
426 * joining member and the 'join' method will be invoked to show that 417 * transmit a 'join_msg' to the channel; if the join request succeeds,
427 * we joined successfully. There is no explicit notification on 418 * the channel state (and 'recent' method calls) will be replayed to
428 * failure (as the channel may simply take days to approve, and 419 * the joining member. There is no explicit notification on failure
429 * disapproval is simply being ignored). 420 * (as the channel may simply take days to approve, and disapproval is
421 * simply being ignored).
430 * 422 *
431 * @param cfg configuration to use 423 * @param cfg configuration to use
432 * @param pub_key ECC key that identifies the channel we wish to join 424 * @param pub_key ECC key that identifies the channel we wish to join
@@ -435,13 +427,6 @@ struct GNUNET_PSYC_StateHandler
435 * typcially at least contains functions for 'join' and 'leave'. 427 * typcially at least contains functions for 'join' and 'leave'.
436 * @param state_count number of state handlers 428 * @param state_count number of state handlers
437 * @param state_handlers array of state event handlers 429 * @param state_handlers array of state event handlers
438 * @param join_msg which method should we invoke on the channel controller
439 * to try to join the channel (i.e. "join")
440 * @param join_cb method to invoke on channel to obtain arguments
441 * for a join method invocation;
442 * use NULL to send nothing (useful for anonymous groups that permit anyone);
443 * arguments to give to join method, must not include streaming args
444 * @param join_cb_cls closure for 'join_cb'
445 * @return handle for the member, NULL on error 430 * @return handle for the member, NULL on error
446 */ 431 */
447struct GNUNET_PSYC_Member * 432struct GNUNET_PSYC_Member *
@@ -450,10 +435,18 @@ GNUNET_PSYC_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
450 unsigned int method_count, 435 unsigned int method_count,
451 const struct GNUNET_PSYC_Method *methods, 436 const struct GNUNET_PSYC_Method *methods,
452 unsigned int state_count, 437 unsigned int state_count,
453 struct GNUNET_PSYC_StateHandler *state_handlers, 438 struct GNUNET_PSYC_StateHandler *state_handlers);
454 const char *join_method, 439
455 const struct GNUNET_PSYC_ChannelReadyNotify join_cb, 440
456 void *join_cb_cls); 441/**
442 * Leave a multicast group. Will terminate the connection to the PSYC
443 * service. Polite clients should first explicitly send a 'leave'
444 * request (via 'GNUNET_PSYC_member_send_to_host').
445 *
446 * @param member membership handle
447 */
448void
449GNUNET_PSYC_member_leave (struct GNUNET_PSYC_Member *member);
457 450
458 451
459/** 452/**
@@ -483,14 +476,11 @@ struct GNUNET_PSYC_HostTransmitHandle;
483 476
484 477
485/** 478/**
486 * Request a message to be send to the channel. 479 * Request a message to be send to the channel host.
487 * 480 *
488 * @param member membership handle 481 * @param member membership handle
489 * @param request_data which method should be invoked on channel (and how) 482 * @param method_name which (PSYC) method should be invoked (on host)
490 * @param method_name which method should be invoked 483 * @param notify function to call when we are allowed to transmit (to get data)
491 * @param argc number of arguments the method takes (size of 'ads' array)
492 * @param ads description of the arguments the method takes
493 * @param notify function to call to obtain the arguments
494 * @param notify_cls closure for 'notify' 484 * @param notify_cls closure for 'notify'
495 * @return transmission handle, NULL on error (i.e. more than one request queued) 485 * @return transmission handle, NULL on error (i.e. more than one request queued)
496 */ 486 */
@@ -502,6 +492,25 @@ GNUNET_PSYC_member_send_to_host (struct GNUNET_PSYC_Member *member,
502 492
503 493
504/** 494/**
495 * Set a (temporary, ":") variable for the next message being transmitted
496 * via 'GNUNET_PSYC_member_send_to_host'. If GNUNET_PSYC_member_send_to_host
497 * is called and then cancelled, all variables that were set using this
498 * function will be unset (lost/forgotten). To clear a variable state after
499 * setting it, you can also call this function again with NULL/0 for the value.
500 *
501 * @param member membership handle
502 * @param state_name name of the state to set
503 * @param value value to set for the given variable
504 * @param value_size number of bytes in 'value'
505 */
506uint64_t
507GNUNET_PSYC_member_host_variable_set (struct GNUNET_PSYC_Member *member,
508 const char *state_name,
509 const void *value,
510 size_t value_size);
511
512
513/**
505 * Abort transmission request to host. 514 * Abort transmission request to host.
506 * 515 *
507 * @param th handle of the request that is being aborted 516 * @param th handle of the request that is being aborted
@@ -593,25 +602,12 @@ GNUNET_PSYC_member_state_get (struct GNUNET_PSYC_Member *member,
593 * might also not be 0-terminated; set to 0 on errors 602 * might also not be 0-terminated; set to 0 on errors
594 * @return NULL on error, pointer to variable state otherwise 603 * @return NULL on error, pointer to variable state otherwise
595 */ 604 */
596const char * 605const void *
597GNUNET_PSYC_member_variable_get (struct GNUNET_PSYC_Member *member, 606GNUNET_PSYC_member_variable_get (struct GNUNET_PSYC_Member *member,
598 const char *variable_name, 607 const char *variable_name,
599 size_t *return_value_size); 608 size_t *return_value_size);
600 609
601 610
602/**
603 * Leave a multicast group. Will terminate the connection to the PSYC
604 * service. Polite clients should first explicitly send a 'leave'
605 * request (via 'GNUNET_PSYC_member_send_to_host'). This function
606 * must not be called on a 'member' that was obtained from
607 * GNUNET_PSYC_channel_get_group.
608 *
609 * @param member membership handle
610 */
611void
612GNUNET_PSYC_member_leave (struct GNUNET_PSYC_Member *member);
613
614
615 611
616#if 0 /* keep Emacsens' auto-indent happy */ 612#if 0 /* keep Emacsens' auto-indent happy */
617{ 613{