- mark old API calls used for previous VPN implementation as deprecated
[oweals/gnunet.git] / src / include / gnunet_disk_lib.h
index d6ec0fe80e9d488878b24f817a53e153fb33fc66..d364568b648dc8184cee02e57001edf2ec304737 100644 (file)
@@ -355,6 +355,21 @@ char *
 GNUNET_DISK_mktemp (const char *t);
 
 
+/**
+ * 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/".
+ * @return NULL on error, otherwise name of fresh
+ *         file on disk in directory for temporary files
+ */
+char *
+GNUNET_DISK_mkdtemp (const char *t);
+
+
 /**
  * Open a file.  Note that the access permissions will only be
  * used if a new file is created and if the underlying operating
@@ -410,6 +425,7 @@ GNUNET_DISK_pipe (int blocking_read, int blocking_write, int inherit_read, int i
 struct GNUNET_DISK_PipeHandle *
 GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]);
 
+
 /**
  * Closes an interprocess channel
  * @param p pipe
@@ -418,6 +434,7 @@ GNUNET_DISK_pipe_from_fd (int blocking_read, int blocking_write, int fd[2]);
 int
 GNUNET_DISK_pipe_close (struct GNUNET_DISK_PipeHandle *p);
 
+
 /**
  * Closes one half of an interprocess channel
  *
@@ -450,6 +467,17 @@ const struct GNUNET_DISK_FileHandle *
 GNUNET_DISK_pipe_handle (const struct GNUNET_DISK_PipeHandle *p,
                          enum GNUNET_DISK_PipeEnd n);
 
+
+/**
+ * Get a handle from a native FD.
+ *
+ * @param fd native file descriptor
+ * @return file handle corresponding to the descriptor
+ */
+struct GNUNET_DISK_FileHandle *
+GNUNET_DISK_get_handle_from_native (FILE *fd);
+
+
 /**
  * Read the contents of a binary file into a buffer.
  * @param h handle to an open file
@@ -461,6 +489,7 @@ ssize_t
 GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result,
                        size_t len);
 
+
 /**
  * Read the contents of a binary file into a buffer.
  * Guarantees not to block (returns GNUNET_SYSERR and sets errno to EAGAIN
@@ -473,7 +502,8 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, void *result,
  */
 ssize_t
 GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle * h,
-    void *result, size_t len);
+                                   void *result, size_t len);
+
 
 /**
  * Read the contents of a binary file into a buffer.