Commit graph

189 commits

Author SHA1 Message Date
Oliver Jowett 001f4956ea faup1090: report non-A-class categories. 2016-09-15 15:00:10 +01:00
Oliver Jowett 9653d365db faup1090: emit events from DF18 as well as DF17 2016-09-15 14:59:04 +01:00
Oliver Jowett 4dacb291ab Fix tabs in faup1090 output. 2016-09-14 17:19:36 +01:00
Oliver Jowett 8441cf7d90 Emit non-icao addresses, address types from faup1090 2016-09-14 17:02:23 +01:00
Oliver Jowett 0ae2c5efc8 Emit addrtype in json output. 2016-09-14 17:01:07 +01:00
Oliver Jowett 1958b23a93 Tweak the on-the-ground conditions a little. 2016-09-02 18:46:48 +01:00
Oliver Jowett 303d3c3fef Make faup1090 emit iSource to say where the ident came from. 2016-09-01 19:11:33 +01:00
Oliver Jowett 08887642ea Rename the ACAS stuff a bit, emit ES target state. 2016-08-28 12:51:03 +01:00
Oliver Jowett 954034855a Make faup1090 emit some interesting messages when they occur. 2016-08-28 01:29:37 +01:00
Oliver Jowett 54ca2c7fb2 WIP big rewrite of message decoding / aircraft tracking. 2016-08-27 14:34:14 +01:00
Oliver Jowett 36a5c16dd2 Initialize from static "zero" messages rather than using memset. 2016-08-26 21:39:39 +01:00
Oliver Jowett e4ceea33da Disable the internal webserver at build time. 2016-07-10 11:56:31 +01:00
Oliver Jowett da437b3295 Set the socket buffer to the size of a HTTP response.
This gives us a better chance of the response fitting in a single
write() call (if it doesn't, it's going to get truncated, because
the internal webserver is really simple)
2016-07-02 10:51:23 +01:00
Oliver Jowett 22c90415be Check we got a full read when serving local files over HTTP. 2016-07-02 10:50:55 +01:00
Jon Williams 94706763e5 fix compilation on OpenBSD 2016-03-31 13:25:32 -04:00
Oliver Jowett 85aa200947 Extra paranoia for --aggressive mode: only forward 2-bit-corrected messages
via paths that allow the recipient to see that they are 2-bit-corrected
i.e. raw or beast output in --net-verbatim mode only.
2016-03-03 12:39:01 +00:00
Oliver Jowett 214bc0e587 Treat zero-or-missing signal levels as "no information" and don't include them in RSSI. 2016-02-24 11:55:01 +00:00
Oliver Jowett eb16ac2028 Fix some termination issues. 2016-02-16 13:05:03 +00:00
Oliver Jowett a2eb71d49a IPv6 support (in theory).
Fixes #87.
2016-02-16 13:00:55 +00:00
Oliver Jowett 2b466535de Support multiple listening ports per listener type.
Beast input defaults to listening on both 30004 and 30104.
Drop the FATSV listener entirely (use faup1090 for that)
Ignore --net-beast.
2016-01-24 18:47:58 +00:00
Oliver Jowett c4e162287d Oops, sprintf -> snprintf 2016-01-21 20:22:18 +00:00
Oliver Jowett d9eec668cf Track what data we got via TIS-B, report it as such. 2016-01-21 19:42:37 +00:00
Oliver Jowett ecbdbf23d6 Never forward mlat via SBS or raw output; it is no longer identifiable
as mlat when forwarded on those paths.
2016-01-21 17:48:06 +00:00
Oliver Jowett 9479a5c9be If --hae is passed, report altitudes as HAE where available, with a H suffix.
This affects interactive mode and SBS output.
2016-01-01 15:15:28 +00:00
maxried 90adaf22f7 Update net_io.c 2015-09-14 20:03:19 +02:00
maxried 267e5d6909 Update net_io.c 2015-09-14 19:59:50 +02:00
Oliver Jowett 45d645a864 Default to not forwarding mlat messages. Add --forward-mlat option to enable it. 2015-07-03 21:56:23 +01:00
Oliver Jowett 51b5f4af24 Include mlatFlags in aircraft.json.
This requires expanding the line-buffer margin too as we can produce lines >256 chars now.
2015-06-29 10:46:37 +01:00
Oliver Jowett b793f83a29 Rewrite and fix heartbeat code.
The old logic had a number of problems, including:

 * sending heartbeats on all service types if any type needed
   a heartbeat
 * sending a heartbeat multiple times a second if there was a
   service type that was idle but didn't generate traffic when
   an empty message was sent (e.g. FATSV)

Rewrite it all so that heartbeats are explicitly tracked and handled
per service type, rather than by sending a dummy message.

Also switch to mode A/C messages for the beast/raw heartbeat, as
it's a bit more compact and less likely to mess with Mode S state
(an all-zeros Mode S message actually looks valid)
2015-06-29 10:06:13 +01:00
Oliver Jowett 12a7d45e75 Mlat synthetic message detection.
Notice synthetic mlat messages by looking for messages with a magic
timestamp value. If they arrive, tag the derived data as mlat-derived.

Don't include mlat-derived output in FATSV output to avoid loops.
2015-06-28 20:04:09 +01:00
Oliver Jowett 8f08c1b87f Make faup1090 write to stdout, not listen on port 10001. 2015-06-28 19:59:49 +01:00
Oliver Jowett c7722f2b97 Guard against closing clients in a couple of places.
In particular, not guarding in flushWrites() meant that we
could end up trying to write to an uninitialized writer
(where writer->service == c->service == NULL) and crashing.
2015-06-26 21:29:54 +01:00
Oliver Jowett 8d1df036ae Don't use DF0/4/16/20 altitudes when DF17/18 altitudes are available.
The DF17/18 values are generally more trustworthy as they have full
CRC coverage. Errors in the CRC bits of a DF0/4/16/20 message can
result in the contained altitude being attributed to the wrong aircraft.
2015-06-26 20:43:46 +01:00
Oliver Jowett 278448179d Factor out net services so they're not tied to a static array.
This lets different things dynamically create the services they need,
and sorts out the horrible hacks that view1090 used to make outgoing
connections. Now you can explicitly create a service and tell it to make
an outgoing connection.

This means that view1090 can now just set all the ports to zero (to disable
the listeners), do a normal net init, then explicitly construct the beast
input service without a listener and tell it to make a connection as needed.
2015-06-26 17:50:51 +01:00
Oliver Jowett 21bdc45bf0 Tweaks to noise measurements. 2015-06-16 10:13:25 +01:00
Oliver Jowett 7d4eaf6a48 Don't emit stale alt/speed/track/pos (more than 30s old) even if
they were updated since we last emitted a message.
2015-06-16 01:38:44 +01:00
Oliver Jowett 4f861f653a Track age of heading/speed/altitude; use this when deciding what to emit in FATSV format. 2015-06-15 23:13:04 +01:00
Oliver Jowett 4d697ac61d Emit capitalized hex in avrmlat output. 2015-04-18 11:21:09 +01:00
Oliver Jowett e9378fb1c5 Fix endian issues in timestamp input/output.
This affected Beast input/output, and AVR output in --mlat mode.

Works on a little-endian host, should work on a big-endian host but
I don't have one to test with.

Probably fixes #44.
2015-04-18 11:05:12 +01:00
Oliver Jowett 15ea5ba3da Rearrangements to the receive thread.
Magnitude conversion now happens immediately when sample data is
received, so there is no risk of newly received data clobbering old
data under CPU overload.
2015-04-09 18:51:31 +01:00
Oliver Jowett d7c5047fd3 Fix crash when requesting nonexistent extensionless files
(but only if HTMLPATH does not contain a '.')

Clean up overuse of strstr.

(based on 259ce08f81eaaaa087b6b1994fce7dde81820c52)
2015-02-23 00:11:55 +00:00
Oliver Jowett 8f3be2cd79 Decode aircraft category, export in aircraft.json.
Closes #2.
2015-02-22 12:15:26 +00:00
Oliver Jowett e7d7fd549c Fix off-by-one error in Beast-format input.
This would mangle messages if the first byte of a message ended up
as the last byte returned by a read() call - it would read beyond
the end of the buffer, decide the message was damaged, and then run
off into the message data looking for a new delimiter. Sometimes
that would work (only dropping one message), but sometimes it would
run into data that happened to look like a message start but
actually wasn't, and then try to interpret that, leading to completely
bogus message data being read.

Fixes #29.
2015-02-21 23:50:35 +00:00
Oliver Jowett e0f167b703 Fix json syntax error. 2015-02-19 19:12:06 +00:00
Oliver Jowett f6d2f3dfff More CPR stats. 2015-02-19 18:53:11 +00:00
Oliver Jowett bfe2cb0336 NUCp tracking and CPR position sanity checks.
Track NUCp when we compute positions.

Do speed checks when we have an updated position with the same or worse NUCp
before accepting the new position. Don't do speed checks on new postions if
they improve NUCp - assume that the new position is better.

Include NUCp in aircraft.json

Gather stats on reasons for rejecting CPR data due to range/speed check failures.

Expire old positions if we have had no updates for 60 seconds.

Closes #16, closes #17.
2015-02-18 00:12:35 +00:00
Oliver Jowett 849697f84c Fix integer overflow in stats output. 2015-02-11 00:14:28 +00:00
Oliver Jowett f9ed7e4a97 More time_t -> milliseconds conversions.
This lets us support fractional net flush times among other things, which is handy.
2015-02-10 22:24:22 +00:00
Oliver Jowett 7053ad02da Make aircraft tracking use milliseconds everywhere. 2015-02-10 21:49:37 +00:00
Oliver Jowett a49b5b8830 Add stats for total aircraft tracks and tracks that have only a single message. 2015-02-08 18:47:39 +00:00
Oliver Jowett 4e177c2d64 Store computed reception time in the message struct so we don't rely on
the message being emitted immediately.

Fix computation of reception time so it's more sensible (the block timestamp
is some time after reception of the _end_ of the block, not the start) - this
means that message-emission times are always later than message-reception
times in SBS output, which is a bit more sensible.

Use clock_gettime in preference to ftime.
2015-02-08 17:46:01 +00:00
Oliver Jowett 20407e5378 Don't emit SBS output with non-ICAO addresses (fixes #9) 2015-02-08 14:30:10 +00:00
Oliver Jowett 245bbd8b97 Report total, not latest-minute, message count in aircraft.json so that
the webmap value doesn't jump around over a reset.
2015-01-23 17:40:03 +00:00
Oliver Jowett c5b61a33fd Oops, another compile error, sigh. 2015-01-23 02:11:44 +00:00
Oliver Jowett c07e45a4c8 Report CPU in integer milliseconds, makes it a bit easier to process. 2015-01-23 02:03:57 +00:00
Oliver Jowett 5b40377b98 Measure CPU for demodulator, read thread, and background tasks individually. 2015-01-23 01:22:22 +00:00
Oliver Jowett eb023ff1d9 Don't include latest in 1/5/15 min totals, it's a bit confusing.
This means the 1/5/15 min values may reflect a period that ended
up to 1 minute ago, but the length of the measured period is always
as expected i.e. 1/5/15 mins.
2015-01-22 20:45:53 +00:00
Oliver Jowett c8025700e5 Emit all stats in stats.json. 2015-01-22 20:18:51 +00:00
Oliver Jowett 008ae926e7 Add --net-verbatim, which forwards the original uncorrected message to net clients,
not the corrected version. Then the client can make its own policy decisions about
whether to accept and correct the damaged messages.
2015-01-22 19:56:38 +00:00
Oliver Jowett a59077a370 Stats overhaul. 2015-01-22 19:49:19 +00:00
Oliver Jowett b77d52bd1f Include recent RSSI in aircraft output. 2015-01-22 15:30:34 +00:00
Oliver Jowett 89d6b64747 Treat signal level in network messages as a (RMS) amplitude, since that
is what was previously done and it gives us better range for small signals.

Means a sqrt() call on beast output, but this shouldn't be too bad as
it's only done once per message.
2015-01-22 15:28:35 +00:00
Oliver Jowett 35e0364670 Fix compile errors. 2015-01-22 13:29:13 +00:00
Oliver Jowett 70e8579850 Simple filter for spurious messages that make it past checksum:
don't show aircraft until we have seen 2 messages from them.
2015-01-22 13:22:16 +00:00
Oliver Jowett ada188a1c8 Changed my mind, put the non-ICAO flag bit in the address itself
since we have 8 bits spare, so there's no chance of confusing it
with an ICAO address, and we can safely use the filter table to match
future messages without also matching equivalent ICAO addresses.
2015-01-22 12:30:12 +00:00
Oliver Jowett 35551b4455 Don't emit FATSV output for non-ICAO addresses. 2015-01-22 12:18:46 +00:00
Oliver Jowett 6e1315e3a6 Flag non-ICAO addresses in json output. 2015-01-22 12:18:14 +00:00
Oliver Jowett d0605629b6 Avoid zero signalLevel. 2015-01-22 11:40:52 +00:00
Oliver Jowett 7850848ef7 Export a few stats via JSON. 2015-01-22 01:21:53 +00:00
Oliver Jowett 19082d92ea Measure signal power / noise power (at least in 2.4MHz mode).
Switch signalLevel back to a power measurement, don't put SNR in there.
But make it a 0.0 - 1.0 double so we're not scaling everywhere.

Adjust for the amplitude offset when calculating power.

Adapt everything else to the new scheme.
2015-01-22 01:01:39 +00:00
Oliver Jowett 2a1a2a0a71 Fix (maybe) JSON escaping.
I've obviously never tested this code!
2015-01-21 11:58:51 +00:00
Oliver Jowett cae20a8060 Escape flight name in JSON in case it has odd characters. 2015-01-21 11:56:27 +00:00
Oliver Jowett ebae590653 Use MODES_NOTUSED for unused args. 2015-01-21 11:54:55 +00:00
Oliver Jowett 5e522fe8db Decoder cleanups from experimental branch. 2015-01-21 00:23:48 +00:00
Oliver Jowett b9b76da02d Stats rearrangement, based on experimental branch changes. 2015-01-20 17:16:35 +00:00
Oliver Jowett e02a2cdd44 GPL. 2015-01-20 16:49:01 +00:00
Oliver Jowett e68949bdb3 Write an accurate value for the history count, so the progress bar is correct.
(cherry picked from commit 0919700293e34f5a93a4407d33e1e56c0ae0d13c)
2015-01-16 20:33:40 +00:00
Oliver Jowett c7204ec6ab Support image/gif content type
(cherry picked from commit f4b38a62f69d0df2bb5d3a87979e38d76249b80a)
2015-01-16 20:33:08 +00:00
Oliver Jowett 1db63ebc65 Add generation of history JSON.
Add support for URL handlers that match a path prefix.

(cherry picked from commit 38faa510cb881cbf9d2a0a85bbde61130b5259e7)
2015-01-16 20:31:59 +00:00
Oliver Jowett b1bfb4d520 Rationalization of JSON output. Pass actual URL path to URL handler.
(cherry picked from commit becce8d69a6e6cee38d4fdb78b5a4e25d570baea)
2015-01-16 20:30:41 +00:00
Oliver Jowett 63fb121d1c Status messages in HTTP responses.
(cherry picked from commit 820528b4ad7f3963199718205724cdf3ac97b113)
2015-01-16 20:28:36 +00:00
Oliver Jowett 72bfc31458 Display message rate (30 sec average) on the webmap.
(cherry picked from commit 848af78be685c6e2a26d0b30e9f385696201a2c4)
2015-01-13 22:01:53 +00:00
Oliver Jowett 0976d12b88 Ditch any query strings in HTTP requests before handling them,
to allow AJAX requests to tack on a query string to avoid caching.
2015-01-07 18:40:55 +00:00
Oliver Jowett e8a62293c2 More WIP on the webmap, mostly fixing up track history. 2015-01-06 01:00:44 +00:00
Oliver Jowett 1f06abf67d WIP webmap cleanup 2015-01-05 23:20:03 +00:00
Oliver Jowett 58dfbdcb6b Add support for controlling the accuracy of the receiver location
written in the JSON metadata used by the webmap.
2014-12-27 20:52:56 +00:00
Oliver Jowett 9fa09e0e92 receiver.json support, internal webserver cleanup.
Add data/receiver.json (generated once) and support for it in script.js.

Internal webserver rearrangement to support multiple json files.
2014-12-10 17:05:22 +00:00
Oliver Jowett c712543ee5 Only completeWrite() if we didn't run off the end of the buffer.
If we did run off the end, complain about it.
2014-12-08 20:17:48 +00:00
Oliver Jowett 39d905324f Be more paranoid about not overrunning our fatsv output buffer.
Request a buffer of a more reasonable size.
2014-12-08 20:14:53 +00:00
Oliver Jowett 2dcc8e3524 Add direct support for FATSV-format output.
This is adapted from the FlightAware fork, with some cleanup and
modifications needed to work with the net-cleanup changes.

Inclusion of "verbatim" TSV data read from an AVR-format input
connection is not supported.
2014-12-08 19:56:45 +00:00
Oliver Jowett af957da81c Merge branch 'realpath-memory-leak' 2014-12-07 14:10:17 +00:00
Oliver Jowett d09eefb827 Fix a memory leak from use of realpath() in HTTP request processing.
realpath() returns a heap-allocated buffer if given NULL for the destination buffer.
This must be freed by the caller; dump1090 does not do this.

Instead of worrying about freeing it, take the simpler approach of just providing a
stack-allocated destination buffer.
2014-12-07 14:05:24 +00:00
Oliver Jowett e0bc89e542 Merge branch 'write-json-files' into oversampling 2014-11-23 16:34:18 +00:00
Oliver Jowett ebab2c0e11 Create json files with mode 0644 - umask.
mkstemp defaults to 0600 which is not so useful for serving the file.
2014-11-23 16:32:45 +00:00
Oliver Jowett 7bd2ee5510 Merge branch 'write-json-files' into oversampling
Conflicts:
	dump1090.c
	dump1090.h
2014-11-23 16:03:35 +00:00
Oliver Jowett 6910a4bf4d Experimental json changes 2014-11-23 16:02:11 +00:00
Oliver Jowett 29d1e53f9f Merge remote-tracking branch 'upstream/master' into net-cleanups 2014-10-31 17:58:03 +00:00
Malcolm Robb 5f18f6cbca Fix warnings and Windows compile problems 2014-10-29 19:00:42 +00:00
MalcolmRobb 5699e48855 Merge pull request #54 from l0calguest/bind_address
Ability to assign bind address for services
2014-10-29 17:21:12 +00:00
hhm 027ab92e7a Merge branch 'master' of https://www.github.com/MalcolmRobb/dump1090 into http_server_wk 2014-10-29 10:29:04 -04:00