aboutsummaryrefslogtreecommitdiff
path: root/src/messenger/gnunet-service-messenger_ego_store.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/messenger/gnunet-service-messenger_ego_store.h')
-rw-r--r--src/messenger/gnunet-service-messenger_ego_store.h206
1 files changed, 0 insertions, 206 deletions
diff --git a/src/messenger/gnunet-service-messenger_ego_store.h b/src/messenger/gnunet-service-messenger_ego_store.h
deleted file mode 100644
index 4ed2bbf6d..000000000
--- a/src/messenger/gnunet-service-messenger_ego_store.h
+++ /dev/null
@@ -1,206 +0,0 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2020--2022 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_ego_store.h
23 * @brief GNUnet MESSENGER service
24 */
25
26#ifndef GNUNET_SERVICE_MESSENGER_EGO_STORE_H
27#define GNUNET_SERVICE_MESSENGER_EGO_STORE_H
28
29#include "platform.h"
30#include "gnunet_container_lib.h"
31
32#include "messenger_api_ego.h"
33
34struct GNUNET_MESSENGER_Ego;
35struct GNUNET_MESSENGER_EgoStore;
36
37typedef void
38(*GNUNET_MESSENGER_EgoLookupCallback) (void *cls,
39 const char *identifier,
40 const struct GNUNET_MESSENGER_Ego *ego);
41
42struct GNUNET_MESSENGER_EgoLookup
43{
44 struct GNUNET_MESSENGER_EgoLookup *prev;
45 struct GNUNET_MESSENGER_EgoLookup *next;
46
47 struct GNUNET_IDENTITY_EgoLookup *lookup;
48
49 struct GNUNET_MESSENGER_EgoStore *store;
50
51 GNUNET_MESSENGER_EgoLookupCallback cb;
52 void *cls;
53
54 char *identifier;
55};
56
57struct GNUNET_MESSENGER_EgoOperation
58{
59 struct GNUNET_MESSENGER_EgoOperation *prev;
60 struct GNUNET_MESSENGER_EgoOperation *next;
61
62 struct GNUNET_IDENTITY_Operation *operation;
63
64 struct GNUNET_MESSENGER_EgoStore *store;
65
66 void *cls;
67
68 char *identifier;
69};
70
71struct GNUNET_MESSENGER_EgoStore
72{
73 const struct GNUNET_CONFIGURATION_Handle *cfg;
74
75 struct GNUNET_IDENTITY_Handle *identity;
76 struct GNUNET_CONTAINER_MultiHashMap *egos;
77 struct GNUNET_CONTAINER_MultiHashMap *handles;
78
79 struct GNUNET_MESSENGER_EgoLookup *lu_start;
80 struct GNUNET_MESSENGER_EgoLookup *lu_end;
81
82 struct GNUNET_MESSENGER_EgoOperation *op_start;
83 struct GNUNET_MESSENGER_EgoOperation *op_end;
84};
85
86/**
87 * Initializes an EGO-store as fully empty.
88 *
89 * @param[out] store EGO-store
90 * @param[in] config Configuration handle
91 */
92void
93init_ego_store (struct GNUNET_MESSENGER_EgoStore *store,
94 const struct GNUNET_CONFIGURATION_Handle *config);
95
96/**
97 * Clears an EGO-store, wipes its content and deallocates its memory.
98 *
99 * @param[in/out] store EGO-store
100 */
101void
102clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store);
103
104/**
105 * Creates a new EGO which will be registered to a <i>store</i> under
106 * a specific <i>identifier</i>.
107 *
108 * @param[in/out] store EGO-store
109 * @param[in] identifier Identifier string
110 */
111void
112create_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
113 const char *identifier);
114
115/**
116 * Binds an EGO which was registered to a <i>store</i> under
117 * a specific <i>identifier</i> to a given <i>handle</i>
118 *
119 * @param[in/out] store EGO-store
120 * @param[in] identifier Identifier string
121 * @param[in/out] handle Handle
122 */
123void
124bind_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
125 const char *identifier,
126 void *handle);
127
128/**
129 * Binds an EGO which was registered to a <i>store</i> under
130 * a specific <i>identifier</i> to a given <i>handle</i>
131 *
132 * @param[in/out] store EGO-store
133 * @param[in] identifier Identifier string
134 * @param[in/out] handle Handle
135 */
136void
137unbind_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
138 const char *identifier,
139 void *handle);
140
141/**
142 * Lookups an EGO which was registered to a <i>store</i> under
143 * a specific <i>identifier</i>.
144 *
145 * @param[in/out] store EGO-store
146 * @param[in] identifier Identifier string
147 * @param[in] lookup Lookup callback (non-NULL)
148 * @param[in] cls Closure
149 */
150void
151lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
152 const char *identifier,
153 GNUNET_MESSENGER_EgoLookupCallback lookup,
154 void *cls);
155
156/**
157 * Updates the registration of an EGO to a <i>store</i> under
158 * a specific <i>identifier</i> with a new <i>key</i>.
159 *
160 * @param[in/out] store EGO-store
161 * @param[in] identifier Identifier string
162 * @param[in] key Private EGO key
163 * @return Updated EGO
164 */
165struct GNUNET_MESSENGER_Ego*
166update_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
167 const char *identifier,
168 const struct GNUNET_IDENTITY_PrivateKey *key);
169
170/**
171 * Deletes the registration of an EGO in a <i>store</i> under
172 * a specific <i>identifier</i>.
173 *
174 * @param[in/out] store EGO-store
175 * @param[in] identifier Identifier string
176 */
177void
178delete_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
179 const char *identifier);
180
181/**
182 * Updates the location of a registered EGO in a <i>store</i> to
183 * a different one under a specific <i>new_identifier<i> replacing
184 * its old one.
185 *
186 * @param[in/out] store EGO-store
187 * @param[in] old_identifier Old identifier string
188 * @param[in] new_identifier New identifier string
189 */
190void
191rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
192 const char *old_identifier,
193 const char *new_identifier);
194
195/**
196 * Replaces the registered EGO in a <i>store</i> under a specific
197 * <i>identifier</i> with a newly created one.
198 *
199 * @param[in/out] store EGO-store
200 * @param[in] identifier Identifier string
201 */
202void
203renew_store_ego (struct GNUNET_MESSENGER_EgoStore *store,
204 const char *identifier);
205
206#endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H