/*
This file is part of GNUnet.
- (C) 2012 Christian Grothoff (and other contributing authors)
+ (C) 2012, 2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
#include "platform.h"
#include "gnunet_common.h"
-
-/**
- * The service sends up to GNUNET_SET_ACK_WINDOW messages per client handle,
- * the client should send an ack every GNUNET_SET_ACK_WINDOW/2 messages.
- */
-#define GNUNET_SET_ACK_WINDOW 8
+#define GNUNET_SET_ACK_WINDOW 10
GNUNET_NETWORK_STRUCT_BEGIN
-struct SetCreateMessage
+struct GNUNET_SET_CreateMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SET_CREATE
/**
* Operation type, values of enum GNUNET_SET_OperationType
*/
+ // FIXME: use 32_t for 'enum'.
uint16_t operation GNUNET_PACKED;
};
-struct ListenMessage
+struct GNUNET_SET_ListenMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
struct GNUNET_MessageHeader header;
/**
- * application id
+ * Operation type, values of enum GNUNET_SET_OperationType
*/
- struct GNUNET_HashCode app_id;
+ uint32_t operation GNUNET_PACKED;
/**
- * Operation type, values of enum GNUNET_SET_OperationType
+ * application id
*/
- uint16_t operation GNUNET_PACKED;
+ struct GNUNET_HashCode app_id;
+
};
-struct AcceptMessage
+struct GNUNET_SET_AcceptRejectMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT
+ * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT or
+ * GNUNET_MESSAGE_TYPE_SET_REJECT
*/
struct GNUNET_MessageHeader header;
/**
- * request id of the request we want to accept
+ * ID of the incoming request we want to accept / reject.
+ */
+ uint32_t accept_reject_id GNUNET_PACKED;
+
+ /**
+ * Request ID to identify responses,
+ * must be 0 if we don't accept the request.
*/
uint32_t request_id GNUNET_PACKED;
/**
- * Zero if the client has rejected the request,
- * non-zero if it has accepted it
+ * How should results be sent to us?
+ * See enum GNUNET_SET_ResultMode.
*/
- uint32_t accepted GNUNET_PACKED;
+ uint16_t result_mode GNUNET_PACKED;
};
-struct RequestMessage
+/**
+ * A request for an operation with another client.
+ */
+struct GNUNET_SET_RequestMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_Request
+ * Type: GNUNET_MESSAGE_TYPE_SET_Request.
*/
struct GNUNET_MessageHeader header;
/**
- * requesting peer
+ * Identity of the requesting peer.
*/
struct GNUNET_PeerIdentity peer_id;
/**
- * request id of the request we want to accept
+ * ID of the to identify the request when accepting or
+ * rejecting it.
*/
- uint32_t request_id GNUNET_PACKED;
+ uint32_t accept_id GNUNET_PACKED;
- /* rest: inner message */
+ /* rest: nested context message */
};
-struct EvaluateMessage
+struct GNUNET_SET_EvaluateMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
*/
struct GNUNET_MessageHeader header;
+ /**
+ * id of our evaluate, chosen by the client
+ */
+ uint32_t request_id GNUNET_PACKED;
+
/**
* Peer to evaluate the operation with
*/
- struct GNUNET_PeerIdentity peer;
+ struct GNUNET_PeerIdentity target_peer;
/**
* Application id
struct GNUNET_HashCode app_id;
/**
- * id of our evaluate
+ * Salt to use for the operation
*/
- uint32_t request_id GNUNET_PACKED;
+ uint16_t salt GNUNET_PACKED;
+
+ /**
+ * How should results be sent to us?
+ * See enum GNUNET_SET_ResultMode.
+ */
+ uint16_t result_mode GNUNET_PACKED;
/* rest: inner message */
};
-struct ResultMessage
+struct GNUNET_SET_ResultMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SET_RESULT
};
-struct ElementMessage
+struct GNUNET_SET_ElementMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SET_ADD or
uint16_t element_type GNUNET_PACKED;
+ uint16_t reserved GNUNET_PACKED;
+
/* rest: the actual element */
};
-struct CancelMessage
+/**
+ * Sent to the service by the client
+ * in order to cancel a set operation.
+ */
+struct GNUNET_SET_CancelMessage
{
/**
* Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
struct GNUNET_MessageHeader header;
/**
- * id we want to cancel result belongs to
+ * ID of the request we want to cancel.
*/
uint32_t request_id GNUNET_PACKED;
};
+struct GNUNET_SET_IterResponseMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Type of the element attachted to the message,
+ * if any.
+ */
+ uint16_t element_type GNUNET_PACKED;
+
+ /* rest: element */
+};
+
+struct GNUNET_SET_IterAckMessage
+{
+ /**
+ * Type: GNUNET_MESSAGE_TYPE_SET_ITER_ACK
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * Non-zero if the service should continue sending elements.
+ */
+ uint32_t send_more;
+};
GNUNET_NETWORK_STRUCT_END