2 * This file is part of GNUnet
3 * Copyright (C) 2013 GNUnet e.V.
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., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, 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 * Maximum number of fragments to retrieve.
350 uint64_t fragment_limit GNUNET_PACKED;
353 * Do membership test with @a slave_key before returning fragment?
354 * #GNUNET_YES or #GNUNET_NO
356 uint8_t do_membership_test;
358 /* Followed by method_prefix */
363 * @see GNUNET_PSYCSTORE_message_get_fragment()
365 struct MessageGetFragmentRequest
368 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
370 struct GNUNET_MessageHeader header;
372 uint32_t reserved GNUNET_PACKED;
377 uint64_t op_id GNUNET_PACKED;
380 * Channel's public key.
382 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
385 * Slave's public key.
387 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
390 * Requested message ID.
392 uint64_t message_id GNUNET_PACKED;
395 * Requested fragment offset.
397 uint64_t fragment_offset GNUNET_PACKED;
400 * Do membership test with @a slave_key before returning fragment?
401 * #GNUNET_YES or #GNUNET_NO
403 uint8_t do_membership_test;
408 * @see GNUNET_PSYCSTORE_state_hash_update()
410 struct StateHashUpdateRequest
413 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
415 struct GNUNET_MessageHeader header;
417 uint32_t reserved GNUNET_PACKED;
422 uint64_t op_id GNUNET_PACKED;
425 * Channel's public key.
427 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
429 struct GNUNET_HashCode hash;
435 STATE_OP_FIRST = 1 << 0,
436 STATE_OP_LAST = 1 << 1
441 * @see GNUNET_PSYCSTORE_state_modify()
443 struct StateModifyRequest
446 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
448 struct GNUNET_MessageHeader header;
453 uint64_t op_id GNUNET_PACKED;
456 * ID of the message to apply the state changes in.
458 uint64_t message_id GNUNET_PACKED;
461 * State delta of the message with ID @a message_id.
463 uint64_t state_delta GNUNET_PACKED;
466 * Channel's public key.
468 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
473 * @see GNUNET_PSYCSTORE_state_sync()
475 struct StateSyncRequest
478 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
480 struct GNUNET_MessageHeader header;
483 * Size of name, including NUL terminator.
485 uint16_t name_size GNUNET_PACKED;
497 uint64_t op_id GNUNET_PACKED;
500 * ID of the message that contains the state_hash PSYC header variable.
502 uint64_t state_hash_message_id GNUNET_PACKED;
505 * ID of the last stateful message before @a state_hash_message_id.
507 uint64_t max_state_message_id GNUNET_PACKED;
510 * Channel's public key.
512 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
514 /* Followed by NUL-terminated name, then the value. */
518 GNUNET_NETWORK_STRUCT_END