40#define LOG(kind, ...) GNUNET_log_from (kind, "setu", __VA_ARGS__)
46#define INCOMING_CHANNEL_TIMEOUT GNUNET_TIME_UNIT_MINUTES
51#define SE_STRATA_COUNT 32
58#define SE_IBFS_TOTAL_SIZE 632
63#define SE_IBF_HASH_NUM 3
68#define MAX_BUCKETS_PER_MESSAGE ((1 << 16) / IBF_BUCKET_SIZE)
75#define MAX_IBF_SIZE 1048576
82#define IBF_MIN_SIZE 37
88#define DIFFERENTIAL_RTT_MEAN 3.65145
94#define SECURITY_LEVEL 80
101#define PROBABILITY_FOR_NEW_ROUND 0.15
107#define MEASURE_PERFORMANCE 0
760#if MEASURE_PERFORMANCE
773struct perf_num_send_received_msg
776 uint64_t sent_var_bytes;
778 uint64_t received_var_bytes;
784struct per_store_struct
786 struct perf_num_send_received_msg operation_request;
787 struct perf_num_send_received_msg se;
788 struct perf_num_send_received_msg request_full;
789 struct perf_num_send_received_msg element_full;
790 struct perf_num_send_received_msg full_done;
791 struct perf_num_send_received_msg ibf;
792 struct perf_num_send_received_msg inquery;
793 struct perf_num_send_received_msg element;
794 struct perf_num_send_received_msg demand;
795 struct perf_num_send_received_msg offer;
796 struct perf_num_send_received_msg done;
797 struct perf_num_send_received_msg over;
799 uint64_t se_diff_remote;
800 uint64_t se_diff_local;
801 uint64_t active_passive_switches;
802 uint8_t mode_of_operation;
805struct per_store_struct perf_store;
878#if MEASURE_PERFORMANCE
896 "BUCKET_NUMBER_FACTOR",
898 op->ibf_bucket_number_factor = fl;
903 op->ibf_number_buckets_per_element =
number;
908 op->rtt_bandwidth_tradeoff =
number;
925sum_sent_received_bytes (uint64_t
size,
926 struct perf_num_send_received_msg
927 perf_num_send_received_msg)
929 return (
size * perf_num_send_received_msg.sent)
930 + (
size * perf_num_send_received_msg.received)
931 + perf_num_send_received_msg.sent_var_bytes
932 + perf_num_send_received_msg.received_var_bytes;
940calculate_perf_store ()
947 int bytes_transmitted = 0;
952 if ((perf_store.element_full.received != 0) ||
953 (perf_store.element_full.sent != 0)
957 if ((perf_store.request_full.received != 0) ||
958 (perf_store.request_full.sent != 0)
966 if ((perf_store.element.received != 0) ||
967 (perf_store.element.sent != 0))
969 int iterations = perf_store.active_passive_switches;
972 rtt += iterations * 0.5;
980 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct
982 perf_store.request_full);
984 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct
986 perf_store.element_full);
987 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct
991 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct
994 bytes_transmitted += sum_sent_received_bytes (4, perf_store.full_done);
995 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct IBFMessage),
997 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct InquiryMessage),
999 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct
1002 bytes_transmitted += sum_sent_received_bytes (
sizeof(
struct
1005 bytes_transmitted += sum_sent_received_bytes (4, perf_store.done);
1013 long long num_per_bucket;
1019 if (perf_store.active_passive_switches == 0)
1021 int ibf_bytes_transmitted = sum_sent_received_bytes (
sizeof(
struct
1025 FILE *out1 = fopen (
"perf_data.csv",
"a");
1026 fprintf (out1,
"%d,%f,%d,%d,%f,%d,%d,%d,%d,%d\n",num_per_bucket,factor,
1027 decoded,ibf_bytes_transmitted,rtt,perf_store.se_diff,
1029 perf_store.se_diff_local,perf_store.se_diff_remote,
1030 perf_store.mode_of_operation);
1051 uint64_t local_set_size,
1052 uint64_t remote_set_size,
1053 uint64_t est_set_diff_remote,
1054 uint64_t est_set_diff_local,
1055 uint64_t bandwith_latency_tradeoff,
1056 uint64_t ibf_bucket_number_factor)
1063 if (0 == local_set_size)
1065 if (0 == remote_set_size)
1072 uint8_t sizeof_full_done_header = 4;
1073 uint8_t sizeof_done_header = 4;
1074 uint8_t rtt_min_full = 2;
1075 uint8_t sizeof_request_full = 4;
1076 uint64_t estimated_total_diff = (est_set_diff_remote + est_set_diff_local);
1079 uint64_t total_elements_to_send_local_send_first = est_set_diff_remote
1082 uint64_t total_bytes_full_local_send_first = (avg_element_size
1084 total_elements_to_send_local_send_first) \
1086 total_elements_to_send_local_send_first *
sizeof(
struct
1089 + (sizeof_full_done_header * 2) \
1091 * bandwith_latency_tradeoff;
1094 uint64_t total_elements_to_send_remote_send_first = est_set_diff_local
1097 uint64_t total_bytes_full_remote_send_first = (avg_element_size
1099 total_elements_to_send_remote_send_first) \
1101 total_elements_to_send_remote_send_first *
sizeof(
struct
1103 + (sizeof_full_done_header * 2
1105 + (rtt_min_full + 0.5)
1106 * bandwith_latency_tradeoff \
1107 + sizeof_request_full;
1115 long double ibf_bucket_count = estimated_total_diff
1116 * ibf_bucket_number_factor;
1123 uint64_t ibf_message_count = ceil ( ((
float) ibf_bucket_count)
1126 uint64_t estimated_counter_size = ceil (
1127 MIN (2 * log2l (((
float) local_set_size)
1128 / ((
float) ibf_bucket_count)),
1129 log2l (local_set_size)));
1131 long double counter_bytes = (float) estimated_counter_size / 8;
1133 uint64_t ibf_bytes = ceil ((
sizeof (
struct IBFMessage) * ibf_message_count
1136 + (ibf_bucket_count *
sizeof(
struct IBF_Key))
1138 + (ibf_bucket_count *
sizeof(
struct
1141 + (ibf_bucket_count * counter_bytes) * 1.2);
1144 uint64_t element_size = (avg_element_size
1146 * estimated_total_diff;
1147 uint64_t done_size = sizeof_done_header;
1148 uint64_t inquery_size = (
sizeof (
struct IBF_Key)
1150 * estimated_total_diff;
1151 uint64_t demand_size =
1153 * estimated_total_diff;
1156 * estimated_total_diff;
1158 uint64_t total_bytes_diff = (element_size + done_size + inquery_size
1159 + demand_size + offer_size + ibf_bytes) \
1161 * bandwith_latency_tradeoff);
1163 uint64_t full_min = MIN (total_bytes_full_local_send_first,
1164 total_bytes_full_remote_send_first);
1168 if (full_min < total_bytes_diff)
1171 if (total_bytes_full_remote_send_first >
1172 total_bytes_full_local_send_first
1207 for (uint32_t phase_ctr = 0; phase_ctr < size_phases; phase_ctr++)
1209 uint8_t
phase = allowed_phases[phase_ctr];
1213 "Message received in valid phase\n");
1218 "Received message in invalid phase: %u\n",
op->phase);
1253 "Received an element without sent offer!\n");
1261 "Received an element that was not demanded\n");
1307 if (new_mcfs <= *mcfs)
1411 op->total_elements_size_local += element->
size;
1443 &
op->set->content->elements_randomized_salt,
1500 "Union operation failed\n");
1502 "# Union operations failed",
1517 "# Union operations succeeded",
1521 "Signalling client that union operation is done\n");
1528 op->key_to_element));
1549 if (
op->remote_element_count +
op->remote_set_diff >
1550 op->byzantine_upper_bound)
1552 if (
op->local_element_count +
op->local_set_diff >
op->byzantine_upper_bound)
1558 if (
op->remote_element_count <
op->byzantine_lower_bound)
1591 struct Set *set =
op->set;
1595 "Destroying union operation %p\n",
1599 if (NULL !=
op->remote_ibf)
1602 op->remote_ibf = NULL;
1604 if (NULL !=
op->demanded_hashes)
1607 op->demanded_hashes = NULL;
1609 if (NULL !=
op->local_ibf)
1612 op->local_ibf = NULL;
1619 if (NULL !=
op->key_to_element)
1625 op->key_to_element = NULL;
1627 if (NULL !=
op->message_control_flow)
1633 op->message_control_flow = NULL;
1635 if (NULL !=
op->inquiries_sent)
1638 op->inquiries_sent = NULL;
1647 if (NULL !=
op->context_msg)
1650 op->context_msg = NULL;
1652 if (NULL != (channel =
op->channel))
1684 "Destroying incoming operation %p\n",
1686 if (NULL != (listener =
op->listener))
1691 op->listener = NULL;
1693 if (NULL !=
op->timeout_task)
1696 op->timeout_task = NULL;
1712 if (NULL != (channel =
op->channel))
1719 if (NULL !=
op->listener)
1724 if (NULL !=
op->set)
1744 "union operation failed\n");
1747 msg->request_id = htonl (
op->client_request_id);
1748 msg->element_type = htons (0);
1769 uint64_t duplicates =
op->received_fresh -
op->received_total;
1782 "PROTOCOL VIOLATION: Received duplicate element in full receiving "
1783 "mode of operation this is not allowed! Duplicates: %llu\n",
1784 (
unsigned long long) duplicates);
1798 long double base = (1 - (
long double) (
op->remote_set_diff
1799 / (
long double) (
op->initial_size
1802 long double exponent = (
op->received_total - (
op->received_fresh * ((
long
1810 long double value = exponent * (log2l (base) / log2l (2));
1811 if (0 ==
op->remote_set_diff)
1812 op->remote_set_diff = 1;
1816 "PROTOCOL VIOLATION: Other peer violated probabilistic rule for receiving "
1817 "to many duplicated full element : %LF\n",
1834 double probability =
op->differential_sync_iterations * (log2l (
1840 "PROTOCOL VIOLATION: Other peer violated probabilistic rule for to many active passive "
1841 "switches in differential sync: %u\n",
1842 op->differential_sync_iterations);
1934 ctx.hash = *element_hash;
1998 int s = (
salt * 7) % 64;
2002 x = (x >> s) | (x << (64 - s));
2015 int s = (
salt * 7) % 64;
2018 x = (x << s) | (x >> (64 - s));
2040 "[OP %p] inserting %lx (hash %s) into ibf\n",
2132 if (NULL !=
op->local_ibf)
2136 ((uint8_t)
op->ibf_number_buckets_per_element));
2137 if (NULL ==
op->local_ibf)
2140 "Failed to allocate local IBF\n");
2163 uint64_t buckets_sent = 0;
2171 op->differential_sync_iterations++;
2184 "sending ibf of size %u\n",
2192 "# sent IBF (order %u)",
2197 ibf =
op->local_ibf;
2201 unsigned int buckets_in_message;
2205 buckets_in_message =
ibf_size - buckets_sent;
2210#if MEASURE_PERFORMANCE
2211 perf_store.ibf.sent += 1;
2212 perf_store.ibf.sent_var_bytes += (buckets_in_message *
IBF_BUCKET_SIZE);
2218 msg->offset = htonl (buckets_sent);
2219 msg->salt = htonl (
op->salt_send);
2224 buckets_in_message, &
msg[1],
msg->ibf_counter_bit_length);
2225 buckets_sent += buckets_in_message;
2227 "ibf chunk size %u, %llu/%u sent\n",
2228 (
unsigned int) buckets_in_message,
2229 (
unsigned long long) buckets_sent,
2250 float ibf_bucket_number_factor)
2254 return (((
int) (diff * ibf_bucket_number_factor)) | 1);
2261 decoded_elements,
unsigned int last_ibf_size)
2263 unsigned int next_size = (
unsigned int) ((last_ibf_size * 2)
2264 - (ibf_bucket_number_factor
2265 * decoded_elements));
2268 return next_size | 1;
2293 "Sending element %s\n",
2295#if MEASURE_PERFORMANCE
2296 perf_store.element_full.received += 1;
2297 perf_store.element_full.received_var_bytes +=
el->size;
2324 "Dedicing to transmit the full set\n");
2340 op->set->content->elements_randomized,
2343#if MEASURE_PERFORMANCE
2344 perf_store.full_done.sent += 1;
2394#if MEASURE_PERFORMANCE
2395 perf_store.se.received += 1;
2396 perf_store.se.received_var_bytes += ntohs (
msg->header.
size) -
sizeof(
struct
2402 uint64_t other_size;
2407 op->set->content->elements);
2423 if ((
msg->se_count > 8) || (__builtin_popcount ((
int)
msg->se_count) != 1))
2426 "PROTOCOL VIOLATION: Invalid number of se transmitted by other peer %u\n",
2436 "# bytes of SE received",
2441 op->remote_element_count = other_size;
2443 if (
op->byzantine_upper_bound <
op->remote_element_count)
2446 "Exceeded configured upper bound <%" PRIu64
"> of element: %u\n",
2447 op->byzantine_upper_bound,
2448 op->remote_element_count);
2456 if (NULL == remote_se)
2482 uint64_t avg_element_size = 0;
2485 if (diff_remote +
op->remote_element_count >
op->byzantine_upper_bound)
2486 diff_remote =
op->byzantine_upper_bound -
op->remote_element_count;
2487 if (diff_local +
op->local_element_count >
op->byzantine_upper_bound)
2488 diff_local =
op->byzantine_upper_bound -
op->local_element_count;
2489 if ((diff_remote < 0) || (diff_local < 0))
2493 "PROTOCOL VIOLATION: More element is set as upper boundary or other peer is "
2494 "malicious: remote diff %ld, local diff: %ld\n",
2495 diff_remote, diff_local);
2501 if (0 ==
op->remote_element_count)
2504 diff_local =
op->local_element_count;
2506 if (0 ==
op->local_element_count)
2509 diff_remote =
op->remote_element_count;
2512 diff = diff_remote + diff_local;
2513 op->remote_set_diff = diff_remote;
2516 if (0 <
op->local_element_count)
2518 op->total_elements_size_local = 0;
2523 avg_element_size =
op->total_elements_size_local /
op->local_element_count
2534 remote_element_count,
2538 rtt_bandwidth_tradeoff,
2540 ibf_bucket_number_factor);
2542#if MEASURE_PERFORMANCE
2543 perf_store.se_diff_local = diff_local;
2544 perf_store.se_diff_remote = diff_remote;
2545 perf_store.se_diff = diff;
2546 perf_store.mode_of_operation =
op->mode_of_operation;
2553 "got se diff=%d, using ibf size %d\n",
2556 ibf_number_buckets_per_element,
2557 op->ibf_bucket_number_factor));
2562 set_debug =
getenv (
"GNUNET_SETU_BENCHMARK");
2563 if ((NULL != set_debug) &&
2564 (0 == strcmp (set_debug,
"1")))
2566 FILE *
f = fopen (
"set.log",
"a");
2567 fprintf (
f,
"%llu\n", (
unsigned long long) diff);
2573 (other_size < op->byzantine_lower_bound))
2584 "Deciding to go for full set transmission (diff=%d, own set=%llu)\n",
2586 (
unsigned long long)
op->initial_size);
2609 "Telling other peer that we expect its full set\n");
2611#if MEASURE_PERFORMANCE
2612 perf_store.request_full.sent += 1;
2636 op->ibf_number_buckets_per_element
2638 op->ibf_bucket_number_factor)))
2642 "Failed to send IBF, closing connection\n");
2673 op->active_passive_switch_required =
true;
2680 op->message_control_flow,
2686 "Skipping already sent processed element offer!\n");
2693 op->message_control_flow,
2700 "Double offer message sent found!\n");
2710 op->message_control_flow,
2717 "Double demand received found!\n");
2723#if MEASURE_PERFORMANCE
2724 perf_store.offer.sent += 1;
2733 "[OP %p] sending element offer (%s) to peer\n",
2777 unsigned int num_decoded;
2784 op->remote_ibf->size))
2796 op->remote_ibf = NULL;
2799 "decoding IBF (size=%u)\n",
2818 "decoded ibf key %lx\n",
2819 (
unsigned long)
key.key_val);
2821 if ((num_decoded > diff_ibf->
size) ||
2822 ((num_decoded > 1) &&
2826 "detected cyclic ibf (decoded %u/%u)\n",
2845 if (next_size<ibf_min_size)
2846 next_size = ibf_min_size;
2852 "decoding failed, sending larger ibf (size %u)\n",
2858#if MEASURE_PERFORMANCE
2859 perf_store.active_passive_switches += 1;
2862 op->salt_send =
op->salt_receive++;
2869 "Failed to send IBF, closing connection\n");
2878 "# of failed union operations (too large)",
2883 "set union failed: reached ibf limit\n");
2895 "transmitted all values, sending DONE\n");
2897#if MEASURE_PERFORMANCE
2898 perf_store.done.sent += 1;
2916 else if (-1 == side)
2921#if MEASURE_PERFORMANCE
2922 perf_store.inquery.sent += 1;
2923 perf_store.inquery.sent_var_bytes +=
sizeof(
struct IBF_Key);
2949 msg->salt = htonl (
op->salt_receive);
2954 "sending element inquiry for IBF key %lx\n",
2955 (
unsigned long)
key.key_val);
3008 op->remote_element_count = ntohl (
msg->remote_set_size);
3009 op->remote_set_diff = ntohl (
msg->remote_set_difference);
3010 op->local_set_diff = ntohl (
msg->local_set_difference);
3016 "PROTOCOL VIOLATION: Parameters transmitted from other peer do not satisfie byzantine "
3025 op->set->content->elements);
3027 uint64_t avg_element_size = 0;
3029 if (0 <
op->local_element_count)
3031 op->total_elements_size_local = 0;
3036 avg_element_size =
op->total_elements_size_local /
op->local_element_count
3056 "PROTOCOL VIOLATION: Remote peer choose to send his full set first but correct mode would have been"
3082 unsigned int buckets_in_message;
3084 buckets_in_message = (ntohs (
msg->header.
size) -
sizeof *
msg)
3086 if (0 == buckets_in_message)
3091 if ((ntohs (
msg->header.
size) -
sizeof *
msg) != buckets_in_message
3099 if (ntohl (
msg->offset) !=
op->ibf_buckets_received)
3105 if (
msg->ibf_size !=
op->remote_ibf->size)
3110 if (ntohl (
msg->salt) !=
op->salt_receive)
3141 unsigned int buckets_in_message;
3154 op->differential_sync_iterations++;
3156 op->active_passive_switch_required =
false;
3158#if MEASURE_PERFORMANCE
3159 perf_store.ibf.received += 1;
3160 perf_store.ibf.received_var_bytes += (ntohs (
msg->header.
size) -
sizeof *
msg);
3163 buckets_in_message = (ntohs (
msg->header.
size) -
sizeof *
msg)
3171 "Creating new ibf of size %u\n",
3172 ntohl (
msg->ibf_size));
3175 ((uint8_t)
op->ibf_number_buckets_per_element))
3177 op->salt_receive = ntohl (
msg->salt);
3179 "Receiving new IBF with salt %u\n",
3181 if (NULL ==
op->remote_ibf)
3184 "Failed to parse remote IBF, closing connection\n");
3188 op->ibf_buckets_received = 0;
3189 if (0 != ntohl (
msg->offset))
3200 "Received more of IBF\n");
3205 op->ibf_buckets_received,
3207 op->remote_ibf,
msg->ibf_counter_bit_length);
3208 op->ibf_buckets_received += buckets_in_message;
3210 if (
op->ibf_buckets_received ==
op->remote_ibf->size)
3213 "received full ibf\n");
3220 "Failed to decode IBF, closing connection\n");
3246 "sending element (size %u) to client\n",
3262 op->key_to_element));
3279 unsigned int num_demanded;
3281 op->message_control_flow,
3286 op->demanded_hashes);
3290 "In PHASE_FINISH_WAITING, pending %u demands -> %d\n",
3291 num_demanded,
op->peer_site);
3292 if (-1 != send_done)
3297#if MEASURE_PERFORMANCE
3298 perf_store.done.sent += 1;
3310 "In PHASE_FINISH_CLOSING, pending %u demands %d\n",
3311 num_demanded,
op->peer_site);
3312 if (-1 != send_done)
3358 uint16_t element_size;
3373 element_size = ntohs (emsg->
header.
size) -
sizeof(
struct
3375#if MEASURE_PERFORMANCE
3376 perf_store.element.received += 1;
3377 perf_store.element.received_var_bytes += element_size;
3403 op->message_control_flow,
3410 "An element has been received more than once!\n");
3417 "Got element (size %u, hash %s) from peer\n",
3418 (
unsigned int) element_size,
3422 "# received elements",
3426 "# exchanged elements",
3430 op->received_total++;
3439 "# repeated elements",
3448 "Registering new element from remote peer\n");
3449 op->received_fresh++;
3457 if ((
op->received_total > 8) &&
3458 (
op->received_fresh <
op->received_total / 3))
3502 uint16_t element_size;
3519#if MEASURE_PERFORMANCE
3520 perf_store.element_full.received += 1;
3521 perf_store.element_full.received_var_bytes += element_size;
3533 "Got element (full diff, size %u, hash %s) from peer\n",
3534 (
unsigned int) element_size,
3538 "# received elements",
3542 "# exchanged elements",
3546 op->received_total++;
3552 "# repeated elements",
3562 "Registering new element from remote peer\n");
3563 op->received_fresh++;
3573 (
op->received_total >
op->remote_element_count) )
3577 "Other peer sent %llu elements while pretending to have %llu elements, failing operation\n",
3578 (
unsigned long long)
op->received_total,
3579 (
unsigned long long)
op->remote_element_count);
3600 unsigned int num_keys;
3610 != num_keys *
sizeof(
struct IBF_Key))
3630 const struct IBF_Key *ibf_key;
3631 unsigned int num_keys;
3645#if MEASURE_PERFORMANCE
3646 perf_store.inquery.received += 1;
3647 perf_store.inquery.received_var_bytes += (ntohs (
msg->header.
size)
3652 "Received union inquiry\n");
3673 while (0 != num_keys--)
3711#if MEASURE_PERFORMANCE
3712 perf_store.element_full.received += 1;
3746 uint64_t avg_element_size = 0;
3760 op->remote_element_count = ntohl (
msg->remote_set_size);
3761 op->remote_set_diff = ntohl (
msg->remote_set_difference);
3762 op->local_set_diff = ntohl (
msg->local_set_difference);
3768 "PROTOCOL VIOLATION: Parameters transmitted from other peer do not satisfie byzantine "
3775#if MEASURE_PERFORMANCE
3776 perf_store.request_full.received += 1;
3780 "Received request for full set transmission\n");
3784 op->set->content->elements);
3785 if (0 <
op->local_element_count)
3787 op->total_elements_size_local = 0;
3792 avg_element_size =
op->total_elements_size_local /
op->local_element_count;
3810 "PROTOCOL VIOLATION: Remote peer choose to request the full set first but correct mode would have been"
3848#if MEASURE_PERFORMANCE
3849 perf_store.full_done.received += 1;
3859 (
op->received_total !=
op->remote_element_count) )
3863 "Other peer sent only %llu/%llu fresh elements, failing operation\n",
3864 (
unsigned long long)
op->received_total,
3865 (
unsigned long long)
op->remote_element_count);
3872 "got FULL DONE, sending elements that other peer is missing\n");
3878#if MEASURE_PERFORMANCE
3879 perf_store.full_done.sent += 1;
3892 "got FULL DONE, finishing\n");
3903 "Handle full done phase is %u\n",
3904 (
unsigned)
op->phase);
3926 unsigned int num_hashes;
3956 unsigned int num_hashes;
3971#if MEASURE_PERFORMANCE
3972 perf_store.demand.received += 1;
3973 perf_store.demand.received_var_bytes += (ntohs (
mh->size) -
sizeof(
struct
3981 hash++, num_hashes--)
3996 op->message_control_flow,
4003 "Double demand message received found!\n");
4013 op->message_control_flow,
4020 "Double element message sent found!\n");
4032#if MEASURE_PERFORMANCE
4033 perf_store.element.sent += 1;
4034 perf_store.element.sent_var_bytes += ee->
element.
size;
4045 "[OP %p] Sending demanded element (size %u, hash %s) to peer\n",
4051 "# exchanged elements",
4076 unsigned int num_hashes;
4110 unsigned int num_hashes;
4123#if MEASURE_PERFORMANCE
4124 perf_store.offer.received += 1;
4125 perf_store.offer.received_var_bytes += (ntohs (
mh->size) -
sizeof(
struct
4133 hash++, num_hashes--)
4150 "Skipped sending duplicate demand\n");
4156 op->demanded_hashes,
4162 "[OP %p] Requesting element (hash %s)\n",
4165#if MEASURE_PERFORMANCE
4166 perf_store.demand.sent += 1;
4172 op->message_control_flow,
4178 "Double demand message sent found!\n");
4187 op->message_control_flow,
4193 "Double offer message received found!\n");
4201 op->message_control_flow,
4207 "Element already expected!\n");
4248 if (
op->active_passive_switch_required)
4251 "PROTOCOL VIOLATION: Received done but role change is necessary\n");
4257#if MEASURE_PERFORMANCE
4258 perf_store.done.received += 1;
4266 "got DONE (as passive partner), waiting for our demands to be satisfied\n");
4280 "got DONE (as active partner), waiting to finish\n");
4309#if MEASURE_PERFORMANCE
4310 perf_store.over.received += 1;
4334 if (
op->suggest_id ==
id)
4402 "Client disconnected, cleaning up\n");
4403 if (NULL != (set =
cs->
set))
4408 "Destroying client's set\n");
4414 if (NULL != set->
se)
4436 if (NULL != (listener = cs->
listener))
4439 "Destroying client's listener\n");
4442 while (NULL != (
op = listener->
op_head))
4445 "Destroying incoming operation `%u' from peer `%s'\n",
4446 (
unsigned int)
op->client_request_id,
4486 if (0 !=
op->suggest_id)
4492 if (NULL == listener)
4498 if ((NULL != nested_context) &&
4537 if (NULL != nested_context)
4539 op->remote_element_count = ntohl (
msg->element_count);
4542 "Received P2P operation request (port %s) for active listener\n",
4550 op->timeout_task = NULL;
4556 "Suggesting incoming request with accept id %u to listener %p of client %p\n",
4585 "Client created new set for union operation\n");
4586 if (NULL !=
cs->
set)
4603 "Failed to allocate strata estimator\n");
4634 op->timeout_task = NULL;
4636 "Remote peer's incoming request timed out\n");
4666 "New incoming channel\n");
4822 "New listener created (port %s)\n",
4855 "Client rejected unknown operation %u\n",
4856 (
unsigned int) ntohl (
msg->accept_reject_id));
4861 "Peer request (app %s) rejected by client\n",
4900 if (NULL == (set = cs->
set))
4909 el.size = ntohs (
msg->header.
size) -
sizeof(*msg);
4911 el.element_type = ntohs (
msg->element_type);
4919 "Client inserts element %s of size %u\n",
4940 "Client inserted element %s of size %u twice (ignored)\n",
5061 if (NULL == (set = cs->
set))
5070 op->peer =
msg->target_peer;
5071 op->client_request_id = ntohl (
msg->request_id);
5072 op->byzantine =
msg->byzantine;
5073 op->byzantine_lower_bound = ntohl (
msg->byzantine_lower_bound);
5074 op->force_full =
msg->force_full;
5075 op->force_delta =
msg->force_delta;
5076 op->symmetric =
msg->symmetric;
5077 op->rtt_bandwidth_tradeoff =
msg->bandwidth_latency_tradeoff;
5078 op->ibf_bucket_number_factor =
msg->ibf_bucket_number_factor;
5079 op->ibf_number_buckets_per_element =
msg->ibf_number_of_buckets_per_element;
5080 op->byzantine_upper_bound =
msg->byzantine_upper_bond;
5081 op->active_passive_switch_required =
false;
5089#if MEASURE_PERFORMANCE
5103 "Creating new CADET channel to port %s for set union\n",
5117#if MEASURE_PERFORMANCE
5118 perf_store.operation_request.sent += 1;
5137 op->salt_receive = (
op->peer_site + 1) % 2;
5138 op->salt_send =
op->peer_site;
5142 "Initiating union operation evaluation\n");
5144 "# of total union operations",
5148 "# of initiated union operations",
5155 "sent op request with context message\n");
5158 "sent op request without context message\n");
5161 op->key_to_element);
5183 if (NULL == (
set = cs->
set))
5193 if (
op->client_request_id == ntohl (
msg->request_id))
5207 "Client canceled non-existent op %u\n",
5208 (uint32_t) ntohl (
msg->request_id));
5213 "Client requested cancel for op %u\n",
5214 (uint32_t) ntohl (
msg->request_id));
5240 if (NULL == (set =
cs->
set))
5254 "Client %p accepted request %u of listener %p that is no longer active\n",
5256 ntohl (
msg->accept_reject_id),
5267 "Client accepting request %u\n",
5268 (uint32_t) ntohl (
msg->accept_reject_id));
5269 listener =
op->listener;
5270 op->listener = NULL;
5278 op->client_request_id = ntohl (
msg->request_id);
5279 op->byzantine =
msg->byzantine;
5280 op->byzantine_lower_bound = ntohl (
msg->byzantine_lower_bound);
5281 op->force_full =
msg->force_full;
5282 op->force_delta =
msg->force_delta;
5283 op->symmetric =
msg->symmetric;
5284 op->rtt_bandwidth_tradeoff =
msg->bandwidth_latency_tradeoff;
5285 op->ibf_bucket_number_factor =
msg->ibf_bucket_number_factor;
5286 op->ibf_number_buckets_per_element =
msg->ibf_number_of_buckets_per_element;
5287 op->byzantine_upper_bound =
msg->byzantine_upper_bond;
5288 op->active_passive_switch_required =
false;
5294#if MEASURE_PERFORMANCE
5306 "accepting set union operation\n");
5308 "# of accepted union operations",
5312 "# of total union operations",
5326 op->salt_receive = (
op->peer_site + 1) % 2;
5327 op->salt_send =
op->peer_site;
5330 op->key_to_element);
5337 if (
op->initial_size > 0)
5339 op->total_elements_size_local = 0;
5345 op->total_elements_size_local /
op->initial_size,
5354#if MEASURE_PERFORMANCE
5355 perf_store.se.sent += 1;
5356 perf_store.se.sent_var_bytes += len;
5373 op->set->content->elements));
5409 "handled shutdown request\n");
5410#if MEASURE_PERFORMANCE
5411 calculate_perf_store ();
5440 _ (
"Could not connect to CADET service\n"));
struct GNUNET_MQ_Handle * mq
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Envelope * env
void ibf_subtract(struct InvertibleBloomFilter *ibf1, const struct InvertibleBloomFilter *ibf2)
Subtract ibf2 from ibf1, storing the result in ibf1.
int ibf_decode(struct InvertibleBloomFilter *ibf, int *ret_side, struct IBF_Key *ret_id)
Decode and remove an element from the IBF, if possible.
void ibf_read_slice(const void *buf, uint32_t start, uint32_t count, struct InvertibleBloomFilter *ibf)
Read buckets from a buffer into an ibf.
void ibf_write_slice(const struct InvertibleBloomFilter *ibf, uint32_t start, uint32_t count, void *buf)
Write buckets from an ibf to a buffer.
void ibf_insert(struct InvertibleBloomFilter *ibf, struct IBF_Key key)
Insert a key into an IBF.
struct InvertibleBloomFilter * ibf_dup(const struct InvertibleBloomFilter *ibf)
Create a copy of an IBF, the copy has to be destroyed properly.
struct InvertibleBloomFilter * ibf_create(uint32_t size, uint8_t hash_num)
Create an invertible bloom filter.
void ibf_destroy(struct InvertibleBloomFilter *ibf)
Destroy all resources associated with the invertible bloom filter.
#define IBF_BUCKET_SIZE
Size of one ibf bucket in bytes.
static struct GNUNET_ARM_Operation * op
Current operation.
static int ret
Final status code.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static unsigned int phase
Processing stage that we are in.
static struct GNUNET_CADET_Handle * mh
Cadet handle.
struct GNUNET_HashCode key
The key used in the DHT.
static struct GNUNET_FS_Handle * ctx
static GstElement * source
Appsrc instance into which we write data for the pipeline.
static pa_context * context
Pulseaudio context.
static char * name
Name (label) of the records to list.
static struct GNUNET_IDENTITY_EgoLookup * el
Handle to identity lookup.
static char * res
Currently read line or NULL on EOF.
static char * value
Value of the record to add/remove.
static uint32_t type
Type string converted to DNS type value.
static int status
The program status; 0 for success.
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calculations.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
UnionOperationPhase
Current phase we are in for a union operation.
unsigned int strata_estimator_difference(const struct StrataEstimator *se1, const struct StrataEstimator *se2)
Estimate set difference with two strata estimators, i.e.
struct StrataEstimator * strata_estimator_create(unsigned int strata_count, uint32_t ibf_size, uint8_t ibf_hashnum)
Create a new strata estimator with the given parameters.
void strata_estimator_destroy(struct StrataEstimator *se)
Destroy a strata estimator, free all of its resources.
int strata_estimator_read(const void *buf, size_t buf_len, int is_compressed, struct StrataEstimator *se)
Read strata from the buffer into the given strata estimator.
size_t strata_estimator_write(const struct StrataEstimator *se, void *buf)
Write the given strata estimator to the buffer.
void strata_estimator_insert(struct StrataEstimator *se, struct IBF_Key key)
Add a key to the strata estimator.
struct StrataEstimator * strata_estimator_dup(struct StrataEstimator *se)
Make a copy of a strata estimator.
static void _GSS_operation_destroy(struct Operation *op)
Destroy the given operation.
#define IBF_MIN_SIZE
Minimal size of an ibf Based on the bsc thesis of Elias Summermatter (2021)
static void _GSS_operation_destroy2(struct Operation *op)
This function probably should not exist and be replaced by inlining more specific logic in the variou...
static void handle_client_create_set(void *cls, const struct GNUNET_SETU_CreateMessage *msg)
Called when a client wants to create a new set.
static int _GSS_is_element_of_operation(struct ElementEntry *ee, struct Operation *op)
Is element ee part of the set used by op?
static int check_client_set_add(void *cls, const struct GNUNET_SETU_ElementMessage *msg)
Called when a client wants to add or remove an element to a set it inhabits.
static unsigned int get_next_ibf_size(float ibf_bucket_number_factor, unsigned int decoded_elements, unsigned int last_ibf_size)
#define MAX_IBF_SIZE
The maximum size of an ibf we use is MAX_IBF_SIZE=2^20.
#define MAX_BUCKETS_PER_MESSAGE
Number of buckets that can be transmitted in one message.
static uint32_t suggest_id
Counter for allocating unique IDs for clients, used to identify incoming operation requests from remo...
static void handle_union_p2p_request_full(void *cls, const struct TransmitFullMessage *msg)
static int check_union_p2p_request_full(void *cls, const struct TransmitFullMessage *mh)
Handle a request for full set transmission.
static int create_randomized_element_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Create randomized element hashmap for full sending.
static int decode_and_send(struct Operation *op)
Decode which elements are missing on each side, and send the appropriate offers and inquiries.
static int send_full_element_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Send a set element.
MESSAGE_CONTROL_FLOW_STATE
Different states to control the messages flow in differential mode.
@ MSG_CFS_EXPECTED
Track that receiving this message is expected.
@ MSG_CFS_SENT
Track that a message has been sent.
@ MSG_CFS_UNINITIALIZED
Initial message state.
@ MSG_CFS_RECEIVED
Track that message has been received.
static struct Listener * listener_head
Listeners are held in a doubly linked list.
static void send_full_set(struct Operation *op)
Switch to full set transmission for op.
#define PROBABILITY_FOR_NEW_ROUND
Is the estimated probability for a new round this values is based on the bsc thesis of Elias Summerma...
static int check_byzantine_bounds(struct Operation *op)
Check if all given byzantine parameters are in given boundaries.
static void handle_client_accept(void *cls, const struct GNUNET_SETU_AcceptMessage *msg)
Handle a request from the client to accept a set operation that came from a remote peer.
static void handle_union_p2p_over(void *cls, const struct GNUNET_MessageHeader *mh)
Handle a over message from a remote peer.
static void handle_client_cancel(void *cls, const struct GNUNET_SETU_CancelMessage *msg)
Handle a request from the client to cancel a running set operation.
static void handle_union_p2p_inquiry(void *cls, const struct InquiryMessage *msg)
Send offers (for GNUNET_Hash-es) in response to inquiries (for IBF_Key-s).
static void handle_client_evaluate(void *cls, const struct GNUNET_SETU_EvaluateMessage *msg)
Called when a client wants to initiate a set operation with another peer.
static void handle_union_p2p_strata_estimator(void *cls, const struct StrataEstimatorMessage *msg)
Handle a strata estimator from a remote peer.
static int check_union_p2p_ibf(void *cls, const struct IBFMessage *msg)
Check an IBF message from a remote peer.
static struct IBF_Key get_ibf_key(const struct GNUNET_HashCode *src)
Derive the IBF key from a hash code and a salt.
static struct GNUNET_CADET_Handle * cadet
Handle to the cadet service, used to listen for and connect to remote peers.
static void maybe_finish(struct Operation *op)
Tests if the operation is finished, and if so notify.
static void handle_client_reject(void *cls, const struct GNUNET_SETU_RejectMessage *msg)
Called when the listening client rejects an operation request by another peer.
static int init_key_to_element_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator for initializing the key-to-element mapping of a union operation.
static int send_offers_iterator(void *cls, uint32_t key, void *value)
Iterator to send elements to a remote peer.
static void handle_union_p2p_demand(void *cls, const struct GNUNET_MessageHeader *mh)
Handle a demand by the other peer for elements based on a list of struct GNUNET_HashCodes.
static int check_union_p2p_inquiry(void *cls, const struct InquiryMessage *msg)
Send offers (for GNUNET_Hash-es) in response to inquiries (for IBF_Key-s).
static int check_union_p2p_strata_estimator(void *cls, const struct StrataEstimatorMessage *msg)
Handle a strata estimator from a remote peer.
static int send_missing_full_elements_iter(void *cls, uint32_t key, void *value)
Iterator over hash map entries, called to destroy the linked list of colliding ibf key entries.
static unsigned int get_size_from_difference(unsigned int diff, int number_buckets_per_element, float ibf_bucket_number_factor)
Compute the necessary order of an ibf from the size of the symmetric set difference.
static void handle_incoming_msg(void *cls, const struct OperationRequestMessage *msg)
Handle a request for a set operation from another peer.
static int in_shutdown
Are we in shutdown? if GNUNET_YES and the number of clients drops to zero, disconnect from CADET.
static int destroy_elements_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator over hash map entries to free element entries.
static void shutdown_task(void *cls)
Called to clean up, after a shutdown has been requested.
static void handle_union_p2p_send_full(void *cls, const struct TransmitFullMessage *msg)
Handle send full message received from other peer.
static void handle_union_p2p_full_element(void *cls, const struct GNUNET_SETU_ElementMessage *emsg)
Handle an element message from a remote peer.
static struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
static unsigned int num_clients
Number of active clients.
static void channel_window_cb(void *cls, const struct GNUNET_CADET_Channel *channel, int window_size)
Function called whenever an MQ-channel's transmission window size changes.
static void advance_generation(struct Set *set)
Advance the current generation of a set, adding exclusion ranges if necessary.
static int update_message_control_flow(struct GNUNET_CONTAINER_MultiHashMap *hash_map, enum MESSAGE_CONTROL_FLOW_STATE new_mcfs, const struct GNUNET_HashCode *hash_code, enum MESSAGE_TYPE mt)
Function to update, track and validate message received in differential sync.
static void check_max_differential_rounds(struct Operation *op)
Limit active passive switches in differential sync to configured security level.
static void handle_union_p2p_done(void *cls, const struct GNUNET_MessageHeader *mh)
Handle a done message from a remote peer.
static int check_incoming_msg(void *cls, const struct OperationRequestMessage *msg)
Check a request for a set operation from another peer.
static void fail_union_operation(struct Operation *op)
Inform the client that the union operation has failed, and proceed to destroy the evaluate operation.
static int check_union_p2p_offer(void *cls, const struct GNUNET_MessageHeader *mh)
Check offer (of struct GNUNET_HashCodes).
static void send_client_done(void *cls)
Signal to the client that the operation has finished and destroy the operation.
static void unsalt_key(const struct IBF_Key *k_in, uint32_t salt, struct IBF_Key *k_out)
Reverse modification done in the salt_key function.
static void handle_union_p2p_full_done(void *cls, const struct GNUNET_MessageHeader *mh)
Handle a "full done" message.
static void salt_key(const struct IBF_Key *k_in, uint32_t salt, struct IBF_Key *k_out)
Modify an IBF key k_in based on the salt, returning a salted key in k_out.
static int prepare_ibf(struct Operation *op, uint32_t size)
Create an ibf with the operation's elements of the specified size.
static void op_register_element(struct Operation *op, struct ElementEntry *ee, int received)
Insert an element into the union operation's key-to-element mapping.
static void incoming_destroy(struct Operation *op)
Destroy an incoming request from a remote peer.
static struct Listener * listener_tail
Listeners are held in a doubly linked list.
static int determinate_avg_element_size_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator for determining average size.
static int check_union_p2p_full_element(void *cls, const struct GNUNET_SETU_ElementMessage *emsg)
Check a full element message from a remote peer.
MESSAGE_TYPE
Message types to track in message control flow.
@ DEMAND_MESSAGE
Demand message type.
@ OFFER_MESSAGE
Offer message type.
@ ELEMENT_MESSAGE
Element message type.
static enum GNUNET_GenericReturnValue check_valid_phase(const uint8_t allowed_phases[], size_t size_phases, struct Operation *op)
Validates the if a message is received in a correct phase.
static void handle_union_p2p_offer(void *cls, const struct GNUNET_MessageHeader *mh)
Handle offers (of struct GNUNET_HashCodes) and respond with demands (of struct GNUNET_HashCodes).
static void initialize_key_to_element(struct Operation *op)
Initialize the IBF key to element mapping local to this set operation.
static int check_union_p2p_demand(void *cls, const struct GNUNET_MessageHeader *mh)
Check a demand by the other peer for elements based on a list of struct GNUNET_HashCodes.
static enum GNUNET_GenericReturnValue free_values_iter(void *cls, const struct GNUNET_HashCode *key, void *value)
static void send_offers_for_key(struct Operation *op, struct IBF_Key ibf_key)
Send offers (in the form of GNUNET_Hash-es) to the remote peer for the given IBF key.
static int destroy_key_to_element_iter(void *cls, uint32_t key, void *value)
Iterator over hash map entries, called to destroy the linked list of colliding ibf key entries.
static void handle_union_p2p_ibf(void *cls, const struct IBFMessage *msg)
Handle an IBF message from a remote peer.
static void * channel_new_cb(void *cls, struct GNUNET_CADET_Channel *channel, const struct GNUNET_PeerIdentity *source)
Method called whenever another peer has added us to a channel the other peer initiated.
static int check_union_p2p_send_full(void *cls, const struct TransmitFullMessage *msg)
Check send full message received from other peer.
static void handle_client_listen(void *cls, const struct GNUNET_SETU_ListenMessage *msg)
Called when a client wants to create a new listener.
#define SE_STRATA_COUNT
Number of IBFs in a strata estimator.
static struct Operation * get_incoming(uint32_t id)
Get the incoming socket associated with the given id.
static void full_sync_plausibility_check(struct Operation *op)
Function that checks if full sync is plausible.
static void * client_connect_cb(void *cls, struct GNUNET_SERVICE_Client *c, struct GNUNET_MQ_Handle *mq)
Callback called when a client connects to the service.
GNUNET_SERVICE_MAIN(GNUNET_OS_project_data_gnunet(), "set", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(client_accept, GNUNET_MESSAGE_TYPE_SETU_ACCEPT, struct GNUNET_SETU_AcceptMessage, NULL), GNUNET_MQ_hd_var_size(client_set_add, GNUNET_MESSAGE_TYPE_SETU_ADD, struct GNUNET_SETU_ElementMessage, NULL), GNUNET_MQ_hd_fixed_size(client_create_set, GNUNET_MESSAGE_TYPE_SETU_CREATE, struct GNUNET_SETU_CreateMessage, NULL), GNUNET_MQ_hd_var_size(client_evaluate, GNUNET_MESSAGE_TYPE_SETU_EVALUATE, struct GNUNET_SETU_EvaluateMessage, NULL), GNUNET_MQ_hd_fixed_size(client_listen, GNUNET_MESSAGE_TYPE_SETU_LISTEN, struct GNUNET_SETU_ListenMessage, NULL), GNUNET_MQ_hd_fixed_size(client_reject, GNUNET_MESSAGE_TYPE_SETU_REJECT, struct GNUNET_SETU_RejectMessage, NULL), GNUNET_MQ_hd_fixed_size(client_cancel, GNUNET_MESSAGE_TYPE_SETU_CANCEL, struct GNUNET_SETU_CancelMessage, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
static void handle_union_p2p_elements(void *cls, const struct GNUNET_SETU_ElementMessage *emsg)
Handle an element message from a remote peer.
#define INCOMING_CHANNEL_TIMEOUT
How long do we hold on to an incoming channel if there is no local listener before giving up?
static void handle_client_set_add(void *cls, const struct GNUNET_SETU_ElementMessage *msg)
Called when a client wants to add or remove an element to a set it inhabits.
static int is_message_in_message_control_flow(struct GNUNET_CONTAINER_MultiHashMap *hash_map, struct GNUNET_HashCode *hash_code, enum MESSAGE_TYPE mt)
Validate if a message in differential sync si already received before.
#define SECURITY_LEVEL
Security level used for byzantine checks (2^80)
static int send_ibf(struct Operation *op, uint32_t ibf_size)
Send an ibf of appropriate size.
MODE_OF_OPERATION
Different modes of operations.
@ DIFFERENTIAL_SYNC
Mode just synchronizes the difference between sets.
@ FULL_SYNC_LOCAL_SENDING_FIRST
Mode send full set sending local set first.
@ FULL_SYNC_REMOTE_SENDING_FIRST
Mode request full set from remote peer.
static struct KeyEntry * op_get_element(struct Operation *op, const struct GNUNET_HashCode *element_hash)
Determine whether the given element is already in the operation's element set.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls)
Clean up after a client has disconnected.
@ PHASE_FINISH_CLOSING
The protocol is almost finished, but we still have to flush our message queue and/or expect some elem...
@ PHASE_EXPECT_SE
We sent the request message, and expect a strata estimator.
@ PHASE_EXPECT_IBF_LAST
Continuation for multi part IBFs.
@ PHASE_FULL_RECEIVING
Phase that receives full set first and then sends elements that are the local peer missing.
@ PHASE_FINISH_WAITING
In the penultimate phase, we wait until all our demands are satisfied.
@ PHASE_FINISHED
In the ultimate phase, we wait until our demands are satisfied and then quit (sending another DONE me...
@ PHASE_PASSIVE_DECODING
The other peer is decoding the IBF we just sent.
@ PHASE_ACTIVE_DECODING
We are decoding an IBF.
@ PHASE_FULL_SENDING
After sending the full set, wait for responses with the elements that the local peer is missing.
@ PHASE_EXPECT_IBF
We sent the strata estimator, and expect an IBF.
static uint8_t estimate_best_mode_of_operation(uint64_t avg_element_size, uint64_t local_set_size, uint64_t remote_set_size, uint64_t est_set_diff_remote, uint64_t est_set_diff_local, uint64_t bandwith_latency_tradeoff, uint64_t ibf_bucket_number_factor)
Function that chooses the optimal mode of operation depending on operation parameters.
static void channel_end_cb(void *channel_ctx, const struct GNUNET_CADET_Channel *channel)
Function called whenever a channel is destroyed.
static void send_client_element(struct Operation *op, const struct GNUNET_SETU_Element *element, enum GNUNET_SETU_Status status)
Send a result message to the client indicating that there is a new element.
static int determinate_done_message_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator for determining if all demands have been satisfied.
#define SE_IBF_HASH_NUM
The hash num parameter for the difference digests and strata estimators.
static void incoming_timeout_cb(void *cls)
Timeout happens iff:
#define SE_IBFS_TOTAL_SIZE
Primes for all 4 different strata estimators 61,67,71,73,79,83,89,97 348 Based on the bsc thesis of E...
#define DIFFERENTIAL_RTT_MEAN
AVG RTT for differential sync when k=2 and Factor = 2 Based on the bsc thesis of Elias Summermatter (...
static int op_get_element_iterator(void *cls, uint32_t key, void *value)
Iterator over the mapping from IBF keys to element entries.
static int prepare_ibf_iterator(void *cls, uint32_t key, void *value)
Insert a key into an ibf.
static int check_union_p2p_elements(void *cls, const struct GNUNET_SETU_ElementMessage *emsg)
Check an element message from a remote peer.
static void run(void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_SERVICE_Handle *service)
Function called by the service's run method to run service-specific setup code.
static int check_client_evaluate(void *cls, const struct GNUNET_SETU_EvaluateMessage *msg)
Called when a client wants to initiate a set operation with another peer.
uint8_t determine_strata_count(uint64_t avg_element_size, uint64_t element_count)
Calculates the optimal number of strata Estimators to send.
static unsigned int ibf_size
CADET service; establish channels to distant peers.
Constants for network protocols.
Two-peer set union operations.
API to create, modify and access statistics.
struct GNUNET_CADET_Handle * GNUNET_CADET_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the MQ-based cadet service.
void GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel)
Indicate readiness to receive the next message on a channel.
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
struct GNUNET_MQ_Handle * GNUNET_CADET_get_mq(const struct GNUNET_CADET_Channel *channel)
Obtain the message queue for a connected channel.
struct GNUNET_CADET_Port * GNUNET_CADET_open_port(struct GNUNET_CADET_Handle *h, const struct GNUNET_HashCode *port, GNUNET_CADET_ConnectEventHandler connects, void *connects_cls, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Open a port to receive incoming MQ-based channels.
void GNUNET_CADET_disconnect(struct GNUNET_CADET_Handle *handle)
Disconnect from the cadet service.
void GNUNET_CADET_close_port(struct GNUNET_CADET_Port *p)
Close a port opened with GNUNET_CADET_open_port.
struct GNUNET_CADET_Channel * GNUNET_CADET_channel_create(struct GNUNET_CADET_Handle *h, void *channel_cls, const struct GNUNET_PeerIdentity *destination, const struct GNUNET_HashCode *port, GNUNET_CADET_WindowSizeEventHandler window_changes, GNUNET_CADET_DisconnectEventHandler disconnects, const struct GNUNET_MQ_MessageHandler *handlers)
Create a new channel towards a remote peer.
struct GNUNET_CONFIGURATION_Handle * GNUNET_CONFIGURATION_create(const struct GNUNET_OS_ProjectData *pd)
Create a new configuration object.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_load(struct GNUNET_CONFIGURATION_Handle *cfg, const char *filename)
Load configuration.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_float(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, float *number)
Get a configuration value that should be a floating point number.
uint64_t GNUNET_CRYPTO_random_u64(enum GNUNET_CRYPTO_Quality mode, uint64_t max)
Generate a random unsigned 64-bit value.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
@ GNUNET_CRYPTO_QUALITY_NONCE
Randomness for IVs etc.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
int GNUNET_CRYPTO_hash_cmp(const struct GNUNET_HashCode *h1, const struct GNUNET_HashCode *h2)
Compare function for HashCodes, producing a total ordering of all hashcodes.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_kdf(void *result, size_t out_len, const void *xts, size_t xts_len, const void *skm, size_t skm_len,...)
Derive key.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_contains(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Check if the map contains any value under the given key (including values that are NULL).
int GNUNET_CONTAINER_multihashmap32_get_multiple(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map that match a particular key.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MultiHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap32_put(struct GNUNET_CONTAINER_MultiHashMap32 *map, uint32_t key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
struct GNUNET_CONTAINER_MultiHashMap32 * GNUNET_CONTAINER_multihashmap32_create(unsigned int len)
Create a 32-bit key multi hash map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_remove(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, const void *value)
Remove the given key-value pair from the map.
unsigned int GNUNET_CONTAINER_multihashmap32_size(const struct GNUNET_CONTAINER_MultiHashMap32 *map)
Get the number of key-value pairs in the map.
enum GNUNET_GenericReturnValue GNUNET_CONTAINER_multihashmap_put(struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key, void *value, enum GNUNET_CONTAINER_MultiHashMapOption opt)
Store a key-value pair in the map.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void GNUNET_CONTAINER_multihashmap32_destroy(struct GNUNET_CONTAINER_MultiHashMap32 *map)
Destroy a 32-bit key hash map.
int GNUNET_CONTAINER_multihashmap32_iterate(struct GNUNET_CONTAINER_MultiHashMap32 *map, GNUNET_CONTAINER_MultiHashMapIterator32Callback it, void *it_cls)
Iterate over all entries in the map.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST
, ' bother checking if a value already exists (faster than GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE...
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE
Allow multiple values with the same key.
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY
There must only be one value per key; storing a value should fail if a value under the same key alrea...
@ GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE
If a value with the given key exists, replace it.
uint16_t type
The type of the message (GNUNET_MESSAGE_TYPE_XXXX), in big-endian format.
#define GNUNET_log(kind,...)
void GNUNET_CRYPTO_hash_context_read(struct GNUNET_HashContext *hc, const void *buf, size_t size)
Add data to be hashed.
uint64_t GNUNET_ntohll(uint64_t n)
Convert unsigned 64-bit integer to host byte order.
uint64_t GNUNET_htonll(uint64_t n)
Convert unsigned 64-bit integer to network byte order.
void GNUNET_CRYPTO_hash_context_finish(struct GNUNET_HashContext *hc, struct GNUNET_HashCode *r_hash)
Finish the hash computation.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
GNUNET_GenericReturnValue
Named constants for return values.
uint16_t size
The length of the struct (in bytes, including the length field itself), in big-endian format.
struct GNUNET_HashContext * GNUNET_CRYPTO_hash_context_start(void)
Start incremental hashing operation.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
@ GNUNET_ERROR_TYPE_WARNING
@ GNUNET_ERROR_TYPE_ERROR
@ GNUNET_ERROR_TYPE_DEBUG
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
int GNUNET_snprintf(char *buf, size_t size, const char *format,...) __attribute__((format(printf
Like snprintf, just aborts if the buffer is of insufficient size.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
void GNUNET_MQ_discard(struct GNUNET_MQ_Envelope *mqm)
Discard the message queue message, free all allocated resources.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct.
#define GNUNET_MQ_msg_nested_mh(mvar, type, mh)
Allocate a GNUNET_MQ_Envelope, and append a payload message after the given message struct.
#define GNUNET_MQ_msg_header(type)
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MQ_msg_header_extra(mh, esize, type)
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header and extra space.
#define GNUNET_MQ_extract_nested_mh(var)
Return a pointer to the message at the end of the given message.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
#define GNUNET_MESSAGE_TYPE_SETU_REQUEST
Notify the client of an incoming request from a remote peer.
#define GNUNET_MESSAGE_TYPE_SETU_REJECT
Reject a set request.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST
Request a set union operation from a remote peer.
#define GNUNET_MESSAGE_TYPE_SETU_RESULT
Handle result message from operation.
#define GNUNET_MESSAGE_TYPE_SETU_CREATE
Create a new local set.
#define GNUNET_MESSAGE_TYPE_SETU_ADD
Add element to set.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_DONE
Set operation is done.
#define GNUNET_MESSAGE_TYPE_SETU_ACCEPT
Accept an incoming set request.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_OVER
Request all missing elements from the other peer, based on their sets and the elements we previously ...
#define GNUNET_MESSAGE_TYPE_SETU_CANCEL
Cancel a set operation.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER
Tell the other peer which hashes match a given IBF key.
#define GNUNET_MESSAGE_TYPE_SETU_LISTEN
Listen for operation requests.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE
Request all missing elements from the other peer, based on their sets and the elements we previously ...
#define GNUNET_MESSAGE_TYPE_SETU_P2P_SEC
Compressed strata estimator.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_IBF
Invertible bloom filter.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS
Actual set elements.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL
Signals other peer that all elements are sent.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT
Send a set element, not as response to a demand but because we're sending the full set.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_SE
Strata estimator.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY
Tell the other peer to send us a list of hashes that match an IBF key.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND
Demand the whole element from the other peer, given only the hash code.
#define GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL
Demand the whole element from the other peer, given only the hash code.
#define GNUNET_MESSAGE_TYPE_SETU_EVALUATE
Evaluate a set operation.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
@ GNUNET_SERVICE_OPTION_NONE
Use defaults.
#define GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE
Maximum size of a context message for set operation requests.
void GNUNET_SETU_element_hash(const struct GNUNET_SETU_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
GNUNET_SETU_Status
Status for the result callback.
@ GNUNET_SETU_STATUS_DONE
Success, all elements have been sent (and received).
@ GNUNET_SETU_STATUS_ADD_REMOTE
Element should be added to the result set of the remote peer, i.e.
@ GNUNET_SETU_STATUS_FAILURE
The other peer refused to do the operation with us, or something went wrong.
@ GNUNET_SETU_STATUS_ADD_LOCAL
Element should be added to the result set of the local peer, i.e.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
static unsigned int size
Size of the "table".
uint8_t ibf_get_max_counter(struct InvertibleBloomFilter *ibf)
Returns the minimal bytes needed to store the counter of the IBF.
State we keep per client.
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
struct Listener * listener
Listener, if associated with the client, otherwise NULL.
struct Set * set
Set, if associated with the client, otherwise NULL.
struct GNUNET_SERVICE_Client * client
Client this is about.
Information about an element element in the set.
int remote
GNUNET_YES if the element is a remote element, and does not belong to the operation's set.
struct GNUNET_SET_Element element
The actual element.
unsigned int generation
First generation that includes this element.
struct GNUNET_HashCode element_hash
Hash of the element.
struct GNUNET_ARM_Operation * next
This is a doubly-linked list.
Opaque handle to a channel.
Opaque handle to the service.
Internal representation of the hash map.
Internal representation of the hash map.
Handle to a message queue.
Message handler for a specific message type.
The identity of the host (wraps the signing key of the peer).
Entry in list of pending tasks.
Handle to a client that is connected to a service.
Message sent by a listening client to the service to accept performing the operation with the other p...
Sent to the service by the client in order to cancel a set operation.
Message sent by the client to the service to ask starting a new set to perform operations with.
Message sent by client to the service to add an element to the set.
uint16_t element_type
Type of the element to add or remove.
uint16_t reserved
For alignment, always zero.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SETU_ADD.
uint16_t element_type
Application-specific element type.
uint16_t size
Number of bytes in the buffer pointed to by data.
const void * data
Actual data of the element.
Message sent by client to service to initiate a set operation as a client (not as listener).
Message sent by the client to the service to start listening for incoming requests to perform a certa...
Message sent by a listening client to the service to reject performing the operation with the other p...
A request for an operation with another client.
struct GNUNET_PeerIdentity peer_id
Identity of the requesting peer.
uint32_t accept_id
ID of the to identify the request when accepting or rejecting it.
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
uint64_t current_size
Current set size.
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SETU_Status in NBO.
uint16_t element_type
Type of the element attached to the message, if any.
uint32_t request_id
id the result belongs to
uint16_t size
Number of bytes in the buffer pointed to by data.
const void * data
Actual data of the element.
uint16_t element_type
Application-specific element type.
Context for op_get_element_iterator.
struct GNUNET_HashCode hash
FIXME.
struct KeyEntry * k
FIXME.
Message containing buckets of an invertible bloom filter.
Keys that can be inserted into and removed from an IBF.
estimate_best_mode_of_operation (uint64_t avg_element_size, uint64_t local_set_size,...
Invertible bloom filter (IBF).
int remote_decoded_count
If an IBF is decoded this count stores how many elements are on the remote site.
int local_decoded_count
If an IBF is decoded this count stores how many elements are on the local site.
uint32_t size
How many cells does this IBF have?
The key entry is used to associate an ibf key with an element.
struct ElementEntry * element
The actual element associated with the key.
struct IBF_Key ibf_key
IBF key for the entry, derived from the current salt.
int received
Did we receive this element? Even if element->is_foreign is false, we might have received the element...
A listener is inhabited by a client, and waits for evaluation requests from remote peers.
struct Listener * next
Listeners are held in a doubly linked list.
struct ClientState * cs
Client that owns the listener.
struct GNUNET_HashCode app_id
Application ID for the operation, used to distinguish multiple operations of the same type with the s...
struct GNUNET_CADET_Port * open_port
The port we are listening on with CADET.
struct Listener * prev
Listeners are held in a doubly linked list.
struct Operation * op_tail
Tail of DLL of operations this listener is responsible for.
struct Operation * op_head
Head of DLL of operations this listener is responsible for.
struct StrataEstimator ** stratas
Array of strata estimators.
Operation context used to execute a set operation.
unsigned int generation_created
Generation in which the operation handle was created.
uint32_t suggest_id
Unique request id for the request from a remote peer, sent to the client, which will accept or reject...
uint32_t salt_receive
Salt for the IBF we've received and that we're currently decoding.
struct GNUNET_CONTAINER_MultiHashMap * message_control_flow
Hashmap to keep track of the send/received messages.
struct InvertibleBloomFilter * remote_ibf
The IBF we currently receive.
struct GNUNET_MessageHeader * context_msg
Context message, may be NULL.
int force_delta
Always use delta operation instead of sending full sets, even it it's less efficient.
int force_full
Always send full sets, even if delta operations would be more efficient.
uint8_t ibf_bucket_number_factor
Set difference is multiplied with this factor to gennerate large enough IBF.
uint64_t total_elements_size_local
Total size of local set.
uint64_t local_set_diff
Estimated or committed set difference at the start.
struct InvertibleBloomFilter * local_ibf
The IBF with the local set's element.
uint64_t ibf_buckets_received
Number of ibf buckets already received into the remote_ibf.
struct Operation * prev
Kept in a DLL of the listener, if listener is non-NULL.
struct GNUNET_CADET_Channel * channel
Channel to the peer.
uint8_t mode_of_operation
Mode of operation that was chosen by the algorithm.
uint32_t salt_send
Salt that we're using for sending IBFs.
uint8_t differential_sync_iterations
is the count of already passed differential sync iterations
uint64_t rtt_bandwidth_tradeoff
User defined Bandwidth Round Trips Tradeoff.
struct GNUNET_CONTAINER_MultiHashMap * demanded_hashes
Hashes for elements that we have demanded from the other peer.
uint8_t ibf_number_buckets_per_element
Number of Element per bucket in IBF.
struct GNUNET_MQ_Handle * mq
Message queue for the channel.
bool active_passive_switch_required
Boolean to enforce an active passive switch.
struct GNUNET_PeerIdentity peer
The identity of the requesting peer.
int client_done_sent
Did we send the client that we are done?
uint8_t peer_site
Defines which site a client is 0 = Initiating peer 1 = Receiving peer.
struct MultiStrataEstimator * se
Copy of the set's strata estimator at the time of creation of this operation.
enum UnionOperationPhase phase
Current state of the operation.
uint64_t local_element_count
Local peer element count.
int symmetric
GNUNET_YES to also send back set elements we are sending to the remote peer.
uint64_t byzantine_lower_bound
Lower bound for the set size, used only when byzantine mode is enabled.
struct Listener * listener
Port this operation runs on.
uint32_t received_fresh
Number of elements we received from the other peer that were not in the local set yet.
uint64_t initial_size
Initial size of our set, just before the operation started.
struct Operation * next
Kept in a DLL of the listener, if listener is non-NULL.
uint32_t salt
Salt to use for the operation.
uint64_t byzantine_upper_bound
Limit of number of elements in set.
uint32_t remote_element_count
Remote peers element count.
uint64_t remote_set_diff
Estimated or committed set difference at the start.
uint32_t client_request_id
ID used to identify an operation between service and client.
struct GNUNET_CONTAINER_MultiHashMap32 * key_to_element
Maps unsalted IBF-Keys to elements.
int byzantine
GNUNET_YES to fail operations where Byzantine faults are suspected
struct GNUNET_CONTAINER_MultiHashMap * inquiries_sent
Hashmap to keep track of the send/received inquiries (ibf keys)
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task, if the incoming peer has not been accepted after the timeout, it will be disconnected.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set.
uint32_t received_total
Total number of elements received from the other peer.
Used as a closure for sending elements with a specific IBF key.
struct Operation * op
Operation for which the elements should be sent.
struct IBF_Key ibf_key
The IBF key whose matching elements should be sent.
SetContent stores the actual set elements, which may be shared by multiple generations derived from o...
int iterator_count
Number of concurrently active iterators.
unsigned int latest_generation
FIXME: document!
uint64_t elements_randomized_salt
Salt to construct the randomized element map.
struct GNUNET_CONTAINER_MultiHashMap * elements
Maps struct GNUNET_HashCode * to struct ElementEntry *.
struct GNUNET_CONTAINER_MultiHashMap * elements_randomized
Maps struct GNUNET_HashCode * to struct ElementEntry * randomized.
unsigned int refcount
Number of references to the content.
A set that supports a specific operation with other peers.
struct MultiStrataEstimator * se
The strata estimator is only generated once for each set.
struct Set * next
Sets are held in a doubly linked list (in sets_head and sets_tail).
struct Operation * ops_head
Evaluate operations are held in a linked list.
struct Operation * ops_tail
Evaluate operations are held in a linked list.
struct Set * prev
Sets are held in a doubly linked list.
struct SetContent * content
Content, possibly shared by multiple sets, and thus reference counted.
struct ClientState * cs
Client that owns the set.
unsigned int current_generation
Current generation, that is, number of previously executed operations and lazy copies on the underlyi...
Strata estimator together with the peer's overall set size.
uint64_t set_size
Size of the local set.
uint8_t se_count
The number of ses transmitted.
struct InvertibleBloomFilter ** strata
The IBFs of this strata estimator.
unsigned int strata_count
Size of the IBF array in strata.
Message which signals to other peer that we are sending full set.
uint32_t local_set_difference
Local set difference calculated with strata estimator.
uint32_t remote_set_difference
Remote set difference calculated with strata estimator.
uint32_t remote_set_size
Total remote set size.
Struct to tracked messages in message control flow.
enum MESSAGE_CONTROL_FLOW_STATE element
Track the message control state of the element message.
enum MESSAGE_CONTROL_FLOW_STATE offer
Track the message control state of the offer message.
enum MESSAGE_CONTROL_FLOW_STATE demand
Track the message control state of the demand message.