Disable the internal webserver at build time.
This commit is contained in:
parent
9a10ef4886
commit
e4ceea33da
10
dump1090.c
10
dump1090.c
|
@ -150,7 +150,9 @@ void modesInitConfig(void) {
|
|||
Modes.net_output_sbs_ports = strdup("30003");
|
||||
Modes.net_input_beast_ports = strdup("30004,30104");
|
||||
Modes.net_output_beast_ports = strdup("30005");
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
Modes.net_http_ports = strdup("8080");
|
||||
#endif
|
||||
Modes.interactive_rows = getTermRows();
|
||||
Modes.interactive_display_ttl = MODES_INTERACTIVE_DISPLAY_TTL;
|
||||
Modes.html_dir = HTMLPATH;
|
||||
|
@ -680,7 +682,9 @@ void showHelp(void) {
|
|||
"--modeac Enable decoding of SSR Modes 3/A & 3/C\n"
|
||||
"--net-only Enable just networking, no RTL device or file used\n"
|
||||
"--net-bind-address <ip> IP address to bind to (default: Any; Use 127.0.0.1 for private)\n"
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
"--net-http-port <ports> HTTP server ports (default: 8080)\n"
|
||||
#endif
|
||||
"--net-ri-port <ports> TCP raw input listen ports (default: 30001)\n"
|
||||
"--net-ro-port <ports> TCP raw output listen ports (default: 30002)\n"
|
||||
"--net-sbs-port <ports> TCP BaseStation output listen ports (default: 30003)\n"
|
||||
|
@ -993,8 +997,14 @@ int main(int argc, char **argv) {
|
|||
free(Modes.net_bind_address);
|
||||
Modes.net_bind_address = strdup(argv[++j]);
|
||||
} else if (!strcmp(argv[j],"--net-http-port") && more) {
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
free(Modes.net_http_ports);
|
||||
Modes.net_http_ports = strdup(argv[++j]);
|
||||
#else
|
||||
if (strcmp(argv[++j], "0")) {
|
||||
fprintf(stderr, "warning: --net-http-port not supported in this build, option ignored.\n");
|
||||
}
|
||||
#endif
|
||||
} else if (!strcmp(argv[j],"--net-sbs-port") && more) {
|
||||
free(Modes.net_output_sbs_ports);
|
||||
Modes.net_output_sbs_ports = strdup(argv[++j]);
|
||||
|
|
|
@ -292,7 +292,9 @@ struct { // Internal state
|
|||
char *net_output_sbs_ports; // List of SBS output TCP ports
|
||||
char *net_input_beast_ports; // List of Beast input TCP ports
|
||||
char *net_output_beast_ports; // List of Beast output TCP ports
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
char *net_http_ports; // List of HTTP ports
|
||||
#endif
|
||||
char *net_bind_address; // Bind address
|
||||
int net_sndbuf_size; // TCP output buffer size (64Kb * 2^n)
|
||||
int net_verbatim; // if true, send the original message, not the CRC-corrected one
|
||||
|
|
14
net_io.c
14
net_io.c
|
@ -69,7 +69,9 @@
|
|||
|
||||
static int decodeBinMessage(struct client *c, char *p);
|
||||
static int decodeHexMessage(struct client *c, char *hex);
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
static int handleHTTPRequest(struct client *c, char *p);
|
||||
#endif
|
||||
|
||||
static void send_raw_heartbeat(struct net_service *service);
|
||||
static void send_beast_heartbeat(struct net_service *service);
|
||||
|
@ -258,8 +260,10 @@ void modesInitNet(void) {
|
|||
s = makeBeastInputService();
|
||||
serviceListen(s, Modes.net_bind_address, Modes.net_input_beast_ports);
|
||||
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
s = serviceInit("HTTP server", NULL, NULL, "\r\n\r\n", handleHTTPRequest);
|
||||
serviceListen(s, Modes.net_bind_address, Modes.net_http_ports);
|
||||
#endif
|
||||
}
|
||||
//
|
||||
//=========================================================================
|
||||
|
@ -1083,9 +1087,11 @@ static char * appendStatsJson(char *p,
|
|||
else p += snprintf(p, end-p, ",%u", st->remote_accepted[i]);
|
||||
}
|
||||
|
||||
p += snprintf(p, end-p, "]");
|
||||
p += snprintf(p, end-p, "]}");
|
||||
|
||||
p += snprintf(p, end-p, "},\"http_requests\":%u", st->http_requests);
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
p += snprintf(p, end-p, ",\"http_requests\":%u", st->http_requests);
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -1277,6 +1283,7 @@ void writeJsonToFile(const char *file, char * (*generator) (const char *,int*))
|
|||
}
|
||||
|
||||
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
|
||||
//
|
||||
//=========================================================================
|
||||
|
@ -1471,6 +1478,9 @@ static int handleHTTPRequest(struct client *c, char *p) {
|
|||
Modes.stats_current.http_requests++;
|
||||
return !keepalive;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
//=========================================================================
|
||||
//
|
||||
|
|
4
stats.c
4
stats.c
|
@ -155,8 +155,10 @@ void display_stats(struct stats *st) {
|
|||
printf("%u unique aircraft tracks\n", st->unique_aircraft);
|
||||
printf("%u aircraft tracks where only one message was seen\n", st->single_message_aircraft);
|
||||
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
if (Modes.net)
|
||||
printf("%d HTTP requests\n", st->http_requests);
|
||||
#endif
|
||||
|
||||
{
|
||||
uint64_t demod_cpu_millis = (uint64_t)st->demod_cpu.tv_sec*1000UL + st->demod_cpu.tv_nsec/1000000UL;
|
||||
|
@ -307,8 +309,10 @@ void add_stats(const struct stats *st1, const struct stats *st2, struct stats *t
|
|||
// total messages:
|
||||
target->messages_total = st1->messages_total + st2->messages_total;
|
||||
|
||||
#ifdef ENABLE_WEBSERVER
|
||||
// network:
|
||||
target->http_requests = st1->http_requests + st2->http_requests;
|
||||
#endif
|
||||
|
||||
// CPR decoding:
|
||||
target->cpr_surface = st1->cpr_surface + st2->cpr_surface;
|
||||
|
|
Loading…
Reference in a new issue