[server] iptables 'comment' match check
[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     "ENABLE_IPT_COMMENT_CHECK",
82 #elif FIREWALL_IPFW
83     "FLUSH_IPFW_AT_INIT",
84     "FLUSH_IPFW_AT_EXIT",
85     "IPFW_START_RULE_NUM",
86     "IPFW_MAX_RULES",
87     "IPFW_ACTIVE_SET_NUM",
88     "IPFW_EXPIRE_SET_NUM",
89     "IPFW_EXPIRE_PURGE_INTERVAL",
90     "IPFW_ADD_CHECK_STATE",
91 #elif FIREWALL_PF
92     "PF_ANCHOR_NAME",
93     "PF_EXPIRE_INTERVAL",
94 #elif FIREWALL_IPF
95     /* --DSS Place-holder */
96 #endif /* FIREWALL type */
97     "FWKNOP_RUN_DIR",
98     "FWKNOP_CONF_DIR",
99     "ACCESS_FILE",
100     "FWKNOP_PID_FILE",
101 #if USE_FILE_CACHE
102     "DIGEST_FILE",
103 #else
104     "DIGEST_DB_FILE",
105 #endif
106     "GPG_HOME_DIR",
107     "FIREWALL_EXE",
108 };
109
110
111 /* Long options values (for those that may not have a short option).
112 */
113 enum {
114     FW_LIST         = 0x200,
115     FW_LIST_ALL,
116     FW_FLUSH,
117     GPG_HOME_DIR,
118     ROTATE_DIGEST_CACHE,
119     NOOP /* Just to be a marker for the end */
120 };
121
122 /* Our getopt_long options string.
123 */
124 #define GETOPTS_OPTION_STRING "a:c:C:d:Dfhi:Kl:O:p:P:RSvV"
125
126 /* Our program command-line options...
127 */
128 static struct option cmd_opts[] =
129 {
130     {"access-file",         1, NULL, 'a'},
131     {"config-file",         1, NULL, 'c'},
132     {"packet-limit",        1, NULL, 'C'},
133     {"digest-file",         1, NULL, 'd'},
134     {"dump-config",         0, NULL, 'D'},
135     {"foreground",          0, NULL, 'f'},
136     {"help",                0, NULL, 'h'},
137     {"interface",           1, NULL, 'i'},
138     {"kill",                0, NULL, 'K'},
139     {"fw-flush",            0, NULL, FW_FLUSH },
140     {"fw-list",             0, NULL, FW_LIST },
141     {"fw-list-all",         0, NULL, FW_LIST_ALL },
142     {"gpg-home-dir",        1, NULL, GPG_HOME_DIR },
143     {"locale",              1, NULL, 'l' },
144     {"rotate-digest-cache", 0, NULL, ROTATE_DIGEST_CACHE },
145     {"override-config",     1, NULL, 'O' },
146     {"pcap-filter",         1, NULL, 'P'},
147     {"pid-file",            1, NULL, 'p'},
148     {"restart",             0, NULL, 'R'},
149     {"status",              0, NULL, 'S'},
150     {"verbose",             0, NULL, 'v'},
151     {"version",             0, NULL, 'V'},
152     {0, 0, 0, 0}
153 };
154
155 #endif /* CMD_OPTS_H */
156
157 /***EOF***/