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_EddsaPublicKey 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_EddsaPublicKey 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;
238 uint32_t psycstore_flags GNUNET_PACKED;
243 * @see GNUNET_PSYCSTORE_fragment_get()
245 struct FragmentGetRequest
248 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET
250 struct GNUNET_MessageHeader header;
255 uint32_t op_id GNUNET_PACKED;
258 * Channel's public key.
260 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
262 uint64_t fragment_id GNUNET_PACKED;
267 * @see GNUNET_PSYCSTORE_message_get()
269 struct MessageGetRequest
272 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
274 struct GNUNET_MessageHeader header;
279 uint32_t op_id GNUNET_PACKED;
282 * Channel's public key.
284 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
286 uint64_t message_id GNUNET_PACKED;
291 * @see GNUNET_PSYCSTORE_message_get_fragment()
293 struct MessageGetFragmentRequest
296 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
298 struct GNUNET_MessageHeader header;
303 uint32_t op_id GNUNET_PACKED;
306 * Channel's public key.
308 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
310 uint64_t message_id GNUNET_PACKED;
312 uint64_t fragment_offset GNUNET_PACKED;
317 * @see GNUNET_PSYCSTORE_state_hash_update()
319 struct StateHashUpdateRequest
322 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
324 struct GNUNET_MessageHeader header;
329 uint32_t op_id GNUNET_PACKED;
332 * Channel's public key.
334 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
336 struct GNUNET_HashCode hash;
341 STATE_OP_FIRST = 1 << 0,
342 STATE_OP_LAST = 1 << 1
346 * @see GNUNET_PSYCSTORE_state_modify()
348 struct StateModifyRequest
351 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
353 struct GNUNET_MessageHeader header;
358 uint32_t op_id GNUNET_PACKED;
361 * Channel's public key.
363 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
365 uint64_t message_id GNUNET_PACKED;
367 uint64_t state_delta GNUNET_PACKED;
370 * Size of name, including NUL terminator.
372 uint16_t name_size GNUNET_PACKED;
380 * enum GNUNET_ENV_Operator
384 /* Followed by NUL-terminated name, then the value. */
389 * @see GNUNET_PSYCSTORE_state_sync()
391 struct StateSyncRequest
394 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
396 struct GNUNET_MessageHeader header;
401 uint32_t op_id GNUNET_PACKED;
404 * Channel's public key.
406 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
408 uint64_t message_id GNUNET_PACKED;
411 * Size of name, including NUL terminator.
413 uint16_t name_size GNUNET_PACKED;
420 /* Followed by NUL-terminated name, then the value. */
424 GNUNET_NETWORK_STRUCT_END