37 #define INCOMING_CHANNEL_TIMEOUT GNUNET_TIME_UNIT_MINUTES 298 unsigned int generation_created;
315 uint32_t remote_element_count;
320 uint32_t client_request_id;
351 unsigned int refcount;
356 unsigned int latest_generation;
412 unsigned int current_generation;
528 "Sending removed element (size %u) to client\n",
531 "# Element removed messages sent",
587 "FIMA called for %s:%u\n",
594 "Reduced initialization, not starting with %s:%u (wrong generation)\n",
605 "Testing mingled hash %s with salt %u\n",
616 "Reduced initialization, not starting with %s:%u\n",
626 "Filtered initialization of my_elements, adding %s:%u\n",
661 "Testing mingled hash %s with salt %u\n",
674 "Bloom filter reduction of my_elements, removing %s:%u\n",
687 "Bloom filter reduction of my_elements, keeping %s:%u\n",
716 "Initializing BF with hash %s with salt %u\n",
740 struct Set *
set = op->
set;
767 "Destroying intersection op state done\n");
780 if (NULL != (channel = op->
channel))
812 "Destroying incoming operation %p\n",
814 if (NULL != (listener = op->
listener))
844 "Intersection succeeded, sending DONE to local client\n");
846 "# Intersection operations succeeded",
871 "channel_end_cb called\n");
872 if (NULL != (channel = op->
channel))
916 "Intersection operation failed\n");
918 "# Intersection operations failed",
949 uint32_t bf_elementbits;
958 bf_elementbits = 2 + ceil (log2 ((
double)
961 if (bf_elementbits < 1)
965 * bf_elementbits / log (2)));
967 "Sending Bloom filter (%u) of size %u bytes\n",
968 (
unsigned int) bf_elementbits,
969 (
unsigned int) bf_size);
981 "# Intersection Bloom filters sent",
984 chunk_size = 60 * 1024 -
sizeof(
struct BFMessage);
985 if (bf_size <= chunk_size)
988 chunk_size = bf_size;
998 msg->bloomfilter_total_length = htonl (bf_size);
999 msg->bits_per_element = htonl (bf_elementbits);
1000 msg->sender_mutator = htonl (op->
salt);
1001 msg->element_xor_hash = op->
my_xor;
1014 while (offset < bf_size)
1016 if (bf_size - chunk_size < offset)
1017 chunk_size = bf_size - offset;
1024 offset += chunk_size;
1053 "DONE sent to other peer, now waiting for other end to close the channel\n");
1114 "Sending done and destroy because iterator ran out\n");
1136 "Sending element %s:%u to client (full set)\n",
1181 "Initial full initialization of my_elements, adding %s:%u\n",
1206 "Sending our element count (%u)\n",
1248 "Received remote element count (%u), I have %u\n",
1276 "Received BF in phase %u, foreign count is %u, my element count is %u/%u\n",
1325 "Intersection succeeded, sending DONE to other peer\n");
1331 "Sending full result set (%u elements)\n",
1377 uint32_t chunk_size;
1393 if (bf_size == chunk_size)
1405 bf_bits_per_element);
1406 op->
salt = ntohl (msg->sender_mutator);
1437 (
const char *) &msg[1],
1446 bf_bits_per_element);
1485 "Final reduction of my_elements, removing %s:%u\n",
1536 "Got IntersectionDoneMessage, have %u elements in intersection\n",
1545 "Sending full result set to client (%u elements)\n",
1640 if (NULL != (
set = cs->
set))
1646 while (NULL != set->ops_head)
1650 set->content = NULL;
1666 if (NULL != (listener = cs->
listener))
1671 while (NULL != (op = listener->
op_head))
1674 "Destroying incoming operation `%u' from peer `%s'\n",
1718 if (NULL == listener)
1724 if ((NULL != nested_context) &&
1765 if (NULL != nested_context)
1770 "Received P2P operation request (port %s) for active listener\n",
1784 "Suggesting incoming request with accept id %u to listener %p of client %p\n",
1812 "Client created new intersection set\n");
1813 if (NULL != cs->
set)
1822 set->content->refcount = 1;
1847 "Remote peer's incoming request timed out\n");
1877 "New incoming channel\n");
1992 "New listener for set intersection created (port %s)\n",
2025 "Client rejected unknown operation %u\n",
2031 "Peer request (app %s) rejected by client\n",
2070 if (NULL == (
set = cs->
set))
2088 "Client inserts element %s of size %u\n",
2100 set->content->elements,
2108 "Client inserted element %s of size %u twice (ignored)\n",
2114 set->current_set_element_count++;
2127 if (set->current_generation == set->content->latest_generation)
2129 set->content->latest_generation++;
2130 set->current_generation++;
2133 GNUNET_assert (set->current_generation < set->content->latest_generation);
2192 if (NULL == (
set = cs->
set))
2204 "Return intersection for evaluate is %d\n",
2218 "Creating new CADET channel to port %s for set intersection\n",
2243 "Initiating intersection operation evaluation\n");
2255 if (NULL != context)
2257 "Sent op request with context message\n");
2260 "Sent op request without context message\n");
2281 if (NULL == (
set = cs->
set))
2305 "Client canceled non-existent op %u\n",
2311 "Client requested cancel for op %u\n",
2338 if (NULL == (
set = cs->
set))
2352 "Client %p accepted request %u of listener %p that is no longer active\n",
2365 "Client accepting request %u\n",
2371 "Return intersection for accept is %d\n",
2388 "Accepting set intersection operation\n");
2439 "handled shutdown request\n");
2467 _ (
"Could not connect to CADET service\n"));
struct Operation * prev
Kept in a DLL of the listener, if listener is non-NULL.
#define GNUNET_CONTAINER_DLL_remove(head, tail, element)
Remove an element from a DLL.
void GNUNET_CONTAINER_multihashmap_iterator_destroy(struct GNUNET_CONTAINER_MultiHashMapIterator *iter)
Destroy a multihashmap iterator.
struct GNUNET_CONTAINER_BloomFilter * GNUNET_CONTAINER_bloomfilter_init(const char *data, size_t size, unsigned int k)
Create a Bloom filter from raw bits.
struct Set * prev
Sets are held in a doubly linked list.
uint32_t accept_id
ID of the to identify the request when accepting or rejecting it.
static int check_client_evaluate(void *cls, const struct GNUNET_SETI_EvaluateMessage *msg)
Called when a client wants to initiate a set operation with another peer.
static void handle_client_cancel(void *cls, const struct GNUNET_SETI_CancelMessage *msg)
Handle a request from the client to cancel a running set operation.
static int check_incoming_msg(void *cls, const struct OperationRequestMessage *msg)
Check a request for a set operation from another peer.
uint32_t request_id
Id of our set to evaluate, chosen implicitly by the client when it calls GNUNET_SETI_commit().
void GNUNET_CADET_disconnect(struct GNUNET_CADET_Handle *handle)
Disconnect from the cadet service.
struct Set * set
Set, if associated with the client, otherwise NULL.
static struct GNUNET_SERVICE_Handle * service
Handle to our service instance.
int GNUNET_CONTAINER_multihashmap_iterator_next(struct GNUNET_CONTAINER_MultiHashMapIterator *iter, struct GNUNET_HashCode *key, const void **value)
Retrieve the next element from the hash map at the iterator's position.
Success, all elements have been sent (and received).
struct GNUNET_CONTAINER_BloomFilter * local_bf
BF of the set's element.
struct GNUNET_MessageHeader * msg
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
State we keep per client.
static unsigned int phase
Processing stage that we are in.
static struct GNUNET_CADET_Handle * cadet
Handle to the cadet service, used to listen for and connect to remote peers.
void GNUNET_CONTAINER_bloomfilter_add(struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Add an element to the filter.
struct GNUNET_MessageHeader * context_msg
Context message, may be NULL.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
uint32_t final_element_count
Final number of elements in intersection.
The other peer refused to do the operation with us, or something went wrong.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
enum IntersectionOperationPhase phase
Current state of the operation.
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
uint32_t suggest_id
Unique request id for the request from a remote peer, sent to the client, which will accept or reject...
Sent to the service by the client in order to cancel a set operation.
uint32_t bf_bits_per_element
size of the bloomfilter
uint32_t element_count
For Intersection: my element count.
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...
Opaque handle to the service.
#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_MESSAGE_TYPE_SETI_REQUEST
Notify the client of an incoming request from a remote peer.
#define GNUNET_MESSAGE_TYPE_SETI_EVALUATE
Evaluate a set operation.
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.
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
struct GNUNET_CONTAINER_MultiHashMapIterator * GNUNET_CONTAINER_multihashmap_iterator_create(const struct GNUNET_CONTAINER_MultiHashMap *map)
Create an iterator for a multihashmap.
uint32_t bf_data_size
size of the bloomfilter in bf_data.
#define INCOMING_CHANNEL_TIMEOUT
How long do we hold on to an incoming channel if there is no local listener before giving up...
uint16_t size
Number of bytes in the buffer pointed to by data.
static unsigned int num_clients
Number of active clients.
int return_intersection
When are elements sent to the client, and which elements are sent?
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, or when GNUNET_SCHEDULER_shutdown() is being invoked.
GNUNET_SERVICE_MAIN("seti", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(client_accept, GNUNET_MESSAGE_TYPE_SETI_ACCEPT, struct GNUNET_SETI_AcceptMessage, NULL), GNUNET_MQ_hd_var_size(client_set_add, GNUNET_MESSAGE_TYPE_SETI_ADD, struct GNUNET_SETI_ElementMessage, NULL), GNUNET_MQ_hd_fixed_size(client_create_set, GNUNET_MESSAGE_TYPE_SETI_CREATE, struct GNUNET_SETI_CreateMessage, NULL), GNUNET_MQ_hd_var_size(client_evaluate, GNUNET_MESSAGE_TYPE_SETI_EVALUATE, struct GNUNET_SETI_EvaluateMessage, NULL), GNUNET_MQ_hd_fixed_size(client_listen, GNUNET_MESSAGE_TYPE_SETI_LISTEN, struct GNUNET_SETI_ListenMessage, NULL), GNUNET_MQ_hd_fixed_size(client_reject, GNUNET_MESSAGE_TYPE_SETI_REJECT, struct GNUNET_SETI_RejectMessage, NULL), GNUNET_MQ_hd_fixed_size(client_cancel, GNUNET_MESSAGE_TYPE_SETI_CANCEL, struct GNUNET_SETI_CancelMessage, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
static void _GSS_operation_destroy(struct Operation *op)
Destroy the given operation.
struct GNUNET_HashCode element_hash
Hash of the element.
#define GNUNET_MESSAGE_TYPE_SETI_ACCEPT
Accept an incoming set request.
unsigned int refcount
Number of references to the content.
uint32_t sender_element_count
Number of elements the sender still has in the set.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
static int iterator_bf_reduce(void *cls, const struct GNUNET_HashCode *key, void *value)
Removes elements from our hashmap if they are not contained within the provided remote bloomfilter...
struct Listener * next
Listeners are held in a doubly linked list.
static void handle_incoming_msg(void *cls, const struct OperationRequestMessage *msg)
Handle a request for a set operation from another peer.
#define GNUNET_MQ_extract_nested_mh(var)
Return a pointer to the message at the end of the given message.
uint32_t GNUNET_CRYPTO_random_u32(enum GNUNET_CRYPTO_Quality mode, uint32_t i)
Produce a random value.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MESSAGE_TYPE_SETI_CANCEL
Cancel a set operation.
static void handle_client_reject(void *cls, const struct GNUNET_SETI_RejectMessage *msg)
Called when the listening client rejects an operation request by another peer.
struct Operation * op_head
Head of DLL of operations this listener is responsible for.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF.
static void client_disconnect_cb(void *cls, struct GNUNET_SERVICE_Client *client, void *internal_cls)
Clean up after a client has disconnected.
static int check_client_set_add(void *cls, const struct GNUNET_SETI_ElementMessage *msg)
Called when a client wants to add or remove an element to a set it inhabits.
Peer-to-Peer messages for gnunet set.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
struct GNUNET_CONTAINER_MultiHashMap * elements
Maps struct GNUNET_HashCode * to struct ElementEntry *.
Message sent by a listening client to the service to accept performing the operation with the other p...
uint32_t current_set_element_count
Number of currently valid elements in the set which have not been removed.
static void begin_bf_exchange(struct Operation *op)
We go first, initialize our map with all elements and send the first Bloom filter.
static void advance_generation(struct Set *set)
Advance the current generation of a set, adding exclusion ranges if necessary.
Opaque handle to a channel.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
uint32_t accept_reject_id
ID of the incoming request we want to accept.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SETI_ADD.
Message sent by a listening client to the service to reject performing the operation with the other p...
#define GNUNET_new(type)
Allocate a struct or union of the given type.
A listener is inhabited by a client, and waits for evaluation requests from remote peers...
uint32_t bf_data_offset
How many bytes of bf_data are valid?
We have send the number of our elements to the other peer, but did not setup our element set yet...
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
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_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
uint32_t return_intersection
Return the intersection (1), instead of the elements to remove / the delta (0), in NBO...
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.
uint32_t bloomfilter_total_length
Total length of the bloomfilter data.
Internal representation of the hash map.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static int filtered_map_initialization(void *cls, const struct GNUNET_HashCode *key, void *value)
Fills the "my_elements" hashmap with all relevant elements.
unsigned int generation_created
Generation in which the operation handle was created.
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task, if the incoming peer has not been accepted after the timeout, it will be disconnected...
#define GNUNET_MESSAGE_TYPE_SETI_REJECT
Reject a set request.
static pa_context * context
Pulseaudio context.
const void * data
Actual data of the element.
struct GNUNET_CADET_Handle * GNUNET_CADET_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the MQ-based cadet service.
struct Operation * next
Kept in a DLL of the listener, if listener is non-NULL.
Message sent by the client to the service to start listening for incoming requests to perform a certa...
static struct Operation * get_incoming(uint32_t id)
Get the incoming socket associated with the given id.
uint16_t element_type
Type of the element to add or remove.
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.
static void handle_intersection_p2p_element_info(void *cls, const struct IntersectionElementInfoMessage *msg)
Handle the initial struct IntersectionElementInfoMessage from a remote peer.
static void handle_client_accept(void *cls, const struct GNUNET_SETI_AcceptMessage *msg)
Handle a request from the client to accept a set operation that came from a remote peer...
Handle to a client that is connected to a service.
struct GNUNET_PeerIdentity peer
The identity of the requesting peer.
struct GNUNET_HashCode app_id
application id
static void handle_intersection_p2p_done(void *cls, const struct IntersectionDoneMessage *idm)
Handle a done message from a remote peer.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Element should be added to the result set of the local peer, i.e.
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.
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 incomming MQ-based channels.
uint32_t request_id
ID of the request we want to cancel.
void GNUNET_MQ_notify_sent(struct GNUNET_MQ_Envelope *ev, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls)
Call a callback once the envelope has been sent, that is, sending it can not be canceled anymore...
static char * value
Value of the record to add/remove.
Information about an element element in the set.
uint32_t request_id
id the result belongs to
int GNUNET_CONTAINER_bloomfilter_test(const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Test if an element is in the filter.
#define GNUNET_MQ_hd_var_size(name, code, str, ctx)
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
int remote
GNUNET_YES if the element is a remote element, and does not belong to the operation's set...
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
struct GNUNET_HashCode app_id
Application id.
A set that supports a specific operation with other peers.
uint32_t sender_element_count
mutator used with this bloomfilter.
uint32_t accept_reject_id
ID of the incoming request we want to reject.
static int iterator_bf_create(void *cls, const struct GNUNET_HashCode *key, void *value)
Create initial bloomfilter based on all the elements given.
static void handle_intersection_p2p_bf(void *cls, const struct BFMessage *msg)
Handle an BF message from a remote peer.
static void incoming_timeout_cb(void *cls)
Timeout happens iff:
int 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.
static uint32_t suggest_id
Counter for allocating unique IDs for clients, used to identify incoming operation requests from remo...
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
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.
IntersectionOperationPhase
Current phase we are in for a intersection operation.
const void * data
Actual data of the element.
#define GNUNET_MESSAGE_TYPE_SETI_P2P_ELEMENT_INFO
Information about the element count for intersection.
#define GNUNET_MESSAGE_TYPE_SETI_P2P_OPERATION_REQUEST
Request to begin set intersection operation.
static void send_bloomfilter(struct Operation *op)
Send a bloomfilter to our peer.
#define GNUNET_MESSAGE_TYPE_SETI_RESULT
Handle result message from operation.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
struct GNUNET_HashCode element_xor_hash
XOR of all hashes over all elements remaining in the set.
Message handler for a specific message type.
static void send_remaining_elements(void *cls)
Send all elements in the full result iterator.
static void send_client_removed_element(struct Operation *op, struct GNUNET_SETI_Element *element)
If applicable in the current operation mode, send a result message to the client indicating we remove...
uint32_t request_id
Request ID to identify responses.
We must next send the P2P DONE message (after finishing mostly with the local client).
Bloom filter messages exchanged for set intersection calculation.
static GstElement * source
Appsrc instance into which we write data for the pipeline.
struct GNUNET_HashCode element_xor_hash
XOR of all hashes over all elements remaining in the set.
static int in_shutdown
Are we in shutdown? if GNUNET_YES and the number of clients drops to zero, disconnect from CADET...
unsigned int generation_added
Generation in which the element was added.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
struct GNUNET_TESTBED_Peer * peer
The peer associated with this model.
struct GNUNET_HashCode key
The key used in the DHT.
#define GNUNET_MESSAGE_TYPE_SETI_ADD
Add element to set.
static struct Listener * listener_head
Listeners are held in a doubly linked list.
static int destroy_elements_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator over hash map entries to free element entries.
struct GNUNET_CADET_Port * open_port
The port we are listening on with CADET.
static void handle_client_create_set(void *cls, const struct GNUNET_SETI_CreateMessage *msg)
Called when a client wants to create a new set.
struct ClientState * cs
Client that owns the set.
struct GNUNET_PeerIdentity peer_id
Identity of the requesting peer.
struct GNUNET_MQ_Envelope * env
Cursor into a multihashmap.
static void finished_local_operations(void *cls)
Remember that we are done dealing with the local client AND have sent the other peer our message that...
static struct GNUNET_SCHEDULER_Task * timeout_task
Task to be run on timeout.
#define GNUNET_MESSAGE_TYPE_SETI_LISTEN
Listen for operation requests.
int GNUNET_CONTAINER_bloomfilter_get_raw_data(const struct GNUNET_CONTAINER_BloomFilter *bf, char *data, size_t size)
Copy the raw data of this Bloom filter into the given data array.
int client_done_sent
Did we send the client that we are done?
static void shutdown_task(void *cls)
Called to clean up, after a shutdown has been requested.
Operation context used to execute a set operation.
void GNUNET_SETI_element_hash(const struct GNUNET_SETI_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
int 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.
Element should be delete from the result set of the local peer, i.e.
SetContent stores the actual set elements, which may be shared by multiple generations derived from o...
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
struct GNUNET_PeerIdentity target_peer
Peer to evaluate the operation with.
static void handle_client_set_add(void *cls, const struct GNUNET_SETI_ElementMessage *msg)
Called when a client wants to add an element to a set it inhabits.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
static int filter_all(void *cls, const struct GNUNET_HashCode *key, void *value)
Remove all elements from our hashmap.
uint32_t my_element_count
Current element count contained within my_elements.
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.
static void channel_end_cb(void *channel_ctx, const struct GNUNET_CADET_Channel *channel)
Function called whenever a channel is destroyed.
uint32_t bits_per_element
Number of bits (k-value) used in encoding the bloomfilter.
Handle to a message queue.
static struct GNUNET_CRYPTO_PowSalt salt
Salt for PoW calcualations.
struct GNUNET_CONTAINER_BloomFilter * remote_bf
The bf we currently receive.
static int initialize_map_unfiltered(void *cls, const struct GNUNET_HashCode *key, void *value)
Fills the "my_elements" hashmap with the initial set of (non-deleted) elements from the set of the sp...
During intersection, the first (and possibly second) message send it the number of elements in the se...
static void send_p2p_done(struct Operation *op)
Notify the other peer that we are done.
The identity of the host (wraps the signing key of the peer).
void GNUNET_CADET_receive_done(struct GNUNET_CADET_Channel *channel)
Send an ack on the channel to confirm the processing of a message.
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_CADET_Channel * channel
Channel to the peer.
struct Operation * ops_head
Evaluate operations are held in a linked list.
uint32_t salt
Salt to use for the operation.
struct GNUNET_SERVICE_Client * client
Client this is about.
uint32_t client_request_id
ID used to identify an operation between service and client.
#define GNUNET_MESSAGE_TYPE_SETI_P2P_DONE
Intersection operation is done.
static int _GSS_is_element_of_operation(struct ElementEntry *ee, struct Operation *op)
Is element ee part of the set used by op?
static void handle_client_listen(void *cls, const struct GNUNET_SETI_ListenMessage *msg)
Called when a client wants to create a new listener.
struct SetContent * content
Content, possibly shared by multiple sets, and thus reference counted.
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SETI_Status in NBO.
static void process_bf(struct Operation *op)
Process a Bloomfilter once we got all the chunks.
static void send_client_done_and_destroy(void *cls)
Signal to the client that the operation has finished and destroy the operation.
uint16_t size
Number of bytes in the buffer pointed to by data.
struct GNUNET_MQ_Handle * mq
#define GNUNET_log(kind,...)
Entry in list of pending tasks.
Message sent by the client to the service to ask starting a new set to perform operations with...
static void fail_intersection_operation(struct Operation *op)
Inform the client that the intersection operation has failed, and proceed to destroy the evaluate ope...
static int check_intersection_p2p_bf(void *cls, const struct BFMessage *msg)
Check an BF message from a remote peer.
struct GNUNET_SET_Element element
The actual element.
struct Listener * prev
Listeners are held in a doubly linked list.
#define GNUNET_SETI_CONTEXT_MESSAGE_MAX_SIZE
Maximum size of a context message for set operation requests.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
uint32_t return_intersection
Return the intersection (1), instead of the elements to remove / the delta (0), in NBO...
struct GNUNET_HashCode app_id
Application ID for the operation, used to distinguish multiple operations of the same type with the s...
void GNUNET_CADET_close_port(struct GNUNET_CADET_Port *p)
Close a port opened with GNUNET_CADET_open_port().
void GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = a ^ b
Last message, send to confirm the final set.
A request for an operation with another client.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
static void handle_client_evaluate(void *cls, const struct GNUNET_SETI_EvaluateMessage *msg)
Called when a client wants to initiate a set operation with another peer.
struct ClientState * cs
Client that owns the listener.
struct Listener * listener
Listener, if associated with the client, otherwise NULL.
static void incoming_destroy(struct Operation *op)
Destroy an incoming request from a remote peer.
uint32_t remote_element_count
Remote peers element count.
struct GNUNET_CONTAINER_MultiHashMapIterator * full_result_iter
Iterator for sending the final set of my_elements to the client.
struct Operation * op_tail
Tail of DLL of operations this listener is responsible for.
#define GNUNET_MESSAGE_TYPE_SETI_P2P_BF
Bloom filter message for intersection exchange started by Bob.
static struct GNUNET_ARM_Operation * op
Current operation.
Message sent by client to service to initiate a set operation as a client (not as listener)...
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
We have initialized our set and are now reducing it by exchanging Bloom filters until one party notic...
struct Set * next
Sets are held in a doubly linked list (in sets_head and sets_tail).
We have received the P2P DONE message, and must finish with the local client before terminating the c...
static struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
struct Listener * listener
Port this operation runs on.
Message sent by client to the service to add an element to the set.
const char * GNUNET_i2s(const struct GNUNET_PeerIdentity *pid)
Convert a peer identity to a string (for printing debug messages).
void GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c)
Continue receiving further messages from the given client.
struct GNUNET_MQ_Handle * mq
Message queue for the channel.
void GNUNET_CONTAINER_bloomfilter_free(struct GNUNET_CONTAINER_BloomFilter *bf)
Free the space associated with a filter in memory, flush to drive if needed (do not free the space on...
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
uint16_t element_type
Application-specific element type.
void GNUNET_BLOCK_mingle_hash(const struct GNUNET_HashCode *in, uint32_t mingle_number, struct GNUNET_HashCode *hc)
Mingle hash with the mingle_number to produce different bits.
uint32_t sender_mutator
Mutator used with this bloomfilter.
#define GNUNET_malloc(size)
Wrapper around malloc.
struct GNUNET_HashCode other_xor
XOR of the keys of all of the elements (remaining) in the other peer's set.
char * bf_data
For multipart BF transmissions, we have to store the bloomfilter-data until we fully received it...
int channel_death_expected
Set whenever we reach the state where the death of the channel is perfectly find and should NOT resul...
uint16_t element_type
Type of the element attachted to the message, if any.
#define GNUNET_free(ptr)
Wrapper around free.
uint16_t element_type
Application-specific element type.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
#define GNUNET_MESSAGE_TYPE_SETI_CREATE
Create a new local set.
struct GNUNET_MQ_Handle * GNUNET_CADET_get_mq(const struct GNUNET_CADET_Channel *channel)
Obtain the message queue for a connected peer.
static struct Listener * listener_tail
Listeners are held in a doubly linked list.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
static void send_element_count(struct Operation *op)
Send our element count to the peer, in case our element count is lower than theirs.