From a75bb977ff16c9f3b3bdccdcd4173e9ef033463f Mon Sep 17 00:00:00 2001 From: "/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=pablo/emailAddress=pablo@netfilter.org" Date: Sun, 15 May 2005 14:23:16 +0000 Subject: Completed some stuff related to protocol helpers: o final_check o help o ICMP support --- src/conntrack.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/conntrack.c b/src/conntrack.c index ed97a86..676049e 100644 --- a/src/conntrack.c +++ b/src/conntrack.c @@ -46,7 +46,7 @@ #include "libct_proto.h" #define PROGNAME "conntrack" -#define VERSION "0.50" +#define VERSION "0.60" #if 0 #define DEBUGP printf @@ -182,7 +182,7 @@ static char commands_v_options[NUMBER_OF_CMD][NUMBER_OF_OPT] = /*EVENT*/ {'x','x','x','x','x','x','x','x','x',' ','x'}, /*ACTION*/ {'x','x','x','x','x','x','x','x',' ','x',' '}, /*VERSION*/ {'x','x','x','x','x','x','x','x','x','x','x'}, -/*HELP*/ {'x','x','x','x','x','x','x','x','x','x','x'}, +/*HELP*/ {'x','x','x','x',' ','x','x','x','x','x','x'}, }; /* FIXME: hardcoded!, this must be defined during compilation time */ @@ -203,6 +203,13 @@ enum exittype { VERSION_PROBLEM }; +void extension_help(struct ctproto_handler *h) +{ + fprintf(stdout, "\n"); + fprintf(stdout, "Proto `%s' help:\n", h->name); + h->help(); +} + void exit_tryhelp(int status) { @@ -624,6 +631,13 @@ int main(int argc, char *argv[]) generic_opt_check(command, options); + if (!(command & CT_HELP) + && h && h->final_check && !h->final_check(extra_flags)) { + usage(argv[0]); + extension_help(h); + exit_error(PARAMETER_PROBLEM, "Missing protocol arguments!\n"); + } + while (retry > 0) { retry--; switch(command) { @@ -697,6 +711,8 @@ int main(int argc, char *argv[]) break; case CT_HELP: usage(argv[0]); + if (options & CT_OPT_PROTO) + extension_help(h); break; default: usage(argv[0]); -- cgit v1.2.3