-GNUNET_FS_directory_scanner_default (void *cls,
- const char *dirname,
- int do_index,
- uint32_t anonymity,
- uint32_t priority,
- struct GNUNET_TIME_Absolute expirationTime,
- GNUNET_FS_FileProcessor proc,
- void *proc_cls,
- char **emsg)
-{
- struct EXTRACTOR_Extractor *ex = cls;
- struct DirScanCls dsc;
-
- dsc.extractors = ex;
- dsc.proc = proc;
- dsc.proc_cls = proc_cls;
- dsc.scanner = &GNUNET_FS_directory_scanner_default;
- dsc.scanner_cls = cls;
- dsc.do_index = do_index;
- dsc.anonymity = anonymity;
- dsc.priority = priority;
- dsc.expiration = expirationTime;
- if (-1 == GNUNET_DISK_directory_scan (dirname,
- &dir_scan_cb,
- &dsc))
- {
- GNUNET_assert (NULL != dsc.emsg);
- *emsg = dsc.emsg;
- return GNUNET_SYSERR;
- }
- return GNUNET_OK;
-}
-
-
-/**
- * Closure for dirproc function.
- */
-struct EntryProcCls
-{
- /**
- * Linked list of directory entries that is being
- * created.
- */
- struct GNUNET_FS_FileInformation *entries;
-
-};
-
-
-/**
- * Function that processes a directory entry that
- * was obtained from the scanner.
- * @param cls our closure
- * @param filename name of the file (unused, why there???)
- * @param fi information for publishing the file
- */
-static void
-dirproc (void *cls,
- const char *filename,
- struct GNUNET_FS_FileInformation *fi)
-{
- struct EntryProcCls *dc = cls;
-
- GNUNET_assert (fi->next == NULL);
- GNUNET_assert (fi->dir == NULL);
- fi->next = dc->entries;
- dc->entries = fi;
-}
-
-
-/**
- * Create a publish-structure from an existing file hierarchy, inferring
- * and organizing keywords and metadata as much as possible. This
- * function primarily performs the recursive build and re-organizes
- * keywords and metadata; for automatically getting metadata
- * extraction, scanning of directories and creation of the respective
- * GNUNET_FS_FileInformation entries the default scanner should be
- * passed (GNUNET_FS_directory_scanner_default). This is strictly a
- * convenience function.
- *
- * @param client_info initial value for the client-info value for this entry
- * @param filename name of the top-level file or directory
- * @param scanner function used to get a list of files in a directory
- * @param scanner_cls closure for scanner
- * @param do_index should files in the hierarchy be indexed?
- * @param anonymity what is the desired anonymity level for sharing?
- * @param priority what is the priority for OUR node to
- * keep this file available? Use 0 for maximum anonymity and
- * minimum reliability...
- * @param expirationTime when should this content expire?
- * @param emsg where to store an error message
- * @return publish structure entry for the directory, NULL on error
- */
-struct GNUNET_FS_FileInformation *
-GNUNET_FS_file_information_create_from_directory (void *client_info,
- const char *filename,
- GNUNET_FS_DirectoryScanner scanner,
- void *scanner_cls,
- int do_index,
- uint32_t anonymity,
- uint32_t priority,
- struct GNUNET_TIME_Absolute expirationTime,
- char **emsg)