Two-peer set operations. More...
Data Structures | |
struct | GNUNET_SET_Element |
Element stored in a set. More... | |
struct | GNUNET_SET_Option |
Option for set operations. More... | |
struct | GNUNET_SETI_Element |
Element stored in a set. More... | |
struct | GNUNET_SETI_Option |
Option for set operations. More... | |
struct | GNUNET_SETU_Element |
Element stored in a set. More... | |
struct | GNUNET_SETU_Option |
Option for set operations. More... | |
Macros | |
#define | GNUNET_SET_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024) |
Maximum size of a context message for set operation requests. More... | |
#define | GNUNET_SETI_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024) |
Maximum size of a context message for set operation requests. More... | |
#define | GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024) |
Maximum size of a context message for set operation requests. More... | |
Typedefs | |
typedef void(* | GNUNET_SET_Continuation) (void *cls) |
Continuation used for some of the set operations. More... | |
typedef void(* | GNUNET_SET_ResultIterator) (void *cls, const struct GNUNET_SET_Element *element, uint64_t current_size, enum GNUNET_SET_Status status) |
Callback for set operation results. More... | |
typedef int(* | GNUNET_SET_ElementIterator) (void *cls, const struct GNUNET_SET_Element *element) |
Iterator for set elements. More... | |
typedef void(* | GNUNET_SET_ListenCallback) (void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SET_Request *request) |
Called when another peer wants to do a set operation with the local peer. More... | |
typedef void(* | GNUNET_SET_CopyReadyCallback) (void *cls, struct GNUNET_SET_Handle *copy) |
typedef void(* | GNUNET_SETI_ResultIterator) (void *cls, const struct GNUNET_SETI_Element *element, uint64_t current_size, enum GNUNET_SETI_Status status) |
Callback for set union operation results. More... | |
typedef void(* | GNUNET_SETI_ListenCallback) (void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETI_Request *request) |
Called when another peer wants to do a set operation with the local peer. More... | |
typedef void(* | GNUNET_SETU_ResultIterator) (void *cls, const struct GNUNET_SETU_Element *element, uint64_t current_size, enum GNUNET_SETU_Status status) |
Callback for set union operation results. More... | |
typedef void(* | GNUNET_SETU_ListenCallback) (void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETU_Request *request) |
Called when another peer wants to do a set operation with the local peer. More... | |
Functions | |
struct GNUNET_SET_Handle * | GNUNET_SET_create (const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_SET_OperationType op) |
Create an empty set, supporting the specified operation. More... | |
int | GNUNET_SET_add_element (struct GNUNET_SET_Handle *set, const struct GNUNET_SET_Element *element, GNUNET_SET_Continuation cont, void *cont_cls) |
Add an element to the given set. More... | |
int | GNUNET_SET_remove_element (struct GNUNET_SET_Handle *set, const struct GNUNET_SET_Element *element, GNUNET_SET_Continuation cont, void *cont_cls) |
Remove an element to the given set. More... | |
void | GNUNET_SET_copy_lazy (struct GNUNET_SET_Handle *set, GNUNET_SET_CopyReadyCallback cb, void *cls) |
void | GNUNET_SET_destroy (struct GNUNET_SET_Handle *set) |
Destroy the set handle, and free all associated resources. More... | |
struct GNUNET_SET_OperationHandle * | GNUNET_SET_prepare (const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_HashCode *app_id, const struct GNUNET_MessageHeader *context_msg, enum GNUNET_SET_ResultMode result_mode, struct GNUNET_SET_Option options[], GNUNET_SET_ResultIterator result_cb, void *result_cls) |
Prepare a set operation to be evaluated with another peer. More... | |
struct GNUNET_SET_ListenHandle * | GNUNET_SET_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, enum GNUNET_SET_OperationType op_type, const struct GNUNET_HashCode *app_id, GNUNET_SET_ListenCallback listen_cb, void *listen_cls) |
Wait for set operation requests for the given application ID. More... | |
void | GNUNET_SET_listen_cancel (struct GNUNET_SET_ListenHandle *lh) |
Cancel the given listen operation. More... | |
struct GNUNET_SET_OperationHandle * | GNUNET_SET_accept (struct GNUNET_SET_Request *request, enum GNUNET_SET_ResultMode result_mode, struct GNUNET_SET_Option options[], GNUNET_SET_ResultIterator result_cb, void *result_cls) |
Accept a request we got via GNUNET_SET_listen(). More... | |
int | GNUNET_SET_commit (struct GNUNET_SET_OperationHandle *oh, struct GNUNET_SET_Handle *set) |
Commit a set to be used with a set operation. More... | |
void | GNUNET_SET_operation_cancel (struct GNUNET_SET_OperationHandle *oh) |
Cancel the given set operation. More... | |
int | GNUNET_SET_iterate (struct GNUNET_SET_Handle *set, GNUNET_SET_ElementIterator iter, void *iter_cls) |
Iterate over all elements in the given set. More... | |
void | GNUNET_SET_iterate_cancel (struct GNUNET_SET_Handle *set) |
Stop iteration over all elements in the given set. More... | |
struct GNUNET_SET_Element * | GNUNET_SET_element_dup (const struct GNUNET_SET_Element *element) |
Create a copy of an element. More... | |
void | GNUNET_SET_element_hash (const struct GNUNET_SET_Element *element, struct GNUNET_HashCode *ret_hash) |
Hash a set element. More... | |
struct GNUNET_SETI_Handle * | GNUNET_SETI_create (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Create an empty set, supporting the specified operation. More... | |
int | GNUNET_SETI_add_element (struct GNUNET_SETI_Handle *set, const struct GNUNET_SETI_Element *element, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls) |
Add an element to the given set. More... | |
void | GNUNET_SETI_destroy (struct GNUNET_SETI_Handle *set) |
Destroy the set handle, and free all associated resources. More... | |
struct GNUNET_SETI_OperationHandle * | GNUNET_SETI_prepare (const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_HashCode *app_id, const struct GNUNET_MessageHeader *context_msg, const struct GNUNET_SETI_Option options[], GNUNET_SETI_ResultIterator result_cb, void *result_cls) |
Prepare a set operation to be evaluated with another peer. More... | |
struct GNUNET_SETI_ListenHandle * | GNUNET_SETI_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HashCode *app_id, GNUNET_SETI_ListenCallback listen_cb, void *listen_cls) |
Wait for set operation requests for the given application ID. More... | |
void | GNUNET_SETI_listen_cancel (struct GNUNET_SETI_ListenHandle *lh) |
Cancel the given listen operation. More... | |
struct GNUNET_SETI_OperationHandle * | GNUNET_SETI_accept (struct GNUNET_SETI_Request *request, const struct GNUNET_SETI_Option options[], GNUNET_SETI_ResultIterator result_cb, void *result_cls) |
Accept a request we got via GNUNET_SETI_listen(). More... | |
int | GNUNET_SETI_commit (struct GNUNET_SETI_OperationHandle *oh, struct GNUNET_SETI_Handle *set) |
Commit a set to be used with a set operation. More... | |
void | GNUNET_SETI_operation_cancel (struct GNUNET_SETI_OperationHandle *oh) |
Cancel the given set operation. More... | |
void | GNUNET_SETI_element_hash (const struct GNUNET_SETI_Element *element, struct GNUNET_HashCode *ret_hash) |
Hash a set element. More... | |
struct GNUNET_SETU_Handle * | GNUNET_SETU_create (const struct GNUNET_CONFIGURATION_Handle *cfg) |
Create an empty set, supporting the specified operation. More... | |
int | GNUNET_SETU_add_element (struct GNUNET_SETU_Handle *set, const struct GNUNET_SETU_Element *element, GNUNET_SCHEDULER_TaskCallback cb, void *cb_cls) |
Add an element to the given set. More... | |
void | GNUNET_SETU_destroy (struct GNUNET_SETU_Handle *set) |
Destroy the set handle, and free all associated resources. More... | |
struct GNUNET_SETU_OperationHandle * | GNUNET_SETU_prepare (const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_HashCode *app_id, const struct GNUNET_MessageHeader *context_msg, const struct GNUNET_SETU_Option options[], GNUNET_SETU_ResultIterator result_cb, void *result_cls) |
Prepare a set operation to be evaluated with another peer. More... | |
struct GNUNET_SETU_ListenHandle * | GNUNET_SETU_listen (const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_HashCode *app_id, GNUNET_SETU_ListenCallback listen_cb, void *listen_cls) |
Wait for set operation requests for the given application ID. More... | |
void | GNUNET_SETU_listen_cancel (struct GNUNET_SETU_ListenHandle *lh) |
Cancel the given listen operation. More... | |
struct GNUNET_SETU_OperationHandle * | GNUNET_SETU_accept (struct GNUNET_SETU_Request *request, const struct GNUNET_SETU_Option options[], GNUNET_SETU_ResultIterator result_cb, void *result_cls) |
Accept a request we got via GNUNET_SETU_listen(). More... | |
int | GNUNET_SETU_commit (struct GNUNET_SETU_OperationHandle *oh, struct GNUNET_SETU_Handle *set) |
Commit a set to be used with a set operation. More... | |
void | GNUNET_SETU_operation_cancel (struct GNUNET_SETU_OperationHandle *oh) |
Cancel the given set operation. More... | |
void | GNUNET_SETU_element_hash (const struct GNUNET_SETU_Element *element, struct GNUNET_HashCode *ret_hash) |
Hash a set element. More... | |
Two-peer set operations.
#define GNUNET_SET_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024) |
Maximum size of a context message for set operation requests.
Definition at line 59 of file gnunet_set_service.h.
#define GNUNET_SETI_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024) |
Maximum size of a context message for set operation requests.
Definition at line 56 of file gnunet_seti_service.h.
#define GNUNET_SETU_CONTEXT_MESSAGE_MAX_SIZE ((1 << 16) - 1024) |
Maximum size of a context message for set operation requests.
Definition at line 56 of file gnunet_setu_service.h.
typedef void(* GNUNET_SET_Continuation) (void *cls) |
Continuation used for some of the set operations.
cls | closure |
Definition at line 276 of file gnunet_set_service.h.
typedef void(* GNUNET_SET_ResultIterator) (void *cls, const struct GNUNET_SET_Element *element, uint64_t current_size, enum GNUNET_SET_Status status) |
Callback for set operation results.
Called for each element in the result set.
cls | closure |
element | a result element, only valid if status is GNUNET_SET_STATUS_OK |
current_size | current set size |
status | see enum GNUNET_SET_Status |
Definition at line 289 of file gnunet_set_service.h.
typedef int(* GNUNET_SET_ElementIterator) (void *cls, const struct GNUNET_SET_Element *element) |
Iterator for set elements.
cls | closure |
element | the current element, NULL if all elements have been iterated over |
Definition at line 303 of file gnunet_set_service.h.
typedef void(* GNUNET_SET_ListenCallback) (void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SET_Request *request) |
Called when another peer wants to do a set operation with the local peer.
If a listen error occurs, the request is NULL.
cls | closure |
other_peer | the other peer |
context_msg | message with application specific information from the other peer |
request | request from the other peer (never NULL), use GNUNET_SET_accept() to accept it, otherwise the request will be refused Note that we can't just return value from the listen callback, as it is also necessary to specify the set we want to do the operation with, with sometimes can be derived from the context message. It's necessary to specify the timeout. |
Definition at line 323 of file gnunet_set_service.h.
typedef void(* GNUNET_SET_CopyReadyCallback) (void *cls, struct GNUNET_SET_Handle *copy) |
Definition at line 330 of file gnunet_set_service.h.
typedef void(* GNUNET_SETI_ResultIterator) (void *cls, const struct GNUNET_SETI_Element *element, uint64_t current_size, enum GNUNET_SETI_Status status) |
Callback for set union operation results.
Called for each element in the result set.
cls | closure |
element | a result element, only valid if status is #GNUNET_SETI_STATUS_OK |
current_size | current set size |
status | see enum GNUNET_SETI_Status |
Definition at line 182 of file gnunet_seti_service.h.
typedef void(* GNUNET_SETI_ListenCallback) (void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETI_Request *request) |
Called when another peer wants to do a set operation with the local peer.
If a listen error occurs, the request is NULL.
cls | closure |
other_peer | the other peer |
context_msg | message with application specific information from the other peer |
request | request from the other peer (never NULL), use GNUNET_SETI_accept() to accept it, otherwise the request will be refused Note that we can't just return value from the listen callback, as it is also necessary to specify the set we want to do the operation with, with sometimes can be derived from the context message. It's necessary to specify the timeout. |
Definition at line 204 of file gnunet_seti_service.h.
typedef void(* GNUNET_SETU_ResultIterator) (void *cls, const struct GNUNET_SETU_Element *element, uint64_t current_size, enum GNUNET_SETU_Status status) |
Callback for set union operation results.
Called for each element in the result set.
cls | closure |
element | a result element, only valid if status is #GNUNET_SETU_STATUS_OK |
current_size | current set size |
status | see enum GNUNET_SETU_Status |
Definition at line 227 of file gnunet_setu_service.h.
typedef void(* GNUNET_SETU_ListenCallback) (void *cls, const struct GNUNET_PeerIdentity *other_peer, const struct GNUNET_MessageHeader *context_msg, struct GNUNET_SETU_Request *request) |
Called when another peer wants to do a set operation with the local peer.
If a listen error occurs, the request is NULL.
cls | closure |
other_peer | the other peer |
context_msg | message with application specific information from the other peer |
request | request from the other peer (never NULL), use GNUNET_SETU_accept() to accept it, otherwise the request will be refused Note that we can't just return value from the listen callback, as it is also necessary to specify the set we want to do the operation with, with sometimes can be derived from the context message. It's necessary to specify the timeout. |
Definition at line 249 of file gnunet_setu_service.h.
The operation that a set set supports.
Enumerator | |
---|---|
GNUNET_SET_OPERATION_NONE | A purely local set that does not support any operation. |
GNUNET_SET_OPERATION_INTERSECTION | Set intersection, only return elements that are in both sets. |
GNUNET_SET_OPERATION_UNION | Set union, return all elements that are in at least one of the sets. |
Definition at line 86 of file gnunet_set_service.h.
enum GNUNET_SET_Status |
Status for the result callback.
Enumerator | |
---|---|
GNUNET_SET_STATUS_OK | Everything went ok, we are transmitting an element of the result (in set, or to be removed from set, depending on the Only applies to GNUNET_SET_RESULT_FULL, GNUNET_SET_RESULT_ADDED, GNUNET_SET_RESULT_REMOVED, |
GNUNET_SET_STATUS_ADD_LOCAL | Element should be added to the result set of the local peer, i.e. the local peer is missing an element. Only applies to GNUNET_SET_RESULT_SYMMETRIC |
GNUNET_SET_STATUS_ADD_REMOTE | Element should be added to the result set of the remote peer, i.e. the remote peer is missing an element. Only applies to GNUNET_SET_RESULT_SYMMETRIC |
GNUNET_SET_STATUS_FAILURE | The other peer refused to to the operation with us, or something went wrong. |
GNUNET_SET_STATUS_HALF_DONE | Success, all elements have been returned (but the other peer might still be receiving some from us, so we are not done). Only used during UNION operation. |
GNUNET_SET_STATUS_DONE | Success, all elements have been sent (and received). |
Definition at line 108 of file gnunet_set_service.h.
The way results are given to the client.
Definition at line 163 of file gnunet_set_service.h.
Possible options to pass to a set operation.
Used as tag for struct GNUNET_SET_Option.
Definition at line 223 of file gnunet_set_service.h.
enum GNUNET_SETI_Status |
Status for the result callback.
Definition at line 82 of file gnunet_seti_service.h.
Possible options to pass to a set operation.
Used as tag for struct GNUNET_SETI_Option.
Enumerator | |
---|---|
GNUNET_SETI_OPTION_END | List terminator. |
GNUNET_SETI_OPTION_RETURN_INTERSECTION | Return the elements remaining in the intersection (GNUNET_SETI_STATUS_ADD_LOCAL). If not given, the default is to return a list of the elements to be removed (GNUNET_SETI_STATUS_DEL_LOCAL). |
Definition at line 137 of file gnunet_seti_service.h.
enum GNUNET_SETU_Status |
Status for the result callback.
Enumerator | |
---|---|
GNUNET_SETU_STATUS_ADD_LOCAL | Element should be added to the result set of the local peer, i.e. the local peer is missing an element. |
GNUNET_SETU_STATUS_ADD_REMOTE | Element should be added to the result set of the remote peer, i.e. the remote peer is missing an element. Only used if GNUNET_SETU_OPTION_SYMMETRIC is set. |
GNUNET_SETU_STATUS_FAILURE | The other peer refused to do the operation with us, or something went wrong. |
GNUNET_SETU_STATUS_DONE | Success, all elements have been sent (and received). |
Definition at line 82 of file gnunet_setu_service.h.
Possible options to pass to a set operation.
Used as tag for struct GNUNET_SETU_Option.
Definition at line 138 of file gnunet_setu_service.h.
struct GNUNET_SET_Handle * GNUNET_SET_create | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
enum GNUNET_SET_OperationType | op | ||
) |
Create an empty set, supporting the specified operation.
cfg | configuration to use for connecting to the set service |
op | operation supported by the set Note that the operation has to be specified beforehand, as certain set operations need to maintain data structures specific to the operation |
Definition at line 656 of file set_api.c.
References cfg, create_internal(), GNUNET_ERROR_TYPE_DEBUG, LOG, and op.
Referenced by commit_set(), and handle_client_join().
int GNUNET_SET_add_element | ( | struct GNUNET_SET_Handle * | set, |
const struct GNUNET_SET_Element * | element, | ||
GNUNET_SET_Continuation | cont, | ||
void * | cont_cls | ||
) |
Add an element to the given set.
After the element has been added (in the sense of being transmitted to the set service), cont will be called. Calls to GNUNET_SET_add_element can be queued
set | set to add element to |
element | element to add to the set |
cont | continuation called after the element has been added |
cont_cls | closure for cont |
Definition at line 673 of file set_api.c.
References GNUNET_SET_Element::data, GNUNET_SET_Element::element_type, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SET_ADD, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SET_Handle::invalid, LOG, GNUNET_SET_Handle::mq, msg, and GNUNET_SET_Element::size.
Referenced by commit_set(), handle_client_insert(), set_result_cb(), task_start_apply_round(), and task_start_eval_echo().
int GNUNET_SET_remove_element | ( | struct GNUNET_SET_Handle * | set, |
const struct GNUNET_SET_Element * | element, | ||
GNUNET_SET_Continuation | cont, | ||
void * | cont_cls | ||
) |
Remove an element to the given set.
After the element has been removed (in the sense of the request being transmitted to the set service), cont will be called.
Multiple calls to GNUNET_SET_remove_element() can be queued
set | set to remove element from |
element | element to remove from the set |
cont | continuation called after the element has been removed |
cont_cls | closure for cont |
Definition at line 707 of file set_api.c.
References GNUNET_SET_Element::data, GNUNET_SET_Element::element_type, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SET_REMOVE, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SET_Handle::invalid, LOG, GNUNET_SET_Handle::mq, msg, and GNUNET_SET_Element::size.
Referenced by set_result_cb(), task_start_apply_round(), and task_start_eval_echo().
void GNUNET_SET_copy_lazy | ( | struct GNUNET_SET_Handle * | set, |
GNUNET_SET_CopyReadyCallback | cb, | ||
void * | cls | ||
) |
Definition at line 1139 of file set_api.c.
References SetCopyRequest::cb, SetCopyRequest::cls, GNUNET_SET_Handle::copy_req_head, GNUNET_SET_Handle::copy_req_tail, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SET_COPY_LAZY_PREPARE, GNUNET_MQ_msg_header, GNUNET_MQ_send(), GNUNET_new, LOG, and GNUNET_SET_Handle::mq.
Referenced by create_set_copy_for_task().
void GNUNET_SET_destroy | ( | struct GNUNET_SET_Handle * | set | ) |
Destroy the set handle, and free all associated resources.
Iterations must have completed (or be explicitly canceled) before destroying the corresponding set. Operations may still be pending when a set is destroyed.
set | set to destroy |
Destroy the set handle, and free all associated resources.
set | set handle to destroy |
Definition at line 745 of file set_api.c.
References GNUNET_SET_Handle::destroy_requested, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SYSERR, GNUNET_YES, GNUNET_SET_Handle::iterator, LOG, GNUNET_SET_Handle::mq, and GNUNET_SET_Handle::ops_head.
Referenced by client_disconnect_cb(), commit_set(), GNUNET_SET_operation_cancel(), handle_iter_done(), and handle_result().
struct GNUNET_SET_OperationHandle * GNUNET_SET_prepare | ( | const struct GNUNET_PeerIdentity * | other_peer, |
const struct GNUNET_HashCode * | app_id, | ||
const struct GNUNET_MessageHeader * | context_msg, | ||
enum GNUNET_SET_ResultMode | result_mode, | ||
struct GNUNET_SET_Option | options[], | ||
GNUNET_SET_ResultIterator | result_cb, | ||
void * | result_cls | ||
) |
Prepare a set operation to be evaluated with another peer.
The evaluation will not start until the client provides a local set with GNUNET_SET_commit().
other_peer | peer with the other set |
app_id | hash for the application using the set |
context_msg | additional information for the request |
result_mode | specified how results will be returned, see enum GNUNET_SET_ResultMode . |
result_cb | called on error or success |
result_cls | closure for result_cb |
Definition at line 772 of file set_api.c.
References GNUNET_SET_OperationHandle::conclude_mqm, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_MESSAGE_TYPE_SET_EVALUATE, GNUNET_MQ_msg_nested_mh, GNUNET_new, GNUNET_SET_OPTION_BYZANTINE, GNUNET_SET_OPTION_FORCE_DELTA, GNUNET_SET_OPTION_FORCE_FULL, GNUNET_YES, LOG, msg, GNUNET_SET_Option::num, options, GNUNET_SET_OperationHandle::request_id_addr, GNUNET_SET_OperationHandle::result_cb, GNUNET_SET_OperationHandle::result_cls, GNUNET_SET_Option::type, and GNUNET_SET_Option::v.
Referenced by task_start_reconcile().
struct GNUNET_SET_ListenHandle * GNUNET_SET_listen | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
enum GNUNET_SET_OperationType | operation, | ||
const struct GNUNET_HashCode * | app_id, | ||
GNUNET_SET_ListenCallback | listen_cb, | ||
void * | listen_cls | ||
) |
Wait for set operation requests for the given application ID.
If the connection to the set service is lost, the listener is re-created transparently with exponential backoff.
cfg | configuration to use for connecting to the set service |
operation | operation we want to listen for |
app_id | id of the application that handles set operation requests |
listen_cb | called for each incoming request matching the operation and application id |
listen_cls | handle for listen_cb |
Wait for set operation requests for the given application ID.
cfg | configuration to use for connecting to the set service, needs to be valid for the lifetime of the listen handle |
operation | operation we want to listen for |
app_id | id of the application that handles set operation requests |
listen_cb | called for each incoming request matching the operation and application id |
listen_cls | handle for listen_cb |
Definition at line 976 of file set_api.c.
References GNUNET_SET_ListenHandle::app_id, cfg, GNUNET_SET_ListenHandle::cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_new, GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_SET_ListenHandle::listen_cb, listen_cb(), GNUNET_SET_ListenHandle::listen_cls, listen_connect(), LOG, GNUNET_SET_ListenHandle::mq, GNUNET_SET_ListenHandle::operation, and GNUNET_SET_ListenHandle::reconnect_backoff.
Referenced by handle_client_join().
void GNUNET_SET_listen_cancel | ( | struct GNUNET_SET_ListenHandle * | lh | ) |
Cancel the given listen operation.
After calling cancel, the listen callback for this listen handle will not be called again. Note that cancelling a listen operation will automatically reject all operations that have not yet been accepted.
lh | handle for the listen operation |
lh | handle for the listen operation |
Definition at line 1010 of file set_api.c.
References GNUNET_SET_ListenHandle::app_id, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), LOG, GNUNET_SET_ListenHandle::mq, and GNUNET_SET_ListenHandle::reconnect_task.
Referenced by client_disconnect_cb().
struct GNUNET_SET_OperationHandle * GNUNET_SET_accept | ( | struct GNUNET_SET_Request * | request, |
enum GNUNET_SET_ResultMode | result_mode, | ||
struct GNUNET_SET_Option | options[], | ||
GNUNET_SET_ResultIterator | result_cb, | ||
void * | result_cls | ||
) |
Accept a request we got via GNUNET_SET_listen().
Must be called during GNUNET_SET_listen(), as the struct GNUNET_SET_Request
becomes invalid afterwards. Call GNUNET_SET_commit() to provide the local set to use for the operation, and to begin the exchange with the remote peer.
request | request to accept |
result_mode | specified how results will be returned, see enum GNUNET_SET_ResultMode . |
result_cb | callback for the results |
result_cls | closure for result_cb |
Definition at line 1030 of file set_api.c.
References GNUNET_SET_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SET_ACCEPT, GNUNET_MQ_msg, GNUNET_new, GNUNET_NO, GNUNET_YES, LOG, msg, request, GNUNET_SET_OperationHandle::request_id_addr, GNUNET_SET_OperationHandle::result_cb, GNUNET_SET_OperationHandle::result_cls, and GNUNET_SET_AcceptMessage::result_mode.
Referenced by set_listen_cb().
int GNUNET_SET_commit | ( | struct GNUNET_SET_OperationHandle * | oh, |
struct GNUNET_SET_Handle * | set | ||
) |
Commit a set to be used with a set operation.
This function is called once we have fully constructed the set that we want to use for the operation. At this time, the P2P protocol can then begin to exchange the set information and call the result callback with the result information.
oh | handle to the set operation |
set | the set to use for the operation |
Definition at line 1073 of file set_api.c.
References GNUNET_SET_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MQ_assoc_add(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SET_Handle::invalid, LOG, GNUNET_SET_Handle::mq, GNUNET_SET_Handle::ops_head, GNUNET_SET_Handle::ops_tail, GNUNET_SET_OperationHandle::request_id, GNUNET_SET_OperationHandle::request_id_addr, and GNUNET_SET_OperationHandle::set.
Referenced by commit_set().
void GNUNET_SET_operation_cancel | ( | struct GNUNET_SET_OperationHandle * | oh | ) |
Cancel the given set operation.
May not be called after the operation's GNUNET_SET_ResultIterator
has been called with a status that indicates error, timeout or done.
oh | set operation to cancel |
We need to send an explicit cancel message, as all operations one one set communicate using one handle.
oh | set operation to cancel |
Definition at line 516 of file set_api.c.
References GNUNET_SET_Handle::destroy_requested, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SET_CANCEL, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SET_destroy(), GNUNET_YES, LOG, m, GNUNET_SET_Handle::mq, GNUNET_SET_Handle::ops_head, GNUNET_SET_OperationHandle::request_id, GNUNET_SET_OperationHandle::set, and set_operation_destroy().
Referenced by commit_set().
int GNUNET_SET_iterate | ( | struct GNUNET_SET_Handle * | set, |
GNUNET_SET_ElementIterator | iter, | ||
void * | iter_cls | ||
) |
Iterate over all elements in the given set.
Note that this operation involves transferring every element of the set from the service to the client, and is thus costly. Only one iteration per set may be active at the same time.
set | the set to iterate over |
iter | the iterator to call for each element |
iter_cls | closure for iter |
Note that this operation involves transferring every element of the set from the service to the client, and is thus costly.
set | the set to iterate over |
iter | the iterator to call for each element |
iter_cls | closure for iter |
Definition at line 1117 of file set_api.c.
References GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SET_ITER_REQUEST, GNUNET_MQ_msg_header, GNUNET_MQ_send(), GNUNET_NO, GNUNET_SYSERR, GNUNET_YES, GNUNET_SET_Handle::invalid, GNUNET_SET_Handle::iterator, GNUNET_SET_Handle::iterator_cls, LOG, and GNUNET_SET_Handle::mq.
Referenced by task_start_finish().
void GNUNET_SET_iterate_cancel | ( | struct GNUNET_SET_Handle * | set | ) |
Stop iteration over all elements in the given set.
Can only be called before the iteration has "naturally" completed its turn.
set | the set to stop iterating over |
struct GNUNET_SET_Element * GNUNET_SET_element_dup | ( | const struct GNUNET_SET_Element * | element | ) |
Create a copy of an element.
The copy must be GNUNET_free-d by the caller.
element | the element to copy |
Definition at line 1168 of file set_api.c.
References GNUNET_SET_Element::data, GNUNET_SET_Element::element_type, GNUNET_malloc, GNUNET_memcpy, and GNUNET_SET_Element::size.
Referenced by diff_insert(), and rfn_vote().
void GNUNET_SET_element_hash | ( | const struct GNUNET_SET_Element * | element, |
struct GNUNET_HashCode * | ret_hash | ||
) |
Hash a set element.
element | the element that should be hashed | |
[out] | ret_hash | a pointer to where the hash of element should be stored |
Definition at line 1184 of file set_api.c.
References ctx, GNUNET_SET_Element::data, GNUNET_SET_Element::element_type, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), and GNUNET_SET_Element::size.
Referenced by diff_insert(), execute_add(), execute_remove(), handle_union_p2p_elements(), handle_union_p2p_full_element(), and rfn_vote().
struct GNUNET_SETI_Handle * GNUNET_SETI_create | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Create an empty set, supporting the specified operation.
cfg | configuration to use for connecting to the set service |
Create an empty set, supporting the specified operation.
cfg | configuration to use for connecting to the set service |
Definition at line 399 of file seti_api.c.
References cfg, GNUNET_SETI_Handle::cfg, GNUNET_CLIENT_connect(), GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MESSAGE_TYPE_SETI_CREATE, GNUNET_MESSAGE_TYPE_SETI_RESULT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, handle_client_set_error(), LOG, GNUNET_SETI_Handle::mq, and result.
Referenced by handle_alice_client_message(), and handle_bob_client_message().
int GNUNET_SETI_add_element | ( | struct GNUNET_SETI_Handle * | set, |
const struct GNUNET_SETI_Element * | element, | ||
GNUNET_SCHEDULER_TaskCallback | cb, | ||
void * | cb_cls | ||
) |
Add an element to the given set.
set | set to add element to |
element | element to add to the set |
cb | function to call when finished, can be NULL |
cb_cls | closure for cb |
After the element has been added (in the sense of being transmitted to the set service), cont will be called. Multiple calls to GNUNET_SETI_add_element() can be queued.
set | set to add element to |
element | element to add to the set |
cb | continuation called after the element has been added |
cb_cls | closure for cont |
Definition at line 447 of file seti_api.c.
References GNUNET_SETI_Element::data, GNUNET_SETI_Element::element_type, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETI_ADD, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SETI_Handle::invalid, LOG, GNUNET_SETI_Handle::mq, msg, and GNUNET_SETI_Element::size.
Referenced by handle_alice_client_message(), handle_alice_client_message_multipart(), handle_bob_client_message(), and handle_bob_client_message_multipart().
void GNUNET_SETI_destroy | ( | struct GNUNET_SETI_Handle * | set | ) |
Destroy the set handle, and free all associated resources.
Operations may still be pending when a set is destroyed (and will be allowed to complete).
set | set to destroy |
Destroy the set handle, and free all associated resources.
set | set handle to destroy |
Definition at line 488 of file seti_api.c.
References GNUNET_SETI_Handle::destroy_requested, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SYSERR, GNUNET_YES, LOG, GNUNET_SETI_Handle::mq, and GNUNET_SETI_Handle::ops_head.
Referenced by cb_intersection_element_removed(), destroy_service_session(), GNUNET_SETI_operation_cancel(), and handle_result().
struct GNUNET_SETI_OperationHandle * GNUNET_SETI_prepare | ( | const struct GNUNET_PeerIdentity * | other_peer, |
const struct GNUNET_HashCode * | app_id, | ||
const struct GNUNET_MessageHeader * | context_msg, | ||
const struct GNUNET_SETI_Option | options[], | ||
GNUNET_SETI_ResultIterator | result_cb, | ||
void * | result_cls | ||
) |
Prepare a set operation to be evaluated with another peer.
The evaluation will not start until the client provides a local set with GNUNET_SETI_commit().
other_peer | peer with the other set |
app_id | hash for the application using the set |
context_msg | additional information for the request |
options | options to use when processing the request |
result_cb | called on error or success |
result_cls | closure for result_cb |
Definition at line 513 of file seti_api.c.
References GNUNET_SETI_EvaluateMessage::app_id, GNUNET_SETI_OperationHandle::conclude_mqm, GNUNET_ERROR_TYPE_ERROR, GNUNET_MESSAGE_TYPE_SETI_EVALUATE, GNUNET_MQ_msg_nested_mh, GNUNET_new, GNUNET_SETI_OPTION_END, GNUNET_SETI_OPTION_RETURN_INTERSECTION, GNUNET_YES, LOG, msg, options, GNUNET_SETI_OperationHandle::request_id_addr, GNUNET_SETI_OperationHandle::result_cb, and GNUNET_SETI_OperationHandle::result_cls.
Referenced by start_intersection().
struct GNUNET_SETI_ListenHandle * GNUNET_SETI_listen | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_HashCode * | app_id, | ||
GNUNET_SETI_ListenCallback | listen_cb, | ||
void * | listen_cls | ||
) |
Wait for set operation requests for the given application ID.
If the connection to the set service is lost, the listener is re-created transparently with exponential backoff.
cfg | configuration to use for connecting to the set service |
app_id | id of the application that handles set operation requests |
listen_cb | called for each incoming request matching the operation and application id |
listen_cls | handle for listen_cb |
Wait for set operation requests for the given application ID.
cfg | configuration to use for connecting to the set service, needs to be valid for the lifetime of the listen handle |
app_id | id of the application that handles set operation requests |
listen_cb | called for each incoming request matching the operation and application id |
listen_cls | handle for listen_cb |
Definition at line 702 of file seti_api.c.
References GNUNET_SETI_ListenHandle::app_id, cfg, GNUNET_SETI_ListenHandle::cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_new, GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_SETI_ListenHandle::listen_cb, listen_cb(), GNUNET_SETI_ListenHandle::listen_cls, listen_connect(), LOG, GNUNET_SETI_ListenHandle::mq, and GNUNET_SETI_ListenHandle::reconnect_backoff.
Referenced by client_request_complete_alice().
void GNUNET_SETI_listen_cancel | ( | struct GNUNET_SETI_ListenHandle * | lh | ) |
Cancel the given listen operation.
After calling cancel, the listen callback for this listen handle will not be called again. Note that cancelling a listen operation will automatically reject all operations that have not yet been accepted.
lh | handle for the listen operation |
lh | handle for the listen operation |
Definition at line 734 of file seti_api.c.
References GNUNET_SETI_ListenHandle::app_id, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), LOG, GNUNET_SETI_ListenHandle::mq, and GNUNET_SETI_ListenHandle::reconnect_task.
Referenced by cb_intersection_element_removed(), and destroy_service_session().
struct GNUNET_SETI_OperationHandle * GNUNET_SETI_accept | ( | struct GNUNET_SETI_Request * | request, |
const struct GNUNET_SETI_Option | options[], | ||
GNUNET_SETI_ResultIterator | result_cb, | ||
void * | result_cls | ||
) |
Accept a request we got via GNUNET_SETI_listen().
Must be called during GNUNET_SETI_listen(), as the struct GNUNET_SETI_Request
becomes invalid afterwards. Call GNUNET_SETI_commit() to provide the local set to use for the operation, and to begin the exchange with the remote peer.
request | request to accept |
options | options to use when processing the request |
result_cb | callback for the results |
result_cls | closure for result_cb |
Definition at line 754 of file seti_api.c.
References GNUNET_SETI_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_MESSAGE_TYPE_SETI_ACCEPT, GNUNET_MQ_msg, GNUNET_new, GNUNET_NO, GNUNET_SETI_OPTION_END, GNUNET_SETI_OPTION_RETURN_INTERSECTION, GNUNET_YES, LOG, msg, options, request, GNUNET_SETI_OperationHandle::request_id_addr, GNUNET_SETI_OperationHandle::result_cb, GNUNET_SETI_OperationHandle::result_cls, and GNUNET_SETI_OperationHandle::return_intersection.
Referenced by cb_intersection_request_alice().
int GNUNET_SETI_commit | ( | struct GNUNET_SETI_OperationHandle * | oh, |
struct GNUNET_SETI_Handle * | set | ||
) |
Commit a set to be used with a set operation.
This function is called once we have fully constructed the set that we want to use for the operation. At this time, the P2P protocol can then begin to exchange the set information and call the result callback with the result information.
oh | handle to the set operation |
set | the set to use for the operation |
Definition at line 810 of file seti_api.c.
References GNUNET_SETI_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MQ_assoc_add(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SETI_Handle::invalid, LOG, GNUNET_SETI_Handle::mq, GNUNET_SETI_Handle::ops_head, GNUNET_SETI_Handle::ops_tail, GNUNET_SETI_OperationHandle::request_id, GNUNET_SETI_OperationHandle::request_id_addr, and GNUNET_SETI_OperationHandle::set.
Referenced by cb_intersection_request_alice().
void GNUNET_SETI_operation_cancel | ( | struct GNUNET_SETI_OperationHandle * | oh | ) |
Cancel the given set operation.
May not be called after the operation's GNUNET_SETI_ResultIterator
has been called with a status of GNUNET_SETI_STATUS_FAILURE or GNUNET_SETI_STATUS_DONE.
oh | set operation to cancel |
We need to send an explicit cancel message, as all operations one one set communicate using one handle.
oh | set operation to cancel |
Definition at line 335 of file seti_api.c.
References GNUNET_SETI_Handle::destroy_requested, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SETI_CANCEL, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SETI_destroy(), GNUNET_YES, LOG, m, GNUNET_SETI_Handle::mq, GNUNET_SETI_Handle::ops_head, GNUNET_SETI_OperationHandle::request_id, GNUNET_SETI_OperationHandle::set, and set_operation_destroy().
Referenced by destroy_service_session().
void GNUNET_SETI_element_hash | ( | const struct GNUNET_SETI_Element * | element, |
struct GNUNET_HashCode * | ret_hash | ||
) |
Hash a set element.
element | the element that should be hashed | |
[out] | ret_hash | a pointer to where the hash of element should be stored |
Definition at line 849 of file seti_api.c.
References ctx, GNUNET_SETI_Element::data, GNUNET_SETI_Element::element_type, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), and GNUNET_SETI_Element::size.
Referenced by handle_client_set_add().
struct GNUNET_SETU_Handle * GNUNET_SETU_create | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg | ) |
Create an empty set, supporting the specified operation.
cfg | configuration to use for connecting to the set service |
Definition at line 384 of file setu_api.c.
References cfg, GNUNET_CLIENT_connect(), GNUNET_free, GNUNET_MESSAGE_TYPE_SETU_CREATE, GNUNET_MESSAGE_TYPE_SETU_RESULT, GNUNET_MQ_handler_end, GNUNET_MQ_hd_var_size, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_new, handle_client_set_error(), GNUNET_SETU_Handle::mq, and result.
Referenced by run().
int GNUNET_SETU_add_element | ( | struct GNUNET_SETU_Handle * | set, |
const struct GNUNET_SETU_Element * | element, | ||
GNUNET_SCHEDULER_TaskCallback | cb, | ||
void * | cb_cls | ||
) |
Add an element to the given set.
set | set to add element to |
element | element to add to the set |
cb | function to call when finished, can be NULL |
cb_cls | closure for cb |
After the element has been added (in the sense of being transmitted to the set service), cont will be called. Multiple calls to GNUNET_SETU_add_element() can be queued.
set | set to add element to |
element | element to add to the set |
cb | continuation called after the element has been added |
cb_cls | closure for cb |
Definition at line 429 of file setu_api.c.
References GNUNET_SETU_Element::data, GNUNET_SETU_Element::element_type, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_memcpy, GNUNET_MESSAGE_TYPE_SETU_ADD, GNUNET_MQ_msg_extra, GNUNET_MQ_notify_sent(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SETU_Handle::invalid, LOG, GNUNET_SETU_Handle::mq, msg, and GNUNET_SETU_Element::size.
Referenced by publicize_rm().
void GNUNET_SETU_destroy | ( | struct GNUNET_SETU_Handle * | set | ) |
Destroy the set handle, and free all associated resources.
Operations may still be pending when a set is destroyed (and will be allowed to complete).
set | set to destroy |
Destroy the set handle, and free all associated resources.
set | set handle to destroy |
Definition at line 471 of file setu_api.c.
References GNUNET_SETU_Handle::destroy_requested, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_MQ_destroy(), GNUNET_SYSERR, GNUNET_YES, LOG, GNUNET_SETU_Handle::mq, and GNUNET_SETU_Handle::ops_head.
Referenced by GNUNET_SETU_operation_cancel(), handle_result(), and shutdown_task().
struct GNUNET_SETU_OperationHandle * GNUNET_SETU_prepare | ( | const struct GNUNET_PeerIdentity * | other_peer, |
const struct GNUNET_HashCode * | app_id, | ||
const struct GNUNET_MessageHeader * | context_msg, | ||
const struct GNUNET_SETU_Option | options[], | ||
GNUNET_SETU_ResultIterator | result_cb, | ||
void * | result_cls | ||
) |
Prepare a set operation to be evaluated with another peer.
The evaluation will not start until the client provides a local set with GNUNET_SETU_commit().
other_peer | peer with the other set |
app_id | hash for the application using the set |
context_msg | additional information for the request |
options | options to use when processing the request |
result_cb | called on error or success |
result_cls | closure for result_cb |
Definition at line 497 of file setu_api.c.
References GNUNET_SETU_EvaluateMessage::app_id, GNUNET_SETU_OperationHandle::conclude_mqm, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_MESSAGE_TYPE_SETU_EVALUATE, GNUNET_MQ_msg_nested_mh, GNUNET_new, GNUNET_SETU_OPTION_BYZANTINE, GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF, GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND, GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR, GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT, GNUNET_SETU_OPTION_FORCE_DELTA, GNUNET_SETU_OPTION_FORCE_FULL, GNUNET_SETU_OPTION_SYMMETRIC, GNUNET_YES, LOG, msg, options, GNUNET_SETU_OperationHandle::request_id_addr, GNUNET_SETU_OperationHandle::result_cb, and GNUNET_SETU_OperationHandle::result_cls.
Referenced by transmit_task_cb().
struct GNUNET_SETU_ListenHandle * GNUNET_SETU_listen | ( | const struct GNUNET_CONFIGURATION_Handle * | cfg, |
const struct GNUNET_HashCode * | app_id, | ||
GNUNET_SETU_ListenCallback | listen_cb, | ||
void * | listen_cls | ||
) |
Wait for set operation requests for the given application ID.
If the connection to the set service is lost, the listener is re-created transparently with exponential backoff.
cfg | configuration to use for connecting to the set service |
app_id | id of the application that handles set operation requests |
listen_cb | called for each incoming request matching the operation and application id |
listen_cls | handle for listen_cb |
Wait for set operation requests for the given application ID.
cfg | configuration to use for connecting to the set service, needs to be valid for the lifetime of the listen handle |
app_id | id of the application that handles set operation requests |
listen_cb | called for each incoming request matching the operation and application id |
listen_cls | handle for listen_cb |
Definition at line 717 of file setu_api.c.
References GNUNET_SETU_ListenHandle::app_id, cfg, GNUNET_SETU_ListenHandle::cfg, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_new, GNUNET_TIME_UNIT_MILLISECONDS, GNUNET_SETU_ListenHandle::listen_cb, listen_cb(), GNUNET_SETU_ListenHandle::listen_cls, listen_connect(), LOG, GNUNET_SETU_ListenHandle::mq, and GNUNET_SETU_ListenHandle::reconnect_backoff.
Referenced by run().
void GNUNET_SETU_listen_cancel | ( | struct GNUNET_SETU_ListenHandle * | lh | ) |
Cancel the given listen operation.
After calling cancel, the listen callback for this listen handle will not be called again. Note that cancelling a listen operation will automatically reject all operations that have not yet been accepted.
lh | handle for the listen operation |
lh | handle for the listen operation |
Definition at line 749 of file setu_api.c.
References GNUNET_SETU_ListenHandle::app_id, GNUNET_ERROR_TYPE_DEBUG, GNUNET_free, GNUNET_h2s(), GNUNET_MQ_destroy(), GNUNET_SCHEDULER_cancel(), LOG, GNUNET_SETU_ListenHandle::mq, and GNUNET_SETU_ListenHandle::reconnect_task.
Referenced by shutdown_task().
struct GNUNET_SETU_OperationHandle * GNUNET_SETU_accept | ( | struct GNUNET_SETU_Request * | request, |
const struct GNUNET_SETU_Option | options[], | ||
GNUNET_SETU_ResultIterator | result_cb, | ||
void * | result_cls | ||
) |
Accept a request we got via GNUNET_SETU_listen().
Must be called during GNUNET_SETU_listen(), as the struct GNUNET_SETU_Request
becomes invalid afterwards. Call GNUNET_SETU_commit() to provide the local set to use for the operation, and to begin the exchange with the remote peer.
request | request to accept |
options | options to use when processing the request |
result_cb | callback for the results |
result_cls | closure for result_cb |
Definition at line 769 of file setu_api.c.
References GNUNET_SETU_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_ERROR_TYPE_ERROR, GNUNET_MESSAGE_TYPE_SETU_ACCEPT, GNUNET_MQ_msg, GNUNET_new, GNUNET_NO, GNUNET_SETU_OPTION_BYZANTINE, GNUNET_SETU_OPTION_CUSTOM_BANDWIDTH_LATENCY_TRADEOFF, GNUNET_SETU_OPTION_CUSTOM_BYZANTINE_UPPER_BOUND, GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKET_NUMBER_FACTOR, GNUNET_SETU_OPTION_CUSTOM_IBF_BUCKETS_PER_ELEMENT, GNUNET_SETU_OPTION_FORCE_DELTA, GNUNET_SETU_OPTION_FORCE_FULL, GNUNET_SETU_OPTION_SYMMETRIC, GNUNET_YES, LOG, msg, options, request, GNUNET_SETU_OperationHandle::request_id_addr, GNUNET_SETU_OperationHandle::result_cb, and GNUNET_SETU_OperationHandle::result_cls.
Referenced by handle_revocation_union_request().
int GNUNET_SETU_commit | ( | struct GNUNET_SETU_OperationHandle * | oh, |
struct GNUNET_SETU_Handle * | set | ||
) |
Commit a set to be used with a set operation.
This function is called once we have fully constructed the set that we want to use for the operation. At this time, the P2P protocol can then begin to exchange the set information and call the result callback with the result information.
oh | handle to the set operation |
set | the set to use for the operation |
Definition at line 851 of file setu_api.c.
References GNUNET_SETU_OperationHandle::conclude_mqm, GNUNET_assert, GNUNET_break, GNUNET_CONTAINER_DLL_insert, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MQ_assoc_add(), GNUNET_MQ_send(), GNUNET_OK, GNUNET_SYSERR, GNUNET_YES, GNUNET_SETU_Handle::invalid, LOG, GNUNET_SETU_Handle::mq, GNUNET_SETU_Handle::ops_head, GNUNET_SETU_Handle::ops_tail, GNUNET_SETU_OperationHandle::request_id, GNUNET_SETU_OperationHandle::request_id_addr, and GNUNET_SETU_OperationHandle::set.
Referenced by handle_revocation_union_request().
void GNUNET_SETU_operation_cancel | ( | struct GNUNET_SETU_OperationHandle * | oh | ) |
Cancel the given set operation.
May not be called after the operation's GNUNET_SETU_ResultIterator
has been called with a status of GNUNET_SETU_STATUS_FAILURE or GNUNET_SETU_STATUS_DONE.
oh | set operation to cancel |
We need to send an explicit cancel message, as all operations one one set communicate using one handle.
oh | set operation to cancel |
Definition at line 320 of file setu_api.c.
References GNUNET_SETU_Handle::destroy_requested, GNUNET_ERROR_TYPE_DEBUG, GNUNET_MESSAGE_TYPE_SETU_CANCEL, GNUNET_MQ_msg, GNUNET_MQ_send(), GNUNET_SETU_destroy(), GNUNET_YES, LOG, m, GNUNET_SETU_Handle::mq, GNUNET_SETU_Handle::ops_head, GNUNET_SETU_OperationHandle::request_id, GNUNET_SETU_OperationHandle::set, and set_operation_destroy().
Referenced by handle_core_disconnect().
void GNUNET_SETU_element_hash | ( | const struct GNUNET_SETU_Element * | element, |
struct GNUNET_HashCode * | ret_hash | ||
) |
Hash a set element.
element | the element that should be hashed | |
[out] | ret_hash | a pointer to where the hash of element should be stored |
Definition at line 890 of file setu_api.c.
References ctx, GNUNET_SETU_Element::data, GNUNET_SETU_Element::element_type, GNUNET_CRYPTO_hash_context_finish(), GNUNET_CRYPTO_hash_context_read(), GNUNET_CRYPTO_hash_context_start(), and GNUNET_SETU_Element::size.
Referenced by handle_client_set_add(), handle_union_p2p_elements(), and handle_union_p2p_full_element().