gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [gnunet] 01/02: add option parsing


From: gnunet
Subject: [GNUnet-SVN] [gnunet] 01/02: add option parsing
Date: Fri, 24 Feb 2017 18:10:15 +0100

This is an automated email from the git hooks/post-receive script.

dold pushed a commit to branch master
in repository gnunet.

commit 592b43fdf3f3572892f4095808daf22010469d0b
Author: Florian Dold <address@hidden>
AuthorDate: Fri Feb 24 15:50:48 2017 +0100

    add option parsing
---
 src/set/gnunet-service-set.c |  8 ++++++++
 src/set/gnunet-service-set.h | 24 ++++++++++++++++++++++
 src/set/set.h                | 48 ++++++++++++++++++++++++++++++++++++++++++++
 src/set/set_api.c            | 20 ++++++++++++++++++
 4 files changed, 100 insertions(+)

diff --git a/src/set/gnunet-service-set.c b/src/set/gnunet-service-set.c
index e3e1afe08..126bf02d2 100644
--- a/src/set/gnunet-service-set.c
+++ b/src/set/gnunet-service-set.c
@@ -1683,6 +1683,10 @@ handle_client_evaluate (void *cls,
   spec->set = set;
   spec->result_mode = ntohl (msg->result_mode);
   spec->client_request_id = ntohl (msg->request_id);
+  spec->byzantine = msg->byzantine;
+  spec->byzantine_lower_bound = msg->byzantine_lower_bound;
+  spec->force_full = msg->force_full;
+  spec->force_delta = msg->force_delta;
   context = GNUNET_MQ_extract_nested_mh (msg);
   op->spec = spec;
 
@@ -2019,6 +2023,10 @@ handle_client_accept (void *cls,
                                op);
   op->spec->client_request_id = ntohl (msg->request_id);
   op->spec->result_mode = ntohl (msg->result_mode);
+  op->spec->byzantine = msg->byzantine;
+  op->spec->byzantine_lower_bound = msg->byzantine_lower_bound;
+  op->spec->force_full = msg->force_full;
+  op->spec->force_delta = msg->force_delta;
 
   // Advance generation values, so that
   // mutations won't interfer with the running operation.
diff --git a/src/set/gnunet-service-set.h b/src/set/gnunet-service-set.h
index 1460707fa..68d8fe81f 100644
--- a/src/set/gnunet-service-set.h
+++ b/src/set/gnunet-service-set.h
@@ -119,6 +119,30 @@ struct OperationSpecification
    * When are elements sent to the client, and which elements are sent?
    */
   enum GNUNET_SET_ResultMode result_mode;
+
+  /**
+   * Always use delta operation instead of sending full sets,
+   * even it it's less efficient.
+   */
+  int force_delta;
+
+  /**
+   * Always send full sets, even if delta operations would
+   * be more efficient.
+   */
+  int force_full;
+
+  /**
+   * #GNUNET_YES to fail operations where Byzantine faults
+   * are suspected
+   */
+  int byzantine;
+
+  /**
+   * Lower bound for the set size, used only when
+   * byzantine mode is enabled.
+   */
+  int byzantine_lower_bound;
 };
 
 
diff --git a/src/set/set.h b/src/set/set.h
index f31216cb8..207f098bc 100644
--- a/src/set/set.h
+++ b/src/set/set.h
@@ -102,6 +102,30 @@ struct GNUNET_SET_AcceptMessage
    * See `enum GNUNET_SET_ResultMode`.
    */
   uint32_t result_mode GNUNET_PACKED;
+
+  /**
+   * Always use delta operation instead of sending full sets,
+   * even it it's less efficient.
+   */
+  uint8_t force_delta;
+
+  /**
+   * Always send full sets, even if delta operations would
+   * be more efficient.
+   */
+  uint8_t force_full;
+
+  /**
+   * #GNUNET_YES to fail operations where Byzantine faults
+   * are suspected
+   */
+  uint8_t byzantine;
+
+  /**
+   * Lower bound for the set size, used only when
+   * byzantine mode is enabled.
+   */
+  uint8_t byzantine_lower_bound;
 };
 
 
@@ -184,6 +208,30 @@ struct GNUNET_SET_EvaluateMessage
    */
   uint32_t request_id GNUNET_PACKED;
 
+  /**
+   * Always use delta operation instead of sending full sets,
+   * even it it's less efficient.
+   */
+  uint8_t force_delta;
+
+  /**
+   * Always send full sets, even if delta operations would
+   * be more efficient.
+   */
+  uint8_t force_full;
+
+  /**
+   * #GNUNET_YES to fail operations where Byzantine faults
+   * are suspected
+   */
+  uint8_t byzantine;
+
+  /**
+   * Lower bound for the set size, used only when
+   * byzantine mode is enabled.
+   */
+  uint8_t byzantine_lower_bound;
+
   /* rest: context message, that is, application-specific
      message to convince listener to pick up */
 };
diff --git a/src/set/set_api.c b/src/set/set_api.c
index c2e2cd1e9..2b09725e8 100644
--- a/src/set/set_api.c
+++ b/src/set/set_api.c
@@ -773,6 +773,7 @@ GNUNET_SET_prepare (const struct GNUNET_PeerIdentity 
*other_peer,
   struct GNUNET_MQ_Envelope *mqm;
   struct GNUNET_SET_OperationHandle *oh;
   struct GNUNET_SET_EvaluateMessage *msg;
+  struct GNUNET_SET_Option *opt;
 
   LOG (GNUNET_ERROR_TYPE_DEBUG,
        "Client prepares set operation (%d)\n",
@@ -786,6 +787,25 @@ GNUNET_SET_prepare (const struct GNUNET_PeerIdentity 
*other_peer,
   msg->app_id = *app_id;
   msg->result_mode = htonl (result_mode);
   msg->target_peer = *other_peer;
+  for (opt = options; opt->type != 0; opt++)
+  {
+    switch (opt->type)
+    {
+      case GNUNET_SET_OPTION_BYZANTINE:
+        msg->byzantine = GNUNET_YES;
+        msg->byzantine_lower_bound = opt->v.num;
+        break;
+      case GNUNET_SET_OPTION_FORCE_FULL:
+        msg->force_full = GNUNET_YES;
+        break;
+      case GNUNET_SET_OPTION_FORCE_DELTA:
+        msg->force_delta = GNUNET_YES;
+        break;
+      default:
+        LOG (GNUNET_ERROR_TYPE_ERROR, 
+             "Option with type %d not recognized\n", (int) opt->type);
+    }
+  }
   oh->conclude_mqm = mqm;
   oh->request_id_addr = &msg->request_id;
 

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]