dissector_add() --> dissector_add_uint();
[metze/wireshark/wip.git] / tempfile.h
index 1c073e5e2bf0dcd526f41e8c1bda30db55c9feb3..2a7fc5148c5d7fb2353b977fa30d100db6596de0 100644 (file)
 extern "C" {
 #endif /* __cplusplus */
 
-/* create a tempfile with the given prefix (e.g. "ether")
- * namebuf (and namebuflen) should be 128+1 bytes long (BTW: why?)
- * returns the file descriptor of the new tempfile and
- * the name of the new file in namebuf 
+/** @file
+ * Convenience function for temporary file creation.
  */
-int create_tempfile(char *namebuf, int namebuflen, const char *pfx);
+
+
+/**
+ * Create a tempfile with the given prefix (e.g. "wireshark"). The path
+ * is created using g_get_tmp_dir and mkstemp.
+ * 
+ * @param namebuf If not NULL, receives the full path of the temp file.
+ *                Must NOT be freed.
+ * @param pfx A prefix for the temporary file.
+ * @return The file descriptor of the new tempfile, from mkstemp().
+ */
+int create_tempfile(char **namebuf, const char *pfx);
+
+/**
+ * Create a directory with the given prefix (e.g. "wireshark"). The path
+ * is created using g_get_tmp_dir and mkdtemp.
+ * 
+ * @param namebuf If not NULL, receives the full path of the temp directory.
+ *                Must NOT be freed.
+ * @param pfx A prefix for the temporary directory.
+ * @return The temporary directory path on success, or NULL on failure.
+ *         Must NOT be freed.
+ */
+const char *create_tempdir(char **namebuf, const char *pfx);
 
 #ifdef __cplusplus
 }