#ifndef PSYC_H
#define PSYC_H
-#include "gnunet_common.h"
+#include "platform.h"
+#include "gnunet_psyc_service.h"
-GNUNET_NETWORK_STRUCT_BEGIN
-/**** service -> library ****/
+uint16_t
+GNUNET_PSYC_message_last_part (uint16_t data_size, const char *data);
-/**
- * Answer from service to client about last operation.
- */
-struct OperationResult
-{
- /**
- * Type: GNUNET_MESSAGE_TYPE_PSYCSTORE_RESULT_CODE
- */
- struct GNUNET_MessageHeader header;
+void
+GNUNET_PSYC_log_message (enum GNUNET_ErrorType kind,
+ const struct GNUNET_MessageHeader *msg);
- /**
- * Operation ID.
- */
- uint32_t op_id GNUNET_PACKED;
-
- /**
- * Status code for the operation.
- */
- int64_t result_code GNUNET_PACKED;
- /* followed by 0-terminated error message (on error) */
-
-};
-
-
-struct CountersResult
+enum MessageState
{
- /**
- * Type: GNUNET_MESSAGE_TYPE_PSYC_RESULT_COUNTERS
- */
- struct GNUNET_MessageHeader header;
-
- uint64_t max_message_id;
+ MSG_STATE_START = 0,
+ MSG_STATE_HEADER = 1,
+ MSG_STATE_METHOD = 2,
+ MSG_STATE_MODIFIER = 3,
+ MSG_STATE_MOD_CONT = 4,
+ MSG_STATE_DATA = 5,
+ MSG_STATE_END = 6,
+ MSG_STATE_CANCEL = 7,
};
-/**
- * Transmit acknowledgment.
- *
- * Sent after the last GNUNET_PSYC_MessageModifier and after each
- * GNUNET_PSYC_MessageData.
- *
- * This message acknowledges previously received messages and asks for the next
- * fragment of data.
- */
-struct TransmitAck
-{
- /**
- * Type: GNUNET_MESSAGE_TYPE_PSYC_TRANSMIT_ACK
- */
- struct GNUNET_MessageHeader header;
-
- /**
- * Buffer space available for the next data fragment.
- */
- uint16_t buf_avail;
-};
+GNUNET_NETWORK_STRUCT_BEGIN
/**** library -> service ****/
*/
struct GNUNET_MessageHeader header;
- struct GNUNET_CRYPTO_EccPrivateKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPrivateKey channel_key;
uint32_t policy GNUNET_PACKED;
};
uint32_t relay_count GNUNET_PACKED;
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
+
+ struct GNUNET_CRYPTO_EddsaPrivateKey slave_key;
- struct GNUNET_CRYPTO_EccPrivateKey slave_key;
+ struct GNUNET_PeerIdentity origin;
/* Followed by struct GNUNET_PeerIdentity relays[relay_count] */
};
uint32_t reserved;
- struct GNUNET_CRYPTO_EccPublicSignKey *slave_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
uint64_t announced_at;
uint32_t reserved;
- struct GNUNET_CRYPTO_EccPublicSignKey *slave_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey *slave_key;
uint64_t announced_at;
};
};
-struct StateQuery
+struct StateRequest
{
/**
- * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_QUERY
+ * Types:
+ * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_GET
+ * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_GET_PREFIX
*/
struct GNUNET_MessageHeader header;
+ /**
+ * ID for this operation.
+ */
uint64_t op_id;
/* Followed by NUL-terminated name. */
};
-struct StateResult
+/**** service -> library ****/
+
+
+struct CountersResult
{
/**
- * Type: GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_RESULT
+ * Type: GNUNET_MESSAGE_TYPE_PSYC_RESULT_COUNTERS
*/
struct GNUNET_MessageHeader header;
/**
- * Size of name, including NUL terminator.
+ * Status code for the operation.
*/
- uint16_t name_size GNUNET_PACKED;
+ int32_t result_code GNUNET_PACKED;
/**
- * OR'd StateOpFlags
+ * Last message ID sent to the channel.
*/
- uint8_t flags;
+ uint64_t max_message_id;
+};
- /* Followed by NUL-terminated name, then the value. */
+/**
+ * Answer from service to client about last operation.
+ */
+struct OperationResult
+{
+ /**
+ * Types:
+ * - GNUNET_MESSAGE_TYPE_PSYC_RESULT_CODE
+ * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STORY_RESULT
+ * - GNUNET_MESSAGE_TYPE_PSYC_CHANNEL_STATE_RESULT
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Operation ID.
+ */
+ uint32_t op_id GNUNET_PACKED;
+
+ /**
+ * Status code for the operation.
+ */
+ int64_t result_code GNUNET_PACKED;
+
+ /* Followed by:
+ * - on error: NUL-terminated error message
+ * - on success: one of the following message types
+ *
+ * For a STORY_RESULT:
+ * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE
+ *
+ * For a STATE_RESULT, one of:
+ * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MODIFIER
+ * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_MOD_CONT
+ * - GNUNET_MESSAGE_TYPE_PSYC_MESSAGE_END
+ */
};