aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-05-03 21:35:44 +0000
committerChristian Grothoff <christian@grothoff.org>2010-05-03 21:35:44 +0000
commit7eb4b4b3ab14ef6433b08cca8c673d00f8405062 (patch)
tree04dfe48fe96a0a8096239b0083f19602b333a998 /src/fs/fs.h
parent4092583a7dcb0844d5957909ef81f6766b3f2603 (diff)
downloadgnunet-7eb4b4b3ab14ef6433b08cca8c673d00f8405062.tar.gz
gnunet-7eb4b4b3ab14ef6433b08cca8c673d00f8405062.zip
towards suspend
Diffstat (limited to 'src/fs/fs.h')
-rw-r--r--src/fs/fs.h128
1 files changed, 127 insertions, 1 deletions
diff --git a/src/fs/fs.h b/src/fs/fs.h
index 7b30367ea..275882c4f 100644
--- a/src/fs/fs.h
+++ b/src/fs/fs.h
@@ -158,7 +158,14 @@
158 */ 158 */
159struct ContentHashKey 159struct ContentHashKey
160{ 160{
161 /**
162 * Hash of the original content, used for encryption.
163 */
161 GNUNET_HashCode key; 164 GNUNET_HashCode key;
165
166 /**
167 * Hash of the encrypted content, used for querying.
168 */
162 GNUNET_HashCode query; 169 GNUNET_HashCode query;
163}; 170};
164 171
@@ -212,15 +219,42 @@ struct Location
212 219
213}; 220};
214 221
222/**
223 * Types of URIs.
224 */
215enum uri_types 225enum uri_types
216{ chk, sks, ksk, loc }; 226 {
227 /**
228 * Content-hash-key (simple file).
229 */
230 chk,
231
232 /**
233 * Signed key space (file in namespace).
234 */
235 sks,
236
237 /**
238 * Keyword search key (query with keywords).
239 */
240 ksk,
241
242 /**
243 * Location (chk with identity of hosting peer).
244 */
245 loc
246 };
217 247
218/** 248/**
219 * A Universal Resource Identifier (URI), opaque. 249 * A Universal Resource Identifier (URI), opaque.
220 */ 250 */
221struct GNUNET_FS_Uri 251struct GNUNET_FS_Uri
222{ 252{
253 /**
254 * Type of the URI.
255 */
223 enum uri_types type; 256 enum uri_types type;
257
224 union 258 union
225 { 259 {
226 struct 260 struct
@@ -930,6 +964,68 @@ GNUNET_FS_download_sync_ (struct GNUNET_FS_DownloadContext *dc);
930 964
931 965
932/** 966/**
967 * Function signature of the functions that can be called
968 * to trigger suspend signals and clean-up for top-level
969 * activities.
970 *
971 * @param cls closure
972 */
973typedef void (*SuspendSignalFunction)(void *cls);
974
975/**
976 * We track all of the top-level activities of FS
977 * so that we can signal 'suspend' on shutdown.
978 */
979struct TopLevelActivity
980{
981 /**
982 * This is a doubly-linked list.
983 */
984 struct TopLevelActivity *next;
985
986 /**
987 * This is a doubly-linked list.
988 */
989 struct TopLevelActivity *prev;
990
991 /**
992 * Function to call for suspend-signalling and clean up.
993 */
994 SuspendSignalFunction ssf;
995
996 /**
997 * Closure for 'ssf' (some struct GNUNET_FS_XXXHandle*)
998 */
999 void *ssf_cls;
1000};
1001
1002
1003/**
1004 * Create a top-level activity entry.
1005 *
1006 * @param h global fs handle
1007 * @param ssf suspend signal function to use
1008 * @param ssf_cls closure for ssf
1009 * @return fresh top-level activity handle
1010 */
1011struct TopLevelActivity *
1012GNUNET_FS_make_top (struct GNUNET_FS_Handle *h,
1013 SuspendSignalFunction ssf,
1014 void *ssf_cls);
1015
1016
1017/**
1018 * Destroy a top-level activity entry.
1019 *
1020 * @param h global fs handle
1021 * @param top top level activity entry
1022 */
1023void
1024GNUNET_FS_end_top (struct GNUNET_FS_Handle *h,
1025 struct TopLevelActivity *top);
1026
1027
1028/**
933 * Master context for most FS operations. 1029 * Master context for most FS operations.
934 */ 1030 */
935struct GNUNET_FS_Handle 1031struct GNUNET_FS_Handle
@@ -965,6 +1061,16 @@ struct GNUNET_FS_Handle
965 struct GNUNET_CLIENT_Connection *client; 1061 struct GNUNET_CLIENT_Connection *client;
966 1062
967 /** 1063 /**
1064 * Head of DLL of top-level activities.
1065 */
1066 struct TopLevelActivity *top_head;
1067
1068 /**
1069 * Tail of DLL of top-level activities.
1070 */
1071 struct TopLevelActivity *top_tail;
1072
1073 /**
968 * Head of DLL of running jobs. 1074 * Head of DLL of running jobs.
969 */ 1075 */
970 struct GNUNET_FS_QueueEntry *running_head; 1076 struct GNUNET_FS_QueueEntry *running_head;
@@ -1035,6 +1141,11 @@ struct GNUNET_FS_PublishContext
1035 struct GNUNET_FS_Handle *h; 1141 struct GNUNET_FS_Handle *h;
1036 1142
1037 /** 1143 /**
1144 * Our top-level activity entry (if we are top-level, otherwise NULL).
1145 */
1146 struct TopLevelActivity *top;
1147
1148 /**
1038 * File-structure that is being shared. 1149 * File-structure that is being shared.
1039 */ 1150 */
1040 struct GNUNET_FS_FileInformation *fi; 1151 struct GNUNET_FS_FileInformation *fi;
@@ -1163,6 +1274,11 @@ struct GNUNET_FS_UnindexContext
1163 struct GNUNET_FS_Handle *h; 1274 struct GNUNET_FS_Handle *h;
1164 1275
1165 /** 1276 /**
1277 * Our top-level activity entry.
1278 */
1279 struct TopLevelActivity *top;
1280
1281 /**
1166 * Name of the file that we are unindexing. 1282 * Name of the file that we are unindexing.
1167 */ 1283 */
1168 char *filename; 1284 char *filename;
@@ -1274,6 +1390,11 @@ struct GNUNET_FS_SearchContext
1274 struct GNUNET_FS_Handle *h; 1390 struct GNUNET_FS_Handle *h;
1275 1391
1276 /** 1392 /**
1393 * Our top-level activity entry (if we are top-level, otherwise NULL).
1394 */
1395 struct TopLevelActivity *top;
1396
1397 /**
1277 * List of keywords that we're looking for. 1398 * List of keywords that we're looking for.
1278 */ 1399 */
1279 struct GNUNET_FS_Uri *uri; 1400 struct GNUNET_FS_Uri *uri;
@@ -1420,6 +1541,11 @@ struct GNUNET_FS_DownloadContext
1420 * Global FS context. 1541 * Global FS context.
1421 */ 1542 */
1422 struct GNUNET_FS_Handle *h; 1543 struct GNUNET_FS_Handle *h;
1544
1545 /**
1546 * Our top-level activity entry (if we are top-level, otherwise NULL).
1547 */
1548 struct TopLevelActivity *top;
1423 1549
1424 /** 1550 /**
1425 * Connection to the FS service. 1551 * Connection to the FS service.