X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Finclude%2Fgnunet_chat_service.h;h=8e77f9b6587cb21db5377389ce72f0ea7a9380b2;hb=6c471eeb15e27f8226492b4860a3c2acb94c5f25;hp=059dff25429dad76efd52f4915c3a350f220dd69;hpb=151801296c4218af91bbdf1f34a7e3bbfe761594;p=oweals%2Fgnunet.git diff --git a/src/include/gnunet_chat_service.h b/src/include/gnunet_chat_service.h index 059dff254..8e77f9b65 100644 --- a/src/include/gnunet_chat_service.h +++ b/src/include/gnunet_chat_service.h @@ -20,7 +20,7 @@ /** * @file include/gnunet_chat_service.h - * @brief API for chatting via GNUnet + * @brief API for chatting via GNUnet * @author Christian Grothoff * @author Nathan Evans * @author Vitaly Minko @@ -47,47 +47,55 @@ extern "C" * Options for messaging. Compatible options can be OR'ed together. */ enum GNUNET_CHAT_MsgOptions - { +{ /** * No special options. */ - GNUNET_CHAT_MSG_OPTION_NONE = 0, - + GNUNET_CHAT_MSG_OPTION_NONE = 0, + /** * Encrypt the message so that only the receiver can decrypt it. */ - GNUNET_CHAT_MSG_PRIVATE = 1, - + GNUNET_CHAT_MSG_PRIVATE = 1, + /** * Hide the identity of the sender. */ - GNUNET_CHAT_MSG_ANONYMOUS = 2, - + GNUNET_CHAT_MSG_ANONYMOUS = 2, + /** * Sign the content, authenticating the sender (using the provided private * key, which may represent a pseudonym). */ - GNUNET_CHAT_MSG_AUTHENTICATED = 4, - + GNUNET_CHAT_MSG_AUTHENTICATED = 4, + /** * Require signed acknowledgment before completing delivery (and of course, * only acknowledge if delivery is guaranteed). */ - GNUNET_CHAT_MSG_ACKNOWLEDGED = 8, - + GNUNET_CHAT_MSG_ACKNOWLEDGED = 8, + /** * Authenticate for the receiver, but ensure that receiver cannot prove * authenticity to third parties later. (not yet implemented) */ - GNUNET_CHAT_MSG_OFF_THE_RECORD = 16, - - }; + GNUNET_CHAT_MSG_OFF_THE_RECORD = 16, + +}; /** * Handle for a (joined) chat room. */ struct GNUNET_CHAT_Room; +/** + * Callback used for notification that we have joined the room. + * + * @param cls closure + * @return GNUNET_OK + */ +typedef int (*GNUNET_CHAT_JoinCallback) (void *cls); + /** * Callback used for notification about incoming messages. * @@ -96,20 +104,26 @@ struct GNUNET_CHAT_Room; * @param sender what is the ID of the sender? (maybe NULL) * @param member_info information about the joining member * @param message the message text + * @param timestamp when was the message sent? * @param options options for the message * @return GNUNET_OK to accept the message now, GNUNET_NO to * accept (but user is away), GNUNET_SYSERR to signal denied delivery */ typedef int (*GNUNET_CHAT_MessageCallback) (void *cls, - struct GNUNET_CHAT_Room *room, - const GNUNET_HashCode *sender, - const struct GNUNET_CONTAINER_MetaData *member_info, - const char *message, - enum GNUNET_CHAT_MsgOptions options); + struct GNUNET_CHAT_Room * room, + const struct GNUNET_HashCode * sender, + const struct + GNUNET_CONTAINER_MetaData * + member_info, const char *message, + struct GNUNET_TIME_Absolute + timestamp, + enum GNUNET_CHAT_MsgOptions + options); /** * Callback used for notification that another room member has joined or left. * + * @param cls closure * @param member_info will be non-null if the member is joining, NULL if he is * leaving * @param member_id hash of public key of the user (for unique identification) @@ -117,9 +131,14 @@ typedef int (*GNUNET_CHAT_MessageCallback) (void *cls, * @return GNUNET_OK */ typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls, - const struct GNUNET_CONTAINER_MetaData *member_info, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *member_id, - enum GNUNET_CHAT_MsgOptions options); + const struct + GNUNET_CONTAINER_MetaData * + member_info, + const struct + GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded + * member_id, + enum GNUNET_CHAT_MsgOptions + options); /** * Callback used for message delivery confirmations. @@ -129,18 +148,16 @@ typedef int (*GNUNET_CHAT_MemberListCallback) (void *cls, * @param orig_seq_number sequence number of the original message * @param timestamp when was the message received? * @param receiver who is confirming the receipt? - * @param msg_hash hash of the original message - * @param receipt signature confirming delivery * @return GNUNET_OK to continue, GNUNET_SYSERR to refuse processing further * confirmations from anyone for this message */ typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, - struct GNUNET_CHAT_Room *room, - uint32_t orig_seq_number, - struct GNUNET_TIME_Absolute timestamp, - const GNUNET_HashCode *receiver, - const GNUNET_HashCode *msg_hash, - const struct GNUNET_CRYPTO_RsaSignature *receipt); + struct GNUNET_CHAT_Room * room, + uint32_t orig_seq_number, + struct GNUNET_TIME_Absolute + timestamp, + const struct GNUNET_HashCode * + receiver); /** * Join a chat room. @@ -153,6 +170,8 @@ typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, * @param member_info information about the joining member * @param room_name name of the room * @param msg_options message options of the joining user + * @param joinCallback which function to call when we've joined the room + * @param join_cls argument to callback * @param messageCallback which function to call if a message has * been received? * @param message_cls argument to callback @@ -166,17 +185,17 @@ typedef int (*GNUNET_CHAT_MessageConfirmation) (void *cls, */ struct GNUNET_CHAT_Room * GNUNET_CHAT_join_room (const struct GNUNET_CONFIGURATION_Handle *cfg, - const char *nick_name, - struct GNUNET_CONTAINER_MetaData *member_info, - const char *room_name, - enum GNUNET_CHAT_MsgOptions msg_options, - GNUNET_CHAT_MessageCallback messageCallback, - void *message_cls, - GNUNET_CHAT_MemberListCallback memberCallback, - void *member_cls, - GNUNET_CHAT_MessageConfirmation confirmationCallback, - void *confirmation_cls, - GNUNET_HashCode *me); + const char *nick_name, + struct GNUNET_CONTAINER_MetaData *member_info, + const char *room_name, + enum GNUNET_CHAT_MsgOptions msg_options, + GNUNET_CHAT_JoinCallback joinCallback, void *join_cls, + GNUNET_CHAT_MessageCallback messageCallback, + void *message_cls, + GNUNET_CHAT_MemberListCallback memberCallback, + void *member_cls, + GNUNET_CHAT_MessageConfirmation confirmationCallback, + void *confirmation_cls, struct GNUNET_HashCode * me); /** * Send a message. @@ -188,11 +207,10 @@ GNUNET_CHAT_join_room (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param sequence_number where to write the sequence id of the message */ void -GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, - const char *message, - enum GNUNET_CHAT_MsgOptions options, - const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *receiver, - uint32_t *sequence_number); +GNUNET_CHAT_send_message (struct GNUNET_CHAT_Room *room, const char *message, + enum GNUNET_CHAT_MsgOptions options, + const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded + *receiver, uint32_t * sequence_number); /** @@ -209,16 +227,17 @@ GNUNET_CHAT_leave_room (struct GNUNET_CHAT_Room *chat_room); * * @return GNUNET_OK to continue, GNUNET_SYSERR to abort iteration */ -typedef int (*GNUNET_CHAT_RoomIterator) (const char *room, - const char *topic, void *cls); +typedef int (*GNUNET_CHAT_RoomIterator) (const char *room, const char *topic, + void *cls); /** * List all of the (publically visible) chat rooms. * @return number of rooms on success, GNUNET_SYSERR if iterator aborted */ -int GNUNET_CHAT_list_rooms (struct GNUNET_GE_Context *ectx, - struct GNUNET_GC_Configuration *cfg, - GNUNET_CHAT_RoomIterator it, void *cls); +int +GNUNET_CHAT_list_rooms (struct GNUNET_GE_Context *ectx, + struct GNUNET_GC_Configuration *cfg, + GNUNET_CHAT_RoomIterator it, void *cls); #endif