diff options
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r-- | src/fs/fs.h | 272 |
1 files changed, 125 insertions, 147 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h index 954fe0599..1d3fc6611 100644 --- a/src/fs/fs.h +++ b/src/fs/fs.h | |||
@@ -240,7 +240,7 @@ | |||
240 | /** | 240 | /** |
241 | * @brief content hash key | 241 | * @brief content hash key |
242 | */ | 242 | */ |
243 | struct ContentHashKey | 243 | struct ContentHashKey |
244 | { | 244 | { |
245 | /** | 245 | /** |
246 | * Hash of the original content, used for encryption. | 246 | * Hash of the original content, used for encryption. |
@@ -307,27 +307,27 @@ struct Location | |||
307 | * Types of URIs. | 307 | * Types of URIs. |
308 | */ | 308 | */ |
309 | enum uri_types | 309 | enum uri_types |
310 | { | 310 | { |
311 | /** | 311 | /** |
312 | * Content-hash-key (simple file). | 312 | * Content-hash-key (simple file). |
313 | */ | 313 | */ |
314 | chk, | 314 | chk, |
315 | 315 | ||
316 | /** | 316 | /** |
317 | * Signed key space (file in namespace). | 317 | * Signed key space (file in namespace). |
318 | */ | 318 | */ |
319 | sks, | 319 | sks, |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * Keyword search key (query with keywords). | 322 | * Keyword search key (query with keywords). |
323 | */ | 323 | */ |
324 | ksk, | 324 | ksk, |
325 | 325 | ||
326 | /** | 326 | /** |
327 | * Location (chk with identity of hosting peer). | 327 | * Location (chk with identity of hosting peer). |
328 | */ | 328 | */ |
329 | loc | 329 | loc |
330 | }; | 330 | }; |
331 | 331 | ||
332 | /** | 332 | /** |
333 | * A Universal Resource Identifier (URI), opaque. | 333 | * A Universal Resource Identifier (URI), opaque. |
@@ -356,7 +356,7 @@ struct GNUNET_FS_Uri | |||
356 | * (only in URI-strings). | 356 | * (only in URI-strings). |
357 | */ | 357 | */ |
358 | char **keywords; | 358 | char **keywords; |
359 | 359 | ||
360 | /** | 360 | /** |
361 | * Size of the keywords array. | 361 | * Size of the keywords array. |
362 | */ | 362 | */ |
@@ -453,7 +453,7 @@ struct GNUNET_FS_FileInformation | |||
453 | * using 'mktemp'. | 453 | * using 'mktemp'. |
454 | */ | 454 | */ |
455 | char *serialization; | 455 | char *serialization; |
456 | 456 | ||
457 | /** | 457 | /** |
458 | * Encoder being used to publish this file. | 458 | * Encoder being used to publish this file. |
459 | */ | 459 | */ |
@@ -478,7 +478,8 @@ struct GNUNET_FS_FileInformation | |||
478 | /** | 478 | /** |
479 | * Data for a file. | 479 | * Data for a file. |
480 | */ | 480 | */ |
481 | struct { | 481 | struct |
482 | { | ||
482 | 483 | ||
483 | /** | 484 | /** |
484 | * Function that can be used to read the data for the file. | 485 | * Function that can be used to read the data for the file. |
@@ -524,8 +525,9 @@ struct GNUNET_FS_FileInformation | |||
524 | /** | 525 | /** |
525 | * Data for a directory. | 526 | * Data for a directory. |
526 | */ | 527 | */ |
527 | struct { | 528 | struct |
528 | 529 | { | |
530 | |||
529 | /** | 531 | /** |
530 | * Linked list of entries in the directory. | 532 | * Linked list of entries in the directory. |
531 | */ | 533 | */ |
@@ -567,15 +569,15 @@ struct GNUNET_FS_FileInformation | |||
567 | * @param cls closure | 569 | * @param cls closure |
568 | * @param client handle to use for FS communication | 570 | * @param client handle to use for FS communication |
569 | */ | 571 | */ |
570 | typedef void (*GNUNET_FS_QueueStart)(void *cls, | 572 | typedef void (*GNUNET_FS_QueueStart) (void *cls, |
571 | struct GNUNET_CLIENT_Connection *client); | 573 | struct GNUNET_CLIENT_Connection * client); |
572 | 574 | ||
573 | 575 | ||
574 | /** | 576 | /** |
575 | * The job must now stop to run and should destry the client handle as | 577 | * The job must now stop to run and should destry the client handle as |
576 | * soon as possible (ideally prior to returning). | 578 | * soon as possible (ideally prior to returning). |
577 | */ | 579 | */ |
578 | typedef void (*GNUNET_FS_QueueStop)(void *cls); | 580 | typedef void (*GNUNET_FS_QueueStop) (void *cls); |
579 | 581 | ||
580 | 582 | ||
581 | /** | 583 | /** |
@@ -610,7 +612,7 @@ struct GNUNET_FS_QueueEntry | |||
610 | 612 | ||
611 | /** | 613 | /** |
612 | * Handle to FS primary context. | 614 | * Handle to FS primary context. |
613 | */ | 615 | */ |
614 | struct GNUNET_FS_Handle *h; | 616 | struct GNUNET_FS_Handle *h; |
615 | 617 | ||
616 | /** | 618 | /** |
@@ -757,20 +759,17 @@ struct GNUNET_FS_SearchResult | |||
757 | * @param blocks number of blocks this download has | 759 | * @param blocks number of blocks this download has |
758 | * @return queue handle | 760 | * @return queue handle |
759 | */ | 761 | */ |
760 | struct GNUNET_FS_QueueEntry * | 762 | struct GNUNET_FS_QueueEntry *GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, |
761 | GNUNET_FS_queue_ (struct GNUNET_FS_Handle *h, | 763 | GNUNET_FS_QueueStart start, |
762 | GNUNET_FS_QueueStart start, | 764 | GNUNET_FS_QueueStop stop, |
763 | GNUNET_FS_QueueStop stop, | 765 | void *cls, unsigned int blocks); |
764 | void *cls, | ||
765 | unsigned int blocks); | ||
766 | 766 | ||
767 | 767 | ||
768 | /** | 768 | /** |
769 | * Dequeue a job from the queue. | 769 | * Dequeue a job from the queue. |
770 | * @param qh handle for the job | 770 | * @param qh handle for the job |
771 | */ | 771 | */ |
772 | void | 772 | void GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh); |
773 | GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh); | ||
774 | 773 | ||
775 | 774 | ||
776 | /** | 775 | /** |
@@ -790,11 +789,16 @@ GNUNET_FS_dequeue_ (struct GNUNET_FS_QueueEntry *qh); | |||
790 | * @return number of bytes written, usually "max", 0 on error | 789 | * @return number of bytes written, usually "max", 0 on error |
791 | */ | 790 | */ |
792 | size_t | 791 | size_t |
793 | GNUNET_FS_data_reader_file_(void *cls, | 792 | |
794 | uint64_t offset, | 793 | |
795 | size_t max, | 794 | |
796 | void *buf, | 795 | |
797 | char **emsg); | 796 | |
797 | |||
798 | |||
799 | GNUNET_FS_data_reader_file_ (void *cls, | ||
800 | uint64_t offset, | ||
801 | size_t max, void *buf, char **emsg); | ||
798 | 802 | ||
799 | 803 | ||
800 | /** | 804 | /** |
@@ -803,8 +807,7 @@ GNUNET_FS_data_reader_file_(void *cls, | |||
803 | * @param filename file to read | 807 | * @param filename file to read |
804 | * @return closure to use | 808 | * @return closure to use |
805 | */ | 809 | */ |
806 | void * | 810 | void *GNUNET_FS_make_file_reader_context_ (const char *filename); |
807 | GNUNET_FS_make_file_reader_context_ (const char *filename); | ||
808 | 811 | ||
809 | 812 | ||
810 | 813 | ||
@@ -825,11 +828,9 @@ GNUNET_FS_make_file_reader_context_ (const char *filename); | |||
825 | * @return number of bytes written, usually "max", 0 on error | 828 | * @return number of bytes written, usually "max", 0 on error |
826 | */ | 829 | */ |
827 | size_t | 830 | size_t |
828 | GNUNET_FS_data_reader_copy_(void *cls, | 831 | GNUNET_FS_data_reader_copy_ (void *cls, |
829 | uint64_t offset, | 832 | uint64_t offset, |
830 | size_t max, | 833 | size_t max, void *buf, char **emsg); |
831 | void *buf, | ||
832 | char **emsg); | ||
833 | 834 | ||
834 | /** | 835 | /** |
835 | * Notification of FS that a search probe has made progress. | 836 | * Notification of FS that a search probe has made progress. |
@@ -846,9 +847,9 @@ GNUNET_FS_data_reader_copy_(void *cls, | |||
846 | * will be passed to future callbacks in the respective | 847 | * will be passed to future callbacks in the respective |
847 | * field in the GNUNET_FS_ProgressInfo struct. | 848 | * field in the GNUNET_FS_ProgressInfo struct. |
848 | */ | 849 | */ |
849 | void* | 850 | void *GNUNET_FS_search_probe_progress_ (void *cls, |
850 | GNUNET_FS_search_probe_progress_ (void *cls, | 851 | const struct GNUNET_FS_ProgressInfo |
851 | const struct GNUNET_FS_ProgressInfo *info); | 852 | *info); |
852 | 853 | ||
853 | 854 | ||
854 | /** | 855 | /** |
@@ -859,7 +860,7 @@ GNUNET_FS_search_probe_progress_ (void *cls, | |||
859 | */ | 860 | */ |
860 | void | 861 | void |
861 | GNUNET_FS_publish_main_ (void *cls, | 862 | GNUNET_FS_publish_main_ (void *cls, |
862 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 863 | const struct GNUNET_SCHEDULER_TaskContext *tc); |
863 | 864 | ||
864 | 865 | ||
865 | /** | 866 | /** |
@@ -869,9 +870,8 @@ GNUNET_FS_publish_main_ (void *cls, | |||
869 | * @param cls closure, unindex context | 870 | * @param cls closure, unindex context |
870 | * @param file_id computed hash, NULL on error | 871 | * @param file_id computed hash, NULL on error |
871 | */ | 872 | */ |
872 | void | 873 | void |
873 | GNUNET_FS_unindex_process_hash_ (void *cls, | 874 | GNUNET_FS_unindex_process_hash_ (void *cls, const GNUNET_HashCode * file_id); |
874 | const GNUNET_HashCode *file_id); | ||
875 | 875 | ||
876 | 876 | ||
877 | /** | 877 | /** |
@@ -884,11 +884,10 @@ GNUNET_FS_unindex_process_hash_ (void *cls, | |||
884 | * @param offset where in the file are we so far | 884 | * @param offset where in the file are we so far |
885 | * @return value returned from callback | 885 | * @return value returned from callback |
886 | */ | 886 | */ |
887 | void * | 887 | void *GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, |
888 | GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | 888 | struct GNUNET_FS_PublishContext *sc, |
889 | struct GNUNET_FS_PublishContext *sc, | 889 | const struct GNUNET_FS_FileInformation *p, |
890 | const struct GNUNET_FS_FileInformation *p, | 890 | uint64_t offset); |
891 | uint64_t offset); | ||
892 | 891 | ||
893 | 892 | ||
894 | /** | 893 | /** |
@@ -900,7 +899,7 @@ GNUNET_FS_publish_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
900 | */ | 899 | */ |
901 | void | 900 | void |
902 | GNUNET_FS_download_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | 901 | GNUNET_FS_download_make_status_ (struct GNUNET_FS_ProgressInfo *pi, |
903 | struct GNUNET_FS_DownloadContext *dc); | 902 | struct GNUNET_FS_DownloadContext *dc); |
904 | 903 | ||
905 | 904 | ||
906 | /** | 905 | /** |
@@ -912,7 +911,7 @@ GNUNET_FS_download_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
912 | */ | 911 | */ |
913 | void | 912 | void |
914 | GNUNET_FS_download_start_task_ (void *cls, | 913 | GNUNET_FS_download_start_task_ (void *cls, |
915 | const struct GNUNET_SCHEDULER_TaskContext *tc); | 914 | const struct GNUNET_SCHEDULER_TaskContext *tc); |
916 | 915 | ||
917 | 916 | ||
918 | 917 | ||
@@ -926,8 +925,8 @@ GNUNET_FS_download_start_task_ (void *cls, | |||
926 | */ | 925 | */ |
927 | void | 926 | void |
928 | GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | 927 | GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi, |
929 | struct GNUNET_FS_UnindexContext *uc, | 928 | struct GNUNET_FS_UnindexContext *uc, |
930 | uint64_t offset); | 929 | uint64_t offset); |
931 | 930 | ||
932 | /** | 931 | /** |
933 | * Fill in all of the generic fields for a search event and | 932 | * Fill in all of the generic fields for a search event and |
@@ -937,9 +936,8 @@ GNUNET_FS_unindex_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
937 | * @param sc overall search context | 936 | * @param sc overall search context |
938 | * @return value returned by the callback | 937 | * @return value returned by the callback |
939 | */ | 938 | */ |
940 | void * | 939 | void *GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi, |
941 | GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | 940 | struct GNUNET_FS_SearchContext *sc); |
942 | struct GNUNET_FS_SearchContext *sc); | ||
943 | 941 | ||
944 | 942 | ||
945 | /** | 943 | /** |
@@ -947,8 +945,7 @@ GNUNET_FS_search_make_status_ (struct GNUNET_FS_ProgressInfo *pi, | |||
947 | * | 945 | * |
948 | * @param uc context for the unindex operation. | 946 | * @param uc context for the unindex operation. |
949 | */ | 947 | */ |
950 | void | 948 | void GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc); |
951 | GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc); | ||
952 | 949 | ||
953 | /** | 950 | /** |
954 | * Build the request and actually initiate the search using the | 951 | * Build the request and actually initiate the search using the |
@@ -957,8 +954,7 @@ GNUNET_FS_unindex_do_remove_ (struct GNUNET_FS_UnindexContext *uc); | |||
957 | * @param sc search context | 954 | * @param sc search context |
958 | * @return GNUNET_OK on success, GNUNET_SYSERR on error | 955 | * @return GNUNET_OK on success, GNUNET_SYSERR on error |
959 | */ | 956 | */ |
960 | int | 957 | int GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc); |
961 | GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc); | ||
962 | 958 | ||
963 | /** | 959 | /** |
964 | * Start the downloading process (by entering the queue). | 960 | * Start the downloading process (by entering the queue). |
@@ -974,8 +970,7 @@ GNUNET_FS_download_start_downloading_ (struct GNUNET_FS_DownloadContext *dc); | |||
974 | * | 970 | * |
975 | * @param sr the search result | 971 | * @param sr the search result |
976 | */ | 972 | */ |
977 | void | 973 | void GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr); |
978 | GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr); | ||
979 | 974 | ||
980 | /** | 975 | /** |
981 | * Remove serialization/deserialization file from disk. | 976 | * Remove serialization/deserialization file from disk. |
@@ -986,8 +981,7 @@ GNUNET_FS_search_start_probe_ (struct GNUNET_FS_SearchResult *sr); | |||
986 | */ | 981 | */ |
987 | void | 982 | void |
988 | GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, | 983 | GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, |
989 | const char *ext, | 984 | const char *ext, const char *ent); |
990 | const char *ent); | ||
991 | 985 | ||
992 | 986 | ||
993 | /** | 987 | /** |
@@ -999,8 +993,7 @@ GNUNET_FS_remove_sync_file_ (struct GNUNET_FS_Handle *h, | |||
999 | */ | 993 | */ |
1000 | void | 994 | void |
1001 | GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, | 995 | GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, |
1002 | const char *ext, | 996 | const char *ext, const char *uni); |
1003 | const char *uni); | ||
1004 | 997 | ||
1005 | 998 | ||
1006 | /** | 999 | /** |
@@ -1011,8 +1004,7 @@ GNUNET_FS_remove_sync_dir_ (struct GNUNET_FS_Handle *h, | |||
1011 | * | 1004 | * |
1012 | * @param fi the struct to sync | 1005 | * @param fi the struct to sync |
1013 | */ | 1006 | */ |
1014 | void | 1007 | void GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f); |
1015 | GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f); | ||
1016 | 1008 | ||
1017 | /** | 1009 | /** |
1018 | * Synchronize this publishing struct with its mirror | 1010 | * Synchronize this publishing struct with its mirror |
@@ -1022,8 +1014,7 @@ GNUNET_FS_file_information_sync_ (struct GNUNET_FS_FileInformation *f); | |||
1022 | * | 1014 | * |
1023 | * @param pc the struct to sync | 1015 | * @param pc the struct to sync |
1024 | */ | 1016 | */ |
1025 | void | 1017 | void GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc); |
1026 | GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc); | ||
1027 | 1018 | ||
1028 | /** | 1019 | /** |
1029 | * Synchronize this unindex struct with its mirror | 1020 | * Synchronize this unindex struct with its mirror |
@@ -1033,8 +1024,7 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc); | |||
1033 | * | 1024 | * |
1034 | * @param uc the struct to sync | 1025 | * @param uc the struct to sync |
1035 | */ | 1026 | */ |
1036 | void | 1027 | void GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc); |
1037 | GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc); | ||
1038 | 1028 | ||
1039 | /** | 1029 | /** |
1040 | * Synchronize this search struct with its mirror | 1030 | * Synchronize this search struct with its mirror |
@@ -1044,8 +1034,7 @@ GNUNET_FS_unindex_sync_ (struct GNUNET_FS_UnindexContext *uc); | |||
1044 | * | 1034 | * |
1045 | * @param sc the struct to sync | 1035 | * @param sc the struct to sync |
1046 | */ | 1036 | */ |
1047 | void | 1037 | void GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc); |
1048 | GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc); | ||
1049 | 1038 | ||
1050 | /** | 1039 | /** |
1051 | * Synchronize this search result with its mirror | 1040 | * Synchronize this search result with its mirror |
@@ -1055,8 +1044,7 @@ GNUNET_FS_search_sync_ (struct GNUNET_FS_SearchContext *sc); | |||
1055 | * | 1044 | * |
1056 | * @param sr the struct to sync | 1045 | * @param sr the struct to sync |
1057 | */ | 1046 | */ |
1058 | void | 1047 | void GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr); |
1059 | GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr); | ||
1060 | 1048 | ||
1061 | /** | 1049 | /** |
1062 | * Synchronize this download struct with its mirror | 1050 | * Synchronize this download struct with its mirror |
@@ -1066,8 +1054,7 @@ GNUNET_FS_search_result_sync_ (struct GNUNET_FS_SearchResult *sr); | |||
1066 | * | 1054 | * |
1067 | * @param dc the struct to sync | 1055 | * @param dc the struct to sync |
1068 | */ | 1056 | */ |
1069 | void | 1057 | void GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc); |
1070 | GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc); | ||
1071 | 1058 | ||
1072 | /** | 1059 | /** |
1073 | * Create SUSPEND event for the given publish operation | 1060 | * Create SUSPEND event for the given publish operation |
@@ -1075,8 +1062,7 @@ GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc); | |||
1075 | * | 1062 | * |
1076 | * @param cls the 'struct GNUNET_FS_PublishContext' to signal for | 1063 | * @param cls the 'struct GNUNET_FS_PublishContext' to signal for |
1077 | */ | 1064 | */ |
1078 | void | 1065 | void GNUNET_FS_publish_signal_suspend_ (void *cls); |
1079 | GNUNET_FS_publish_signal_suspend_ (void *cls); | ||
1080 | 1066 | ||
1081 | /** | 1067 | /** |
1082 | * Create SUSPEND event for the given search operation | 1068 | * Create SUSPEND event for the given search operation |
@@ -1084,8 +1070,7 @@ GNUNET_FS_publish_signal_suspend_ (void *cls); | |||
1084 | * | 1070 | * |
1085 | * @param cls the 'struct GNUNET_FS_SearchContext' to signal for | 1071 | * @param cls the 'struct GNUNET_FS_SearchContext' to signal for |
1086 | */ | 1072 | */ |
1087 | void | 1073 | void GNUNET_FS_search_signal_suspend_ (void *cls); |
1088 | GNUNET_FS_search_signal_suspend_ (void *cls); | ||
1089 | 1074 | ||
1090 | /** | 1075 | /** |
1091 | * Create SUSPEND event for the given download operation | 1076 | * Create SUSPEND event for the given download operation |
@@ -1093,8 +1078,7 @@ GNUNET_FS_search_signal_suspend_ (void *cls); | |||
1093 | * | 1078 | * |
1094 | * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for | 1079 | * @param cls the 'struct GNUNET_FS_DownloadContext' to signal for |
1095 | */ | 1080 | */ |
1096 | void | 1081 | void GNUNET_FS_download_signal_suspend_ (void *cls); |
1097 | GNUNET_FS_download_signal_suspend_ (void *cls); | ||
1098 | 1082 | ||
1099 | /** | 1083 | /** |
1100 | * Create SUSPEND event for the given unindex operation | 1084 | * Create SUSPEND event for the given unindex operation |
@@ -1102,8 +1086,7 @@ GNUNET_FS_download_signal_suspend_ (void *cls); | |||
1102 | * | 1086 | * |
1103 | * @param cls the 'struct GNUNET_FS_UnindexContext' to signal for | 1087 | * @param cls the 'struct GNUNET_FS_UnindexContext' to signal for |
1104 | */ | 1088 | */ |
1105 | void | 1089 | void GNUNET_FS_unindex_signal_suspend_ (void *cls); |
1106 | GNUNET_FS_unindex_signal_suspend_ (void *cls); | ||
1107 | 1090 | ||
1108 | /** | 1091 | /** |
1109 | * Function signature of the functions that can be called | 1092 | * Function signature of the functions that can be called |
@@ -1112,7 +1095,7 @@ GNUNET_FS_unindex_signal_suspend_ (void *cls); | |||
1112 | * | 1095 | * |
1113 | * @param cls closure | 1096 | * @param cls closure |
1114 | */ | 1097 | */ |
1115 | typedef void (*SuspendSignalFunction)(void *cls); | 1098 | typedef void (*SuspendSignalFunction) (void *cls); |
1116 | 1099 | ||
1117 | /** | 1100 | /** |
1118 | * We track all of the top-level activities of FS | 1101 | * We track all of the top-level activities of FS |
@@ -1122,12 +1105,12 @@ struct TopLevelActivity | |||
1122 | { | 1105 | { |
1123 | /** | 1106 | /** |
1124 | * This is a doubly-linked list. | 1107 | * This is a doubly-linked list. |
1125 | */ | 1108 | */ |
1126 | struct TopLevelActivity *next; | 1109 | struct TopLevelActivity *next; |
1127 | 1110 | ||
1128 | /** | 1111 | /** |
1129 | * This is a doubly-linked list. | 1112 | * This is a doubly-linked list. |
1130 | */ | 1113 | */ |
1131 | struct TopLevelActivity *prev; | 1114 | struct TopLevelActivity *prev; |
1132 | 1115 | ||
1133 | /** | 1116 | /** |
@@ -1150,10 +1133,9 @@ struct TopLevelActivity | |||
1150 | * @param ssf_cls closure for ssf | 1133 | * @param ssf_cls closure for ssf |
1151 | * @return fresh top-level activity handle | 1134 | * @return fresh top-level activity handle |
1152 | */ | 1135 | */ |
1153 | struct TopLevelActivity * | 1136 | struct TopLevelActivity *GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, |
1154 | GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, | 1137 | SuspendSignalFunction ssf, |
1155 | SuspendSignalFunction ssf, | 1138 | void *ssf_cls); |
1156 | void *ssf_cls); | ||
1157 | 1139 | ||
1158 | 1140 | ||
1159 | /** | 1141 | /** |
@@ -1163,8 +1145,7 @@ GNUNET_FS_make_top (struct GNUNET_FS_Handle *h, | |||
1163 | * @param top top level activity entry | 1145 | * @param top top level activity entry |
1164 | */ | 1146 | */ |
1165 | void | 1147 | void |
1166 | GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, | 1148 | GNUNET_FS_end_top (struct GNUNET_FS_Handle *h, struct TopLevelActivity *top); |
1167 | struct TopLevelActivity *top); | ||
1168 | 1149 | ||
1169 | 1150 | ||
1170 | 1151 | ||
@@ -1270,7 +1251,7 @@ struct GNUNET_FS_PublishContext | |||
1270 | { | 1251 | { |
1271 | /** | 1252 | /** |
1272 | * Handle to the global fs context. | 1253 | * Handle to the global fs context. |
1273 | */ | 1254 | */ |
1274 | struct GNUNET_FS_Handle *h; | 1255 | struct GNUNET_FS_Handle *h; |
1275 | 1256 | ||
1276 | /** | 1257 | /** |
@@ -1378,37 +1359,36 @@ struct GNUNET_FS_PublishContext | |||
1378 | 1359 | ||
1379 | /** | 1360 | /** |
1380 | * Phases of unindex processing (state machine). | 1361 | * Phases of unindex processing (state machine). |
1381 | */ | 1362 | */ |
1382 | enum UnindexState | 1363 | enum UnindexState |
1383 | { | 1364 | { |
1384 | /** | 1365 | /** |
1385 | * We're currently hashing the file. | 1366 | * We're currently hashing the file. |
1386 | */ | 1367 | */ |
1387 | UNINDEX_STATE_HASHING = 0, | 1368 | UNINDEX_STATE_HASHING = 0, |
1388 | 1369 | ||
1389 | /** | 1370 | /** |
1390 | * We're telling the datastore to delete | 1371 | * We're telling the datastore to delete |
1391 | * the respective entries. | 1372 | * the respective entries. |
1392 | */ | 1373 | */ |
1393 | UNINDEX_STATE_DS_REMOVE = 1, | 1374 | UNINDEX_STATE_DS_REMOVE = 1, |
1394 | 1375 | ||
1395 | /** | 1376 | /** |
1396 | * We're notifying the FS service about | 1377 | * We're notifying the FS service about |
1397 | * the unindexing. | 1378 | * the unindexing. |
1398 | */ | 1379 | */ |
1399 | UNINDEX_STATE_FS_NOTIFY = 2, | 1380 | UNINDEX_STATE_FS_NOTIFY = 2, |
1400 | 1381 | ||
1401 | /** | 1382 | /** |
1402 | * We're done. | 1383 | * We're done. |
1403 | */ | 1384 | */ |
1404 | UNINDEX_STATE_COMPLETE = 3, | 1385 | UNINDEX_STATE_COMPLETE = 3, |
1405 | 1386 | ||
1406 | /** | 1387 | /** |
1407 | * We've encountered a fatal error. | 1388 | * We've encountered a fatal error. |
1408 | */ | 1389 | */ |
1409 | UNINDEX_STATE_ERROR = 4 | 1390 | UNINDEX_STATE_ERROR = 4 |
1410 | 1391 | }; | |
1411 | }; | ||
1412 | 1392 | ||
1413 | 1393 | ||
1414 | /** | 1394 | /** |
@@ -1416,7 +1396,7 @@ enum UnindexState | |||
1416 | */ | 1396 | */ |
1417 | struct GNUNET_FS_UnindexContext | 1397 | struct GNUNET_FS_UnindexContext |
1418 | { | 1398 | { |
1419 | 1399 | ||
1420 | /** | 1400 | /** |
1421 | * Global FS context. | 1401 | * Global FS context. |
1422 | */ | 1402 | */ |
@@ -1476,7 +1456,7 @@ struct GNUNET_FS_UnindexContext | |||
1476 | 1456 | ||
1477 | /** | 1457 | /** |
1478 | * Overall size of the file. | 1458 | * Overall size of the file. |
1479 | */ | 1459 | */ |
1480 | uint64_t file_size; | 1460 | uint64_t file_size; |
1481 | 1461 | ||
1482 | /** | 1462 | /** |
@@ -1488,11 +1468,11 @@ struct GNUNET_FS_UnindexContext | |||
1488 | * Hash of the file's contents (once computed). | 1468 | * Hash of the file's contents (once computed). |
1489 | */ | 1469 | */ |
1490 | GNUNET_HashCode file_id; | 1470 | GNUNET_HashCode file_id; |
1491 | 1471 | ||
1492 | /** | 1472 | /** |
1493 | * Current operatinonal phase. | 1473 | * Current operatinonal phase. |
1494 | */ | 1474 | */ |
1495 | enum UnindexState state; | 1475 | enum UnindexState state; |
1496 | 1476 | ||
1497 | }; | 1477 | }; |
1498 | 1478 | ||
@@ -1512,7 +1492,7 @@ struct SearchRequestEntry | |||
1512 | /** | 1492 | /** |
1513 | * Hash of the public key, also known as the query. | 1493 | * Hash of the public key, also known as the query. |
1514 | */ | 1494 | */ |
1515 | GNUNET_HashCode query; | 1495 | GNUNET_HashCode query; |
1516 | 1496 | ||
1517 | /** | 1497 | /** |
1518 | * Map that contains a "struct GNUNET_FS_SearchResult" for each result that | 1498 | * Map that contains a "struct GNUNET_FS_SearchResult" for each result that |
@@ -1592,7 +1572,7 @@ struct GNUNET_FS_SearchContext | |||
1592 | * have exactly as many entries as there were keywords. | 1572 | * have exactly as many entries as there were keywords. |
1593 | */ | 1573 | */ |
1594 | struct SearchRequestEntry *requests; | 1574 | struct SearchRequestEntry *requests; |
1595 | 1575 | ||
1596 | /** | 1576 | /** |
1597 | * When did we start? | 1577 | * When did we start? |
1598 | */ | 1578 | */ |
@@ -1617,7 +1597,7 @@ struct GNUNET_FS_SearchContext | |||
1617 | * map have been passed to the service so far? | 1597 | * map have been passed to the service so far? |
1618 | */ | 1598 | */ |
1619 | unsigned int keyword_offset; | 1599 | unsigned int keyword_offset; |
1620 | 1600 | ||
1621 | /** | 1601 | /** |
1622 | * Anonymity level for the search. | 1602 | * Anonymity level for the search. |
1623 | */ | 1603 | */ |
@@ -1631,7 +1611,7 @@ struct GNUNET_FS_SearchContext | |||
1631 | /** | 1611 | /** |
1632 | * Options for the search. | 1612 | * Options for the search. |
1633 | */ | 1613 | */ |
1634 | enum GNUNET_FS_SearchOptions options; | 1614 | enum GNUNET_FS_SearchOptions options; |
1635 | }; | 1615 | }; |
1636 | 1616 | ||
1637 | 1617 | ||
@@ -1641,12 +1621,12 @@ struct GNUNET_FS_SearchContext | |||
1641 | * are documented in the comments. | 1621 | * are documented in the comments. |
1642 | */ | 1622 | */ |
1643 | enum BlockRequestState | 1623 | enum BlockRequestState |
1644 | { | 1624 | { |
1645 | /** | 1625 | /** |
1646 | * Initial state, block has only been allocated (since it is | 1626 | * Initial state, block has only been allocated (since it is |
1647 | * relevant to the overall download request). | 1627 | * relevant to the overall download request). |
1648 | */ | 1628 | */ |
1649 | BRS_INIT = 0, | 1629 | BRS_INIT = 0, |
1650 | 1630 | ||
1651 | /** | 1631 | /** |
1652 | * We've checked the block on the path down the tree, and the | 1632 | * We've checked the block on the path down the tree, and the |
@@ -1654,7 +1634,7 @@ enum BlockRequestState | |||
1654 | * the way down, so at the bottom some blocks will still | 1634 | * the way down, so at the bottom some blocks will still |
1655 | * need to be reconstructed). | 1635 | * need to be reconstructed). |
1656 | */ | 1636 | */ |
1657 | BRS_RECONSTRUCT_DOWN = 1, | 1637 | BRS_RECONSTRUCT_DOWN = 1, |
1658 | 1638 | ||
1659 | /** | 1639 | /** |
1660 | * We've calculated the CHK bottom-up based on the meta data. | 1640 | * We've calculated the CHK bottom-up based on the meta data. |
@@ -1662,7 +1642,7 @@ enum BlockRequestState | |||
1662 | * disk at the end (and we still need to check against the | 1642 | * disk at the end (and we still need to check against the |
1663 | * CHK set on top). | 1643 | * CHK set on top). |
1664 | */ | 1644 | */ |
1665 | BRS_RECONSTRUCT_META_UP = 2, | 1645 | BRS_RECONSTRUCT_META_UP = 2, |
1666 | 1646 | ||
1667 | /** | 1647 | /** |
1668 | * We've calculated the CHK bottom-up based on what we have on | 1648 | * We've calculated the CHK bottom-up based on what we have on |
@@ -1670,7 +1650,7 @@ enum BlockRequestState | |||
1670 | * reconstructed CHKs match whatever comes from above, we're | 1650 | * reconstructed CHKs match whatever comes from above, we're |
1671 | * done with the respective subtree. | 1651 | * done with the respective subtree. |
1672 | */ | 1652 | */ |
1673 | BRS_RECONSTRUCT_UP = 3, | 1653 | BRS_RECONSTRUCT_UP = 3, |
1674 | 1654 | ||
1675 | /** | 1655 | /** |
1676 | * We've determined the real, desired CHK for this block | 1656 | * We've determined the real, desired CHK for this block |
@@ -1679,7 +1659,7 @@ enum BlockRequestState | |||
1679 | * the top-level request, the state machine for the subtree | 1659 | * the top-level request, the state machine for the subtree |
1680 | * would have moved to BRS_DOWNLOAD_UP. | 1660 | * would have moved to BRS_DOWNLOAD_UP. |
1681 | */ | 1661 | */ |
1682 | BRS_CHK_SET = 4, | 1662 | BRS_CHK_SET = 4, |
1683 | 1663 | ||
1684 | /** | 1664 | /** |
1685 | * We've successfully downloaded this block, but the children | 1665 | * We've successfully downloaded this block, but the children |
@@ -1688,27 +1668,26 @@ enum BlockRequestState | |||
1688 | * state machine for this block may move to | 1668 | * state machine for this block may move to |
1689 | * BRS_DOWNLOAD_ERROR instead. | 1669 | * BRS_DOWNLOAD_ERROR instead. |
1690 | */ | 1670 | */ |
1691 | BRS_DOWNLOAD_DOWN = 5, | 1671 | BRS_DOWNLOAD_DOWN = 5, |
1692 | 1672 | ||
1693 | /** | 1673 | /** |
1694 | * This block and all of its children have been downloaded | 1674 | * This block and all of its children have been downloaded |
1695 | * successfully (full completion propagates up). | 1675 | * successfully (full completion propagates up). |
1696 | */ | 1676 | */ |
1697 | BRS_DOWNLOAD_UP = 6, | 1677 | BRS_DOWNLOAD_UP = 6, |
1698 | 1678 | ||
1699 | /** | 1679 | /** |
1700 | * We got a block back that matched the query but did not hash to | 1680 | * We got a block back that matched the query but did not hash to |
1701 | * the key (malicious publisher or hash collision); this block | 1681 | * the key (malicious publisher or hash collision); this block |
1702 | * can never be downloaded (error propagates up). | 1682 | * can never be downloaded (error propagates up). |
1703 | */ | 1683 | */ |
1704 | BRS_ERROR = 7 | 1684 | BRS_ERROR = 7 |
1705 | 1685 | }; | |
1706 | }; | ||
1707 | 1686 | ||
1708 | 1687 | ||
1709 | /** | 1688 | /** |
1710 | * Information about an active download request. | 1689 | * Information about an active download request. |
1711 | */ | 1690 | */ |
1712 | struct DownloadRequest | 1691 | struct DownloadRequest |
1713 | { | 1692 | { |
1714 | /** | 1693 | /** |
@@ -1735,7 +1714,7 @@ struct DownloadRequest | |||
1735 | * CHK for the request for this block (set during reconstruction | 1714 | * CHK for the request for this block (set during reconstruction |
1736 | * to what we have on disk, later to what we want to have). | 1715 | * to what we have on disk, later to what we want to have). |
1737 | */ | 1716 | */ |
1738 | struct ContentHashKey chk; | 1717 | struct ContentHashKey chk; |
1739 | 1718 | ||
1740 | /** | 1719 | /** |
1741 | * Offset of the corresponding block. Specifically, first (!) byte of | 1720 | * Offset of the corresponding block. Specifically, first (!) byte of |
@@ -1772,8 +1751,7 @@ struct DownloadRequest | |||
1772 | * | 1751 | * |
1773 | * @param dr request to free | 1752 | * @param dr request to free |
1774 | */ | 1753 | */ |
1775 | void | 1754 | void GNUNET_FS_free_download_request_ (struct DownloadRequest *dr); |
1776 | GNUNET_FS_free_download_request_ (struct DownloadRequest *dr); | ||
1777 | 1755 | ||
1778 | 1756 | ||
1779 | /** | 1757 | /** |
@@ -1781,17 +1759,17 @@ GNUNET_FS_free_download_request_ (struct DownloadRequest *dr); | |||
1781 | */ | 1759 | */ |
1782 | struct GNUNET_FS_DownloadContext | 1760 | struct GNUNET_FS_DownloadContext |
1783 | { | 1761 | { |
1784 | 1762 | ||
1785 | /** | 1763 | /** |
1786 | * Global FS context. | 1764 | * Global FS context. |
1787 | */ | 1765 | */ |
1788 | struct GNUNET_FS_Handle *h; | 1766 | struct GNUNET_FS_Handle *h; |
1789 | 1767 | ||
1790 | /** | 1768 | /** |
1791 | * Our top-level activity entry (if we are top-level, otherwise NULL). | 1769 | * Our top-level activity entry (if we are top-level, otherwise NULL). |
1792 | */ | 1770 | */ |
1793 | struct TopLevelActivity *top; | 1771 | struct TopLevelActivity *top; |
1794 | 1772 | ||
1795 | /** | 1773 | /** |
1796 | * Connection to the FS service. | 1774 | * Connection to the FS service. |
1797 | */ | 1775 | */ |
@@ -2019,7 +1997,7 @@ struct NamespaceUpdateNode | |||
2019 | * freshness of the tree_id. | 1997 | * freshness of the tree_id. |
2020 | */ | 1998 | */ |
2021 | unsigned int nug; | 1999 | unsigned int nug; |
2022 | 2000 | ||
2023 | /** | 2001 | /** |
2024 | * TREE this entry belongs to (if nug is current). | 2002 | * TREE this entry belongs to (if nug is current). |
2025 | */ | 2003 | */ |
@@ -2035,7 +2013,7 @@ struct GNUNET_FS_Namespace | |||
2035 | * Handle to the FS service context. | 2013 | * Handle to the FS service context. |
2036 | */ | 2014 | */ |
2037 | struct GNUNET_FS_Handle *h; | 2015 | struct GNUNET_FS_Handle *h; |
2038 | 2016 | ||
2039 | /** | 2017 | /** |
2040 | * Array with information about nodes in the namespace. | 2018 | * Array with information about nodes in the namespace. |
2041 | */ | 2019 | */ |
@@ -2059,7 +2037,7 @@ struct GNUNET_FS_Namespace | |||
2059 | 2037 | ||
2060 | /** | 2038 | /** |
2061 | * Name of the namespace. | 2039 | * Name of the namespace. |
2062 | */ | 2040 | */ |
2063 | char *name; | 2041 | char *name; |
2064 | 2042 | ||
2065 | /** | 2043 | /** |
@@ -2113,7 +2091,7 @@ struct IndexStartMessage | |||
2113 | * full hash recomputation. | 2091 | * full hash recomputation. |
2114 | */ | 2092 | */ |
2115 | uint64_t device GNUNET_PACKED; | 2093 | uint64_t device GNUNET_PACKED; |
2116 | 2094 | ||
2117 | /** | 2095 | /** |
2118 | * Inode of the file on the given device, as seen by the client | 2096 | * Inode of the file on the given device, as seen by the client |
2119 | * ("st_ino" field from "struct stat"). Use 0 if the OS does not | 2097 | * ("st_ino" field from "struct stat"). Use 0 if the OS does not |
@@ -2128,8 +2106,8 @@ struct IndexStartMessage | |||
2128 | GNUNET_HashCode file_id; | 2106 | GNUNET_HashCode file_id; |
2129 | 2107 | ||
2130 | /* this is followed by a 0-terminated | 2108 | /* this is followed by a 0-terminated |
2131 | filename of a file with the hash | 2109 | * filename of a file with the hash |
2132 | "file_id" as seen by the client */ | 2110 | * "file_id" as seen by the client */ |
2133 | 2111 | ||
2134 | }; | 2112 | }; |
2135 | 2113 | ||
@@ -2157,9 +2135,9 @@ struct IndexInfoMessage | |||
2157 | GNUNET_HashCode file_id; | 2135 | GNUNET_HashCode file_id; |
2158 | 2136 | ||
2159 | /* this is followed by a 0-terminated | 2137 | /* this is followed by a 0-terminated |
2160 | filename of a file with the hash | 2138 | * filename of a file with the hash |
2161 | "file_id" as seen by the client */ | 2139 | * "file_id" as seen by the client */ |
2162 | 2140 | ||
2163 | }; | 2141 | }; |
2164 | 2142 | ||
2165 | 2143 | ||
@@ -2245,10 +2223,10 @@ struct SearchMessage | |||
2245 | GNUNET_HashCode query; | 2223 | GNUNET_HashCode query; |
2246 | 2224 | ||
2247 | /* this is followed by the hash codes of already-known | 2225 | /* this is followed by the hash codes of already-known |
2248 | results (which should hence be excluded from what | 2226 | * results (which should hence be excluded from what |
2249 | the service returns); naturally, this only applies | 2227 | * the service returns); naturally, this only applies |
2250 | to queries that can have multiple results, such as | 2228 | * to queries that can have multiple results, such as |
2251 | those for KBLOCKS (KSK) and SBLOCKS (SKS) */ | 2229 | * those for KBLOCKS (KSK) and SBLOCKS (SKS) */ |
2252 | }; | 2230 | }; |
2253 | 2231 | ||
2254 | 2232 | ||
@@ -2333,10 +2311,10 @@ struct GetMessage | |||
2333 | GNUNET_HashCode query GNUNET_PACKED; | 2311 | GNUNET_HashCode query GNUNET_PACKED; |
2334 | 2312 | ||
2335 | /* this is followed by hash codes | 2313 | /* this is followed by hash codes |
2336 | as specified in the "hash_bitmap"; | 2314 | * as specified in the "hash_bitmap"; |
2337 | after that, an optional bloomfilter | 2315 | * after that, an optional bloomfilter |
2338 | (with bits set for replies that should | 2316 | * (with bits set for replies that should |
2339 | be suppressed) can be present */ | 2317 | * be suppressed) can be present */ |
2340 | }; | 2318 | }; |
2341 | 2319 | ||
2342 | 2320 | ||