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;
267 uint64_t fragment_id GNUNET_PACKED;
272 * @see GNUNET_PSYCSTORE_message_get()
274 struct MessageGetRequest
277 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
279 struct GNUNET_MessageHeader header;
284 uint32_t op_id GNUNET_PACKED;
287 * Channel's public key.
289 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
291 uint64_t message_id GNUNET_PACKED;
296 * @see GNUNET_PSYCSTORE_message_get_fragment()
298 struct MessageGetFragmentRequest
301 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
303 struct GNUNET_MessageHeader header;
308 uint32_t op_id GNUNET_PACKED;
311 * Channel's public key.
313 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
315 uint64_t message_id GNUNET_PACKED;
317 uint64_t fragment_offset GNUNET_PACKED;
322 * @see GNUNET_PSYCSTORE_state_hash_update()
324 struct StateHashUpdateRequest
327 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
329 struct GNUNET_MessageHeader header;
334 uint32_t op_id GNUNET_PACKED;
337 * Channel's public key.
339 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
341 struct GNUNET_HashCode hash;
347 STATE_OP_FIRST = 1 << 0,
348 STATE_OP_LAST = 1 << 1
353 * @see GNUNET_PSYCSTORE_state_modify()
355 struct StateModifyRequest
358 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
360 struct GNUNET_MessageHeader header;
365 uint32_t op_id GNUNET_PACKED;
368 * Channel's public key.
370 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
372 uint64_t message_id GNUNET_PACKED;
374 uint64_t state_delta GNUNET_PACKED;
377 * Size of name, including NUL terminator.
379 uint16_t name_size GNUNET_PACKED;
387 * enum GNUNET_ENV_Operator
391 /* Followed by NUL-terminated name, then the value. */
396 * @see GNUNET_PSYCSTORE_state_sync()
398 struct StateSyncRequest
401 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
403 struct GNUNET_MessageHeader header;
408 uint32_t op_id GNUNET_PACKED;
411 * Channel's public key.
413 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
415 uint64_t message_id GNUNET_PACKED;
418 * Size of name, including NUL terminator.
420 uint16_t name_size GNUNET_PACKED;
427 /* Followed by NUL-terminated name, then the value. */
431 GNUNET_NETWORK_STRUCT_END