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.h171
1 files changed, 0 insertions, 171 deletions
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h
deleted file mode 100644
index e6ca474f2..000000000
--- a/src/messenger/messenger_api_handle.h
+++ /dev/null
@@ -1,171 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2021 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_container_lib.h"
32#include "gnunet_crypto_lib.h"
33#include "gnunet_identity_service.h"
34#include "gnunet_peer_lib.h"
35
36#include "gnunet_messenger_service.h"
37
38#include "messenger_api_contact_store.h"
39#include "messenger_api_room.h"
40
41struct GNUNET_MESSENGER_Handle
42{
43 const struct GNUNET_CONFIGURATION_Handle *cfg;
44
45 struct GNUNET_MQ_Handle *mq;
46
47 GNUNET_MESSENGER_IdentityCallback identity_callback;
48 void *identity_cls;
49
50 GNUNET_MESSENGER_MessageCallback msg_callback;
51 void *msg_cls;
52
53 char *name;
54 struct GNUNET_IDENTITY_PublicKey *pubkey;
55
56 struct GNUNET_TIME_Relative reconnect_time;
57 struct GNUNET_SCHEDULER_Task *reconnect_task;
58
59 struct GNUNET_MESSENGER_ContactStore contact_store;
60
61 struct GNUNET_CONTAINER_MultiHashMap *rooms;
62};
63
64/**
65 * Creates and allocates a new handle using a given configuration and a custom message callback
66 * with a given closure for the client API.
67 *
68 * @param[in] cfg Configuration
69 * @param[in] msg_callback Message callback
70 * @param[in/out] msg_cls Closure
71 * @return New handle
72 */
73struct GNUNET_MESSENGER_Handle*
74create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback,
75 void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls);
76
77/**
78 * Destroys a <i>handle</i> and frees its memory fully from the client API.
79 *
80 * @param[in/out] handle Handle
81 */
82void
83destroy_handle (struct GNUNET_MESSENGER_Handle *handle);
84
85/**
86 * Sets the name of a <i>handle</i> to a specific <i>name</i>.
87 *
88 * @param[in/out] handle Handle
89 * @param[in] name New name
90 */
91void
92set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name);
93
94/**
95 * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet.
96 *
97 * @param[in] handle Handle
98 * @return Name of the handle or NULL
99 */
100const char*
101get_handle_name (const struct GNUNET_MESSENGER_Handle *handle);
102
103/**
104 * Sets the public key of a given <i>handle</i> to a specific public key.
105 *
106 * @param[in/out] handle Handle
107 * @param[in] pubkey Public key
108 */
109void
110set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey);
111
112/**
113 * Returns the public key of a given <i>handle</i>.
114 *
115 * @param[in] handle Handle
116 * @return Public key of the handle
117 */
118const struct GNUNET_IDENTITY_PublicKey*
119get_handle_key (const struct GNUNET_MESSENGER_Handle *handle);
120
121/**
122 * Returns the used contact store of a given <i>handle</i>.
123 *
124 * @param[in/out] handle Handle
125 * @return Contact store
126 */
127struct GNUNET_MESSENGER_ContactStore*
128get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle);
129
130/**
131 * Returns the contact of a given <i>handle</i> in a room identified by a
132 * given <i>key</i>.
133 *
134 * @param[in/out] handle Handle
135 * @param[in] key Key of room
136 * @return Contact
137 */
138struct GNUNET_MESSENGER_Contact*
139get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
140
141/**
142 * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open.
143 *
144 * @param[in/out] handle Handle
145 * @param[in] key Key of room
146 */
147void
148open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
149
150/**
151 * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a
152 * list of opened connections.
153 *
154 * @param[in/out] handle Handle
155 * @param[in] door Peer identity
156 * @param[in] key Key of room
157 */
158void
159entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door,
160 const struct GNUNET_HashCode *key);
161
162/**
163 * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>.
164 *
165 * @param[in/out] handle Handle
166 * @param[in] key Key of room
167 */
168void
169close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key);
170
171#endif //GNUNET_MESSENGER_API_HANDLE_H