HKDF (does not work yet)
[oweals/gnunet.git] / src / include / gnunet_disk_lib.h
index 69f7fb825f7a873f12d65f5ca2dcddb0a0f4da23..980f142c5668ee5aa404c4dd72ffbd86d3bed9dd 100644 (file)
@@ -293,7 +293,10 @@ int GNUNET_DISK_file_get_identifiers (const char *filename,
  
 
 /**
- * Create an (empty) temporary file on disk.
+ * Create an (empty) temporary file on disk.  If the given name is not
+ * an absolute path, the current 'TMPDIR' will be prepended.  In any case,
+ * 6 random characters will be appended to the name to create a unique
+ * filename.
  * 
  * @param t component to use for the name;
  *        does NOT contain "XXXXXX" or "/tmp/".
@@ -312,7 +315,7 @@ GNUNET_DISK_mktemp (const char *t);
  * @param fn file name to be opened
  * @param flags opening flags, a combination of GNUNET_DISK_OPEN_xxx bit flags
  * @param perm permissions for the newly created file, use
- *             GNUNET_DISK_PERM_USER_NONE if a file could not be created by this
+ *             GNUNET_DISK_PERM_NONE if a file could not be created by this
  *             call (because of flags)
  * @return IO handle on success, NULL on error
  */
@@ -327,6 +330,7 @@ struct GNUNET_DISK_FileHandle *GNUNET_DISK_file_open (const char *fn,
  */
 struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking);
 
+
 /**
  * Closes an interprocess channel
  * @param p pipe
@@ -334,6 +338,17 @@ struct GNUNET_DISK_PipeHandle *GNUNET_DISK_pipe (int blocking);
  */
 int GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
 
+/**
+ * Closes one half of an interprocess channel
+ *
+ * @param p pipe to close end of
+ * @param end which end of the pipe to close
+ * @return GNUNET_OK on success, GNUNET_SYSERR otherwise
+ */
+int
+GNUNET_DISK_pipe_close_end (struct GNUNET_DISK_PipeHandle *p, 
+                           enum GNUNET_DISK_PipeEnd end);
+
 /**
  * Close an open file.
  *
@@ -342,8 +357,10 @@ int GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
  */
 int GNUNET_DISK_file_close (struct GNUNET_DISK_FileHandle *h);
 
+
 /**
  * Get the handle to a particular pipe end
+ *
  * @param p pipe
  * @param n end to access
  * @return handle for the respective end
@@ -384,7 +401,7 @@ ssize_t GNUNET_DISK_fn_read (const char *fn,
  * @param h handle to open file
  * @param buffer the data to write
  * @param n number of bytes to write
- * @return GNUNET_OK on success, GNUNET_SYSERR on error
+ * @return number of bytes written on success, GNUNET_SYSERR on error
  */
 ssize_t GNUNET_DISK_file_write (const struct GNUNET_DISK_FileHandle *h, 
                                const void *buffer,
@@ -441,7 +458,8 @@ struct GNUNET_DISK_DirectoryIterator;
  *
  * @param cls closure
  * @param di argument to pass to "GNUNET_DISK_directory_iterator_next" to
- *           get called on the next entry (or finish cleanly)
+ *           get called on the next entry (or finish cleanly);
+ *           NULL on error (will be the last call in that case)
  * @param filename complete filename (absolute path)
  * @param dirname directory name (absolute path)
  */