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
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;
46 * Status code for the operation.
48 int64_t result_code GNUNET_PACKED;
50 uint32_t op_id GNUNET_PACKED;
52 /* followed by 0-terminated error message (on error) */
58 * Answer from service to client about master counters.
60 * @see GNUNET_PSYCSTORE_counters_get_master()
62 struct MasterCountersResult
65 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS_MASTER
67 struct GNUNET_MessageHeader header;
69 uint64_t fragment_id GNUNET_PACKED;
71 uint64_t message_id GNUNET_PACKED;
73 uint64_t group_generation GNUNET_PACKED;
76 * Status code for the operation.
78 int64_t result_code GNUNET_PACKED;
80 uint32_t op_id GNUNET_PACKED;
86 * Answer from service to client about slave counters.
88 * @see GNUNET_PSYCSTORE_counters_get_slave()
90 struct SlaveCountersResult
93 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_COUNTERS_SLAVE
95 struct GNUNET_MessageHeader header;
97 uint64_t max_known_msg_id GNUNET_PACKED;
100 * Status code for the operation.
102 int64_t result_code GNUNET_PACKED;
104 uint32_t op_id GNUNET_PACKED;
110 * Answer from service to client containing a message fragment.
112 struct FragmentResult
115 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
117 struct GNUNET_MessageHeader header;
119 uint32_t op_id GNUNET_PACKED;
121 uint32_t psycstore_flags GNUNET_PACKED;
123 /* followed by GNUNET_MULTICAST_MessageHeader */
129 * Answer from service to client containing a state variable.
134 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
136 struct GNUNET_MessageHeader header;
138 uint32_t op_id GNUNET_PACKED;
140 uint16_t name_size GNUNET_PACKED;
142 /* followed by name and value */
147 * Generic operation request.
149 struct OperationRequest
151 struct GNUNET_MessageHeader header;
153 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
155 uint32_t op_id GNUNET_PACKED;
160 * @see GNUNET_PSYCSTORE_membership_store()
162 struct MembershipStoreRequest
165 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_STORE
167 struct GNUNET_MessageHeader header;
170 * Channel's public key.
172 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
175 * Slave's public key.
177 struct GNUNET_CRYPTO_EccPublicSignKey slave_key;
180 uint64_t announced_at;
181 uint64_t effective_since;
182 uint64_t group_generation;
184 uint32_t op_id GNUNET_PACKED;
189 * @see GNUNET_PSYCSTORE_membership_test()
191 struct MembershipTestRequest
194 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MEMBERSHIP_TEST
196 struct GNUNET_MessageHeader header;
199 * Channel's public key.
201 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
204 * Slave's public key.
206 struct GNUNET_CRYPTO_EccPublicSignKey slave_key;
208 uint64_t message_id GNUNET_PACKED;
210 uint64_t group_generation GNUNET_PACKED;
212 uint32_t op_id GNUNET_PACKED;
217 * @see GNUNET_PSYCSTORE_fragment_store()
219 struct FragmentStoreRequest
222 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_STORE
224 struct GNUNET_MessageHeader header;
227 * Channel's public key.
229 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
231 uint32_t psycstore_flags GNUNET_PACKED;
233 uint32_t op_id GNUNET_PACKED;
238 * @see GNUNET_PSYCSTORE_fragment_get()
240 struct FragmentGetRequest
243 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_FRAGMENT_GET
245 struct GNUNET_MessageHeader header;
248 * Channel's public key.
250 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
252 uint64_t fragment_id;
254 uint32_t op_id GNUNET_PACKED;
259 * @see GNUNET_PSYCSTORE_message_get()
261 struct MessageGetRequest
264 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_GET
266 struct GNUNET_MessageHeader header;
269 * Channel's public key.
271 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
275 uint32_t op_id GNUNET_PACKED;
280 * @see GNUNET_PSYCSTORE_message_get_fragment()
282 struct MessageGetFragmentRequest
285 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_MESSAGE_FRAGMENT_GET
287 struct GNUNET_MessageHeader header;
290 * Channel's public key.
292 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
296 uint64_t fragment_offset;
298 uint32_t op_id GNUNET_PACKED;
303 * @see GNUNET_PSYCSTORE_state_hash_update()
305 struct StateHashUpdateRequest
308 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_HASH_UPDATE
310 struct GNUNET_MessageHeader header;
313 * Channel's public key.
315 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
317 struct GNUNET_HashCode hash;
319 uint32_t op_id GNUNET_PACKED;
324 STATE_OP_FIRST = 1 << 0,
325 STATE_OP_LAST = 1 << 1
329 * @see GNUNET_PSYCSTORE_state_modify()
331 struct StateModifyRequest
334 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_MODIFY
336 struct GNUNET_MessageHeader header;
339 * Channel's public key.
341 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
343 uint64_t message_id GNUNET_PACKED;
345 uint64_t state_delta GNUNET_PACKED;
347 uint32_t op_id GNUNET_PACKED;
350 * Size of name, including NUL terminator.
352 uint16_t name_size GNUNET_PACKED;
360 * enum GNUNET_ENV_Operator
364 /* Followed by NUL-terminated name, then the value. */
369 * @see GNUNET_PSYCSTORE_state_sync()
371 struct StateSyncRequest
374 * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_STATE_SYNC
376 struct GNUNET_MessageHeader header;
379 * Channel's public key.
381 struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
383 uint64_t message_id GNUNET_PACKED;
385 uint32_t op_id GNUNET_PACKED;
388 * Size of name, including NUL terminator.
390 uint16_t name_size GNUNET_PACKED;
397 /* Followed by NUL-terminated name, then the value. */
401 GNUNET_NETWORK_STRUCT_END