diff options
author | Christian Grothoff <christian@grothoff.org> | 2012-02-18 19:03:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2012-02-18 19:03:26 +0000 |
commit | c456c5bb7f9b95d1800ad6e2892a77f40a08493e (patch) | |
tree | 8b04e75f8a65225848816d8e588b28413ff9d758 /src/include/gnunet_fs_service.h | |
parent | 6d0a62078edfa5c0001acb93d517c674c5124f4e (diff) | |
download | gnunet-c456c5bb7f9b95d1800ad6e2892a77f40a08493e.tar.gz gnunet-c456c5bb7f9b95d1800ad6e2892a77f40a08493e.zip |
make all (?) asynchronously operating FS operations actually cancel-able
Diffstat (limited to 'src/include/gnunet_fs_service.h')
-rw-r--r-- | src/include/gnunet_fs_service.h | 81 |
1 files changed, 70 insertions, 11 deletions
diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index 0c739709d..3af4e50f9 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h | |||
@@ -2023,6 +2023,12 @@ typedef void (*GNUNET_FS_PublishContinuation) (void *cls, | |||
2023 | 2023 | ||
2024 | 2024 | ||
2025 | /** | 2025 | /** |
2026 | * Handle to cancel publish KSK operation. | ||
2027 | */ | ||
2028 | struct GNUNET_FS_PublishKskContext; | ||
2029 | |||
2030 | |||
2031 | /** | ||
2026 | * Publish a KBlock on GNUnet. | 2032 | * Publish a KBlock on GNUnet. |
2027 | * | 2033 | * |
2028 | * @param h handle to the file sharing subsystem | 2034 | * @param h handle to the file sharing subsystem |
@@ -2033,8 +2039,9 @@ typedef void (*GNUNET_FS_PublishContinuation) (void *cls, | |||
2033 | * @param options publication options | 2039 | * @param options publication options |
2034 | * @param cont continuation | 2040 | * @param cont continuation |
2035 | * @param cont_cls closure for cont | 2041 | * @param cont_cls closure for cont |
2042 | * @return NULL on error ('cont' will still be called) | ||
2036 | */ | 2043 | */ |
2037 | void | 2044 | struct GNUNET_FS_PublishKskContext * |
2038 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | 2045 | GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, |
2039 | const struct GNUNET_FS_Uri *ksk_uri, | 2046 | const struct GNUNET_FS_Uri *ksk_uri, |
2040 | const struct GNUNET_CONTAINER_MetaData *meta, | 2047 | const struct GNUNET_CONTAINER_MetaData *meta, |
@@ -2045,6 +2052,21 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
2045 | 2052 | ||
2046 | 2053 | ||
2047 | /** | 2054 | /** |
2055 | * Abort the KSK publishing operation. | ||
2056 | * | ||
2057 | * @param pkc context of the operation to abort. | ||
2058 | */ | ||
2059 | void | ||
2060 | GNUNET_FS_publish_ksk_cancel (struct GNUNET_FS_PublishKskContext *pkc); | ||
2061 | |||
2062 | |||
2063 | /** | ||
2064 | * Handle to cancel publish SKS operation. | ||
2065 | */ | ||
2066 | struct GNUNET_FS_PublishSksContext; | ||
2067 | |||
2068 | |||
2069 | /** | ||
2048 | * Publish an SBlock on GNUnet. | 2070 | * Publish an SBlock on GNUnet. |
2049 | * | 2071 | * |
2050 | * @param h handle to the file sharing subsystem | 2072 | * @param h handle to the file sharing subsystem |
@@ -2057,8 +2079,9 @@ GNUNET_FS_publish_ksk (struct GNUNET_FS_Handle *h, | |||
2057 | * @param options publication options | 2079 | * @param options publication options |
2058 | * @param cont continuation | 2080 | * @param cont continuation |
2059 | * @param cont_cls closure for cont | 2081 | * @param cont_cls closure for cont |
2082 | * @return NULL on error ('cont' will still be called) | ||
2060 | */ | 2083 | */ |
2061 | void | 2084 | struct GNUNET_FS_PublishSksContext * |
2062 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | 2085 | GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, |
2063 | struct GNUNET_FS_Namespace *namespace, | 2086 | struct GNUNET_FS_Namespace *namespace, |
2064 | const char *identifier, const char *update, | 2087 | const char *identifier, const char *update, |
@@ -2070,10 +2093,19 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, | |||
2070 | 2093 | ||
2071 | 2094 | ||
2072 | /** | 2095 | /** |
2096 | * Abort the SKS publishing operation. | ||
2097 | * | ||
2098 | * @param psc context of the operation to abort. | ||
2099 | */ | ||
2100 | void | ||
2101 | GNUNET_FS_publish_sks_cancel (struct GNUNET_FS_PublishSksContext *psc); | ||
2102 | |||
2103 | |||
2104 | /** | ||
2073 | * Type of a function called by "GNUNET_FS_get_indexed_files". | 2105 | * Type of a function called by "GNUNET_FS_get_indexed_files". |
2074 | * | 2106 | * |
2075 | * @param cls closure | 2107 | * @param cls closure |
2076 | * @param filename the name of the file | 2108 | * @param filename the name of the file, NULL for end of list |
2077 | * @param file_id hash of the contents of the indexed file | 2109 | * @param file_id hash of the contents of the indexed file |
2078 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort | 2110 | * @return GNUNET_OK to continue iteration, GNUNET_SYSERR to abort |
2079 | */ | 2111 | */ |
@@ -2082,21 +2114,32 @@ typedef int (*GNUNET_FS_IndexedFileProcessor) (void *cls, const char *filename, | |||
2082 | 2114 | ||
2083 | 2115 | ||
2084 | /** | 2116 | /** |
2117 | * Handle to cancel 'GNUNET_FS_get_indexed_files'. | ||
2118 | */ | ||
2119 | struct GNUNET_FS_GetIndexedContext; | ||
2120 | |||
2121 | |||
2122 | /** | ||
2085 | * Iterate over all indexed files. | 2123 | * Iterate over all indexed files. |
2086 | * | 2124 | * |
2087 | * @param h handle to the file sharing subsystem | 2125 | * @param h handle to the file sharing subsystem |
2088 | * @param iterator function to call on each indexed file | 2126 | * @param iterator function to call on each indexed file |
2089 | * @param iterator_cls closure for iterator | 2127 | * @param iterator_cls closure for iterator |
2090 | * @param cont continuation to call when done; | 2128 | * @return NULL on error ('iter' is not called) |
2091 | * reason should be "TIMEOUT" (on | ||
2092 | * error) or "PREREQ_DONE" (on success) | ||
2093 | * @param cont_cls closure for cont | ||
2094 | */ | 2129 | */ |
2095 | void | 2130 | struct GNUNET_FS_GetIndexedContext * |
2096 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, | 2131 | GNUNET_FS_get_indexed_files (struct GNUNET_FS_Handle *h, |
2097 | GNUNET_FS_IndexedFileProcessor iterator, | 2132 | GNUNET_FS_IndexedFileProcessor iterator, |
2098 | void *iterator_cls, GNUNET_SCHEDULER_Task cont, | 2133 | void *iterator_cls); |
2099 | void *cont_cls); | 2134 | |
2135 | |||
2136 | /** | ||
2137 | * Cancel iteration over all indexed files. | ||
2138 | * | ||
2139 | * @param gic operation to cancel | ||
2140 | */ | ||
2141 | void | ||
2142 | GNUNET_FS_get_indexed_files_cancel (struct GNUNET_FS_GetIndexedContext *gic); | ||
2100 | 2143 | ||
2101 | 2144 | ||
2102 | /** | 2145 | /** |
@@ -2122,6 +2165,12 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | |||
2122 | 2165 | ||
2123 | 2166 | ||
2124 | /** | 2167 | /** |
2168 | * Context for advertising a namespace. | ||
2169 | */ | ||
2170 | struct GNUNET_FS_AdvertisementContext; | ||
2171 | |||
2172 | |||
2173 | /** | ||
2125 | * Publish an advertismement for a namespace. | 2174 | * Publish an advertismement for a namespace. |
2126 | * | 2175 | * |
2127 | * @param h handle to the file sharing subsystem | 2176 | * @param h handle to the file sharing subsystem |
@@ -2132,8 +2181,9 @@ GNUNET_FS_unindex_stop (struct GNUNET_FS_UnindexContext *uc); | |||
2132 | * @param rootEntry name of the root of the namespace | 2181 | * @param rootEntry name of the root of the namespace |
2133 | * @param cont continuation | 2182 | * @param cont continuation |
2134 | * @param cont_cls closure for cont | 2183 | * @param cont_cls closure for cont |
2184 | * @return NULL on error ('cont' will still be called) | ||
2135 | */ | 2185 | */ |
2136 | void | 2186 | struct GNUNET_FS_AdvertisementContext * |
2137 | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | 2187 | GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, |
2138 | struct GNUNET_FS_Uri *ksk_uri, | 2188 | struct GNUNET_FS_Uri *ksk_uri, |
2139 | struct GNUNET_FS_Namespace *namespace, | 2189 | struct GNUNET_FS_Namespace *namespace, |
@@ -2145,6 +2195,15 @@ GNUNET_FS_namespace_advertise (struct GNUNET_FS_Handle *h, | |||
2145 | 2195 | ||
2146 | 2196 | ||
2147 | /** | 2197 | /** |
2198 | * Abort the namespace advertisement operation. | ||
2199 | * | ||
2200 | * @param pkc context of the operation to abort. | ||
2201 | */ | ||
2202 | void | ||
2203 | GNUNET_FS_namespace_advertise_cancel (struct GNUNET_FS_AdvertisementContext *ac); | ||
2204 | |||
2205 | |||
2206 | /** | ||
2148 | * Create a namespace with the given name; if one already | 2207 | * Create a namespace with the given name; if one already |
2149 | * exists, return a handle to the existing namespace. | 2208 | * exists, return a handle to the existing namespace. |
2150 | * | 2209 | * |