added ippool.h and ippool.c
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 @@
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 @@
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 @@
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 @@
{ "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,32 +274,6 @@
args_info->statedir_arg = strdup (optarg);
break;
}
- /* Network mask. */
- else if (strcmp (long_options[option_index].name, "mask") == 0)
- {
- if (args_info->mask_given)
- {
- fprintf (stderr, "%s: `--mask' option given more than once\n", PACKAGE);
- clear_args ();
- exit (EXIT_FAILURE);
- }
- args_info->mask_given = 1;
- args_info->mask_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;
- }
/* Script to run after link-up. */
else if (strcmp (long_options[option_index].name, "ipup") == 0)
{
@@ -314,6 +300,71 @@
args_info->ipdown_arg = strdup (optarg);
break;
}
+ /* Dynamic IP address pool. */
+ else if (strcmp (long_options[option_index].name, "dynip") == 0)
+ {
+ if (args_info->dynip_given)
+ {
+ fprintf (stderr, "%s: `--dynip' option given more than once\n", PACKAGE);
+ clear_args ();
+ exit (EXIT_FAILURE);
+ }
+ args_info->dynip_given = 1;
+ args_info->dynip_arg = strdup (optarg);
+ break;
+ }
+ /* Static IP address pool. */
+ else if (strcmp (long_options[option_index].name, "statip") == 0)
+ {
+ if (args_info->statip_given)
+ {
+ fprintf (stderr, "%s: `--statip' option given more than once\n", PACKAGE);
+ clear_args ();
+ exit (EXIT_FAILURE);
+ }
+ 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;
+ }
case '?': /* Invalid option. */
/* `getopt_long' already printed an error message. */
@@ -485,13 +536,93 @@
}
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",
+ filename, line_num);
+ exit (EXIT_FAILURE);
+ }
+ }
+ continue;
+ }
+ if (!strcmp(fopt, "ipdown"))
+ {
+ if (override || !args_info->ipdown_given)
+ {
+ args_info->ipdown_given = 1;
+ if (fnum == 2)
+ args_info->ipdown_arg = strdup (farg);
+ else
+ {
+ fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
+ filename, line_num);
+ exit (EXIT_FAILURE);
+ }
+ }
+ continue;
+ }
+ if (!strcmp(fopt, "dynip"))
+ {
+ if (override || !args_info->dynip_given)
+ {
+ args_info->dynip_given = 1;
+ if (fnum == 2)
+ args_info->dynip_arg = strdup (farg);
+ else
+ {
+ fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
+ filename, line_num);
+ exit (EXIT_FAILURE);
+ }
+ }
+ continue;
+ }
+ if (!strcmp(fopt, "statip"))
+ {
+ if (override || !args_info->statip_given)
+ {
+ args_info->statip_given = 1;
+ if (fnum == 2)
+ args_info->statip_arg = strdup (farg);
+ else
+ {
+ fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
+ filename, line_num);
+ exit (EXIT_FAILURE);
+ }
+ }
+ continue;
+ }
+ if (!strcmp(fopt, "pcodns1"))
+ {
+ if (override || !args_info->pcodns1_given)
+ {
+ args_info->pcodns1_given = 1;
+ if (fnum == 2)
+ args_info->pcodns1_arg = strdup (farg);
+ else
+ {
+ fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
+ filename, line_num);
+ exit (EXIT_FAILURE);
+ }
+ }
+ continue;
+ }
+ if (!strcmp(fopt, "pcodns2"))
+ {
+ if (override || !args_info->pcodns2_given)
+ {
+ args_info->pcodns2_given = 1;
+ if (fnum == 2)
+ args_info->pcodns2_arg = strdup (farg);
else
{
fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
@@ -549,38 +680,6 @@
}
continue;
}
- if (!strcmp(fopt, "ipup"))
- {
- if (override || !args_info->ipup_given)
- {
- args_info->ipup_given = 1;
- if (fnum == 2)
- args_info->ipup_arg = strdup (farg);
- else
- {
- fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
- filename, line_num);
- exit (EXIT_FAILURE);
- }
- }
- continue;
- }
- if (!strcmp(fopt, "ipdown"))
- {
- if (override || !args_info->ipdown_given)
- {
- args_info->ipdown_given = 1;
- if (fnum == 2)
- args_info->ipdown_arg = strdup (farg);
- else
- {
- fprintf (stderr, "%s:%d: required <option_name> <option_val>\n",
- filename, line_num);
- exit (EXIT_FAILURE);
- }
- }
- continue;
- }
/* Tried all known options. This one is unknown! */