36 #define INCOMING_CHANNEL_TIMEOUT GNUNET_TIME_UNIT_MINUTES 191 if (
op->suggest_id ==
id)
209 "Destroying incoming operation %p\n",
211 if (NULL != (listener = op->
listener))
298 gc.
map =
set->content->elements;
316 unsigned int excluded_size)
318 for (
unsigned int i = 0; i < excluded_size; i++)
319 if ((generation >= excluded[i].
start) && (generation < excluded[i].
end))
336 unsigned int query_generation,
338 unsigned int excluded_size)
383 is_present = mut->
added;
423 struct Set *
set = op->
set;
428 if (NULL != op->
state)
430 set->vt->cancel (op);
443 if (NULL != (channel = op->
channel))
519 if (NULL != (
set = cs->
set))
528 while (NULL != set->ops_head)
533 set->vt->destroy_set (set->state);
537 if (NULL != set->iter)
550 if (pm_current->
set ==
set)
574 set->excluded_generations = NULL;
594 if (NULL != (listener = cs->
listener))
599 while (NULL != (op = listener->
op_head))
602 "Destroying incoming operation `%u' from peer `%s'\n",
657 if ((NULL != nested_context) &&
697 if (NULL != nested_context)
702 "Received P2P operation request (op %u, port %s) for active listener\n",
717 "Suggesting incoming request with accept id %u to listener %p of client %p\n",
751 "Client inserts element %s of size %u\n",
765 set->content->elements,
772 set->current_generation,
773 set->excluded_generations,
774 set->excluded_generations_size))
777 "Client inserted element %s of size %u twice (ignored)\n",
790 set->vt->add (set->state, ee);
817 "Client removes non-existing element of size %u\n",
822 set->current_generation,
823 set->excluded_generations,
824 set->excluded_generations_size))
828 "Client removed element of size %u twice (ignored)\n",
838 "Client removes element of size %u\n",
843 set->vt->remove (set->state, ee);
891 "Executing pending mutation on %p.\n",
926 (
const void **) &ee);
935 set->content->iterator_count--;
944 set->iter_generation,
945 set->excluded_generations,
946 set->excluded_generations_size));
948 "Sending iteration element on %p.\n",
975 if (NULL == (
set = cs->
set))
982 if (NULL != set->iter)
990 "Iterating set %p in gen %u with %u content elements\n",
992 set->current_generation,
995 set->content->iterator_count++;
998 set->iter_generation =
set->current_generation;
1018 "Client created new set (operation %u)\n",
1020 if (NULL != cs->
set)
1045 set->state =
set->vt->create ();
1046 if (NULL == set->state)
1054 set->content->refcount = 1;
1078 "Remote peer's incoming request timed out\n");
1159 if (NULL != (channel = op->
channel))
1171 if (NULL != op->
set)
1294 "New listener created (op %u, port %s)\n",
1327 "Client rejected unknown operation %u\n",
1333 "Peer request (op %u, app %s) rejected by client\n",
1368 if (NULL == (
set = cs->
set))
1377 if (0 != set->content->iterator_count)
1387 set->content->pending_mutations_tail,
1407 if (set->current_generation == set->content->latest_generation)
1409 set->content->latest_generation++;
1410 set->current_generation++;
1414 GNUNET_assert (set->current_generation < set->content->latest_generation);
1416 r.
start =
set->current_generation + 1;
1417 r.
end =
set->content->latest_generation + 1;
1418 set->content->latest_generation = r.
end;
1419 set->current_generation = r.
end;
1421 set->excluded_generations_size,
1526 if (NULL == (
set = cs->
set))
1550 "Creating new CADET channel to port %s for set operation type %u\n",
1561 op->
state =
set->vt->evaluate (op, context);
1562 if (NULL == op->
state)
1586 if (NULL == (
set = cs->
set))
1593 if (NULL == set->iter)
1610 set->iteration_id++;
1631 if (NULL == (
set = cs->
set))
1639 "Client requested creation of lazy copy\n");
1667 if (NULL != cs->
set)
1675 for (cr = lazy_copy_head; NULL != cr; cr = cr->
next)
1692 "Client %p requested use of lazy copy\n",
1710 if (NULL == set->vt->copy_state)
1727 set->excluded_generations =
1729 set->excluded_generations_size
1756 if (NULL == (
set = cs->
set))
1779 "Client canceled non-existent op %u\n",
1785 "Client requested cancel for op %u\n",
1811 if (NULL == (
set = cs->
set))
1825 "Client %p accepted request %u of listener %p that is no longer active\n",
1837 "Client accepting request %u\n",
1856 op->
state =
set->vt->accept (op);
1857 if (NULL == op->
state)
1916 _ (
"Could not connect to CADET service\n"));
static void handle_client_create_set(void *cls, const struct GNUNET_SET_CreateMessage *msg)
Called when a client wants to create a new set.
struct GNUNET_PeerIdentity target_peer
Peer to evaluate the operation with.
#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.
#define GNUNET_MESSAGE_TYPE_SET_CANCEL
Cancel a set operation.
static uint32_t suggest_id
Counter for allocating unique IDs for clients, used to identify incoming operation requests from remo...
struct GNUNET_ARM_Operation * next
This is a doubly-linked list.
void GNUNET_CADET_disconnect(struct GNUNET_CADET_Handle *handle)
Disconnect from the cadet service.
const struct SetVT * _GSS_intersection_vt(void)
Get the table with implementing functions for set intersection.
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.
static struct Listener * listener_tail
Listeners are held in a doubly linked list.
static void handle_client_listen(void *cls, const struct GNUNET_SET_ListenMessage *msg)
Called when a client wants to create a new listener.
struct GNUNET_MessageHeader * msg
#define GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS
Actual set elements.
enum GNUNET_SET_ResultMode result_mode
When are elements sent to the client, and which elements are sent?
State we keep per client.
struct GNUNET_MessageHeader * context_msg
Context message, may be NULL.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Configuration we are using.
#define GNUNET_array_append(arr, len, element)
Append an element to an array (growing the array by one).
unsigned int GNUNET_CONTAINER_multihashmap_size(const struct GNUNET_CONTAINER_MultiHashMap *map)
Get the number of key-value pairs in the map.
struct GenerationRange * excluded_generations
List of generations we have to exclude, due to lazy copies.
static int end
Set if we are to shutdown all services (including ARM).
#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...
int _GSS_is_element_of_operation(struct ElementEntry *ee, struct Operation *op)
Is element ee part of the set used by op?
#define GNUNET_MESSAGE_TYPE_SET_ADD
Add element to set.
static void handle_client_mutation(void *cls, const struct GNUNET_SET_ElementMessage *msg)
Called when a client wants to add or remove an element to a set it inhabits.
uint32_t element_count
For Intersection: my element count.
struct MutationEvent * mutations
If mutations is not NULL, it contains a list of mutations, ordered by increasing generation.
Opaque handle to the service.
#define GNUNET_MESSAGE_TYPE_SET_ITER_ELEMENT
Element result for the iterating client.
#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_SET_UNION_P2P_OFFER
Tell the other peer which hashes match a given IBF key.
int byzantine_lower_bound
Lower bound for the set size, used only when byzantine mode is enabled.
struct GNUNET_MQ_Handle * mq
MQ to talk to client.
struct PendingMutation * pending_mutations_head
Mutations requested by the client that we're unable to execute right now because we're iterating over...
struct GNUNET_CONTAINER_MultiHashMapIterator * GNUNET_CONTAINER_multihashmap_iterator_create(const struct GNUNET_CONTAINER_MultiHashMap *map)
Create an iterator for a multihashmap.
struct SetState * state
Implementation-specific state.
#define GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_RESPONSE
Give the client an ID for connecting to the set's copy.
#define GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF
Bloom filter message for intersection exchange started by Bob.
Message sent by the service to the client to indicate an element that is removed (set intersection) o...
uint32_t request_id
Request ID to identify responses.
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.
static int check_client_evaluate(void *cls, const struct GNUNET_SET_EvaluateMessage *msg)
Called when a client wants to initiate a set operation with another peer.
struct GNUNET_HashCode element_hash
Hash of the element.
unsigned int refcount
Number of references to the content.
struct GNUNET_STATISTICS_Handle * GNUNET_STATISTICS_create(const char *subsystem, const struct GNUNET_CONFIGURATION_Handle *cfg)
Get handle for the statistics service.
uint8_t force_full
Always send full sets, even if delta operations would be more efficient.
static int start
Set if we are to start default services (including ARM).
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_incoming_msg(void *cls, const struct OperationRequestMessage *msg)
Check a request for a set operation from another peer.
Message containing buckets of an invertible bloom filter.
struct Listener * next
Listeners are held in a doubly linked list.
#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.
int added
If added is GNUNET_YES, then this is a remove event, otherwise it is an add event.
static uint32_t lazy_copy_cookie
Generator for unique cookie we set per lazy copy request.
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
uint32_t cookie
Cookie identifying the request.
static struct GNUNET_CADET_Handle * mh
Cadet handle.
uint8_t force_delta
Always use delta operation instead of sending full sets, even it it's less efficient.
static void execute_delayed_mutations(struct Set *set)
Execute mutations that were delayed on a set because of pending operations.
#define GNUNET_MESSAGE_TYPE_SET_EVALUATE
Evaluate a set operation.
#define INCOMING_CHANNEL_TIMEOUT
How long do we hold on to an incoming channel if there is no local listener before giving up...
struct GNUNET_MessageHeader header
Type: GNUNET_MESSAGE_TYPE_SET_ADD or GNUNET_MESSAGE_TYPE_SET_REMOVE.
#define GNUNET_MESSAGE_TYPE_SET_RESULT
Create an empty set.
A request for an operation with another client.
#define GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_PREPARE
Ask the set service to prepare a copy of a set.
unsigned int excluded_generations_size
Number of elements in array excluded_generations.
struct Operation * op_head
Head of DLL of operations this listener is responsible for.
uint32_t request_id
id the result belongs to
#define GNUNET_MESSAGE_TYPE_SET_ACCEPT
Accept a set request.
#define GNUNET_memcpy(dst, src, n)
Call memcpy() but check for n being 0 first.
static void shutdown_task(void *cls)
Called to clean up, after a shutdown has been requested.
#define GNUNET_MQ_hd_fixed_size(name, code, str, ctx)
static int ret
Return value of the commandline.
#define GNUNET_MQ_msg(mvar, type)
Allocate a GNUNET_MQ_Envelope.
struct GNUNET_CONTAINER_MultiHashMap * elements
Maps struct GNUNET_HashCode * to struct ElementEntry *.
void _GSS_operation_destroy(struct Operation *op, int gc)
Destroy the given operation.
#define GNUNET_memdup(buf, size)
Allocate and initialize a block of memory.
Opaque handle to a channel.
static int is_excluded_generation(unsigned int generation, struct GenerationRange *excluded, unsigned int excluded_size)
Is generation in the range of exclusions?
const char * GNUNET_h2s(const struct GNUNET_HashCode *hc)
Convert a hash value to a string (for printing debug messages).
Set element transmitted by service to client in response to a set iteration request.
static struct GNUNET_HashCode app_id
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static void handle_client_evaluate(void *cls, const struct GNUNET_SET_EvaluateMessage *msg)
Called when a client wants to initiate a set operation with another peer.
A listener is inhabited by a client, and waits for evaluation requests from remote peers...
static void execute_mutation(struct Set *set, const struct GNUNET_SET_ElementMessage *msg)
Perform a mutation on a set as specified by the msg.
static int garbage_collect_cb(void *cls, const struct GNUNET_HashCode *key, void *value)
Function invoked to check if an element can be removed from the set's history because it is no longer...
void GNUNET_STATISTICS_destroy(struct GNUNET_STATISTICS_Handle *h, int sync_first)
Destroy a handle (free all state associated with it).
Information about a mutation to apply to a set.
uint32_t result_mode
How should results be sent to us? See enum GNUNET_SET_ResultMode.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
enum GNUNET_SET_OperationType operation
The type of the operation.
static void send_client_element(struct Set *set)
Send the next element of a set to the set's client.
uint8_t byzantine_lower_bound
Lower bound for the set size, used only when byzantine mode is enabled.
static int check_client_mutation(void *cls, const struct GNUNET_SET_ElementMessage *msg)
Called when a client wants to add or remove an element to a set it inhabits.
uint8_t force_full
Always send full sets, even if delta operations would be more efficient.
struct LazyCopyRequest * prev
Kept in a DLL.
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...
#define GNUNET_MESSAGE_TYPE_SET_CREATE
Create a new local set.
void GNUNET_SET_element_hash(const struct GNUNET_SET_Element *element, struct GNUNET_HashCode *ret_hash)
Hash a set element.
#define GNUNET_MESSAGE_TYPE_SET_REJECT
Reject a set request.
unsigned int generation_created
Generation in which the operation handle was created.
uint16_t element_type
Type of the element to add or remove.
struct GNUNET_SCHEDULER_Task * timeout_task
Timeout task, if the incoming peer has not been accepted after the timeout, it will be disconnected...
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.
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.
struct Operation * next
Kept in a DLL of the listener, if listener is non-NULL.
uint32_t operation
Operation type, values of enum GNUNET_SET_OperationType
void * GNUNET_CONTAINER_multihashmap_get(const struct GNUNET_CONTAINER_MultiHashMap *map, const struct GNUNET_HashCode *key)
Given a key find a value in the map matching the key.
struct PendingMutation * next
Mutations are kept in a DLL.
struct GNUNET_STATISTICS_Handle * _GSS_statistics
Statistics handle.
Handle to a client that is connected to a service.
struct GNUNET_PeerIdentity peer
The identity of the requesting peer.
static struct GNUNET_ARM_MonitorHandle * m
Monitor connection with ARM.
GNUNET_SERVICE_MAIN("set", GNUNET_SERVICE_OPTION_NONE, &run, &client_connect_cb, &client_disconnect_cb, NULL, GNUNET_MQ_hd_fixed_size(client_accept, GNUNET_MESSAGE_TYPE_SET_ACCEPT, struct GNUNET_SET_AcceptMessage, NULL), GNUNET_MQ_hd_fixed_size(client_iter_ack, GNUNET_MESSAGE_TYPE_SET_ITER_ACK, struct GNUNET_SET_IterAckMessage, NULL), GNUNET_MQ_hd_var_size(client_mutation, GNUNET_MESSAGE_TYPE_SET_ADD, struct GNUNET_SET_ElementMessage, NULL), GNUNET_MQ_hd_fixed_size(client_create_set, GNUNET_MESSAGE_TYPE_SET_CREATE, struct GNUNET_SET_CreateMessage, NULL), GNUNET_MQ_hd_fixed_size(client_iterate, GNUNET_MESSAGE_TYPE_SET_ITER_REQUEST, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_var_size(client_evaluate, GNUNET_MESSAGE_TYPE_SET_EVALUATE, struct GNUNET_SET_EvaluateMessage, NULL), GNUNET_MQ_hd_fixed_size(client_listen, GNUNET_MESSAGE_TYPE_SET_LISTEN, struct GNUNET_SET_ListenMessage, NULL), GNUNET_MQ_hd_fixed_size(client_reject, GNUNET_MESSAGE_TYPE_SET_REJECT, struct GNUNET_SET_RejectMessage, NULL), GNUNET_MQ_hd_var_size(client_mutation, GNUNET_MESSAGE_TYPE_SET_REMOVE, struct GNUNET_SET_ElementMessage, NULL), GNUNET_MQ_hd_fixed_size(client_cancel, GNUNET_MESSAGE_TYPE_SET_CANCEL, struct GNUNET_SET_CancelMessage, NULL), GNUNET_MQ_hd_fixed_size(client_copy_lazy_prepare, GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_PREPARE, struct GNUNET_MessageHeader, NULL), GNUNET_MQ_hd_fixed_size(client_copy_lazy_connect, GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT, struct GNUNET_SET_CopyLazyConnectMessage, NULL), GNUNET_MQ_handler_end())
Define "main" method using service macro.
#define GNUNET_MQ_msg_extra(mvar, esize, type)
Allocate an envelope, with extra space allocated after the space needed by the message struct...
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.
#define GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_CONNECT
Sent by the client to the server to connect to an existing, lazily copied set.
#define GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST
Request a set operation from a remote peer.
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.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SEC
Compressed strata estimator.
Message sent by the client to the service to ask starting a new set to perform operations with...
static unsigned int num_clients
Number of active clients.
static char * value
Value of the record to add/remove.
Information about an element element in the set.
The other peer refused to to the operation with us, or something went wrong.
unsigned int current_generation
Current generation, that is, number of previously executed operations and lazy copies on the underlyi...
#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.
Message sent by the client to the service to start listening for incoming requests to perform a certa...
unsigned int max_op_generation
Largest generation for which an operation is still pending.
uint8_t force_delta
Always use delta operation instead of sending full sets, even it it's less efficient.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE
Strata estimator.
uint16_t result_status
Was the evaluation successful? Contains an enum GNUNET_SET_Status in NBO.
A set that supports a specific operation with other peers.
static void handle_client_copy_lazy_prepare(void *cls, const struct GNUNET_MessageHeader *mh)
Handle a request from the client to copy a set.
static int is_element_of_generation(struct ElementEntry *ee, unsigned int query_generation, struct GenerationRange *excluded, unsigned int excluded_size)
Is element ee part of the set during query_generation?
OpChannelDeathImpl channel_death
Callback called in case the CADET channel died.
static void handle_client_cancel(void *cls, const struct GNUNET_SET_CancelMessage *msg)
Handle a request from the client to cancel a running set operation.
static int in_shutdown
Are we in shutdown? if GNUNET_YES and the number of clients drops to zero, disconnect from CADET...
struct Set * set
Set associated with the operation, NULL until the spec has been associated with a set...
uint32_t request_id
Id of our set to evaluate, chosen implicitly by the client when it calls GNUNET_SET_commit().
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE
Set operation is done.
#define GNUNET_MESSAGE_TYPE_SET_LISTEN
Listen for operation requests.
uint32_t operation
Operation type, values of enum GNUNET_SET_OperationType
static void handle_client_iterate(void *cls, const struct GNUNET_MessageHeader *m)
Called when a client wants to iterate the elements of a set.
struct PendingMutation * pending_mutations_tail
Mutations requested by the client that we're unable to execute right now because we're iterating over...
static struct GNUNET_CADET_Handle * cadet
Handle to the cadet service, used to listen for and connect to remote peers.
#define GNUNET_MESSAGE_TYPE_SET_ITER_REQUEST
Start iteration over set elements.
void GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c)
Ask the server to disconnect from the given client.
Message handler for a specific message type.
Client connects to a lazily copied set.
static void incoming_timeout_cb(void *cls)
Timeout happens iff:
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_REQUEST_FULL
Demand the whole element from the other peer, given only the hash code.
Bloom filter messages exchanged for set intersection calculation.
static GstElement * source
Appsrc instance into which we write data for the pipeline.
int force_delta
Always use delta operation instead of sending full sets, even it it's less efficient.
There must only be one value per key; storing a value should fail if a value under the same key alrea...
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.
uint8_t byzantine
GNUNET_YES to fail operations where Byzantine faults are suspected
MutationEvent gives information about changes to an element (removal / addition) in a set content...
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_CADET_Port * open_port
The port we are listening on with CADET.
uint32_t result_mode
How should results be sent to us? See enum GNUNET_SET_ResultMode.
int byzantine
GNUNET_YES to fail operations where Byzantine faults are suspected
uint8_t byzantine_lower_bound
Lower bound for the set size, used only when byzantine mode is enabled.
#define GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO
Information about the element count for intersection.
struct ClientState * cs
Client that owns the set.
static void handle_incoming_msg(void *cls, const struct OperationRequestMessage *msg)
Handle a request for a set operation from another peer.
Sent to the service by the client in order to cancel a set operation.
struct GNUNET_MQ_Envelope * env
#define GNUNET_CONTAINER_DLL_insert_tail(head, tail, element)
Insert an element at the tail of a DLL.
Strata estimator together with the peer's overall set size.
Message sent by client to service to initiate a set operation as a client (not as listener)...
Client acknowledges receiving element in iteration.
GNUNET_SET_OperationType
The operation that a set set supports.
enum GNUNET_SET_OperationType operation
Type of operation supported for this set.
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.
static void handle_client_reject(void *cls, const struct GNUNET_SET_RejectMessage *msg)
Called when the listening client rejects an operation request by another peer.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF
Invertible bloom filter.
SetContent stores the actual set elements, which may be shared by multiple generations derived from o...
static void channel_end_cb(void *channel_ctx, const struct GNUNET_CADET_Channel *channel)
Function called whenever a channel is destroyed.
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.
uint32_t accept_reject_id
ID of the incoming request we want to accept.
#define GNUNET_MESSAGE_TYPE_SET_ITER_ACK
Acknowledge result from iteration.
unsigned int generation
First generation affected by this mutation event.
uint32_t cookie
Temporary name for the copied set.
struct Set * source_set
Which set are we supposed to copy?
Handle to a message queue.
static void handle_client_copy_lazy_connect(void *cls, const struct GNUNET_SET_CopyLazyConnectMessage *msg)
Handle a request from the client to connect to a copy of a set.
static struct LazyCopyRequest * lazy_copy_tail
DLL of lazy copy requests by this client.
static void incoming_destroy(struct Operation *op)
Destroy an incoming request from a remote peer.
During intersection, the first (and possibly second) message send it the number of elements in the se...
#define GNUNET_MQ_msg_header(type)
Allocate a GNUNET_MQ_Envelope, where the message only consists of a header.
The identity of the host (wraps the signing key of the peer).
uint32_t accept_reject_id
ID of the incoming request we want to reject.
struct LazyCopyRequest * next
Kept in a DLL.
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 GNUNET_HashCode app_id
application id
struct Set * set
Set this mutation is about.
struct Operation * ops_head
Evaluate operations are held in a linked list.
#define GNUNET_SET_CONTEXT_MESSAGE_MAX_SIZE
Maximum size of a context message for set operation requests.
struct GNUNET_HashCode app_id
Application id.
uint32_t salt
Salt to use for the operation.
struct GNUNET_SERVICE_Client * client
Client this is about.
static void handle_client_accept(void *cls, const struct GNUNET_SET_AcceptMessage *msg)
Handle a request from the client to accept a set operation that came from a remote peer...
uint32_t client_request_id
ID used to identify an operation between service and client.
uint32_t accept_id
ID of the to identify the request when accepting or rejecting it.
#define GNUNET_MESSAGE_TYPE_SET_REMOVE
Remove element from set.
#define GNUNET_MESSAGE_TYPE_SET_REQUEST
Notify the client of a request from a remote peer.
#define GNUNET_MESSAGE_TYPE_SET_ITER_DONE
Iteration end marker for the client.
Server responds to a lazy copy request.
struct SetContent * content
Content, possibly shared by multiple sets, and thus reference counted.
const struct SetVT * _GSS_union_vt(void)
Get the table with implementing functions for set union.
unsigned int end
Generation after the last excluded generation.
static void execute_add(struct Set *set, const struct GNUNET_SET_ElementMessage *msg)
Add an element to set as specified by msg.
uint16_t size
Number of bytes in the buffer pointed to by data.
common components for the implementation the different set operations
struct GNUNET_MQ_Handle * mq
#define GNUNET_log(kind,...)
#define GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE
Intersection operation is done.
static struct Operation * get_incoming(uint32_t id)
Get the incoming socket associated with the given id.
Message sent by client to the service to add or remove an element to/from the set.
int iterator_count
Number of concurrently active iterators.
struct GNUNET_SET_Element element
The actual element.
uint32_t operation
Operation to request, values from enum GNUNET_SET_OperationType
struct Listener * prev
Listeners are held in a doubly linked list.
struct GNUNET_PeerIdentity peer_id
Identity of the requesting peer.
struct GNUNET_CONTAINER_MultiHashMap * GNUNET_CONTAINER_multihashmap_create(unsigned int len, int do_not_copy_keys)
Create a multi hash map.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_DONE
Request all missing elements from the other peer, based on their sets and the elements we previously ...
uint8_t byzantine
GNUNET_YES to fail operations where Byzantine faults are suspected
uint32_t cookie
Temporary name for the copied set.
struct GNUNET_HashCode app_id
Application ID for the operation, used to distinguish multiple operations of the same type with the s...
static void handle_client_iter_ack(void *cls, const struct GNUNET_SET_IterAckMessage *ack)
Handle an ack from a client, and send the next element.
void GNUNET_CADET_close_port(struct GNUNET_CADET_Port *p)
Close a port opened with GNUNET_CADET_open_port().
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_FULL_ELEMENT
Send a set element, not as response to a demand but because we're sending the full set...
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.
const struct SetVT * vt
Virtual table for this set.
struct GNUNET_CONTAINER_MultiHashMap * map
Map for which we are garbage collecting removed elements.
Set intersection, only return elements that are in both sets.
static void execute_remove(struct Set *set, const struct GNUNET_SET_ElementMessage *msg)
Remove an element from set as specified by msg.
uint32_t request_id
ID of the request we want to cancel.
struct ClientState * cs
Client that owns the listener.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_OVER
Request all missing elements from the other peer, based on their sets and the elements we previously ...
struct Listener * listener
Listener, if associated with the client, otherwise NULL.
uint32_t remote_element_count
Remote peers element count.
static void collect_generation_garbage(struct Set *set)
Collect and destroy elements that are not needed anymore, because their lifetime (as determined by th...
struct Operation * op_tail
Tail of DLL of operations this listener is responsible for.
struct OperationState * state
Operation-specific operation state.
static struct GNUNET_ARM_Operation * op
Current operation.
unsigned int start
First generation that is excluded.
static void advance_generation(struct Set *set)
Advance the current generation of a set, adding exclusion ranges if necessary.
int GNUNET_CONTAINER_multihashmap_iterate(struct GNUNET_CONTAINER_MultiHashMap *map, GNUNET_CONTAINER_MulitHashMapIteratorCallback it, void *it_cls)
Iterate over all entries in the map.
unsigned int mutations_size
Number of elements in the array mutations.
Set union, return all elements that are in at least one of the sets.
static struct LazyCopyRequest * lazy_copy_head
DLL of lazy copy requests by this client.
Message sent by a listening client to the service to reject performing the operation with the other p...
Lazy copy requests made by a client.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_INQUIRY
Tell the other peer to send us a list of hashes that match an IBF key.
void GNUNET_CADET_channel_destroy(struct GNUNET_CADET_Channel *channel)
Destroy an existing channel.
static int destroy_elements_iterator(void *cls, const struct GNUNET_HashCode *key, void *value)
Iterator over hash map entries to free element entries.
struct Listener * listener
Port this operation runs on.
struct GNUNET_SET_ElementMessage * msg
Message that describes the desired mutation.
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.
Message sent by a listening client to the service to accept performing the operation with the other p...
#define GNUNET_MQ_handler_end()
End-marker for the handlers array.
Peer-to-Peer messages for gnunet set.
#define GNUNET_malloc(size)
Wrapper around malloc.
Context for the garbage_collect_cb().
uint16_t element_type
Type of the element attachted to the message, if any.
void _GSS_operation_destroy2(struct Operation *op)
This function probably should not exist and be replaced by inlining more specific logic in the variou...
uint16_t iteration_id
To which set iteration does this reponse belong to? First iteration (per client) has counter zero...
static struct Listener * listener_head
Listeners are held in a doubly linked list.
#define GNUNET_free(ptr)
Wrapper around free.
uint16_t element_type
Application-specific element type.
uint32_t send_more
Non-zero if the service should continue sending elements.
#define GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DEMAND
Demand the whole element from the other peer, given only the hash code.
struct GNUNET_MessageHeader * GNUNET_copy_message(const struct GNUNET_MessageHeader *msg)
Create a copy of the given message.
static struct GNUNET_TRANSPORT_PluginMonitor * pm
Handle if we are monitoring plugin session activity.
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.
struct GNUNET_MQ_Handle * GNUNET_CADET_get_mq(const struct GNUNET_CADET_Channel *channel)
Obtain the message queue for a connected peer.
int force_full
Always send full sets, even if delta operations would be more efficient.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
unsigned int min_op_generation
Lowest generation for which an operation is still pending.