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
11 #ifndef __TEMPFILE_H__
12 #define __TEMPFILE_H__
14 #include "ws_symbol_export.h"
18 #endif /* __cplusplus */
21 * Convenience function for temporary file creation.
25 * Construct the path name of a file in the appropriate temporary
28 * @param filename the file name to be given to the file.
29 * @return the pathname of the file, g_malloced so the caller
32 WS_DLL_PUBLIC char *get_tempfile_path(const char *filename);
35 * Create a tempfile with the given prefix (e.g. "wireshark"). The path
36 * is created using g_get_tmp_dir and mkstemp.
38 * @param namebuf [in,out] If not NULL, receives the full path of the temp file.
40 * @param pfx [in] A prefix for the temporary file.
41 * @param sfx [in] A file extension for the temporary file. NULL can be passed
42 * if no file extension is needed
43 * @return The file descriptor of the new tempfile, from mkstemps().
45 WS_DLL_PUBLIC int create_tempfile(char **namebuf, const char *pfx, const char *sfx);
49 #endif /* __cplusplus */
51 #endif /* __TEMPFILE_H__ */