set union operation More...
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_statistics_service.h"
#include "ibf.h"
#include "gnunet_protocols.h"
#include "gnunet_cadet_service.h"
#include "gnunet-service-setu_strata_estimator.h"
#include "gnunet-service-setu_protocol.h"
#include <gcrypt.h>
#include "gnunet_setu_service.h"
#include "setu.h"
Go to the source code of this file.
Data Structures | |
struct | ElementEntry |
Information about an element element in the set. More... | |
struct | ClientState |
State we keep per client. More... | |
struct | Operation |
Operation context used to execute a set operation. More... | |
struct | SetContent |
SetContent stores the actual set elements, which may be shared by multiple generations derived from one set. More... | |
struct | Set |
A set that supports a specific operation with other peers. More... | |
struct | KeyEntry |
The key entry is used to associate an ibf key with an element. More... | |
struct | SendElementClosure |
Used as a closure for sending elements with a specific IBF key. More... | |
struct | Listener |
A listener is inhabited by a client, and waits for evaluation requests from remote peers. More... | |
struct | messageControlFlowElement |
Struct to tracked messages in message control flow. More... | |
struct | GetElementContext |
Context for op_get_element_iterator. More... | |
Macros | |
#define | LOG(kind, ...) GNUNET_log_from (kind, "setu", __VA_ARGS__) |
#define | INCOMING_CHANNEL_TIMEOUT GNUNET_TIME_UNIT_MINUTES |
How long do we hold on to an incoming channel if there is no local listener before giving up? More... | |
#define | SE_STRATA_COUNT 32 |
Number of IBFs in a strata estimator. More... | |
#define | SE_IBFS_TOTAL_SIZE 632 |
Primes for all 4 different strata estimators 61,67,71,73,79,83,89,97 348 Based on the bsc thesis of Elias Summermatter (2021) More... | |
#define | SE_IBF_HASH_NUM 3 |
The hash num parameter for the difference digests and strata estimators. More... | |
#define | MAX_BUCKETS_PER_MESSAGE ((1 << 16) / IBF_BUCKET_SIZE) |
Number of buckets that can be transmitted in one message. More... | |
#define | MAX_IBF_SIZE 1048576 |
The maximum size of an ibf we use is MAX_IBF_SIZE=2^20. More... | |
#define | IBF_MIN_SIZE 37 |
Minimal size of an ibf Based on the bsc thesis of Elias Summermatter (2021) More... | |
#define | DIFFERENTIAL_RTT_MEAN 3.65145 |
AVG RTT for differential sync when k=2 and Factor = 2 Based on the bsc thesis of Elias Summermatter (2021) More... | |
#define | SECURITY_LEVEL 80 |
Security level used for byzantine checks (2^80) More... | |
#define | PROBABILITY_FOR_NEW_ROUND 0.15 |
Is the estimated probability for a new round this values is based on the bsc thesis of Elias Summermatter (2021) More... | |
#define | MEASURE_PERFORMANCE 0 |
Measure the performance in a csv. More... | |
Enumerations | |
enum | UnionOperationPhase { PHASE_EXPECT_SE , PHASE_EXPECT_IBF , PHASE_EXPECT_IBF_CONT , PHASE_INVENTORY_ACTIVE , PHASE_INVENTORY_PASSIVE , PHASE_FINISH_CLOSING , PHASE_FINISH_WAITING , PHASE_DONE , PHASE_FULL_SENDING , PHASE_EXPECT_SE , PHASE_EXPECT_IBF , PHASE_EXPECT_IBF_LAST , PHASE_ACTIVE_DECODING , PHASE_PASSIVE_DECODING , PHASE_FINISH_CLOSING , PHASE_FINISH_WAITING , PHASE_FINISHED , PHASE_FULL_SENDING , PHASE_FULL_RECEIVING } |
Current phase we are in for a union operation. More... | |
enum | MODE_OF_OPERATION { DIFFERENTIAL_SYNC , FULL_SYNC_LOCAL_SENDING_FIRST , FULL_SYNC_REMOTE_SENDING_FIRST } |
Different modes of operations. More... | |
enum | MESSAGE_CONTROL_FLOW_STATE { MSG_CFS_UNINITIALIZED , MSG_CFS_SENT , MSG_CFS_EXPECTED , MSG_CFS_RECEIVED } |
Different states to control the messages flow in differential mode. More... | |
enum | MESSAGE_TYPE { OFFER_MESSAGE , DEMAND_MESSAGE , ELEMENT_MESSAGE } |
Message types to track in message control flow. More... | |
Functions | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
static int | determinate_done_message_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator for determining if all demands have been satisfied. More... | |
static int | determinate_avg_element_size_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator for determining average size. More... | |
static int | create_randomized_element_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) |
Create randomized element hashmap for full sending. More... | |
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. More... | |
static void | send_client_done (void *cls) |
Signal to the client that the operation has finished and destroy the operation. More... | |
static int | check_byzantine_bounds (struct Operation *op) |
Check if all given byzantine parameters are in given boundaries. More... | |
static enum GNUNET_GenericReturnValue | free_values_iter (void *cls, const struct GNUNET_HashCode *key, void *value) |
static void | _GSS_operation_destroy (struct Operation *op) |
Destroy the given operation. More... | |
static void | _GSS_operation_destroy2 (struct Operation *op) |
This function probably should not exist and be replaced by inlining more specific logic in the various places where it is called. More... | |
static void | incoming_destroy (struct Operation *op) |
Destroy an incoming request from a remote peer. More... | |
static void | fail_union_operation (struct Operation *op) |
Inform the client that the union operation has failed, and proceed to destroy the evaluate operation. More... | |
static void | full_sync_plausibility_check (struct Operation *op) |
Function that checks if full sync is plausible. More... | |
static void | check_max_differential_rounds (struct Operation *op) |
Limit active passive switches in differential sync to configured security level. More... | |
static struct IBF_Key | get_ibf_key (const struct GNUNET_HashCode *src) |
Derive the IBF key from a hash code and a salt. More... | |
static int | op_get_element_iterator (void *cls, uint32_t key, void *value) |
Iterator over the mapping from IBF keys to element entries. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
static int | prepare_ibf_iterator (void *cls, uint32_t key, void *value) |
Insert a key into an ibf. More... | |
static int | _GSS_is_element_of_operation (struct ElementEntry *ee, struct Operation *op) |
Is element ee part of the set used by op? More... | |
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. More... | |
static void | initialize_key_to_element (struct Operation *op) |
Initialize the IBF key to element mapping local to this set operation. More... | |
static int | prepare_ibf (struct Operation *op, uint32_t size) |
Create an ibf with the operation's elements of the specified size. More... | |
static int | send_ibf (struct Operation *op, uint32_t ibf_size) |
Send an ibf of appropriate size. More... | |
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. More... | |
static unsigned int | get_next_ibf_size (float ibf_bucket_number_factor, unsigned int decoded_elements, unsigned int last_ibf_size) |
static int | send_full_element_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) |
Send a set element. More... | |
static void | send_full_set (struct Operation *op) |
Switch to full set transmission for op. More... | |
static int | check_union_p2p_strata_estimator (void *cls, const struct StrataEstimatorMessage *msg) |
Handle a strata estimator from a remote peer. More... | |
static void | handle_union_p2p_strata_estimator (void *cls, const struct StrataEstimatorMessage *msg) |
Handle a strata estimator from a remote peer. More... | |
static int | send_offers_iterator (void *cls, uint32_t key, void *value) |
Iterator to send elements to a remote peer. More... | |
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. More... | |
static int | decode_and_send (struct Operation *op) |
Decode which elements are missing on each side, and send the appropriate offers and inquiries. More... | |
static int | check_union_p2p_send_full (void *cls, const struct TransmitFullMessage *msg) |
Check send full message received from other peer. More... | |
static void | handle_union_p2p_send_full (void *cls, const struct TransmitFullMessage *msg) |
Handle send full message received from other peer. More... | |
static int | check_union_p2p_ibf (void *cls, const struct IBFMessage *msg) |
Check an IBF message from a remote peer. More... | |
static void | handle_union_p2p_ibf (void *cls, const struct IBFMessage *msg) |
Handle an IBF message from a remote peer. More... | |
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. More... | |
static void | maybe_finish (struct Operation *op) |
Tests if the operation is finished, and if so notify. More... | |
static int | check_union_p2p_elements (void *cls, const struct GNUNET_SETU_ElementMessage *emsg) |
Check an element message from a remote peer. More... | |
static void | handle_union_p2p_elements (void *cls, const struct GNUNET_SETU_ElementMessage *emsg) |
Handle an element message from a remote peer. More... | |
static int | check_union_p2p_full_element (void *cls, const struct GNUNET_SETU_ElementMessage *emsg) |
Check a full element message from a remote peer. More... | |
static void | handle_union_p2p_full_element (void *cls, const struct GNUNET_SETU_ElementMessage *emsg) |
Handle an element message from a remote peer. More... | |
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). More... | |
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). More... | |
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. More... | |
static int | check_union_p2p_request_full (void *cls, const struct TransmitFullMessage *mh) |
Handle a request for full set transmission. More... | |
static void | handle_union_p2p_request_full (void *cls, const struct TransmitFullMessage *msg) |
static void | handle_union_p2p_full_done (void *cls, const struct GNUNET_MessageHeader *mh) |
Handle a "full done" message. More... | |
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_HashCode s. More... | |
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_HashCode s. More... | |
static int | check_union_p2p_offer (void *cls, const struct GNUNET_MessageHeader *mh) |
Check offer (of struct GNUNET_HashCode s). More... | |
static void | handle_union_p2p_offer (void *cls, const struct GNUNET_MessageHeader *mh) |
Handle offers (of struct GNUNET_HashCode s) and respond with demands (of struct GNUNET_HashCode s). More... | |
static void | handle_union_p2p_done (void *cls, const struct GNUNET_MessageHeader *mh) |
Handle a done message from a remote peer. More... | |
static void | handle_union_p2p_over (void *cls, const struct GNUNET_MessageHeader *mh) |
Handle a over message from a remote peer. More... | |
static struct Operation * | get_incoming (uint32_t id) |
Get the incoming socket associated with the given id. More... | |
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. More... | |
static int | destroy_elements_iterator (void *cls, const struct GNUNET_HashCode *key, void *value) |
Iterator over hash map entries to free element entries. More... | |
static void | client_disconnect_cb (void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls) |
Clean up after a client has disconnected. More... | |
static int | check_incoming_msg (void *cls, const struct OperationRequestMessage *msg) |
Check a request for a set operation from another peer. More... | |
static void | handle_incoming_msg (void *cls, const struct OperationRequestMessage *msg) |
Handle a request for a set operation from another peer. More... | |
static void | handle_client_create_set (void *cls, const struct GNUNET_SETU_CreateMessage *msg) |
Called when a client wants to create a new set. More... | |
static void | incoming_timeout_cb (void *cls) |
Timeout happens iff: More... | |
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. More... | |
static void | channel_end_cb (void *channel_ctx, const struct GNUNET_CADET_Channel *channel) |
Function called whenever a channel is destroyed. More... | |
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. More... | |
static void | handle_client_listen (void *cls, const struct GNUNET_SETU_ListenMessage *msg) |
Called when a client wants to create a new listener. More... | |
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. More... | |
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. More... | |
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. More... | |
static void | advance_generation (struct Set *set) |
Advance the current generation of a set, adding exclusion ranges if necessary. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
static void | shutdown_task (void *cls) |
Called to clean up, after a shutdown has been requested. More... | |
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. More... | |
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. More... | |
Variables | |
static struct GNUNET_CADET_Handle * | cadet |
Handle to the cadet service, used to listen for and connect to remote peers. More... | |
static struct GNUNET_STATISTICS_Handle * | _GSS_statistics |
Statistics handle. More... | |
static struct Listener * | listener_head |
Listeners are held in a doubly linked list. More... | |
static struct Listener * | listener_tail |
Listeners are held in a doubly linked list. More... | |
static unsigned int | num_clients |
Number of active clients. More... | |
static int | in_shutdown |
Are we in shutdown? if GNUNET_YES and the number of clients drops to zero, disconnect from CADET. More... | |
static uint32_t | suggest_id |
Counter for allocating unique IDs for clients, used to identify incoming operation requests from remote peers, that the client can choose to accept or refuse. More... | |
set union operation
Definition in file gnunet-service-setu.c.
#define LOG | ( | kind, | |
... | |||
) | GNUNET_log_from (kind, "setu", __VA_ARGS__) |
Definition at line 40 of file gnunet-service-setu.c.
#define INCOMING_CHANNEL_TIMEOUT GNUNET_TIME_UNIT_MINUTES |
How long do we hold on to an incoming channel if there is no local listener before giving up?
Definition at line 46 of file gnunet-service-setu.c.
#define SE_STRATA_COUNT 32 |
Number of IBFs in a strata estimator.
Definition at line 51 of file gnunet-service-setu.c.
#define SE_IBFS_TOTAL_SIZE 632 |
Primes for all 4 different strata estimators 61,67,71,73,79,83,89,97 348 Based on the bsc thesis of Elias Summermatter (2021)
Definition at line 58 of file gnunet-service-setu.c.
#define SE_IBF_HASH_NUM 3 |
The hash num parameter for the difference digests and strata estimators.
Definition at line 63 of file gnunet-service-setu.c.
#define MAX_BUCKETS_PER_MESSAGE ((1 << 16) / IBF_BUCKET_SIZE) |
Number of buckets that can be transmitted in one message.
Definition at line 68 of file gnunet-service-setu.c.
#define MAX_IBF_SIZE 1048576 |
The maximum size of an ibf we use is MAX_IBF_SIZE=2^20.
Choose this value so that computing the IBF is still cheaper than transmitting all values.
Definition at line 75 of file gnunet-service-setu.c.
#define IBF_MIN_SIZE 37 |
Minimal size of an ibf Based on the bsc thesis of Elias Summermatter (2021)
Definition at line 82 of file gnunet-service-setu.c.
#define DIFFERENTIAL_RTT_MEAN 3.65145 |
AVG RTT for differential sync when k=2 and Factor = 2 Based on the bsc thesis of Elias Summermatter (2021)
Definition at line 88 of file gnunet-service-setu.c.
#define SECURITY_LEVEL 80 |
Security level used for byzantine checks (2^80)
Definition at line 94 of file gnunet-service-setu.c.
#define PROBABILITY_FOR_NEW_ROUND 0.15 |
Is the estimated probability for a new round this values is based on the bsc thesis of Elias Summermatter (2021)
Definition at line 101 of file gnunet-service-setu.c.
#define MEASURE_PERFORMANCE 0 |
Measure the performance in a csv.
Definition at line 107 of file gnunet-service-setu.c.
enum UnionOperationPhase |
Current phase we are in for a union operation.
Definition at line 113 of file gnunet-service-setu.c.
enum MODE_OF_OPERATION |
Different modes of operations.
Definition at line 181 of file gnunet-service-setu.c.
Different states to control the messages flow in differential mode.
Definition at line 812 of file gnunet-service-setu.c.
enum MESSAGE_TYPE |
Message types to track in message control flow.
Enumerator | |
---|---|
OFFER_MESSAGE | Offer message type. |
DEMAND_MESSAGE | Demand message type. |
ELEMENT_MESSAGE | Element message type. |
Definition at line 839 of file gnunet-service-setu.c.
|
static |
Function that chooses the optimal mode of operation depending on operation parameters.
avg_element_size | |
local_set_size | |
remote_set_size | |
est_set_diff_remote | |
est_set_diff_local | |
bandwith_latency_tradeoff | |
ibf_bucket_number_factor |
Definition at line 1050 of file gnunet-service-setu.c.
References DIFFERENTIAL_RTT_MEAN, DIFFERENTIAL_SYNC, FULL_SYNC_LOCAL_SENDING_FIRST, FULL_SYNC_REMOTE_SENDING_FIRST, IBF_MIN_SIZE, and MAX_BUCKETS_PER_MESSAGE.
Referenced by handle_union_p2p_request_full(), handle_union_p2p_send_full(), and handle_union_p2p_strata_estimator().
|
static |
Validates the if a message is received in a correct phase.
allowed_phases | |
size_phases | |
op |
Iterate over allowed phases
Definition at line 1200 of file gnunet-service-setu.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_NO, GNUNET_YES, LOG, op, and phase.
Referenced by handle_union_p2p_demand(), handle_union_p2p_done(), handle_union_p2p_elements(), handle_union_p2p_full_done(), handle_union_p2p_full_element(), handle_union_p2p_ibf(), handle_union_p2p_inquiry(), handle_union_p2p_offer(), handle_union_p2p_request_full(), handle_union_p2p_send_full(), and handle_union_p2p_strata_estimator().
|
static |
Function to update, track and validate message received in differential sync.
This function tracks states of messages and check it against different constraints as described in Summermatter's BSc Thesis (2021)
hash_map | Hashmap to store message control flow |
new_mcfs | The new message control flow state an given message type should be set to |
hash_code | Hash code of the element |
mt | The message type for which the message control flow state should be set |
Check logic for forbidden messages
In case the element hash is not in the hashmap create a new entry
Set state of message
Check if state is allowed
Definition at line 1235 of file gnunet-service-setu.c.
References messageControlFlowElement::demand, DEMAND_MESSAGE, messageControlFlowElement::element, ELEMENT_MESSAGE, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_new, GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, LOG, MSG_CFS_RECEIVED, MSG_CFS_SENT, messageControlFlowElement::offer, and OFFER_MESSAGE.
Referenced by handle_union_p2p_demand(), handle_union_p2p_elements(), handle_union_p2p_offer(), and send_offers_iterator().
|
static |
Validate if a message in differential sync si already received before.
hash_map | |
hash_code | |
mt |
Set state of message
Evaluate if set is in message
Definition at line 1325 of file gnunet-service-setu.c.
References messageControlFlowElement::demand, DEMAND_MESSAGE, messageControlFlowElement::element, ELEMENT_MESSAGE, GNUNET_CONTAINER_multihashmap_get(), GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, MSG_CFS_UNINITIALIZED, messageControlFlowElement::offer, and OFFER_MESSAGE.
Referenced by send_offers_iterator().
|
static |
Iterator for determining if all demands have been satisfied.
cls | the union operation struct Operation * |
key | unused |
value | the struct ElementEntry * to insert into the key-to-element mapping |
Definition at line 1381 of file gnunet-service-setu.c.
References messageControlFlowElement::element, GNUNET_NO, GNUNET_YES, MSG_CFS_RECEIVED, MSG_CFS_SENT, and value.
Referenced by maybe_finish().
|
static |
Iterator for determining average size.
cls | the union operation struct Operation * |
key | unused |
value | the struct ElementEntry * to insert into the key-to-element mapping |
Definition at line 1405 of file gnunet-service-setu.c.
References GNUNET_YES, op, GNUNET_SETU_Element::size, and value.
Referenced by handle_client_accept(), handle_union_p2p_request_full(), handle_union_p2p_send_full(), and handle_union_p2p_strata_estimator().
|
static |
Create randomized element hashmap for full sending.
cls | the union operation struct Operation * |
key | unused |
value | the struct ElementEntry * to insert into the key-to-element mapping |
Hash element with new salt to randomize hashmap
Definition at line 1426 of file gnunet-service-setu.c.
References GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), GNUNET_YES, key, op, and value.
Referenced by send_full_set().
|
static |
Iterator over hash map entries, called to destroy the linked list of colliding ibf key entries.
cls | closure |
key | current key code |
value | value in the hash map |
Definition at line 1465 of file gnunet-service-setu.c.
References KeyEntry::element, GNUNET_assert, GNUNET_free, GNUNET_YES, ElementEntry::remote, and value.
Referenced by _GSS_operation_destroy().
|
static |
Signal to the client that the operation has finished and destroy the operation.
cls | operation to destroy |
Definition at line 1489 of file gnunet-service-setu.c.
References _GSS_statistics, GNUNET_SETU_ResultMessage::current_size, GNUNET_SETU_ResultMessage::element_type, GNUNET_CONTAINER_multihashmap32_size(), GNUNET_ERROR_TYPE_INFO, GNUNET_ERROR_TYPE_WARNING, GNUNET_htonll(), GNUNET_MESSAGE_TYPE_SETU_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SETU_STATUS_DONE, GNUNET_SETU_STATUS_FAILURE, GNUNET_STATISTICS_update(), GNUNET_YES, LOG, op, PHASE_FINISHED, GNUNET_SETU_ResultMessage::request_id, and GNUNET_SETU_ResultMessage::result_status.
Referenced by _GSS_operation_destroy2(), handle_union_p2p_full_done(), handle_union_p2p_over(), and maybe_finish().
|
static |
Check if all given byzantine parameters are in given boundaries.
op |
Check upper byzantine bounds
Check lower byzantine bounds
Definition at line 1541 of file gnunet-service-setu.c.
References GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, and op.
Referenced by handle_union_p2p_request_full(), and handle_union_p2p_send_full().
|
static |
Definition at line 1565 of file gnunet-service-setu.c.
References GNUNET_free, GNUNET_YES, and value.
Referenced by _GSS_operation_destroy().
|
static |
Destroy the given operation.
Used for any operation where both peers were known and that thus actually had a vt and channel. Must not be used for operations where 'listener' is still set and we do not know the other peer.
Call the implementation-specific cancel function of the operation. Disconnects from the remote peer. Does not disconnect the client, as there may be multiple operations per set.
op | operation to destroy |
Definition at line 1589 of file gnunet-service-setu.c.
References destroy_key_to_element_iter(), free_values_iter(), GNUNET_assert, GNUNET_CADET_channel_destroy(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_destroy(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, ibf_destroy(), op, Set::ops_head, Set::ops_tail, and strata_estimator_destroy().
Referenced by _GSS_operation_destroy2(), client_disconnect_cb(), fail_union_operation(), and handle_client_cancel().
|
static |
This function probably should not exist and be replaced by inlining more specific logic in the various places where it is called.
Definition at line 1708 of file gnunet-service-setu.c.
References _GSS_operation_destroy(), GNUNET_CADET_channel_destroy(), GNUNET_free, incoming_destroy(), op, and send_client_done().
Referenced by channel_end_cb(), handle_client_reject(), handle_union_p2p_full_done(), incoming_destroy(), and maybe_finish().
|
static |
Destroy an incoming request from a remote peer.
op | remote request to destroy |
Definition at line 1679 of file gnunet-service-setu.c.
References _GSS_operation_destroy2(), GNUNET_CONTAINER_DLL_remove, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_SCHEDULER_cancel(), op, Listener::op_head, and Listener::op_tail.
Referenced by _GSS_operation_destroy2(), client_disconnect_cb(), and incoming_timeout_cb().
|
static |
Inform the client that the union operation has failed, and proceed to destroy the evaluate operation.
op | the union operation to fail |
Definition at line 1738 of file gnunet-service-setu.c.
References _GSS_operation_destroy(), GNUNET_ERROR_TYPE_WARNING, GNUNET_MESSAGE_TYPE_SETU_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SETU_STATUS_FAILURE, LOG, msg, and op.
Referenced by check_max_differential_rounds(), decode_and_send(), full_sync_plausibility_check(), handle_union_p2p_demand(), handle_union_p2p_done(), handle_union_p2p_elements(), handle_union_p2p_full_done(), handle_union_p2p_full_element(), handle_union_p2p_ibf(), handle_union_p2p_inquiry(), handle_union_p2p_offer(), handle_union_p2p_request_full(), handle_union_p2p_send_full(), handle_union_p2p_strata_estimator(), and send_offers_iterator().
|
static |
Function that checks if full sync is plausible.
initial_local_elements_in_set | |
estimated_set_difference | |
repeated_elements | |
fresh_elements | |
op |
Definition at line 1766 of file gnunet-service-setu.c.
References fail_union_operation(), GNUNET_break_op, GNUNET_ERROR_TYPE_ERROR, GNUNET_YES, LOG, op, PHASE_FULL_RECEIVING, PHASE_FULL_SENDING, SECURITY_LEVEL, and value.
Referenced by handle_union_p2p_full_element().
|
static |
Limit active passive switches in differential sync to configured security level.
op |
Definition at line 1832 of file gnunet-service-setu.c.
References fail_union_operation(), GNUNET_break_op, GNUNET_ERROR_TYPE_ERROR, LOG, op, PROBABILITY_FOR_NEW_ROUND, and SECURITY_LEVEL.
Referenced by handle_union_p2p_ibf().
|
static |
Derive the IBF key from a hash code and a salt.
src | the hash code |
Definition at line 1858 of file gnunet-service-setu.c.
References GNUNET_assert, GNUNET_CRYPTO_kdf(), GNUNET_OK, key, and salt.
Referenced by handle_client_set_add(), op_get_element(), and op_register_element().
|
static |
Iterator over the mapping from IBF keys to element entries.
Checks if we have an element with a given GNUNET_HashCode.
cls | closure |
key | current key code |
value | value in the hash map |
Definition at line 1900 of file gnunet-service-setu.c.
References ctx, KeyEntry::element, ElementEntry::element_hash, GNUNET_assert, GNUNET_CRYPTO_hash_cmp(), GNUNET_NO, GNUNET_YES, and value.
Referenced by op_get_element().
|
static |
Determine whether the given element is already in the operation's element set.
op | operation that should be tested for 'element_hash' |
element_hash | hash of the element to look for |
Definition at line 1927 of file gnunet-service-setu.c.
References ctx, get_ibf_key(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_get_multiple(), GNUNET_SYSERR, IBF_Key::key_val, op, op_get_element_iterator(), and ret.
Referenced by handle_union_p2p_elements(), and handle_union_p2p_full_element().
|
static |
Insert an element into the union operation's key-to-element mapping.
Takes ownership of 'ee'. Note that this does not insert the element in the set, only in the operation's key-element mapping. This is done to speed up re-tried operations, if some elements were transmitted, and then the IBF fails to decode.
XXX: clarify ownership, doesn't sound right.
op | the union operation |
ee | the element entry |
received | was this element received from the remote peer? |
Definition at line 1968 of file gnunet-service-setu.c.
References KeyEntry::element, ElementEntry::element_hash, get_ibf_key(), GNUNET_assert, GNUNET_CONTAINER_multihashmap32_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE, GNUNET_new, GNUNET_OK, KeyEntry::ibf_key, IBF_Key::key_val, op, and KeyEntry::received.
Referenced by handle_union_p2p_elements(), handle_union_p2p_full_element(), and init_key_to_element_iterator().
Modify an IBF key k_in based on the salt, returning a salted key in k_out.
Definition at line 1994 of file gnunet-service-setu.c.
References IBF_Key::key_val, and salt.
Referenced by prepare_ibf_iterator().
|
static |
Reverse modification done in the salt_key function.
Definition at line 2011 of file gnunet-service-setu.c.
References IBF_Key::key_val, and salt.
Referenced by decode_and_send(), and handle_union_p2p_inquiry().
|
static |
Insert a key into an ibf.
cls | the ibf |
key | unused |
value | the key entry to get the key from |
Definition at line 2031 of file gnunet-service-setu.c.
References KeyEntry::element, ElementEntry::element_hash, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_YES, ibf_insert(), KeyEntry::ibf_key, IBF_Key::key_val, LOG, op, salt_key(), and value.
Referenced by prepare_ibf().
|
static |
Is element ee part of the set used by op?
ee | element to test |
op | operation the defines the set and its generation |
Definition at line 2060 of file gnunet-service-setu.c.
References ElementEntry::generation, and op.
Referenced by handle_union_p2p_demand(), handle_union_p2p_offer(), and init_key_to_element_iterator().
|
static |
Iterator for initializing the key-to-element mapping of a union operation.
cls | the union operation struct Operation * |
key | unused |
value | the struct ElementEntry * to insert into the key-to-element mapping |
Definition at line 2078 of file gnunet-service-setu.c.
References _GSS_is_element_of_operation(), GNUNET_assert, GNUNET_NO, GNUNET_YES, op, op_register_element(), ElementEntry::remote, and value.
Referenced by initialize_key_to_element().
|
static |
Initialize the IBF key to element mapping local to this set operation.
op | the set union operation |
Definition at line 2105 of file gnunet-service-setu.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_create(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), init_key_to_element_iterator(), and op.
Referenced by handle_client_accept(), and handle_client_evaluate().
|
static |
Create an ibf with the operation's elements of the specified size.
op | the union operation |
size | size of the ibf to create |
Definition at line 2127 of file gnunet-service-setu.c.
References GNUNET_assert, GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, GNUNET_SYSERR, ibf_create(), ibf_destroy(), op, prepare_ibf_iterator(), and size.
Referenced by decode_and_send(), and send_ibf().
|
static |
Send an ibf of appropriate size.
Fragments the IBF into multiple messages if necessary.
op | the union operation |
ibf_order | order of the ibf to send, size=2^order |
Enforce min size of IBF
Definition at line 2160 of file gnunet-service-setu.c.
References _GSS_statistics, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SETU_P2P_IBF, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_snprintf(), GNUNET_STATISTICS_update(), GNUNET_SYSERR, IBF_BUCKET_SIZE, ibf_get_max_counter(), IBF_MIN_SIZE, ibf_size, ibf_write_slice(), LOG, MAX_BUCKETS_PER_MESSAGE, msg, name, op, PHASE_PASSIVE_DECODING, and prepare_ibf().
Referenced by decode_and_send(), and handle_union_p2p_strata_estimator().
|
static |
Compute the necessary order of an ibf from the size of the symmetric set difference.
diff | the difference |
Make ibf estimation size odd reasoning can be found in BSc Thesis of Elias Summermatter (2021) in section 3.11
Definition at line 2249 of file gnunet-service-setu.c.
Referenced by handle_union_p2p_strata_estimator().
|
static |
Make ibf estimation size odd reasoning can be found in BSc Thesis of Elias Summermatter (2021) in section 3.11
Definition at line 2260 of file gnunet-service-setu.c.
References consensus-simulation::int.
Referenced by decode_and_send().
|
static |
Send a set element.
cls | the union operation struct Operation * |
key | unused |
value | the struct ElementEntry * to insert into the key-to-element mapping |
Definition at line 2282 of file gnunet-service-setu.c.
References el, ElementEntry::element, GNUNET_SETU_ElementMessage::element_type, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_YES, key, LOG, op, and value.
Referenced by send_full_set().
|
static |
Switch to full set transmission for op.
op | operation to switch to full set transmission. |
Definition at line 2318 of file gnunet-service-setu.c.
References create_randomized_element_iterator(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u64(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE, GNUNET_MQ_msg_header, GNUNET_MQ_send(), GNUNET_NO, LOG, op, PHASE_FULL_SENDING, and send_full_element_iterator().
Referenced by handle_union_p2p_request_full(), and handle_union_p2p_strata_estimator().
|
static |
Handle a strata estimator from a remote peer.
cls | the union operation |
msg | the message |
Definition at line 2359 of file gnunet-service-setu.c.
References GNUNET_break, GNUNET_MESSAGE_TYPE_SETU_P2P_SEC, GNUNET_NO, GNUNET_OK, GNUNET_SYSERR, IBF_BUCKET_SIZE, msg, op, PHASE_EXPECT_SE, SE_IBFS_TOTAL_SIZE, SE_STRATA_COUNT, GNUNET_MessageHeader::size, and GNUNET_MessageHeader::type.
|
static |
Handle a strata estimator from a remote peer.
cls | the union operation |
msg | the message |
Check that the message is received only in supported phase
Only allow 1,2,4,8 SEs
Calculate avg element size if not initial sync
Definition at line 2391 of file gnunet-service-setu.c.
References _GSS_statistics, check_valid_phase(), determinate_avg_element_size_iterator(), DIFFERENTIAL_SYNC, estimate_best_mode_of_operation(), removetrailingwhitespace::f, fail_union_operation(), FULL_SYNC_LOCAL_SENDING_FIRST, get_size_from_difference(), getenv(), GNUNET_assert, GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, GNUNET_MESSAGE_TYPE_SETU_P2P_SEC, GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_ntohll(), GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_YES, InvertibleBloomFilter::local_decoded_count, TransmitFullMessage::local_set_difference, LOG, msg, op, PHASE_EXPECT_SE, PHASE_FULL_RECEIVING, InvertibleBloomFilter::remote_decoded_count, TransmitFullMessage::remote_set_difference, TransmitFullMessage::remote_set_size, SE_IBF_HASH_NUM, SE_IBFS_TOTAL_SIZE, SE_STRATA_COUNT, send_full_set(), send_ibf(), GNUNET_MessageHeader::size, StrataEstimator::strata, strata_estimator_create(), strata_estimator_destroy(), strata_estimator_difference(), strata_estimator_read(), MultiStrataEstimator::stratas, and GNUNET_MessageHeader::type.
|
static |
Iterator to send elements to a remote peer.
cls | closure with the element key and the union operation |
key | ignored |
value | the key entry |
Definition at line 2660 of file gnunet-service-setu.c.
References DEMAND_MESSAGE, KeyEntry::element, ElementEntry::element_hash, fail_union_operation(), GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER, GNUNET_MQ_msg_header_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_YES, KeyEntry::ibf_key, SendElementClosure::ibf_key, is_message_in_message_control_flow(), IBF_Key::key_val, LOG, mh, MSG_CFS_EXPECTED, MSG_CFS_SENT, OFFER_MESSAGE, op, SendElementClosure::op, update_message_control_flow(), and value.
Referenced by send_offers_for_key().
Send offers (in the form of GNUNET_Hash-es) to the remote peer for the given IBF key.
op | union operation |
ibf_key | IBF key of interest |
Definition at line 2748 of file gnunet-service-setu.c.
References GNUNET_CONTAINER_multihashmap32_get_multiple(), SendElementClosure::ibf_key, op, SendElementClosure::op, and send_offers_iterator().
Referenced by decode_and_send(), and handle_union_p2p_inquiry().
|
static |
Decode which elements are missing on each side, and send the appropriate offers and inquiries.
op | union operation |
Enforce odd ibf size
Make ibf estimation size odd reasoning can be found in BSc Thesis of Elias Summermatter (2021) in section 3.11
Add sent inquiries to hashmap for flow control
Definition at line 2772 of file gnunet-service-setu.c.
References _GSS_statistics, fail_union_operation(), get_next_ibf_size(), GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_P2P_DONE, GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY, GNUNET_MQ_msg_extra, GNUNET_MQ_msg_header, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_STATISTICS_update(), GNUNET_SYSERR, GNUNET_YES, ibf_decode(), ibf_destroy(), ibf_dup(), IBF_MIN_SIZE, ibf_subtract(), key, IBF_Key::key_val, LOG, MAX_IBF_SIZE, msg, MSG_CFS_SENT, op, PHASE_ACTIVE_DECODING, prepare_ibf(), res, send_ibf(), send_offers_for_key(), InvertibleBloomFilter::size, and unsalt_key().
Referenced by handle_union_p2p_ibf().
|
static |
Check send full message received from other peer.
cls | |
msg |
Definition at line 2976 of file gnunet-service-setu.c.
References GNUNET_OK.
|
static |
Handle send full message received from other peer.
cls | |
msg |
Check that the message is received only in supported phase
write received values to operator
Check byzantine limits
Calculate avg element size if not initial sync
Validate mode of operation
Definition at line 2990 of file gnunet-service-setu.c.
References check_byzantine_bounds(), check_valid_phase(), determinate_avg_element_size_iterator(), estimate_best_mode_of_operation(), fail_union_operation(), FULL_SYNC_LOCAL_SENDING_FIRST, GNUNET_break, GNUNET_break_op, GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_ERROR, GNUNET_OK, Operation::ibf_bucket_number_factor, Operation::local_element_count, LOG, Operation::mode_of_operation, msg, op, PHASE_EXPECT_IBF, PHASE_FULL_RECEIVING, Operation::remote_element_count, and Operation::rtt_bandwidth_tradeoff.
|
static |
Check an IBF message from a remote peer.
Reassemble the IBF from multiple pieces, and process the whole IBF once possible.
cls | the union operation |
msg | the header of the message |
Definition at line 3078 of file gnunet-service-setu.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, IBF_BUCKET_SIZE, msg, op, PHASE_EXPECT_IBF, PHASE_EXPECT_IBF_LAST, PHASE_PASSIVE_DECODING, and GNUNET_MessageHeader::size.
|
static |
Handle an IBF message from a remote peer.
Reassemble the IBF from multiple pieces, and process the whole IBF once possible.
cls | the union operation |
msg | the header of the message |
Check that the message is received only in supported phase
Definition at line 3137 of file gnunet-service-setu.c.
References check_max_differential_rounds(), check_valid_phase(), decode_and_send(), fail_union_operation(), GNUNET_assert, GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_OK, IBF_BUCKET_SIZE, ibf_create(), ibf_read_slice(), LOG, msg, op, PHASE_ACTIVE_DECODING, PHASE_EXPECT_IBF, PHASE_EXPECT_IBF_LAST, PHASE_PASSIVE_DECODING, and GNUNET_MessageHeader::size.
|
static |
Send a result message to the client indicating that there is a new element.
op | union operation |
element | element to send |
status | status to send with the new element |
Definition at line 3238 of file gnunet-service-setu.c.
References GNUNET_SETU_ResultMessage::current_size, GNUNET_SETU_Element::data, GNUNET_SETU_Element::element_type, GNUNET_SETU_ResultMessage::element_type, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap32_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_htonll(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_RESULT, GNUNET_MQ_discard(), GNUNET_MQ_msg_extra, GNUNET_MQ_send(), LOG, op, GNUNET_SETU_ResultMessage::request_id, GNUNET_SETU_ResultMessage::result_status, GNUNET_SETU_Element::size, and status.
Referenced by handle_union_p2p_demand(), handle_union_p2p_elements(), and handle_union_p2p_full_element().
|
static |
Tests if the operation is finished, and if so notify.
op | operation to check |
Definition at line 3277 of file gnunet-service-setu.c.
References _GSS_operation_destroy2(), determinate_done_message_iterator(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SETU_P2P_DONE, GNUNET_MQ_msg_header, GNUNET_MQ_send(), LOG, op, PHASE_FINISH_CLOSING, PHASE_FINISH_WAITING, PHASE_FINISHED, and send_client_done().
Referenced by handle_union_p2p_demand(), handle_union_p2p_done(), and handle_union_p2p_elements().
|
static |
Check an element message from a remote peer.
cls | the union operation |
emsg | the message |
Definition at line 3329 of file gnunet-service-setu.c.
References GNUNET_break_op, GNUNET_CONTAINER_multihashmap_size(), GNUNET_OK, GNUNET_SYSERR, and op.
|
static |
Handle an element message from a remote peer.
Sent by the other peer either because we decoded an IBF and placed a demand, or because the other peer switched to full set transmission.
cls | the union operation |
emsg | the message |
Check that the message is received only in supported phase
Definition at line 3352 of file gnunet-service-setu.c.
References _GSS_statistics, check_valid_phase(), GNUNET_SET_Element::data, ElementEntry::element, ElementEntry::element_hash, ELEMENT_MESSAGE, GNUNET_SET_Element::element_type, GNUNET_SETU_ElementMessage::element_type, fail_union_operation(), GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_h2s(), GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SETU_element_hash(), GNUNET_SETU_STATUS_ADD_LOCAL, GNUNET_STATISTICS_update(), GNUNET_YES, GNUNET_SETU_ElementMessage::header, LOG, maybe_finish(), MSG_CFS_RECEIVED, op, op_get_element(), op_register_element(), PHASE_ACTIVE_DECODING, PHASE_FINISH_CLOSING, PHASE_FINISH_WAITING, PHASE_PASSIVE_DECODING, KeyEntry::received, ElementEntry::remote, send_client_element(), GNUNET_MessageHeader::size, GNUNET_SET_Element::size, and update_message_control_flow().
|
static |
Check a full element message from a remote peer.
cls | the union operation |
emsg | the message |
Definition at line 3477 of file gnunet-service-setu.c.
|
static |
Handle an element message from a remote peer.
cls | the union operation |
emsg | the message |
Check that the message is received only in supported phase
Definition at line 3496 of file gnunet-service-setu.c.
References _GSS_statistics, check_valid_phase(), GNUNET_SET_Element::data, ElementEntry::element, ElementEntry::element_hash, GNUNET_SET_Element::element_type, GNUNET_SETU_ElementMessage::element_type, fail_union_operation(), full_sync_plausibility_check(), GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_h2s(), GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_OK, GNUNET_SETU_element_hash(), GNUNET_SETU_STATUS_ADD_LOCAL, GNUNET_STATISTICS_update(), GNUNET_YES, GNUNET_SETU_ElementMessage::header, LOG, op, op_get_element(), op_register_element(), PHASE_FULL_RECEIVING, PHASE_FULL_SENDING, KeyEntry::received, ElementEntry::remote, send_client_element(), GNUNET_MessageHeader::size, and GNUNET_SET_Element::size.
|
static |
Send offers (for GNUNET_Hash-es) in response to inquiries (for IBF_Key-s).
cls | the union operation |
msg | the message |
Definition at line 3596 of file gnunet-service-setu.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, msg, op, PHASE_PASSIVE_DECODING, and GNUNET_MessageHeader::size.
|
static |
Send offers (for GNUNET_Hash-es) in response to inquiries (for IBF_Key-s).
cls | the union operation |
msg | the message |
Check that the message is received only in supported phase
Add received inquiries to hashmap for flow control
Definition at line 3626 of file gnunet-service-setu.c.
References check_valid_phase(), fail_union_operation(), GNUNET_break, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_new, GNUNET_OK, LOG, msg, MSG_CFS_RECEIVED, op, PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING, send_offers_for_key(), GNUNET_MessageHeader::size, and unsalt_key().
|
static |
Iterator over hash map entries, called to destroy the linked list of colliding ibf key entries.
cls | closure |
key | current key code |
value | value in the hash map |
Definition at line 3699 of file gnunet-service-setu.c.
References GNUNET_SET_Element::data, ElementEntry::element, KeyEntry::element, GNUNET_SET_Element::element_type, GNUNET_SETU_ElementMessage::element_type, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_YES, op, KeyEntry::received, GNUNET_SET_Element::size, and value.
Referenced by handle_union_p2p_full_done().
|
static |
Handle a request for full set transmission.
cls | closure, a set union operation |
mh | the demand message |
Definition at line 3734 of file gnunet-service-setu.c.
References GNUNET_OK.
|
static |
Check that the message is received only in supported phase
Calculate avg element size if not initial sync
Definition at line 3742 of file gnunet-service-setu.c.
References check_byzantine_bounds(), check_valid_phase(), determinate_avg_element_size_iterator(), estimate_best_mode_of_operation(), fail_union_operation(), FULL_SYNC_REMOTE_SENDING_FIRST, GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_OK, Operation::ibf_bucket_number_factor, Operation::local_element_count, LOG, Operation::mode_of_operation, msg, op, PHASE_EXPECT_IBF, Operation::remote_element_count, Operation::rtt_bandwidth_tradeoff, and send_full_set().
|
static |
Handle a "full done" message.
cls | closure, a set union operation |
mh | the demand message |
Check that the message is received only in supported phase
Definition at line 3831 of file gnunet-service-setu.c.
References _GSS_operation_destroy2(), check_valid_phase(), fail_union_operation(), GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap32_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE, GNUNET_MQ_msg_header, GNUNET_MQ_send(), GNUNET_OK, GNUNET_YES, LOG, op, PHASE_FINISHED, PHASE_FULL_RECEIVING, PHASE_FULL_SENDING, send_client_done(), and send_missing_full_elements_iter().
|
static |
Check a demand by the other peer for elements based on a list of struct GNUNET_HashCode
s.
cls | closure, a set union operation |
mh | the demand message |
Definition at line 3922 of file gnunet-service-setu.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, mh, and op.
|
static |
Handle a demand by the other peer for elements based on a list of struct GNUNET_HashCode
s.
cls | closure, a set union operation |
mh | the demand message |
Check that the message is received only in supported phase
Definition at line 3949 of file gnunet-service-setu.c.
References _GSS_is_element_of_operation(), _GSS_statistics, check_valid_phase(), GNUNET_SET_Element::data, DEMAND_MESSAGE, ElementEntry::element, ElementEntry::element_hash, ELEMENT_MESSAGE, GNUNET_SET_Element::element_type, GNUNET_SETU_ElementMessage::element_type, fail_union_operation(), GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_OK, GNUNET_SETU_STATUS_ADD_REMOTE, GNUNET_STATISTICS_update(), GNUNET_YES, LOG, maybe_finish(), mh, MSG_CFS_RECEIVED, MSG_CFS_SENT, op, PHASE_ACTIVE_DECODING, PHASE_FINISH_WAITING, PHASE_PASSIVE_DECODING, GNUNET_SETU_ElementMessage::reserved, send_client_element(), GNUNET_SET_Element::size, and update_message_control_flow().
|
static |
Check offer (of struct GNUNET_HashCode
s).
cls | the union operation |
mh | the message |
Definition at line 4072 of file gnunet-service-setu.c.
References GNUNET_break_op, GNUNET_OK, GNUNET_SYSERR, mh, op, PHASE_ACTIVE_DECODING, and PHASE_PASSIVE_DECODING.
|
static |
Handle offers (of struct GNUNET_HashCode
s) and respond with demands (of struct GNUNET_HashCode
s).
cls | the union operation |
mh | the message |
Check that the message is received only in supported phase
Definition at line 4105 of file gnunet-service-setu.c.
References _GSS_is_element_of_operation(), check_valid_phase(), DEMAND_MESSAGE, ELEMENT_MESSAGE, fail_union_operation(), GNUNET_assert, GNUNET_break, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_contains(), GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_h2s(), GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND, GNUNET_MQ_msg_header_extra, GNUNET_MQ_send(), GNUNET_OK, GNUNET_YES, LOG, mh, MSG_CFS_EXPECTED, MSG_CFS_RECEIVED, MSG_CFS_SENT, OFFER_MESSAGE, op, PHASE_ACTIVE_DECODING, PHASE_PASSIVE_DECODING, and update_message_control_flow().
|
static |
Handle a done message from a remote peer.
cls | the union operation |
mh | the message |
Check that the message is received only in supported phase
Definition at line 4231 of file gnunet-service-setu.c.
References check_valid_phase(), fail_union_operation(), GNUNET_break, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_OK, LOG, maybe_finish(), op, PHASE_ACTIVE_DECODING, PHASE_FINISH_CLOSING, PHASE_FINISH_WAITING, and PHASE_PASSIVE_DECODING.
|
static |
Handle a over message from a remote peer.
cls | the union operation |
mh | the message |
Definition at line 4306 of file gnunet-service-setu.c.
References send_client_done().
|
static |
Get the incoming socket associated with the given id.
listener | the listener to look in |
id | id to look for |
Definition at line 4325 of file gnunet-service-setu.c.
References Operation::listener, listener_head, Listener::next, GNUNET_ARM_Operation::next, op, and Listener::op_head.
Referenced by handle_client_accept(), and handle_client_reject().
|
static |
Callback called when a client connects to the service.
cls | closure for the service |
c | the new client that connected to the service |
mq | the message queue used to send messages to the client |
Definition at line 4350 of file gnunet-service-setu.c.
References ClientState::client, GNUNET_new, mq, ClientState::mq, and num_clients.
|
static |
Iterator over hash map entries to free element entries.
cls | closure |
key | current key code |
value | a struct ElementEntry * to be free'd |
Definition at line 4373 of file gnunet-service-setu.c.
References GNUNET_free, GNUNET_YES, and value.
Referenced by client_disconnect_cb().
|
static |
Clean up after a client has disconnected.
cls | closure, unused |
client | the client to clean up after |
internal_cls | the struct ClientState |
Definition at line 4392 of file gnunet-service-setu.c.
References _GSS_operation_destroy(), cadet, Set::content, Set::cs, destroy_elements_iterator(), SetContent::elements, GNUNET_assert, GNUNET_CADET_close_port(), GNUNET_CADET_disconnect(), GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_i2s(), GNUNET_log, GNUNET_YES, in_shutdown, incoming_destroy(), ClientState::listener, listener_head, listener_tail, num_clients, op, Listener::op_head, Listener::open_port, Set::ops_head, SetContent::refcount, Set::se, ClientState::set, and strata_estimator_destroy().
|
static |
Check a request for a set operation from another peer.
cls | the operation state |
msg | the received message |
Definition at line 4478 of file gnunet-service-setu.c.
References GNUNET_break, GNUNET_break_op, GNUNET_MQ_extract_nested_mh, GNUNET_OK, GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE, GNUNET_SYSERR, msg, op, and GNUNET_MessageHeader::size.
|
static |
Handle a request for a set operation from another peer.
Checks if we have a listener waiting for such a request (and in that case initiates asking the listener about accepting the connection). If no listener is waiting, we queue the operation request in hope that a listener shows up soon (before timeout).
This msg is expected as the first and only msg handled through the non-operation bound virtual table, acceptance of this operation replaces our virtual table and subsequent msgs would be routed differently (as we then know what type of operation this is).
cls | the operation state |
msg | the received message |
Definition at line 4524 of file gnunet-service-setu.c.
References GNUNET_SETU_RequestMessage::accept_id, Listener::cs, env, GNUNET_assert, GNUNET_copy_message(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_SETU_REQUEST, GNUNET_MQ_extract_nested_mh, GNUNET_MQ_msg_nested_mh, GNUNET_MQ_send(), GNUNET_SCHEDULER_cancel(), ClientState::mq, msg, op, GNUNET_SETU_RequestMessage::peer_id, and suggest_id.
|
static |
Called when a client wants to create a new set.
This is typically the first request from a client, and includes the type of set operation to be performed.
cls | client that sent the message |
m | message sent by the client |
Definition at line 4578 of file gnunet-service-setu.c.
References ClientState::client, Set::content, Set::cs, SetContent::elements, GNUNET_break, GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_free, GNUNET_log, GNUNET_new, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_YES, SetContent::refcount, Set::se, SE_IBF_HASH_NUM, SE_IBFS_TOTAL_SIZE, SE_STRATA_COUNT, ClientState::set, and strata_estimator_create().
|
static |
Timeout happens iff:
cls | channel context |
tc | context information (why was this task triggered now) |
Definition at line 4630 of file gnunet-service-setu.c.
References GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, incoming_destroy(), and op.
Referenced by channel_new_cb().
|
static |
Method called whenever another peer has added us to a channel the other peer initiated.
Only called (once) upon reception of data from a channel we listen on.
The channel context represents the operation itself and gets added to a DLL, from where it gets looked up when our local listener client responds to a proposed/suggested operation or connects and associates with this operation.
cls | closure |
channel | new handle to the channel |
source | peer that started the channel |
Definition at line 4658 of file gnunet-service-setu.c.
References Operation::channel, GNUNET_CADET_get_mq(), GNUNET_CONTAINER_DLL_insert, GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_new, GNUNET_SCHEDULER_add_delayed(), INCOMING_CHANNEL_TIMEOUT, incoming_timeout_cb(), Operation::listener, op, Listener::op_head, Listener::op_tail, and source.
Referenced by handle_client_listen().
|
static |
Function called whenever a channel is destroyed.
Should clean up any associated state. It must NOT call GNUNET_CADET_channel_destroy() on the channel.
The peer_disconnect function is part of a a virtual table set initially either when a peer creates a new channel with us, or once we create a new channel ourselves (evaluate).
Once we know the exact type of operation (union/intersection), the vt is replaced with an operation specific instance (GSS[op]_vt).
channel_ctx | place where local state associated with the channel is stored |
channel | connection to the other end (henceforth invalid) |
Definition at line 4701 of file gnunet-service-setu.c.
References _GSS_operation_destroy2(), and op.
Referenced by handle_client_evaluate(), and handle_client_listen().
|
static |
Function called whenever an MQ-channel's transmission window size changes.
The first callback in an outgoing channel will be with a non-zero value and will mean the channel is connected to the destination.
For an incoming channel it will be called immediately after the GNUNET_CADET_ConnectEventHandler, also with a non-zero value.
cls | Channel closure. |
channel | Connection to the other end (henceforth invalid). |
window_size | New window size. If the is more messages than buffer size this value will be negative.. |
Definition at line 4726 of file gnunet-service-setu.c.
Referenced by handle_client_evaluate(), and handle_client_listen().
|
static |
Called when a client wants to create a new listener.
cls | client that sent the message |
msg | message sent by the client |
Definition at line 4742 of file gnunet-service-setu.c.
References Listener::app_id, cadet, channel_end_cb(), channel_new_cb(), channel_window_cb(), ClientState::client, Listener::cs, GNUNET_break, GNUNET_CADET_open_port(), GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND, GNUNET_MESSAGE_TYPE_SETU_P2P_DONE, GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT, GNUNET_MESSAGE_TYPE_SETU_P2P_IBF, GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY, GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER, GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, GNUNET_MESSAGE_TYPE_SETU_P2P_OVER, GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, GNUNET_MESSAGE_TYPE_SETU_P2P_SE, GNUNET_MESSAGE_TYPE_SETU_P2P_SEC, GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_new, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), ClientState::listener, listener_head, listener_tail, msg, and Listener::open_port.
|
static |
Called when the listening client rejects an operation request by another peer.
cls | client that sent the message |
msg | message sent by the client |
Definition at line 4843 of file gnunet-service-setu.c.
References _GSS_operation_destroy2(), Listener::app_id, ClientState::client, get_incoming(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_h2s(), GNUNET_log, GNUNET_SERVICE_client_continue(), ClientState::listener, msg, and op.
|
static |
Called when a client wants to add or remove an element to a set it inhabits.
cls | client that sent the message |
msg | message sent by the client |
Definition at line 4875 of file gnunet-service-setu.c.
References GNUNET_OK.
|
static |
Called when a client wants to add or remove an element to a set it inhabits.
cls | client that sent the message |
msg | message sent by the client |
Definition at line 4891 of file gnunet-service-setu.c.
References ClientState::client, Set::content, Set::current_generation, GNUNET_SET_Element::data, el, ElementEntry::element, ElementEntry::element_hash, GNUNET_SET_Element::element_type, SetContent::elements, ElementEntry::generation, get_ibf_key(), GNUNET_break, GNUNET_CONTAINER_multihashmap_get(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_SETU_element_hash(), GNUNET_YES, msg, ElementEntry::remote, Set::se, ClientState::set, GNUNET_MessageHeader::size, GNUNET_SET_Element::size, and strata_estimator_insert().
|
static |
Advance the current generation of a set, adding exclusion ranges if necessary.
set | the set where we want to advance the generation |
Definition at line 4958 of file gnunet-service-setu.c.
References Set::content, Set::current_generation, and SetContent::latest_generation.
Referenced by handle_client_accept(), and handle_client_evaluate().
|
static |
Called when a client wants to initiate a set operation with another peer.
Initiates the CADET connection to the listener and sends the request.
cls | client that sent the message |
msg | message sent by the client |
Definition at line 4975 of file gnunet-service-setu.c.
References GNUNET_OK.
|
static |
Called when a client wants to initiate a set operation with another peer.
Initiates the CADET connection to the listener and sends the request.
cls | client that sent the message |
msg | message sent by the client |
Definition at line 4993 of file gnunet-service-setu.c.
References _GSS_statistics, advance_generation(), cadet, channel_end_cb(), channel_window_cb(), ClientState::client, context, Set::current_generation, GNUNET_break, GNUNET_CADET_channel_create(), GNUNET_CADET_get_mq(), GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_log, GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND, GNUNET_MESSAGE_TYPE_SETU_P2P_DONE, GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE, GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT, GNUNET_MESSAGE_TYPE_SETU_P2P_IBF, GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY, GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER, GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, GNUNET_MESSAGE_TYPE_SETU_P2P_OVER, GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL, GNUNET_MESSAGE_TYPE_SETU_P2P_SE, GNUNET_MESSAGE_TYPE_SETU_P2P_SEC, GNUNET_MESSAGE_TYPE_SETU_P2P_SEND_FULL, GNUNET_MQ_extract_nested_mh, GNUNET_MQ_handler_end, GNUNET_MQ_hd_fixed_size, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg_nested_mh, GNUNET_MQ_send(), GNUNET_new, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_STATISTICS_update(), initialize_key_to_element(), LOG, msg, op, Set::ops_head, Set::ops_tail, PHASE_EXPECT_SE, ClientState::set, and strata_estimator_dup().
|
static |
Handle a request from the client to cancel a running set operation.
cls | the client |
msg | the message |
Definition at line 5175 of file gnunet-service-setu.c.
References _GSS_operation_destroy(), ClientState::client, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_log, GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_YES, msg, GNUNET_ARM_Operation::next, op, Set::ops_head, ClientState::set, and Operation::set.
|
static |
Handle a request from the client to accept a set operation that came from a remote peer.
We forward the accept to the associated operation for handling
cls | the client |
msg | the message |
Definition at line 5230 of file gnunet-service-setu.c.
References _GSS_statistics, advance_generation(), ClientState::client, Listener::cs, Set::cs, Set::current_generation, determinate_avg_element_size_iterator(), determine_strata_count(), get_incoming(), GNUNET_assert, GNUNET_break, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_DLL_insert, GNUNET_CONTAINER_DLL_remove, GNUNET_CONTAINER_multihashmap32_size(), GNUNET_CONTAINER_multihashmap_create(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_INFO, GNUNET_free, GNUNET_htonll(), GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_P2P_SE, GNUNET_MESSAGE_TYPE_SETU_P2P_SEC, GNUNET_MESSAGE_TYPE_SETU_RESULT, GNUNET_MQ_msg, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SERVICE_client_continue(), GNUNET_SERVICE_client_drop(), GNUNET_SETU_STATUS_FAILURE, GNUNET_STATISTICS_update(), IBF_BUCKET_SIZE, initialize_key_to_element(), ClientState::listener, LOG, ClientState::mq, msg, op, Listener::op_head, Listener::op_tail, Set::ops_head, Set::ops_tail, PHASE_EXPECT_IBF, GNUNET_SETU_ResultMessage::request_id, GNUNET_SETU_ResultMessage::result_status, StrataEstimatorMessage::se_count, SE_IBFS_TOTAL_SIZE, ClientState::set, StrataEstimatorMessage::set_size, StrataEstimator::strata_count, strata_estimator_dup(), strata_estimator_write(), MultiStrataEstimator::stratas, and type.
|
static |
Called to clean up, after a shutdown has been requested.
cls | closure, NULL |
Definition at line 5394 of file gnunet-service-setu.c.
References _GSS_statistics, cadet, GNUNET_CADET_disconnect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_STATISTICS_destroy(), GNUNET_YES, in_shutdown, and num_clients.
Referenced by run().
|
static |
Function called by the service's run method to run service-specific setup code.
cls | closure |
cfg | configuration to use |
service | the initialized service |
Definition at line 5425 of file gnunet-service-setu.c.
References _, _GSS_statistics, cadet, cfg, GNUNET_CADET_connect(), GNUNET_ERROR_TYPE_ERROR, GNUNET_log, GNUNET_SCHEDULER_add_shutdown(), GNUNET_SCHEDULER_shutdown(), GNUNET_STATISTICS_create(), and shutdown_task().
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 |
Handle to the cadet service, used to listen for and connect to remote peers.
Definition at line 725 of file gnunet-service-setu.c.
Referenced by client_disconnect_cb(), handle_client_evaluate(), handle_client_listen(), run(), and shutdown_task().
|
static |
Statistics handle.
Definition at line 730 of file gnunet-service-setu.c.
Referenced by decode_and_send(), handle_client_accept(), handle_client_evaluate(), handle_union_p2p_demand(), handle_union_p2p_elements(), handle_union_p2p_full_element(), handle_union_p2p_strata_estimator(), run(), send_client_done(), send_ibf(), and shutdown_task().
|
static |
Listeners are held in a doubly linked list.
Definition at line 735 of file gnunet-service-setu.c.
Referenced by client_disconnect_cb(), get_incoming(), and handle_client_listen().
|
static |
Listeners are held in a doubly linked list.
Definition at line 740 of file gnunet-service-setu.c.
Referenced by client_disconnect_cb(), and handle_client_listen().
|
static |
Number of active clients.
Definition at line 745 of file gnunet-service-setu.c.
Referenced by client_connect_cb(), client_disconnect_cb(), and shutdown_task().
|
static |
Are we in shutdown? if GNUNET_YES and the number of clients drops to zero, disconnect from CADET.
Definition at line 751 of file gnunet-service-setu.c.
Referenced by client_disconnect_cb(), and shutdown_task().
|
static |
Counter for allocating unique IDs for clients, used to identify incoming operation requests from remote peers, that the client can choose to accept or refuse.
0 must not be used (reserved for uninitialized).
Definition at line 758 of file gnunet-service-setu.c.
Referenced by handle_incoming_msg().