peapod  0.1.0
EAPOL Proxy Daemon
args.h
Go to the documentation of this file.
1 /**
2  * @file args.h
3  * @brief Function prototypes for @p args.c, global program arguments data
4  * structure
5  */
6 #pragma once
7 #include <stdint.h>
8 
9 /**
10  * @brief The program arguments data structure
11  * @see @p defaults.h
12  */
13 struct args_t {
14  uint8_t help; /**< @brief Flag: Was @p -h provided? */
15  uint8_t daemon; /**< @brief Flag: Was @p -d provided? */
16  /**
17  * @brief A C string containing the path to the PID file
18  *
19  * Providing @p -d means that this will be set to @e something, because
20  * running as a daemon requires a PID file. May be the argument to
21  * @p -p. Defaults to @p PEAPOD_PID_PATH.
22  */
23  char *pidfile;
24  /**
25  * @brief A C string containing the path to the config file
26  *
27  * May be the argument to @p -c. Defaults to @c PEAPOD_CONF_PATH.
28  */
29  char *conffile;
30  uint8_t test; /**< @brief Flag: Was @p -t provided? */
31  /**
32  * @brief Logging level
33  *
34  * Defaults to @p LOG_NOTICE (5). Providing @p -v increments this up to
35  * @p LOG_DEBUGPKT (8).
36  *
37  * @see log.h
38  */
39  uint8_t level;
40  /**
41  * @brief The path to the log file
42  *
43  * Independently of whether logs are emitted to the console and/or
44  * @p syslog, controls whether logs are emitted to a log file. If @p -l
45  * is not provided, remains @p NULL, and a log file is not used.
46  * Otherwise, may be the optional argument to @p -l, or the default of
47  * @p PEAPOD_LOG_PATH.
48  */
49  char *logfile;
50  uint8_t syslog; /**< @brief Flag: Was @p -s provided? */
51  uint8_t quiet; /**< @brief Flag: Was @p -q provided? */
52  uint8_t color; /**< @brief Flag: Was @p -C provided? */
53  uint8_t oneshot; /**< @brief Flag: Was @p -o provided? */
54 };
55 
56 char *args_canonpath(const char *path, uint8_t create);
57 int args_get(int argc, char* argv[]);
char * pidfile
A C string containing the path to the PID file.
Definition: args.h:23
char * conffile
A C string containing the path to the config file.
Definition: args.h:29
uint8_t syslog
Flag: Was -s provided?
Definition: args.h:50
uint8_t color
Flag: Was -C provided?
Definition: args.h:52
uint8_t level
Logging level.
Definition: args.h:39
uint8_t help
Flag: Was -h provided?
Definition: args.h:14
The program arguments data structure.
Definition: args.h:13
uint8_t daemon
Flag: Was -d provided?
Definition: args.h:15
uint8_t quiet
Flag: Was -q provided?
Definition: args.h:51
int args_get(int argc, char *argv[])
Parse command-line arguments and set up the global program arguments data structure.
Definition: args.c:107
char * logfile
The path to the log file.
Definition: args.h:49
uint8_t test
Flag: Was -t provided?
Definition: args.h:30
char * args_canonpath(const char *path, uint8_t create)
Validate and canonicalize a path.
Definition: args.c:73
uint8_t oneshot
Flag: Was -o provided?
Definition: args.h:53