Wireshark 4.7.4
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
filesystem.h
Go to the documentation of this file.
1
10
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
667WS_DLL_PUBLIC unsigned files_identical_hash(const void* fname);
668
681WS_DLL_PUBLIC bool file_needs_reopen(int fd, const char* filename);
682
698WS_DLL_PUBLIC bool write_file_binary_mode(const char *filename,
699 const void *content, size_t content_len);
700
715WS_DLL_PUBLIC bool copy_file_binary_mode(const char *from_filename,
716 const char *to_filename);
717
718
731WS_DLL_PUBLIC char* data_file_url(const char *filename, const char* app_env_var_prefix);
732
740WS_DLL_PUBLIC void free_progdirs(void);
741
742#ifdef __cplusplus
743}
744#endif /* __cplusplus */
745
746#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:2813
WS_DLL_PUBLIC unsigned files_identical_hash(const void *fname)
Create hash value using same metrics as files_identical().
Definition filesystem.c:2580
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:1680
WS_DLL_PUBLIC const char * get_basename(const char *path)
Returns the last component of a pathname.
Definition filesystem.c:109
WS_DLL_PUBLIC int test_for_fifo(const char *path)
Tests whether a given pathname refers to a FIFO (named pipe).
Definition filesystem.c:190
WS_DLL_PUBLIC const char * get_persdatafile_dir(void)
Gets the default directory in which personal data is stored.
Definition filesystem.c:2193
WS_DLL_PUBLIC char * get_dirname(char *path)
Returns the directory portion of a pathname.
Definition filesystem.c:136
WS_DLL_PUBLIC const char * get_profile_name(void)
Gets the current configuration profile name used for storing personal configuration files.
Definition filesystem.c:1456
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:2119
WS_DLL_PUBLIC char * configuration_init(const char *arg0, const char *app_flavor_lower)
Initialize our configuration environment.
Definition filesystem.c:923
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:1946
WS_DLL_PUBLIC void set_profile_name(const char *profilename)
Sets the configuration profile name for storing personal configuration files.
Definition filesystem.c:1442
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:2304
WS_DLL_PUBLIC void set_persconffile_dir(const char *p)
Sets the path of the personal configuration file directory.
Definition filesystem.c:1673
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:2236
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:1268
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:1752
WS_DLL_PUBLIC bool has_global_profiles(const char *app_env_var_prefix)
Checks whether global configuration profiles are available.
Definition filesystem.c:1472
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:936
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:2722
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:2472
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:1260
WS_DLL_PUBLIC bool files_identical(const char *fname1, const char *fname2)
Checks whether two filenames refer to the same file.
Definition filesystem.c:2591
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:2792
WS_DLL_PUBLIC bool file_exists(const char *fname)
Checks whether a file exists.
Definition filesystem.c:2457
WS_DLL_PUBLIC WS_RETNONNULL const char * get_current_working_dir(void)
Gets the current working directory.
Definition filesystem.c:942
WS_DLL_PUBLIC const char * get_extcap_pers_dir(const char *app_env_var_prefix)
Gets the personal extcap directory.
Definition filesystem.c:1406
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:537
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:2009
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:1970
WS_DLL_PUBLIC void free_progdirs(void)
Frees internal program directory structures.
Definition filesystem.c:2834
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:1397
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:2113
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:2605
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:2282
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:1004
WS_DLL_PUBLIC int test_for_directory(const char *path)
Tests whether a given pathname refers to a directory.
Definition filesystem.c:176
WS_DLL_PUBLIC bool running_in_build_directory(void)
Indicates whether Wireshark is running from a build directory.
Definition filesystem.c:1418
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:1713
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:1802
WS_DLL_PUBLIC void profile_register_persconffile(const char *filename)
Registers a filename to the personal configuration files storage.
Definition filesystem.c:1509
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:2323
WS_DLL_PUBLIC const char * file_write_error_message(int err)
Returns a human-readable error message for write operation failures.
Definition filesystem.c:2428
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:1287
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:1808
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:2256
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:2656
WS_DLL_PUBLIC const GHashTable * allowed_profile_filenames(void)
Returns the list of known profile configuration filenames.
Definition filesystem.c:2107
WS_DLL_PUBLIC void profile_store_persconffiles(bool store)
Enables or disables tracking of personal configuration file names for profile duplication.
Definition filesystem.c:1500
WS_DLL_PUBLIC bool is_default_profile(void)
Checks whether the current configuration profile is the default profile.
Definition filesystem.c:1466
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:76
WS_DLL_PUBLIC bool test_for_regular_file(const char *path)
Tests whether a given pathname refers to a regular file.
Definition filesystem.c:204
WS_DLL_PUBLIC const char * get_plugins_pers_dir(const char *app_env_var_prefix)
Gets the personal plugin directory.
Definition filesystem.c:1279