Instant messaging based on the CADET subsystem. More...
Data Structures | |
struct | GNUNET_MESSENGER_RoomEntryRecord |
A room entry record specifies which peer is hosting a given room and may also specify the key to enter it. More... | |
struct | GNUNET_MESSENGER_RoomDetailsRecord |
A room details record specifies a custom name for a given room and some additional space for flags. More... | |
struct | GNUNET_MESSENGER_MessageHeader |
The header of a GNUNET_MESSENGER_Message. More... | |
struct | GNUNET_MESSENGER_MessageInfo |
An info message body. More... | |
struct | GNUNET_MESSENGER_MessageJoin |
A join message body. More... | |
struct | GNUNET_MESSENGER_MessageLeave |
A leave message body. More... | |
struct | GNUNET_MESSENGER_MessageName |
A name message body. More... | |
struct | GNUNET_MESSENGER_MessageKey |
A key message body. More... | |
struct | GNUNET_MESSENGER_MessagePeer |
A peer message body. More... | |
struct | GNUNET_MESSENGER_MessageId |
An id message body. More... | |
struct | GNUNET_MESSENGER_MessageMiss |
A miss message body. More... | |
struct | GNUNET_MESSENGER_MessageMerge |
A merge message body. More... | |
struct | GNUNET_MESSENGER_MessageRequest |
A request message body. More... | |
struct | GNUNET_MESSENGER_MessageInvite |
An invite message body. More... | |
struct | GNUNET_MESSENGER_MessageText |
A text message body. More... | |
struct | GNUNET_MESSENGER_MessageFile |
A file message body. More... | |
struct | GNUNET_MESSENGER_MessagePrivate |
A private message body. More... | |
struct | GNUNET_MESSENGER_MessageDelete |
A delete message body This allows deletion of an own previous message with any custom automatic delay. More... | |
struct | GNUNET_MESSENGER_MessageConnection |
A connection message body This allows to tell others about connection information about a peer. More... | |
struct | GNUNET_MESSENGER_MessageTicket |
A ticket message body This allows to exchange ticket identifiers with an audience. More... | |
struct | GNUNET_MESSENGER_MessageTranscript |
A transcript message body This allows reading the content of a sent private message. More... | |
struct | GNUNET_MESSENGER_MessageTag |
A tag message body This allows tagging a message with a custom tag. More... | |
struct | GNUNET_MESSENGER_MessageSubscribe |
A subscribe message body This allows subscribing to a discourse. More... | |
struct | GNUNET_MESSENGER_MessageTalk |
A talk message body This allows talking in a discourse. More... | |
struct | GNUNET_MESSENGER_MessageBody |
The unified body of a GNUNET_MESSENGER_Message. More... | |
struct | GNUNET_MESSENGER_Message |
Struct to a message. More... | |
Macros | |
#define | GNUNET_MESSENGER_VERSION 0x00000005 |
Version number of GNUnet Messenger API. More... | |
#define | GNUNET_MESSENGER_SERVICE_NAME "messenger" |
Identifier of GNUnet MESSENGER Service. More... | |
#define | GNUNET_MESSENGER_KIND_MAX (GNUNET_MESSENGER_KIND_TALK) |
Typedefs | |
typedef void(* | GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags) |
Method called whenever a message is sent or received from a room. More... | |
typedef enum GNUNET_GenericReturnValue(* | GNUNET_MESSENGER_MemberCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) |
Method called for each member in a room during iteration. More... | |
Functions | |
const char * | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) |
Get the name of a message kind. More... | |
struct GNUNET_MESSENGER_Handle * | GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, const struct GNUNET_CRYPTO_PrivateKey *key, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) |
Set up a handle for the messenger related functions and connects to all necessary services. More... | |
void | GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle) |
Disconnect all of the messengers used services and clears up its used memory. More... | |
const char * | GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle) |
Get the name (if specified, otherwise NULL) used by the messenger. More... | |
enum GNUNET_GenericReturnValue | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) |
Set the name for the messenger handle and sends messages renaming your contact in currently open rooms. More... | |
const struct GNUNET_CRYPTO_PublicKey * | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle) |
Get the public key used by the messenger or NULL if the anonymous key was used. More... | |
enum GNUNET_GenericReturnValue | GNUNET_MESSENGER_set_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_CRYPTO_PrivateKey *key) |
Set the private key used by the messenger or NULL if the anonymous key should be used instead. More... | |
struct GNUNET_MESSENGER_Room * | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
Open a room to send and receive messages. More... | |
struct GNUNET_MESSENGER_Room * | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) |
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room. More... | |
void | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room) |
Close a room which was entered, opened or both in various order and variety. More... | |
int | GNUNET_MESSENGER_find_rooms (const struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_MESSENGER_Contact *contact, GNUNET_MESSENGER_MemberCallback callback, void *cls) |
Searches for a specific contact in a given room and calls a selected callback with a given closure for each of them containing the contact as a member. More... | |
const struct GNUNET_HashCode * | GNUNET_MESSENGER_room_get_key (const struct GNUNET_MESSENGER_Room *room) |
Get the key of a given room. More... | |
const struct GNUNET_MESSENGER_Contact * | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Get the contact of a member in a room which sent a specific message identified with a given hash. More... | |
const struct GNUNET_MESSENGER_Contact * | GNUNET_MESSENGER_get_recipient (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Get the contact of a member in a room which has been targeted as recipient of a specific message identified with a given hash. More... | |
const char * | GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contact) |
Get the name used by the contact. More... | |
const struct GNUNET_CRYPTO_PublicKey * | GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact) |
Get the public key used by the contact or NULL if the anonymous key was used. More... | |
size_t | GNUNET_MESSENGER_contact_get_id (const struct GNUNET_MESSENGER_Contact *contact) |
Get the locally unique id of the contact. More... | |
void | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_MESSENGER_Contact *contact) |
Send a message into a room. More... | |
void | GNUNET_MESSENGER_delete_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
Delete a message identified by its hash from a room. More... | |
const struct GNUNET_MESSENGER_Message * | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
Get the message in a room identified by its hash. More... | |
int | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, void *cls) |
Iterates through all members of a given room and calls a selected callback for each of them with a provided closure. More... | |
Instant messaging based on the CADET subsystem.
#define GNUNET_MESSENGER_VERSION 0x00000005 |
Version number of GNUnet Messenger API.
Current version of the Messenger: 0.5
Definition at line 49 of file gnunet_messenger_service.h.
#define GNUNET_MESSENGER_SERVICE_NAME "messenger" |
Identifier of GNUnet MESSENGER Service.
Definition at line 54 of file gnunet_messenger_service.h.
#define GNUNET_MESSENGER_KIND_MAX (GNUNET_MESSENGER_KIND_TALK) |
Definition at line 229 of file gnunet_messenger_service.h.
typedef void(* GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, const struct GNUNET_MESSENGER_Contact *recipient, const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, enum GNUNET_MESSENGER_MessageFlags flags) |
Method called whenever a message is sent or received from a room.
The flags will indicate with a bitmask if a message was received privately or if the message was sent by the client.
[in/out] | cls Closure from GNUNET_MESSENGER_connect | |
[in] | room | Room handle |
[in] | sender | Sender of message |
[in] | recipient | Recipient of message |
[in] | message | Newly received or sent message |
[in] | hash | Hash identifying the message |
[in] | flags | Flags of the message |
Definition at line 790 of file gnunet_messenger_service.h.
typedef enum GNUNET_GenericReturnValue(* GNUNET_MESSENGER_MemberCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *contact) |
Method called for each member in a room during iteration.
If the method returns GNUNET_YES the iteration continues, otherwise it will quit the iteration.
[in/out] | cls Closure from GNUNET_MESSENGER_iterate_members | |
[in] | room | Room handle |
[in] | contact | Contact handle |
Definition at line 790 of file gnunet_messenger_service.h.
Enum for the different supported kinds of messages.
Enumerator | |
---|---|
GNUNET_MESSENGER_KIND_INFO | The info kind. The message contains a GNUNET_MESSENGER_MessageInfo body. |
GNUNET_MESSENGER_KIND_JOIN | The join kind. The message contains a GNUNET_MESSENGER_MessageJoin body. |
GNUNET_MESSENGER_KIND_LEAVE | The leave kind. The message contains a GNUNET_MESSENGER_MessageLeave body. |
GNUNET_MESSENGER_KIND_NAME | The name kind. The message contains a GNUNET_MESSENGER_MessageName body. |
GNUNET_MESSENGER_KIND_KEY | The key kind. The message contains a GNUNET_MESSENGER_MessageKey body. |
GNUNET_MESSENGER_KIND_PEER | The peer kind. The message contains a GNUNET_MESSENGER_MessagePeer body. |
GNUNET_MESSENGER_KIND_ID | The id kind. The message contains a GNUNET_MESSENGER_MessageId body. |
GNUNET_MESSENGER_KIND_MISS | The miss kind. The message contains a GNUNET_MESSENGER_MessageMiss body. |
GNUNET_MESSENGER_KIND_MERGE | The merge kind. The message contains a GNUNET_MESSENGER_MessageMerge body. |
GNUNET_MESSENGER_KIND_REQUEST | The request kind. The message contains a GNUNET_MESSENGER_MessageRequest body. |
GNUNET_MESSENGER_KIND_INVITE | The invite kind. The message contains a GNUNET_MESSENGER_MessageInvite body. |
GNUNET_MESSENGER_KIND_TEXT | The text kind. The message contains a GNUNET_MESSENGER_MessageText body. |
GNUNET_MESSENGER_KIND_FILE | The file kind. The message contains a GNUNET_MESSENGER_MessageFile body. |
GNUNET_MESSENGER_KIND_PRIVATE | The private kind. The message contains a GNUNET_MESSENGER_MessagePrivate body. |
GNUNET_MESSENGER_KIND_DELETE | The delete kind. The message contains a GNUNET_MESSENGER_MessageDelete body. |
GNUNET_MESSENGER_KIND_CONNECTION | The connection kind. The message contains a GNUNET_MESSENGER_MessageConnection body. |
GNUNET_MESSENGER_KIND_TICKET | The ticket kind. The message contains a GNUNET_MESSENGER_MessageTicket body. |
GNUNET_MESSENGER_KIND_TRANSCRIPT | The transcript kind. The message contains a GNUNET_MESSENGER_MessageTranscript body. |
GNUNET_MESSENGER_KIND_TAG | The tag kind. The message contains a GNUNET_MESSENGER_MessageTag body. |
GNUNET_MESSENGER_KIND_SUBSCRIBE | The subscribe kind. The message contains a GNUNET_MESSENGER_MessageSubscribe body. |
GNUNET_MESSENGER_KIND_TALK | The talk kind. The message contains a GNUNET_MESSENGER_MessageTalk body. |
GNUNET_MESSENGER_KIND_UNKNOWN | The unknown kind. The message contains an unknown body. |
Definition at line 116 of file gnunet_messenger_service.h.
Enum for the different supported flags used by message handling.
Compatible flags can be OR'ed together.
Definition at line 699 of file gnunet_messenger_service.h.
Enum for the different supported flags used to specify connection handling.
Compatible flags can be OR'ed together.
Definition at line 741 of file gnunet_messenger_service.h.
Enum for the different supported flags used to specify subscribtion handling.
Compatible flags can be OR'ed together.
Definition at line 758 of file gnunet_messenger_service.h.
const char * GNUNET_MESSENGER_name_of_kind | ( | enum GNUNET_MESSENGER_MessageKind | kind | ) |
Get the name of a message kind.
kind | Kind of a message |
Definition at line 44 of file messenger_api.c.
References GNUNET_MESSENGER_KIND_CONNECTION, GNUNET_MESSENGER_KIND_DELETE, GNUNET_MESSENGER_KIND_FILE, GNUNET_MESSENGER_KIND_ID, GNUNET_MESSENGER_KIND_INFO, GNUNET_MESSENGER_KIND_INVITE, GNUNET_MESSENGER_KIND_JOIN, GNUNET_MESSENGER_KIND_KEY, GNUNET_MESSENGER_KIND_LEAVE, GNUNET_MESSENGER_KIND_MERGE, GNUNET_MESSENGER_KIND_MISS, GNUNET_MESSENGER_KIND_NAME, GNUNET_MESSENGER_KIND_PEER, GNUNET_MESSENGER_KIND_PRIVATE, GNUNET_MESSENGER_KIND_REQUEST, GNUNET_MESSENGER_KIND_SUBSCRIBE, GNUNET_MESSENGER_KIND_TAG, GNUNET_MESSENGER_KIND_TALK, GNUNET_MESSENGER_KIND_TEXT, GNUNET_MESSENGER_KIND_TICKET, and GNUNET_MESSENGER_KIND_TRANSCRIPT.
Referenced by check_send_message(), handle_recv_message(), handle_send_message(), handle_service_message(), handle_tunnel_message(), notify_srv_handle_message(), on_message(), send_srv_room_message(), and verify_tunnel_message().
struct GNUNET_MESSENGER_Handle * GNUNET_MESSENGER_connect | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const char * | name, | ||
const struct GNUNET_CRYPTO_PrivateKey * | key, | ||
GNUNET_MESSENGER_MessageCallback | msg_callback, | ||
void * | msg_cls | ||
) |
Set up a handle for the messenger related functions and connects to all necessary services.
It will use the a custom name in combination of a private key provided for signing all messages from the handle.
[in] | cfg | Configuration to use |
[in] | name | Name or NULL |
[in] | key | Private key or NULL to stay anonymous |
[in] | msg_callback | Function called when a new message is sent or received |
[in,out] | msg_cls | Closure for the msg_callback handler |
Definition at line 676 of file messenger_api.c.
References cfg, create_handle(), destroy_handle(), env, GNUNET_assert, GNUNET_CRYPTO_private_key_get_length(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_CREATE, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, key, GNUNET_VPN_Handle::mq, msg, GNUNET_MESSENGER_Handle::msg_callback, GNUNET_MESSENGER_Handle::msg_cls, name, reconnect(), set_handle_key(), and set_handle_name().
Referenced by on_ego_lookup(), run(), and start_service_run().
void GNUNET_MESSENGER_disconnect | ( | struct GNUNET_MESSENGER_Handle * | handle | ) |
Disconnect all of the messengers used services and clears up its used memory.
[in,out] | handle | Messenger handle to use |
Definition at line 715 of file messenger_api.c.
References destroy_handle(), env, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_DESTROY, GNUNET_MQ_msg, GNUNET_MQ_send(), handle, GNUNET_VPN_Handle::mq, and msg.
Referenced by shutdown_hook(), and stop_service_run().
const char * GNUNET_MESSENGER_get_name | ( | const struct GNUNET_MESSENGER_Handle * | handle | ) |
Get the name (if specified, otherwise NULL) used by the messenger.
[in] | handle | Messenger handle to use |
Definition at line 1050 of file messenger_api.c.
References get_handle_name(), and handle.
Referenced by on_identity(), and on_message().
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_name | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const char * | name | ||
) |
Set the name for the messenger handle and sends messages renaming your contact in currently open rooms.
[in,out] | handle | Messenger handle to use |
[in] | name | Name for the messenger to change to |
Definition at line 1089 of file messenger_api.c.
References GNUNET_MESSENGER_find_rooms(), GNUNET_SYSERR, GNUNET_YES, handle, iterate_send_name_to_room(), name, and set_handle_name().
const struct GNUNET_CRYPTO_PublicKey * GNUNET_MESSENGER_get_key | ( | const struct GNUNET_MESSENGER_Handle * | handle | ) |
Get the public key used by the messenger or NULL if the anonymous key was used.
[in] | handle | Messenger handle to use |
Definition at line 1112 of file messenger_api.c.
References get_handle_pubkey(), get_non_anonymous_key(), and handle.
enum GNUNET_GenericReturnValue GNUNET_MESSENGER_set_key | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_CRYPTO_PrivateKey * | key | ||
) |
Set the private key used by the messenger or NULL if the anonymous key should be used instead.
The currently used key will be replaced and the change will get signed accordingly to be verified by all contacts.
[in,out] | handle | Messenger handle to use |
[in] | key | Private key to change to or NULL |
Definition at line 1143 of file messenger_api.c.
References GNUNET_CRYPTO_private_key_clear(), GNUNET_CRYPTO_private_key_get_length(), GNUNET_memcpy, GNUNET_MESSENGER_find_rooms(), GNUNET_SYSERR, GNUNET_YES, handle, iterate_send_key_to_room(), key, and set_handle_key().
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_open_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_HashCode * | key | ||
) |
Open a room to send and receive messages.
The room will use the specified key as port for the underlying cadet service. Opening a room results in opening the port for incoming connections as possible door.
Notice that there can only be one room related to a specific key. So trying to open two rooms with the same key will result in opening the room once but returning the handle both times because the room stays open.
You can also open a room after entering it through a door using GNUNET_MESSENGER_enter_room. This will notify all entered doors to list you as new door.
( All doors form a ring structured network to shorten the latency sending and receiving messages. )
[in,out] | handle | Messenger handle to use |
[in] | key | Hash identifying the port |
Definition at line 1173 of file messenger_api.c.
References create_room(), destroy_room(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_OK, handle, key, and send_open_room().
Referenced by join_room_run(), and on_identity().
struct GNUNET_MESSENGER_Room * GNUNET_MESSENGER_enter_room | ( | struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_PeerIdentity * | door, | ||
const struct GNUNET_HashCode * | key | ||
) |
Enter a room to send and receive messages through a door opened using GNUNET_MESSENGER_open_room.
Notice that there can only be one room related to a specific key. So trying to enter two rooms with the same key will result in entering the room once but returning the handle both times because the room stays entered. You can however enter a room through multiple doors in parallel which results in connecting both ends. But entering the room through the same door won't have any effect after the first time.
You can also enter a room through a door after opening it using GNUNET_MESSENGER_open_room. But the door may not be your own peer identity.
( All doors form a ring structured network to shorten the latency sending and receiving messages. )
[in,out] | handle | Messenger handle to use |
[in] | door | Peer identity of an open door |
[in] | key | Hash identifying the port |
Definition at line 1201 of file messenger_api.c.
References create_room(), destroy_room(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_OK, handle, key, and send_enter_room().
Referenced by join_room_run(), and on_identity().
void GNUNET_MESSENGER_close_room | ( | struct GNUNET_MESSENGER_Room * | room | ) |
Close a room which was entered, opened or both in various order and variety.
Closing a room will destroy all connections from your peer to another and the other way around.
( After a member closes a door, all members entered through that specific door have to use another one or open the room on their own. )
[in,out] | room | Room handle |
Definition at line 1230 of file messenger_api.c.
References create_message_leave(), and enqueue_message_to_room().
Referenced by shutdown_hook().
int GNUNET_MESSENGER_find_rooms | ( | const struct GNUNET_MESSENGER_Handle * | handle, |
const struct GNUNET_MESSENGER_Contact * | contact, | ||
GNUNET_MESSENGER_MemberCallback | callback, | ||
void * | cls | ||
) |
Searches for a specific contact in a given room and calls a selected callback with a given closure for each of them containing the contact as a member.
The callback will receive a room matching the condition and the given contact. The function returns the amount of rooms iterated with the given callback.
[in] | handle | Messenger handle to use |
[in] | contact | Contact handle |
[in] | callback | Function called for each room |
[in] | cls | Closure for the callback handler |
Definition at line 1286 of file messenger_api.c.
References GNUNET_MESSENGER_RoomFind::callback, GNUNET_MESSENGER_RoomFind::cls, GNUNET_MESSENGER_RoomFind::contact, GNUNET_MESSENGER_RoomFind::counter, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_SYSERR, handle, iterate_find_room(), GNUNET_MESSENGER_Contact::rc, and SIZE_MAX.
Referenced by GNUNET_MESSENGER_set_key(), and GNUNET_MESSENGER_set_name().
const struct GNUNET_HashCode * GNUNET_MESSENGER_room_get_key | ( | const struct GNUNET_MESSENGER_Room * | room | ) |
Get the key of a given room.
[in] | room | Room handle |
Definition at line 1307 of file messenger_api.c.
References GNUNET_MESSENGER_Room::key.
Referenced by on_message_cb().
const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_sender | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Get the contact of a member in a room which sent a specific message identified with a given hash.
Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed.
[in] | room | Room handle |
[in] | hash | Hash identifying a message |
Definition at line 1317 of file messenger_api.c.
References get_room_sender().
const struct GNUNET_MESSENGER_Contact * GNUNET_MESSENGER_get_recipient | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Get the contact of a member in a room which has been targeted as recipient of a specific message identified with a given hash.
Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed.
[in] | room | Room handle |
[in] | hash | Hash identifying a message |
Definition at line 1328 of file messenger_api.c.
References get_room_recipient().
const char * GNUNET_MESSENGER_contact_get_name | ( | const struct GNUNET_MESSENGER_Contact * | contact | ) |
Get the name used by the contact.
[in] | contact | Contact handle |
Definition at line 1339 of file messenger_api.c.
References get_contact_name().
Referenced by on_message().
const struct GNUNET_CRYPTO_PublicKey * GNUNET_MESSENGER_contact_get_key | ( | const struct GNUNET_MESSENGER_Contact * | contact | ) |
Get the public key used by the contact or NULL if the anonymous key was used.
[in] | contact | Contact handle |
Definition at line 1350 of file messenger_api.c.
References get_contact_key(), and get_non_anonymous_key().
Referenced by iterate_send_private_message().
size_t GNUNET_MESSENGER_contact_get_id | ( | const struct GNUNET_MESSENGER_Contact * | contact | ) |
Get the locally unique id of the contact.
[in] | contact | Contact handle |
Definition at line 1361 of file messenger_api.c.
References get_contact_id().
void GNUNET_MESSENGER_send_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_MESSENGER_Message * | message, | ||
const struct GNUNET_MESSENGER_Contact * | contact | ||
) |
Send a message into a room.
If you opened the room all entered members will receive the message. If you entered the room through a door all so entered doors will receive the message as well. All members receiving the message will also propagate this message recursively as long as the message is unknown to them.
Notice that all messages sent and received are also stored and can be propagated to new members entering the room.
If you provide a specific contact as receiver of the given message, the message will automatically be encrypted and sent as a private message (see GNUNET_MESSENGER_MessagePrivate). Therefore the selected contact will be the only member receiving the actual message.
Sending a message to all members in a given room can be done by providing NULL as contact.
[in,out] | room | Room handle |
[in,out] | message | New message to send |
[in] | contact | Contact or NULL |
Definition at line 1429 of file messenger_api.c.
References copy_message(), filter_message_sending(), get_contact_key(), get_non_anonymous_key(), GNUNET_ERROR_TYPE_ERROR, GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_NO, GNUNET_SYSERR, and send_message_to_room_with_key().
Referenced by iterate_send_private_message(), on_message(), and read_stdio().
void GNUNET_MESSENGER_delete_message | ( | struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash, | ||
const struct GNUNET_TIME_Relative | delay | ||
) |
Delete a message identified by its hash from a room.
A deletion will be propagated to all members of the room as with any other sent message. Notice that a deletion will only request other members of the room to delete the selected message. If you are not permitted to delete the message, the deletion will be ignored.
Depending on the implementation other clients may also ignore your deletion request in other circumstances.
[in,out] | room | Room handle |
[in] | message | Message to delete |
[in] | delay | Delay to delete the message |
Definition at line 1473 of file messenger_api.c.
References delete_room_message().
const struct GNUNET_MESSENGER_Message * GNUNET_MESSENGER_get_message | ( | const struct GNUNET_MESSENGER_Room * | room, |
const struct GNUNET_HashCode * | hash | ||
) |
Get the message in a room identified by its hash.
[in] | room | Room handle |
[in] | hash | Hash identifying a message |
Definition at line 1485 of file messenger_api.c.
References env, get_room_message(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_MESSENGER_Room::handle, GNUNET_MESSENGER_Room::key, GNUNET_MESSENGER_Handle::mq, and msg.
int GNUNET_MESSENGER_iterate_members | ( | struct GNUNET_MESSENGER_Room * | room, |
GNUNET_MESSENGER_MemberCallback | callback, | ||
void * | cls | ||
) |
Iterates through all members of a given room and calls a selected callback for each of them with a provided closure.
The callback will receive the contact of each member. The function returns the amount of members iterated with the given callback.
[in] | room | Room handle |
[in] | callback | Function called for each member |
[in] | cls | Closure for the callback handler |
Definition at line 1514 of file messenger_api.c.
References GNUNET_SYSERR, and iterate_room_members().
Referenced by read_stdio().