2 * This file is part of GNUnet
3 * (C) 2013 Christian Grothoff (and other contributing authors)
5 * GNUnet is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 3, or (at your
8 * option) any later version.
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 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNUnet; see the file COPYING. If not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * @file psycstore/psycstore.h
23 * @brief Common type definitions for the PSYCstore service and API.
24 * @author Gabor X Toth
27 #ifndef GNUNET_PSYCSTORE_H
28 #define GNUNET_PSYCSTORE_H
30 #include "gnunet_common.h"
33 GNUNET_NETWORK_STRUCT_BEGIN
36 * Answer from service to client about last operation.
38 struct OperationResult
41 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
43 struct GNUNET_MessageHeader header;
45 uint32_t reserved GNUNET_PACKED;
50 uint64_t op_id GNUNET_PACKED;
53 * Status code for the operation.
55 uint64_t result_code GNUNET_PACKED;
57 /* followed by 0-terminated error message (on error) */
63 * Answer from service to client about master counters.
65 * @see GNUNET_PSYCSTORE_counters_get()
70 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS
72 struct GNUNET_MessageHeader header;
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.
80 uint32_t result_code GNUNET_PACKED;
85 uint64_t op_id GNUNET_PACKED;
87 uint64_t max_fragment_id GNUNET_PACKED;
89 uint64_t max_message_id GNUNET_PACKED;
91 uint64_t max_group_generation GNUNET_PACKED;
93 uint64_t max_state_message_id GNUNET_PACKED;
98 * Answer from service to client containing a message fragment.
100 struct FragmentResult
103 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
105 struct GNUNET_MessageHeader header;
107 uint32_t psycstore_flags GNUNET_PACKED;
112 uint64_t op_id GNUNET_PACKED;
114 /* Followed by GNUNET_MULTICAST_MessageHeader */
119 * Answer from service to client containing a state variable.
124 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
126 struct GNUNET_MessageHeader header;
128 uint16_t name_size GNUNET_PACKED;
130 uint16_t reserved GNUNET_PACKED;
135 uint64_t op_id GNUNET_PACKED;
137 /* Followed by name and value */
142 * Generic operation request.
144 struct OperationRequest
146 struct GNUNET_MessageHeader header;
148 uint32_t reserved GNUNET_PACKED;
153 uint64_t op_id GNUNET_PACKED;
155 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
160 * @see GNUNET_PSYCSTORE_membership_store()
162 struct MembershipStoreRequest
165 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE
167 struct GNUNET_MessageHeader header;
169 uint32_t reserved GNUNET_PACKED;
174 uint64_t op_id GNUNET_PACKED;
177 * Channel's public key.
179 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
182 * Slave's public key.
184 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
186 uint64_t announced_at GNUNET_PACKED;
187 uint64_t effective_since GNUNET_PACKED;
188 uint64_t group_generation GNUNET_PACKED;
194 * @see GNUNET_PSYCSTORE_membership_test()
196 struct MembershipTestRequest
199 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST
201 struct GNUNET_MessageHeader header;
203 uint32_t reserved GNUNET_PACKED;
208 uint64_t op_id GNUNET_PACKED;
211 * Channel's public key.
213 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
216 * Slave's public key.
218 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
220 uint64_t message_id GNUNET_PACKED;
222 uint64_t group_generation GNUNET_PACKED;
227 * @see GNUNET_PSYCSTORE_fragment_store()
229 struct FragmentStoreRequest
232 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE
234 struct GNUNET_MessageHeader header;
237 * enum GNUNET_PSYCSTORE_MessageFlags
239 uint32_t psycstore_flags GNUNET_PACKED;
242 * Channel's public key.
244 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
251 /* Followed by fragment */
256 * @see GNUNET_PSYCSTORE_fragment_get()
258 struct FragmentGetRequest
261 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET
263 struct GNUNET_MessageHeader header;
265 uint32_t reserved GNUNET_PACKED;
270 uint64_t op_id GNUNET_PACKED;
273 * Channel's public key.
275 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
278 * Slave's public key.
280 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
283 * First fragment ID to request.
285 uint64_t first_fragment_id GNUNET_PACKED;
288 * Last fragment ID to request.
290 uint64_t last_fragment_id GNUNET_PACKED;
293 * Maximum number of fragments to retrieve.
295 uint64_t fragment_limit GNUNET_PACKED;
298 * Do membership test with @a slave_key before returning fragment?
299 * #GNUNET_YES or #GNUNET_NO
301 uint8_t do_membership_test;
306 * @see GNUNET_PSYCSTORE_message_get()
308 struct MessageGetRequest
311 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
313 struct GNUNET_MessageHeader header;
315 uint32_t reserved GNUNET_PACKED;
320 uint64_t op_id GNUNET_PACKED;
323 * Channel's public key.
325 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
328 * Slave's public key.
330 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
333 * First message ID to request.
335 uint64_t first_message_id GNUNET_PACKED;
338 * Last message ID to request.
340 uint64_t last_message_id GNUNET_PACKED;
343 * Maximum number of messages to retrieve.
345 uint64_t message_limit GNUNET_PACKED;
348 * Do membership test with @a slave_key before returning fragment?
349 * #GNUNET_YES or #GNUNET_NO
351 uint8_t do_membership_test;
356 * @see GNUNET_PSYCSTORE_message_get_fragment()
358 struct MessageGetFragmentRequest
361 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
363 struct GNUNET_MessageHeader header;
365 uint32_t reserved GNUNET_PACKED;
370 uint64_t op_id GNUNET_PACKED;
373 * Channel's public key.
375 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
378 * Slave's public key.
380 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
383 * Requested message ID.
385 uint64_t message_id GNUNET_PACKED;
388 * Requested fragment offset.
390 uint64_t fragment_offset GNUNET_PACKED;
393 * Do membership test with @a slave_key before returning fragment?
394 * #GNUNET_YES or #GNUNET_NO
396 uint8_t do_membership_test;
401 * @see GNUNET_PSYCSTORE_state_hash_update()
403 struct StateHashUpdateRequest
406 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
408 struct GNUNET_MessageHeader header;
410 uint32_t reserved GNUNET_PACKED;
415 uint64_t op_id GNUNET_PACKED;
418 * Channel's public key.
420 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
422 struct GNUNET_HashCode hash;
428 STATE_OP_FIRST = 1 << 0,
429 STATE_OP_LAST = 1 << 1
434 * @see GNUNET_PSYCSTORE_state_modify()
436 struct StateModifyRequest
439 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
441 struct GNUNET_MessageHeader header;
444 * Size of name, including NUL terminator.
446 uint16_t name_size GNUNET_PACKED;
454 * enum GNUNET_ENV_Operator
461 uint64_t op_id GNUNET_PACKED;
464 * Channel's public key.
466 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
468 uint64_t message_id GNUNET_PACKED;
470 uint64_t state_delta GNUNET_PACKED;
472 /* Followed by NUL-terminated name, then the value. */
477 * @see GNUNET_PSYCSTORE_state_sync()
479 struct StateSyncRequest
482 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
484 struct GNUNET_MessageHeader header;
487 * Size of name, including NUL terminator.
489 uint16_t name_size GNUNET_PACKED;
498 uint64_t message_id GNUNET_PACKED;
503 uint64_t op_id GNUNET_PACKED;
506 * Channel's public key.
508 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
510 /* Followed by NUL-terminated name, then the value. */
514 GNUNET_NETWORK_STRUCT_END