diff options
author | Christian Grothoff <christian@grothoff.org> | 2011-02-08 22:57:06 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2011-02-08 22:57:06 +0000 |
commit | 6cf52d591c8a72c1fd5b71850e3abe85ffe3433a (patch) | |
tree | abc4def5826a72aee5dfeefa55b6b378e77b525b /src | |
parent | eda4a5ba9aadcbf554f511c58db8bc51f0638d71 (diff) | |
download | gnunet-6cf52d591c8a72c1fd5b71850e3abe85ffe3433a.tar.gz gnunet-6cf52d591c8a72c1fd5b71850e3abe85ffe3433a.zip |
stuff
Diffstat (limited to 'src')
-rw-r--r-- | src/fs/gnunet-service-fs_pr.c | 34 | ||||
-rw-r--r-- | src/fs/gnunet-service-fs_pr.h | 53 |
2 files changed, 85 insertions, 2 deletions
diff --git a/src/fs/gnunet-service-fs_pr.c b/src/fs/gnunet-service-fs_pr.c index 343ec3ada..ad19a807e 100644 --- a/src/fs/gnunet-service-fs_pr.c +++ b/src/fs/gnunet-service-fs_pr.c | |||
@@ -28,6 +28,38 @@ | |||
28 | 28 | ||
29 | 29 | ||
30 | /** | 30 | /** |
31 | * An active request. | ||
32 | */ | ||
33 | struct GSF_PendingRequest | ||
34 | { | ||
35 | /** | ||
36 | * Public data for the request. | ||
37 | */ | ||
38 | struct GSF_PendingRequestData public_data; | ||
39 | |||
40 | GSF_PendingRequestReplyHandler rh; | ||
41 | |||
42 | void *rh_cls; | ||
43 | |||
44 | const GNUNET_HashCode *replies_seen; | ||
45 | |||
46 | struct GNUNET_CONTAINER_BloomFilter *bf; | ||
47 | |||
48 | unsigned int replies_seen_count; | ||
49 | |||
50 | int32_t mingle; | ||
51 | |||
52 | }; | ||
53 | |||
54 | |||
55 | /** | ||
56 | * All pending requests, ordered by the query. Entries | ||
57 | * are of type 'struct GSF_PendingRequest*'. | ||
58 | */ | ||
59 | static struct GNUNET_CONTAINER_MultiHashMap *requests; | ||
60 | |||
61 | |||
62 | /** | ||
31 | * Create a new pending request. | 63 | * Create a new pending request. |
32 | * | 64 | * |
33 | * @param options request options | 65 | * @param options request options |
@@ -51,7 +83,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, | |||
51 | const GNUNET_HashCode *query, | 83 | const GNUNET_HashCode *query, |
52 | const GNUNET_HashCode *namespace, | 84 | const GNUNET_HashCode *namespace, |
53 | const struct GNUNET_PeerIdentity *target, | 85 | const struct GNUNET_PeerIdentity *target, |
54 | struct GNUNET_CONTAINER_BloomFilter *bf, | 86 | const struct GNUNET_CONTAINER_BloomFilter *bf, |
55 | int32_t mingle, | 87 | int32_t mingle, |
56 | uint32_t anonymity_level, | 88 | uint32_t anonymity_level, |
57 | uint32_t priority, | 89 | uint32_t priority, |
diff --git a/src/fs/gnunet-service-fs_pr.h b/src/fs/gnunet-service-fs_pr.h index ee5124a90..5fb9d2a5a 100644 --- a/src/fs/gnunet-service-fs_pr.h +++ b/src/fs/gnunet-service-fs_pr.h | |||
@@ -63,10 +63,61 @@ enum GSF_PendingRequestOptions | |||
63 | * Option mask for typical local requests. | 63 | * Option mask for typical local requests. |
64 | */ | 64 | */ |
65 | GSF_PRO_LOCAL_REQUEST = (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) | 65 | GSF_PRO_LOCAL_REQUEST = (GSF_PRO_BLOOMFILTER_FULL_REFRESH | GSF_PRO_PRIORITY_UNLIMITED) |
66 | |||
66 | }; | 67 | }; |
67 | 68 | ||
68 | 69 | ||
69 | /** | 70 | /** |
71 | * Public data associated with each pending request. | ||
72 | */ | ||
73 | struct GSF_PendingRequestData | ||
74 | { | ||
75 | |||
76 | /** | ||
77 | * Primary query hash for this request. | ||
78 | */ | ||
79 | GNUNET_HashCode query; | ||
80 | |||
81 | /** | ||
82 | * Namespace to query, only set if the type is SBLOCK. | ||
83 | */ | ||
84 | GNUNET_HashCode namespace; | ||
85 | |||
86 | /** | ||
87 | * Identity of a peer hosting the content, only set if | ||
88 | * 'has_target' is GNUNET_YES. | ||
89 | */ | ||
90 | struct GNUNET_PeerIdentity target; | ||
91 | |||
92 | /** | ||
93 | * Desired anonymity level. | ||
94 | */ | ||
95 | uint32_t anonymity_level; | ||
96 | |||
97 | /** | ||
98 | * Priority that this request (still) has for us. | ||
99 | */ | ||
100 | uint32_t priority; | ||
101 | |||
102 | /** | ||
103 | * Options for the request. | ||
104 | */ | ||
105 | enum GSF_PendingRequestOptions options; | ||
106 | |||
107 | /** | ||
108 | * Type of the requested block. | ||
109 | */ | ||
110 | enum GNUNET_BLOCK_Type type; | ||
111 | |||
112 | /** | ||
113 | * Is the 'target' value set to a valid peer identity? | ||
114 | */ | ||
115 | int has_target; | ||
116 | |||
117 | }; | ||
118 | |||
119 | |||
120 | /** | ||
70 | * Handle a reply to a pending request. Also called if a request | 121 | * Handle a reply to a pending request. Also called if a request |
71 | * expires (then with data == NULL). The handler may be called | 122 | * expires (then with data == NULL). The handler may be called |
72 | * many times (depending on the request type), but will not be | 123 | * many times (depending on the request type), but will not be |
@@ -109,7 +160,7 @@ GSF_pending_request_create_ (enum GSF_PendingRequestOptions options, | |||
109 | const GNUNET_HashCode *query, | 160 | const GNUNET_HashCode *query, |
110 | const GNUNET_HashCode *namespace, | 161 | const GNUNET_HashCode *namespace, |
111 | const struct GNUNET_PeerIdentity *target, | 162 | const struct GNUNET_PeerIdentity *target, |
112 | struct GNUNET_CONTAINER_BloomFilter *bf, | 163 | const struct GNUNET_CONTAINER_BloomFilter *bf, |
113 | int32_t mingle, | 164 | int32_t mingle, |
114 | uint32_t anonymity_level, | 165 | uint32_t anonymity_level, |
115 | uint32_t priority, | 166 | uint32_t priority, |