diff options
Diffstat (limited to 'src/messenger/gnunet-service-messenger_service.h')
-rw-r--r-- | src/messenger/gnunet-service-messenger_service.h | 201 |
1 files changed, 0 insertions, 201 deletions
diff --git a/src/messenger/gnunet-service-messenger_service.h b/src/messenger/gnunet-service-messenger_service.h deleted file mode 100644 index aa43fa457..000000000 --- a/src/messenger/gnunet-service-messenger_service.h +++ /dev/null | |||
@@ -1,201 +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/gnunet-service-messenger_service.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_SERVICE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_SERVICE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_configuration_lib.h" | ||
31 | #include "gnunet_crypto_lib.h" | ||
32 | #include "gnunet_container_lib.h" | ||
33 | #include "gnunet_disk_lib.h" | ||
34 | #include "gnunet_identity_service.h" | ||
35 | |||
36 | #include "gnunet-service-messenger_ego_store.h" | ||
37 | #include "gnunet-service-messenger_list_handles.h" | ||
38 | |||
39 | #include "messenger_api_contact_store.h" | ||
40 | #include "gnunet-service-messenger_room.h" | ||
41 | |||
42 | #include "gnunet-service-messenger_member_session.h" | ||
43 | |||
44 | struct GNUNET_MESSENGER_Service | ||
45 | { | ||
46 | const struct GNUNET_CONFIGURATION_Handle *config; | ||
47 | struct GNUNET_SERVICE_Handle *service; | ||
48 | |||
49 | struct GNUNET_SCHEDULER_Task *shutdown; | ||
50 | |||
51 | char *dir; | ||
52 | |||
53 | struct GNUNET_CADET_Handle *cadet; | ||
54 | |||
55 | struct GNUNET_MESSENGER_EgoStore ego_store; | ||
56 | struct GNUNET_MESSENGER_ContactStore contact_store; | ||
57 | |||
58 | struct GNUNET_MESSENGER_ListHandles handles; | ||
59 | |||
60 | struct GNUNET_CONTAINER_MultiHashMap *rooms; | ||
61 | }; | ||
62 | |||
63 | /** | ||
64 | * Creates and allocates a new service using a given <i>config</i> and a GNUnet service handle. | ||
65 | * | ||
66 | * @param[in] config Configuration | ||
67 | * @param[in/out] service_handle GNUnet service handle | ||
68 | * @return New service | ||
69 | */ | ||
70 | struct GNUNET_MESSENGER_Service* | ||
71 | create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle); | ||
72 | |||
73 | /** | ||
74 | * Destroys a <i>service</i> and frees its memory fully. | ||
75 | * | ||
76 | * @param[in/out] service Service | ||
77 | */ | ||
78 | void | ||
79 | destroy_service (struct GNUNET_MESSENGER_Service *service); | ||
80 | |||
81 | /** | ||
82 | * Returns the used EGO-store of a given <i>service</i>. | ||
83 | * | ||
84 | * @param[in/out] service Service | ||
85 | * @return EGO-store | ||
86 | */ | ||
87 | struct GNUNET_MESSENGER_EgoStore* | ||
88 | get_service_ego_store (struct GNUNET_MESSENGER_Service *service); | ||
89 | |||
90 | /** | ||
91 | * Returns the used contact store of a given <i>service</i>. | ||
92 | * | ||
93 | * @param[in/out] service Service | ||
94 | * @return Contact store | ||
95 | */ | ||
96 | struct GNUNET_MESSENGER_ContactStore* | ||
97 | get_service_contact_store (struct GNUNET_MESSENGER_Service *service); | ||
98 | |||
99 | /** | ||
100 | * Creates and adds a new handle to a <i>service</i> using a given message queue. | ||
101 | * | ||
102 | * @param[in/out] service Service | ||
103 | * @param[in/out] mq Message queue | ||
104 | * @return New handle | ||
105 | */ | ||
106 | struct GNUNET_MESSENGER_SrvHandle* | ||
107 | add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq); | ||
108 | |||
109 | /** | ||
110 | * Removes a <i>handle</i> from a <i>service</i> and destroys it. | ||
111 | * | ||
112 | * @param[in/out] service Service | ||
113 | * @param[in/out] handle Handle | ||
114 | */ | ||
115 | void | ||
116 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle); | ||
117 | |||
118 | /** | ||
119 | * Tries to write the peer identity of the peer running a <i>service</i> on to the <i>peer</i> | ||
120 | * parameter. The functions returns #GNUNET_OK on success, otherwise #GNUNET_SYSERR. | ||
121 | * | ||
122 | * @param[in] service Service | ||
123 | * @param[out] peer Peer identity | ||
124 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
125 | */ | ||
126 | int | ||
127 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer); | ||
128 | |||
129 | /** | ||
130 | * Returns the room identified by a given <i>key</i> for a <i>service</i>. If the service doesn't know any room | ||
131 | * using the given key, NULL gets returned. | ||
132 | * | ||
133 | * @param[in] service Service | ||
134 | * @param[in] key Key of room | ||
135 | * @return Room or NULL | ||
136 | */ | ||
137 | struct GNUNET_MESSENGER_SrvRoom* | ||
138 | get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); | ||
139 | |||
140 | /** | ||
141 | * Tries to open a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will be | ||
142 | * created if necessary. If the function is successful, it returns #GNUNET_YES, otherwise #GNUNET_NO. | ||
143 | * | ||
144 | * @param[in/out] service Service | ||
145 | * @param[in/out] handle Handle | ||
146 | * @param[in] key Key of room | ||
147 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO | ||
148 | */ | ||
149 | int | ||
150 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
151 | const struct GNUNET_HashCode *key); | ||
152 | |||
153 | /** | ||
154 | * Tries to enter a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will | ||
155 | * be created if necessary. If the function is successful, it returns #GNUNET_YES, otherwise #GNUNET_NO. | ||
156 | * | ||
157 | * The room will be entered through the peer identitied by the peer identity provided as <i>door</i> parameter and | ||
158 | * a new connection will be made. | ||
159 | * | ||
160 | * @param[in/out] service Service | ||
161 | * @param[in/out] handle Handle | ||
162 | * @param[in] door Peer identity | ||
163 | * @param[in] key Key of room | ||
164 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO | ||
165 | */ | ||
166 | int | ||
167 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
168 | const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); | ||
169 | |||
170 | /** | ||
171 | * Tries to close a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will | ||
172 | * be created if necessary. If the function is successful, it returns #GNUNET_YES, otherwise #GNUNET_NO. | ||
173 | * | ||
174 | * If the specific handle is currently the host of the room for this service, a new handle which is a member will | ||
175 | * take its place. Otherwise the room will be destroyed for this service. | ||
176 | * | ||
177 | * @param[in/out] service Service | ||
178 | * @param[in/out] handle Handle | ||
179 | * @param[in] key Key of room | ||
180 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO | ||
181 | */ | ||
182 | int | ||
183 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
184 | const struct GNUNET_HashCode *key); | ||
185 | |||
186 | /** | ||
187 | * Sends a received or sent <i>message</i> with a given <i>hash</i> to each handle of a <i>service</i> which | ||
188 | * is currently member of a specific <i>room</i> for handling it in the client API. | ||
189 | * | ||
190 | * @param[in/out] service Service | ||
191 | * @param[in/out] room Room | ||
192 | * @param[in] session Member session | ||
193 | * @param[in] message Message | ||
194 | * @param[in] hash Hash of message | ||
195 | */ | ||
196 | void | ||
197 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, | ||
198 | const struct GNUNET_MESSENGER_MemberSession *session, | ||
199 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
200 | |||
201 | #endif //GNUNET_SERVICE_MESSENGER_SERVICE_H | ||