Commit 1bcc0158 authored by 's avatar
Browse files

Added support for long options


git-svn-id: file:///home/svn/mapi/trunk@352 8d5bb341-7cf1-0310-8cf6-ba355fef3186
parent 974b8e0c
CC=gcc
LD=gcc
CFLAGS=-g -O2 -Wall
LIBS=/usr/local/mapi/lib/mapi/mapi.so -lmysqlclient
LIBS=/usr/local/mapi/lib/mapi/mapi.so -lmysqlclient -lreadline
AR=/usr/bin/ar
RANLIB=ranlib
INSTALL=/usr/bin/install -c
......@@ -9,8 +9,8 @@ LIB_DIRS=
RLIB_DIRS=
INCLUDE_DIRS=
TARGETS=abw abw_measure abw_dummy test_abw_time test_config
# OBJS=abw.o abw_common.o abw_measure.o abw_mysql.o abw_time.o abw_dummy.o test_abw_time.o test_config.o abw_conf.o
TARGETS=abw abw_dummy test_abw_time test_config
# OBJS=abw.o abw_common.o abw_mysql.o abw_time.o abw_dummy.o test_abw_time.o test_config.o abw_conf.o
all: $(TARGETS)
......@@ -24,8 +24,8 @@ all: $(TARGETS)
abw: abw.o abw_common.o abw_mysql.o abw_time.o abw_conf.o
$(LD) -o $@ abw.o abw_common.o abw_mysql.o abw_time.o abw_conf.o $(LIB_DIRS) $(LIBS) -Wl,-rpath,$(RLIB_DIRS)
abw_measure: abw_measure.o abw_common.o abw_mysql.o abw_time.o abw_conf.o
$(LD) -o $@ abw_measure.o abw_common.o abw_mysql.o abw_time.o abw_conf.o $(LIB_DIRS) $(LIBS) -Wl,-rpath,$(RLIB_DIRS)
#abw_measure: abw_measure.o abw_common.o abw_mysql.o abw_time.o abw_conf.o
# $(LD) -o $@ abw_measure.o abw_common.o abw_mysql.o abw_time.o abw_conf.o $(LIB_DIRS) $(LIBS) -Wl,-rpath,$(RLIB_DIRS)
abw_dummy: abw_dummy.o
$(LD) -o $@ abw_dummy.o $(LIB_DIRS) $(LIBS) -Wl,-rpath,$(RLIB_DIRS)
......
......@@ -74,7 +74,7 @@ web UI <--> | PHP conf. scripts | <----
conf. file --> ---------- v
| abw_conf | --> conf. in MySQL --> ------------- --> stdout
command-line --> ---------- | abw_measure |
command-line --> ------------- --> results
------------- --> results
in MySQL
|
-------------------- |
......@@ -95,7 +95,7 @@ command-line --> ---------- | abw_measure |
and read and write configuration to MySQL database, a signal is then
sent to abw_measure
- abw_measure reads measurement configuration from MySQL database or
- abw_measure reads measurement configuration from MySQL database
command-line, does the measurements and prints results on stdout
or stores them to MySQL database
......@@ -106,6 +106,21 @@ command-line --> ---------- | abw_measure |
- PHP result scripts read requests for results from web interface, read
results from MySQL database and present them on web interface
Differences between abw, abw_conf, abw_measure, abw_print:
- abw: configuration processing (manages tSubject and tParameters tables
so that results stored in tValue can refer to them, but does not manage
tMeasurement table), measurement, printing
- abw_conf: configuration processing only, but also manages tMeasurement
table and can delete records in tSubject and tParameters tables which
are not refered from tMeasurement or tValue tables
- abw_measure: measurement only, but restarts measurements according
to the current configuration when signal SIGUSR1 is delivered to it
- abw_print: printing only
Where the components run:
If we have one central machine and measurement nodes, components run
......
......@@ -30,21 +30,8 @@ int main(int argc, char *argv[])
struct timeval next, wait;
int subject_id, parameters_id;
if (gethostname(global_spec.hostname, MAX_HOSTNAME+1)<0) {
fprintf(stderr, "%s: gethostname() failed\n", __func__);
exit(-1);
}
if (!strchr(global_spec.hostname, ',')) {
char domainname[MAX_HOSTNAME+1];
if (getdomainname(domainname, MAX_HOSTNAME+1)<0) {
fprintf(stderr, "%s: getdomainname() failed\n", __func__);
exit(-1);
}
if (strlen(domainname))
strcat(global_spec.hostname, domainname);
else
fprintf(stderr, "%s: WARNING: could not obtain local domain name, local hostname (without domain name) will be used as subject specification\n", __func__);
}
/* Create first flow specification so that it can be filled-in
by command-line options */
if ((flow_spec[0]=new_flow_spec())==NULL) {
fprintf(stderr, "%s: new_flow_spec() failed\n", __func__);
......@@ -67,6 +54,24 @@ int main(int argc, char *argv[])
}
}
/* Get local hostname */
if (gethostname(global_spec.hostname, MAX_HOSTNAME+1)<0) {
fprintf(stderr, "%s: gethostname() failed\n", __func__);
exit(-1);
}
if (!strchr(global_spec.hostname, ',')) {
char domainname[MAX_HOSTNAME+1];
if (getdomainname(domainname, MAX_HOSTNAME+1)<0) {
fprintf(stderr, "%s: getdomainname() failed\n", __func__);
exit(-1);
}
if (strlen(domainname))
strcat(global_spec.hostname, domainname);
else
fprintf(stderr, "%s: WARNING: could not obtain local domain name, local hostname (without domain name) will be used as subject specification\n", __func__);
}
/* Check if specified values are within acceptable limits */
if (check_conf(&global_spec, flow_spec)<0) {
......@@ -123,6 +128,10 @@ int main(int argc, char *argv[])
__func__);
exit(-1);
}
p->subject_id=subject_id;
p->parameters_id=parameters_id;
}
/* Split string of protocols into individual protocols */
......@@ -141,11 +150,6 @@ int main(int argc, char *argv[])
}
q=p->flow_run[j];
if (global_spec.db) {
q->subject_id=subject_id;
q->parameters_id=parameters_id;
}
/* Prepare header filter for this protocol */
if (p->protocols_array[j] && p->protocols_array[j][0]) {
......@@ -279,7 +283,7 @@ int main(int argc, char *argv[])
if (global_spec.db) {
if (abw_mysql_insert_value(&global_spec, q,
if (abw_mysql_insert_value(&global_spec, p, q,
tm.tv_sec, tm.tv_usec,
"packets", NULL, NULL,
*(q->pkt_counter)-q->old_pkt_counter, 0, NULL)<0) {
......@@ -287,7 +291,7 @@ int main(int argc, char *argv[])
return -1;
}
if (abw_mysql_insert_value(&global_spec, q,
if (abw_mysql_insert_value(&global_spec, p, q,
tm.tv_sec, tm.tv_usec,
"bytes", NULL, NULL,
*(q->byte_counter)-q->old_byte_counter, 0, NULL)<0) {
......
......@@ -37,8 +37,6 @@ typedef struct {
unsigned *byte_counter; /* result of BYTE_COUNTER */
unsigned old_pkt_counter; /* result of PKT_COUNTER */
unsigned old_byte_counter; /* result of BYTE_COUNTER */
int subject_id; /* id field in tSubject table */
int parameters_id; /* id field in tParameters table */
} flow_run_t;
/*
......@@ -80,16 +78,25 @@ typedef struct {
/* Runtime flows created for all characteristics of this flow specification */
flow_run_t *flow_run[MAX_PROTOCOLS];
int subject_id; /* id field in tSubject table */
int parameters_id; /* id field in tParameters table */
} flow_spec_t;
typedef struct {
char *conf_filename;
char *conf_filename; /* read flow configuration from this file */
int conf_from_mysql; /* if non-zero read flow configuration from MySQL */
int conf_to_mysql; /* if non-zero write flow configuration to MySQL */
int clear_conf; /* if non-zero overwrite and delete unused
configuration in MySQL */
int no_measure; /* if non-zero do not do measurements (only process
configuration or print results) */
int no_stdout; /* if non-zero do not print results to stdout */
MYSQL *mysql; /* MySQL connection handler */
char *db; /* MySQL database name, if NULL do not insert results
into MySQL database */
char *user; /* username for MySQL connection */
char *passwd; /* password for MySQL connection */
MYSQL *mysql; /* MySQL connection handler */
char hostname[MAX_HOSTNAME+1]; /* local hostname including domain name */
} global_spec_t;
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "abw.h"
#include "abw_conf.h"
......@@ -167,3 +168,38 @@ int protocol_filter(char *header_filter, char *protocol,
return 0;
} /* protocol_filter() */
int get_local_hostname(char **hostname) {
char buffer[MAX_HOSTNAME+1];
if (gethostname(buffer, MAX_HOSTNAME+1)<0) {
fprintf(stderr, "%s: gethostname() failed\n", __func__);
return -1;
}
buffer[MAX_HOSTNAME]='\0';
if (!strchr(buffer, '.')) {
char buffer2[MAX_HOSTNAME+1];
if (getdomainname(buffer2, MAX_HOSTNAME+1)<0) {
fprintf(stderr, "%s: getdomainname() failed\n", __func__);
return -1;
}
buffer2[MAX_HOSTNAME]='\0';
if (strlen(buffer2) && (strlen(buffer) + strlen(buffer2)) < MAX_HOSTNAME) {
strcat(buffer, ".");
strcat(buffer, buffer2);
}
else
fprintf(stderr, "%s: WARNING: could not obtain local domain name or local domain and local hostname are too long together, using local hostname (without domain name) as subject specification\n", __func__);
}
if ((*hostname=malloc(strlen(buffer)+1))==NULL) {
fprintf(stderr, "%s: malloc() failed\n", __func__);
return -1;
}
strcpy(*hostname, buffer);
return 0;
} /* get_local_hostname() */
......@@ -5,6 +5,10 @@
#include <math.h>
#define __USE_XOPEN
#include <time.h>
#define _GNU_SOURCE
#include <getopt.h>
#include <readline/readline.h>
#include <readline/history.h>
#include "../../parseconf.h"
#include "abw.h"
......@@ -16,34 +20,56 @@ void usage() {
char *progname="abw";
fprintf(stderr, "%s: Usage: %s [options] [header_filter]\n", progname, progname);
fprintf(stderr, "You can specify either -f option to read flow configuration\n");
fprintf(stderr, "from the configuration file or you can specify one flow\n");
fprintf(stderr, "directly on the command line (but not both)\n\n");
fprintf(stderr, " -f filename file to read multi-flow specification (e.g., abw.cfg)\n\n");
fprintf(stderr, "General options (can be specified with -f):\n");
fprintf(stderr, " -h this help message\n");
fprintf(stderr, " -q do not print results on stdout\n");
fprintf(stderr, " -b <database> MySQL database name (e.g., abw)\n");
fprintf(stderr, " -u <user> MySQL user (e.g., abw)\n");
fprintf(stderr, " -p [password] MySQL password, if not specified, asks interactively\n\n");
fprintf(stderr, "Flow options (cannot be specified with -f):\n");
fprintf(stderr, " -d <device> device (e.g., /dev/combosix/0, /dev/dag0, default %s)\n", DEFAULT_DEVICE);
fprintf(stderr, " -m {d | b | p} sampling mode (default deterministic)\n");
fprintf(stderr, "\nFlow configuration can be specified by flow options on the command line (see below) or by configuration file or it can be read from MySQL. These three possibilities are mutually exclusive.\n");
fprintf(stderr, "\nGeneral options:\n");
fprintf(stderr, " -h print this help message\n");
fprintf(stderr, " -q or --no_stdout do not print results on stdout\n");
fprintf(stderr, " --no_measure do not do measurements, use when you want to print already\n");
fprintf(stderr, " measured results stored in MySQL or together with --conf-to-mysql when\n");
fprintf(stderr, " you want to change measurement configuration in MySQL\n");
fprintf(stderr, "\nFlow options:\n");
fprintf(stderr, " -n or --hostname <hostname> hostname of measurement station\n");
fprintf(stderr, " (default local hostname)\n");
fprintf(stderr, " -d or --device <device> device of measurement station\n");
fprintf(stderr, " (e.g., /dev/combosix/0, /dev/dag0,\n");
fprintf(stderr, " default %s)\n", DEFAULT_DEVICE);
fprintf(stderr, " -m or --sau_mode {d | b | p} sampling mode (default deterministic)\n");
fprintf(stderr, " d - deterministic\n");
fprintf(stderr, " b - byte deterministic\n");
fprintf(stderr, " p - probabilistic\n");
fprintf(stderr, " -r <threshold> pass packet when threshold is reached\n");
fprintf(stderr, " -r or --sau_threshold <threshold> pass packet when threshold is reached\n");
fprintf(stderr, " number of packets for d mode (default 1)\n");
fprintf(stderr, " number of bytes for b mode (default 3000)\n");
fprintf(stderr, " pass probability for p mode (default 0.5)\n");
fprintf(stderr, " -w <word> word to be searched in payload, for multiple -w,\n");
fprintf(stderr, " passes when at least one word matches\n");
fprintf(stderr, " -c <protocols> comma-separated list of protocols (default all),\n");
fprintf(stderr, " which means all packets irrespective of protocol\n");
fprintf(stderr, " -i interval seconds between measurements (default 1)\n");
fprintf(stderr, " -s DD.MM.YYYY-HH:MM:SS start time (default %s)\n", DEFAULT_START_TIME_STRING);
fprintf(stderr, " -e DD.MM.YYYY-HH:MM:SS end time (default %s)\n", DEFAULT_END_TIME_STRING);
fprintf(stderr, " -l mbps link installed bandwidth (default %d)\n", DEFAULT_LINK_MBPS);
fprintf(stderr, " -w or --payload_string <word> word to be searched in payload,\n");
fprintf(stderr, " for multiple -w, packet passes when at leasti\n");
fprintf(stderr, " one word matches\n");
fprintf(stderr, " --protocols <protocols> comma-separated list of protocols\n");
fprintf(stderr, " (default all), which means all packets\n");
fprintf(stderr, " irrespective of protocol\n");
fprintf(stderr, " -i or --interval <interval> seconds between measurements (default 1)\n");
fprintf(stderr, " -s or --start_time DD.MM.YYYY-HH:MM:SS\n");
fprintf(stderr, " start time (default %s)\n", DEFAULT_START_TIME_STRING);
fprintf(stderr, " -e or --end_time DD.MM.YYYY-HH:MM:SS\n");
fprintf(stderr, " end time (default %s)\n", DEFAULT_END_TIME_STRING);
fprintf(stderr, " -l or --link_mbps <mbps> link installed bandwidth (default %d)\n", DEFAULT_LINK_MBPS);
fprintf(stderr, "\nRead flow configuration from configuration file:\n");
fprintf(stderr, " -f or conf_filename <filename> file to read multi-flow specification\n");
fprintf(stderr, " (e.g., abw.cfg)\n");
fprintf(stderr, "\nRead or write flow configuration from or to MySQL:\n");
fprintf(stderr, " --db <database> MySQL database name (e.g., abw)\n");
fprintf(stderr, " -u or --user <user> MySQL user (e.g., abw)\n");
fprintf(stderr, " -p or --passwd [password] MySQL password, if not specified,\n");
fprintf(stderr, " ask interactively\n");
fprintf(stderr, " --conf_from_mysql read flow configuration from MySQL\n");
fprintf(stderr, " --conf_to_mysql write flow configuration to MySQL\n");
fprintf(stderr, " --clear_conf overwrite and delete unused configuration\n");
fprintf(stderr, " in MySQL\n");
exit(-1);
} /* usage() */
......@@ -54,40 +80,38 @@ int read_command_line(int argc, char *argv[], global_spec_t *global_spec,
double interval;
int direct_flow;
int opt;
int opt_idx;
payload_strings_no=0;
direct_flow=0;
while ((opt=getopt(argc, argv, ARGS)) != -1) {
while ((opt=getopt_long(argc, argv, ARGS, long_options, &opt_idx)) != -1) {
switch(opt) {
case 'f':
if (direct_flow) {
fprintf(stderr, "%s: cannot specify -f and direct flow at the same time\n", __func__);
return -1;
}
global_spec->conf_filename=optarg;
break;
/* General options */
case 'h':
usage();
exit(0);
case 'q':
case LO_NO_STDOUT:
global_spec->no_stdout=1;
break;
case 'b':
global_spec->db=optarg;
break;
case 'u':
global_spec->user=optarg;
case LO_NO_MEASURE:
global_spec->no_measure=1;
break;
case 'p':
if (optarg)
global_spec->passwd=optarg;
/* Flow options */
case 'n':
case LO_HOSTNAME:
direct_flow=1;
flow_spec[0]->hostname=optarg;
break;
case 'd':
case LO_DEVICE:
direct_flow=1;
flow_spec[0]->device=optarg;
break;
case 'm':
case LO_SAU_MODE:
direct_flow=1;
if (strlen(optarg)>1) {
fprintf(stderr, "%s: sampling mode must be d, b or p\n", __func__);
......@@ -96,6 +120,7 @@ int read_command_line(int argc, char *argv[], global_spec_t *global_spec,
flow_spec[0]->sau_mode=optarg[0];
break;
case 'r':
case LO_SAU_THRESHOLD:
direct_flow=1;
if (flow_spec[0]->sau_mode=='p')
sscanf(optarg, "%f", &(flow_spec[0]->sau_pass_probability));
......@@ -105,6 +130,7 @@ int read_command_line(int argc, char *argv[], global_spec_t *global_spec,
flow_spec[0]->sau_packet_threshold=atoi(optarg);
break;
case 'w':
case LO_PAYLOAD_STRING:
direct_flow=1;
if (payload_strings_no >= MAX_PAYLOAD_STRINGS) {
fprintf(stderr, "%s: max. %d strings can be searched in payload\n", __func__, MAX_PAYLOAD_STRINGS);
......@@ -121,7 +147,11 @@ int read_command_line(int argc, char *argv[], global_spec_t *global_spec,
strcpy(flow_spec[0]->payload_strings[payload_strings_no], optarg);
payload_strings_no++;
break;
case LO_PROTOCOLS:
flow_spec[0]->protocols=optarg;
break;
case 'i':
case LO_INTERVAL:
direct_flow=1;
interval=atof(optarg);
if (interval<=0) {
......@@ -133,14 +163,17 @@ int read_command_line(int argc, char *argv[], global_spec_t *global_spec,
(int)floor((interval - flow_spec[0]->interval.tv_sec) * 1000000);
break;
case 's':
case LO_START_TIME:
direct_flow=1;
flow_spec[0]->start_time_string=optarg;
break;
case 'e':
case LO_END_TIME:
direct_flow=1;
flow_spec[0]->end_time_string=optarg;
break;
case 'l':
case LO_LINK_MBPS:
direct_flow=1;
flow_spec[0]->link_mbps=atoi(optarg);
if (flow_spec[0]->link_mbps<=0) {
......@@ -148,12 +181,48 @@ int read_command_line(int argc, char *argv[], global_spec_t *global_spec,
return -1;
}
break;
/* Read flow configuration from configuration file */
case 'f':
global_spec->conf_filename=optarg;
break;
/* Read or write flow configuration from or to MySQL */
case LO_DB:
global_spec->db=optarg;
break;
case 'u':
case LO_USER:
global_spec->user=optarg;
break;
case 'p':
case LO_PASSWD:
if (optarg)
global_spec->passwd=optarg;
break;
case LO_CONF_FROM_MYSQL:
global_spec->conf_from_mysql=1;
break;
case LO_CONF_TO_MYSQL:
global_spec->conf_to_mysql=1;
break;
case LO_CLEAR_CONF:
global_spec->clear_conf=1;
break;
default:
usage();
return -1;
}
}
if ((direct_flow && global_spec->conf_filename) ||
(direct_flow && global_spec->conf_from_mysql) ||
(global_spec->conf_filename && global_spec->conf_from_mysql)) {
fprintf(stderr, "%s: flow configuration can be read from one source only - command line, configuration file or MySQL\n", __func__);
return -1;
}
return 0;
} /* read_command_line() */
......@@ -390,11 +459,19 @@ int check_conf(global_spec_t *global_spec, flow_spec_t **flow_spec) {
if (global_spec==NULL || flow_spec==NULL)
return 0;
if (global_spec->db) {
if (!global_spec->user || !global_spec->passwd) {
fprintf(stderr, "%s: if MySQL database name is given, you also have to specify MySQL username and password\n", __func__);
if (global_spec->conf_from_mysql || global_spec->conf_to_mysql ||
global_spec->db) {
if (!global_spec->db || !global_spec->user) {
fprintf(stderr, "%s: if MySQL operation is requested, you also have to specify MySQL database name, username and password\n", __func__);
return -1;
}
if (!global_spec->passwd) {
/* Note that readline() uses malloc() to allocate memory */
if ((global_spec->passwd=readline("MySQL password:"))==NULL) {
fprintf(stderr, "%s: Invalid MySQL password\n", __func__);
return -1;
}
}
}
pp=flow_spec;
......@@ -437,6 +514,9 @@ int check_conf(global_spec_t *global_spec, flow_spec_t **flow_spec) {
}
}
if (!(p->protocols) || !strlen(p->protocols))
p->protocols="all";
if (strptime(p->start_time_string, "%d.%m.%Y-%H:%M:%S",
&(p->start_time_tm))==NULL) {
fprintf(stderr, "%s: flow[%d]: cannot parse start time %s\n",
......@@ -499,6 +579,10 @@ void print_conf(global_spec_t *global_spec, flow_spec_t **flow_spec) {
printf("global_spec->conf_filename: unspecified\n");
printf("global_spec->no_stdout: %d\n", global_spec->no_stdout);
printf("global_spec->no_measure: %d\n", global_spec->no_measure);
printf("global_spec->conf_from_mysql: %d\n", global_spec->conf_from_mysql);
printf("global_spec->conf_to_mysql: %d\n", global_spec->conf_to_mysql);
printf("global_spec->clear_conf: %d\n", global_spec->clear_conf);
if (global_spec->db)
printf("global_spec->db: %s\n", global_spec->db);
......
#ifndef __ABW_CONF_H
#define __ABW_CONF_H
#define _GNU_SOURCE
#include <getopt.h>
#include "abw.h"
/*
......@@ -13,7 +16,38 @@
* as not followed by ":" and an option with an optional argument as
* followed by "::".
*/
#define ARGS ":d:m:r:w:c:f:i:s:e:l:qb:hu:p::"
#define ARGS ":n:d:m:r:w:f:i:s:e:l:hu:p::"
/* Long option codes */
enum {
LO_HOSTNAME, LO_DEVICE, LO_SAU_MODE, LO_SAU_THRESHOLD, LO_PAYLOAD_STRING,
LO_PROTOCOLS, LO_INTERVAL, LO_START_TIME, LO_END_TIME, LO_LINK_MBPS,
LO_CONF_FILENAME, LO_CONF_FROM_MYSQL, LO_CONF_TO_MYSQL, LO_CLEAR_CONF,
LO_NO_MEASURE, LO_NO_STDOUT, LO_DB, LO_USER, LO_PASSWD };
/* Long option names and argument types */
static const struct option long_options[] = {
{ "hostname", required_argument, 0, LO_HOSTNAME },
{ "device", required_argument, 0, LO_DEVICE },
{ "sau_mode", required_argument, 0, LO_SAU_MODE },
{ "sau_threshold", required_argument, 0, LO_SAU_THRESHOLD },
{ "payload_string", required_argument, 0, LO_PAYLOAD_STRING },
{ "protocols", required_argument, 0, LO_PROTOCOLS },
{ "interval", required_argument, 0, LO_INTERVAL },
{ "start_time", required_argument, 0, LO_START_TIME },
{ "end_time", required_argument, 0, LO_END_TIME },
{ "link_mbps", required_argument, 0, LO_LINK_MBPS },
{ "conf_filename", required_argument, 0, LO_CONF_FILENAME },
{ "conf_from_mysql", no_argument, 0, LO_CONF_FROM_MYSQL },
{ "conf_to_mysql", no_argument, 0, LO_CONF_TO_MYSQL },
{ "clear_conf", no_argument, 0, LO_CLEAR_CONF },
{ "no_measure", no_argument, 0, LO_NO_MEASURE },
{ "no_stdout", no_argument, 0, LO_NO_STDOUT },
{ "db", required_argument, 0, LO_DB },
{ "username", required_argument, 0, LO_USER },
{ "passwd", optional_argument, 0, LO_PASSWD },
{ 0, 0, 0, 0 }
};
#define DEFAULT_DEVICE "eth0"
#define DEFAULT_START_TIME_STRING "01.01.1970-01:00:00"
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#define __USE_XOPEN
#include <time.h>
#include <sys/time.h>
#include <math.h>
int main()
{ return 0;
}
#include <mysql/mysql.h>
#include "../../mapi.h"
#include "../../stdlib/sample.h"
#include "abw.h"
#include "abw_mysql.h"
#include "abw_time.h"
#include "abw_conf.h"
global_spec_t global_spec;
flow_spec_t *flow_spec[MAX_FLOWS];
int main(int argc, char *argv[])
{
int i, j;
struct timeval tm;
struct timezone tz;
flow_spec_t **pp;
flow_spec_t *p;
flow_run_t *q;
struct timeval next, wait;
int subject_id, parameters_id;
if (get_local_hostname(&(global_spec.hostname))<0) {
fprintf(stderr, "%s: get_local_hostname() failed\n", __func__);
return -1;
}
/* Read MySQL database name, username and password from command line */
if (read_command_line_mysql(argc, argv, &global_spec)<0) {
fprintf(stderr, "%s: read_command_line_mysql() failed\n", __func__);
return -1;