aboutsummaryrefslogtreecommitdiff
path: root/analyzer/utils/fs.h
blob: 6335799b69f9488df1afb5a3e72f1fd114a717e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);