aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_messenger_service.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_messenger_service.h')
-rw-r--r--src/include/gnunet_messenger_service.h47
1 files changed, 31 insertions, 16 deletions
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h
index 5d7155a3d..b54567aa7 100644
--- a/src/include/gnunet_messenger_service.h
+++ b/src/include/gnunet_messenger_service.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 Copyright (C) 2020 GNUnet e.V. 3 Copyright (C) 2020--2021 GNUnet e.V.
4 4
5 GNUnet is free software: you can redistribute it and/or modify it 5 GNUnet is free software: you can redistribute it and/or modify it
6 under the terms of the GNU Affero General Public License as published 6 under the terms of the GNU Affero General Public License as published
@@ -527,7 +527,8 @@ enum GNUNET_MESSENGER_MessageFlags
527 * @param[in/out] handle Messenger handle 527 * @param[in/out] handle Messenger handle
528 */ 528 */
529typedef void 529typedef void
530(*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle); 530(*GNUNET_MESSENGER_IdentityCallback) (void *cls,
531 struct GNUNET_MESSENGER_Handle *handle);
531 532
532/** 533/**
533 * Method called whenever a message is sent or received from a <i>room</i>. 534 * Method called whenever a message is sent or received from a <i>room</i>.
@@ -543,7 +544,8 @@ typedef void
543 * @param[in] flags Flags of the message 544 * @param[in] flags Flags of the message
544 */ 545 */
545typedef void 546typedef void
546(*GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, 547(*GNUNET_MESSENGER_MessageCallback) (void *cls,
548 struct GNUNET_MESSENGER_Room *room,
547 const struct GNUNET_MESSENGER_Contact *sender, 549 const struct GNUNET_MESSENGER_Contact *sender,
548 const struct GNUNET_MESSENGER_Message *message, 550 const struct GNUNET_MESSENGER_Message *message,
549 const struct GNUNET_HashCode *hash, 551 const struct GNUNET_HashCode *hash,
@@ -558,7 +560,8 @@ typedef void
558 * @param[in] contact Contact handle 560 * @param[in] contact Contact handle
559 */ 561 */
560typedef int 562typedef int
561(*GNUNET_MESSENGER_MemberCallback) (void* cls, struct GNUNET_MESSENGER_Room *room, 563(*GNUNET_MESSENGER_MemberCallback) (void* cls,
564 struct GNUNET_MESSENGER_Room *room,
562 const struct GNUNET_MESSENGER_Contact *contact); 565 const struct GNUNET_MESSENGER_Contact *contact);
563 566
564/** 567/**
@@ -574,9 +577,12 @@ typedef int
574 * @return Messenger handle to use, NULL on error 577 * @return Messenger handle to use, NULL on error
575 */ 578 */
576struct GNUNET_MESSENGER_Handle* 579struct GNUNET_MESSENGER_Handle*
577GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, 580GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
578 GNUNET_MESSENGER_IdentityCallback identity_callback, void *identity_cls, 581 const char *name,
579 GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls); 582 GNUNET_MESSENGER_IdentityCallback identity_callback,
583 void *identity_cls,
584 GNUNET_MESSENGER_MessageCallback msg_callback,
585 void *msg_cls);
580 586
581/** 587/**
582 * Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All 588 * Update a handle of the messenger to use a different ego key and replace the old one with a newly generated one. All
@@ -619,7 +625,8 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle);
619 * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL 625 * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL
620 */ 626 */
621int 627int
622GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); 628GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle,
629 const char *name);
623 630
624/** 631/**
625 * Get the public key used by the messenger or NULL if the anonymous key was used. 632 * Get the public key used by the messenger or NULL if the anonymous key was used.
@@ -647,7 +654,8 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle);
647 * @return Room handle, NULL on error 654 * @return Room handle, NULL on error
648 */ 655 */
649struct GNUNET_MESSENGER_Room* 656struct GNUNET_MESSENGER_Room*
650GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 657GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle,
658 const struct GNUNET_HashCode *key);
651 659
652/** 660/**
653 * Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room. 661 * Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room.
@@ -668,7 +676,8 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct
668 * @return Room handle, NULL on error 676 * @return Room handle, NULL on error
669 */ 677 */
670struct GNUNET_MESSENGER_Room* 678struct GNUNET_MESSENGER_Room*
671GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 679GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle,
680 const struct GNUNET_PeerIdentity *door,
672 const struct GNUNET_HashCode *key); 681 const struct GNUNET_HashCode *key);
673 682
674/** 683/**
@@ -695,8 +704,10 @@ GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room);
695 * @return Amount of rooms iterated 704 * @return Amount of rooms iterated
696 */ 705 */
697int 706int
698GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, 707GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle,
699 GNUNET_MESSENGER_MemberCallback callback, void *cls); 708 const struct GNUNET_MESSENGER_Contact *contact,
709 GNUNET_MESSENGER_MemberCallback callback,
710 void *cls);
700 711
701/** 712/**
702 * Get the key of a given <i>room</i>. 713 * Get the key of a given <i>room</i>.
@@ -717,7 +728,8 @@ GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room);
717 * @return Contact handle, NULL otherwise 728 * @return Contact handle, NULL otherwise
718 */ 729 */
719const struct GNUNET_MESSENGER_Contact* 730const struct GNUNET_MESSENGER_Contact*
720GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); 731GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room,
732 const struct GNUNET_HashCode *hash);
721 733
722/** 734/**
723 * Get the name used by the <i>contact</i>. 735 * Get the name used by the <i>contact</i>.
@@ -756,7 +768,8 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact
756 * @param[in] contact Contact or NULL 768 * @param[in] contact Contact or NULL
757 */ 769 */
758void 770void
759GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, 771GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room,
772 const struct GNUNET_MESSENGER_Message *message,
760 const struct GNUNET_MESSENGER_Contact* contact); 773 const struct GNUNET_MESSENGER_Contact* contact);
761 774
762/** 775/**
@@ -767,7 +780,8 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct
767 * @return Message struct or NULL if no message with that hash is known 780 * @return Message struct or NULL if no message with that hash is known
768 */ 781 */
769const struct GNUNET_MESSENGER_Message* 782const struct GNUNET_MESSENGER_Message*
770GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); 783GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room,
784 const struct GNUNET_HashCode *hash);
771 785
772/** 786/**
773 * Iterates through all members of a given <i>room</i> and calls a selected <i>callback</i> 787 * Iterates through all members of a given <i>room</i> and calls a selected <i>callback</i>
@@ -780,7 +794,8 @@ GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const st
780 * @return Amount of members iterated 794 * @return Amount of members iterated
781 */ 795 */
782int 796int
783GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, 797GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room,
798 GNUNET_MESSENGER_MemberCallback callback,
784 void* cls); 799 void* cls);
785 800
786#if 0 /* keep Emacsens' auto-indent happy */ 801#if 0 /* keep Emacsens' auto-indent happy */