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.
23 * @brief Common type definitions for the PSYC service and API.
24 * @author Gabor X Toth
31 #include "gnunet_psyc_service.h"
35 GNUNET_PSYC_message_last_part (uint16_t data_size, const char *data);
38 GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind,
39 const struct GNUNET_MessageHeader *msg);
47 MSG_STATE_MODIFIER = 3,
48 MSG_STATE_MOD_CONT = 4,
55 GNUNET_NETWORK_STRUCT_BEGIN
58 /**** library -> service ****/
61 struct MasterStartRequest
64 * Type: GNUNET_MESSAGE_TYPE_PSYC_MASTER_START
66 struct GNUNET_MessageHeader header;
68 struct GNUNET_CRYPTO_EddsaPrivateKey channel_key;
70 uint32_t policy GNUNET_PACKED;
74 struct SlaveJoinRequest
77 * Type: GNUNET_MESSAGE_TYPE_PSYC_SLAVE_JOIN
79 struct GNUNET_MessageHeader header;
81 uint32_t relay_count GNUNET_PACKED;
83 struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
85 struct GNUNET_CRYPTO_EddsaPrivateKey slave_key;
87 struct GNUNET_PeerIdentity origin;
89 /* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
93 struct ChannelSlaveAdd
96 * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_ADD
98 struct GNUNET_MessageHeader header;
102 struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
104 uint64_t announced_at;
106 uint64_t effective_since;
110 struct ChannelSlaveRemove
113 * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_SLAVE_RM
115 struct GNUNET_MessageHeader header;
119 struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
121 uint64_t announced_at;
128 * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STORY_REQUEST
130 struct GNUNET_MessageHeader header;
134 uint64_t start_message_id;
136 uint64_t end_message_id;
144 * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_GET
145 * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_GET_PREFIX
147 struct GNUNET_MessageHeader header;
150 * ID for this operation.
154 /* Followed by NUL-terminated name. */
158 /**** service -> library ****/
161 struct CountersResult
164 * Type: GNUNET_MESSAGE_TYPE_PSYC_RESULT_COUNTERS
166 struct GNUNET_MessageHeader header;
169 * Status code for the operation.
171 int32_t result_code GNUNET_PACKED;
174 * Last message ID sent to the channel.
176 uint64_t max_message_id;
180 * Answer from service to client about last operation.
182 struct OperationResult
186 * - GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE
187 * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STORY_RESULT
188 * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_RESULT
190 struct GNUNET_MessageHeader header;
195 uint32_t op_id GNUNET_PACKED;
198 * Status code for the operation.
200 int64_t result_code GNUNET_PACKED;
203 * - on error: NUL-terminated error message
204 * - on success: one of the following message types
206 * For a STORY_RESULT:
207 * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE
209 * For a STATE_RESULT, one of:
210 * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER
211 * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT
212 * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END
217 GNUNET_NETWORK_STRUCT_END