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;
48 uint32_t op_id GNUNET_PACKED;
51 * Status code for the operation.
53 int64_t result_code GNUNET_PACKED;
55 /* followed by 0-terminated error message (on error) */
61 * Answer from service to client about master counters.
63 * @see GNUNET_PSYCSTORE_counters_get()
68 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS
70 struct GNUNET_MessageHeader header;
75 uint32_t op_id GNUNET_PACKED;
77 uint64_t max_fragment_id GNUNET_PACKED;
79 uint64_t max_message_id GNUNET_PACKED;
81 uint64_t max_group_generation GNUNET_PACKED;
83 uint64_t max_state_message_id GNUNET_PACKED;
86 * Status code for the operation:
87 * #GNUNET_OK: success, counter values are returned.
88 * #GNUNET_NO: no message has been sent to the channel yet.
89 * #GNUNET_SYSERR: an error occurred.
91 int32_t result_code GNUNET_PACKED;
96 * Answer from service to client containing a message fragment.
101 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
103 struct GNUNET_MessageHeader header;
108 uint32_t op_id GNUNET_PACKED;
110 uint32_t psycstore_flags GNUNET_PACKED;
112 /* followed by GNUNET_MULTICAST_MessageHeader */
118 * Answer from service to client containing a state variable.
123 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
125 struct GNUNET_MessageHeader header;
130 uint32_t op_id GNUNET_PACKED;
132 uint16_t name_size GNUNET_PACKED;
134 /* followed by name and value */
139 * Generic operation request.
141 struct OperationRequest
143 struct GNUNET_MessageHeader header;
148 uint32_t op_id GNUNET_PACKED;
150 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
156 * @see GNUNET_PSYCSTORE_membership_store()
158 struct MembershipStoreRequest
161 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE
163 struct GNUNET_MessageHeader header;
168 uint32_t op_id GNUNET_PACKED;
171 * Channel's public key.
173 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
176 * Slave's public key.
178 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
180 uint64_t announced_at GNUNET_PACKED;
181 uint64_t effective_since GNUNET_PACKED;
182 uint64_t group_generation GNUNET_PACKED;
183 int did_join GNUNET_PACKED;
188 * @see GNUNET_PSYCSTORE_membership_test()
190 struct MembershipTestRequest
193 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST
195 struct GNUNET_MessageHeader header;
200 uint32_t op_id GNUNET_PACKED;
203 * Channel's public key.
205 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
208 * Slave's public key.
210 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
212 uint64_t message_id GNUNET_PACKED;
214 uint64_t group_generation GNUNET_PACKED;
219 * @see GNUNET_PSYCSTORE_fragment_store()
221 struct FragmentStoreRequest
224 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE
226 struct GNUNET_MessageHeader header;
231 uint32_t op_id GNUNET_PACKED;
234 * Channel's public key.
236 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
239 * enum GNUNET_PSYCSTORE_MessageFlags
241 uint32_t psycstore_flags GNUNET_PACKED;
243 /* Followed by fragment */
248 * @see GNUNET_PSYCSTORE_fragment_get()
250 struct FragmentGetRequest
253 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET
255 struct GNUNET_MessageHeader header;
260 uint32_t op_id GNUNET_PACKED;
263 * Channel's public key.
265 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
268 * Slave's public key.
270 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
273 * Fragment ID to request.
275 uint64_t fragment_id GNUNET_PACKED;
278 * Do membership test with @a slave_key before returning fragment?
279 * #GNUNET_YES or #GNUNET_NO
281 uint8_t do_membership_test;
286 * @see GNUNET_PSYCSTORE_message_get()
288 struct MessageGetRequest
291 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
293 struct GNUNET_MessageHeader header;
298 uint32_t op_id GNUNET_PACKED;
301 * Channel's public key.
303 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
306 * Slave's public key.
308 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
311 * Message ID to request.
313 uint64_t message_id GNUNET_PACKED;
316 * Do membership test with @a slave_key before returning fragment?
317 * #GNUNET_YES or #GNUNET_NO
319 uint8_t do_membership_test;
324 * @see GNUNET_PSYCSTORE_message_get_fragment()
326 struct MessageGetFragmentRequest
329 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
331 struct GNUNET_MessageHeader header;
336 uint32_t op_id GNUNET_PACKED;
339 * Channel's public key.
341 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
344 * Slave's public key.
346 struct GNUNET_CRYPTO_EcdsaPublicKey slave_key;
349 * Requested message ID.
351 uint64_t message_id GNUNET_PACKED;
354 * Requested fragment offset.
356 uint64_t fragment_offset GNUNET_PACKED;
359 * Do membership test with @a slave_key before returning fragment?
360 * #GNUNET_YES or #GNUNET_NO
362 uint8_t do_membership_test;
367 * @see GNUNET_PSYCSTORE_state_hash_update()
369 struct StateHashUpdateRequest
372 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
374 struct GNUNET_MessageHeader header;
379 uint32_t op_id GNUNET_PACKED;
382 * Channel's public key.
384 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
386 struct GNUNET_HashCode hash;
392 STATE_OP_FIRST = 1 << 0,
393 STATE_OP_LAST = 1 << 1
398 * @see GNUNET_PSYCSTORE_state_modify()
400 struct StateModifyRequest
403 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
405 struct GNUNET_MessageHeader header;
410 uint32_t op_id GNUNET_PACKED;
413 * Channel's public key.
415 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
417 uint64_t message_id GNUNET_PACKED;
419 uint64_t state_delta GNUNET_PACKED;
422 * Size of name, including NUL terminator.
424 uint16_t name_size GNUNET_PACKED;
432 * enum GNUNET_ENV_Operator
436 /* Followed by NUL-terminated name, then the value. */
441 * @see GNUNET_PSYCSTORE_state_sync()
443 struct StateSyncRequest
446 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
448 struct GNUNET_MessageHeader header;
453 uint32_t op_id GNUNET_PACKED;
456 * Channel's public key.
458 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
460 uint64_t message_id GNUNET_PACKED;
463 * Size of name, including NUL terminator.
465 uint16_t name_size GNUNET_PACKED;
472 /* Followed by NUL-terminated name, then the value. */
476 GNUNET_NETWORK_STRUCT_END