05dc9cac6a78ee638ed44b40a7a376f136dbd36a
[fwknop.git] / server / cmd_opts.h
1 /*
2  ******************************************************************************
3  *
4  * File:    cmd_opts.h
5  *
6  * Author:  Damien Stuart
7  *
8  * Purpose: Header file for fwknopd command line options.
9  *
10  * Copyright 2010 Damien Stuart (dstuart@dstuart.org)
11  *
12  *  License (GNU Public License):
13  *
14  *  This program is free software; you can redistribute it and/or
15  *  modify it under the terms of the GNU General Public License
16  *  as published by the Free Software Foundation; either version 2
17  *  of the License, or (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
27  *  USA
28  *
29  ******************************************************************************
30 */
31 #ifndef CMD_OPTS_H
32 #define CMD_OPTS_H
33
34 /* The config entry indexes are defined in the fwknopd_common.h, and now we
35  * create a config entry name map as well (too lazy to make a hash table).
36  *
37  * Note: It is very important this list matches the enum in fwknopd_common.h
38  *
39 */
40 static char *config_map[NUMBER_OF_CONFIG_ENTRIES] = {
41     "CONFIG_FILE",
42     "OVERRIDE_CONFIG",
43     //"FIREWALL_TYPE",
44     "PCAP_INTF",
45     "ENABLE_PCAP_PROMISC",
46     "PCAP_FILTER",
47     "PCAP_DISPATCH_COUNT",
48     "PCAP_LOOP_SLEEP",
49     "MAX_SNIFF_BYTES",
50     "ENABLE_SPA_PACKET_AGING",
51     "MAX_SPA_PACKET_AGE",
52     "ENABLE_DIGEST_PERSISTENCE",
53     "CMD_EXEC_TIMEOUT",
54     //"BLACKLIST",
55     "ENABLE_SPA_OVER_HTTP",
56     "ENABLE_TCP_SERVER",
57     "TCPSERV_PORT",
58     "LOCALE",
59     "SYSLOG_IDENTITY",
60     "SYSLOG_FACILITY",
61     //"ENABLE_EXTERNAL_CMDS",
62     //"EXTERNAL_CMD_OPEN",
63     //"EXTERNAL_CMD_CLOSE",
64     //"EXTERNAL_CMD_ALARM",
65     //"ENABLE_EXT_CMD_PREFIX",
66     //"EXT_CMD_PREFIX",
67 #if FIREWALL_IPTABLES
68     "ENABLE_IPT_FORWARDING",
69     "ENABLE_IPT_LOCAL_NAT",
70     "ENABLE_IPT_SNAT",
71     "SNAT_TRANSLATE_IP",
72     "ENABLE_IPT_OUTPUT",
73     "FLUSH_IPT_AT_INIT",
74     "FLUSH_IPT_AT_EXIT",
75     "IPT_INPUT_ACCESS",
76     "IPT_OUTPUT_ACCESS",
77     "IPT_FORWARD_ACCESS",
78     "IPT_DNAT_ACCESS",
79     "IPT_SNAT_ACCESS",
80     "IPT_MASQUERADE_ACCESS",
81 #elif FIREWALL_IPFW
82     "FLUSH_IPFW_AT_INIT",
83     "FLUSH_IPFW_AT_EXIT",
84     "IPFW_START_RULE_NUM",
85     "IPFW_MAX_RULES",
86     "IPFW_ACTIVE_SET_NUM",
87     "IPFW_EXPIRE_SET_NUM",
88     "IPFW_EXPIRE_PURGE_INTERVAL",
89     "IPFW_ADD_CHECK_STATE",
90 #elif FIREWALL_PF
91     "PF_ANCHOR_NAME",
92     "PF_EXPIRE_INTERVAL",
93 #elif FIREWALL_IPF
94     /* --DSS Place-holder */
95 #endif /* FIREWALL type */
96     "FWKNOP_RUN_DIR",
97     "FWKNOP_CONF_DIR",
98     "ACCESS_FILE",
99     "FWKNOP_PID_FILE",
100 #if USE_FILE_CACHE
101     "DIGEST_FILE",
102 #else
103     "DIGEST_DB_FILE",
104 #endif
105     "GPG_HOME_DIR",
106     "FIREWALL_EXE",
107 };
108
109
110 /* Long options values (for those that may not have a short option).
111 */
112 enum {
113     FW_LIST         = 0x200,
114     FW_LIST_ALL,
115     FW_FLUSH,
116     GPG_HOME_DIR,
117     ROTATE_DIGEST_CACHE,
118     NOOP /* Just to be a marker for the end */
119 };
120
121 /* Our getopt_long options string.
122 */
123 #define GETOPTS_OPTION_STRING "a:c:C:d:Dfhi:Kl:O:p:P:RSvV"
124
125 /* Our program command-line options...
126 */
127 static struct option cmd_opts[] =
128 {
129     {"access-file",         1, NULL, 'a'},
130     {"config-file",         1, NULL, 'c'},
131     {"packet-limit",        1, NULL, 'C'},
132     {"digest-file",         1, NULL, 'd'},
133     {"dump-config",         0, NULL, 'D'},
134     {"foreground",          0, NULL, 'f'},
135     {"help",                0, NULL, 'h'},
136     {"interface",           1, NULL, 'i'},
137     {"kill",                0, NULL, 'K'},
138     {"fw-flush",            0, NULL, FW_FLUSH },
139     {"fw-list",             0, NULL, FW_LIST },
140     {"fw-list-all",         0, NULL, FW_LIST_ALL },
141     {"gpg-home-dir",        1, NULL, GPG_HOME_DIR },
142     {"locale",              1, NULL, 'l' },
143     {"rotate-digest-cache", 0, NULL, ROTATE_DIGEST_CACHE },
144     {"override-config",     1, NULL, 'O' },
145     {"pcap-filter",         1, NULL, 'P'},
146     {"pid-file",            1, NULL, 'p'},
147     {"restart",             0, NULL, 'R'},
148     {"status",              0, NULL, 'S'},
149     {"verbose",             0, NULL, 'v'},
150     {"version",             0, NULL, 'V'},
151     {0, 0, 0, 0}
152 };
153
154 #endif /* CMD_OPTS_H */
155
156 /***EOF***/