diff options
Diffstat (limited to 'src/gnunet_chat_file.h')
-rw-r--r-- | src/gnunet_chat_file.h | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/src/gnunet_chat_file.h b/src/gnunet_chat_file.h index 8aa1465..5208f18 100644 --- a/src/gnunet_chat_file.h +++ b/src/gnunet_chat_file.h | |||
@@ -103,45 +103,128 @@ struct GNUNET_CHAT_File | |||
103 | void *user_pointer; | 103 | void *user_pointer; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | /** | ||
107 | * Creates a chat file handle from a file body in a | ||
108 | * <i>message</i> with a selected chat <i>handle</i>. | ||
109 | * | ||
110 | * @param[in,out] handle Chat handle | ||
111 | * @param[in] message File message body | ||
112 | * @return New chat file handle | ||
113 | */ | ||
106 | struct GNUNET_CHAT_File* | 114 | struct GNUNET_CHAT_File* |
107 | file_create_from_message (struct GNUNET_CHAT_Handle *handle, | 115 | file_create_from_message (struct GNUNET_CHAT_Handle *handle, |
108 | const struct GNUNET_MESSENGER_MessageFile *message); | 116 | const struct GNUNET_MESSENGER_MessageFile *message); |
109 | 117 | ||
118 | /** | ||
119 | * Creates a chat file handle from a local file on disk | ||
120 | * under a given <i>name</i> using a <i>hash</i> and a | ||
121 | * selected symmetric <i>key</i> with a selected chat | ||
122 | * <i>handle</i>. | ||
123 | * | ||
124 | * @param[in,out] handle Chat handle | ||
125 | * @param[in] name File name | ||
126 | * @param[in] hash File hash | ||
127 | * @param[in] key Symmetric key | ||
128 | * @return New chat file handle | ||
129 | */ | ||
110 | struct GNUNET_CHAT_File* | 130 | struct GNUNET_CHAT_File* |
111 | file_create_from_disk (struct GNUNET_CHAT_Handle *handle, | 131 | file_create_from_disk (struct GNUNET_CHAT_Handle *handle, |
112 | const char *name, | 132 | const char *name, |
113 | const struct GNUNET_HashCode *hash, | 133 | const struct GNUNET_HashCode *hash, |
114 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); | 134 | const struct GNUNET_CRYPTO_SymmetricSessionKey *key); |
115 | 135 | ||
136 | /** | ||
137 | * Destroys a chat <i>file</i> handle and frees its memory. | ||
138 | * | ||
139 | * @param[in,out] file Chat file handle | ||
140 | */ | ||
116 | void | 141 | void |
117 | file_destroy (struct GNUNET_CHAT_File *file); | 142 | file_destroy (struct GNUNET_CHAT_File *file); |
118 | 143 | ||
144 | /** | ||
145 | * Binds a chat <i>context</i>, a callback and a closure | ||
146 | * to a given chat <i>file</i> handle to be called on any | ||
147 | * progress uploading the regarding file. | ||
148 | * | ||
149 | * @param[in,out] file Chat file handle | ||
150 | * @param[in,out] context Chat context | ||
151 | * @param[in] cb Callback for upload progress | ||
152 | * @param[in,out] cls Closure | ||
153 | */ | ||
119 | void | 154 | void |
120 | file_bind_upload (struct GNUNET_CHAT_File *file, | 155 | file_bind_upload (struct GNUNET_CHAT_File *file, |
121 | struct GNUNET_CHAT_Context *context, | 156 | struct GNUNET_CHAT_Context *context, |
122 | GNUNET_CHAT_FileUploadCallback cb, | 157 | GNUNET_CHAT_FileUploadCallback cb, |
123 | void *cls); | 158 | void *cls); |
124 | 159 | ||
160 | /** | ||
161 | * Binds a callback and a closure to a given chat <i>file</i> | ||
162 | * handle to be called on any progress downloading the | ||
163 | * regarding file. | ||
164 | * | ||
165 | * @param[in,out] file Chat file handle | ||
166 | * @param[in] cb Callback for download progress | ||
167 | * @param[in,out] cls Closure | ||
168 | */ | ||
125 | void | 169 | void |
126 | file_bind_downlaod (struct GNUNET_CHAT_File *file, | 170 | file_bind_downlaod (struct GNUNET_CHAT_File *file, |
127 | GNUNET_CHAT_FileDownloadCallback cb, | 171 | GNUNET_CHAT_FileDownloadCallback cb, |
128 | void *cls); | 172 | void *cls); |
129 | 173 | ||
174 | /** | ||
175 | * Binds a callback and a closure to a given chat <i>file</i> | ||
176 | * handle to be called on any progress unindexing the | ||
177 | * regarding file. | ||
178 | * | ||
179 | * @param[in,out] file Chat file handle | ||
180 | * @param[in] cb Callback for unindex progress | ||
181 | * @param[in,out] cls Closure | ||
182 | */ | ||
130 | void | 183 | void |
131 | file_bind_unindex (struct GNUNET_CHAT_File *file, | 184 | file_bind_unindex (struct GNUNET_CHAT_File *file, |
132 | GNUNET_CHAT_FileUnindexCallback cb, | 185 | GNUNET_CHAT_FileUnindexCallback cb, |
133 | void *cls); | 186 | void *cls); |
134 | 187 | ||
188 | /** | ||
189 | * Calls the regarding events and bound callback of a given | ||
190 | * chat <i>file</i> handle to a file upload progress using | ||
191 | * the provided state of <i>completed</i> bytes and its file | ||
192 | * <i>size</i>. | ||
193 | * | ||
194 | * @param[in,out] file Chat file handle | ||
195 | * @param[in] completed Amount of uploaded bytes | ||
196 | * @param[in] size Full file size | ||
197 | */ | ||
135 | void | 198 | void |
136 | file_update_upload (struct GNUNET_CHAT_File *file, | 199 | file_update_upload (struct GNUNET_CHAT_File *file, |
137 | uint64_t completed, | 200 | uint64_t completed, |
138 | uint64_t size); | 201 | uint64_t size); |
139 | 202 | ||
203 | /** | ||
204 | * Calls the regarding events and bound callback of a given | ||
205 | * chat <i>file</i> handle to a file download progress using | ||
206 | * the provided state of <i>completed</i> bytes and its file | ||
207 | * <i>size</i>. | ||
208 | * | ||
209 | * @param[in,out] file Chat file handle | ||
210 | * @param[in] completed Amount of downloaded bytes | ||
211 | * @param[in] size Full file size | ||
212 | */ | ||
140 | void | 213 | void |
141 | file_update_download (struct GNUNET_CHAT_File *file, | 214 | file_update_download (struct GNUNET_CHAT_File *file, |
142 | uint64_t completed, | 215 | uint64_t completed, |
143 | uint64_t size); | 216 | uint64_t size); |
144 | 217 | ||
218 | /** | ||
219 | * Calls the regarding events and bound callback of a given | ||
220 | * chat <i>file</i> handle to a file unindex progress using | ||
221 | * the provided state of <i>completed</i> bytes and its file | ||
222 | * <i>size</i>. | ||
223 | * | ||
224 | * @param[in,out] file Chat file handle | ||
225 | * @param[in] completed Amount of unindexed bytes | ||
226 | * @param[in] size Full file size | ||
227 | */ | ||
145 | void | 228 | void |
146 | file_update_unindex (struct GNUNET_CHAT_File *file, | 229 | file_update_unindex (struct GNUNET_CHAT_File *file, |
147 | uint64_t completed, | 230 | uint64_t completed, |