diff options
| author | Maciej Borowiec <81316152+Mosder@users.noreply.github.com> | 2026-06-14 01:54:07 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-14 01:54:07 +0200 |
| commit | 2e3f7fe39791cd671a68330f7ba7a5bb5fc6f9ae (patch) | |
| tree | bf2f679387bff19637e1183400c0b0290d2d1834 /analyzer/utils/fs.h | |
| parent | 35dc15a03ba5cf2dec10d63a1fdc7ab1fb082899 (diff) | |
| parent | c2568d72efca8fae3c610072cb055f9c8de3ca5f (diff) | |
Merge pull request #4 from Mosder/2-simple-capturing-mode
Simple capturing mode
Diffstat (limited to 'analyzer/utils/fs.h')
| -rw-r--r-- | analyzer/utils/fs.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/analyzer/utils/fs.h b/analyzer/utils/fs.h new file mode 100644 index 0000000..6335799 --- /dev/null +++ b/analyzer/utils/fs.h @@ -0,0 +1,31 @@ +// utils/fs.h +// functions for operating on the file system, i.e. creating directories, writing files, etc. + +#include <sys/types.h> + +// get main directory used by the program +// params: +// - main_dir - buffer to save the directory to +extern void get_main_dir(char *main_dir); + +// get directory to save the .pcap files to +// params: +// - capture_dir - buffer to save the directory to +extern void get_capture_dir(char *capture_dir); + +// get directory of save data of the program +// params: +// - saves_dir - buffer to save the directory to +extern void get_saves_dir(char *saves_dir); + +// create directories that will be used by the program +extern void create_necessary_directories(); + +// writes file to the specified path +// params: +// - path - path to write the file to +// - contents - contents of the file +// - contents_len - amount of bytes of contents to write +// - flags - flags to open the file with +// - permissions - permissions of the written file +extern void write_file(char *path, void *contents, int contents_len, int flags, mode_t permissions); |
