aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_search.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-10-17 09:47:05 +0000
committerChristian Grothoff <christian@grothoff.org>2013-10-17 09:47:05 +0000
commit8f488ae652e52af47d5662666c016755132a72d7 (patch)
tree966016493bd9646e176f725eae1e395afe0ea8e6 /src/fs/fs_search.c
parentc289646ae19f0f64c4e270c172a51c6ce07eaa24 (diff)
downloadgnunet-8f488ae652e52af47d5662666c016755132a72d7.tar.gz
gnunet-8f488ae652e52af47d5662666c016755132a72d7.zip
-doxygen, etc
Diffstat (limited to 'src/fs/fs_search.c')
-rw-r--r--src/fs/fs_search.c76
1 files changed, 43 insertions, 33 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index bc3561856..fe99a9cf9 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -69,18 +69,19 @@ GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
69 69
70 70
71/** 71/**
72 * Check if the given result is identical 72 * Check if the given result is identical to the given URI.
73 * to the given URI.
74 * 73 *
75 * @param cls points to the URI we check against 74 * @param cls points to the URI we check against
76 * @param key not used 75 * @param key not used
77 * @param value a "struct GNUNET_FS_SearchResult" who's URI we 76 * @param value a `struct GNUNET_FS_SearchResult` who's URI we
78 * should compare with 77 * should compare with
79 * @return GNUNET_SYSERR if the result is present, 78 * @return #GNUNET_SYSERR if the result is present,
80 * GNUNET_OK otherwise 79 * #GNUNET_OK otherwise
81 */ 80 */
82static int 81static int
83test_result_present (void *cls, const struct GNUNET_HashCode * key, void *value) 82test_result_present (void *cls,
83 const struct GNUNET_HashCode * key,
84 void *value)
84{ 85{
85 const struct GNUNET_FS_Uri *uri = cls; 86 const struct GNUNET_FS_Uri *uri = cls;
86 struct GNUNET_FS_SearchResult *sr = value; 87 struct GNUNET_FS_SearchResult *sr = value;
@@ -163,11 +164,11 @@ struct GetResultContext
163 * Check if the given result is identical to the given URI and if so 164 * Check if the given result is identical to the given URI and if so
164 * return it. 165 * return it.
165 * 166 *
166 * @param cls a "struct GetResultContext" 167 * @param cls a `struct GetResultContext`
167 * @param key not used 168 * @param key not used
168 * @param value a "struct GNUNET_FS_SearchResult" who's URI we 169 * @param value a `struct GNUNET_FS_SearchResult` who's URI we
169 * should compare with 170 * should compare with
170 * @return GNUNET_OK 171 * @return #GNUNET_OK
171 */ 172 */
172static int 173static int
173get_result_present (void *cls, const struct GNUNET_HashCode * key, void *value) 174get_result_present (void *cls, const struct GNUNET_HashCode * key, void *value)
@@ -184,6 +185,8 @@ get_result_present (void *cls, const struct GNUNET_HashCode * key, void *value)
184/** 185/**
185 * Signal result of last probe to client and then schedule next 186 * Signal result of last probe to client and then schedule next
186 * probe. 187 * probe.
188 *
189 * @param sr search result to signal for
187 */ 190 */
188static void 191static void
189signal_probe_result (struct GNUNET_FS_SearchResult *sr) 192signal_probe_result (struct GNUNET_FS_SearchResult *sr)
@@ -209,7 +212,7 @@ signal_probe_result (struct GNUNET_FS_SearchResult *sr)
209/** 212/**
210 * Handle the case where we have failed to receive a response for our probe. 213 * Handle the case where we have failed to receive a response for our probe.
211 * 214 *
212 * @param cls our 'struct GNUNET_FS_SearchResult*' 215 * @param cls our `struct GNUNET_FS_SearchResult *`
213 * @param tc scheduler context 216 * @param tc scheduler context
214 */ 217 */
215static void 218static void
@@ -238,7 +241,7 @@ probe_failure_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
238/** 241/**
239 * Handle the case where we have gotten a response for our probe. 242 * Handle the case where we have gotten a response for our probe.
240 * 243 *
241 * @param cls our 'struct GNUNET_FS_SearchResult*' 244 * @param cls our `struct GNUNET_FS_SearchResult *`
242 * @param tc scheduler context 245 * @param tc scheduler context
243 */ 246 */
244static void 247static void
@@ -268,7 +271,7 @@ probe_success_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
268/** 271/**
269 * Notification of FS that a search probe has made progress. 272 * Notification of FS that a search probe has made progress.
270 * This function is used INSTEAD of the client's event handler 273 * This function is used INSTEAD of the client's event handler
271 * for downloads where the GNUNET_FS_DOWNLOAD_IS_PROBE flag is set. 274 * for downloads where the #GNUNET_FS_DOWNLOAD_IS_PROBE flag is set.
272 * 275 *
273 * @param cls closure, always NULL (!), actual closure 276 * @param cls closure, always NULL (!), actual closure
274 * is in the client-context of the info struct 277 * is in the client-context of the info struct
@@ -278,7 +281,7 @@ probe_success_handler (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
278 * for this operation; should be set to NULL for 281 * for this operation; should be set to NULL for
279 * SUSPEND and STOPPED events). The value returned 282 * SUSPEND and STOPPED events). The value returned
280 * will be passed to future callbacks in the respective 283 * will be passed to future callbacks in the respective
281 * field in the GNUNET_FS_ProgressInfo struct. 284 * field in the `struct GNUNET_FS_ProgressInfo`.
282 */ 285 */
283void * 286void *
284GNUNET_FS_search_probe_progress_ (void *cls, 287GNUNET_FS_search_probe_progress_ (void *cls,
@@ -499,7 +502,7 @@ GNUNET_FS_search_stop_probe_ (struct GNUNET_FS_SearchResult *sr)
499 502
500/** 503/**
501 * Stop probe activity. Must ONLY be used on values 504 * Stop probe activity. Must ONLY be used on values
502 * returned from 'GNUNET_FS_probe'. 505 * returned from #GNUNET_FS_probe.
503 * 506 *
504 * @param sr search result to stop probing for (freed) 507 * @param sr search result to stop probing for (freed)
505 * @return the value of the 'client_info' pointer 508 * @return the value of the 'client_info' pointer
@@ -527,7 +530,7 @@ GNUNET_FS_probe_stop (struct GNUNET_FS_SearchResult *sr)
527 * @param ent entry for the specific keyword 530 * @param ent entry for the specific keyword
528 * @param uri the URI that was found 531 * @param uri the URI that was found
529 * @param meta metadata associated with the URI 532 * @param meta metadata associated with the URI
530 * under the "ent" keyword 533 * under the @a ent keyword
531 */ 534 */
532static void 535static void
533process_ksk_result (struct GNUNET_FS_SearchContext *sc, 536process_ksk_result (struct GNUNET_FS_SearchContext *sc,
@@ -621,7 +624,8 @@ search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri,
621 * @param meta metadata associated with the URI 624 * @param meta metadata associated with the URI
622 */ 625 */
623static void 626static void
624process_sks_result (struct GNUNET_FS_SearchContext *sc, const char *id_update, 627process_sks_result (struct GNUNET_FS_SearchContext *sc,
628 const char *id_update,
625 const struct GNUNET_FS_Uri *uri, 629 const struct GNUNET_FS_Uri *uri,
626 const struct GNUNET_CONTAINER_MetaData *meta) 630 const struct GNUNET_CONTAINER_MetaData *meta)
627{ 631{
@@ -778,7 +782,7 @@ process_kblock (struct GNUNET_FS_SearchContext *sc,
778 * 782 *
779 * @param sc our search context 783 * @param sc our search context
780 * @param ub the ublock with a namespace result 784 * @param ub the ublock with a namespace result
781 * @param size size of sb 785 * @param size size of @a ub
782 */ 786 */
783static void 787static void
784process_sblock (struct GNUNET_FS_SearchContext *sc, 788process_sblock (struct GNUNET_FS_SearchContext *sc,
@@ -967,10 +971,10 @@ struct MessageBuilderContext
967 * Iterating over the known results, pick those matching the given 971 * Iterating over the known results, pick those matching the given
968 * result range and store their keys at 'xoff'. 972 * result range and store their keys at 'xoff'.
969 * 973 *
970 * @param cls the 'struct MessageBuilderContext' 974 * @param cls the `struct MessageBuilderContext`
971 * @param key key for a result 975 * @param key key for a result
972 * @param value the search result 976 * @param value the search result
973 * @return GNUNET_OK to continue iterating 977 * @return #GNUNET_OK to continue iterating
974 */ 978 */
975static int 979static int
976build_result_set (void *cls, const struct GNUNET_HashCode * key, void *value) 980build_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
@@ -1000,10 +1004,10 @@ build_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
1000 * matching the given result range and increment 1004 * matching the given result range and increment
1001 * put count for each. 1005 * put count for each.
1002 * 1006 *
1003 * @param cls the 'struct MessageBuilderContext' 1007 * @param cls the `struct MessageBuilderContext`
1004 * @param key key for a result 1008 * @param key key for a result
1005 * @param value the search result 1009 * @param value the search result
1006 * @return GNUNET_OK to continue iterating 1010 * @return #GNUNET_OK to continue iterating
1007 */ 1011 */
1008static int 1012static int
1009find_result_set (void *cls, const struct GNUNET_HashCode * key, void *value) 1013find_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
@@ -1024,9 +1028,9 @@ find_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
1024 * file-sharing service. Do it. 1028 * file-sharing service. Do it.
1025 * 1029 *
1026 * @param cls closure 1030 * @param cls closure
1027 * @param size number of bytes available in buf 1031 * @param size number of bytes available in @a buf
1028 * @param buf where the callee should write the message 1032 * @param buf where the callee should write the message
1029 * @return number of bytes written to buf 1033 * @return number of bytes written to @a buf
1030 */ 1034 */
1031static size_t 1035static size_t
1032transmit_search_request (void *cls, size_t size, void *buf) 1036transmit_search_request (void *cls, size_t size, void *buf)
@@ -1225,14 +1229,17 @@ try_reconnect (struct GNUNET_FS_SearchContext *sc)
1225 * @return context that can be used to control the search 1229 * @return context that can be used to control the search
1226 */ 1230 */
1227static struct GNUNET_FS_SearchContext * 1231static struct GNUNET_FS_SearchContext *
1228search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri, 1232search_start (struct GNUNET_FS_Handle *h,
1229 uint32_t anonymity, enum GNUNET_FS_SearchOptions options, 1233 const struct GNUNET_FS_Uri *uri,
1230 void *cctx, struct GNUNET_FS_SearchResult *psearch) 1234 uint32_t anonymity,
1235 enum GNUNET_FS_SearchOptions options,
1236 void *cctx,
1237 struct GNUNET_FS_SearchResult *psearch)
1231{ 1238{
1232 struct GNUNET_FS_SearchContext *sc; 1239 struct GNUNET_FS_SearchContext *sc;
1233 struct GNUNET_FS_ProgressInfo pi; 1240 struct GNUNET_FS_ProgressInfo pi;
1234 1241
1235 sc = GNUNET_malloc (sizeof (struct GNUNET_FS_SearchContext)); 1242 sc = GNUNET_new (struct GNUNET_FS_SearchContext);
1236 sc->h = h; 1243 sc->h = h;
1237 sc->options = options; 1244 sc->options = options;
1238 sc->uri = GNUNET_FS_uri_dup (uri); 1245 sc->uri = GNUNET_FS_uri_dup (uri);
@@ -1264,7 +1271,7 @@ search_start (struct GNUNET_FS_Handle *h, const struct GNUNET_FS_Uri *uri,
1264 * GNUnet FS service. 1271 * GNUnet FS service.
1265 * 1272 *
1266 * @param sc search context 1273 * @param sc search context
1267 * @return GNUNET_OK on success, GNUNET_SYSERR on error 1274 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
1268 */ 1275 */
1269int 1276int
1270GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) 1277GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
@@ -1316,7 +1323,7 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1316 * @param cls the global FS handle 1323 * @param cls the global FS handle
1317 * @param key the key for the search result (unused) 1324 * @param key the key for the search result (unused)
1318 * @param value the search result to free 1325 * @param value the search result to free
1319 * @return GNUNET_OK 1326 * @return #GNUNET_OK
1320 */ 1327 */
1321static int 1328static int
1322search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key, 1329search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key,
@@ -1351,10 +1358,11 @@ search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key,
1351 * @param cls the global FS handle 1358 * @param cls the global FS handle
1352 * @param key the key for the search result (unused) 1359 * @param key the key for the search result (unused)
1353 * @param value the search result to free 1360 * @param value the search result to free
1354 * @return GNUNET_OK 1361 * @return #GNUNET_OK
1355 */ 1362 */
1356static int 1363static int
1357search_result_resume_probes (void *cls, const struct GNUNET_HashCode * key, 1364search_result_resume_probes (void *cls,
1365 const struct GNUNET_HashCode * key,
1358 void *value) 1366 void *value)
1359{ 1367{
1360 struct GNUNET_FS_SearchResult *sr = value; 1368 struct GNUNET_FS_SearchResult *sr = value;
@@ -1372,10 +1380,12 @@ search_result_resume_probes (void *cls, const struct GNUNET_HashCode * key,
1372 * @param cls the global FS handle 1380 * @param cls the global FS handle
1373 * @param key the key for the search result (unused) 1381 * @param key the key for the search result (unused)
1374 * @param value the search result to free 1382 * @param value the search result to free
1375 * @return GNUNET_OK 1383 * @return #GNUNET_OK
1376 */ 1384 */
1377static int 1385static int
1378search_result_suspend (void *cls, const struct GNUNET_HashCode * key, void *value) 1386search_result_suspend (void *cls,
1387 const struct GNUNET_HashCode * key,
1388 void *value)
1379{ 1389{
1380 struct GNUNET_FS_SearchContext *sc = cls; 1390 struct GNUNET_FS_SearchContext *sc = cls;
1381 struct GNUNET_FS_SearchResult *sr = value; 1391 struct GNUNET_FS_SearchResult *sr = value;