aboutsummaryrefslogtreecommitdiff
path: root/src/psycstore/psycstore.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2019-02-11 20:39:36 +0100
committerChristian Grothoff <christian@grothoff.org>2019-02-11 20:39:36 +0100
commit1f59e703d82b47f3aeaf432045a2633c2841169b (patch)
tree6af5609b388cf1906a29b5d572bec2dd8fb2ae1c /src/psycstore/psycstore.h
downloadgnunet-secushare-1f59e703d82b47f3aeaf432045a2633c2841169b.tar.gz
gnunet-secushare-1f59e703d82b47f3aeaf432045a2633c2841169b.zip
initial import from gnunet.git
Diffstat (limited to 'src/psycstore/psycstore.h')
-rw-r--r--src/psycstore/psycstore.h520
1 files changed, 520 insertions, 0 deletions
diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h
new file mode 100644
index 0000000..9a1c06a
--- /dev/null
+++ b/src/psycstore/psycstore.h
@@ -0,0 +1,520 @@
1/*
2 * This file is part of GNUnet
3 * Copyright (C) 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 psycstore/psycstore.h
23 * @brief Common type definitions for the PSYCstore service and API.
24 * @author Gabor X Toth
25 */
26
27#ifndef GNUNET_PSYCSTORE_H
28#define GNUNET_PSYCSTORE_H
29
30#include "gnunet_common.h"
31
32
33GNUNET_NETWORK_STRUCT_BEGIN
34
35/**
36 * Answer from service to client about last operation.
37 */
38struct OperationResult
39{
40 /**
41 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
42 */
43 struct GNUNET_MessageHeader header;
44
45 uint32_t reserved GNUNET_PACKED;
46
47 /**
48 * Operation ID.
49 */
50 uint64_t op_id GNUNET_PACKED;
51
52 /**lowed by
53 * Status code for the operation.
54 */
55 uint64_t result_code GNUNET_PACKED;
56
57 /* followed by 0-terminated error message (on error) */
58
59};
60
61
62/**
63 * Answer from service to client about master counters.
64 *
65 * @see GNUNET_PSYCSTORE_counters_get()
66 */
67struct CountersResult
68{
69 /**
70 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS
71 */
72 struct GNUNET_MessageHeader header;
73
74 /**
75 * Status code for the operation:
76 * #GNUNET_OK: success, counter values are returned.
77 * #GNUNET_NO: no message has been sent to the channel yet.
78 * #GNUNET_SYSERR: an error occurred.
79 */
80 uint32_t result_code GNUNET_PACKED;
81
82 /**
83 * Operation ID.
84 */
85 uint64_t op_id GNUNET_PACKED;
86
87 uint64_t max_fragment_id GNUNET_PACKED;
88
89 uint64_t max_message_id GNUNET_PACKED;
90
91 uint64_t max_group_generation GNUNET_PACKED;
92
93 uint64_t max_state_message_id GNUNET_PACKED;
94};
95
96
97/**
98 * Answer from service to client containing a message fragment.
99 */
100struct FragmentResult
101{
102 /**
103 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
104 */
105 struct GNUNET_MessageHeader header;
106
107 uint32_t psycstore_flags GNUNET_PACKED;
108
109 /**
110 * Operation ID.
111 */
112 uint64_t op_id GNUNET_PACKED;
113
114 /* Followed by GNUNET_MULTICAST_MessageHeader */
115};
116
117
118/**
119 * Answer from service to client containing a state variable.
120 */
121struct StateResult
122{
123 /**
124 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
125 */
126 struct GNUNET_MessageHeader header;
127
128 uint16_t name_size GNUNET_PACKED;
129
130 uint16_t reserved GNUNET_PACKED;
131
132 /**
133 * Operation ID.
134 */
135 uint64_t op_id GNUNET_PACKED;
136
137 /* Followed by name and value */
138};
139
140
141/**
142 * Generic operation request.
143 */
144struct OperationRequest
145{
146 struct GNUNET_MessageHeader header;
147
148 uint32_t reserved GNUNET_PACKED;
149
150 /**
151 * Operation ID.
152 */
153 uint64_t op_id GNUNET_PACKED;
154
155 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
156};
157
158
159/**
160 * @see GNUNET_PSYCSTORE_membership_store()
161 */
162struct MembershipStoreRequest
163{
164 /**
165 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE
166 */
167 struct GNUNET_MessageHeader header;
168
169 uint32_t reserved GNUNET_PACKED;
170
171 /**
172 * Operation ID.
173 */
174 uint64_t op_id GNUNET_PACKED;
175
176 /**
177 * Channel's public key.
178 */
179 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
180
181 /**
182 * Slave's public key.
183 */
184 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
185
186 uint64_t announced_at GNUNET_PACKED;
187 uint64_t effective_since GNUNET_PACKED;
188 uint64_t group_generation GNUNET_PACKED;
189 uint8_t did_join;
190};
191
192
193/**
194 * @see GNUNET_PSYCSTORE_membership_test()
195 */
196struct MembershipTestRequest
197{
198 /**
199 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST
200 */
201 struct GNUNET_MessageHeader header;
202
203 uint32_t reserved GNUNET_PACKED;
204
205 /**
206 * Operation ID.
207 */
208 uint64_t op_id GNUNET_PACKED;
209
210 /**
211 * Channel's public key.
212 */
213 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
214
215 /**
216 * Slave's public key.
217 */
218 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
219
220 uint64_t message_id GNUNET_PACKED;
221
222 uint64_t group_generation GNUNET_PACKED;
223};
224
225
226/**
227 * @see GNUNET_PSYCSTORE_fragment_store()
228 */
229struct FragmentStoreRequest
230{
231 /**
232 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE
233 */
234 struct GNUNET_MessageHeader header;
235
236 /**
237 * enum GNUNET_PSYCSTORE_MessageFlags
238 */
239 uint32_t psycstore_flags GNUNET_PACKED;
240
241 /**
242 * Channel's public key.
243 */
244 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
245
246 /**
247 * Operation ID.
248 */
249 uint64_t op_id;
250
251 /* Followed by fragment */
252};
253
254
255/**
256 * @see GNUNET_PSYCSTORE_fragment_get()
257 */
258struct FragmentGetRequest
259{
260 /**
261 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET
262 */
263 struct GNUNET_MessageHeader header;
264
265 uint32_t reserved GNUNET_PACKED;
266
267 /**
268 * Operation ID.
269 */
270 uint64_t op_id GNUNET_PACKED;
271
272 /**
273 * Channel's public key.
274 */
275 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
276
277 /**
278 * Slave's public key.
279 */
280 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
281
282 /**
283 * First fragment ID to request.
284 */
285 uint64_t first_fragment_id GNUNET_PACKED;
286
287 /**
288 * Last fragment ID to request.
289 */
290 uint64_t last_fragment_id GNUNET_PACKED;
291
292 /**
293 * Maximum number of fragments to retrieve.
294 */
295 uint64_t fragment_limit GNUNET_PACKED;
296
297 /**
298 * Do membership test with @a slave_key before returning fragment?
299 * #GNUNET_YES or #GNUNET_NO
300 */
301 uint8_t do_membership_test;
302};
303
304
305/**
306 * @see GNUNET_PSYCSTORE_message_get()
307 */
308struct MessageGetRequest
309{
310 /**
311 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
312 */
313 struct GNUNET_MessageHeader header;
314
315 uint32_t reserved GNUNET_PACKED;
316
317 /**
318 * Operation ID.
319 */
320 uint64_t op_id GNUNET_PACKED;
321
322 /**
323 * Channel's public key.
324 */
325 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
326
327 /**
328 * Slave's public key.
329 */
330 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
331
332 /**
333 * First message ID to request.
334 */
335 uint64_t first_message_id GNUNET_PACKED;
336
337 /**
338 * Last message ID to request.
339 */
340 uint64_t last_message_id GNUNET_PACKED;
341
342 /**
343 * Maximum number of messages to retrieve.
344 */
345 uint64_t message_limit GNUNET_PACKED;
346
347 /**
348 * Maximum number of fragments to retrieve.
349 */
350 uint64_t fragment_limit GNUNET_PACKED;
351
352 /**
353 * Do membership test with @a slave_key before returning fragment?
354 * #GNUNET_YES or #GNUNET_NO
355 */
356 uint8_t do_membership_test;
357
358 /* Followed by method_prefix */
359};
360
361
362/**
363 * @see GNUNET_PSYCSTORE_message_get_fragment()
364 */
365struct MessageGetFragmentRequest
366{
367 /**
368 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
369 */
370 struct GNUNET_MessageHeader header;
371
372 uint32_t reserved GNUNET_PACKED;
373
374 /**
375 * Operation ID.
376 */
377 uint64_t op_id GNUNET_PACKED;
378
379 /**
380 * Channel's public key.
381 */
382 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
383
384 /**
385 * Slave's public key.
386 */
387 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
388
389 /**
390 * Requested message ID.
391 */
392 uint64_t message_id GNUNET_PACKED;
393
394 /**
395 * Requested fragment offset.
396 */
397 uint64_t fragment_offset GNUNET_PACKED;
398
399 /**
400 * Do membership test with @a slave_key before returning fragment?
401 * #GNUNET_YES or #GNUNET_NO
402 */
403 uint8_t do_membership_test;
404};
405
406
407/**
408 * @see GNUNET_PSYCSTORE_state_hash_update()
409 */
410struct StateHashUpdateRequest
411{
412 /**
413 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
414 */
415 struct GNUNET_MessageHeader header;
416
417 uint32_t reserved GNUNET_PACKED;
418
419 /**
420 * Operation ID.
421 */
422 uint64_t op_id GNUNET_PACKED;
423
424 /**
425 * Channel's public key.
426 */
427 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
428
429 struct GNUNET_HashCode hash;
430};
431
432
433enum StateOpFlags
434{
435 STATE_OP_FIRST = 1 << 0,
436 STATE_OP_LAST = 1 << 1
437};
438
439
440/**
441 * @see GNUNET_PSYCSTORE_state_modify()
442 */
443struct StateModifyRequest
444{
445 /**
446 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
447 */
448 struct GNUNET_MessageHeader header;
449
450 /**
451 * Operation ID.
452 */
453 uint64_t op_id GNUNET_PACKED;
454
455 /**
456 * ID of the message to apply the state changes in.
457 */
458 uint64_t message_id GNUNET_PACKED;
459
460 /**
461 * State delta of the message with ID @a message_id.
462 */
463 uint64_t state_delta GNUNET_PACKED;
464
465 /**
466 * Channel's public key.
467 */
468 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
469};
470
471
472/**
473 * @see GNUNET_PSYCSTORE_state_sync()
474 */
475struct StateSyncRequest
476{
477 /**
478 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
479 */
480 struct GNUNET_MessageHeader header;
481
482 /**
483 * Size of name, including NUL terminator.
484 */
485 uint16_t name_size GNUNET_PACKED;
486
487 /**
488 * OR'd StateOpFlags
489 */
490 uint8_t flags;
491
492 uint8_t reserved;
493
494 /**
495 * Operation ID.
496 */
497 uint64_t op_id GNUNET_PACKED;
498
499 /**
500 * ID of the message that contains the state_hash PSYC header variable.
501 */
502 uint64_t state_hash_message_id GNUNET_PACKED;
503
504 /**
505 * ID of the last stateful message before @a state_hash_message_id.
506 */
507 uint64_t max_state_message_id GNUNET_PACKED;
508
509 /**
510 * Channel's public key.
511 */
512 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
513
514 /* Followed by NUL-terminated name, then the value. */
515};
516
517
518GNUNET_NETWORK_STRUCT_END
519
520#endif