Tor  0.4.7.0-alpha-dev
dir.h
Go to the documentation of this file.
1 /* Copyright (c) 2003-2004, Roger Dingledine
2  * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
3  * Copyright (c) 2007-2021, The Tor Project, Inc. */
4 /* See LICENSE for licensing information */
5 
6 #ifndef TOR_DIR_H
7 #define TOR_DIR_H
8 
9 /**
10  * \file dir.h
11  *
12  * \brief Header for dir.c
13  **/
14 
15 #include "lib/cc/compat_compiler.h"
17 
18 /** Possible behaviors for check_private_dir() on encountering a nonexistent
19  * directory; see that function's documentation for details. */
20 typedef unsigned int cpd_check_t;
21 #define CPD_NONE 0
22 #define CPD_CREATE (1u << 0)
23 #define CPD_CHECK (1u << 1)
24 #define CPD_GROUP_OK (1u << 2)
25 #define CPD_GROUP_READ (1u << 3)
26 #define CPD_CHECK_MODE_ONLY (1u << 4)
27 #define CPD_RELAX_DIRMODE_CHECK (1u << 5)
28 MOCK_DECL(int, check_private_dir, (const char *dirname, cpd_check_t check,
29  const char *effective_user));
30 
31 MOCK_DECL(struct smartlist_t *, tor_listdir, (const char *dirname));
32 
33 #endif /* !defined(TOR_DIR_H) */
Utility macros to handle different features and behavior in different compilers.
struct smartlist_t * tor_listdir(const char *dirname)
Definition: dir.c:307
int check_private_dir(const char *dirname, cpd_check_t check, const char *effective_user)
Definition: dir.c:71
unsigned int cpd_check_t
Definition: dir.h:20
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)
Definition: testsupport.h:127