diff options
Diffstat (limited to 'src/messenger/gnunet-service-messenger_ego_store.h')
-rw-r--r-- | src/messenger/gnunet-service-messenger_ego_store.h | 159 |
1 files changed, 0 insertions, 159 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 4222a4e91..000000000 --- a/src/messenger/gnunet-service-messenger_ego_store.h +++ /dev/null | |||
@@ -1,159 +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_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 | |||
34 | struct GNUNET_MESSENGER_Ego; | ||
35 | struct GNUNET_MESSENGER_EgoStore; | ||
36 | |||
37 | typedef void | ||
38 | (*GNUNET_MESSENGER_EgoLookupCallback) (void *cls, | ||
39 | const char *identifier, | ||
40 | const struct GNUNET_MESSENGER_Ego *ego); | ||
41 | |||
42 | struct 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 | |||
57 | struct 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 | void *handle; | ||
66 | |||
67 | char *identifier; | ||
68 | }; | ||
69 | |||
70 | struct GNUNET_MESSENGER_EgoStore | ||
71 | { | ||
72 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
73 | |||
74 | struct GNUNET_IDENTITY_Handle *identity; | ||
75 | struct GNUNET_CONTAINER_MultiHashMap *egos; | ||
76 | |||
77 | struct GNUNET_MESSENGER_EgoLookup *lu_start; | ||
78 | struct GNUNET_MESSENGER_EgoLookup *lu_end; | ||
79 | |||
80 | struct GNUNET_MESSENGER_EgoOperation *op_start; | ||
81 | struct GNUNET_MESSENGER_EgoOperation *op_end; | ||
82 | }; | ||
83 | |||
84 | /** | ||
85 | * Initializes an EGO-store as fully empty. | ||
86 | * | ||
87 | * @param[out] store EGO-store | ||
88 | * @param[in] config Configuration handle | ||
89 | */ | ||
90 | void | ||
91 | init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, | ||
92 | const struct GNUNET_CONFIGURATION_Handle *config); | ||
93 | |||
94 | /** | ||
95 | * Clears an EGO-store, wipes its content and deallocates its memory. | ||
96 | * | ||
97 | * @param[in/out] store EGO-store | ||
98 | */ | ||
99 | void | ||
100 | clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store); | ||
101 | |||
102 | /** | ||
103 | * Creates a new EGO which will be registered to a <i>store</i> under | ||
104 | * a specific <i>identifier</i>. A given <i>handle</i> will be informed | ||
105 | * about the creation and changes its EGO accordingly. | ||
106 | * | ||
107 | * @param[in/out] store EGO-store | ||
108 | * @param[in] identifier Identifier string | ||
109 | * @param[in/out] handle Handle or NULL | ||
110 | */ | ||
111 | void | ||
112 | create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, | ||
113 | const char *identifier, | ||
114 | void *handle); | ||
115 | |||
116 | /** | ||
117 | * Lookups an EGO which was registered to a <i>store</i> under | ||
118 | * a specific <i>identifier</i>. | ||
119 | * | ||
120 | * @param[in/out] store EGO-store | ||
121 | * @param[in] identifier Identifier string | ||
122 | * @param[in] lookup Lookup callback (non-NULL) | ||
123 | * @param[in] cls Closure | ||
124 | */ | ||
125 | void | ||
126 | lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, | ||
127 | const char *identifier, | ||
128 | GNUNET_MESSENGER_EgoLookupCallback lookup, | ||
129 | void *cls); | ||
130 | |||
131 | /** | ||
132 | * Updates the registration of an EGO to a <i>store</i> under | ||
133 | * a specific <i>identifier</i> with a new <i>key</i>. | ||
134 | * | ||
135 | * @param[in/out] store EGO-store | ||
136 | * @param[in] identifier Identifier string | ||
137 | * @param[in] key Private EGO key | ||
138 | * @return Updated EGO | ||
139 | */ | ||
140 | struct GNUNET_MESSENGER_Ego* | ||
141 | update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, | ||
142 | const char *identifier, | ||
143 | const struct GNUNET_IDENTITY_PrivateKey *key); | ||
144 | |||
145 | /** | ||
146 | * Updates the location of a registered EGO in a <i>store</i> to | ||
147 | * a different one under a specific <i>new_identifier<i> replacing | ||
148 | * its old one. | ||
149 | * | ||
150 | * @param[in/out] store EGO-store | ||
151 | * @param[in] old_identifier Old identifier string | ||
152 | * @param[in] new_identifier New identifier string | ||
153 | */ | ||
154 | void | ||
155 | rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, | ||
156 | const char *old_identifier, | ||
157 | const char *new_identifier); | ||
158 | |||
159 | #endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H | ||