aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_search.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fs/fs_search.c')
-rw-r--r--src/fs/fs_search.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c
index adbb85dc0..542d8f2e9 100644
--- a/src/fs/fs_search.c
+++ b/src/fs/fs_search.c
@@ -74,7 +74,7 @@ GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi,
74 * GNUNET_OK otherwise 74 * GNUNET_OK otherwise
75 */ 75 */
76static int 76static int
77test_result_present (void *cls, const GNUNET_HashCode * key, void *value) 77test_result_present (void *cls, const struct GNUNET_HashCode * key, void *value)
78{ 78{
79 const struct GNUNET_FS_Uri *uri = cls; 79 const struct GNUNET_FS_Uri *uri = cls;
80 struct GNUNET_FS_SearchResult *sr = value; 80 struct GNUNET_FS_SearchResult *sr = value;
@@ -162,7 +162,7 @@ struct GetResultContext
162 * @return GNUNET_OK 162 * @return GNUNET_OK
163 */ 163 */
164static int 164static int
165get_result_present (void *cls, const GNUNET_HashCode * key, void *value) 165get_result_present (void *cls, const struct GNUNET_HashCode * key, void *value)
166{ 166{
167 struct GetResultContext *grc = cls; 167 struct GetResultContext *grc = cls;
168 struct GNUNET_FS_SearchResult *sr = value; 168 struct GNUNET_FS_SearchResult *sr = value;
@@ -388,7 +388,7 @@ process_ksk_result (struct GNUNET_FS_SearchContext *sc,
388 const struct GNUNET_FS_Uri *uri, 388 const struct GNUNET_FS_Uri *uri,
389 const struct GNUNET_CONTAINER_MetaData *meta) 389 const struct GNUNET_CONTAINER_MetaData *meta)
390{ 390{
391 GNUNET_HashCode key; 391 struct GNUNET_HashCode key;
392 struct GNUNET_FS_SearchResult *sr; 392 struct GNUNET_FS_SearchResult *sr;
393 struct GetResultContext grc; 393 struct GetResultContext grc;
394 int is_new; 394 int is_new;
@@ -477,7 +477,7 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc, const char *id_update,
477 const struct GNUNET_CONTAINER_MetaData *meta) 477 const struct GNUNET_CONTAINER_MetaData *meta)
478{ 478{
479 struct GNUNET_FS_Uri uu; 479 struct GNUNET_FS_Uri uu;
480 GNUNET_HashCode key; 480 struct GNUNET_HashCode key;
481 struct GNUNET_FS_SearchResult *sr; 481 struct GNUNET_FS_SearchResult *sr;
482 482
483 /* check if new */ 483 /* check if new */
@@ -533,7 +533,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
533 size_t edata_size, 533 size_t edata_size,
534 char *data) 534 char *data)
535{ 535{
536 GNUNET_HashCode q; 536 struct GNUNET_HashCode q;
537 struct GNUNET_CRYPTO_AesSessionKey skey; 537 struct GNUNET_CRYPTO_AesSessionKey skey;
538 struct GNUNET_CRYPTO_AesInitializationVector iv; 538 struct GNUNET_CRYPTO_AesInitializationVector iv;
539 int i; 539 int i;
@@ -543,7 +543,7 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
543 &q); 543 &q);
544 /* find key */ 544 /* find key */
545 for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) 545 for (i = 0; i < sc->uri->data.ksk.keywordCount; i++)
546 if (0 == memcmp (&q, &sc->requests[i].query, sizeof (GNUNET_HashCode))) 546 if (0 == memcmp (&q, &sc->requests[i].query, sizeof (struct GNUNET_HashCode)))
547 break; 547 break;
548 if (i == sc->uri->data.ksk.keywordCount) 548 if (i == sc->uri->data.ksk.keywordCount)
549 { 549 {
@@ -708,7 +708,7 @@ process_sblock (struct GNUNET_FS_SearchContext *sc, const struct SBlock *sb,
708 const char *uris; 708 const char *uris;
709 size_t off; 709 size_t off;
710 char *emsg; 710 char *emsg;
711 GNUNET_HashCode key; 711 struct GNUNET_HashCode key;
712 char *identifier; 712 char *identifier;
713 713
714 /* decrypt */ 714 /* decrypt */
@@ -904,7 +904,7 @@ struct MessageBuilderContext
904 /** 904 /**
905 * Where to store the keys. 905 * Where to store the keys.
906 */ 906 */
907 GNUNET_HashCode *xoff; 907 struct GNUNET_HashCode *xoff;
908 908
909 /** 909 /**
910 * Search context we are iterating for. 910 * Search context we are iterating for.
@@ -928,7 +928,7 @@ struct MessageBuilderContext
928 * @return GNUNET_OK to continue iterating 928 * @return GNUNET_OK to continue iterating
929 */ 929 */
930static int 930static int
931build_result_set (void *cls, const GNUNET_HashCode * key, void *value) 931build_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
932{ 932{
933 struct MessageBuilderContext *mbc = cls; 933 struct MessageBuilderContext *mbc = cls;
934 struct GNUNET_FS_SearchResult *sr = value; 934 struct GNUNET_FS_SearchResult *sr = value;
@@ -960,7 +960,7 @@ build_result_set (void *cls, const GNUNET_HashCode * key, void *value)
960 * @return GNUNET_OK to continue iterating 960 * @return GNUNET_OK to continue iterating
961 */ 961 */
962static int 962static int
963find_result_set (void *cls, const GNUNET_HashCode * key, void *value) 963find_result_set (void *cls, const struct GNUNET_HashCode * key, void *value)
964{ 964{
965 struct MessageBuilderContext *mbc = cls; 965 struct MessageBuilderContext *mbc = cls;
966 struct GNUNET_FS_SearchResult *sr = value; 966 struct GNUNET_FS_SearchResult *sr = value;
@@ -990,8 +990,8 @@ transmit_search_request (void *cls, size_t size, void *buf)
990 size_t msize; 990 size_t msize;
991 struct SearchMessage *sm; 991 struct SearchMessage *sm;
992 const char *identifier; 992 const char *identifier;
993 GNUNET_HashCode key; 993 struct GNUNET_HashCode key;
994 GNUNET_HashCode idh; 994 struct GNUNET_HashCode idh;
995 unsigned int sqms; 995 unsigned int sqms;
996 uint32_t options; 996 uint32_t options;
997 997
@@ -1004,7 +1004,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
1004 mbc.skip_cnt = sc->search_request_map_offset; 1004 mbc.skip_cnt = sc->search_request_map_offset;
1005 sm = buf; 1005 sm = buf;
1006 sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH); 1006 sm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_START_SEARCH);
1007 mbc.xoff = (GNUNET_HashCode *) & sm[1]; 1007 mbc.xoff = (struct GNUNET_HashCode *) & sm[1];
1008 options = SEARCH_MESSAGE_OPTION_NONE; 1008 options = SEARCH_MESSAGE_OPTION_NONE;
1009 if (0 != (sc->options & GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY)) 1009 if (0 != (sc->options & GNUNET_FS_SEARCH_OPTION_LOOPBACK_ONLY))
1010 options |= SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY; 1010 options |= SEARCH_MESSAGE_OPTION_LOOPBACK_ONLY;
@@ -1017,7 +1017,7 @@ transmit_search_request (void *cls, size_t size, void *buf)
1017 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map, 1017 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
1018 &find_result_set, &mbc); 1018 &find_result_set, &mbc);
1019 sqms = mbc.put_cnt; 1019 sqms = mbc.put_cnt;
1020 mbc.put_cnt = (size - msize) / sizeof (GNUNET_HashCode); 1020 mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode);
1021 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt); 1021 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
1022 if (sc->search_request_map_offset < sqms) 1022 if (sc->search_request_map_offset < sqms)
1023 GNUNET_assert (mbc.put_cnt > 0); 1023 GNUNET_assert (mbc.put_cnt > 0);
@@ -1025,9 +1025,9 @@ transmit_search_request (void *cls, size_t size, void *buf)
1025 sm->header.size = htons (msize); 1025 sm->header.size = htons (msize);
1026 sm->type = htonl (GNUNET_BLOCK_TYPE_ANY); 1026 sm->type = htonl (GNUNET_BLOCK_TYPE_ANY);
1027 sm->anonymity_level = htonl (sc->anonymity); 1027 sm->anonymity_level = htonl (sc->anonymity);
1028 memset (&sm->target, 0, sizeof (GNUNET_HashCode)); 1028 memset (&sm->target, 0, sizeof (struct GNUNET_HashCode));
1029 sm->query = sc->requests[sc->keyword_offset].query; 1029 sm->query = sc->requests[sc->keyword_offset].query;
1030 msize += sizeof (GNUNET_HashCode) * mbc.put_cnt; 1030 msize += sizeof (struct GNUNET_HashCode) * mbc.put_cnt;
1031 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map, 1031 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
1032 &build_result_set, &mbc); 1032 &build_result_set, &mbc);
1033 sm->header.size = htons (msize); 1033 sm->header.size = htons (msize);
@@ -1058,15 +1058,15 @@ transmit_search_request (void *cls, size_t size, void *buf)
1058 sm->target = sc->uri->data.sks.namespace; 1058 sm->target = sc->uri->data.sks.namespace;
1059 identifier = sc->uri->data.sks.identifier; 1059 identifier = sc->uri->data.sks.identifier;
1060 GNUNET_CRYPTO_hash (identifier, strlen (identifier), &key); 1060 GNUNET_CRYPTO_hash (identifier, strlen (identifier), &key);
1061 GNUNET_CRYPTO_hash (&key, sizeof (GNUNET_HashCode), &idh); 1061 GNUNET_CRYPTO_hash (&key, sizeof (struct GNUNET_HashCode), &idh);
1062 GNUNET_CRYPTO_hash_xor (&idh, &sm->target, &sm->query); 1062 GNUNET_CRYPTO_hash_xor (&idh, &sm->target, &sm->query);
1063 mbc.put_cnt = (size - msize) / sizeof (GNUNET_HashCode); 1063 mbc.put_cnt = (size - msize) / sizeof (struct GNUNET_HashCode);
1064 sqms = GNUNET_CONTAINER_multihashmap_size (sc->master_result_map); 1064 sqms = GNUNET_CONTAINER_multihashmap_size (sc->master_result_map);
1065 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt); 1065 mbc.put_cnt = GNUNET_MIN (mbc.put_cnt, sqms - mbc.skip_cnt);
1066 mbc.keyword_offset = 0; 1066 mbc.keyword_offset = 0;
1067 if (sc->search_request_map_offset < sqms) 1067 if (sc->search_request_map_offset < sqms)
1068 GNUNET_assert (mbc.put_cnt > 0); 1068 GNUNET_assert (mbc.put_cnt > 0);
1069 msize += sizeof (GNUNET_HashCode) * mbc.put_cnt; 1069 msize += sizeof (struct GNUNET_HashCode) * mbc.put_cnt;
1070 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map, 1070 GNUNET_CONTAINER_multihashmap_iterate (sc->master_result_map,
1071 &build_result_set, &mbc); 1071 &build_result_set, &mbc);
1072 sm->header.size = htons (msize); 1072 sm->header.size = htons (msize);
@@ -1103,9 +1103,9 @@ schedule_transmit_search_request (struct GNUNET_FS_SearchContext *sc)
1103 sqms = 1103 sqms =
1104 GNUNET_CONTAINER_multihashmap_size (sc->master_result_map) - 1104 GNUNET_CONTAINER_multihashmap_size (sc->master_result_map) -
1105 sc->search_request_map_offset; 1105 sc->search_request_map_offset;
1106 fit = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - size) / sizeof (GNUNET_HashCode); 1106 fit = (GNUNET_SERVER_MAX_MESSAGE_SIZE - 1 - size) / sizeof (struct GNUNET_HashCode);
1107 fit = GNUNET_MIN (fit, sqms); 1107 fit = GNUNET_MIN (fit, sqms);
1108 size += sizeof (GNUNET_HashCode) * fit; 1108 size += sizeof (struct GNUNET_HashCode) * fit;
1109 GNUNET_CLIENT_notify_transmit_ready (sc->client, size, 1109 GNUNET_CLIENT_notify_transmit_ready (sc->client, size,
1110 GNUNET_CONSTANTS_SERVICE_TIMEOUT, 1110 GNUNET_CONSTANTS_SERVICE_TIMEOUT,
1111 GNUNET_NO, &transmit_search_request, sc); 1111 GNUNET_NO, &transmit_search_request, sc);
@@ -1220,7 +1220,7 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1220{ 1220{
1221 unsigned int i; 1221 unsigned int i;
1222 const char *keyword; 1222 const char *keyword;
1223 GNUNET_HashCode hc; 1223 struct GNUNET_HashCode hc;
1224 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub; 1224 struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
1225 struct GNUNET_CRYPTO_RsaPrivateKey *pk; 1225 struct GNUNET_CRYPTO_RsaPrivateKey *pk;
1226 1226
@@ -1267,7 +1267,7 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc)
1267 * @return GNUNET_OK 1267 * @return GNUNET_OK
1268 */ 1268 */
1269static int 1269static int
1270search_result_freeze_probes (void *cls, const GNUNET_HashCode * key, 1270search_result_freeze_probes (void *cls, const struct GNUNET_HashCode * key,
1271 void *value) 1271 void *value)
1272{ 1272{
1273 struct GNUNET_FS_SearchResult *sr = value; 1273 struct GNUNET_FS_SearchResult *sr = value;
@@ -1297,7 +1297,7 @@ search_result_freeze_probes (void *cls, const GNUNET_HashCode * key,
1297 * @return GNUNET_OK 1297 * @return GNUNET_OK
1298 */ 1298 */
1299static int 1299static int
1300search_result_resume_probes (void *cls, const GNUNET_HashCode * key, 1300search_result_resume_probes (void *cls, const struct GNUNET_HashCode * key,
1301 void *value) 1301 void *value)
1302{ 1302{
1303 struct GNUNET_FS_SearchResult *sr = value; 1303 struct GNUNET_FS_SearchResult *sr = value;
@@ -1318,7 +1318,7 @@ search_result_resume_probes (void *cls, const GNUNET_HashCode * key,
1318 * @return GNUNET_OK 1318 * @return GNUNET_OK
1319 */ 1319 */
1320static int 1320static int
1321search_result_suspend (void *cls, const GNUNET_HashCode * key, void *value) 1321search_result_suspend (void *cls, const struct GNUNET_HashCode * key, void *value)
1322{ 1322{
1323 struct GNUNET_FS_SearchContext *sc = cls; 1323 struct GNUNET_FS_SearchContext *sc = cls;
1324 struct GNUNET_FS_SearchResult *sr = value; 1324 struct GNUNET_FS_SearchResult *sr = value;
@@ -1477,7 +1477,7 @@ GNUNET_FS_search_continue (struct GNUNET_FS_SearchContext *sc)
1477 * @return GNUNET_OK 1477 * @return GNUNET_OK
1478 */ 1478 */
1479static int 1479static int
1480search_result_stop (void *cls, const GNUNET_HashCode * key, void *value) 1480search_result_stop (void *cls, const struct GNUNET_HashCode * key, void *value)
1481{ 1481{
1482 struct GNUNET_FS_SearchContext *sc = cls; 1482 struct GNUNET_FS_SearchContext *sc = cls;
1483 struct GNUNET_FS_SearchResult *sr = value; 1483 struct GNUNET_FS_SearchResult *sr = value;
@@ -1530,7 +1530,7 @@ search_result_stop (void *cls, const GNUNET_HashCode * key, void *value)
1530 * @return GNUNET_OK 1530 * @return GNUNET_OK
1531 */ 1531 */
1532static int 1532static int
1533search_result_free (void *cls, const GNUNET_HashCode * key, void *value) 1533search_result_free (void *cls, const struct GNUNET_HashCode * key, void *value)
1534{ 1534{
1535 struct GNUNET_FS_SearchResult *sr = value; 1535 struct GNUNET_FS_SearchResult *sr = value;
1536 1536