aboutsummaryrefslogtreecommitdiff
path: root/src/setu/setu_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/setu/setu_api.c')
-rw-r--r--src/setu/setu_api.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/setu/setu_api.c b/src/setu/setu_api.c
index 0a09b18b2..faa57aaba 100644
--- a/src/setu/setu_api.c
+++ b/src/setu/setu_api.c
@@ -22,6 +22,7 @@
22 * @brief api for the set union service 22 * @brief api for the set union service
23 * @author Florian Dold 23 * @author Florian Dold
24 * @author Christian Grothoff 24 * @author Christian Grothoff
25 * @author Elias Summermatter
25 */ 26 */
26#include "platform.h" 27#include "platform.h"
27#include "gnunet_util_lib.h" 28#include "gnunet_util_lib.h"
@@ -526,6 +527,14 @@ GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer,
526 context_msg); 527 context_msg);
527 msg->app_id = *app_id; 528 msg->app_id = *app_id;
528 msg->target_peer = *other_peer; 529 msg->target_peer = *other_peer;
530
531 /* Set default values */
532 msg->byzantine_upper_bond = UINT64_MAX;
533 msg->bandwidth_latency_tradeoff = 0;
534 msg->ibf_bucket_number_factor = 2;
535 msg->ibf_number_of_buckets_per_element = 3;
536
537
529 for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++) 538 for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++)
530 { 539 {
531 switch (opt->type) 540 switch (opt->type)
@@ -534,6 +543,18 @@ GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer,
534 msg->byzantine = GNUNET_YES; 543 msg->byzantine = GNUNET_YES;
535 msg->byzantine_lower_bound = htonl (opt->v.num); 544 msg->byzantine_lower_bound = htonl (opt->v.num);
536 break; 545 break;
546 case GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND:
547 msg->byzantine_upper_bond = htonl (opt->v.num);
548 break;
549 case GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF:
550 msg->bandwidth_latency_tradeoff = htonl (opt->v.num);
551 break;
552 case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR:
553 msg->ibf_bucket_number_factor = htonl (opt->v.num);
554 break;
555 case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT:
556 msg->ibf_number_of_buckets_per_element = htonl (opt->v.num);
557 break;
537 case GNUNET_SETU_OPTION_FORCE_FULL: 558 case GNUNET_SETU_OPTION_FORCE_FULL:
538 msg->force_full = GNUNET_YES; 559 msg->force_full = GNUNET_YES;
539 break; 560 break;
@@ -788,6 +809,13 @@ GNUNET_SETU_accept (struct GNUNET_SETU_Request *request,
788 mqm = GNUNET_MQ_msg (msg, 809 mqm = GNUNET_MQ_msg (msg,
789 GNUNET_MESSAGE_TYPE_SETU_ACCEPT); 810 GNUNET_MESSAGE_TYPE_SETU_ACCEPT);
790 msg->accept_reject_id = htonl (request->accept_id); 811 msg->accept_reject_id = htonl (request->accept_id);
812
813 /* Set default values */
814 msg->byzantine_upper_bond = UINT64_MAX;
815 msg->bandwidth_latency_tradeoff = 0;
816 msg->ibf_bucket_number_factor = 2;
817 msg->ibf_number_of_buckets_per_element = 3;
818
791 for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++) 819 for (const struct GNUNET_SETU_Option *opt = options; opt->type != 0; opt++)
792 { 820 {
793 switch (opt->type) 821 switch (opt->type)
@@ -796,6 +824,18 @@ GNUNET_SETU_accept (struct GNUNET_SETU_Request *request,
796 msg->byzantine = GNUNET_YES; 824 msg->byzantine = GNUNET_YES;
797 msg->byzantine_lower_bound = htonl (opt->v.num); 825 msg->byzantine_lower_bound = htonl (opt->v.num);
798 break; 826 break;
827 case GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND:
828 msg->byzantine_upper_bond = htonl (opt->v.num);
829 break;
830 case GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF:
831 msg->bandwidth_latency_tradeoff = htonl (opt->v.num);
832 break;
833 case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR:
834 msg->ibf_bucket_number_factor = htonl (opt->v.num);
835 break;
836 case GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT:
837 msg->ibf_number_of_buckets_per_element = htonl (opt->v.num);
838 break;
799 case GNUNET_SETU_OPTION_FORCE_FULL: 839 case GNUNET_SETU_OPTION_FORCE_FULL:
800 msg->force_full = GNUNET_YES; 840 msg->force_full = GNUNET_YES;
801 break; 841 break;