diff options
author | jjako <jjako> | 2003-04-11 09:40:12 +0000 |
---|---|---|
committer | jjako <jjako> | 2003-04-11 09:40:12 +0000 |
commit | a7cd249501b869ed518746b301eb92230ec50f50 (patch) | |
tree | 685d542efae0d9e14c1bd21ecb64117521f8c5a9 /ggsn/cmdline.c | |
parent | afb2a970de8bcc78142bf0a40a8481012a6d2f34 (diff) |
added ippool.h and ippool.c
Diffstat (limited to 'ggsn/cmdline.c')
-rw-r--r-- | ggsn/cmdline.c | 227 |
1 files changed, 163 insertions, 64 deletions
diff --git a/ggsn/cmdline.c b/ggsn/cmdline.c index 3c5d7e2..bb5c3f1 100644 --- a/ggsn/cmdline.c +++ b/ggsn/cmdline.c @@ -1,7 +1,7 @@ /* - File autogenerated by gengetopt version 2.8rc + File autogenerated by gengetopt version 2.8 generated with the following command: - ../../gengetopt-2.8rc/src/gengetopt --conf-parser + gengetopt --conf-parser The developers of gengetopt consider the fixed text that goes in all gengetopt output files to be in the public domain: @@ -50,13 +50,16 @@ cmdline_parser_print_help (void) printf(" --pidfile=STRING Filename of process id file (default='/var/run/ggsn.pid')\n"); printf(" --statedir=STRING Directory of nonvolatile data (default='/var/lib/ggsn/')\n"); printf(" -lSTRING --listen=STRING Local interface\n"); - printf(" -nSTRING --net=STRING Network (default='192.168.0.0')\n"); - printf(" --mask=STRING Network mask (default='255.255.255.0')\n"); + printf(" -nSTRING --net=STRING Network (default='192.168.0.0/24')\n"); + printf(" --ipup=STRING Script to run after link-up\n"); + printf(" --ipdown=STRING Script to run after link-down\n"); + printf(" --dynip=STRING Dynamic IP address pool (default='192.168.0.0/24')\n"); + printf(" --statip=STRING Static IP address pool (default='192.168.1.0/24')\n"); + printf(" --pcodns1=STRING PCO DNS Server 1 (default='0.0.0.0')\n"); + printf(" --pcodns2=STRING PCO DNS Server 2 (default='0.0.0.0')\n"); printf(" --timelimit=INT Exit after timelimit seconds (default='0')\n"); printf(" -aSTRING --apn=STRING Access point name (default='internet')\n"); printf(" -qINT --qos=INT Requested quality of service (default='0x0b921f')\n"); - printf(" --ipup=STRING Script to run after link-up\n"); - printf(" --ipdown=STRING Script to run after link-down\n"); } @@ -89,12 +92,15 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i args_info->statedir_given = 0 ; args_info->listen_given = 0 ; args_info->net_given = 0 ; - args_info->mask_given = 0 ; + args_info->ipup_given = 0 ; + args_info->ipdown_given = 0 ; + args_info->dynip_given = 0 ; + args_info->statip_given = 0 ; + args_info->pcodns1_given = 0 ; + args_info->pcodns2_given = 0 ; args_info->timelimit_given = 0 ; args_info->apn_given = 0 ; args_info->qos_given = 0 ; - args_info->ipup_given = 0 ; - args_info->ipdown_given = 0 ; #define clear_args() { \ args_info->fg_flag = 0;\ args_info->debug_flag = 0;\ @@ -102,13 +108,16 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i args_info->pidfile_arg = strdup("/var/run/ggsn.pid") ;\ args_info->statedir_arg = strdup("/var/lib/ggsn/") ;\ args_info->listen_arg = NULL; \ - args_info->net_arg = strdup("192.168.0.0") ;\ - args_info->mask_arg = strdup("255.255.255.0") ;\ + args_info->net_arg = strdup("192.168.0.0/24") ;\ + args_info->ipup_arg = NULL; \ + args_info->ipdown_arg = NULL; \ + args_info->dynip_arg = strdup("192.168.0.0/24") ;\ + args_info->statip_arg = strdup("192.168.1.0/24") ;\ + args_info->pcodns1_arg = strdup("0.0.0.0") ;\ + args_info->pcodns2_arg = strdup("0.0.0.0") ;\ args_info->timelimit_arg = 0 ;\ args_info->apn_arg = strdup("internet") ;\ args_info->qos_arg = 0x0b921f ;\ - args_info->ipup_arg = NULL; \ - args_info->ipdown_arg = NULL; \ } clear_args(); @@ -132,12 +141,15 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i { "statedir", 1, NULL, 0 }, { "listen", 1, NULL, 'l' }, { "net", 1, NULL, 'n' }, - { "mask", 1, NULL, 0 }, + { "ipup", 1, NULL, 0 }, + { "ipdown", 1, NULL, 0 }, + { "dynip", 1, NULL, 0 }, + { "statip", 1, NULL, 0 }, + { "pcodns1", 1, NULL, 0 }, + { "pcodns2", 1, NULL, 0 }, { "timelimit", 1, NULL, 0 }, { "apn", 1, NULL, 'a' }, { "qos", 1, NULL, 'q' }, - { "ipup", 1, NULL, 0 }, - { "ipdown", 1, NULL, 0 }, { NULL, 0, NULL, 0 } }; @@ -262,56 +274,95 @@ cmdline_parser (int argc, char * const *argv, struct gengetopt_args_info *args_i args_info->statedir_arg = strdup (optarg); break; } - /* Network mask. */ - else if (strcmp (long_options[option_index].name, "mask") == 0) + /* Script to run after link-up. */ + else if (strcmp (long_options[option_index].name, "ipup") == 0) { - if (args_info->mask_given) + if (args_info->ipup_given) { - fprintf (stderr, "%s: `--mask' option given more than once\n", PACKAGE); + fprintf (stderr, "%s: `--ipup' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } - args_info->mask_given = 1; - args_info->mask_arg = strdup (optarg); + args_info->ipup_given = 1; + args_info->ipup_arg = strdup (optarg); break; } - /* Exit after timelimit seconds. */ - else if (strcmp (long_options[option_index].name, "timelimit") == 0) + /* Script to run after link-down. */ + else if (strcmp (long_options[option_index].name, "ipdown") == 0) { - if (args_info->timelimit_given) + if (args_info->ipdown_given) { - fprintf (stderr, "%s: `--timelimit' option given more than once\n", PACKAGE); + fprintf (stderr, "%s: `--ipdown' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } - args_info->timelimit_given = 1; - args_info->timelimit_arg = strtol (optarg,&stop_char,0); + args_info->ipdown_given = 1; + args_info->ipdown_arg = strdup (optarg); break; } - /* Script to run after link-up. */ - else if (strcmp (long_options[option_index].name, "ipup") == 0) + /* Dynamic IP address pool. */ + else if (strcmp (long_options[option_index].name, "dynip") == 0) { - if (args_info->ipup_given) + if (args_info->dynip_given) { - fprintf (stderr, "%s: `--ipup' option given more than once\n", PACKAGE); + fprintf (stderr, "%s: `--dynip' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } - args_info->ipup_given = 1; - args_info->ipup_arg = strdup (optarg); + args_info->dynip_given = 1; + args_info->dynip_arg = strdup (optarg); break; } - /* Script to run after link-down. */ - else if (strcmp (long_options[option_index].name, "ipdown") == 0) + /* Static IP address pool. */ + else if (strcmp (long_options[option_index].name, "statip") == 0) { - if (args_info->ipdown_given) + if (args_info->statip_given) { - fprintf (stderr, "%s: `--ipdown' option given more than once\n", PACKAGE); + fprintf (stderr, "%s: `--statip' option given more than once\n", PACKAGE); clear_args (); exit (EXIT_FAILURE); } - args_info->ipdown_given = 1; - args_info->ipdown_arg = strdup (optarg); + args_info->statip_given = 1; + args_info->statip_arg = strdup (optarg); + break; + } + /* PCO DNS Server 1. */ + else if (strcmp (long_options[option_index].name, "pcodns1") == 0) + { + if (args_info->pcodns1_given) + { + fprintf (stderr, "%s: `--pcodns1' option given more than once\n", PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->pcodns1_given = 1; + args_info->pcodns1_arg = strdup (optarg); + break; + } + /* PCO DNS Server 2. */ + else if (strcmp (long_options[option_index].name, "pcodns2") == 0) + { + if (args_info->pcodns2_given) + { + fprintf (stderr, "%s: `--pcodns2' option given more than once\n", PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->pcodns2_given = 1; + args_info->pcodns2_arg = strdup (optarg); + break; + } + /* Exit after timelimit seconds. */ + else if (strcmp (long_options[option_index].name, "timelimit") == 0) + { + if (args_info->timelimit_given) + { + fprintf (stderr, "%s: `--timelimit' option given more than once\n", PACKAGE); + clear_args (); + exit (EXIT_FAILURE); + } + args_info->timelimit_given = 1; + args_info->timelimit_arg = strtol (optarg,&stop_char,0); break; } @@ -485,13 +536,13 @@ cmdline_parser_configfile (char * const filename, struct gengetopt_args_info *ar } continue; } - if (!strcmp(fopt, "mask")) + if (!strcmp(fopt, "ipup")) { - if (override || !args_info->mask_given) + if (override || !args_info->ipup_given) { - args_info->mask_given = 1; + args_info->ipup_given = 1; if (fnum == 2) - args_info->mask_arg = strdup (farg); + args_info->ipup_arg = strdup (farg); else { fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", @@ -501,13 +552,13 @@ cmdline_parser_configfile (char * const filename, struct gengetopt_args_info *ar } continue; } - if (!strcmp(fopt, "timelimit")) + if (!strcmp(fopt, "ipdown")) { - if (override || !args_info->timelimit_given) + if (override || !args_info->ipdown_given) { - args_info->timelimit_given = 1; + args_info->ipdown_given = 1; if (fnum == 2) - args_info->timelimit_arg = strtol (farg,&stop_char,0); + args_info->ipdown_arg = strdup (farg); else { fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", @@ -517,13 +568,13 @@ cmdline_parser_configfile (char * const filename, struct gengetopt_args_info *ar } continue; } - if (!strcmp(fopt, "apn")) + if (!strcmp(fopt, "dynip")) { - if (override || !args_info->apn_given) + if (override || !args_info->dynip_given) { - args_info->apn_given = 1; + args_info->dynip_given = 1; if (fnum == 2) - args_info->apn_arg = strdup (farg); + args_info->dynip_arg = strdup (farg); else { fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", @@ -533,13 +584,13 @@ cmdline_parser_configfile (char * const filename, struct gengetopt_args_info *ar } continue; } - if (!strcmp(fopt, "qos")) + if (!strcmp(fopt, "statip")) { - if (override || !args_info->qos_given) + if (override || !args_info->statip_given) { - args_info->qos_given = 1; + args_info->statip_given = 1; if (fnum == 2) - args_info->qos_arg = strtol (farg,&stop_char,0); + args_info->statip_arg = strdup (farg); else { fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", @@ -549,13 +600,13 @@ cmdline_parser_configfile (char * const filename, struct gengetopt_args_info *ar } continue; } - if (!strcmp(fopt, "ipup")) + if (!strcmp(fopt, "pcodns1")) { - if (override || !args_info->ipup_given) + if (override || !args_info->pcodns1_given) { - args_info->ipup_given = 1; + args_info->pcodns1_given = 1; if (fnum == 2) - args_info->ipup_arg = strdup (farg); + args_info->pcodns1_arg = strdup (farg); else { fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", @@ -565,13 +616,61 @@ cmdline_parser_configfile (char * const filename, struct gengetopt_args_info *ar } continue; } - if (!strcmp(fopt, "ipdown")) + if (!strcmp(fopt, "pcodns2")) { - if (override || !args_info->ipdown_given) + if (override || !args_info->pcodns2_given) { - args_info->ipdown_given = 1; + args_info->pcodns2_given = 1; if (fnum == 2) - args_info->ipdown_arg = strdup (farg); + args_info->pcodns2_arg = strdup (farg); + else + { + fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", + filename, line_num); + exit (EXIT_FAILURE); + } + } + continue; + } + if (!strcmp(fopt, "timelimit")) + { + if (override || !args_info->timelimit_given) + { + args_info->timelimit_given = 1; + if (fnum == 2) + args_info->timelimit_arg = strtol (farg,&stop_char,0); + else + { + fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", + filename, line_num); + exit (EXIT_FAILURE); + } + } + continue; + } + if (!strcmp(fopt, "apn")) + { + if (override || !args_info->apn_given) + { + args_info->apn_given = 1; + if (fnum == 2) + args_info->apn_arg = strdup (farg); + else + { + fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", + filename, line_num); + exit (EXIT_FAILURE); + } + } + continue; + } + if (!strcmp(fopt, "qos")) + { + if (override || !args_info->qos_given) + { + args_info->qos_given = 1; + if (fnum == 2) + args_info->qos_arg = strtol (farg,&stop_char,0); else { fprintf (stderr, "%s:%d: required <option_name> <option_val>\n", |