From bd690db2b3da119045d43af5a37eb34ecd5c102d Mon Sep 17 00:00:00 2001 From: Karl Lehenbauer Date: Thu, 2 Oct 2014 21:38:41 -0500 Subject: [PATCH] Use standard MODES_NET_SERVICES_NUM in faup1090 For faup1090 only the FlightAware service is enabled and we were shortening the services table by using our own define of FAUP_NET_SERVICES_NUM and having it set to 1. Apps need to stick with the same number of services as defined by MODES_NET_SERVICES_NUM in dump1090 because dump1090 support routine modesAcceptClients loops on this constant to walk the services table. Likewise we now define all the service ports dump1090 defines even though we are not using them. We have configured them as disabled. Version bump to 1.14. --- faup1090.c | 25 +++++++++++++------------ faup1090.h | 2 +- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/faup1090.c b/faup1090.c index 8d693e4..21b336b 100644 --- a/faup1090.c +++ b/faup1090.c @@ -146,21 +146,22 @@ struct service { int enabled; }; -#define FAUP_NET_SERVICES_NUM 1 - -extern struct service services[FAUP_NET_SERVICES_NUM]; +extern struct service services[MODES_NET_SERVICES_NUM]; void faupInitNet(void) { int j; - struct service svc[FAUP_NET_SERVICES_NUM] = { - // {"Raw TCP output", &Modes.ros, Modes.net_output_raw_port, 0}, - // {"Raw TCP input", &Modes.ris, Modes.net_input_raw_port, 0}, - // {"Beast TCP output", &Modes.bos, Modes.net_output_beast_port, 0}, - // {"Beast TCP input", &Modes.bis, Modes.net_input_beast_port, 0}, - // {"HTTP server", &Modes.https, Modes.net_http_port, 0}, - // {"Basestation TCP output", &Modes.sbsos, Modes.net_output_sbs_port, 0}, - {"FlightAware TSV output", &Modes.fatsvos, Modes.net_fatsv_port, 1} + // for faup1090 only the FlightAware service is enabled. + // we need to stick with the same number of services as defined in + // dump1090 because dump1090 support routines expect this many. + struct service svc[MODES_NET_SERVICES_NUM] = { + {"FlightAware TSV output", &Modes.fatsvos, Modes.net_fatsv_port, 1}, + {"Raw TCP output", &Modes.ros, Modes.net_output_raw_port, 0}, + {"Raw TCP input", &Modes.ris, Modes.net_input_raw_port, 0}, + {"Beast TCP output", &Modes.bos, Modes.net_output_beast_port, 0}, + {"Beast TCP input", &Modes.bis, Modes.net_input_beast_port, 0}, + {"HTTP server", &Modes.https, Modes.net_http_port, 0}, + {"Basestation TCP output", &Modes.sbsos, Modes.net_output_sbs_port, 0} }; memcpy(&services, &svc, sizeof(svc));//services = svc; @@ -178,7 +179,7 @@ void faupInitNet(void) { } #endif - for (j = 0; j < FAUP_NET_SERVICES_NUM; j++) { + for (j = 0; j < MODES_NET_SERVICES_NUM; j++) { services[j].enabled = (services[j].port != 0); if (services[j].enabled) { int s = anetTcpServer(Modes.aneterr, services[j].port, NULL); diff --git a/faup1090.h b/faup1090.h index 96659b6..24b051b 100644 --- a/faup1090.h +++ b/faup1090.h @@ -2,7 +2,7 @@ #include "dump1090.h" -#define FAUP1090_VERSION "1.13" +#define FAUP1090_VERSION "1.14" #undef MODES_NET_INPUT_RAW_PORT #define MODES_NET_INPUT_RAW_PORT 0