Revert "UNUSED enc_key_id_{equal,hash}"
[wireshark-sm.git] / wsutil / tempfile.h
blob328324f02d3f8b215d9521c0f12ae003e01cb45d
1 /* tempfile.h
2 * Declarations of routines to create temporary files
4 * Wireshark - Network traffic analyzer
5 * By Gerald Combs <gerald@wireshark.org>
6 * Copyright 1998 Gerald Combs
8 * SPDX-License-Identifier: GPL-2.0-or-later
9 */
11 #ifndef __TEMPFILE_H__
12 #define __TEMPFILE_H__
14 #include <wireshark.h>
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 /** @file
21 * Convenience function for temporary file creation.
24 /**
25 * Create a tempfile with the given prefix (e.g. "wireshark"). The path
26 * is created using g_file_open_tmp.
28 * @param tempdir [in] If not NULL, the directory in which to create the file.
29 * @param namebuf [in,out] If not NULL, receives the full path of the temp file.
30 * Must be g_freed.
31 * @param pfx [in] A prefix for the temporary file.
32 * @param sfx [in] A file extension for the temporary file. NULL can be passed
33 * if no file extension is needed
34 * @param err [out] Any error returned by g_file_open_tmp. May be NULL.
35 * @return The file descriptor of the new tempfile, from mkstemps().
37 WS_DLL_PUBLIC int create_tempfile(const char *tempdir, char **namebuf, const char *pfx, const char *sfx, GError **err);
39 /**
40 * Create a tempfile with the given parent directory (e.g. "/my/private/tmp"). The path
41 * is created using g_mkdtemp.
43 * @param parent_dir [in] If not NULL, the parent directory in which to create the subdirectory,
44 * otherwise the system temporary directory is used.
45 * @param tmpl [in] A template for the temporary directory.
46 * @param err [out] Any error returned by g_mkdtemp. May be NULL.
47 * @return The full path of the temporary directory or NULL on error. Must be g_freed.
49 WS_DLL_PUBLIC char *create_tempdir(const char *parent_dir, const char *tmpl, GError **err);
51 #ifdef __cplusplus
53 #endif /* __cplusplus */
55 #endif /* __TEMPFILE_H__ */