Browse Source

Imported Upstream version 3.10

tags/upstream/3.10^0
Bernd Zeimetz 7 years ago
parent
commit
baf7bec962
100 changed files with 8902 additions and 4853 deletions
  1. +5
    -0
      .splintrc
  2. +1
    -0
      AUTHORS
  3. +8
    -0
      HACKING
  4. +3
    -6
      INSTALL
  5. +20
    -6
      NEWS
  6. +473
    -327
      SConstruct
  7. +48
    -23
      TODO
  8. +2
    -0
      Tachometer.c
  9. +106
    -22
      ais_json.c
  10. +209
    -24
      ais_json.i
  11. +14
    -7
      bits.c
  12. +1
    -0
      bits.h
  13. +3
    -1
      bsd_base64.c
  14. +95
    -27
      build.txt
  15. +11
    -4
      cgps.c
  16. +11
    -0
      contrib/README
  17. +2
    -2
      contrib/binlog.c
  18. +6
    -30
      contrib/binreplay.c
  19. +4
    -3
      contrib/motosend.c
  20. +10
    -0
      contrib/ntpoffset
  21. +98
    -0
      contrib/ppscheck.c
  22. +59
    -28
      contrib/webgps.py
  23. +1
    -1
      control
  24. +2
    -0
      crc24q.c
  25. +6
    -1
      devtools/ais.py
  26. +39
    -12
      devtools/striplog
  27. +156
    -53
      devtools/tablegen.py
  28. +1
    -1
      doc/Makefile
  29. +303
    -170
      driver_ais.c
  30. +41
    -28
      driver_evermore.c
  31. +156
    -111
      driver_garmin.c
  32. +55
    -33
      driver_garmin_txt.c
  33. +124
    -78
      driver_geostar.c
  34. +48
    -41
      driver_italk.c
  35. +67
    -67
      driver_navcom.c
  36. +176
    -58
      driver_nmea0183.c
  37. +630
    -148
      driver_nmea2000.c
  38. +48
    -83
      driver_oncore.c
  39. +33
    -36
      driver_proto.c
  40. +71
    -2
      driver_rtcm2.c
  41. +3
    -2
      driver_rtcm3.c
  42. +351
    -185
      driver_sirf.c
  43. +35
    -33
      driver_superstar2.c
  44. +292
    -159
      driver_tsip.c
  45. +358
    -180
      driver_ubx.c
  46. +42
    -78
      driver_zodiac.c
  47. +303
    -325
      drivers.c
  48. +7
    -8
      gps.1
  49. +196
    -67
      gps.h
  50. +1
    -0
      gps.xml
  51. +22
    -8
      gps/client.py
  52. +153
    -43
      gps/fake.py
  53. +16
    -2
      gps/gps.py
  54. +114
    -0
      gps2udp.1
  55. +501
    -0
      gps2udp.c
  56. +130
    -0
      gps2udp.xml
  57. +2
    -0
      gps_json.h
  58. +2
    -1
      gps_maskdump.c
  59. +131
    -37
      gpscap.ini
  60. +6
    -6
      gpscap.py
  61. +5
    -5
      gpscat
  62. +2
    -3
      gpscat.1
  63. +1
    -0
      gpsclient.c
  64. +11
    -10
      gpsctl.1
  65. +236
    -211
      gpsctl.c
  66. +15
    -12
      gpsctl.xml
  67. +10
    -164
      gpsd.8
  68. +557
    -636
      gpsd.c
  69. +213
    -76
      gpsd.h-tail
  70. +22
    -144
      gpsd.xml
  71. +36
    -11
      gpsd_json.5
  72. +592
    -229
      gpsd_json.c
  73. +33
    -16
      gpsd_json.xml
  74. +9
    -4
      gpsdctl.8
  75. +11
    -3
      gpsdctl.c
  76. +11
    -1
      gpsdctl.xml
  77. +7
    -4
      gpsdecode.1
  78. +47
    -20
      gpsdecode.c
  79. +5
    -0
      gpsdecode.xml
  80. +26
    -9
      gpsfake
  81. +27
    -7
      gpsfake.1
  82. +40
    -3
      gpsfake.xml
  83. +6
    -1
      gpsinit
  84. +2
    -3
      gpsinit.8
  85. +20
    -15
      gpsmon.1
  86. +939
    -608
      gpsmon.c
  87. +38
    -13
      gpsmon.xml
  88. +3
    -3
      gpspacket.c
  89. +8
    -6
      gpspipe.1
  90. +9
    -1
      gpspipe.c
  91. +6
    -0
      gpspipe.xml
  92. +47
    -14
      gpsprof
  93. +11
    -5
      gpsprof.1
  94. +19
    -9
      gpsprof.xml
  95. +3
    -2
      gpsutils.c
  96. +15
    -8
      gpxlogger.c
  97. +22
    -16
      hex.c
  98. +17
    -11
      isgps.c
  99. +8
    -2
      json.c
  100. +2
    -1
      json.h

+ 5
- 0
.splintrc View File

@@ -18,3 +18,8 @@
-DCRTSCTS=0x00020000
-DONLCR=0x00000002
-D__gnuc_va_list=va_list
-D__signed__=signed
-D__pid_t=int
-D__size_t=size_t
-Dpps_handle_t=int


+ 1
- 0
AUTHORS View File

@@ -7,3 +7,4 @@ Jeff Francis <jeff@gritch.org>
Amaury Jacquot <sxpert@esitcom.org>
Chris Kuethe <chris.kuethe@gmail.com>
Ville Nuorvala <vnuorval@tcs.hut.fi>
Fulup Ar Foll <fulup@sinagot.net>

+ 8
- 0
HACKING View File

@@ -2,3 +2,11 @@ For the gpsd project, the information that was traditionally placed in
this file is in the repository as:

www/hacking.html

If you only have www/hacking.html.in, run

scons www

This builds www/hacking.html with some magic cookies usefully substituted.



+ 3
- 6
INSTALL View File

@@ -85,7 +85,7 @@ various additional features have additional prerequisites:
|pgtk-2/cairo bindings | the main test client, xgps, needs this
|==========================================================================

Some ncurses packages comntain the terminfo library; some break it out
Some ncurses packages contain the terminfo library; some break it out
separately as libtinfo5 or libtinfo.

The Python code in GPSD is actually compatible back to Python 2.4 except that
@@ -157,8 +157,5 @@ first time it's invoked, it will generate a file called
'gpsd_config.inc' in that directory containing configuration
information; edit to taste.

4. Note for people using gpsd as time source for ntpd: In case you're
using dhcp3-client to configure your system, make sure you disable
/etc/dhcp3/dhclient-exit-hooks.d/ntp, as dhclient would restart
ntpd with an automatically created ntp.conf otherwise - and gpsd
would not be able to talk with ntpd anymore.
For special instructions related to using GPSD for time service, see the
GPSD Time Service HOWTO in the distribution or on the web.

+ 20
- 6
NEWS View File

@@ -1,3 +1,16 @@
GPSD project news

* Fri 22 Oct 2013 Eric S. Raymond <esr@snark.thyrsus.com> - 3.10
AIS: Adds gps2udp, an AIS data relay, split24 option supports
passing through Type 24 halves; support for Inland AIS; "scaled" no
longer controls dumping of controlled-vocabulary fields; instead,
the're always dumped numerically and as text, with text in an
attribute name generated by appending "_text" to the name of the
base attribute. The packetizer's handling of write boundaries not
coinciding with packet boundaries is improved. Better support for
mode and speed switching in the UBX driver. PPS message now ships
nsec. PPS events are visible in gpsmon. Time-reporting fix to TSIP.

* Wed 1 May 2013 Eric S. Raymond <esr@snark.thyrsus.com> - 3.9
Note to packagers: this is an urgent release that fixes a possible
DoS or security hole! Armor the AIS driver against an implausible
@@ -8,10 +21,11 @@

* Mon 25 Feb 2013 Eric S. Raymond <esr@snark.thyrsus.com> - 3.8
Fix various minor errors in the AIVDM/AIVDO description. Repair the
xmlto support in the build system. Add two more regression tests. Significant
improvements to NMEA2000 support. Upgrade the PHP client to v3 of the
Google Maps API. Support for the Telit SL869 chipset. Added a nautical-style
display to xgpsspeed. Minor improvements to leapsecond.py.
xmlto support in the build system. Add two more regression
tests. Significant improvements to NMEA2000 support. Upgrade the PHP
client to v3 of the Google Maps API. Support for the Telit SL869
chipset. Added a nautical-style display to xgpsspeed. Minor
improvements to leapsecond.py.

* Mon 02 Jul 2012 Eric S. Raymond <esr@snark.thyrsus.com> - 3.7
Snap release to get the midnight change in the default leap-second
@@ -45,7 +59,7 @@
* Sat Oct 29 2011 Eric S. Raymond <esr@snark.thyrsus.com> - 3.3
Improvements to build and release-procedure documentation. Make
sirf=no build work again. Main reason for this release is to make
chrpath a mandatory build depedency and explain why in the build
chrpath a mandatory build dependency and explain why in the build
documentation.

* Wed Oct 25 2011 Eric S. Raymond <esr@snark.thyrsus.com> - 3.2
@@ -286,7 +300,7 @@

* Sun Mar 12 2006 Eric S. Raymond <esr@snark.thyrsus.com> - 2.32-1
Cleanup of the xgps layout, and minor memory-leak fixes for xgps. Fix
to cope with Antares uBlox by Andreas Stricker. Minor fix to libgps
to cope with Antares u-blox by Andreas Stricker. Minor fix to libgps
cgpxlogger. Merge cgpxlogger and gpxlogger documentation onto
the xgps(1) manual page and rename it gps(1).



+ 473
- 327
SConstruct
File diff suppressed because it is too large
View File


+ 48
- 23
TODO View File

@@ -16,6 +16,44 @@ See the GPSD bug tracker on the project website, but don't be
surprised if it's empty or very sparse. Our rate of new defects per
month is quite low.

*** Client bugs

**** In gpsmon's PPS Offset field

resently PPS Offset is displayed in direct mode for NMEA, SiRF, and
UBX devices. Others should probably do likewise, notably the
Motorola Oncore and Garmin drivers.

**** gpsmon driver switching and blocking on error

Hal Murray reports:

If I run .gpsmon /dev/ttyUSB0

It starts up in NMEA0183 mode as I expect.
"i" switches to SiRF, again, as I expect.

"n" switches the display to NMEA layout, but the header still says SiRF.
Another "n" now says: Device type has no mode switcher.
At this point, "i" doesn't do anything. (no pause either)

The second 'n' is losing information that it shouldn't.

If I start over and feed it an "f", it starts blinking "Unknown command "f"
The logging and display update stops. After I type another character, it
clears the blinking error message and stars logging/updating again.

Display update should not stop while this is going on.

*** Speed, mode and rate-changes in client-mode gpsmon.

Are not implemented. In theory they could be.

*** Speed, mode and rate-changes in client-mode gpsctl.

Baud rate and mode changes work in direct mode but are not
reliable in client mode.

*** Dispatcher/network issues

**** Reading AISHub data via UDP confuses xgps with short writes
@@ -26,17 +64,17 @@ packet aggregation issue as it doesn't happen with test logs.

*** Driver issues

**** gpsctl -b should work on UBX, but does not.

Presently this means there's no way to kick a UBX into returning
binary data. Chris Kuethe is supposed to fix this one.

**** RTCM3 analysis is incomplete

We can presently decode RTCM3 messages of type 1004, 1005, 1006, 1008, 1012,
1013, and 1029. This is not the complete set. We need more test data with
different types in them, and a copy of the RTCM3 standard at latest revision
(all we have is revision 3).
We can presently decode RTCM3 messages of type 1001-1014, 1029, and
1033. This is not the complete set. We need more test data with
different types in them, and a copy of the RTCM3 standard at latest
revision (all we have is revision 3).

The support for unpacking RTCM3 sentences in the client library is
limited to 1001, 1002, 1007, 1008, 1009, 1010, 1014, and 1033. There
are some design issues with the baby JSON parser that are going to
make extending this set difficult.

**** Reporting code for specialized Type 6 and 8 AIS messages is incomplete.

@@ -49,19 +87,6 @@ message 6 and 8 subtypes - specifically, 6/23, 8/21, 8/22, 8/24, and

We'd need machinery to shift a byte array 30 bits left...

**** JSON passthrough for AIS

Roy Barkas wants to be able to pass custom JSON up to GPSD in an
armored AIS sentence, so all his clients will get it. See
http://lists.nongnu.org/archive/html/gpsd-dev/2013-01/msg00022.html
for the full proposal.

** Ports

*** Windows port

Partially complete. David Ludlow <dave@adsllc.com> is working on it.

** To do:

*** Make subframe reports available in the C API.
@@ -83,7 +108,7 @@ shouldn't be difficult.

*** Enable flocktest on the Debian server farm

Debian server farm boxes have a screwy chrooted envorinment setup.
Debian server farm boxes have a screwy chrooted environment setup.
flocktest needs to be modified to deal with it.

*** Finish gpssim


+ 2
- 0
Tachometer.c View File

@@ -579,11 +579,13 @@ static void Destroy(Widget w)

/* Exported Procedures */

// cppcheck-suppress unusedFunction
int TachometerGetValue(Widget w)
{
return (((TachometerWidget) w)->tachometer.value);
}

// cppcheck-suppress unusedFunction
int TachometerSetValue(Widget w, int i)
{
int old;


+ 106
- 22
ais_json.c View File

@@ -122,7 +122,7 @@ int json_ais_read(const char *buf,
&ais->type5.minute);
}
} else if (strstr(buf, "\"type\":6,") != NULL) {
bool imo = false;
bool structured = false;
if (strstr(buf, "\"dac\":1,") != NULL) {
if (strstr(buf, "\"fid\":12,") != NULL) {
status = json_read_object(buf, json_ais6_fid12, endptr);
@@ -148,15 +148,15 @@ int json_ais_read(const char *buf,
&ais->type6.dac1fid12.nhour,
&ais->type6.dac1fid12.nminute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":15,") != NULL) {
status = json_read_object(buf, json_ais6_fid15, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":16,") != NULL) {
status = json_read_object(buf, json_ais6_fid16, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":18,") != NULL) {
status = json_read_object(buf, json_ais6_fid18, endptr);
@@ -171,7 +171,7 @@ int json_ais_read(const char *buf,
&ais->type6.dac1fid18.hour,
&ais->type6.dac1fid18.minute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":20,") != NULL) {
status = json_read_object(buf, json_ais6_fid20, endptr);
@@ -187,11 +187,11 @@ int json_ais_read(const char *buf,
&ais->type6.dac1fid20.hour,
&ais->type6.dac1fid20.minute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":25,") != NULL) {
status = json_read_object(buf, json_ais6_fid25, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":28,") != NULL) {
status = json_read_object(buf, json_ais6_fid28, endptr);
@@ -207,24 +207,62 @@ int json_ais_read(const char *buf,
&ais->type6.dac1fid28.hour,
&ais->type6.dac1fid28.minute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":30,") != NULL) {
status = json_read_object(buf, json_ais6_fid30, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":32,") != NULL || strstr(buf, "\"fid\":14,") != NULL) {
status = json_read_object(buf, json_ais6_fid32, endptr);
imo = true;
structured = true;
}
}
else if (strstr(buf, "\"dac\":235,") != NULL || strstr(buf, "\"dac\":250,") != NULL) {
if (strstr(buf, "\"fid\":10,") != NULL) {
status = json_read_object(buf, json_ais6_fid10, endptr);
imo = true;
structured = true;
}
}
if (!imo) {
else if (strstr(buf, "\"dac\":200,") != NULL) {
if (strstr(buf, "\"fid\":21,") != NULL) {
status = json_read_object(buf, json_ais6_fid21, endptr);
structured = true;
if (status == 0) {
ais->type6.dac200fid21.month = AIS_MONTH_NOT_AVAILABLE;
ais->type6.dac200fid21.day = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac200fid21.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac200fid21.minute = AIS_MINUTE_NOT_AVAILABLE;
// cppcheck-suppress uninitvar
(void)sscanf(eta, "%02u-%02uT%02u:%02u",
&ais->type6.dac200fid21.month,
&ais->type6.dac200fid21.day,
&ais->type6.dac200fid21.hour,
&ais->type6.dac200fid21.minute);
}
}
else if (strstr(buf, "\"fid\":22,") != NULL) {
status = json_read_object(buf, json_ais6_fid22, endptr);
structured = true;
if (status == 0) {
ais->type6.dac200fid22.month = AIS_MONTH_NOT_AVAILABLE;
ais->type6.dac200fid22.day = AIS_DAY_NOT_AVAILABLE;
ais->type6.dac200fid22.hour = AIS_HOUR_NOT_AVAILABLE;
ais->type6.dac200fid22.minute = AIS_MINUTE_NOT_AVAILABLE;
// cppcheck-suppress uninitvar
(void)sscanf(rta, "%02u-%02uT%02u:%02u",
&ais->type6.dac200fid22.month,
&ais->type6.dac200fid22.day,
&ais->type6.dac200fid22.hour,
&ais->type6.dac200fid22.minute);
}
}
else if (strstr(buf, "\"fid\":55,") != NULL) {
status = json_read_object(buf, json_ais6_fid55, endptr);
structured = true;
}
}
if (!structured) {
status = json_read_object(buf, json_ais6, endptr);
if (status == 0)
lenhex_unpack(data, &ais->type6.bitcount,
@@ -234,7 +272,7 @@ int json_ais_read(const char *buf,
|| strstr(buf, "\"type\":13,") != NULL) {
status = json_read_object(buf, json_ais7, endptr);
} else if (strstr(buf, "\"type\":8,") != NULL) {
bool imo = false;
bool structured = false;
if (strstr(buf, "\"dac\":1,") != NULL) {
if (strstr(buf, "\"fid\":11,") != NULL) {
status = json_read_object(buf, json_ais8_fid11, endptr);
@@ -248,7 +286,7 @@ int json_ais_read(const char *buf,
&ais->type8.dac1fid11.hour,
&ais->type8.dac1fid11.minute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":13,") != NULL) {
status = json_read_object(buf, json_ais8_fid13, endptr);
@@ -274,19 +312,55 @@ int json_ais_read(const char *buf,
&ais->type8.dac1fid13.thour,
&ais->type8.dac1fid13.tminute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":15,") != NULL) {
status = json_read_object(buf, json_ais8_fid15, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":16,") != NULL) {
status = json_read_object(buf, json_ais8_fid16, endptr);
structured = true;
}
else if (strstr(buf, "\"fid\":17,") != NULL) {
status = json_read_object(buf, json_ais8_fid17, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":19,") != NULL) {
status = json_read_object(buf, json_ais8_fid19, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":23,") != NULL) {
status = json_read_object(buf, json_ais8_fid23, endptr);
ais->type8.dac200fid23.start_year = AIS_YEAR_NOT_AVAILABLE;
ais->type8.dac200fid23.start_month = AIS_MONTH_NOT_AVAILABLE;
ais->type8.dac200fid23.start_day = AIS_DAY_NOT_AVAILABLE;
ais->type8.dac200fid23.start_hour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac200fid23.start_minute = AIS_MINUTE_NOT_AVAILABLE;
ais->type8.dac200fid23.end_year = AIS_YEAR_NOT_AVAILABLE;
ais->type8.dac200fid23.end_month = AIS_MONTH_NOT_AVAILABLE;
ais->type8.dac200fid23.end_day = AIS_DAY_NOT_AVAILABLE;
ais->type8.dac200fid23.end_hour = AIS_HOUR_NOT_AVAILABLE;
ais->type8.dac200fid23.end_minute = AIS_MINUTE_NOT_AVAILABLE;
// cppcheck-suppress uninitvar
(void)sscanf(start, "%09u-%02u-%02uT%02u:%02u",
&ais->type8.dac200fid23.start_year,
&ais->type8.dac200fid23.start_month,
&ais->type8.dac200fid23.start_day,
&ais->type8.dac200fid23.start_hour,
&ais->type8.dac200fid23.start_minute);
// cppcheck-suppress uninitvar
(void)sscanf(end, "%09u-%02u-%02uT%02u:%02u",
&ais->type8.dac200fid23.end_year,
&ais->type8.dac200fid23.end_month,
&ais->type8.dac200fid23.end_day,
&ais->type8.dac200fid23.end_hour,
&ais->type8.dac200fid23.end_minute);
structured = true;
}
else if (strstr(buf, "\"fid\":24,") != NULL) {
status = json_read_object(buf, json_ais8_fid24, endptr);
structured = true;
}
else if (strstr(buf, "\"fid\":27,") != NULL) {
status = json_read_object(buf, json_ais8_fid27, endptr);
@@ -302,11 +376,11 @@ int json_ais_read(const char *buf,
&ais->type8.dac1fid27.hour,
&ais->type8.dac1fid27.minute);
}
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":29,") != NULL) {
status = json_read_object(buf, json_ais8_fid29, endptr);
imo = true;
structured = true;
}
else if (strstr(buf, "\"fid\":31,") != NULL) {
status = json_read_object(buf, json_ais8_fid31, endptr);
@@ -320,10 +394,20 @@ int json_ais_read(const char *buf,
&ais->type8.dac1fid31.hour,
&ais->type8.dac1fid31.minute);
}
imo = true;
structured = true;
}
}
else if (strstr(buf, "\"dac\":200,") != NULL) {
if (strstr(buf, "\"fid\":10,") != NULL) {
status = json_read_object(buf, json_ais8_fid10, endptr);
structured = true;
}
if (strstr(buf, "\"fid\":40,") != NULL) {
status = json_read_object(buf, json_ais8_fid40, endptr);
structured = true;
}
}
if (!imo) {
if (!structured) {
status = json_read_object(buf, json_ais8, endptr);
if (status == 0)
lenhex_unpack(data, &ais->type8.bitcount,


+ 209
- 24
ais_json.i View File

@@ -10,6 +10,7 @@
AIS_HEADER
{"status", t_uinteger, .addr.uinteger = &ais->type1.status,
.dflt.uinteger = 0},
{"status_text", t_ignore},
{"turn", t_integer, .addr.integer = &ais->type1.turn,
.dflt.integer = AIS_TURN_NOT_AVAILABLE},
{"speed", t_uinteger, .addr.uinteger = &ais->type1.speed,
@@ -48,6 +49,7 @@
.dflt.integer = AIS_LAT_NOT_AVAILABLE},
{"epfd", t_uinteger, .addr.uinteger = &ais->type4.epfd,
.dflt.uinteger = 0},
{"epfd_text", t_ignore},
{"raim", t_boolean, .addr.boolean = &ais->type4.raim,
.dflt.boolean = false},
{"radio", t_uinteger, .addr.uinteger = &ais->type4.radio,
@@ -68,6 +70,7 @@
.len = sizeof(ais->type5.shipname)},
{"shiptype", t_uinteger, .addr.uinteger = &ais->type5.shiptype,
.dflt.uinteger = 0},
{"shiptype_text", t_ignore},
{"to_bow", t_uinteger, .addr.uinteger = &ais->type5.to_bow,
.dflt.uinteger = 0},
{"to_stern", t_uinteger, .addr.uinteger = &ais->type5.to_stern,
@@ -78,6 +81,7 @@
.dflt.uinteger = 0},
{"epfd", t_uinteger, .addr.uinteger = &ais->type5.epfd,
.dflt.uinteger = 0},
{"epfd_text", t_ignore},
{"eta", t_string, .addr.string = eta,
.len = sizeof(eta)},
{"draught", t_uinteger, .addr.uinteger = &ais->type5.draught,
@@ -109,8 +113,10 @@
.dflt.uinteger = 0},
{"racon", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.racon,
.dflt.uinteger = 0},
{"racon_text", t_ignore},
{"light", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.light,
.dflt.uinteger = 0},
{"light_text", t_ignore},
{"alarm", t_boolean, .addr.boolean = &ais->type6.dac235fid10.alarm,
.dflt.boolean = false},
{"stat_ext", t_uinteger, .addr.uinteger = &ais->type6.dac235fid10.stat_ext,
@@ -161,26 +167,6 @@
{NULL}
};

const struct json_attr_t json_ais6_fid25_cargos_subtype[] = {
{"code", t_uinteger,STRUCTOBJECT(struct cargo_t, code),
.dflt.uinteger = 0},
{"subtype", t_uinteger,STRUCTOBJECT(struct cargo_t, subtype),
.dflt.uinteger = 0},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais6_fid25[] = {
AIS_HEADER
AIS_TYPE6
{"unit", t_uinteger, .addr.uinteger = &ais->type6.dac1fid25.unit,
.dflt.uinteger = 0},
{"amount", t_uinteger, .addr.uinteger = &ais->type6.dac1fid25.amount,
.dflt.uinteger = 0},
{"cargos", t_array, STRUCTARRAY(ais->type6.dac1fid25.cargos, json_ais6_fid25_cargos_subtype, &ais->type6.dac1fid25.ncargos)},
{NULL}
};
/*@+type@*/

char arrival[JSON_VAL_MAX+1];
const struct json_attr_t json_ais6_fid18[] = {
AIS_HEADER
@@ -212,6 +198,7 @@
.dflt.uinteger = 0},
{"position", t_uinteger, .addr.uinteger = &ais->type6.dac1fid20.position,
.dflt.uinteger = 0},
{"position_text", t_ignore},
{"arrival", t_string, .addr.string = arrival,
.len = sizeof(arrival)},
{"availability", t_uinteger, .addr.uinteger = &ais->type6.dac1fid20.availability,
@@ -277,6 +264,69 @@
{NULL}
};

const struct json_attr_t json_ais6_fid21[] = {
AIS_HEADER
AIS_TYPE6
{"country", t_string, .addr.string = ais->type6.dac200fid21.country,
.len = sizeof(ais->type6.dac200fid21.country)},
{"locode", t_string, .addr.string = ais->type6.dac200fid21.locode,
.len = sizeof(ais->type6.dac200fid21.locode)},
{"section", t_string, .addr.string = ais->type6.dac200fid21.section,
.len = sizeof(ais->type6.dac200fid21.section)},
{"terminal", t_string, .addr.string = ais->type6.dac200fid21.terminal,
.len = sizeof(ais->type6.dac200fid21.terminal)},
{"hectometre", t_string, .addr.string = ais->type6.dac200fid21.hectometre,
.len = sizeof(ais->type6.dac200fid21.hectometre)},
{"eta", t_string, .addr.string = eta,
.len = sizeof(eta)},
{"tugs", t_uinteger, .addr.uinteger = &ais->type6.dac200fid21.tugs,
.dflt.uinteger = 0},
{"airdraught", t_uinteger, .addr.uinteger = &ais->type6.dac200fid21.airdraught,
.dflt.uinteger = 0},
{NULL}
};

char rta[JSON_VAL_MAX+1];
const struct json_attr_t json_ais6_fid22[] = {
AIS_HEADER
AIS_TYPE6
{"country", t_string, .addr.string = ais->type6.dac200fid22.country,
.len = sizeof(ais->type6.dac200fid22.country)},
{"locode", t_string, .addr.string = ais->type6.dac200fid22.locode,
.len = sizeof(ais->type6.dac200fid22.locode)},
{"section", t_string, .addr.string = ais->type6.dac200fid22.section,
.len = sizeof(ais->type6.dac200fid22.section)},
{"terminal", t_string, .addr.string = ais->type6.dac200fid22.terminal,
.len = sizeof(ais->type6.dac200fid22.terminal)},
{"hectometre", t_string, .addr.string = ais->type6.dac200fid22.hectometre,
.len = sizeof(ais->type6.dac200fid22.hectometre)},
{"rta", t_string, .addr.string = rta,
.len = sizeof(rta)},
{"status", t_uinteger, .addr.uinteger = &ais->type6.dac200fid22.status,
.dflt.uinteger = DAC200FID22_STATUS_NOT_AVAILABLE},
{NULL}
};

const struct json_attr_t json_ais6_fid25_cargos_subtype[] = {
{"code", t_uinteger,STRUCTOBJECT(struct cargo_t, code),
.dflt.uinteger = 0},
{"subtype", t_uinteger,STRUCTOBJECT(struct cargo_t, subtype),
.dflt.uinteger = 0},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais6_fid25[] = {
AIS_HEADER
AIS_TYPE6
{"unit", t_uinteger, .addr.uinteger = &ais->type6.dac1fid25.unit,
.dflt.uinteger = 0},
{"amount", t_uinteger, .addr.uinteger = &ais->type6.dac1fid25.amount,
.dflt.uinteger = 0},
{"cargos", t_array, STRUCTARRAY(ais->type6.dac1fid25.cargos, json_ais6_fid25_cargos_subtype, &ais->type6.dac1fid25.ncargos)},
{NULL}
};
/*@+type@*/

char start[JSON_VAL_MAX+1];
const struct json_attr_t json_ais6_fid28_waypoints_subtype[] = {
{"lon", t_integer, STRUCTOBJECT(struct waypoint_t, lon),
@@ -295,6 +345,7 @@
.dflt.uinteger = 0},
{"rtype", t_uinteger, .addr.uinteger = &ais->type6.dac1fid28.rtype,
.dflt.uinteger = 0},
{"rtype_text", t_ignore},
{"start", t_string, .addr.string = start,
.len = sizeof(start)},
{"duration", t_uinteger, .addr.uinteger = &ais->type6.dac1fid28.duration,
@@ -346,6 +397,18 @@
};
/*@+type@*/

const struct json_attr_t json_ais6_fid55[] = {
AIS_HEADER
AIS_TYPE6
{"crew", t_uinteger, .addr.uinteger = &ais->type6.dac200fid55.crew,
.dflt.uinteger = DAC200FID55_COUNT_NOT_AVAILABLE},
{"passengers", t_uinteger, .addr.uinteger = &ais->type6.dac200fid55.passengers,
.dflt.uinteger = DAC200FID55_COUNT_NOT_AVAILABLE},
{"personnel", t_uinteger, .addr.uinteger = &ais->type6.dac200fid55.personnel,
.dflt.uinteger = DAC200FID55_COUNT_NOT_AVAILABLE},
{NULL}
};

const struct json_attr_t json_ais7[] = {
AIS_HEADER
{"mmsi1", t_uinteger, .addr.uinteger = &ais->type7.mmsi1,
@@ -367,6 +430,35 @@
{NULL}
};

const struct json_attr_t json_ais8_fid10[] = {
AIS_HEADER
AIS_TYPE8
{"vin", t_string, .addr.string = ais->type8.dac200fid10.vin,
.len = sizeof(ais->type8.dac200fid10.vin)},
{"length", t_uinteger, .addr.uinteger = &ais->type8.dac200fid10.length,
.dflt.uinteger = 0},
{"beam", t_uinteger, .addr.uinteger = &ais->type8.dac200fid10.beam,
.dflt.uinteger = 0},
{"type", t_uinteger, .addr.uinteger = &ais->type8.dac200fid10.type,
.dflt.uinteger = 0},
{"type_text", t_ignore},
{"hazard", t_uinteger, .addr.uinteger = &ais->type8.dac200fid10.hazard,
.dflt.uinteger = 0},
{"hazard_text", t_ignore},
{"draught", t_uinteger, .addr.uinteger = &ais->type8.dac200fid10.draught,
.dflt.uinteger = 0},
{"loaded", t_uinteger, .addr.uinteger = &ais->type8.dac200fid10.loaded,
.dflt.uinteger = 0},
{"loaded_text", t_ignore},
{"speed_q", t_boolean, .addr.boolean = &ais->type8.dac200fid10.speed_q,
.dflt.boolean = false},
{"course_q", t_boolean, .addr.boolean = &ais->type8.dac200fid10.course_q,
.dflt.boolean = false},
{"heading_q", t_boolean, .addr.boolean = &ais->type8.dac200fid10.heading_q,
.dflt.boolean = false},
{NULL}
};

const struct json_attr_t json_ais8_fid11[] = {
AIS_HEADER
AIS_TYPE8
@@ -434,22 +526,26 @@
.dflt.uinteger = DAC1FID11_WATERTEMP_NOT_AVAILABLE},
{"preciptype", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.preciptype,
.dflt.uinteger = DAC1FID11_PRECIPTYPE_NOT_AVAILABLE},
{"preciptype_text", t_ignore},
{"salinity", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.salinity,
.dflt.uinteger = DAC1FID11_SALINITY_NOT_AVAILABLE},
{"ice", t_uinteger, .addr.uinteger = &ais->type8.dac1fid11.ice,
.dflt.uinteger = DAC1FID11_ICE_NOT_AVAILABLE},
{"ice_text", t_ignore},
{NULL}
};

char closefrom[JSON_VAL_MAX+1];
char closeto[JSON_VAL_MAX+1];
const struct json_attr_t json_ais8_fid13[] = {
AIS_HEADER
AIS_TYPE8
{"reason", t_string, .addr.string = ais->type8.dac1fid13.reason,
.len = sizeof(ais->type8.dac1fid13.reason)},
{"closefrom", t_string, .addr.string = ais->type8.dac1fid13.closefrom,
.len = sizeof(ais->type8.dac1fid13.closefrom)},
{"closeto", t_string, .addr.string = ais->type8.dac1fid13.closeto,
.len = sizeof(ais->type8.dac1fid13.closeto)},
{"closefrom", t_string, .addr.string = closefrom,
.len = sizeof(closefrom)},
{"closeto", t_string, .addr.string = closeto,
.len = sizeof(closeto)},
{"radius", t_uinteger, .addr.uinteger = &ais->type8.dac1fid13.radius,
.dflt.uinteger = AIS_DAC1FID13_RADIUS_NOT_AVAILABLE},
{"extunit", t_uinteger, .addr.uinteger = &ais->type8.dac1fid13.extunit,
@@ -481,6 +577,14 @@
{NULL}
};

const struct json_attr_t json_ais8_fid16[] = {
AIS_HEADER
AIS_TYPE8
{"persons", t_uinteger, .addr.uinteger = &ais->type8.dac1fid16.persons,
.dflt.uinteger = 0},
{NULL}
};

const struct json_attr_t json_ais8_fid17_targets_subtype[] = {
{"idtype", t_uinteger,STRUCTOBJECT(struct target_t, idtype),
.dflt.uinteger = DAC1FID17_IDTYPE_OTHER},
@@ -528,15 +632,67 @@
.dflt.uinteger = 0},
{"signal", t_uinteger, .addr.uinteger = &ais->type8.dac1fid19.signal,
.dflt.uinteger = 0},
{"signal_text", t_ignore},
{"hour", t_uinteger, .addr.uinteger = &ais->type8.dac1fid19.hour,
.dflt.uinteger = AIS_HOUR_NOT_AVAILABLE},
{"minute", t_uinteger, .addr.uinteger = &ais->type8.dac1fid19.minute,
.dflt.uinteger = AIS_MINUTE_NOT_AVAILABLE},
{"nextsignal", t_uinteger, .addr.uinteger = &ais->type8.dac1fid19.nextsignal,
.dflt.uinteger = 0},
{"nextsignal_type", t_ignore},
{NULL}
};

char end[JSON_VAL_MAX+1];
const struct json_attr_t json_ais8_fid23[] = {
AIS_HEADER
AIS_TYPE8
{"start", t_string, .addr.string = start,
.len = sizeof(start)},
{"end", t_string, .addr.string = end,
.len = sizeof(end)},
{"start_lon", t_integer, .addr.integer = &ais->type8.dac200fid23.start_lon,
.dflt.integer = AIS_LON4_NOT_AVAILABLE},
{"start_lat", t_integer, .addr.integer = &ais->type8.dac200fid23.start_lat,
.dflt.integer = AIS_LAT4_NOT_AVAILABLE},
{"end_lon", t_integer, .addr.integer = &ais->type8.dac200fid23.end_lon,
.dflt.integer = AIS_LON4_NOT_AVAILABLE},
{"end_lat", t_integer, .addr.integer = &ais->type8.dac200fid23.end_lat,
.dflt.integer = AIS_LAT4_NOT_AVAILABLE},
{"type", t_uinteger, .addr.uinteger = &ais->type8.dac200fid23.type,
.dflt.uinteger = DAC200FID23_TYPE_UNKNOWN},
{"type_text", t_ignore},
{"min", t_integer, .addr.integer = &ais->type8.dac200fid23.min,
.dflt.integer = DAC200FID23_MIN_UNKNOWN},
{"max", t_integer, .addr.integer = &ais->type8.dac200fid23.max,
.dflt.integer = DAC200FID23_MAX_UNKNOWN},
{"intensity", t_uinteger, .addr.uinteger = &ais->type8.dac200fid23.intensity,
.dflt.uinteger = DAC200FID23_CLASS_UNKNOWN},
{"intensity_text", t_ignore},
{"wind", t_uinteger, .addr.uinteger = &ais->type8.dac200fid23.wind,
.dflt.uinteger = DAC200FID23_WIND_UNKNOWN},
{"wind_text", t_ignore},
{NULL}
};

const struct json_attr_t json_ais8_fid24_gauges_subtype[] = {
{"id", t_uinteger,STRUCTOBJECT(struct gauge_t, id),
.dflt.uinteger = DAC200FID24_GAUGE_ID_UNKNOWN},
{"level", t_integer, STRUCTOBJECT(struct gauge_t, level),
.dflt.integer = DAC200FID24_GAUGE_LEVEL_UNKNOWN},
{NULL}
};
/*@-type@*//* STRUCTARRAY confuses splint */
const struct json_attr_t json_ais8_fid24[] = {
AIS_HEADER
AIS_TYPE8
{"country", t_string, .addr.string = ais->type8.dac200fid24.country,
.len = sizeof(ais->type8.dac200fid24.country)},
{"gauges", t_array, STRUCTARRAY(ais->type8.dac200fid24.gauges, json_ais8_fid24_gauges_subtype, &ais->type8.dac200fid24.ngauges)},
{NULL}
};
/*@+type@*/

const struct json_attr_t json_ais8_fid27_waypoints_subtype[] = {
{"lon", t_integer, STRUCTOBJECT(struct waypoint_t, lon),
.dflt.integer = AIS_LON4_NOT_AVAILABLE},
@@ -554,6 +710,7 @@
.dflt.uinteger = 0},
{"rtype", t_uinteger, .addr.uinteger = &ais->type8.dac1fid27.rtype,
.dflt.uinteger = 0},
{"rtype_text", t_ignore},
{"start", t_string, .addr.string = start,
.len = sizeof(start)},
{"duration", t_uinteger, .addr.uinteger = &ais->type8.dac1fid27.duration,
@@ -644,6 +801,7 @@
.dflt.integer = DAC1FID31_WATERTEMP_NOT_AVAILABLE},
{"preciptype", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.preciptype,
.dflt.uinteger = DAC1FID31_PRECIPTYPE_NOT_AVAILABLE},
{"preciptype_text", t_ignore},
{"salinity", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.salinity,
.dflt.uinteger = DAC1FID31_SALINITY_NOT_AVAILABLE},
{"ice", t_uinteger, .addr.uinteger = &ais->type8.dac1fid31.ice,
@@ -651,6 +809,22 @@
{NULL}
};

const struct json_attr_t json_ais8_fid40[] = {
AIS_HEADER
AIS_TYPE8
{"form", t_uinteger, .addr.uinteger = &ais->type8.dac200fid40.form,
.dflt.uinteger = DAC200FID40_FORM_UNKNOWN},
{"facing", t_uinteger, .addr.uinteger = &ais->type8.dac200fid40.facing,
.dflt.uinteger = DAC200FID40_FACING_UNKNOWN},
{"direction", t_uinteger, .addr.uinteger = &ais->type8.dac200fid40.direction,
.dflt.uinteger = DAC200FID40_DIRECTION_UNKNOWN},
{"direction_text", t_ignore},
{"status", t_uinteger, .addr.uinteger = &ais->type8.dac200fid40.status,
.dflt.uinteger = DAC200FID40_STATUS_UNKNOWN},
{"status_text", t_ignore},
{NULL}
};

const struct json_attr_t json_ais9[] = {
AIS_HEADER
{"alt", t_uinteger, .addr.uinteger = &ais->type9.alt,
@@ -815,6 +989,7 @@
.len = sizeof(ais->type19.shipname)},
{"shiptype", t_uinteger, .addr.uinteger = &ais->type19.shiptype,
.dflt.uinteger = 0},
{"shiptype_text", t_ignore},
{"to_bow", t_uinteger, .addr.uinteger = &ais->type19.to_bow,
.dflt.uinteger = 0},
{"to_stern", t_uinteger, .addr.uinteger = &ais->type19.to_stern,
@@ -825,6 +1000,7 @@
.dflt.uinteger = 0},
{"epfd", t_uinteger, .addr.uinteger = &ais->type19.epfd,
.dflt.uinteger = 0},
{"epfd_text", t_ignore},
{"raim", t_boolean, .addr.boolean = &ais->type19.raim,
.dflt.boolean = false},
{"dte", t_uinteger, .addr.uinteger = &ais->type19.dte,
@@ -875,6 +1051,7 @@
AIS_HEADER
{"aid_type", t_uinteger, .addr.uinteger = &ais->type21.aid_type,
.dflt.uinteger = 0},
{"aid_type_text", t_ignore},
{"name", t_string, .addr.string = ais->type21.name,
.len = sizeof(ais->type21.name)},
{"accuracy", t_boolean, .addr.boolean = &ais->type21.accuracy,
@@ -893,6 +1070,7 @@
.dflt.uinteger = 0},
{"epfd", t_uinteger, .addr.uinteger = &ais->type21.epfd,
.dflt.uinteger = 0},
{"epfd_text", t_ignore},
{"second", t_uinteger, .addr.uinteger = &ais->type21.second,
.dflt.uinteger = 0},
{"regional", t_uinteger, .addr.uinteger = &ais->type21.regional,
@@ -951,8 +1129,10 @@
.dflt.integer = AIS_GNS_LAT_NOT_AVAILABLE},
{"stationtype", t_uinteger, .addr.uinteger = &ais->type23.stationtype,
.dflt.uinteger = 0},
{"stationtype_text", t_ignore},
{"shiptype", t_uinteger, .addr.uinteger = &ais->type23.shiptype,
.dflt.uinteger = 0},
{"shiptype_text", t_ignore},
{"txrx", t_uinteger, .addr.uinteger = &ais->type23.txrx,
.dflt.uinteger = 0},
{"interval", t_uinteger, .addr.uinteger = &ais->type23.interval,
@@ -968,8 +1148,13 @@
.len = sizeof(ais->type24.shipname)},
{"shiptype", t_uinteger, .addr.uinteger = &ais->type24.shiptype,
.dflt.uinteger = 0},
{"shiptype_text", t_ignore},
{"vendorid", t_string, .addr.string = ais->type24.vendorid,
.len = sizeof(ais->type24.vendorid)},
{"model", t_uinteger, .addr.uinteger = &ais->type24.model,
.dflt.uinteger = 0},
{"serial", t_uinteger, .addr.uinteger = &ais->type24.serial,
.dflt.uinteger = 0},
{"callsign", t_string, .addr.string = ais->type24.callsign,
.len = sizeof(ais->type24.callsign)},
{"mothership_mmsi",t_uinteger, .addr.uinteger = &ais->type24.mothership_mmsi,


+ 14
- 7
bits.c View File

@@ -115,19 +115,28 @@ double getbed64(const char *buf, int off)
return l_d.d;
}

/*@-shiftimplementation@*/
void putbef32(char *buf, int off, float val)
{
union int_float i_f;

i_f.f = val;
/* this would be a putbe32 call if not for a signedness issue */
buf[off] = (char)(((i_f.i) >> 16) >> 8);
/*@-shiftimplementation +ignoresigns@*/
putbe32(buf, off, i_f.i);
/*@+shiftimplementation -ignoresigns@*/
}
/*@+shiftimplementation@*/

#ifdef __UNUSED__
// cppcheck-suppress unusedFunction
void putbed64(char *buf, int off, double val)
{
union long_double l_d;

l_d.d = val;
/*@-shiftimplementation +ignoresigns@*/
putbe32(buf, (off), (l_d.l) >> 32);
putbe32(buf, (off)+4, (l_d.l));
/*@+shiftimplementation -ignoresigns@*/
}

u_int16_t swap_u16(u_int16_t i)
/* byte-swap a 16-bit unsigned int */
{
@@ -139,7 +148,6 @@ u_int16_t swap_u16(u_int16_t i)
return (c1 << 8) + c2;
}

// cppcheck-suppress unusedFunction
u_int32_t swap_u32(u_int32_t i)
/* byte-swap a 32-bit unsigned int */
{
@@ -153,7 +161,6 @@ u_int32_t swap_u32(u_int32_t i)
return ((u_int32_t)c1 << 24) + ((u_int32_t)c2 << 16) + ((u_int32_t)c3 << 8) + c4;
}

// cppcheck-suppress unusedFunction
u_int64_t swap_u64(u_int64_t i)
/* byte-swap a 64-bit unsigned int */
{


+ 1
- 0
bits.h View File

@@ -48,6 +48,7 @@ extern double getbed64(const char *, int);
#define putbe32(buf,off,l) do {putbe16(buf, (off), (l) >> 16); putbe16(buf, (off)+2, (l));} while (0)

extern void putbef32(char *, int, float);
extern void putbed64(char *, int, double);

/* bitfield extraction */
extern uint64_t ubits(unsigned char buf[], unsigned int, unsigned int, bool);


+ 3
- 1
bsd_base64.c View File

@@ -130,7 +130,6 @@ b64_ntop(unsigned char const *src, size_t srclength, char *target,
size_t datalength = 0;
unsigned char input[3];
unsigned char output[4];
size_t i;

while (2 < srclength) {
input[0] = *src++;