aboutsummaryrefslogtreecommitdiffstats
path: root/glougloud/glougloud.c
diff options
context:
space:
mode:
Diffstat (limited to 'glougloud/glougloud.c')
-rw-r--r--glougloud/glougloud.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/glougloud/glougloud.c b/glougloud/glougloud.c
index 2a87492..e868e29 100644
--- a/glougloud/glougloud.c
+++ b/glougloud/glougloud.c
@@ -37,7 +37,8 @@ usage(void)
{
extern char *__progname;
- fprintf(stderr, "usage: %s [-hi]\n", __progname);
+ fprintf(stderr, "usage: %s [-hv] [-l probes_ip] [-L analysers_ip]\n"
+ "\t\t[-p probes_port] [-P analysers_port]\n", __progname);
exit(1);
}
@@ -53,14 +54,30 @@ int
main(int argc, char **argv)
{
struct event *ev_sigint, *ev_sigterm, *ev_sigchld, *ev_sighup;
+ char probes_ip[30] = "127.0.0.1";
+ char analysers_ip[30] = "127.0.0.1";
+ int probes_port = GLOUGLOU_PROBE_DEFAULT_PORT;
+ int analysers_port = GLOUGLOU_ANALY_DEFAULT_PORT;
int loglevel = 0;
int op;
- while ((op = getopt(argc, argv, "hv")) != -1) {
+ while ((op = getopt(argc, argv, "hl:L:p:P:v")) != -1) {
switch (op) {
case 'h':
usage();
/* NOTREACHED */
+ case 'l':
+ strncpy(probes_ip, optarg, sizeof(probes_ip));
+ break;
+ case 'L':
+ strncpy(analysers_ip, optarg, sizeof(analysers_ip));
+ break;
+ case 'p':
+ probes_port = atoi(optarg);
+ break;
+ case 'P':
+ analysers_port = atoi(optarg);
+ break;
case 'v':
loglevel++;
break;
@@ -89,9 +106,9 @@ main(int argc, char **argv)
evsignal_add(ev_sighup, NULL);
signal(SIGPIPE, SIG_IGN);
- ggserv_probes = gg_server_start(ev_base, "127.0.0.1", GLOUGLOU_PROBE_DEFAULT_PORT,
+ ggserv_probes = gg_server_start(ev_base, probes_ip, probes_port,
prb_handle_conn, prb_handle_packet, NULL);
- ggserv_analysers = gg_server_start(ev_base, "127.0.0.1", GLOUGLOU_ANALY_DEFAULT_PORT,
+ ggserv_analysers = gg_server_start(ev_base, analysers_ip, analysers_port,
cli_handle_conn, cli_handle_packet, NULL);
event_base_dispatch(ev_base);