From 8e1466eacc077b608ebfc82dbef6f0beb169e789 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Fri, 11 Mar 2011 13:23:46 +0100 Subject: [PATCH] [Listener] check_configuration(): port numbers --- .../owlps-listener/owlps-listenerd.c | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/infrastructure-centred/owlps-listener/owlps-listenerd.c b/infrastructure-centred/owlps-listener/owlps-listenerd.c index b9c2d67..3d3dd39 100644 --- a/infrastructure-centred/owlps-listener/owlps-listenerd.c +++ b/infrastructure-centred/owlps-listener/owlps-listenerd.c @@ -397,6 +397,38 @@ void check_configuration() " the aggregation IP as the destination of" " autocalibration requests.\n") ; } + + // Port numbers // + if (GET_AGGREGATION_PORT() < 1 || GET_AGGREGATION_PORT() > 65535) + { + if (GET_VERBOSE()) + fprintf(stderr, "Warning! Bad aggregation_port:" + " failing back to the default value.\n") ; + SET_AGGREGATION_PORT(AGGREGATE_DEFAULT_PORT) ; + } + if (GET_LISTENING_PORT() < 1 || GET_LISTENING_PORT() > 65535) + { + if (GET_VERBOSE()) + fprintf(stderr, "Warning! Bad listening_port:" + " failing back to the default value.\n") ; + SET_LISTENING_PORT(LOC_REQUEST_DEFAULT_PORT) ; + } + if (GET_AUTOCALIBRATION_REQUEST_PORT() < 1 || + GET_AUTOCALIBRATION_REQUEST_PORT() > 65535) + { + if (GET_VERBOSE()) + fprintf(stderr, "Warning! Bad autocalibration_request_port:" + " failing back to the default value.\n") ; + SET_AUTOCALIBRATION_REQUEST_PORT(DEFAULT_AUTOCALIBRATION_REQUEST_PORT) ; + } + if (GET_AUTOCALIBRATION_PORT() < 1 || + GET_AUTOCALIBRATION_PORT() > 65535) + { + if (GET_VERBOSE()) + fprintf(stderr, "Warning! Bad autocalibration_port:" + " failing back to the default value.\n") ; + SET_AUTOCALIBRATION_PORT(DEFAULT_AUTOCALIBRATION_PORT) ; + } }