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