[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r34431 - in gnunet/src: consensus dv include revocation sca
From: |
gnunet |
Subject: |
[GNUnet-SVN] r34431 - in gnunet/src: consensus dv include revocation scalarproduct set |
Date: |
Thu, 27 Nov 2014 10:50:41 +0100 |
Author: grothoff
Date: 2014-11-27 10:50:41 +0100 (Thu, 27 Nov 2014)
New Revision: 34431
Modified:
gnunet/src/consensus/gnunet-service-consensus.c
gnunet/src/dv/gnunet-service-dv.c
gnunet/src/include/gnunet_set_service.h
gnunet/src/revocation/gnunet-service-revocation.c
gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
gnunet/src/set/gnunet-service-set.c
gnunet/src/set/gnunet-service-set.h
gnunet/src/set/gnunet-set-profiler.c
gnunet/src/set/set.h
gnunet/src/set/set_api.c
gnunet/src/set/set_protocol.h
gnunet/src/set/test_set_api.c
gnunet/src/set/test_set_intersection_result_full.c
gnunet/src/set/test_set_union_result_full.c
Log:
eliminating useless salt argument, salt can be generated inside of
gnunet-service-set
Modified: gnunet/src/consensus/gnunet-service-consensus.c
===================================================================
--- gnunet/src/consensus/gnunet-service-consensus.c 2014-11-24 14:18:22 UTC
(rev 34430)
+++ gnunet/src/consensus/gnunet-service-consensus.c 2014-11-27 09:50:41 UTC
(rev 34431)
@@ -812,7 +812,6 @@
GNUNET_SET_prepare (&session->partner_outgoing->peer_id,
&session->global_id,
(struct GNUNET_MessageHeader *) msg,
- 0, /* FIXME: salt */
GNUNET_SET_RESULT_ADDED,
set_result_cb, session->partner_outgoing);
GNUNET_free (msg);
Modified: gnunet/src/dv/gnunet-service-dv.c
===================================================================
--- gnunet/src/dv/gnunet-service-dv.c 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/dv/gnunet-service-dv.c 2014-11-27 09:50:41 UTC (rev 34431)
@@ -1744,7 +1744,6 @@
initiate_set_union (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
- static uint16_t salt;
struct DirectNeighbor *neighbor = cls;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1756,7 +1755,6 @@
neighbor->set_op = GNUNET_SET_prepare (&neighbor->peer,
&neighbor->real_session_id,
NULL,
- salt++,
GNUNET_SET_RESULT_ADDED,
&handle_set_union_result,
neighbor);
Modified: gnunet/src/include/gnunet_set_service.h
===================================================================
--- gnunet/src/include/gnunet_set_service.h 2014-11-24 14:18:22 UTC (rev
34430)
+++ gnunet/src/include/gnunet_set_service.h 2014-11-27 09:50:41 UTC (rev
34431)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2013 Christian Grothoff (and other contributing authors)
+ (C) 2013, 2014 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
@@ -296,9 +296,6 @@
* @param other_peer peer with the other set
* @param app_id hash for the application using the set
* @param context_msg additional information for the request
- * @param salt salt used for the set operation; sometimes set operations
- * fail due to hash collisions, using a different salt for each
operation
- * makes it harder for an attacker to exploit this
* @param result_mode specified how results will be returned,
* see `enum GNUNET_SET_ResultMode`.
* @param result_cb called on error or success
@@ -309,7 +306,6 @@
GNUNET_SET_prepare (const struct GNUNET_PeerIdentity *other_peer,
const struct GNUNET_HashCode *app_id,
const struct GNUNET_MessageHeader *context_msg,
- uint16_t salt,
enum GNUNET_SET_ResultMode result_mode,
GNUNET_SET_ResultIterator result_cb,
void *result_cls);
@@ -326,7 +322,7 @@
* @param app_id id of the application that handles set operation requests
* @param listen_cb called for each incoming request matching the operation
* and application id
- * @param listen_cls handle for listen_cb
+ * @param listen_cls handle for @a listen_cb
* @return a handle that can be used to cancel the listen operation
*/
struct GNUNET_SET_ListenHandle *
@@ -389,7 +385,7 @@
/**
* Cancel the given set operation.
- * May not be called after the operation's GNUNET_SET_ResultIterator has been
+ * May not be called after the operation's `GNUNET_SET_ResultIterator` has been
* called with a status that indicates error, timeout or done.
*
* @param oh set operation to cancel
@@ -406,12 +402,14 @@
*
* @param set the set to iterate over
* @param iter the iterator to call for each element
- * @param cls closure for 'iter'
- * @return GNUNET_YES if the iteration started successfuly,
- * GNUNET_SYSERR if the set is invalid (e.g. the server crashed,
disconnected)
+ * @param iter_cls closure for @a iter
+ * @return #GNUNET_YES if the iteration started successfuly,
+ * #GNUNET_SYSERR if the set is invalid (e.g. the server crashed,
disconnected)
*/
int
-GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator
iter, void *cls);
+GNUNET_SET_iterate (struct GNUNET_SET_Handle *set,
+ GNUNET_SET_ElementIterator iter,
+ void *iter_cls);
#if 0 /* keep Emacsens' auto-indent happy */
Modified: gnunet/src/revocation/gnunet-service-revocation.c
===================================================================
--- gnunet/src/revocation/gnunet-service-revocation.c 2014-11-24 14:18:22 UTC
(rev 34430)
+++ gnunet/src/revocation/gnunet-service-revocation.c 2014-11-27 09:50:41 UTC
(rev 34431)
@@ -463,18 +463,14 @@
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct PeerEntry *peer_entry = cls;
- uint16_t salt;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Starting set exchange with peer `%s'\n",
GNUNET_i2s (&peer_entry->id));
-
- salt = (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- UINT16_MAX);
peer_entry->transmit_task = GNUNET_SCHEDULER_NO_TASK;
peer_entry->so = GNUNET_SET_prepare (&peer_entry->id,
&revocation_set_union_app_id,
- NULL, salt,
+ NULL,
GNUNET_SET_RESULT_ADDED,
&add_revocation,
peer_entry);
Modified: gnunet/src/scalarproduct/gnunet-service-scalarproduct.c
===================================================================
--- gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2014-11-24
14:18:22 UTC (rev 34430)
+++ gnunet/src/scalarproduct/gnunet-service-scalarproduct.c 2014-11-27
09:50:41 UTC (rev 34431)
@@ -1590,7 +1590,6 @@
s->intersection_op = GNUNET_SET_prepare (&s->peer,
&s->session_id,
NULL,
- GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK, UINT16_MAX),
GNUNET_SET_RESULT_REMOVED,
cb_intersection_element_removed,
s);
@@ -2308,7 +2307,6 @@
s->intersection_op = GNUNET_SET_prepare (&s->peer,
&s->session_id,
NULL,
- GNUNET_CRYPTO_random_u32
(GNUNET_CRYPTO_QUALITY_WEAK, UINT16_MAX),
GNUNET_SET_RESULT_REMOVED,
cb_intersection_element_removed,
s);
Modified: gnunet/src/set/gnunet-service-set.c
===================================================================
--- gnunet/src/set/gnunet-service-set.c 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/set/gnunet-service-set.c 2014-11-27 09:50:41 UTC (rev 34431)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2013 Christian Grothoff (and other contributing authors)
+ (C) 2013, 2014 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
@@ -17,11 +17,11 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file set/gnunet-service-set.c
* @brief two-peer set operations
* @author Florian Dold
+ * @author Christian Grothoff
*/
#include "gnunet-service-set.h"
#include "set_protocol.h"
@@ -629,7 +629,8 @@
spec->context_msg = GNUNET_copy_message (spec->context_msg);
spec->operation = ntohl (msg->operation);
spec->app_id = msg->app_id;
- spec->salt = ntohl (msg->salt);
+ spec->salt = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
+ UINT32_MAX);
spec->peer = op->state->peer;
spec->remote_element_count = ntohl (msg->element_count);
@@ -729,7 +730,8 @@
GNUNET_SERVER_client_disconnect (client);
return;
}
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "iterating union set with %u
elements\n",
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "iterating union set with %u elements\n",
GNUNET_CONTAINER_multihashmap_size (set->elements));
GNUNET_SERVER_receive_done (client, GNUNET_OK);
set->iter = GNUNET_CONTAINER_multihashmap_iterator_create (set->elements);
@@ -767,7 +769,7 @@
set = GNUNET_new (struct Set);
- switch (ntohs (msg->operation))
+ switch (ntohl (msg->operation))
{
case GNUNET_SET_OPERATION_INTERSECTION:
set->vt = _GSS_intersection_vt ();
@@ -875,9 +877,9 @@
const struct GNUNET_MessageHeader *m)
{
struct Operation *incoming;
- const struct GNUNET_SET_AcceptRejectMessage *msg;
+ const struct GNUNET_SET_RejectMessage *msg;
- msg = (const struct GNUNET_SET_AcceptRejectMessage *) m;
+ msg = (const struct GNUNET_SET_RejectMessage *) m;
GNUNET_break (0 == ntohl (msg->request_id));
// no matching incoming operation for this reject
@@ -1143,10 +1145,10 @@
const struct GNUNET_MessageHeader *mh)
{
struct Set *set;
- const struct GNUNET_SET_AcceptRejectMessage *msg;
+ const struct GNUNET_SET_AcceptMessage *msg;
struct Operation *op;
- msg = (const struct GNUNET_SET_AcceptRejectMessage *) mh;
+ msg = (const struct GNUNET_SET_AcceptMessage *) mh;
// client without a set requested an operation
set = set_get (client);
@@ -1201,7 +1203,7 @@
op);
op->spec->client_request_id = ntohl (msg->request_id);
- op->spec->result_mode = ntohs (msg->result_mode);
+ op->spec->result_mode = ntohl (msg->result_mode);
op->generation_created = set->current_generation++;
op->vt = op->spec->set->vt;
GNUNET_assert (NULL != op->vt->accept);
@@ -1446,7 +1448,7 @@
{
static const struct GNUNET_SERVER_MessageHandler server_handlers[] = {
{handle_client_accept, NULL, GNUNET_MESSAGE_TYPE_SET_ACCEPT,
- sizeof (struct GNUNET_SET_AcceptRejectMessage)},
+ sizeof (struct GNUNET_SET_AcceptMessage)},
{handle_client_iter_ack, NULL, GNUNET_MESSAGE_TYPE_SET_ITER_ACK, 0},
{handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_ADD, 0},
{handle_client_create_set, NULL, GNUNET_MESSAGE_TYPE_SET_CREATE,
@@ -1457,7 +1459,7 @@
{handle_client_listen, NULL, GNUNET_MESSAGE_TYPE_SET_LISTEN,
sizeof (struct GNUNET_SET_ListenMessage)},
{handle_client_reject, NULL, GNUNET_MESSAGE_TYPE_SET_REJECT,
- sizeof (struct GNUNET_SET_AcceptRejectMessage)},
+ sizeof (struct GNUNET_SET_RejectMessage)},
{handle_client_add_remove, NULL, GNUNET_MESSAGE_TYPE_SET_REMOVE, 0},
{handle_client_cancel, NULL, GNUNET_MESSAGE_TYPE_SET_CANCEL,
sizeof (struct GNUNET_SET_CancelMessage)},
Modified: gnunet/src/set/gnunet-service-set.h
===================================================================
--- gnunet/src/set/gnunet-service-set.h 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/set/gnunet-service-set.h 2014-11-27 09:50:41 UTC (rev 34431)
@@ -1,6 +1,6 @@
/*
This file is part of GNUnet
- (C) 2013 Christian Grothoff (and other contributing authors)
+ (C) 2013, 2014 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
@@ -17,7 +17,6 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
* @file set/gnunet-service-set.h
* @brief common components for the implementation the different set operations
Modified: gnunet/src/set/gnunet-set-profiler.c
===================================================================
--- gnunet/src/set/gnunet-set-profiler.c 2014-11-24 14:18:22 UTC (rev
34430)
+++ gnunet/src/set/gnunet-set-profiler.c 2014-11-27 09:50:41 UTC (rev
34431)
@@ -35,8 +35,6 @@
static unsigned int num_b = 5;
static unsigned int num_c = 20;
-static unsigned int salt = 42;
-
static char *op_str = "union";
const static struct GNUNET_CONFIGURATION_Handle *config;
@@ -51,13 +49,13 @@
int done;
} info1, info2;
-struct GNUNET_CONTAINER_MultiHashMap *common_sent;
+static struct GNUNET_CONTAINER_MultiHashMap *common_sent;
-struct GNUNET_HashCode app_id;
+static struct GNUNET_HashCode app_id;
-struct GNUNET_PeerIdentity local_peer;
+static struct GNUNET_PeerIdentity local_peer;
-struct GNUNET_SET_ListenHandle *set_listener;
+static struct GNUNET_SET_ListenHandle *set_listener;
static int
@@ -77,6 +75,7 @@
}
+
static void
check_all_done (void)
{
@@ -270,8 +269,9 @@
set_listener = GNUNET_SET_listen (config, GNUNET_SET_OPERATION_UNION,
&app_id, set_listen_cb, NULL);
- info1.oh = GNUNET_SET_prepare (&local_peer, &app_id, NULL, salt,
GNUNET_SET_RESULT_ADDED,
- set_result_cb, &info1);
+ info1.oh = GNUNET_SET_prepare (&local_peer, &app_id, NULL,
+ GNUNET_SET_RESULT_ADDED,
+ set_result_cb, &info1);
GNUNET_SET_commit (info1.oh, info1.set);
GNUNET_SET_destroy (info1.set);
info1.set = NULL;
Modified: gnunet/src/set/set.h
===================================================================
--- gnunet/src/set/set.h 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/set/set.h 2014-11-27 09:50:41 UTC (rev 34431)
@@ -17,11 +17,11 @@
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
-
/**
- * @author Florian Dold
* @file set/set.h
* @brief messages used for the set api
+ * @author Florian Dold
+ * @author Christian Grothoff
*/
#ifndef SET_H
#define SET_H
@@ -29,6 +29,9 @@
#include "platform.h"
#include "gnunet_common.h"
+/**
+ * FIXME
+ */
#define GNUNET_SET_ACK_WINDOW 10
@@ -37,27 +40,26 @@
struct GNUNET_SET_CreateMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_CREATE
+ * Type: #GNUNET_MESSAGE_TYPE_SET_CREATE
*/
struct GNUNET_MessageHeader header;
/**
- * Operation type, values of enum GNUNET_SET_OperationType
+ * Operation type, values of `enum GNUNET_SET_OperationType`
*/
- // FIXME: use 32_t for 'enum'.
- uint16_t operation GNUNET_PACKED;
+ uint32_t operation GNUNET_PACKED;
};
struct GNUNET_SET_ListenMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_LISTEN
+ * Type: #GNUNET_MESSAGE_TYPE_SET_LISTEN
*/
struct GNUNET_MessageHeader header;
/**
- * Operation type, values of enum GNUNET_SET_OperationType
+ * Operation type, values of `enum GNUNET_SET_OperationType`
*/
uint32_t operation GNUNET_PACKED;
@@ -69,11 +71,10 @@
};
-struct GNUNET_SET_AcceptRejectMessage
+struct GNUNET_SET_AcceptMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_ACCEPT or
- * GNUNET_MESSAGE_TYPE_SET_REJECT
+ * Type: #GNUNET_MESSAGE_TYPE_SET_ACCEPT
*/
struct GNUNET_MessageHeader header;
@@ -90,33 +91,54 @@
/**
* How should results be sent to us?
- * See enum GNUNET_SET_ResultMode.
+ * See `enum GNUNET_SET_ResultMode`.
*/
- uint16_t result_mode GNUNET_PACKED;
+ uint32_t result_mode GNUNET_PACKED;
};
+struct GNUNET_SET_RejectMessage
+{
+ /**
+ * Type: #GNUNET_MESSAGE_TYPE_SET_REJECT
+ */
+ struct GNUNET_MessageHeader header;
+
+ /**
+ * 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;
+
+};
+
+
/**
* 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;
/**
- * Identity of the requesting peer.
- */
- struct GNUNET_PeerIdentity peer_id;
-
- /**
* ID of the to identify the request when accepting or
* rejecting it.
*/
uint32_t accept_id GNUNET_PACKED;
+ /**
+ * Identity of the requesting peer.
+ */
+ struct GNUNET_PeerIdentity peer_id;
+
/* rest: nested context message */
};
@@ -124,7 +146,7 @@
struct GNUNET_SET_EvaluateMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_EVALUATE
+ * Type: #GNUNET_MESSAGE_TYPE_SET_EVALUATE
*/
struct GNUNET_MessageHeader header;
@@ -144,15 +166,15 @@
struct GNUNET_HashCode app_id;
/**
- * Salt to use for the operation
+ * Salt to use for the operation.
*/
- uint16_t salt GNUNET_PACKED;
+ uint32_t salt GNUNET_PACKED;
/**
* How should results be sent to us?
- * See enum GNUNET_SET_ResultMode.
+ * See `enum GNUNET_SET_ResultMode`.
*/
- uint16_t result_mode GNUNET_PACKED;
+ uint32_t result_mode GNUNET_PACKED;
/* rest: inner message */
};
@@ -161,7 +183,7 @@
struct GNUNET_SET_ResultMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_RESULT
+ * Type: #GNUNET_MESSAGE_TYPE_SET_RESULT
*/
struct GNUNET_MessageHeader header;
@@ -188,8 +210,8 @@
struct GNUNET_SET_ElementMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_ADD or
- * GNUNET_MESSAGE_TYPE_SET_REMOVE
+ * Type: #GNUNET_MESSAGE_TYPE_SET_ADD or
+ * #GNUNET_MESSAGE_TYPE_SET_REMOVE
*/
struct GNUNET_MessageHeader header;
@@ -208,7 +230,7 @@
struct GNUNET_SET_CancelMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_CANCEL
+ * Type: #GNUNET_MESSAGE_TYPE_SET_CANCEL
*/
struct GNUNET_MessageHeader header;
@@ -218,10 +240,11 @@
uint32_t request_id GNUNET_PACKED;
};
+
struct GNUNET_SET_IterResponseMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
+ * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_RESPONSE
*/
struct GNUNET_MessageHeader header;
@@ -237,7 +260,7 @@
struct GNUNET_SET_IterAckMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_ITER_ACK
+ * Type: #GNUNET_MESSAGE_TYPE_SET_ITER_ACK
*/
struct GNUNET_MessageHeader header;
Modified: gnunet/src/set/set_api.c
===================================================================
--- gnunet/src/set/set_api.c 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/set/set_api.c 2014-11-27 09:50:41 UTC (rev 34431)
@@ -319,14 +319,16 @@
* @param mh the message
*/
static void
-handle_request (void *cls, const struct GNUNET_MessageHeader *mh)
+handle_request (void *cls,
+ const struct GNUNET_MessageHeader *mh)
{
const struct GNUNET_SET_RequestMessage *msg = (const struct
GNUNET_SET_RequestMessage *) mh;
struct GNUNET_SET_ListenHandle *lh = cls;
struct GNUNET_SET_Request *req;
struct GNUNET_MessageHeader *context_msg;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "processing operation request\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "processing operation request\n");
req = GNUNET_new (struct GNUNET_SET_Request);
req->accept_id = ntohl (msg->accept_id);
context_msg = GNUNET_MQ_extract_nested_mh (msg);
@@ -339,18 +341,21 @@
if (GNUNET_NO == req->accepted)
{
struct GNUNET_MQ_Envelope *mqm;
- struct GNUNET_SET_AcceptRejectMessage *amsg;
+ struct GNUNET_SET_RejectMessage *rmsg;
- mqm = GNUNET_MQ_msg (amsg, GNUNET_MESSAGE_TYPE_SET_REJECT);
+ mqm = GNUNET_MQ_msg (rmsg,
+ GNUNET_MESSAGE_TYPE_SET_REJECT);
/* no request id, as we refused */
- amsg->request_id = htonl (0);
- amsg->accept_reject_id = msg->accept_id;
+ rmsg->request_id = htonl (0);
+ rmsg->accept_reject_id = msg->accept_id;
GNUNET_MQ_send (lh->mq, mqm);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "rejecting request\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "rejecting request\n");
}
GNUNET_free (req);
- LOG (GNUNET_ERROR_TYPE_DEBUG, "processed op request from service\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "processed op request from service\n");
/* the accept-case is handled in GNUNET_SET_accept,
* as we have the accept message available there */
@@ -362,13 +367,14 @@
{
struct GNUNET_SET_ListenHandle *lh = cls;
- LOG (GNUNET_ERROR_TYPE_DEBUG, "listener broke down, re-connecting\n");
+ LOG (GNUNET_ERROR_TYPE_DEBUG,
+ "listener broke down, re-connecting\n");
GNUNET_CLIENT_disconnect (lh->client);
lh->client = NULL;
GNUNET_MQ_destroy (lh->mq);
lh->mq = NULL;
-
- lh->reconnect_task = GNUNET_SCHEDULER_add_delayed (lh->reconnect_backoff,
listen_connect, lh);
+ lh->reconnect_task = GNUNET_SCHEDULER_add_delayed (lh->reconnect_backoff,
+ &listen_connect, lh);
lh->reconnect_backoff = GNUNET_TIME_STD_BACKOFF (lh->reconnect_backoff);
}
@@ -492,15 +498,15 @@
GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg,
enum GNUNET_SET_OperationType op)
{
- struct GNUNET_SET_Handle *set;
- struct GNUNET_MQ_Envelope *mqm;
- struct GNUNET_SET_CreateMessage *msg;
static const struct GNUNET_MQ_MessageHandler mq_handlers[] = {
{handle_result, GNUNET_MESSAGE_TYPE_SET_RESULT, 0},
{handle_iter_element, GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT, 0},
{handle_iter_done, GNUNET_MESSAGE_TYPE_SET_ITER_DONE, 0},
GNUNET_MQ_HANDLERS_END
};
+ struct GNUNET_SET_Handle *set;
+ struct GNUNET_MQ_Envelope *mqm;
+ struct GNUNET_SET_CreateMessage *msg;
set = GNUNET_new (struct GNUNET_SET_Handle);
set->client = GNUNET_CLIENT_connect ("set", cfg);
@@ -510,7 +516,7 @@
handle_client_set_error,
set);
GNUNET_assert (NULL != set->mq);
mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_CREATE);
- msg->operation = htons (op);
+ msg->operation = htonl (op);
GNUNET_MQ_send (set->mq, mqm);
return set;
}
@@ -607,25 +613,21 @@
/**
* Prepare a set operation to be evaluated with another peer.
* The evaluation will not start until the client provides
- * a local set with GNUNET_SET_commit.
+ * a local set with #GNUNET_SET_commit().
*
* @param other_peer peer with the other set
* @param app_id hash for the application using the set
* @param context_msg additional information for the request
- * @param salt salt used for the set operation; sometimes set operations
- * fail due to hash collisions, using a different salt for each
operation
- * makes it harder for an attacker to exploit this
* @param result_mode specified how results will be returned,
- * see 'GNUNET_SET_ResultMode'.
+ * see `enum GNUNET_SET_ResultMode`.
* @param result_cb called on error or success
- * @param result_cls closure for result_cb
+ * @param result_cls closure for @e result_cb
* @return a handle to cancel the operation
*/
struct GNUNET_SET_OperationHandle *
GNUNET_SET_prepare (const struct GNUNET_PeerIdentity *other_peer,
const struct GNUNET_HashCode *app_id,
const struct GNUNET_MessageHeader *context_msg,
- uint16_t salt,
enum GNUNET_SET_ResultMode result_mode,
GNUNET_SET_ResultIterator result_cb,
void *result_cls)
@@ -638,12 +640,12 @@
oh->result_cb = result_cb;
oh->result_cls = result_cls;
- mqm = GNUNET_MQ_msg_nested_mh (msg, GNUNET_MESSAGE_TYPE_SET_EVALUATE,
context_msg);
-
+ mqm = GNUNET_MQ_msg_nested_mh (msg,
+ GNUNET_MESSAGE_TYPE_SET_EVALUATE,
+ context_msg);
msg->app_id = *app_id;
- msg->result_mode = htons (result_mode);
+ msg->result_mode = htonl (result_mode);
msg->target_peer = *other_peer;
- msg->salt = salt;
oh->conclude_mqm = mqm;
oh->request_id_addr = &msg->request_id;
@@ -767,9 +769,9 @@
*
* @param request request to accept
* @param result_mode specified how results will be returned,
- * see 'GNUNET_SET_ResultMode'.
+ * see `enum GNUNET_SET_ResultMode`.
* @param result_cb callback for the results
- * @param result_cls closure for result_cb
+ * @param result_cls closure for @a result_cb
* @return a handle to cancel the operation
*/
struct GNUNET_SET_OperationHandle *
@@ -780,7 +782,7 @@
{
struct GNUNET_MQ_Envelope *mqm;
struct GNUNET_SET_OperationHandle *oh;
- struct GNUNET_SET_AcceptRejectMessage *msg;
+ struct GNUNET_SET_AcceptMessage *msg;
GNUNET_assert (NULL != request);
GNUNET_assert (GNUNET_NO == request->accepted);
@@ -792,7 +794,7 @@
mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_ACCEPT);
msg->accept_reject_id = htonl (request->accept_id);
- msg->result_mode = htons (result_mode);
+ msg->result_mode = htonl (result_mode);
oh->conclude_mqm = mqm;
oh->request_id_addr = &msg->request_id;
Modified: gnunet/src/set/set_protocol.h
===================================================================
--- gnunet/src/set/set_protocol.h 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/set/set_protocol.h 2014-11-27 09:50:41 UTC (rev 34431)
@@ -35,24 +35,24 @@
struct OperationRequestMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
+ * Type: #GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
*/
struct GNUNET_MessageHeader header;
/**
- * Operation to request, values from 'enum GNUNET_SET_OperationType'
+ * Operation to request, values from `enum GNUNET_SET_OperationType`
*/
uint32_t operation GNUNET_PACKED;
/**
* Salt to use for this operation.
*/
- uint32_t salt;
+ uint32_t salt GNUNET_PACKED;
/**
* For Intersection: my element count
*/
- uint32_t element_count;
+ uint32_t element_count GNUNET_PACKED;
/**
* Application-specific identifier of the request.
@@ -62,10 +62,11 @@
/* rest: optional message */
};
+
struct IBFMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_P2P_IBF
+ * Type: #GNUNET_MESSAGE_TYPE_SET_P2P_IBF
*/
struct GNUNET_MessageHeader header;
@@ -88,15 +89,16 @@
/**
* Salt used when hashing elements for this IBF.
*/
- uint32_t salt;
+ uint32_t salt GNUNET_PACKED;
/* rest: strata */
};
+
struct BFMessage
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
+ * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
*/
struct GNUNET_MessageHeader header;
@@ -130,10 +132,11 @@
*/
};
+
struct BFPart
{
/**
- * Type: GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
+ * Type: #GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
*/
struct GNUNET_MessageHeader header;
Modified: gnunet/src/set/test_set_api.c
===================================================================
--- gnunet/src/set/test_set_api.c 2014-11-24 14:18:22 UTC (rev 34430)
+++ gnunet/src/set/test_set_api.c 2014-11-27 09:50:41 UTC (rev 34431)
@@ -130,7 +130,7 @@
listen_handle = GNUNET_SET_listen (config, GNUNET_SET_OPERATION_UNION,
&app_id, listen_cb, NULL);
- oh = GNUNET_SET_prepare (&local_id, &app_id, &context_msg, 42,
+ oh = GNUNET_SET_prepare (&local_id, &app_id, &context_msg,
GNUNET_SET_RESULT_ADDED,
result_cb_set1, NULL);
GNUNET_SET_commit (oh, set1);
@@ -275,7 +275,7 @@
///* test if canceling an uncommited request works! */
- my_oh = GNUNET_SET_prepare (&local_id, &app_id, NULL, 0,
+ my_oh = GNUNET_SET_prepare (&local_id, &app_id, NULL,
GNUNET_SET_RESULT_ADDED, NULL, NULL);
GNUNET_SET_operation_cancel (my_oh);
Modified: gnunet/src/set/test_set_intersection_result_full.c
===================================================================
--- gnunet/src/set/test_set_intersection_result_full.c 2014-11-24 14:18:22 UTC
(rev 34430)
+++ gnunet/src/set/test_set_intersection_result_full.c 2014-11-27 09:50:41 UTC
(rev 34431)
@@ -133,7 +133,7 @@
&listen_cb, NULL);
oh = GNUNET_SET_prepare (&local_id,
&app_id,
- &context_msg, 42,
+ &context_msg,
GNUNET_SET_RESULT_FULL,
&result_cb_set1, NULL);
GNUNET_SET_commit (oh, set1);
Modified: gnunet/src/set/test_set_union_result_full.c
===================================================================
--- gnunet/src/set/test_set_union_result_full.c 2014-11-24 14:18:22 UTC (rev
34430)
+++ gnunet/src/set/test_set_union_result_full.c 2014-11-27 09:50:41 UTC (rev
34431)
@@ -131,7 +131,7 @@
listen_handle = GNUNET_SET_listen (config, GNUNET_SET_OPERATION_UNION,
&app_id, listen_cb, NULL);
- oh = GNUNET_SET_prepare (&local_id, &app_id, &context_msg, 42,
+ oh = GNUNET_SET_prepare (&local_id, &app_id, &context_msg,
GNUNET_SET_RESULT_FULL,
result_cb_set1, NULL);
GNUNET_SET_commit (oh, set1);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r34431 - in gnunet/src: consensus dv include revocation scalarproduct set,
gnunet <=