From 5cce50f3c8b2d0c54230238de5dd19ab8bd2de3b Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Wed, 15 May 2013 13:39:46 +0000 Subject: [PATCH] -comments for Florian --- src/include/gnunet_set_service.h | 19 ++++++++++++++----- src/set/mq.h | 7 +++++-- src/set/set.h | 32 +++++++++++++++++--------------- src/set/test_set.conf | 4 ++++ 4 files changed, 40 insertions(+), 22 deletions(-) diff --git a/src/include/gnunet_set_service.h b/src/include/gnunet_set_service.h index b76882319..72d7ee521 100644 --- a/src/include/gnunet_set_service.h +++ b/src/include/gnunet_set_service.h @@ -86,17 +86,26 @@ enum GNUNET_SET_Status * Everything went ok. */ GNUNET_SET_STATUS_OK, + /** * There was a timeout. */ GNUNET_SET_STATUS_TIMEOUT, + /** * The other peer refused to to the operation with us, * or something went wrong. */ GNUNET_SET_STATUS_FAILURE, + + /** + * Success, all elements have been returned (but the other + * peer might still be receiving some from us, so we are not done). + */ + GNUNET_SET_STATUS_HALF_DONE, + /** - * Success, all elements have been sent. + * Success, all elements have been sent (and received). */ GNUNET_SET_STATUS_DONE }; @@ -140,7 +149,7 @@ struct GNUNET_SET_Element /** * Actual data of the element */ - void *data; + const void *data; }; @@ -161,7 +170,7 @@ typedef void (*GNUNET_SET_Continuation) (void *cls); * @param status see enum GNUNET_SET_Status */ typedef void (*GNUNET_SET_ResultIterator) (void *cls, - struct GNUNET_SET_Element *element, + const struct GNUNET_SET_Element *element, enum GNUNET_SET_Status status); @@ -258,7 +267,7 @@ GNUNET_SET_destroy (struct GNUNET_SET_Handle *set); * fail due to hash collisions, using a different salt for each operation * makes it harder for an attacker to exploit this * @param timeout result_cb will be called with GNUNET_SET_STATUS_TIMEOUT - * if the operation is not done after the specified time + * if the operation is not done after the specified time; @deprecated * @param result_mode specified how results will be returned, * see 'GNUNET_SET_ResultMode'. * @param result_cb called on error or success @@ -313,7 +322,7 @@ GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh); * * @param request request to accept * @param set set used for the requested operation - * @param timeout timeout for the set operation + * @param timeout timeout for the set operation, @deprecated * @param result_mode specified how results will be returned, * see 'GNUNET_SET_ResultMode'. * @param result_cb callback for the results diff --git a/src/set/mq.h b/src/set/mq.h index 42b755163..b7a89f6e0 100644 --- a/src/set/mq.h +++ b/src/set/mq.h @@ -276,7 +276,6 @@ struct GNUNET_MQ_MessageQueue * GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client); - /** * Create a message queue for a GNUNET_STREAM_Socket. * If handlers are specfied, receive messages from the stream socket. @@ -285,12 +284,14 @@ GNUNET_MQ_queue_for_server_client (struct GNUNET_SERVER_Client *client); * @param handlers handlers for receiving messages * @param cls closure for the handlers * @return the message queue + * @deprecated - GNUNET_MQ_queue_create_with_callbacks */ struct GNUNET_MQ_MessageQueue * GNUNET_MQ_queue_for_stream_socket (struct GNUNET_STREAM_Socket *socket, const struct GNUNET_MQ_Handler *handlers, void *cls); + /** * Replace the handlers of a message queue with new handlers. * Takes effect immediately, even for messages that already have been received, but for @@ -306,7 +307,6 @@ GNUNET_MQ_replace_handlers (struct GNUNET_MQ_MessageQueue *mq, void *cls); - /** * Call a callback once the message has been sent, that is, the message * can not be canceled anymore. @@ -321,6 +321,7 @@ GNUNET_MQ_notify_sent (struct GNUNET_MQ_Message *mqm, GNUNET_MQ_NotifyCallback cb, void *cls); + /** * Call a callback once all messages queued have been sent, * i.e. the message queue is empty. @@ -328,6 +329,7 @@ GNUNET_MQ_notify_sent (struct GNUNET_MQ_Message *mqm, * @param mqm the message queue to send the notification for * @param cb the callback to call on an empty queue * @param cls closure for cb + * @deprecated */ void GNUNET_MQ_notify_empty (struct GNUNET_MQ_MessageQueue *mqm, @@ -341,6 +343,7 @@ GNUNET_MQ_notify_empty (struct GNUNET_MQ_MessageQueue *mqm, * @param mqm the message queue to send the notification for * @param cb the callback to call on a read error * @param cls closure for cb + * @deprecated, integrate with queue creation */ void GNUNET_MQ_notify_read_error (struct GNUNET_MQ_MessageQueue *mqm, diff --git a/src/set/set.h b/src/set/set.h index 33e0aafdd..ad2200de9 100644 --- a/src/set/set.h +++ b/src/set/set.h @@ -1,6 +1,6 @@ /* 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 @@ -49,6 +49,7 @@ struct SetCreateMessage /** * Operation type, values of enum GNUNET_SET_OperationType */ + // FIXME: use 32_t for 'enum'. uint16_t operation GNUNET_PACKED; }; @@ -61,14 +62,15 @@ struct ListenMessage struct GNUNET_MessageHeader header; /** - * application id + * Operation type, values of enum GNUNET_SET_OperationType */ - struct GNUNET_HashCode app_id; + uint16_t operation GNUNET_PACKED; /** - * Operation type, values of enum GNUNET_SET_OperationType + * application id */ - uint16_t operation GNUNET_PACKED; + struct GNUNET_HashCode app_id; + }; @@ -104,17 +106,17 @@ struct RequestMessage */ struct GNUNET_MessageHeader header; - /** - * Identity of the requesting peer. - */ - struct GNUNET_PeerIdentity peer_id; - /** * ID of the request we want to accept, * chosen by the service. */ uint32_t accept_id GNUNET_PACKED; + /** + * Identity of the requesting peer. + */ + struct GNUNET_PeerIdentity peer_id; + /* rest: nested context message */ }; @@ -126,6 +128,11 @@ struct EvaluateMessage */ struct GNUNET_MessageHeader header; + /** + * id of our evaluate, chosen by the client + */ + uint32_t request_id GNUNET_PACKED; + /** * Peer to evaluate the operation with */ @@ -136,11 +143,6 @@ struct EvaluateMessage */ struct GNUNET_HashCode app_id; - /** - * id of our evaluate, chosen by the client - */ - uint32_t request_id GNUNET_PACKED; - /** * Salt to use for the operation */ diff --git a/src/set/test_set.conf b/src/set/test_set.conf index c1d5a0f93..34b7a8d2f 100644 --- a/src/set/test_set.conf +++ b/src/set/test_set.conf @@ -1,3 +1,7 @@ +# @INLINE@ test_set_defaults.conf +[PATHS] +SERVICEHOME = /tmp/test-gnunet-set/ + [set] AUTOSTART = YES PORT = 2106 -- 2.25.1