epan: use json_dumper for json outputs.
[metze/wireshark/wip.git] / wsutil / tempfile.h
1 /* tempfile.h
2  * Declarations of routines to create temporary files
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * SPDX-License-Identifier: GPL-2.0-or-later
9  */
10
11 #ifndef __TEMPFILE_H__
12 #define __TEMPFILE_H__
13
14 #include "ws_symbol_export.h"
15
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
19
20 /** @file
21  * Convenience function for temporary file creation.
22  */
23
24 /**
25  * Construct the path name of a file in the appropriate temporary
26  * file directory.
27  *
28  * @param filename the file name to be given to the file.
29  * @return the pathname of the file, g_malloced so the caller
30  * should g_free it.
31  */
32 WS_DLL_PUBLIC char *get_tempfile_path(const char *filename);
33
34 /**
35  * Create a tempfile with the given prefix (e.g. "wireshark"). The path
36  * is created using g_get_tmp_dir and mkstemp.
37  *
38  * @param namebuf [in,out] If not NULL, receives the full path of the temp file.
39  *                Must NOT be freed.
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().
44  */
45 WS_DLL_PUBLIC int create_tempfile(char **namebuf, const char *pfx, const char *sfx);
46
47 #ifdef __cplusplus
48 }
49 #endif /* __cplusplus */
50
51 #endif /* __TEMPFILE_H__ */