diff options
Diffstat (limited to 'src/namestore/namestore.h')
-rw-r--r-- | src/namestore/namestore.h | 408 |
1 files changed, 0 insertions, 408 deletions
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h deleted file mode 100644 index 583ec1e68..000000000 --- a/src/namestore/namestore.h +++ /dev/null | |||
@@ -1,408 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2011-2013 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 | /** | ||
22 | * @file namestore/namestore.h | ||
23 | * @brief common internal definitions for namestore service | ||
24 | * @author Matthias Wachs | ||
25 | * @author Christian Grothoff | ||
26 | */ | ||
27 | #ifndef NAMESTORE_H | ||
28 | #define NAMESTORE_H | ||
29 | |||
30 | /** | ||
31 | * Maximum length of any name, including 0-termination. | ||
32 | */ | ||
33 | #define MAX_NAME_LEN 256 | ||
34 | |||
35 | GNUNET_NETWORK_STRUCT_BEGIN | ||
36 | |||
37 | /** | ||
38 | * Generic namestore message with op id | ||
39 | */ | ||
40 | struct GNUNET_NAMESTORE_Header | ||
41 | { | ||
42 | /** | ||
43 | * header.type will be GNUNET_MESSAGE_TYPE_NAMESTORE_* | ||
44 | * header.size will be message size | ||
45 | */ | ||
46 | struct GNUNET_MessageHeader header; | ||
47 | |||
48 | /** | ||
49 | * Request ID in NBO | ||
50 | */ | ||
51 | uint32_t r_id GNUNET_PACKED; | ||
52 | }; | ||
53 | |||
54 | |||
55 | /** | ||
56 | * Store a record to the namestore (as authority). | ||
57 | */ | ||
58 | struct RecordStoreMessage | ||
59 | { | ||
60 | /** | ||
61 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE | ||
62 | */ | ||
63 | struct GNUNET_NAMESTORE_Header gns_header; | ||
64 | |||
65 | /** | ||
66 | * Expiration time | ||
67 | */ | ||
68 | struct GNUNET_TIME_AbsoluteNBO expire; | ||
69 | |||
70 | /** | ||
71 | * Name length | ||
72 | */ | ||
73 | uint16_t name_len GNUNET_PACKED; | ||
74 | |||
75 | /** | ||
76 | * Length of serialized record data | ||
77 | */ | ||
78 | uint16_t rd_len GNUNET_PACKED; | ||
79 | |||
80 | /** | ||
81 | * Number of records contained | ||
82 | */ | ||
83 | uint16_t rd_count GNUNET_PACKED; | ||
84 | |||
85 | /** | ||
86 | * Reserved for alignment. | ||
87 | */ | ||
88 | uint16_t reserved GNUNET_PACKED; | ||
89 | |||
90 | /** | ||
91 | * The private key of the authority. | ||
92 | */ | ||
93 | struct GNUNET_IDENTITY_PrivateKey private_key; | ||
94 | |||
95 | /* followed by: | ||
96 | * name with length name_len | ||
97 | * serialized record data with rd_count records | ||
98 | */ | ||
99 | }; | ||
100 | |||
101 | |||
102 | /** | ||
103 | * Response to a record storage request. | ||
104 | */ | ||
105 | struct RecordStoreResponseMessage | ||
106 | { | ||
107 | /** | ||
108 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_STORE_RESPONSE | ||
109 | */ | ||
110 | struct GNUNET_NAMESTORE_Header gns_header; | ||
111 | |||
112 | /** | ||
113 | * #GNUNET_SYSERR on failure, #GNUNET_OK on success | ||
114 | */ | ||
115 | int32_t op_result GNUNET_PACKED; | ||
116 | |||
117 | /** | ||
118 | * Error message length | ||
119 | */ | ||
120 | uint16_t emsg_len GNUNET_PACKED; | ||
121 | |||
122 | /** | ||
123 | * Reserved for alignment. | ||
124 | */ | ||
125 | uint16_t reserved GNUNET_PACKED; | ||
126 | |||
127 | /** | ||
128 | * Followed by error message | ||
129 | */ | ||
130 | }; | ||
131 | |||
132 | |||
133 | /** | ||
134 | * Lookup a label | ||
135 | */ | ||
136 | struct LabelLookupMessage | ||
137 | { | ||
138 | /** | ||
139 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP | ||
140 | */ | ||
141 | struct GNUNET_NAMESTORE_Header gns_header; | ||
142 | |||
143 | /** | ||
144 | * Length of the name | ||
145 | */ | ||
146 | uint32_t label_len GNUNET_PACKED; | ||
147 | |||
148 | /** | ||
149 | * The private key of the zone to look up in | ||
150 | */ | ||
151 | struct GNUNET_IDENTITY_PrivateKey zone; | ||
152 | |||
153 | /* followed by: | ||
154 | * name with length name_len | ||
155 | */ | ||
156 | }; | ||
157 | |||
158 | |||
159 | /** | ||
160 | * Lookup a label | ||
161 | */ | ||
162 | struct LabelLookupResponseMessage | ||
163 | { | ||
164 | /** | ||
165 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_LOOKUP_RESPONSE | ||
166 | */ | ||
167 | struct GNUNET_NAMESTORE_Header gns_header; | ||
168 | |||
169 | /** | ||
170 | * Name length | ||
171 | */ | ||
172 | uint16_t name_len GNUNET_PACKED; | ||
173 | |||
174 | /** | ||
175 | * Length of serialized record data | ||
176 | */ | ||
177 | uint16_t rd_len GNUNET_PACKED; | ||
178 | |||
179 | /** | ||
180 | * Number of records contained | ||
181 | */ | ||
182 | uint16_t rd_count GNUNET_PACKED; | ||
183 | |||
184 | /** | ||
185 | * Was the label found in the database?? | ||
186 | * #GNUNET_YES or #GNUNET_NO | ||
187 | */ | ||
188 | int16_t found GNUNET_PACKED; | ||
189 | |||
190 | /** | ||
191 | * The private key of the authority. | ||
192 | */ | ||
193 | struct GNUNET_IDENTITY_PrivateKey private_key; | ||
194 | |||
195 | /* followed by: | ||
196 | * name with length name_len | ||
197 | * serialized record data with rd_count records | ||
198 | */ | ||
199 | }; | ||
200 | |||
201 | |||
202 | /** | ||
203 | * Lookup a name for a zone hash | ||
204 | */ | ||
205 | struct ZoneToNameMessage | ||
206 | { | ||
207 | /** | ||
208 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME | ||
209 | */ | ||
210 | struct GNUNET_NAMESTORE_Header gns_header; | ||
211 | |||
212 | /** | ||
213 | * The private key of the zone to look up in | ||
214 | */ | ||
215 | struct GNUNET_IDENTITY_PrivateKey zone; | ||
216 | |||
217 | /** | ||
218 | * The public key of the target zone | ||
219 | */ | ||
220 | struct GNUNET_IDENTITY_PublicKey value_zone; | ||
221 | }; | ||
222 | |||
223 | |||
224 | /** | ||
225 | * Respone for zone to name lookup | ||
226 | */ | ||
227 | struct ZoneToNameResponseMessage | ||
228 | { | ||
229 | /** | ||
230 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_TO_NAME_RESPONSE | ||
231 | */ | ||
232 | struct GNUNET_NAMESTORE_Header gns_header; | ||
233 | |||
234 | /** | ||
235 | * Length of the name | ||
236 | */ | ||
237 | uint16_t name_len GNUNET_PACKED; | ||
238 | |||
239 | /** | ||
240 | * Length of serialized record data | ||
241 | */ | ||
242 | uint16_t rd_len GNUNET_PACKED; | ||
243 | |||
244 | /** | ||
245 | * Number of records contained | ||
246 | */ | ||
247 | uint16_t rd_count GNUNET_PACKED; | ||
248 | |||
249 | /** | ||
250 | * result in NBO: #GNUNET_OK on success, #GNUNET_NO if there were no | ||
251 | * results, #GNUNET_SYSERR on error | ||
252 | */ | ||
253 | int16_t res GNUNET_PACKED; | ||
254 | |||
255 | /** | ||
256 | * The private key of the zone that contained the name. | ||
257 | */ | ||
258 | struct GNUNET_IDENTITY_PrivateKey zone; | ||
259 | |||
260 | /* followed by: | ||
261 | * name with length name_len | ||
262 | * serialized record data with rd_count records | ||
263 | */ | ||
264 | }; | ||
265 | |||
266 | |||
267 | /** | ||
268 | * Record is returned from the namestore (as authority). | ||
269 | */ | ||
270 | struct RecordResultMessage | ||
271 | { | ||
272 | /** | ||
273 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_RECORD_RESULT | ||
274 | */ | ||
275 | struct GNUNET_NAMESTORE_Header gns_header; | ||
276 | |||
277 | /** | ||
278 | * Name length | ||
279 | */ | ||
280 | uint16_t name_len GNUNET_PACKED; | ||
281 | |||
282 | /** | ||
283 | * Length of serialized record data | ||
284 | */ | ||
285 | uint16_t rd_len GNUNET_PACKED; | ||
286 | |||
287 | /** | ||
288 | * Number of records contained | ||
289 | */ | ||
290 | uint16_t rd_count GNUNET_PACKED; | ||
291 | |||
292 | /** | ||
293 | * always zero (for alignment) | ||
294 | */ | ||
295 | uint16_t reserved GNUNET_PACKED; | ||
296 | |||
297 | /** | ||
298 | * The private key of the authority. | ||
299 | */ | ||
300 | struct GNUNET_IDENTITY_PrivateKey private_key; | ||
301 | |||
302 | /* followed by: | ||
303 | * name with length name_len | ||
304 | * serialized record data with rd_count records | ||
305 | */ | ||
306 | }; | ||
307 | |||
308 | |||
309 | /** | ||
310 | * Start monitoring a zone. | ||
311 | */ | ||
312 | struct ZoneMonitorStartMessage | ||
313 | { | ||
314 | /** | ||
315 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_START | ||
316 | */ | ||
317 | struct GNUNET_MessageHeader header; | ||
318 | |||
319 | /** | ||
320 | * #GNUNET_YES to first iterate over all records, | ||
321 | * #GNUNET_NO to only monitor changes.o | ||
322 | */ | ||
323 | uint32_t iterate_first GNUNET_PACKED; | ||
324 | |||
325 | /** | ||
326 | * Zone key. | ||
327 | */ | ||
328 | struct GNUNET_IDENTITY_PrivateKey zone; | ||
329 | }; | ||
330 | |||
331 | |||
332 | /** | ||
333 | * Ask for next result of zone iteration for the given operation | ||
334 | */ | ||
335 | struct ZoneMonitorNextMessage | ||
336 | { | ||
337 | /** | ||
338 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_MONITOR_NEXT | ||
339 | */ | ||
340 | struct GNUNET_MessageHeader header; | ||
341 | |||
342 | /** | ||
343 | * Always zero. | ||
344 | */ | ||
345 | uint32_t reserved; | ||
346 | |||
347 | /** | ||
348 | * Number of records to return to the iterator in one shot | ||
349 | * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_MONITOR_NEXT | ||
350 | * should be send again). In NBO. | ||
351 | */ | ||
352 | uint64_t limit; | ||
353 | }; | ||
354 | |||
355 | |||
356 | /** | ||
357 | * Start a zone iteration for the given zone | ||
358 | */ | ||
359 | struct ZoneIterationStartMessage | ||
360 | { | ||
361 | /** | ||
362 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START | ||
363 | */ | ||
364 | struct GNUNET_NAMESTORE_Header gns_header; | ||
365 | |||
366 | /** | ||
367 | * Zone key. All zeros for "all zones". | ||
368 | */ | ||
369 | struct GNUNET_IDENTITY_PrivateKey zone; | ||
370 | }; | ||
371 | |||
372 | |||
373 | /** | ||
374 | * Ask for next result of zone iteration for the given operation | ||
375 | */ | ||
376 | struct ZoneIterationNextMessage | ||
377 | { | ||
378 | /** | ||
379 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT | ||
380 | */ | ||
381 | struct GNUNET_NAMESTORE_Header gns_header; | ||
382 | |||
383 | /** | ||
384 | * Number of records to return to the iterator in one shot | ||
385 | * (before #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT | ||
386 | * should be send again). In NBO. | ||
387 | */ | ||
388 | uint64_t limit; | ||
389 | }; | ||
390 | |||
391 | |||
392 | /** | ||
393 | * Stop zone iteration for the given operation | ||
394 | */ | ||
395 | struct ZoneIterationStopMessage | ||
396 | { | ||
397 | /** | ||
398 | * Type will be #GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP | ||
399 | */ | ||
400 | struct GNUNET_NAMESTORE_Header gns_header; | ||
401 | }; | ||
402 | |||
403 | |||
404 | GNUNET_NETWORK_STRUCT_END | ||
405 | |||
406 | |||
407 | /* end of namestore.h */ | ||
408 | #endif | ||