diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2005-10-14 07:07:35 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2005-10-14 07:07:35 +0000 |
commit | bb0d1da6daeede6fc1236bff37814353ef5480ee (patch) | |
tree | dabac3c1913664a2fc56077ca107df80b39f5677 | |
parent | 28ff893ce64e2a46b62fb517c268ed1785c009c2 (diff) | |
download | rsyslog-bb0d1da6daeede6fc1236bff37814353ef5480ee.tar.gz rsyslog-bb0d1da6daeede6fc1236bff37814353ef5480ee.tar.bz2 rsyslog-bb0d1da6daeede6fc1236bff37814353ef5480ee.zip |
added capability to specify listen port for rfc3195d
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | rfc3195d.8 | 6 | ||||
-rw-r--r-- | rfc3195d.c | 24 |
3 files changed, 27 insertions, 4 deletions
@@ -2,6 +2,7 @@ Version 1.11.1 (RGer), 2005-10-13 - some internal restructuring in anticipation/preparation of minimal multi-threading support +- added ability to specify listen port for rfc3195d --------------------------------------------------------------------------- Version 1.11.0 (RGer), 2005-10-12 - support for receiving messages via RFC 3195; added rfc3195d for that @@ -10,6 +10,9 @@ rfc3195d \- RFC 3195 listener .RB [ " \-p" .IB socket ] +.RB [ " \-r" +.IB port +] .RB [ " \-v " ] .LP .SH DESCRIPTION @@ -45,6 +48,9 @@ time as the rsyslog project is continously being enhanced. The socket the received messages are to be sent to. If not specified, /dev/log3195 is used. .TP +.BI "\-r " "port" +The listen port to use. If not specified, IANA-assigned port 601 is used. +.TP .B "\-d" Turns on debug mode. In it, rfc3195d spits out diagnostic information to stdout. @@ -51,6 +51,7 @@ static char* pPathLogname = "/dev/log3195"; static char *PidFile; static int NoFork = 0; static int Debug = 0; +static int listenPort = 0; /* we use a global API object below, because this listener is * not very complex. As such, this hack should not harm anything. @@ -70,7 +71,7 @@ static int usage() * currently actually do... fprintf(stderr, "usage: rfc3195d [-dv] [-i pidfile] [-n] [-p path]\n"); */ - fprintf(stderr, "usage: rfc3195d [-dv] [-p path]\n"); + fprintf(stderr, "usage: rfc3195d [-dv] [-r port] [-p path]\n"); exit(1); } @@ -187,7 +188,7 @@ int main(int argc, char* argv[]) srRetVal iRet; int ch; - while ((ch = getopt(argc, argv, "di:np:v")) != EOF) + while ((ch = getopt(argc, argv, "di:np:r:v")) != EOF) switch((char)ch) { case 'd': /* debug */ Debug = 1; @@ -201,6 +202,14 @@ int main(int argc, char* argv[]) case 'p': /* path to regular log socket */ pPathLogname = optarg; break; + case 'r': /* listen port */ + listenPort = atoi(optarg); + if(listenPort < 1 || listenPort > 65535) { + printf("Error: invalid listen port '%s', using 601 instead\n", + optarg); + listenPort = 601; + } + break; case 'v': printf("rfc3195d %s.%s (using liblogging version %d.%d.%d).\n", VERSION, PATCHLEVEL, @@ -226,10 +235,17 @@ int main(int argc, char* argv[]) exit(1); } +printf("Setting listen port %d\n", listenPort); + if((iRet = srAPISetOption(pAPI, srOPTION_BEEP_LISTENPORT, listenPort)) != SR_RET_OK) + { + printf("Error %d setting listen port - aborting\n", iRet); + exit(100); + } + if((iRet = srAPISetupListener(pAPI, OnReceive)) != SR_RET_OK) { printf("Error %d setting up listener - aborting\n", iRet); - exit(100); + exit(101); } /* now move the listener to running state. Control will only @@ -238,7 +254,7 @@ int main(int argc, char* argv[]) if((iRet = srAPIRunListener(pAPI)) != SR_RET_OK) { printf("Error %d running the listener - aborting\n", iRet); - exit(101); + exit(102); } /** control will reach this point after shutdown */ |