Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
filesystem.h
Go to the documentation of this file.
1
11#ifndef FILESYSTEM_H
12#define FILESYSTEM_H
13
14#include <wireshark.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/*
21 * Default profile name.
22 */
23#define DEFAULT_PROFILE "Default"
24
37WS_DLL_PUBLIC char *configuration_init(const char *arg0, const char* app_flavor_lower);
38
47WS_DLL_PUBLIC const char *get_progfile_dir(void);
48
64WS_DLL_PUBLIC char *get_executable_path(const char *filename);
65
76WS_DLL_PUBLIC const char *get_plugins_dir(const char* app_env_var_prefix);
77
87WS_DLL_PUBLIC const char *get_plugins_dir_with_version(const char* app_env_var_prefix);
88
97WS_DLL_PUBLIC const char *get_plugins_pers_dir(const char* app_env_var_prefix);
98
108WS_DLL_PUBLIC const char *get_plugins_pers_dir_with_version(const char* app_env_var_prefix);
109
121WS_DLL_PUBLIC const char *get_extcap_dir(const char* app_env_var_prefix, const char* dir_extcap);
122
132WS_DLL_PUBLIC const char *get_extcap_pers_dir(const char* app_env_var_prefix);
133
142WS_DLL_PUBLIC bool running_in_build_directory(void);
143
153WS_DLL_PUBLIC const char *get_datafile_dir(const char* app_env_var_prefix);
154
168WS_DLL_PUBLIC char *get_datafile_path(const char *filename, const char* app_env_var_prefix);
169
179WS_DLL_PUBLIC const char *get_doc_dir(const char* app_env_var_prefix);
180
194WS_DLL_PUBLIC char *get_docfile_path(const char *filename, const char* app_env_var_prefix);
195
209WS_DLL_PUBLIC char *doc_file_url(const char *filename, const char* app_env_var_prefix);
210
221WS_DLL_PUBLIC const char *get_systemfile_dir(const char* app_env_var_prefix);
222
231WS_DLL_PUBLIC void set_profile_name(const char *profilename);
232
241WS_DLL_PUBLIC const char *get_profile_name(void);
242
251WS_DLL_PUBLIC bool is_default_profile(void);
252
262WS_DLL_PUBLIC bool has_global_profiles(const char* app_env_var_prefix);
263
273WS_DLL_PUBLIC char *get_profiles_dir(const char* app_env_var_prefix);
274
289WS_DLL_PUBLIC char *get_profile_dir(const char* app_env_var_prefix, const char *profilename, bool is_global);
290
305WS_DLL_PUBLIC int create_profiles_dir(const char* app_env_var_prefix, char **pf_dir_path_return);
306
316WS_DLL_PUBLIC char *get_global_profiles_dir(const char* app_env_var_prefix);
317
326WS_DLL_PUBLIC void profile_store_persconffiles(bool store);
327
337WS_DLL_PUBLIC void profile_register_persconffile(const char *filename);
338
350WS_DLL_PUBLIC bool profile_exists(const char* app_env_var_prefix, const char *profilename, bool global);
351
366WS_DLL_PUBLIC int create_persconffile_profile(const char* app_env_var_prefix, const char *profilename,
367 char **pf_dir_path_return);
368
379WS_DLL_PUBLIC const GHashTable *allowed_profile_filenames(void);
380
395WS_DLL_PUBLIC int delete_persconffile_profile(const char* app_env_var_prefix, const char *profilename,
396 char **pf_dir_path_return);
397
415WS_DLL_PUBLIC int rename_persconffile_profile(const char* app_env_var_prefix, const char *fromname, const char *toname,
416 char **pf_from_dir_path_return,
417 char **pf_to_dir_path_return);
418
437WS_DLL_PUBLIC int copy_persconffile_profile(const char* app_env_var_prefix, const char *toname, const char *fromname,
438 bool from_global,
439 char **pf_filename_return,
440 char **pf_to_dir_path_return,
441 char **pf_from_dir_path_return);
442
456WS_DLL_PUBLIC int create_persconffile_dir(const char* app_env_var_prefix, char **pf_dir_path_return);
457
472WS_DLL_PUBLIC char *get_persconffile_path(const char *filename, bool from_profile, const char* app_env_var_prefix);
473
482WS_DLL_PUBLIC void set_persconffile_dir(const char *p);
483
493WS_DLL_PUBLIC const char *get_persdatafile_dir(void);
494
503WS_DLL_PUBLIC void set_persdatafile_dir(const char *p);
504
514WS_DLL_PUBLIC WS_RETNONNULL const char *get_current_working_dir(void);
515
526WS_DLL_PUBLIC const char *file_open_error_message(int err, bool for_writing);
527
537WS_DLL_PUBLIC const char *file_write_error_message(int err);
538
548WS_DLL_PUBLIC const char *get_basename(const char *path);
549
560WS_DLL_PUBLIC char *find_last_pathname_separator(const char *path);
561
573WS_DLL_PUBLIC char *get_dirname(char *path);
574
589WS_DLL_PUBLIC int test_for_directory(const char *path);
590
605WS_DLL_PUBLIC int test_for_fifo(const char *path);
606
617WS_DLL_PUBLIC bool test_for_regular_file(const char *path);
618
628WS_DLL_PUBLIC bool file_exists(const char *fname);
629
641WS_DLL_PUBLIC bool config_file_exists_with_entries(const char *fname, char comment_char);
642
654WS_DLL_PUBLIC bool files_identical(const char *fname1, const char *fname2);
655
668WS_DLL_PUBLIC bool file_needs_reopen(int fd, const char* filename);
669
685WS_DLL_PUBLIC bool write_file_binary_mode(const char *filename,
686 const void *content, size_t content_len);
687
702WS_DLL_PUBLIC bool copy_file_binary_mode(const char *from_filename,
703 const char *to_filename);
704
705
718WS_DLL_PUBLIC char* data_file_url(const char *filename, const char* app_env_var_prefix);
719
727WS_DLL_PUBLIC void free_progdirs(void);
728
729#ifdef __cplusplus
730}
731#endif /* __cplusplus */
732
733#endif /* FILESYSTEM_H */
WS_DLL_PUBLIC char * doc_file_url(const char *filename, const char *app_env_var_prefix)
Constructs the URL path to a global documentation file.
Definition filesystem.c:2695
WS_DLL_PUBLIC char * get_profiles_dir(const char *app_env_var_prefix)
Gets the directory used to store configuration profile directories.
Definition filesystem.c:1656
WS_DLL_PUBLIC const char * get_basename(const char *path)
Returns the last component of a pathname.
Definition filesystem.c:106
WS_DLL_PUBLIC int test_for_fifo(const char *path)
Tests whether a given pathname refers to a FIFO (named pipe).
Definition filesystem.c:187
WS_DLL_PUBLIC const char * get_persdatafile_dir(void)
Gets the default directory in which personal data is stored.
Definition filesystem.c:2090
WS_DLL_PUBLIC char * get_dirname(char *path)
Returns the directory portion of a pathname.
Definition filesystem.c:133
WS_DLL_PUBLIC const char * get_profile_name(void)
Gets the current configuration profile name used for storing personal configuration files.
Definition filesystem.c:1438
WS_DLL_PUBLIC int copy_persconffile_profile(const char *app_env_var_prefix, const char *toname, const char *fromname, bool from_global, char **pf_filename_return, char **pf_to_dir_path_return, char **pf_from_dir_path_return)
Copies configuration files from one profile to another.
Definition filesystem.c:2030
WS_DLL_PUBLIC char * configuration_init(const char *arg0, const char *app_flavor_lower)
Initialize our configuration environment.
Definition filesystem.c:901
WS_DLL_PUBLIC int delete_persconffile_profile(const char *app_env_var_prefix, const char *profilename, char **pf_dir_path_return)
Deletes the directory for the given configuration profile.
Definition filesystem.c:1881
WS_DLL_PUBLIC void set_profile_name(const char *profilename)
Sets the configuration profile name for storing personal configuration files.
Definition filesystem.c:1424
WS_DLL_PUBLIC char * get_docfile_path(const char *filename, const char *app_env_var_prefix)
Constructs the full path to a global documentation file.
Definition filesystem.c:2201
WS_DLL_PUBLIC void set_persconffile_dir(const char *p)
Sets the path of the personal configuration file directory.
Definition filesystem.c:1649
WS_DLL_PUBLIC void set_persdatafile_dir(const char *p)
Sets the path of the directory in which personal data is stored.
Definition filesystem.c:2133
WS_DLL_PUBLIC const char * get_plugins_dir_with_version(const char *app_env_var_prefix)
Append VERSION_MAJOR.VERSION_MINOR to the plugin dir.
Definition filesystem.c:1247
WS_DLL_PUBLIC char * get_global_profiles_dir(const char *app_env_var_prefix)
Gets the directory used to store global configuration profile directories.
Definition filesystem.c:1702
WS_DLL_PUBLIC bool has_global_profiles(const char *app_env_var_prefix)
Checks whether global configuration profiles are available.
Definition filesystem.c:1454
WS_DLL_PUBLIC const char * get_progfile_dir(void)
Get the directory in which the main (Wireshark, TShark, Stratoshark, etc) program resides.
Definition filesystem.c:914
WS_DLL_PUBLIC bool copy_file_binary_mode(const char *from_filename, const char *to_filename)
Copies a file using binary mode.
Definition filesystem.c:2611
WS_DLL_PUBLIC const char * get_doc_dir(const char *app_env_var_prefix)
Gets the directory in which global documentation files are stored.
WS_DLL_PUBLIC bool config_file_exists_with_entries(const char *fname, char comment_char)
Checks if a configuration file exists and contains non-comment entries.
Definition filesystem.c:2369
WS_DLL_PUBLIC const char * get_plugins_dir(const char *app_env_var_prefix)
Get the directory in which plugins are stored.
Definition filesystem.c:1239
WS_DLL_PUBLIC bool files_identical(const char *fname1, const char *fname2)
Checks whether two filenames refer to the same file.
Definition filesystem.c:2407
WS_DLL_PUBLIC char * data_file_url(const char *filename, const char *app_env_var_prefix)
Constructs a filesystem URL from a given filename.
Definition filesystem.c:2674
WS_DLL_PUBLIC bool file_exists(const char *fname)
Checks whether a file exists.
Definition filesystem.c:2354
WS_DLL_PUBLIC WS_RETNONNULL const char * get_current_working_dir(void)
Gets the current working directory.
Definition filesystem.c:920
WS_DLL_PUBLIC const char * get_extcap_pers_dir(const char *app_env_var_prefix)
Gets the personal extcap directory.
Definition filesystem.c:1390
WS_DLL_PUBLIC char * get_executable_path(const char *filename)
Given the program name, construct the path name of a non-extcap Wireshark executable file.
Definition filesystem.c:530
WS_DLL_PUBLIC int create_persconffile_profile(const char *app_env_var_prefix, const char *profilename, char **pf_dir_path_return)
Creates a directory for the given configuration profile.
Definition filesystem.c:1927
WS_DLL_PUBLIC int rename_persconffile_profile(const char *app_env_var_prefix, const char *fromname, const char *toname, char **pf_from_dir_path_return, char **pf_to_dir_path_return)
Renames the directory for the given configuration profile.
Definition filesystem.c:1899
WS_DLL_PUBLIC void free_progdirs(void)
Frees internal program directory structures.
Definition filesystem.c:2716
WS_DLL_PUBLIC const char * get_extcap_dir(const char *app_env_var_prefix, const char *dir_extcap)
Gets the directory in which extcap hooks are stored.
Definition filesystem.c:1381
WS_DLL_PUBLIC int create_persconffile_dir(const char *app_env_var_prefix, char **pf_dir_path_return)
Creates the directory that holds personal configuration files, if necessary.
Definition filesystem.c:2024
WS_DLL_PUBLIC bool file_needs_reopen(int fd, const char *filename)
Checks whether a file has been recreated since it was opened.
Definition filesystem.c:2480
WS_DLL_PUBLIC char * get_datafile_path(const char *filename, const char *app_env_var_prefix)
Constructs the full path to a global configuration file.
Definition filesystem.c:2179
WS_DLL_PUBLIC const char * get_datafile_dir(const char *app_env_var_prefix)
Gets the directory in which global configuration files are stored.
Definition filesystem.c:982
WS_DLL_PUBLIC int test_for_directory(const char *path)
Tests whether a given pathname refers to a directory.
Definition filesystem.c:173
WS_DLL_PUBLIC bool running_in_build_directory(void)
Indicates whether Wireshark is running from a build directory.
Definition filesystem.c:1402
WS_DLL_PUBLIC int create_profiles_dir(const char *app_env_var_prefix, char **pf_dir_path_return)
Creates the directory used to store configuration profile directories.
Definition filesystem.c:1663
WS_DLL_PUBLIC const char * get_systemfile_dir(const char *app_env_var_prefix)
Gets the directory in which system files are stored.
WS_DLL_PUBLIC char * get_profile_dir(const char *app_env_var_prefix, const char *profilename, bool is_global)
Gets the directory used to store configuration files for a given profile.
Definition filesystem.c:1727
WS_DLL_PUBLIC void profile_register_persconffile(const char *filename)
Registers a filename to the personal configuration files storage.
Definition filesystem.c:1491
WS_DLL_PUBLIC const char * file_open_error_message(int err, bool for_writing)
Returns a human-readable error message for file open or create failures.
Definition filesystem.c:2220
WS_DLL_PUBLIC const char * file_write_error_message(int err)
Returns a human-readable error message for write operation failures.
Definition filesystem.c:2325
WS_DLL_PUBLIC const char * get_plugins_pers_dir_with_version(const char *app_env_var_prefix)
Appends VERSION_MAJOR.VERSION_MINOR to the personal plugin directory path.
Definition filesystem.c:1266
WS_DLL_PUBLIC bool profile_exists(const char *app_env_var_prefix, const char *profilename, bool global)
Checks whether a given configuration profile exists.
Definition filesystem.c:1753
WS_DLL_PUBLIC char * get_persconffile_path(const char *filename, bool from_profile, const char *app_env_var_prefix)
Constructs the full path name of a personal configuration file.
Definition filesystem.c:2153
WS_DLL_PUBLIC bool write_file_binary_mode(const char *filename, const void *content, size_t content_len)
Writes raw content to a file in binary mode.
Definition filesystem.c:2545
WS_DLL_PUBLIC const GHashTable * allowed_profile_filenames(void)
Returns the list of known profile configuration filenames.
Definition filesystem.c:2018
WS_DLL_PUBLIC void profile_store_persconffiles(bool store)
Enables or disables tracking of personal configuration file names for profile duplication.
Definition filesystem.c:1482
WS_DLL_PUBLIC bool is_default_profile(void)
Checks whether the current configuration profile is the default profile.
Definition filesystem.c:1448
WS_DLL_PUBLIC char * find_last_pathname_separator(const char *path)
Returns a pointer to the last pathname separator in a given path.
Definition filesystem.c:73
WS_DLL_PUBLIC bool test_for_regular_file(const char *path)
Tests whether a given pathname refers to a regular file.
Definition filesystem.c:201
WS_DLL_PUBLIC const char * get_plugins_pers_dir(const char *app_env_var_prefix)
Gets the personal plugin directory.
Definition filesystem.c:1258