Commit 4f88adbf authored by 's avatar
Browse files

Done with argument parsing


git-svn-id: file:///home/svn/mapi/trunk@927 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent ff29e943
......@@ -38,7 +38,7 @@ void create_flows(char *scope);
void *process();
char *local_net;
char user_net[MAXLINE]; //XXX
char *user_net;
int user_net_defined = 0;
int votes[NUMFILTERS];
......@@ -71,7 +71,7 @@ int main(int argc, char **argv) {
anonymize = 1;
refresh_time = 10;
private = 1;
local_net = NULL;
user_net = local_net = NULL;
signal(SIGINT, terminate);
signal(SIGQUIT, terminate);
......@@ -79,13 +79,7 @@ int main(int argc, char **argv) {
progname = strdup(argv[0]);
if(argc < 3){
usage();
exit(EXIT_FAILURE);
}
while((opt = getopt(argc, argv, "hvpal:i:n:u:")) != EOF)
while((opt = getopt(argc, argv, "hvpas:i:n:u:")) != EOF)
{
switch(opt)
{
......@@ -96,7 +90,6 @@ int main(int argc, char **argv) {
refresh_time = atoi(optarg);
break;
case 'n':
free(MonitorName);
MonitorName = strdup(optarg);
break;
case 'a':
......@@ -107,10 +100,10 @@ int main(int argc, char **argv) {
private = 1;
break;
case 's':
free(scope);
scope = strdup(optarg);
break;
case 'u':
user_net_defined = 1;
user_net = strdup(optarg);
break;
case 'v':
......@@ -127,7 +120,7 @@ int main(int argc, char **argv) {
local_net = strdup(argv[optind]);
printf("local_net: %s\n",local_net);
}
/* start processing */
create_flows(scope);
if((fp = fopen(RRD_FILENAME, "r")) == NULL) {
......@@ -857,8 +850,14 @@ void terminate() {
static char usgtxt[] = "\
%s: appmon: Network Traffic Classification tool using MAPI.\n\
Usage: %s [-h] localnet host:interface \n\
-h this page\n\
Usage: %s [-hpav] -u <user subnet> [-n <MonitorTitle>] [-s <host:interface>] [localnet]\n\
-h this page\n\
-a anonymize IPs\n\
-p create private page with non anonymized IPs\n\
-v verbose\n\
-u userSubnet provide IP/Net to check\n\
-n monitorTitle provide Monitor Title for Webpage\n\
-s sensor Sensor IP and interface. Multiple sensors separated by a comma\n\
";
void usage() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment