|
static void | send_client_removed_element (struct Operation *op, struct GNUNET_SET_Element *element) |
| If applicable in the current operation mode, send a result message to the client indicating we removed an element. More...
|
|
static int | filtered_map_initialization (void *cls, const struct GNUNET_HashCode *key, void *value) |
| Fills the "my_elements" hashmap with all relevant elements. More...
|
|
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. More...
|
|
static int | iterator_bf_create (void *cls, const struct GNUNET_HashCode *key, void *value) |
| Create initial bloomfilter based on all the elements given. More...
|
|
static void | fail_intersection_operation (struct Operation *op) |
| Inform the client that the intersection operation has failed, and proceed to destroy the evaluate operation. More...
|
|
static void | send_bloomfilter (struct Operation *op) |
| Send a bloomfilter to our peer. More...
|
|
static void | send_client_done_and_destroy (void *cls) |
| Signal to the client that the operation has finished and destroy the operation. More...
|
|
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 we are done, so we are not just waiting for the channel to die before telling the local client that we are done as our last act. More...
|
|
static void | send_p2p_done (struct Operation *op) |
| Notify the other peer that we are done. More...
|
|
static void | send_remaining_elements (void *cls) |
| Send all elements in the full result iterator. More...
|
|
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 specification. More...
|
|
static void | send_element_count (struct Operation *op) |
| Send our element count to the peer, in case our element count is lower than theirs. More...
|
|
static void | begin_bf_exchange (struct Operation *op) |
| We go first, initialize our map with all elements and send the first Bloom filter. More...
|
|
void | handle_intersection_p2p_element_info (void *cls, const struct IntersectionElementInfoMessage *msg) |
| Handle the initial struct IntersectionElementInfoMessage from a remote peer. More...
|
|
static void | process_bf (struct Operation *op) |
| Process a Bloomfilter once we got all the chunks. More...
|
|
int | check_intersection_p2p_bf (void *cls, const struct BFMessage *msg) |
| Check an BF message from a remote peer. More...
|
|
void | handle_intersection_p2p_bf (void *cls, const struct BFMessage *msg) |
| Handle an BF message from a remote peer. More...
|
|
static int | filter_all (void *cls, const struct GNUNET_HashCode *key, void *value) |
| Remove all elements from our hashmap. More...
|
|
void | handle_intersection_p2p_done (void *cls, const struct IntersectionDoneMessage *idm) |
| Handle a done message from a remote peer. More...
|
|
static struct OperationState * | intersection_evaluate (struct Operation *op, const struct GNUNET_MessageHeader *opaque_context) |
| Initiate a set intersection operation with a remote peer. More...
|
|
static struct OperationState * | intersection_accept (struct Operation *op) |
| Accept an intersection operation request from a remote peer. More...
|
|
static void | intersection_op_cancel (struct Operation *op) |
| Destroy the intersection operation. More...
|
|
static struct SetState * | intersection_set_create () |
| Create a new set supporting the intersection operation. More...
|
|
static void | intersection_add (struct SetState *set_state, struct ElementEntry *ee) |
| Add the element from the given element message to the set. More...
|
|
static void | intersection_set_destroy (struct SetState *set_state) |
| Destroy a set that supports the intersection operation. More...
|
|
static void | intersection_remove (struct SetState *set_state, struct ElementEntry *element) |
| Remove the element given in the element message from the set. More...
|
|
static void | intersection_channel_death (struct Operation *op) |
| Callback for channel death for the intersection operation. More...
|
|
const struct SetVT * | _GSS_intersection_vt () |
| Get the table with implementing functions for set intersection. More...
|
|
two-peer set intersection
- Author
- Christian Fuchs
-
Christian Grothoff
Definition in file gnunet-service-set_intersection.c.
If applicable in the current operation mode, send a result message to the client indicating we removed an element.
- Parameters
-
op | intersection operation |
element | element to send |
Definition at line 209 of file gnunet-service-set_intersection.c.
References _GSS_statistics, Operation::client_request_id, Set::cs, GNUNET_SET_Element::data, GNUNET_SET_Element::element_type, GNUNET_SET_ResultMessage::element_type, GNUNET_assert, GNUNET_break, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SET_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SET_RESULT_REMOVED, GNUNET_SET_STATUS_OK, GNUNET_STATISTICS_update(), ClientState::mq, GNUNET_SET_ResultMessage::request_id, Operation::result_mode, GNUNET_SET_ResultMessage::result_status, Operation::set, and GNUNET_SET_Element::size.
Referenced by filter_all(), filtered_map_initialization(), and iterator_bf_reduce().
218 "Sending removed element (size %u) to client\n",
221 "# Element removed messages sent",
enum GNUNET_SET_ResultMode result_mode
When are elements sent to the client, and which elements are sent?
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MESSAGE_TYPE_SET_RESULT
Create an empty set.
uint32_t request_id
id the result belongs to
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
const void * data
Actual data of the element.
struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Everything went ok, we are transmitting an element of the result (in set, or to be removed from set...
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SET_Status in NBO.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint16_t element_type
Type of the element attachted to the message, if any.
struct ClientState * cs
Client that owns the set.
uint32_t client_request_id
ID used to identify an operation between service and client.
uint16_t size
Number of bytes in the buffer pointed to by data.
#define GNUNET_log(kind,...)
Client gets only elements that have been removed from the set.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
uint16_t element_type
Application-specific element type.
static int filtered_map_initialization |
( |
void * |
cls, |
|
|
const struct GNUNET_HashCode * |
key, |
|
|
void * |
value |
|
) |
| |
|
static |
Fills the "my_elements" hashmap with all relevant elements.
- Parameters
-
cls | the struct Operation * we are performing |
key | current key code |
value | the struct ElementEntry * from the hash map |
- Returns
- GNUNET_YES (we should continue to iterate)
Definition at line 253 of file gnunet-service-set_intersection.c.
References _GSS_is_element_of_operation(), ElementEntry::element, ElementEntry::element_hash, GNUNET_BLOCK_mingle_hash(), GNUNET_break, GNUNET_CONTAINER_bloomfilter_test(), GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CRYPTO_hash_xor(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_YES, OperationState::my_element_count, OperationState::my_elements, OperationState::my_xor, op, OperationState::remote_bf, OperationState::salt, send_client_removed_element(), GNUNET_SET_Element::size, Operation::state, and value.
Referenced by process_bf().
263 "FIMA called for %s:%u\n",
270 "Reduced initialization, not starting with %s:%u (wrong generation)\n",
281 "Testing mingled hash %s with salt %u\n",
292 "Reduced initialization, not starting with %s:%u\n",
302 "Filtered initialization of my_elements, adding %s:%u\n",
int _GSS_is_element_of_operation(struct ElementEntry *ee, struct Operation *op)
Is element ee part of the set used by op?
uint32_t salt
Salt currently used for BF construction (by us or the other peer, depending on where we are in the co...
struct GNUNET_HashCode element_hash
Hash of the element.
uint32_t my_element_count
Current element count contained within my_elements.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
static void send_client_removed_element(struct Operation *op, struct GNUNET_SET_Element *element)
If applicable in the current operation mode, send a result message to the client indicating we remove...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char * value
Value of the record to add/remove.
Information about an element element in the set.
int GNUNET_CONTAINER_bloomfilter_test(const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Test if an element is in the filter.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
Operation context used to execute a set operation.
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.
struct GNUNET_CONTAINER_BloomFilter * remote_bf
The bf we currently receive.
uint16_t size
Number of bytes in the buffer pointed to by data.
#define GNUNET_log(kind,...)
struct GNUNET_SET_Element element
The actual element.
void GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = a ^ b
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
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.
static int iterator_bf_reduce |
( |
void * |
cls, |
|
|
const struct GNUNET_HashCode * |
key, |
|
|
void * |
value |
|
) |
| |
|
static |
Removes elements from our hashmap if they are not contained within the provided remote bloomfilter.
- Parameters
-
cls | closure with the struct Operation * |
key | current key code |
value | value in the hash map |
- Returns
- GNUNET_YES (we should continue to iterate)
Definition at line 325 of file gnunet-service-set_intersection.c.
References ElementEntry::element, ElementEntry::element_hash, GNUNET_assert, GNUNET_BLOCK_mingle_hash(), GNUNET_break, GNUNET_CONTAINER_bloomfilter_test(), GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CRYPTO_hash_xor(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_YES, OperationState::my_element_count, OperationState::my_elements, OperationState::my_xor, op, OperationState::remote_bf, OperationState::salt, send_client_removed_element(), GNUNET_SET_Element::size, Operation::state, and value.
Referenced by process_bf().
337 "Testing mingled hash %s with salt %u\n",
350 "Bloom filter reduction of my_elements, removing %s:%u\n",
363 "Bloom filter reduction of my_elements, keeping %s:%u\n",
uint32_t salt
Salt currently used for BF construction (by us or the other peer, depending on where we are in the co...
struct GNUNET_HashCode element_hash
Hash of the element.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t my_element_count
Current element count contained within my_elements.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
static void send_client_removed_element(struct Operation *op, struct GNUNET_SET_Element *element)
If applicable in the current operation mode, send a result message to the client indicating we remove...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char * value
Value of the record to add/remove.
Information about an element element in the set.
int GNUNET_CONTAINER_bloomfilter_test(const struct GNUNET_CONTAINER_BloomFilter *bf, const struct GNUNET_HashCode *e)
Test if an element is in the filter.
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.
Operation context used to execute a set operation.
struct GNUNET_CONTAINER_BloomFilter * remote_bf
The bf we currently receive.
uint16_t size
Number of bytes in the buffer pointed to by data.
#define GNUNET_log(kind,...)
struct GNUNET_SET_Element element
The actual element.
void GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = a ^ b
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
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.
static void fail_intersection_operation |
( |
struct Operation * |
op | ) |
|
|
static |
Inform the client that the intersection operation has failed, and proceed to destroy the evaluate operation.
- Parameters
-
op | the intersection operation to fail |
Definition at line 408 of file gnunet-service-set_intersection.c.
References _GSS_operation_destroy(), _GSS_statistics, Operation::client_request_id, Set::cs, GNUNET_SET_ResultMessage::element_type, GNUNET_CONTAINER_multihashmap_destroy(), GNUNET_ERROR_TYPE_WARNING, GNUNET_log, GNUNET_MESSAGE_TYPE_SET_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SET_STATUS_FAILURE, GNUNET_STATISTICS_update(), GNUNET_YES, ClientState::mq, msg, OperationState::my_elements, GNUNET_SET_ResultMessage::request_id, GNUNET_SET_ResultMessage::result_status, Operation::set, and Operation::state.
Referenced by handle_intersection_p2p_bf(), handle_intersection_p2p_done(), handle_intersection_p2p_element_info(), and process_bf().
414 "Intersection operation failed\n");
416 "# Intersection operations failed",
struct GNUNET_MessageHeader * msg
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
#define GNUNET_MESSAGE_TYPE_SET_RESULT
Create an empty set.
uint32_t request_id
id the result belongs to
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
void _GSS_operation_destroy(struct Operation *op, int gc)
Destroy the given operation.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
The other peer refused to to the operation with us, or something went wrong.
void GNUNET_CONTAINER_multihashmap_destroy(struct GNUNET_CONTAINER_MultiHashMap *map)
Destroy a hash map.
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SET_Status in NBO.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint16_t element_type
Type of the element attachted to the message, if any.
struct ClientState * cs
Client that owns the set.
uint32_t client_request_id
ID used to identify an operation between service and client.
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
struct OperationState * state
Operation-specific operation state.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
static void send_bloomfilter |
( |
struct Operation * |
op | ) |
|
|
static |
Send a bloomfilter to our peer.
After the result done message has been sent to the client, destroy the evaluate operation.
- Parameters
-
Definition at line 443 of file gnunet-service-set_intersection.c.
References _GSS_statistics, OperationState::bf_data, BFMessage::bits_per_element, BFMessage::bloomfilter_total_length, BFMessage::element_xor_hash, GNUNET_assert, GNUNET_CONTAINER_bloomfilter_free(), GNUNET_CONTAINER_bloomfilter_get_raw_data(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CRYPTO_QUALITY_NONCE, GNUNET_CRYPTO_random_u32(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_log, GNUNET_malloc, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF, GNUNET_MQ_msg_extra, GNUNET_MQ_send(), GNUNET_NO, GNUNET_STATISTICS_update(), GNUNET_SYSERR, iterator_bf_create(), OperationState::local_bf, Operation::mq, msg, OperationState::my_element_count, OperationState::my_elements, OperationState::my_xor, Operation::remote_element_count, OperationState::salt, BFMessage::sender_element_count, BFMessage::sender_mutator, and Operation::state.
Referenced by begin_bf_exchange(), and process_bf().
448 uint32_t bf_elementbits;
457 bf_elementbits = 2 + ceil (log2 ((
double)
460 if (bf_elementbits < 1)
464 * bf_elementbits / log (2)));
466 "Sending Bloom filter (%u) of size %u bytes\n",
467 (
unsigned int) bf_elementbits,
468 (
unsigned int) bf_size);
480 "# Intersection Bloom filters sent",
483 chunk_size = 60 * 1024 -
sizeof(
struct BFMessage);
484 if (bf_size <= chunk_size)
487 chunk_size = bf_size;
513 while (offset < bf_size)
515 if (bf_size - chunk_size < offset)
516 chunk_size = bf_size - offset;
523 offset += chunk_size;
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 GNUNET_MessageHeader * msg
#define GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
Bloom filter message for intersection exchange started by Bob.
uint32_t salt
Salt currently used for BF construction (by us or the other peer, depending on where we are in the co...
uint32_t sender_element_count
Number of elements the sender still has in the set.
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_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
struct GNUNET_CONTAINER_BloomFilter * local_bf
BF of the set's element.
uint32_t my_element_count
Current element count contained within my_elements.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
uint32_t bloomfilter_total_length
Total length of the bloomfilter data.
struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
Bloom filter messages exchanged for set intersection calculation.
struct GNUNET_HashCode element_xor_hash
XOR of all hashes over all elements remaining in the set.
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.
uint32_t bits_per_element
Number of bits (k-value) used in encoding the bloomfilter.
static int iterator_bf_create(void *cls, const struct GNUNET_HashCode *key, void *value)
Create initial bloomfilter based on all the elements given.
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
uint32_t remote_element_count
Remote peers element count.
struct OperationState * state
Operation-specific operation state.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_MQ_Handle * mq
Message queue for the channel.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
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...
uint32_t sender_mutator
Mutator used with this bloomfilter.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
static void send_client_done_and_destroy |
( |
void * |
cls | ) |
|
|
static |
Signal to the client that the operation has finished and destroy the operation.
- Parameters
-
Definition at line 545 of file gnunet-service-set_intersection.c.
References _GSS_operation_destroy(), _GSS_statistics, Operation::client_request_id, Set::cs, GNUNET_SET_ResultMessage::element_type, GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_SET_RESULT, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SET_STATUS_DONE, GNUNET_STATISTICS_update(), GNUNET_YES, ClientState::mq, op, GNUNET_SET_ResultMessage::request_id, GNUNET_SET_ResultMessage::result_status, and Operation::set.
Referenced by handle_intersection_p2p_done(), intersection_channel_death(), and send_remaining_elements().
552 "Intersection succeeded, sending DONE to local client\n");
554 "# Intersection operations succeeded",
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
#define GNUNET_MESSAGE_TYPE_SET_RESULT
Create an empty set.
uint32_t request_id
id the result belongs to
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
void _GSS_operation_destroy(struct Operation *op, int gc)
Destroy the given operation.
void GNUNET_STATISTICS_update(struct GNUNET_STATISTICS_Handle *handle, const char *name, int64_t delta, int make_persistent)
Set statistic value for the peer.
Success, all elements have been sent (and received).
struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SET_Status in NBO.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint16_t element_type
Type of the element attachted to the message, if any.
struct ClientState * cs
Client that owns the set.
Operation context used to execute a set operation.
uint32_t client_request_id
ID used to identify an operation between service and client.
#define GNUNET_log(kind,...)
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
static struct GNUNET_ARM_Operation * op
Current operation.
static void send_p2p_done |
( |
struct Operation * |
op | ) |
|
|
static |
Notify the other peer that we are done.
Once this message is out, we still need to notify the local client that we are done.
- Parameters
-
op | operation to notify for. |
Definition at line 597 of file gnunet-service-set_intersection.c.
References OperationState::channel_death_expected, IntersectionDoneMessage::element_xor_hash, IntersectionDoneMessage::final_element_count, finished_local_operations(), GNUNET_assert, GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE, GNUNET_MQ_msg, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_NO, Operation::mq, OperationState::my_element_count, OperationState::my_xor, OperationState::phase, PHASE_MUST_SEND_DONE, and Operation::state.
Referenced by process_bf(), and send_remaining_elements().
uint32_t final_element_count
Final number of elements in intersection.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
uint32_t my_element_count
Current element count contained within my_elements.
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 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...
enum IntersectionOperationPhase phase
Current state of the operation.
We must next send the P2P DONE message (after finishing mostly with the local client).
struct GNUNET_HashCode element_xor_hash
XOR of all hashes over all elements remaining in the set.
#define GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE
Intersection operation is done.
Last message, send to confirm the final set.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
int channel_death_expected
Set whenever we reach the state where the death of the channel is perfectly find and should NOT resul...
struct OperationState * state
Operation-specific operation state.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_MQ_Handle * mq
Message queue for the channel.
static void send_remaining_elements |
( |
void * |
cls | ) |
|
|
static |
Send all elements in the full result iterator.
- Parameters
-
Definition at line 622 of file gnunet-service-set_intersection.c.
References Operation::client_request_id, Set::cs, GNUNET_SET_Element::data, ElementEntry::element, ElementEntry::element_hash, GNUNET_SET_Element::element_type, GNUNET_SET_ResultMessage::element_type, OperationState::full_result_iter, GNUNET_assert, GNUNET_CONTAINER_multihashmap_iterator_destroy(), GNUNET_CONTAINER_multihashmap_iterator_next(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SET_RESULT, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_NO, GNUNET_SET_STATUS_OK, ClientState::mq, op, OperationState::phase, PHASE_DONE_RECEIVED, PHASE_FINISHED, PHASE_MUST_SEND_DONE, GNUNET_SET_ResultMessage::request_id, res, GNUNET_SET_ResultMessage::result_status, send_client_done_and_destroy(), send_p2p_done(), Operation::set, GNUNET_SET_Element::size, and Operation::state.
Referenced by handle_intersection_p2p_done(), and process_bf().
639 "Sending done and destroy because iterator ran out\n");
661 "Sending element %s:%u to client (full set)\n",
void GNUNET_CONTAINER_multihashmap_iterator_destroy(struct GNUNET_CONTAINER_MultiHashMapIterator *iter)
Destroy a multihashmap iterator.
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.
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
static void send_remaining_elements(void *cls)
Send all elements in the full result iterator.
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
struct GNUNET_HashCode element_hash
Hash of the element.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_MESSAGE_TYPE_SET_RESULT
Create an empty set.
static void send_client_done_and_destroy(void *cls)
Signal to the client that the operation has finished and destroy the operation.
uint32_t request_id
id the result belongs to
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
const void * data
Actual data of the element.
static void send_p2p_done(struct Operation *op)
Notify the other peer that we are done.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
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...
Information about an element element in the set.
Everything went ok, we are transmitting an element of the result (in set, or to be removed from set...
enum IntersectionOperationPhase phase
Current state of the operation.
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SET_Status in NBO.
We must next send the P2P DONE message (after finishing mostly with the local client).
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint16_t element_type
Type of the element attachted to the message, if any.
struct ClientState * cs
Client that owns the set.
Operation context used to execute a set operation.
We have received the P2P DONE message, and must finish with the local client before terminating the c...
struct GNUNET_CONTAINER_MultiHashMapIterator * full_result_iter
Iterator for sending the final set of my_elements to the client.
uint32_t client_request_id
ID used to identify an operation between service and client.
uint16_t size
Number of bytes in the buffer pointed to by data.
#define GNUNET_log(kind,...)
struct GNUNET_SET_Element element
The actual element.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
uint16_t element_type
Application-specific element type.
static int initialize_map_unfiltered |
( |
void * |
cls, |
|
|
const struct GNUNET_HashCode * |
key, |
|
|
void * |
value |
|
) |
| |
|
static |
Fills the "my_elements" hashmap with the initial set of (non-deleted) elements from the set of the specification.
- Parameters
-
cls | closure with the struct Operation * |
key | current key code for the element |
value | value in the hash map with the struct ElementEntry * |
- Returns
- GNUNET_YES (we should continue to iterate)
Definition at line 693 of file gnunet-service-set_intersection.c.
References _GSS_is_element_of_operation(), ElementEntry::element, ElementEntry::element_hash, GNUNET_break, GNUNET_CONTAINER_multihashmap_put(), GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY, GNUNET_CRYPTO_hash_xor(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_NO, GNUNET_YES, OperationState::my_elements, OperationState::my_xor, op, GNUNET_SET_Element::size, Operation::state, and value.
Referenced by begin_bf_exchange().
706 "Initial full initialization of my_elements, adding %s:%u\n",
int _GSS_is_element_of_operation(struct ElementEntry *ee, struct Operation *op)
Is element ee part of the set used by op?
struct GNUNET_HashCode element_hash
Hash of the element.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char * value
Value of the record to add/remove.
Information about an element element in the set.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
Operation context used to execute a set operation.
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.
uint16_t size
Number of bytes in the buffer pointed to by data.
#define GNUNET_log(kind,...)
struct GNUNET_SET_Element element
The actual element.
void GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = a ^ b
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
static void process_bf |
( |
struct Operation * |
op | ) |
|
|
static |
Process a Bloomfilter once we got all the chunks.
- Parameters
-
op | the intersection operation |
Definition at line 804 of file gnunet-service-set_intersection.c.
References Set::content, SetContent::elements, fail_intersection_operation(), filtered_map_initialization(), OperationState::full_result_iter, GNUNET_break_op, GNUNET_CONTAINER_bloomfilter_free(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_iterator_create(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcmp, GNUNET_SET_RESULT_FULL, iterator_bf_reduce(), OperationState::local_bf, OperationState::my_element_count, OperationState::my_elements, OperationState::my_xor, OperationState::other_xor, OperationState::phase, PHASE_BF_EXCHANGE, PHASE_COUNT_SENT, PHASE_DONE_RECEIVED, PHASE_FINISHED, PHASE_INITIAL, PHASE_MUST_SEND_DONE, OperationState::remote_bf, Operation::remote_element_count, Operation::result_mode, send_bloomfilter(), send_p2p_done(), send_remaining_elements(), Operation::set, and Operation::state.
Referenced by handle_intersection_p2p_bf().
807 "Received BF in phase %u, foreign count is %u, my element count is %u/%u\n",
861 "Intersection succeeded, sending DONE to other peer\n");
867 "Sending full result set (%u elements)\n",
enum GNUNET_SET_ResultMode result_mode
When are elements sent to the client, and which elements are sent?
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
static void fail_intersection_operation(struct Operation *op)
Inform the client that the intersection operation has failed, and proceed to destroy the evaluate ope...
struct GNUNET_CONTAINER_MultiHashMapIterator * GNUNET_CONTAINER_multihashmap_iterator_create(const struct GNUNET_CONTAINER_MultiHashMap *map)
Create an iterator for a multihashmap.
static void send_remaining_elements(void *cls)
Send all elements in the full result iterator.
static int filtered_map_initialization(void *cls, const struct GNUNET_HashCode *key, void *value)
Fills the "my_elements" hashmap with all relevant elements.
We have initialized our set and are now reducing it by exchanging Bloom filters until one party notic...
struct GNUNET_CONTAINER_BloomFilter * local_bf
BF of the set's element.
uint32_t my_element_count
Current element count contained within my_elements.
struct GNUNET_CONTAINER_MultiHashMap * elements
Maps struct GNUNET_HashCode * to struct ElementEntry *.
Client gets every element in the resulting set.
static void send_p2p_done(struct Operation *op)
Notify the other peer that we are done.
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...
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
enum IntersectionOperationPhase phase
Current state of the operation.
We must next send the P2P DONE message (after finishing mostly with the local client).
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
We have received the P2P DONE message, and must finish with the local client before terminating the c...
We have send the number of our elements to the other peer, but did not setup our element set yet...
struct GNUNET_CONTAINER_MultiHashMapIterator * full_result_iter
Iterator for sending the final set of my_elements to the client.
struct GNUNET_HashCode other_xor
XOR of the keys of all of the elements (remaining) in the other peer's set.
struct SetContent * content
Content, possibly shared by multiple sets, and thus reference counted.
struct GNUNET_CONTAINER_BloomFilter * remote_bf
The bf we currently receive.
#define GNUNET_log(kind,...)
static void send_bloomfilter(struct Operation *op)
Send a bloomfilter to our peer.
uint32_t remote_element_count
Remote peers element count.
struct OperationState * state
Operation-specific operation state.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
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...
void handle_intersection_p2p_bf |
( |
void * |
cls, |
|
|
const struct BFMessage * |
msg |
|
) |
| |
Handle an BF message from a remote peer.
- Parameters
-
cls | the intersection operation |
msg | the header of the message |
Definition at line 912 of file gnunet-service-set_intersection.c.
References OperationState::bf_bits_per_element, OperationState::bf_data, OperationState::bf_data_offset, OperationState::bf_data_size, BFMessage::bits_per_element, BFMessage::bloomfilter_total_length, Operation::channel, BFMessage::element_xor_hash, fail_intersection_operation(), GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_bloomfilter_init(), GNUNET_free, GNUNET_malloc, GNUNET_memcpy, BFMessage::header, op, OperationState::other_xor, OperationState::phase, PHASE_BF_EXCHANGE, PHASE_COUNT_SENT, PHASE_INITIAL, process_bf(), OperationState::remote_bf, Operation::remote_element_count, OperationState::salt, BFMessage::sender_element_count, BFMessage::sender_mutator, GNUNET_MessageHeader::size, and Operation::state.
933 if (bf_size == chunk_size)
945 bf_bits_per_element);
977 (
const char *) &msg[1],
986 bf_bits_per_element);
struct GNUNET_CONTAINER_BloomFilter * GNUNET_CONTAINER_bloomfilter_init(const char *data, size_t size, unsigned int k)
Create a Bloom filter from raw bits.
uint32_t bf_bits_per_element
size of the bloomfilter
static void fail_intersection_operation(struct Operation *op)
Inform the client that the intersection operation has failed, and proceed to destroy the evaluate ope...
uint32_t bf_data_size
size of the bloomfilter in bf_data.
uint32_t salt
Salt currently used for BF construction (by us or the other peer, depending on where we are in the co...
uint32_t sender_element_count
Number of elements the sender still has in the set.
uint32_t bf_bits_per_element
size of the bloomfilter
static void process_bf(struct Operation *op)
Process a Bloomfilter once we got all the chunks.
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF.
We have initialized our set and are now reducing it by exchanging Bloom filters until one party notic...
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
uint32_t bloomfilter_total_length
Total length of the bloomfilter data.
uint32_t bf_data_offset
How many bytes of bf_data are valid?
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
enum IntersectionOperationPhase phase
Current state of the operation.
Bloom filter messages exchanged for set intersection calculation.
struct GNUNET_HashCode element_xor_hash
XOR of all hashes over all elements remaining in the set.
char * bf_data
For multipart BF transmissions, we have to store the bloomfilter-data until we fully received it...
Operation context used to execute a set operation.
uint32_t bits_per_element
Number of bits (k-value) used in encoding the bloomfilter.
We have send the number of our elements to the other peer, but did not setup our element set yet...
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 * channel
Channel to the peer.
struct GNUNET_HashCode other_xor
XOR of the keys of all of the elements (remaining) in the other peer's set.
struct GNUNET_CONTAINER_BloomFilter * remote_bf
The bf we currently receive.
uint32_t remote_element_count
Remote peers element count.
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
uint32_t sender_mutator
Mutator used with this bloomfilter.
#define GNUNET_malloc(size)
Wrapper around malloc.
#define GNUNET_free(ptr)
Wrapper around free.
static int filter_all |
( |
void * |
cls, |
|
|
const struct GNUNET_HashCode * |
key, |
|
|
void * |
value |
|
) |
| |
|
static |
Remove all elements from our hashmap.
- Parameters
-
cls | closure with the struct Operation * |
key | current key code |
value | value in the hash map |
- Returns
- GNUNET_YES (we should continue to iterate)
Definition at line 1012 of file gnunet-service-set_intersection.c.
References ElementEntry::element, ElementEntry::element_hash, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_multihashmap_remove(), GNUNET_CRYPTO_hash_xor(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_h2s(), GNUNET_log, GNUNET_YES, OperationState::my_element_count, OperationState::my_elements, OperationState::my_xor, op, send_client_removed_element(), GNUNET_SET_Element::size, Operation::state, and value.
Referenced by handle_intersection_p2p_done().
1025 "Final reduction of my_elements, removing %s:%u\n",
struct GNUNET_HashCode element_hash
Hash of the element.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t my_element_count
Current element count contained within my_elements.
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
static void send_client_removed_element(struct Operation *op, struct GNUNET_SET_Element *element)
If applicable in the current operation mode, send a result message to the client indicating we remove...
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
static char * value
Value of the record to add/remove.
Information about an element element in the set.
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.
Operation context used to execute a set operation.
uint16_t size
Number of bytes in the buffer pointed to by data.
#define GNUNET_log(kind,...)
struct GNUNET_SET_Element element
The actual element.
void GNUNET_CRYPTO_hash_xor(const struct GNUNET_HashCode *a, const struct GNUNET_HashCode *b, struct GNUNET_HashCode *result)
compute result = a ^ b
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
Handle a done message from a remote peer.
- Parameters
-
cls | the intersection operation |
mh | the message |
Definition at line 1045 of file gnunet-service-set_intersection.c.
References Operation::channel, OperationState::client_done_sent, IntersectionDoneMessage::element_xor_hash, fail_intersection_operation(), filter_all(), IntersectionDoneMessage::final_element_count, OperationState::full_result_iter, GNUNET_assert, GNUNET_break_op, GNUNET_CADET_receive_done(), GNUNET_CONTAINER_multihashmap_iterate(), GNUNET_CONTAINER_multihashmap_iterator_create(), GNUNET_CONTAINER_multihashmap_size(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_memcmp, GNUNET_NO, GNUNET_SET_OPERATION_INTERSECTION, GNUNET_SET_RESULT_FULL, OperationState::my_element_count, OperationState::my_elements, OperationState::my_xor, op, Set::operation, OperationState::phase, PHASE_BF_EXCHANGE, PHASE_DONE_RECEIVED, PHASE_FINISHED, Operation::result_mode, send_client_done_and_destroy(), send_remaining_elements(), Operation::set, and Operation::state.
1082 "Got IntersectionDoneMessage, have %u elements in intersection\n",
1091 "Sending full result set to client (%u elements)\n",
enum GNUNET_SET_ResultMode result_mode
When are elements sent to the client, and which elements are sent?
uint32_t final_element_count
Final number of elements in intersection.
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
static void fail_intersection_operation(struct Operation *op)
Inform the client that the intersection operation has failed, and proceed to destroy the evaluate ope...
struct GNUNET_CONTAINER_MultiHashMapIterator * GNUNET_CONTAINER_multihashmap_iterator_create(const struct GNUNET_CONTAINER_MultiHashMap *map)
Create an iterator for a multihashmap.
static void send_remaining_elements(void *cls)
Send all elements in the full result iterator.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
static void send_client_done_and_destroy(void *cls)
Signal to the client that the operation has finished and destroy the operation.
We have initialized our set and are now reducing it by exchanging Bloom filters until one party notic...
uint32_t my_element_count
Current element count contained within my_elements.
static int filter_all(void *cls, const struct GNUNET_HashCode *key, void *value)
Remove all elements from our hashmap.
int client_done_sent
Did we send the client that we are done?
Client gets every element in the resulting set.
#define GNUNET_break_op(cond)
Use this for assertion violations caused by other peers (i.e.
enum IntersectionOperationPhase phase
Current state of the operation.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
struct GNUNET_HashCode element_xor_hash
XOR of all hashes over all elements remaining in the set.
enum GNUNET_SET_OperationType operation
Type of operation supported for this set.
Operation context used to execute a set operation.
#define GNUNET_memcmp(a, b)
Compare memory in a and b, where both must be of the same pointer type.
We have received the P2P DONE message, and must finish with the local client before terminating the c...
struct GNUNET_CONTAINER_MultiHashMapIterator * full_result_iter
Iterator for sending the final set of my_elements to the client.
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 * channel
Channel to the peer.
#define GNUNET_log(kind,...)
Set intersection, only return elements that are in both sets.
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
struct GNUNET_HashCode my_xor
XOR of the keys of all of the elements (remaining) in my set.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
Initiate a set intersection operation with a remote peer.
- Parameters
-
op | operation that is created, should be initialized to begin the evaluation |
opaque_context | message to be transmitted to the listener to convince it to accept, may be NULL |
- Returns
- operation-specific state to keep in op
Definition at line 1113 of file gnunet-service-set_intersection.c.
References SetState::current_set_element_count, OperationRequestMessage::element_count, GNUNET_break, GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST, GNUNET_MQ_msg_nested_mh, GNUNET_MQ_send(), GNUNET_new, GNUNET_SET_OPERATION_INTERSECTION, GNUNET_YES, Operation::mq, msg, OperationState::my_element_count, OperationState::my_elements, OperationRequestMessage::operation, OperationState::phase, PHASE_COUNT_SENT, PHASE_INITIAL, Operation::set, state, and Set::state.
Referenced by _GSS_intersection_vt().
1130 "Initiating intersection operation evaluation\n");
1144 if (NULL != opaque_context)
1146 "Sent op request with context message\n");
1149 "Sent op request without context message\n");
State of an evaluate operation with another peer.
struct GNUNET_MessageHeader * msg
uint32_t element_count
For Intersection: my element count.
#define GNUNET_MQ_msg_nested_mh(mvar, type, mh)
Allocate a GNUNET_MQ_Envelope, and append a payload message after the given message struct...
struct SetState * state
Implementation-specific state.
uint32_t my_element_count
Current element count contained within my_elements.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
Request a set operation from a remote peer.
enum State state
current state of profiling
enum IntersectionOperationPhase phase
Current state of the operation.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint32_t current_set_element_count
Number of currently valid elements in the set which have not been removed.
We have send the number of our elements to the other peer, but did not setup our element set yet...
#define GNUNET_log(kind,...)
uint32_t operation
Operation to request, values from enum GNUNET_SET_OperationType
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
void GNUNET_MQ_send(struct GNUNET_MQ_Handle *mq, struct GNUNET_MQ_Envelope *ev)
Send a message with the given message queue.
Set intersection, only return elements that are in both sets.
struct GNUNET_MQ_Handle * mq
Message queue for the channel.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.
Accept an intersection operation request from a remote peer.
Only initializes the private operation state.
- Parameters
-
op | operation that will be accepted as an intersection operation |
Definition at line 1161 of file gnunet-service-set_intersection.c.
References begin_bf_exchange(), SetState::current_set_element_count, GNUNET_CONTAINER_multihashmap_create(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_log, GNUNET_MIN, GNUNET_new, GNUNET_YES, OperationState::my_element_count, OperationState::my_elements, OperationState::phase, PHASE_COUNT_SENT, PHASE_INITIAL, Operation::remote_element_count, send_element_count(), Operation::set, state, Operation::state, and Set::state.
Referenced by _GSS_intersection_vt().
1166 "Accepting set intersection operation\n");
State of an evaluate operation with another peer.
struct SetState * state
Implementation-specific state.
static void begin_bf_exchange(struct Operation *op)
We go first, initialize our map with all elements and send the first Bloom filter.
uint32_t my_element_count
Current element count contained within my_elements.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
enum State state
current state of profiling
enum IntersectionOperationPhase phase
Current state of the operation.
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint32_t current_set_element_count
Number of currently valid elements in the set which have not been removed.
static void send_element_count(struct Operation *op)
Send our element count to the peer, in case our element count is lower than theirs.
We have send the number of our elements to the other peer, but did not setup our element set yet...
#define GNUNET_log(kind,...)
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
uint32_t remote_element_count
Remote peers element count.
struct OperationState * state
Operation-specific operation state.
struct GNUNET_CONTAINER_MultiHashMap * my_elements
Remaining elements in the intersection operation.