Go to the documentation of this file.
25 #ifndef SURICATA_UTIL_PATH_H
26 #define SURICATA_UTIL_PATH_H
29 typedef struct _stat
SCStat;
30 #define SCFstatFn(fd, statbuf) _fstat((fd), (statbuf))
31 #define SCStatFn(pathname, statbuf) _stat((pathname), (statbuf))
33 typedef struct stat
SCStat;
34 #define SCFstatFn(fd, statbuf) fstat((fd), (statbuf))
35 #define SCStatFn(pathname, statbuf) stat((pathname), (statbuf))
38 #if defined OS_WIN32 || defined __CYGWIN__
39 #define PATH_SEPARATOR_SIZE 2
41 #define PATH_SEPARATOR_SIZE 1
44 #ifndef HAVE_NON_POSIX_MKDIR
45 #define SCMkDir(a, b) mkdir(a, b)
47 #define SCMkDir(a, b) mkdir(a)
52 int PathMerge(
char *out_buf,
size_t buf_size,
const char *
const dir,
const char *
const fname);
53 char *
PathMergeAlloc(
const char *
const dir,
const char *
const fname);
54 int PathJoin(
char *out_buf,
size_t buf_len,
const char *
const dir,
const char *
const fname);
60 char *
SCRealPath(
const char *path,
char *resolved_path);
int PathIsAbsolute(const char *)
Check if a path is absolute.
bool SCIsRegularDirectory(const struct dirent *const dir_entry)
OS independent wrapper for directory check.
int PathIsRelative(const char *)
Check if a path is relative.
bool SCIsRegularFile(const struct dirent *const dir_entry)
OS independent to check for regular file.
char * SCRealPath(const char *path, char *resolved_path)
OS independent wrapper for realpath.
bool SCPathContainsTraversal(const char *path)
Check for directory traversal.
int SCCreateDirectoryTree(const char *path, const bool final)
Recursively create a directory.
int PathMerge(char *out_buf, size_t buf_size, const char *const dir, const char *const fname)
int SCDefaultMkDir(const char *path)
Wrapper around SCMkDir with default mode arguments.
int PathJoin(char *out_buf, size_t buf_len, const char *const dir, const char *const fname)
Wrapper to join a directory and filename and resolve using realpath _fullpath is used for WIN32.
const char * SCBasename(const char *path)
char * PathMergeAlloc(const char *const dir, const char *const fname)
bool SCPathExists(const char *path)
Check if a path exists.