aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-07-15 07:54:18 +0000
committerGabor X Toth <*@tg-x.net>2013-07-15 07:54:18 +0000
commita34643853662890750a0440f0fae4be55a4652ac (patch)
tree646dad4669da7eab7c789280ed62e8fd7bc0e070 /src
parentd6e993f8abf50bd8d9b637e0fad3b74e71a1850b (diff)
downloadgnunet-a34643853662890750a0440f0fae4be55a4652ac.tar.gz
gnunet-a34643853662890750a0440f0fae4be55a4652ac.zip
PSYC: move history & state functions to the common channel API
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_psyc_service.h224
1 files changed, 112 insertions, 112 deletions
diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h
index 9354d81e9..0882a3b02 100644
--- a/src/include/gnunet_psyc_service.h
+++ b/src/include/gnunet_psyc_service.h
@@ -356,99 +356,6 @@ GNUNET_PSYC_master_destroy (struct GNUNET_PSYC_Master *master);
356 356
357 357
358/** 358/**
359 * Handle to access PSYC channel operations for both the master and slaves.
360 */
361struct GNUNET_PSYC_Channel;
362
363
364/**
365 * Convert a channel @a master to a @e channel handle to access the @e channel APIs.
366 *
367 * @param master Channel master handle.
368 * @return Channel handle, valid for as long as @a master is valid.
369 */
370struct GNUNET_PSYC_Channel *
371GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master);
372
373
374/**
375 * Convert @a slave to a @e channel handle to access the @e channel APIs.
376 *
377 * @param slave Slave handle.
378 * @return Channel handle, valid for as long as @a slave is valid.
379 */
380struct GNUNET_PSYC_Channel *
381GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave);
382
383
384/**
385 * Add a member to the channel.
386 *
387 * Note that this will NOT generate any PSYC traffic, it will merely update the
388 * local data base to modify how we react to <em>membership test</em> queries.
389 * The channel master still needs to explicitly transmit a @e join message to
390 * notify other channel members and they then also must still call this function
391 * in their respective methods handling the @e join message. This way, how @e
392 * join and @e part operations are exactly implemented is still up to the
393 * application; for example, there might be a @e part_all method to kick out
394 * everyone.
395 *
396 * Note that channel members are explicitly trusted to execute such methods
397 * correctly; not doing so correctly will result in either denying members
398 * access or offering access to channel data to non-members.
399 *
400 * @param channel Channel handle.
401 * @param member Which peer to add.
402 * @param message_id Message ID for the message that changed the membership.
403 */
404void
405GNUNET_PSYC_channel_member_add (struct GNUNET_PSYC_Channel *channel,
406 const struct GNUNET_PeerIdentity *member,
407 uint64_t message_id);
408
409
410/**
411 * Remove a member from the channel.
412 *
413 * Note that this will NOT generate any PSYC traffic, it will merely update the
414 * local data base to modify how we react to <em>membership test</em> queries.
415 * The channel master still needs to explicitly transmit a @e part message to
416 * notify other channel members and they then also must still call this function
417 * in their respective methods handling the @e part message. This way, how
418 * @e join and @e part operations are exactly implemented is still up to the
419 * application; for example, there might be a @e part_all message to kick out
420 * everyone.
421 *
422 * Note that channel members are explicitly trusted to perform these
423 * operations correctly; not doing so correctly will result in either
424 * denying members access or offering access to channel data to
425 * non-members.
426 *
427 * @param channel Channel handle.
428 * @param member Which peer to remove.
429 * @param message_id Message ID for the message that changed the membership.
430 */
431void
432GNUNET_PSYC_channel_member_remove (struct GNUNET_PSYC_Channel *channel,
433 const struct GNUNET_PeerIdentity *member,
434 uint64_t message_id);
435
436
437/**
438 * Function called to inform a member about stored state values for a channel.
439 *
440 * @param cls Closure.
441 * @param name Name of the state variable.
442 * @param value Value of the state variable.
443 * @param value_size Number of bytes in @a value.
444 */
445typedef void (*GNUNET_PSYC_StateCallback)(void *cls,
446 const char *name,
447 size_t value_size,
448 const void *value);
449
450
451/**
452 * Handle for a PSYC channel slave. 359 * Handle for a PSYC channel slave.
453 */ 360 */
454struct GNUNET_PSYC_Slave; 361struct GNUNET_PSYC_Slave;
@@ -547,6 +454,99 @@ GNUNET_PSYC_slave_transmit_cancel (struct GNUNET_PSYC_SlaveTransmitHandle *th);
547 454
548 455
549/** 456/**
457 * Handle to access PSYC channel operations for both the master and slaves.
458 */
459struct GNUNET_PSYC_Channel;
460
461
462/**
463 * Convert a channel @a master to a @e channel handle to access the @e channel APIs.
464 *
465 * @param master Channel master handle.
466 * @return Channel handle, valid for as long as @a master is valid.
467 */
468struct GNUNET_PSYC_Channel *
469GNUNET_PSYC_master_get_channel (struct GNUNET_PSYC_Master *master);
470
471
472/**
473 * Convert @a slave to a @e channel handle to access the @e channel APIs.
474 *
475 * @param slave Slave handle.
476 * @return Channel handle, valid for as long as @a slave is valid.
477 */
478struct GNUNET_PSYC_Channel *
479GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave);
480
481
482/**
483 * Add a member to the channel.
484 *
485 * Note that this will NOT generate any PSYC traffic, it will merely update the
486 * local data base to modify how we react to <em>membership test</em> queries.
487 * The channel master still needs to explicitly transmit a @e join message to
488 * notify other channel members and they then also must still call this function
489 * in their respective methods handling the @e join message. This way, how @e
490 * join and @e part operations are exactly implemented is still up to the
491 * application; for example, there might be a @e part_all method to kick out
492 * everyone.
493 *
494 * Note that channel members are explicitly trusted to execute such methods
495 * correctly; not doing so correctly will result in either denying members
496 * access or offering access to channel data to non-members.
497 *
498 * @param channel Channel handle.
499 * @param member Which peer to add.
500 * @param message_id Message ID for the message that changed the membership.
501 */
502void
503GNUNET_PSYC_channel_member_add (struct GNUNET_PSYC_Channel *channel,
504 const struct GNUNET_PeerIdentity *member,
505 uint64_t message_id);
506
507
508/**
509 * Remove a member from the channel.
510 *
511 * Note that this will NOT generate any PSYC traffic, it will merely update the
512 * local data base to modify how we react to <em>membership test</em> queries.
513 * The channel master still needs to explicitly transmit a @e part message to
514 * notify other channel members and they then also must still call this function
515 * in their respective methods handling the @e part message. This way, how
516 * @e join and @e part operations are exactly implemented is still up to the
517 * application; for example, there might be a @e part_all message to kick out
518 * everyone.
519 *
520 * Note that channel members are explicitly trusted to perform these
521 * operations correctly; not doing so correctly will result in either
522 * denying members access or offering access to channel data to
523 * non-members.
524 *
525 * @param channel Channel handle.
526 * @param member Which peer to remove.
527 * @param message_id Message ID for the message that changed the membership.
528 */
529void
530GNUNET_PSYC_channel_member_remove (struct GNUNET_PSYC_Channel *channel,
531 const struct GNUNET_PeerIdentity *member,
532 uint64_t message_id);
533
534
535/**
536 * Function called to inform a member about stored state values for a channel.
537 *
538 * @param cls Closure.
539 * @param name Name of the state variable.
540 * @param value Value of the state variable.
541 * @param value_size Number of bytes in @a value.
542 */
543typedef void (*GNUNET_PSYC_StateCallback)(void *cls,
544 const char *name,
545 size_t value_size,
546 const void *value);
547
548
549/**
550 * Handle to a story telling operation. 550 * Handle to a story telling operation.
551 */ 551 */
552struct GNUNET_PSYC_Story; 552struct GNUNET_PSYC_Story;
@@ -560,7 +560,7 @@ struct GNUNET_PSYC_Story;
560 * 560 *
561 * To get the latest message, use 0 for both the start and end message ID. 561 * To get the latest message, use 0 for both the start and end message ID.
562 * 562 *
563 * @param slave Which channel should be replayed? 563 * @param channel Which channel should be replayed?
564 * @param start_message_id Earliest interesting point in history. 564 * @param start_message_id Earliest interesting point in history.
565 * @param end_message_id Last (exclusive) interesting point in history. 565 * @param end_message_id Last (exclusive) interesting point in history.
566 * @param method Function to invoke on messages received from the story. 566 * @param method Function to invoke on messages received from the story.
@@ -570,18 +570,18 @@ struct GNUNET_PSYC_Story;
570 * might be secret and thus the listener would not know the story is 570 * might be secret and thus the listener would not know the story is
571 * finished without being told explicitly); once this function 571 * finished without being told explicitly); once this function
572 * has been called, the client must not call 572 * has been called, the client must not call
573 * GNUNET_PSYC_slave_story_tell_cancel() anymore. 573 * GNUNET_PSYC_channel_story_tell_cancel() anymore.
574 * @param finish_cb_cls Closure to finish_cb. 574 * @param finish_cb_cls Closure to finish_cb.
575 * @return Handle to cancel story telling operation. 575 * @return Handle to cancel story telling operation.
576 */ 576 */
577struct GNUNET_PSYC_Story * 577struct GNUNET_PSYC_Story *
578GNUNET_PSYC_slave_story_tell (struct GNUNET_PSYC_Slave *slave, 578GNUNET_PSYC_channel_story_tell (struct GNUNET_PSYC_Channel *channel,
579 uint64_t start_message_id, 579 uint64_t start_message_id,
580 uint64_t end_message_id, 580 uint64_t end_message_id,
581 GNUNET_PSYC_Method method, 581 GNUNET_PSYC_Method method,
582 void *method_cls, 582 void *method_cls,
583 void (*finish_cb)(void *), 583 void (*finish_cb)(void *),
584 void *finish_cb_cls); 584 void *finish_cb_cls);
585 585
586 586
587/** 587/**
@@ -593,7 +593,7 @@ GNUNET_PSYC_slave_story_tell (struct GNUNET_PSYC_Slave *slave,
593 * @param story Story telling operation to stop. 593 * @param story Story telling operation to stop.
594 */ 594 */
595void 595void
596GNUNET_PSYC_slave_story_tell_cancel (struct GNUNET_PSYC_Story *story); 596GNUNET_PSYC_channel_story_tell_cancel (struct GNUNET_PSYC_Story *story);
597 597
598 598
599/** 599/**
@@ -608,7 +608,7 @@ GNUNET_PSYC_slave_story_tell_cancel (struct GNUNET_PSYC_Story *story);
608 * empty state ("") will match all values; requesting "_a_b" will also return 608 * empty state ("") will match all values; requesting "_a_b" will also return
609 * values stored under "_a_b_c". 609 * values stored under "_a_b_c".
610 * 610 *
611 * @param slave Slave handle. 611 * @param channel Channel handle.
612 * @param state_name Name of the state to query (full name 612 * @param state_name Name of the state to query (full name
613 * might be longer, this is only the prefix that must match). 613 * might be longer, this is only the prefix that must match).
614 * @param cb Function to call on the matching state values. 614 * @param cb Function to call on the matching state values.
@@ -617,10 +617,10 @@ GNUNET_PSYC_slave_story_tell_cancel (struct GNUNET_PSYC_Story *story);
617 * message ID). 617 * message ID).
618 */ 618 */
619uint64_t 619uint64_t
620GNUNET_PSYC_slave_state_get_all (struct GNUNET_PSYC_Slave *slave, 620GNUNET_PSYC_channel_state_get_all (struct GNUNET_PSYC_Channel *channel,
621 const char *state_name, 621 const char *state_name,
622 GNUNET_PSYC_StateCallback cb, 622 GNUNET_PSYC_StateCallback cb,
623 void *cb_cls); 623 void *cb_cls);
624 624
625 625
626/** 626/**
@@ -634,7 +634,7 @@ GNUNET_PSYC_slave_state_get_all (struct GNUNET_PSYC_Slave *slave,
634 * the state, the nearest less-specific name is matched; for example, 634 * the state, the nearest less-specific name is matched; for example,
635 * requesting "_a_b" will match "_a" if "_a_b" does not exist. 635 * requesting "_a_b" will match "_a" if "_a_b" does not exist.
636 * 636 *
637 * @param slave Slave handle. 637 * @param channel Channel handle.
638 * @param variable_name Name of the variable to query. 638 * @param variable_name Name of the variable to query.
639 * @param[out] return_value_size Set to number of bytes in variable, 639 * @param[out] return_value_size Set to number of bytes in variable,
640 * needed as variables might contain binary data and 640 * needed as variables might contain binary data and
@@ -643,9 +643,9 @@ GNUNET_PSYC_slave_state_get_all (struct GNUNET_PSYC_Slave *slave,
643 to the respective value otherwise. 643 to the respective value otherwise.
644 */ 644 */
645const void * 645const void *
646GNUNET_PSYC_slave_state_get (struct GNUNET_PSYC_Slave *slave, 646GNUNET_PSYC_channel_state_get (struct GNUNET_PSYC_Channel *channel,
647 const char *variable_name, 647 const char *variable_name,
648 size_t *return_value_size); 648 size_t *return_value_size);
649 649
650 650
651#if 0 /* keep Emacsens' auto-indent happy */ 651#if 0 /* keep Emacsens' auto-indent happy */