2006-02-12 21:52:18 +00:00
|
|
|
/* tempfile.h
|
|
|
|
* Declarations of routines to create temporary files
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2006-02-12 21:52:18 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-07 11:26:45 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2006-02-12 21:52:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __TEMPFILE_H__
|
|
|
|
#define __TEMPFILE_H__
|
|
|
|
|
2013-06-26 01:14:35 +00:00
|
|
|
#include "ws_symbol_export.h"
|
|
|
|
|
2006-02-12 21:52:18 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2009-07-01 23:36:51 +00:00
|
|
|
/** @file
|
|
|
|
* Convenience function for temporary file creation.
|
2006-02-12 21:52:18 +00:00
|
|
|
*/
|
2009-07-01 23:36:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a tempfile with the given prefix (e.g. "wireshark"). The path
|
2019-09-01 18:37:38 +00:00
|
|
|
* is created using g_file_open_tmp.
|
2013-01-26 15:41:16 +00:00
|
|
|
*
|
2013-12-02 13:45:59 +00:00
|
|
|
* @param namebuf [in,out] If not NULL, receives the full path of the temp file.
|
2019-09-01 18:37:38 +00:00
|
|
|
* Must be freed.
|
2013-12-02 13:45:59 +00:00
|
|
|
* @param pfx [in] A prefix for the temporary file.
|
2016-05-29 17:52:19 +00:00
|
|
|
* @param sfx [in] A file extension for the temporary file. NULL can be passed
|
|
|
|
* if no file extension is needed
|
2019-09-01 18:37:38 +00:00
|
|
|
* @param sfx [out] Any error returned by g_file_open_tmp. May be NULL.
|
2016-05-29 17:52:19 +00:00
|
|
|
* @return The file descriptor of the new tempfile, from mkstemps().
|
2009-07-01 23:36:51 +00:00
|
|
|
*/
|
2019-09-01 18:37:38 +00:00
|
|
|
WS_DLL_PUBLIC int create_tempfile(gchar **namebuf, const char *pfx, const char *sfx, GError **err);
|
2006-02-12 21:52:18 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* __TEMPFILE_H__ */
|