X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=src%2Ffs%2Fgnunet-service-fs_pr.h;h=b68989be7a22613e373312f25a2e62e44ece5999;hb=16a6919a9f98ee9fa1fee9dd262906c321004a19;hp=5759bee4af0dc1a3e234a4631be6f9f028fcf311;hpb=562b33143ee9fa431a68ea6741e4feb3ba388f83;p=oweals%2Fgnunet.git diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index 5759bee4a..b68989be7 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h @@ -33,38 +33,38 @@ * Options for pending requests (bits to be ORed). */ enum GSF_PendingRequestOptions - { +{ /** * Request must only be processed locally. */ - GSF_PRO_LOCAL_ONLY = 1, - + GSF_PRO_LOCAL_ONLY = 1, + /** * Request must only be forwarded (no routing) */ - GSF_PRO_FORWARD_ONLY = 2, + GSF_PRO_FORWARD_ONLY = 2, /** * Request persists indefinitely (no expiration). */ - GSF_PRO_REQUEST_EXPIRES = 4, + GSF_PRO_REQUEST_EXPIRES = 4, /** * Request is allowed to refresh bloomfilter and change mingle value. */ - GSF_PRO_BLOOMFILTER_FULL_REFRESH = 8, + GSF_PRO_BLOOMFILTER_FULL_REFRESH = 8, /** * Request priority is allowed to be exceeded. */ - GSF_PRO_PRIORITY_UNLIMITED = 16, + GSF_PRO_PRIORITY_UNLIMITED = 16, /** * Option mask for typical local requests. */ - GSF_PRO_LOCAL_REQUEST = (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) - - }; + GSF_PRO_LOCAL_REQUEST = + (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) +}; /** @@ -84,7 +84,7 @@ struct GSF_PendingRequestData * Namespace to query, only set if the type is SBLOCK. */ GNUNET_HashCode namespace; - + /** * Identity of a peer hosting the content, only set if * 'has_target' is GNUNET_YES. @@ -94,12 +94,12 @@ struct GSF_PendingRequestData /** * Fields for the plan module to track a DLL with the request. */ - struct GSF_RequestPlan *rp_head; + struct GSF_RequestPlanReference *rpr_head; /** * Fields for the plan module to track a DLL with the request. */ - struct GSF_RequestPlan *rp_tail; + struct GSF_RequestPlanReference *rpr_tail; /** * Current TTL for the request. @@ -130,7 +130,7 @@ struct GSF_PendingRequestData * Options for the request. */ enum GSF_PendingRequestOptions options; - + /** * Type of the requested block. */ @@ -158,20 +158,25 @@ struct GSF_PendingRequestData * expiration. * * @param cls user-specified closure + * @param eval evaluation of the result * @param pr handle to the original pending request + * @param reply_anonymity_level anonymity level for the reply, UINT32_MAX for "unknown" * @param expiration when does 'data' expire? + * @param type type of the block * @param data response data, NULL on request expiration * @param data_len number of bytes in data - * @param more GNUNET_YES if the request remains active (may call - * this function again), GNUNET_NO if the request is - * finished (client must not call GSF_pending_request_cancel_) */ -typedef void (*GSF_PendingRequestReplyHandler)(void *cls, - struct GSF_PendingRequest *pr, - struct GNUNET_TIME_Absolute expiration, - const void *data, - size_t data_len, - int more); +typedef void (*GSF_PendingRequestReplyHandler) (void *cls, + enum + GNUNET_BLOCK_EvaluationResult + eval, + struct GSF_PendingRequest * pr, + uint32_t reply_anonymity_level, + struct GNUNET_TIME_Absolute + expiration, + enum GNUNET_BLOCK_Type type, + const void *data, + size_t data_len); /** @@ -198,21 +203,17 @@ typedef void (*GSF_PendingRequestReplyHandler)(void *cls, */ struct GSF_PendingRequest * GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, - enum GNUNET_BLOCK_Type type, - const GNUNET_HashCode *query, - const GNUNET_HashCode *namespace, - const struct GNUNET_PeerIdentity *target, - const char *bf_data, - size_t bf_size, - uint32_t mingle, - uint32_t anonymity_level, - uint32_t priority, - int32_t ttl, - GNUNET_PEER_Id sender_pid, - const GNUNET_HashCode *replies_seen, - unsigned int replies_seen_count, - GSF_PendingRequestReplyHandler rh, - void *rh_cls); + enum GNUNET_BLOCK_Type type, + const GNUNET_HashCode * query, + const GNUNET_HashCode * namespace, + const struct GNUNET_PeerIdentity *target, + const char *bf_data, size_t bf_size, + uint32_t mingle, uint32_t anonymity_level, + uint32_t priority, int32_t ttl, + GNUNET_PEER_Id sender_pid, + const GNUNET_HashCode * replies_seen, + unsigned int replies_seen_count, + GSF_PendingRequestReplyHandler rh, void *rh_cls); /** @@ -225,8 +226,8 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, */ void GSF_pending_request_update_ (struct GSF_PendingRequest *pr, - const GNUNET_HashCode *replies_seen, - unsigned int replies_seen_count); + const GNUNET_HashCode * replies_seen, + unsigned int replies_seen_count); /** @@ -239,6 +240,20 @@ struct GSF_PendingRequestData * GSF_pending_request_get_data_ (struct GSF_PendingRequest *pr); +/** + * Test if two pending requests are compatible (would generate + * the same query modulo filters and should thus be processed + * jointly). + * + * @param pra a pending request + * @param pra another pending request + * @return GNUNET_OK if the requests are compatible + */ +int +GSF_pending_request_is_compatible_ (struct GSF_PendingRequest *pra, + struct GSF_PendingRequest *prb); + + /** * Generate the message corresponding to the given pending request for * transmission to other peers (or at least determine its size). @@ -250,17 +265,17 @@ GSF_pending_request_get_data_ (struct GSF_PendingRequest *pr); */ size_t GSF_pending_request_get_message_ (struct GSF_PendingRequest *pr, - size_t buf_size, - void *buf); + size_t buf_size, void *buf); /** * Explicitly cancel a pending request. * * @param pr request to cancel + * @param full_cleanup fully purge the request */ void -GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr); +GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr, int full_cleanup); /** @@ -272,9 +287,9 @@ GSF_pending_request_cancel_ (struct GSF_PendingRequest *pr); * @param pr handle to the pending request * @return GNUNET_YES to continue to iterate */ -typedef int (*GSF_PendingRequestIterator)(void *cls, - const GNUNET_HashCode *key, - struct GSF_PendingRequest *pr); +typedef int (*GSF_PendingRequestIterator) (void *cls, + const GNUNET_HashCode * key, + struct GSF_PendingRequest * pr); /** @@ -284,8 +299,7 @@ typedef int (*GSF_PendingRequestIterator)(void *cls, * @param cls closure for it */ void -GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, - void *cls); +GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, void *cls); /** @@ -303,7 +317,7 @@ GSF_iterate_pending_requests_ (GSF_PendingRequestIterator it, */ int GSF_handle_p2p_content_ (struct GSF_ConnectedPeer *cp, - const struct GNUNET_MessageHeader *message); + const struct GNUNET_MessageHeader *message); /** @@ -323,9 +337,10 @@ GSF_dht_lookup_ (struct GSF_PendingRequest *pr); * @param pr the pending request we were processing * @param result final datastore lookup result */ -typedef void (*GSF_LocalLookupContinuation)(void *cls, - struct GSF_PendingRequest *pr, - enum GNUNET_BLOCK_EvaluationResult result); +typedef void (*GSF_LocalLookupContinuation) (void *cls, + struct GSF_PendingRequest * pr, + enum GNUNET_BLOCK_EvaluationResult + result); /** @@ -337,14 +352,11 @@ typedef void (*GSF_LocalLookupContinuation)(void *cls, */ void GSF_local_lookup_ (struct GSF_PendingRequest *pr, - GSF_LocalLookupContinuation cont, - void *cont_cls); + GSF_LocalLookupContinuation cont, void *cont_cls); /** * Setup the subsystem. - * - * @param cfg configuration to use */ void GSF_pending_request_init_ (void);