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.h193
1 files changed, 0 insertions, 193 deletions
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h
deleted file mode 100644
index 2a97a45db..000000000
--- a/src/messenger/messenger_api_handle.h
+++ /dev/null
@@ -1,193 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2023 GNUnet e.V.
4
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
7 by the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details.
14
15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 SPDX-License-Identifier: AGPL3.0-or-later
19 */
20/**
21 * @author Tobias Frisch
22 * @file src/messenger/messenger_api_handle.h
23 * @brief messenger api: client implementation of GNUnet MESSENGER service
24 */
25
26#ifndef GNUNET_MESSENGER_API_HANDLE_H
27#define GNUNET_MESSENGER_API_HANDLE_H
28
29#include "platform.h"
30#include "gnunet_cadet_service.h"
31#include "gnunet_util_lib.h"
32#include "gnunet_identity_service.h"
33
34#include "gnunet_messenger_service.h"
35
36#include "messenger_api_contact_store.h"
37
38struct GNUNET_MESSENGER_Handle
39{
40 const struct GNUNET_CONFIGURATION_Handle *cfg;
41
42 struct GNUNET_MQ_Handle *mq;
43
44 GNUNET_MESSENGER_MessageCallback msg_callback;
45 void *msg_cls;
46
47 char *name;
48 struct GNUNET_IDENTITY_PrivateKey *key;
49 struct GNUNET_IDENTITY_PublicKey *pubkey;
50
51 struct GNUNET_TIME_Relative reconnect_time;
52 struct GNUNET_SCHEDULER_Task *reconnect_task;
53
54 struct GNUNET_MESSENGER_ContactStore contact_store;
55
56 struct GNUNET_CONTAINER_MultiHashMap *rooms;
57};
58
59/**
60 * Creates and allocates a new handle using a given configuration and a custom message callback
61 * with a given closure for the client API.
62 *
63 * @param[in] cfg Configuration
64 * @param[in] msg_callback Message callback
65 * @param[in,out] msg_cls Closure
66 * @return New handle
67 */
68struct GNUNET_MESSENGER_Handle*
69create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg,
70 GNUNET_MESSENGER_MessageCallback msg_callback,
71 void *msg_cls);
72
73/**
74 * Destroys a <i>handle</i> and frees its memory fully from the client API.
75 *
76 * @param[in,out] handle Handle
77 */
78void
79destroy_handle (struct GNUNET_MESSENGER_Handle *handle);
80
81/**
82 * Sets the name of a <i>handle</i> to a specific <i>name</i>.
83 *
84 * @param[in,out] handle Handle
85 * @param[in] name New name
86 */
87void
88set_handle_name (struct GNUNET_MESSENGER_Handle *handle,
89 const char *name);
90
91/**
92 * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet.
93 *
94 * @param[in] handle Handle
95 * @return Name of the handle or NULL
96 */
97const char*
98get_handle_name (const struct GNUNET_MESSENGER_Handle *handle);
99
100/**
101 * Sets the keypair of a given <i>handle</i> to the keypair of a specific private <i>key</i>.
102 *
103 * @param[in,out] handle Handle
104 * @param[in] key Private key or NULL
105 */
106void
107set_handle_key (struct GNUNET_MESSENGER_Handle *handle,
108 const struct GNUNET_IDENTITY_PrivateKey *key);
109
110/**
111 * Returns the private key of a given <i>handle</i>.
112 *
113 * @param[in] handle Handle
114 * @return Private key of the handle
115 */
116const struct GNUNET_IDENTITY_PrivateKey*
117get_handle_key (const struct GNUNET_MESSENGER_Handle *handle);
118
119/**
120 * Returns the public key of a given <i>handle</i>.
121 *
122 * @param[in] handle Handle
123 * @return Public key of the handle
124 */
125const struct GNUNET_IDENTITY_PublicKey*
126get_handle_pubkey (const struct GNUNET_MESSENGER_Handle *handle);
127
128/**
129 * Returns the used contact store of a given <i>handle</i>.
130 *
131 * @param[in,out] handle Handle
132 * @return Contact store
133 */
134struct GNUNET_MESSENGER_ContactStore*
135get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle);
136
137/**
138 * Returns the contact of a given <i>handle</i> in a room identified by a
139 * given <i>key</i>.
140 *
141 * @param[in,out] handle Handle
142 * @param[in] key Key of room
143 * @return Contact
144 */
145struct GNUNET_MESSENGER_Contact*
146get_handle_contact (struct GNUNET_MESSENGER_Handle *handle,
147 const struct GNUNET_HashCode *key);
148
149/**
150 * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open.
151 *
152 * @param[in,out] handle Handle
153 * @param[in] key Key of room
154 */
155void
156open_handle_room (struct GNUNET_MESSENGER_Handle *handle,
157 const struct GNUNET_HashCode *key);
158
159/**
160 * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a
161 * list of opened connections.
162 *
163 * @param[in,out] handle Handle
164 * @param[in] door Peer identity
165 * @param[in] key Key of room
166 */
167void
168entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle,
169 const struct GNUNET_PeerIdentity *door,
170 const struct GNUNET_HashCode *key);
171
172/**
173 * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>.
174 *
175 * @param[in,out] handle Handle
176 * @param[in] key Key of room
177 */
178void
179close_handle_room (struct GNUNET_MESSENGER_Handle *handle,
180 const struct GNUNET_HashCode *key);
181
182/**
183 * Returns the room known to a <i>handle</i> identified by a given <i>key</i>.
184 *
185 * @param[in,out] handle handle Handle
186 * @param[in] key Key of room
187 * @return Room or NULL
188 */
189struct GNUNET_MESSENGER_Room*
190get_handle_room (struct GNUNET_MESSENGER_Handle *handle,
191 const struct GNUNET_HashCode *key);
192
193#endif //GNUNET_MESSENGER_API_HANDLE_H