aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/messenger_api_handle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/messenger_api_handle.h')
-rw-r--r--src/messenger/messenger_api_handle.h69
1 files changed, 33 insertions, 36 deletions
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h
index d6cde0106..e6ca474f2 100644
--- a/src/messenger/messenger_api_handle.h
+++ b/src/messenger/messenger_api_handle.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
@@ -35,7 +35,7 @@
35 35
36#include "gnunet_messenger_service.h" 36#include "gnunet_messenger_service.h"
37 37
38#include "messenger_api_contact.h" 38#include "messenger_api_contact_store.h"
39#include "messenger_api_room.h" 39#include "messenger_api_room.h"
40 40
41struct GNUNET_MESSENGER_Handle 41struct GNUNET_MESSENGER_Handle
@@ -56,17 +56,18 @@ struct GNUNET_MESSENGER_Handle
56 struct GNUNET_TIME_Relative reconnect_time; 56 struct GNUNET_TIME_Relative reconnect_time;
57 struct GNUNET_SCHEDULER_Task *reconnect_task; 57 struct GNUNET_SCHEDULER_Task *reconnect_task;
58 58
59 struct GNUNET_MESSENGER_ContactStore contact_store;
60
59 struct GNUNET_CONTAINER_MultiHashMap *rooms; 61 struct GNUNET_CONTAINER_MultiHashMap *rooms;
60 struct GNUNET_CONTAINER_MultiHashMap *contacts;
61}; 62};
62 63
63/** 64/**
64 * Creates and allocates a new handle using a given configuration and a custom message callback 65 * Creates and allocates a new handle using a given configuration and a custom message callback
65 * with a given closure for the client API. 66 * with a given closure for the client API.
66 * 67 *
67 * @param cfg Configuration 68 * @param[in] cfg Configuration
68 * @param msg_callback Message callback 69 * @param[in] msg_callback Message callback
69 * @param msg_cls Closure 70 * @param[in/out] msg_cls Closure
70 * @return New handle 71 * @return New handle
71 */ 72 */
72struct GNUNET_MESSENGER_Handle* 73struct GNUNET_MESSENGER_Handle*
@@ -76,7 +77,7 @@ create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_I
76/** 77/**
77 * Destroys a <i>handle</i> and frees its memory fully from the client API. 78 * Destroys a <i>handle</i> and frees its memory fully from the client API.
78 * 79 *
79 * @param handle Handle 80 * @param[in/out] handle Handle
80 */ 81 */
81void 82void
82destroy_handle (struct GNUNET_MESSENGER_Handle *handle); 83destroy_handle (struct GNUNET_MESSENGER_Handle *handle);
@@ -84,8 +85,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle);
84/** 85/**
85 * Sets the name of a <i>handle</i> to a specific <i>name</i>. 86 * Sets the name of a <i>handle</i> to a specific <i>name</i>.
86 * 87 *
87 * @param handle Handle 88 * @param[in/out] handle Handle
88 * @param name New name 89 * @param[in] name New name
89 */ 90 */
90void 91void
91set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); 92set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name);
@@ -93,7 +94,7 @@ set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name);
93/** 94/**
94 * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet. 95 * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet.
95 * 96 *
96 * @param handle Handle 97 * @param[in] handle Handle
97 * @return Name of the handle or NULL 98 * @return Name of the handle or NULL
98 */ 99 */
99const char* 100const char*
@@ -102,8 +103,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle);
102/** 103/**
103 * Sets the public key of a given <i>handle</i> to a specific public key. 104 * Sets the public key of a given <i>handle</i> to a specific public key.
104 * 105 *
105 * @param handle Handle 106 * @param[in/out] handle Handle
106 * @param pubkey Public key 107 * @param[in] pubkey Public key
107 */ 108 */
108void 109void
109set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey); 110set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey);
@@ -111,41 +112,37 @@ set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDEN
111/** 112/**
112 * Returns the public key of a given <i>handle</i>. 113 * Returns the public key of a given <i>handle</i>.
113 * 114 *
114 * @param handle Handle 115 * @param[in] handle Handle
115 * @return Public key of the handle 116 * @return Public key of the handle
116 */ 117 */
117const struct GNUNET_IDENTITY_PublicKey* 118const struct GNUNET_IDENTITY_PublicKey*
118get_handle_key (const struct GNUNET_MESSENGER_Handle *handle); 119get_handle_key (const struct GNUNET_MESSENGER_Handle *handle);
119 120
120/** 121/**
121 * Returns a contact known to a <i>handle</i> identified by a given public key. If not matching 122 * Returns the used contact store of a given <i>handle</i>.
122 * contact is found, NULL gets returned.
123 * 123 *
124 * @param handle Handle 124 * @param[in/out] handle Handle
125 * @param pubkey Public key of EGO 125 * @return Contact store
126 * @return Contact or NULL
127 */ 126 */
128struct GNUNET_MESSENGER_Contact* 127struct GNUNET_MESSENGER_ContactStore*
129get_handle_contact_by_pubkey (const struct GNUNET_MESSENGER_Handle *handle, 128get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle);
130 const struct GNUNET_IDENTITY_PublicKey *pubkey);
131 129
132/** 130/**
133 * Changes the public key for a <i>contact</i> known to a <i>handle</i> to a specific public key and 131 * Returns the contact of a given <i>handle</i> in a room identified by a
134 * updates local map entries to access the contact by its updated key. 132 * given <i>key</i>.
135 * 133 *
136 * @param handle Handle 134 * @param[in/out] handle Handle
137 * @param contact Contact 135 * @param[in] key Key of room
138 * @param pubkey Public key of EGO 136 * @return Contact
139 */ 137 */
140void 138struct GNUNET_MESSENGER_Contact*
141swap_handle_contact_by_pubkey (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Contact *contact, 139get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
142 const struct GNUNET_IDENTITY_PublicKey *pubkey);
143 140
144/** 141/**
145 * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open. 142 * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open.
146 * 143 *
147 * @param handle Handle 144 * @param[in/out] handle Handle
148 * @param key Key of room 145 * @param[in] key Key of room
149 */ 146 */
150void 147void
151open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 148open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
@@ -154,9 +151,9 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha
154 * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a 151 * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a
155 * list of opened connections. 152 * list of opened connections.
156 * 153 *
157 * @param handle Handle 154 * @param[in/out] handle Handle
158 * @param door Peer identity 155 * @param[in] door Peer identity
159 * @param key Key of room 156 * @param[in] key Key of room
160 */ 157 */
161void 158void
162entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, 159entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door,
@@ -165,8 +162,8 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE
165/** 162/**
166 * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>. 163 * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>.
167 * 164 *
168 * @param handle Handle 165 * @param[in/out] handle Handle
169 * @param key Key of room 166 * @param[in] key Key of room
170 */ 167 */
171void 168void
172close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); 169close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);