diff options
Diffstat (limited to 'src/messenger/messenger_api_handle.h')
-rw-r--r-- | src/messenger/messenger_api_handle.h | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h deleted file mode 100644 index 6a43f13a6..000000000 --- a/src/messenger/messenger_api_handle.h +++ /dev/null | |||
@@ -1,180 +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 | |||
41 | struct 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 | */ | ||
73 | struct GNUNET_MESSENGER_Handle* | ||
74 | create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
75 | GNUNET_MESSENGER_IdentityCallback identity_callback, | ||
76 | void *identity_cls, | ||
77 | GNUNET_MESSENGER_MessageCallback msg_callback, | ||
78 | void *msg_cls); | ||
79 | |||
80 | /** | ||
81 | * Destroys a <i>handle</i> and frees its memory fully from the client API. | ||
82 | * | ||
83 | * @param[in/out] handle Handle | ||
84 | */ | ||
85 | void | ||
86 | destroy_handle (struct GNUNET_MESSENGER_Handle *handle); | ||
87 | |||
88 | /** | ||
89 | * Sets the name of a <i>handle</i> to a specific <i>name</i>. | ||
90 | * | ||
91 | * @param[in/out] handle Handle | ||
92 | * @param[in] name New name | ||
93 | */ | ||
94 | void | ||
95 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, | ||
96 | const char *name); | ||
97 | |||
98 | /** | ||
99 | * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet. | ||
100 | * | ||
101 | * @param[in] handle Handle | ||
102 | * @return Name of the handle or NULL | ||
103 | */ | ||
104 | const char* | ||
105 | get_handle_name (const struct GNUNET_MESSENGER_Handle *handle); | ||
106 | |||
107 | /** | ||
108 | * Sets the public key of a given <i>handle</i> to a specific public key. | ||
109 | * | ||
110 | * @param[in/out] handle Handle | ||
111 | * @param[in] pubkey Public key | ||
112 | */ | ||
113 | void | ||
114 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, | ||
115 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
116 | |||
117 | /** | ||
118 | * Returns the public key of a given <i>handle</i>. | ||
119 | * | ||
120 | * @param[in] handle Handle | ||
121 | * @return Public key of the handle | ||
122 | */ | ||
123 | const struct GNUNET_IDENTITY_PublicKey* | ||
124 | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle); | ||
125 | |||
126 | /** | ||
127 | * Returns the used contact store of a given <i>handle</i>. | ||
128 | * | ||
129 | * @param[in/out] handle Handle | ||
130 | * @return Contact store | ||
131 | */ | ||
132 | struct GNUNET_MESSENGER_ContactStore* | ||
133 | get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle); | ||
134 | |||
135 | /** | ||
136 | * Returns the contact of a given <i>handle</i> in a room identified by a | ||
137 | * given <i>key</i>. | ||
138 | * | ||
139 | * @param[in/out] handle Handle | ||
140 | * @param[in] key Key of room | ||
141 | * @return Contact | ||
142 | */ | ||
143 | struct GNUNET_MESSENGER_Contact* | ||
144 | get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, | ||
145 | const struct GNUNET_HashCode *key); | ||
146 | |||
147 | /** | ||
148 | * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open. | ||
149 | * | ||
150 | * @param[in/out] handle Handle | ||
151 | * @param[in] key Key of room | ||
152 | */ | ||
153 | void | ||
154 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, | ||
155 | const struct GNUNET_HashCode *key); | ||
156 | |||
157 | /** | ||
158 | * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a | ||
159 | * list of opened connections. | ||
160 | * | ||
161 | * @param[in/out] handle Handle | ||
162 | * @param[in] door Peer identity | ||
163 | * @param[in] key Key of room | ||
164 | */ | ||
165 | void | ||
166 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, | ||
167 | const struct GNUNET_PeerIdentity *door, | ||
168 | const struct GNUNET_HashCode *key); | ||
169 | |||
170 | /** | ||
171 | * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>. | ||
172 | * | ||
173 | * @param[in/out] handle Handle | ||
174 | * @param[in] key Key of room | ||
175 | */ | ||
176 | void | ||
177 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, | ||
178 | const struct GNUNET_HashCode *key); | ||
179 | |||
180 | #endif //GNUNET_MESSENGER_API_HANDLE_H | ||