GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
- by the Free Software Foundation; either version 2, or (at your
+ by the Free Software Foundation; either version 3, or (at your
option) any later version.
GNUnet is distributed in the hope that it will be useful, but
* @author Christian Grothoff
*
* TODO:
- * - serialization/deserialization (& deserialization API)
* - metadata filename clean up code
* - metadata/ksk generation for directories from contained files
*/
anonymity,
priority,
expirationTime);
+ if (ret == NULL)
+ return NULL;
ret->h = h;
ret->filename = GNUNET_strdup (filename);
fn = filename;
dc.entries = dc.entries->next;
}
fn = filename;
- while (NULL != (ss = strstr (fn,
- DIR_SEPARATOR_STR)))
+ while ( (NULL != (ss = strstr (fn,
+ DIR_SEPARATOR_STR))) &&
+ (strlen (ss) > 1) )
fn = ss + 1;
GNUNET_CONTAINER_meta_data_insert (ret->meta,
"<gnunet>",
}
+/**
+ * Test if a given entry represents a directory.
+ *
+ * @param ent check if this FI represents a directory
+ * @return GNUNET_YES if so, GNUNET_NO if not
+ */
+int
+GNUNET_FS_file_information_is_directory (struct GNUNET_FS_FileInformation *ent)
+{
+ return ent->is_directory;
+}
+
+
/**
* Create an entry for an empty directory in a publish-structure.
* This function should be used by applications for which the
void *proc_cls)
{
struct GNUNET_FS_FileInformation *pos;
+ int no;
+ no = GNUNET_NO;
if (GNUNET_OK !=
proc (proc_cls,
dir,
&dir->keywords,
&dir->anonymity,
&dir->priority,
+ (dir->is_directory) ? &no : &dir->data.file.do_index,
&dir->expirationTime,
&dir->client_info))
return;
pos = dir->data.dir.entries;
while (pos != NULL)
{
+ no = GNUNET_NO;
if (GNUNET_OK !=
proc (proc_cls,
pos,
&pos->keywords,
&pos->anonymity,
&pos->priority,
+ (dir->is_directory) ? &no : &dir->data.file.do_index,
&pos->expirationTime,
&pos->client_info))
break;
void *cleaner_cls)
{
struct GNUNET_FS_FileInformation *pos;
+ int no;
+ no = GNUNET_NO;
if (fi->is_directory)
{
/* clean up directory */
&fi->keywords,
&fi->anonymity,
&fi->priority,
+ &no,
&fi->expirationTime,
&fi->client_info);
GNUNET_free_non_null (fi->data.dir.dir_data);
&fi->keywords,
&fi->anonymity,
&fi->priority,
+ &fi->data.file.do_index,
&fi->expirationTime,
&fi->client_info);
}