Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor restructuring to suppress compiler "defined but not used warnings"

This commit fixes several compiler warnings like the following (now that -Wall
is the default):

config_init.h:68: warning: ‘cmd_opts’ defined but not used
  • Loading branch information...
commit ab7226092dcf687a46916e1841cc05107a5fce8f 1 parent db681fb
@mrash authored
View
79 client/cmd_opts.h
@@ -0,0 +1,79 @@
+
+#ifndef CMD_OPTS_H
+#define CMD_OPTS_H
+
+/* Long options values (for those without a short option).
+*/
+enum {
+ FKO_DIGEST_NAME = 0x100,
+ NAT_LOCAL,
+ NAT_PORT,
+ NAT_RAND_PORT,
+ TIME_OFFSET_MINUS,
+ TIME_OFFSET_PLUS,
+ NO_SAVE_ARGS,
+ SHOW_LAST_ARGS,
+ RESOLVE_URL,
+ /* Put GPG-related items below the following line */
+ GPG_ENCRYPTION = 0x200,
+ GPG_RECIP_KEY,
+ GPG_SIGNER_KEY,
+ GPG_HOME_DIR,
+ GPG_AGENT,
+ NOOP /* Just to be a marker for the end */
+};
+
+
+/* Our getopt_long options string.
+*/
+#define GETOPTS_OPTION_STRING "a:A:bB:C:D:f:gG:hH:lm:n:N:p:P:Q:rRsS:Tu:U:vV"
+
+/* Our program command-line options...
+*/
+static struct option cmd_opts[] =
+{
+ {"allow-ip", 1, NULL, 'a'},
+ {"access", 1, NULL, 'A'},
+ {"save-packet-append", 0, NULL, 'b'},
+ {"save-packet", 1, NULL, 'B'},
+ {"no-save-args", 0, NULL, NO_SAVE_ARGS},
+ {"server-cmd", 1, NULL, 'C'},
+ {"digest-type", 1, NULL, FKO_DIGEST_NAME},
+ {"destination", 1, NULL, 'D'},
+ {"fw-timeout", 1, NULL, 'f'},
+ {"gpg-encryption", 0, NULL, 'g'},
+ {"gpg-recipient-key", 1, NULL, GPG_RECIP_KEY },
+ {"gpg-signer-key", 1, NULL, GPG_SIGNER_KEY },
+ {"gpg-home-dir", 1, NULL, GPG_HOME_DIR },
+ {"gpg-agent", 0, NULL, GPG_AGENT },
+ {"get-key", 1, NULL, 'G'},
+ {"help", 0, NULL, 'h'},
+ {"http-proxy", 1, NULL, 'H'},
+ {"last-cmd", 0, NULL, 'l'},
+ {"nat-access", 1, NULL, 'N'},
+ {"named-config", 1, NULL, 'n'},
+ {"nat-local", 0, NULL, NAT_LOCAL},
+ {"nat-port", 1, NULL, NAT_PORT},
+ {"nat-rand-port", 0, NULL, NAT_RAND_PORT},
+ {"server-port", 1, NULL, 'p'},
+ {"server-proto", 1, NULL, 'P'},
+ {"spoof-src", 1, NULL, 'Q'},
+ {"rand-port", 0, NULL, 'r'},
+ {"resolve-ip-http", 0, NULL, 'R'},
+ {"resolve-url", 1, NULL, RESOLVE_URL},
+ {"show-last", 0, NULL, SHOW_LAST_ARGS},
+ {"source-ip", 0, NULL, 's'},
+ {"source-port", 1, NULL, 'S'},
+ {"test", 0, NULL, 'T'},
+ {"time-offset-plus", 1, NULL, TIME_OFFSET_PLUS},
+ {"time-offset-minus", 1, NULL, TIME_OFFSET_MINUS},
+ {"user-agent", 1, NULL, 'u'},
+ {"spoof-user", 1, NULL, 'U'},
+ {"verbose", 0, NULL, 'v'},
+ {"version", 0, NULL, 'V'},
+ {0, 0, 0, 0}
+};
+
+#endif /* CMD_OPTS_H */
+
+/***EOF***/
View
2  client/config_init.c
@@ -30,7 +30,7 @@
*/
#include "fwknop_common.h"
#include "config_init.h"
-#include "getopt.h"
+#include "cmd_opts.h"
#include "utils.h"
/* Convert a digest_type string to its intger value.
View
71 client/config_init.h
@@ -38,77 +38,6 @@
*/
#define CONF_VAR_IS(n, v) (strcmp(n, v) == 0)
-/* Long options values (for those without a short option).
-*/
-enum {
- FKO_DIGEST_NAME = 0x100,
- NAT_LOCAL,
- NAT_PORT,
- NAT_RAND_PORT,
- TIME_OFFSET_MINUS,
- TIME_OFFSET_PLUS,
- NO_SAVE_ARGS,
- SHOW_LAST_ARGS,
- RESOLVE_URL,
- /* Put GPG-related items below the following line */
- GPG_ENCRYPTION = 0x200,
- GPG_RECIP_KEY,
- GPG_SIGNER_KEY,
- GPG_HOME_DIR,
- GPG_AGENT,
- NOOP /* Just to be a marker for the end */
-};
-
-/* Our getopt_long options string.
-*/
-#define GETOPTS_OPTION_STRING "a:A:bB:C:D:f:gG:hH:lm:n:N:p:P:Q:rRsS:Tu:U:vV"
-
-/* Our program command-line options...
-*/
-static struct option cmd_opts[] =
-{
- {"allow-ip", 1, NULL, 'a'},
- {"access", 1, NULL, 'A'},
- {"save-packet-append", 0, NULL, 'b'},
- {"save-packet", 1, NULL, 'B'},
- {"no-save-args", 0, NULL, NO_SAVE_ARGS},
- {"server-cmd", 1, NULL, 'C'},
- {"digest-type", 1, NULL, FKO_DIGEST_NAME},
- {"destination", 1, NULL, 'D'},
- {"fw-timeout", 1, NULL, 'f'},
- {"gpg-encryption", 0, NULL, 'g'},
- {"gpg-recipient-key", 1, NULL, GPG_RECIP_KEY },
- {"gpg-signer-key", 1, NULL, GPG_SIGNER_KEY },
- {"gpg-home-dir", 1, NULL, GPG_HOME_DIR },
- {"gpg-agent", 0, NULL, GPG_AGENT },
- {"get-key", 1, NULL, 'G'},
- {"help", 0, NULL, 'h'},
- {"http-proxy", 1, NULL, 'H'},
- {"last-cmd", 0, NULL, 'l'},
- {"nat-access", 1, NULL, 'N'},
- {"named-config", 1, NULL, 'n'},
- {"nat-local", 0, NULL, NAT_LOCAL},
- {"nat-port", 1, NULL, NAT_PORT},
- {"nat-rand-port", 0, NULL, NAT_RAND_PORT},
- {"server-port", 1, NULL, 'p'},
- {"server-proto", 1, NULL, 'P'},
- {"spoof-src", 1, NULL, 'Q'},
- {"rand-port", 0, NULL, 'r'},
- {"resolve-ip-http", 0, NULL, 'R'},
- {"resolve-url", 1, NULL, RESOLVE_URL},
- {"show-last", 0, NULL, SHOW_LAST_ARGS},
- {"source-ip", 0, NULL, 's'},
- {"source-port", 1, NULL, 'S'},
- {"test", 0, NULL, 'T'},
- {"time-offset-plus", 1, NULL, TIME_OFFSET_PLUS},
- {"time-offset-minus", 1, NULL, TIME_OFFSET_MINUS},
- {"user-agent", 1, NULL, 'u'},
- {"spoof-user", 1, NULL, 'U'},
- {"verbose", 0, NULL, 'v'},
- {"version", 0, NULL, 'V'},
- {0, 0, 0, 0}
-};
-
/* Function Prototypes
*/
void config_init(fko_cli_options_t *options, int argc, char **argv);
View
1  server/access.c
@@ -38,7 +38,6 @@
#include "fwknopd_common.h"
#include "access.h"
-#include "config_init.h" /* For the convenience macros */
#include "utils.h"
#include "log_msg.h"
View
74 server/cmd_opts.h
@@ -0,0 +1,74 @@
+/*
+ ******************************************************************************
+ *
+ * File: cmd_opts.h
+ *
+ * Author: Damien Stuart
+ *
+ * Purpose: Header file for fwknopd command line options.
+ *
+ * Copyright 2010 Damien Stuart (dstuart@dstuart.org)
+ *
+ * License (GNU Public License):
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ ******************************************************************************
+*/
+#ifndef CMD_OPTS_H
+#define CMD_OPTS_H
+
+/* Long options values (for those that may not have a short option).
+*/
+enum {
+ FW_LIST = 0x200,
+ GPG_HOME_DIR,
+ ROTATE_DIGEST_CACHE,
+ NOOP /* Just to be a marker for the end */
+};
+
+/* Our getopt_long options string.
+*/
+#define GETOPTS_OPTION_STRING "a:c:C:Dfhi:Kl:O:P:RSvV"
+
+/* Our program command-line options...
+*/
+static struct option cmd_opts[] =
+{
+ {"access-file", 1, NULL, 'a'},
+ {"config-file", 1, NULL, 'c'},
+ {"packet-limit", 1, NULL, 'C'},
+ {"dump-config", 0, NULL, 'D'},
+ {"foreground", 0, NULL, 'f'},
+ {"help", 0, NULL, 'h'},
+ {"interface", 1, NULL, 'i'},
+ {"kill", 0, NULL, 'K'},
+ {"fw-list", 0, NULL, FW_LIST },
+ {"gpg-home-dir", 1, NULL, GPG_HOME_DIR },
+ {"locale", 1, NULL, 'l' },
+ {"rotate-digest-cache", 0, NULL, ROTATE_DIGEST_CACHE },
+ {"override-config", 1, NULL, 'O' },
+ {"pcap-filter", 1, NULL, 'P'},
+ {"restart", 0, NULL, 'R'},
+ {"status", 0, NULL, 'S'},
+ {"verbose", 0, NULL, 'v'},
+ {"version", 0, NULL, 'V'},
+ {0, 0, 0, 0}
+};
+
+#endif /* CMD_OPTS_H */
+
+/***EOF***/
View
2  server/config_init.c
@@ -30,7 +30,7 @@
*/
#include "fwknopd_common.h"
#include "config_init.h"
-#include "getopt.h"
+#include "cmd_opts.h"
#include "utils.h"
#include "log_msg.h"
View
59 server/config_init.h
@@ -34,65 +34,6 @@
#include <getopt.h>
#include <sys/stat.h>
-/* Some convenience macros */
-
-/* Characters allowed between a config parameter and its value.
-*/
-#define IS_CONFIG_PARAM_DELIMITER(x) (x == ' ' || x == '\t' || x == '=');
-
-/* End of line characters.
-*/
-#define IS_LINE_END(x) (x == '\n' || x == '\r' || x == ';');
-
-/* Characters in the first position of a line that make it considered
- * empty or otherwise non-interesting (like a comment).
-*/
-#define IS_EMPTY_LINE(x) ( \
- x == '#' || x == '\n' || x == '\r' || x == ';' || x == '\0' \
-)
-
-/* String compare macro.
-*/
-#define CONF_VAR_IS(n, v) (strcmp(n, v) == 0)
-
-/* Long options values (for those that may not have a short option).
-*/
-enum {
- FW_LIST = 0x200,
- GPG_HOME_DIR,
- ROTATE_DIGEST_CACHE,
- NOOP /* Just to be a marker for the end */
-};
-
-/* Our getopt_long options string.
-*/
-#define GETOPTS_OPTION_STRING "a:c:C:Dfhi:Kl:O:P:RSvV"
-
-/* Our program command-line options...
-*/
-static struct option cmd_opts[] =
-{
- {"access-file", 1, NULL, 'a'},
- {"config-file", 1, NULL, 'c'},
- {"packet-limit", 1, NULL, 'C'},
- {"dump-config", 0, NULL, 'D'},
- {"foreground", 0, NULL, 'f'},
- {"help", 0, NULL, 'h'},
- {"interface", 1, NULL, 'i'},
- {"kill", 0, NULL, 'K'},
- {"fw-list", 0, NULL, FW_LIST },
- {"gpg-home-dir", 1, NULL, GPG_HOME_DIR },
- {"locale", 1, NULL, 'l' },
- {"rotate-digest-cache", 0, NULL, ROTATE_DIGEST_CACHE },
- {"override-config", 1, NULL, 'O' },
- {"pcap-filter", 1, NULL, 'P'},
- {"restart", 0, NULL, 'R'},
- {"status", 0, NULL, 'S'},
- {"verbose", 0, NULL, 'v'},
- {"version", 0, NULL, 'V'},
- {0, 0, 0, 0}
-};
-
/* Function Prototypes
*/
void config_init(fko_srv_options_t *opts, int argc, char **argv);
View
1  server/fw_util.c
@@ -32,7 +32,6 @@
#include "fw_util.h"
#include "utils.h"
#include "log_msg.h"
-#include "config_init.h" /* for the IS_EMPTY_LINE macro */
#include "extcmd.h"
#include "access.h"
View
1  server/fw_util_ipf.c
@@ -35,7 +35,6 @@
#include "fw_util.h"
#include "utils.h"
#include "log_msg.h"
-#include "config_init.h" /* for the IS_EMPTY_LINE macro */
#include "extcmd.h"
#include "access.h"
View
1  server/fw_util_ipfw.c
@@ -35,7 +35,6 @@
#include "fw_util.h"
#include "utils.h"
#include "log_msg.h"
-#include "config_init.h" /* for the IS_EMPTY_LINE macro */
#include "extcmd.h"
#include "access.h"
View
1  server/fw_util_iptables.c
@@ -36,7 +36,6 @@
#include "fw_util.h"
#include "utils.h"
#include "log_msg.h"
-#include "config_init.h" /* for the IS_EMPTY_LINE macro */
#include "extcmd.h"
#include "access.h"
View
2  server/fwknopd.c
@@ -29,8 +29,8 @@
*****************************************************************************
*/
#include "fwknopd.h"
-#include "config_init.h"
#include "access.h"
+#include "config_init.h"
#include "process_packet.h"
#include "pcap_capture.h"
#include "log_msg.h"
View
1  server/pcap_capture.c
@@ -34,7 +34,6 @@
#include "pcap_capture.h"
#include "process_packet.h"
#include "incoming_spa.h"
-#include "config_init.h"
#include "sig_handler.h"
#include "fw_util.h"
#include "log_msg.h"
View
21 server/utils.h
@@ -35,6 +35,27 @@
#define CTX_DUMP_BUFSIZE 4096
+/* Some convenience macros */
+
+/* Characters allowed between a config parameter and its value.
+*/
+#define IS_CONFIG_PARAM_DELIMITER(x) (x == ' ' || x == '\t' || x == '=');
+
+/* String compare macro.
+*/
+#define CONF_VAR_IS(n, v) (strcmp(n, v) == 0)
+
+/* End of line characters.
+*/
+#define IS_LINE_END(x) (x == '\n' || x == '\r' || x == ';');
+
+/* Characters in the first position of a line that make it considered
+ * empty or otherwise non-interesting (like a comment).
+*/
+#define IS_EMPTY_LINE(x) ( \
+ x == '#' || x == '\n' || x == '\r' || x == ';' || x == '\0' \
+)
+
/* Prototypes
*/
void hex_dump(unsigned char *data, int size);
Please sign in to comment.
Something went wrong with that request. Please try again.