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;
78 * Status code for the operation.
80 int64_t result_code GNUNET_PACKED;
82 uint64_t max_fragment_id GNUNET_PACKED;
84 uint64_t max_message_id GNUNET_PACKED;
86 uint64_t max_group_generation GNUNET_PACKED;
88 uint64_t max_state_message_id GNUNET_PACKED;
93 * Answer from service to client containing a message fragment.
98 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
100 struct GNUNET_MessageHeader header;
105 uint32_t op_id GNUNET_PACKED;
107 uint32_t psycstore_flags GNUNET_PACKED;
109 /* followed by GNUNET_MULTICAST_MessageHeader */
115 * Answer from service to client containing a state variable.
120 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
122 struct GNUNET_MessageHeader header;
127 uint32_t op_id GNUNET_PACKED;
129 uint16_t name_size GNUNET_PACKED;
131 /* followed by name and value */
136 * Generic operation request.
138 struct OperationRequest
140 struct GNUNET_MessageHeader header;
145 uint32_t op_id GNUNET_PACKED;
147 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
153 * @see GNUNET_PSYCSTORE_membership_store()
155 struct MembershipStoreRequest
158 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE
160 struct GNUNET_MessageHeader header;
165 uint32_t op_id GNUNET_PACKED;
168 * Channel's public key.
170 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
173 * Slave's public key.
175 struct GNUNET_CRYPTO_EccPublicSignKey slave_key;
177 uint64_t announced_at GNUNET_PACKED;
178 uint64_t effective_since GNUNET_PACKED;
179 uint64_t group_generation GNUNET_PACKED;
180 int did_join GNUNET_PACKED;
185 * @see GNUNET_PSYCSTORE_membership_test()
187 struct MembershipTestRequest
190 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST
192 struct GNUNET_MessageHeader header;
197 uint32_t op_id GNUNET_PACKED;
200 * Channel's public key.
202 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
205 * Slave's public key.
207 struct GNUNET_CRYPTO_EccPublicSignKey slave_key;
209 uint64_t message_id GNUNET_PACKED;
211 uint64_t group_generation GNUNET_PACKED;
216 * @see GNUNET_PSYCSTORE_fragment_store()
218 struct FragmentStoreRequest
221 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE
223 struct GNUNET_MessageHeader header;
228 uint32_t op_id GNUNET_PACKED;
231 * Channel's public key.
233 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
235 uint32_t psycstore_flags GNUNET_PACKED;
240 * @see GNUNET_PSYCSTORE_fragment_get()
242 struct FragmentGetRequest
245 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET
247 struct GNUNET_MessageHeader header;
252 uint32_t op_id GNUNET_PACKED;
255 * Channel's public key.
257 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
259 uint64_t fragment_id GNUNET_PACKED;
264 * @see GNUNET_PSYCSTORE_message_get()
266 struct MessageGetRequest
269 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
271 struct GNUNET_MessageHeader header;
276 uint32_t op_id GNUNET_PACKED;
279 * Channel's public key.
281 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
283 uint64_t message_id GNUNET_PACKED;
288 * @see GNUNET_PSYCSTORE_message_get_fragment()
290 struct MessageGetFragmentRequest
293 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
295 struct GNUNET_MessageHeader header;
300 uint32_t op_id GNUNET_PACKED;
303 * Channel's public key.
305 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
307 uint64_t message_id GNUNET_PACKED;
309 uint64_t fragment_offset GNUNET_PACKED;
314 * @see GNUNET_PSYCSTORE_state_hash_update()
316 struct StateHashUpdateRequest
319 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
321 struct GNUNET_MessageHeader header;
326 uint32_t op_id GNUNET_PACKED;
329 * Channel's public key.
331 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
333 struct GNUNET_HashCode hash;
338 STATE_OP_FIRST = 1 << 0,
339 STATE_OP_LAST = 1 << 1
343 * @see GNUNET_PSYCSTORE_state_modify()
345 struct StateModifyRequest
348 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
350 struct GNUNET_MessageHeader header;
355 uint32_t op_id GNUNET_PACKED;
358 * Channel's public key.
360 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
362 uint64_t message_id GNUNET_PACKED;
364 uint64_t state_delta GNUNET_PACKED;
367 * Size of name, including NUL terminator.
369 uint16_t name_size GNUNET_PACKED;
377 * enum GNUNET_ENV_Operator
381 /* Followed by NUL-terminated name, then the value. */
386 * @see GNUNET_PSYCSTORE_state_sync()
388 struct StateSyncRequest
391 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
393 struct GNUNET_MessageHeader header;
398 uint32_t op_id GNUNET_PACKED;
401 * Channel's public key.
403 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
405 uint64_t message_id GNUNET_PACKED;
408 * Size of name, including NUL terminator.
410 uint16_t name_size GNUNET_PACKED;
417 /* Followed by NUL-terminated name, then the value. */
421 GNUNET_NETWORK_STRUCT_END