summaryrefslogtreecommitdiff
path: root/libgps_sock.c
Commit message (Collapse)AuthorAgeFilesLines
* libgps_sock: Stop seg fault on overlong JSON.Gary E. Miller2019-04-291-4/+9
| | | | | Should never happen if GPS_JSON_RESPONSE_MAX is long enough. But things always get longer. Or malicious...
* HAVE_SYS_SELECT_H: Remove test for this. No longer needed.Gary E. Miller2018-12-271-2/+0
| | | | | Many places in the code include sys/select.h with no guard for a long time and no problem reports. So kill it off.
* Factor most uses of pselect(2) into a new utility function named 'nanowait'.Eric S. Raymond2018-12-271-12/+1
| | | | | Also, remove sime header inclusions discovered to be unnecessary during the change.
* libgps_sock: Fix to the fix for pselect() change.Gary E. Miller2018-12-261-2/+2
|
* libgps_sock: Fix pselect() buglet.Gary E. Miller2018-12-261-2/+3
|
* Eliminate effectively all uses of struct timeval.Eric S. Raymond2018-12-261-4/+4
| | | | | Outide of one Mac portability shim, anyway. Associated select(2) calls become pselect(2) calls.
* LICENSE: Update licenses for consistency. No functional changes.Gary E. Miller2018-11-191-1/+1
|
* gps_read(): fix some nasty buffer overruns and corruptions.Gary E. Miller2018-07-141-18/+39
| | | | | | | Now pass an optional message buffer to gps_read(). Finally the JSON display in cgps works. Thanks to Virgin Orbit for their support fixing this bug.
* SPDXify the licerse references.Eric S. Raymond2018-03-081-1/+1
|
* Windows libgps supportRobert Norris2017-02-171-2/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Windows versions for network functions and disable unused features. Add detection of various headers and functions that aren't available in Windows. Note that netlib_localsocket() has no functional implementation on Windows, but it isn't to be used on that platform and it's not part of libgps anyway. Using send() rather than write() seems to work on Windows. For Windows need to ensure networking is initialised on opening of sockets (and then correspondingly shutdown upon closing). Note that within gpsd.h the termios structures and serial related functions are removed from the Windows build. These are only accessed in serial.c by gpsd, so since the Windows build is only generating libgps there is currently no need to modify serial.c. And for os_compat.h, daemon() is simply disabled under Windows as it's not used within libgps. TESTED: Confirmed compiles under a cross compiler. Manual build and run of test_libgps on Windows which successfully connects to a host running GPSD Manual build DLL version and link with a Windows version of a program (Viking) that then successfully connects and monitors positions from GPSD Otherwise no effect on current supported systems. 'scons build-all check' - passes. Signed-off-by: Fred Wright <fw@fwright.net>
* Fix memory leak in Qt build.Robert Norris2017-02-021-3/+2
| | | | | | | Since privdata is always allocated in gps_sock_open(), it always needs to be free'd in gps_sock_close(). Signed-off-by: Fred Wright <fw@fwright.net>
* Prevent client crashes if one calls gps_close() multiple timesRobert Norris2016-08-021-0/+1
| | | | | | | | privdata must be explicitly set to NULL after use, otherwise if gps_close() is (incorrectly) called again before a new gps_open() then a double free condition can occur. Signed-off-by: Gary E. Miller <gem@rellim.com>
* Fix an uninitialized variable found by valgrind.Ferry Huberts2016-07-141-0/+1
| | | | Signed-off-by: Gary E. Miller <gem@rellim.com>
* Remove duplicate <sys/socket.h> include.Rob Norris2016-03-081-1/+0
| | | | | | | TESTED 'scons build-all check' with and without qt passes. Signed-off-by: Jon Schlueter <jon.schlueter@gmail.com>
* Retire splint from our set of static analyzers.Eric S. Raymond2015-03-301-28/+5
| | | | | | | | | | | | | | | | | | | The proximate cause was that we've been seing emission of error messages that were randomly and disturbingly variable across different environments - notably Raspbian and Gentoo splint gave nontrivially different results than Ubuntu 14.10 splint. And this was *not* due to Ubuntu patches! A pristine splint built from the 3.1.2 tarball on Ubuntu didn't match the Raspbian and Gentoo results either. But this has been coming for a while. Easy access to more modern static analyzers such as coverity, scan-build and cppcheck has been decreasing the utility of splint, which is unmaintained and somewhat buggy and not easy to use. Only file not cleaned is ppsthread.c, because Gary has been working on it during this cleanup. All regression tests pass. PPS observed live on GR601-W.
* Document SHM and JSON timeout is in uSec. Fix SHM so that is true.Gary E. Miller2015-03-121-0/+1
| | | | | JSON wait was in uSec, but SHM wait was in Sec. Made both uSec and documented three places.
* Since Windows should have full POSIX now, remove WIN32 port cruft.Eric S. Raymond2015-03-091-4/+0
| | | | It wasn't being used, anyway. There's no Windows port yet.
* Feature removal - delete last remnants of old pre-JSON protocol from libgps.Eric S. Raymond2015-02-221-262/+43
| | | | | All regression tests pass. Clients are working live. PPS observed on Macx-1.
* Easy splint cleanups. All regression tests pass.Eric S. Raymond2015-01-211-6/+6
|
* Add str_rstrip_char, use it everywhere.Zbigniew Chyla2015-01-211-4/+2
| | | | This change doesn't affect generated binary code.
* Add str_{,v}appendf, use it everywhere.Zbigniew Chyla2015-01-211-2/+1
| | | | This change doesn't affect generated binary code.
* Add str_starts_with macro, use it instead of strncmp.Zbigniew Chyla2015-01-211-1/+2
| | | | This change doesn't affect generated binary code.
* Fix a namespace-pollution issue that causes OS X build failures.Eric S. Raymond2015-01-091-0/+4
| | | | All regression tests pass.
* Refactor representation of satellite data into an array of structs...Eric S. Raymond2014-09-221-9/+6
| | | | | | | | | | | | | | | | | | ...from a set of parallel arrays. This change flushed out a longstanding bug in the computation of DOPs for estimated error bars. Some test-load rebuilds were required: geostar-geos1m-binary.log.chk: With this change error estimates are computed and reported. trimble-lassen_iq-3dfix.log, trimble-lassen_iq-3dfix.log: the change revealed a bug in the computation of satellite-seen bits. Error estimates did not change. navcom.log: Error estimates changed. With these rebuilds, all regression tests pass.
* Exit from gps_sock_mainloop() if connection to gpsd is lostDaniel Willmann2014-08-281-2/+6
| | | | | | | | | | | The current mainloop function does not evaluate the return value of gps_read(). If the socket is closed (because gpsd is stopped) the mainloop will consume 99% CPU constantly doing a recv() from the socket which returns zero. gps_read already returns -1 if this condition is encountered. This patch checks the return value of gps_read() and if it is -1 the mainloop is exited. This is also what happens in gps_shm_mainloop().
* Drop the obsolete tag field from JSON output. Bump the minor protocol number.Eric S. Raymond2014-08-241-9/+6
| | | | | | | Required a regression-test rebuild, of course. The field is still set by the TSIP and SiRF drivers; the SiRF driver actually uses it. It may be possible to eliminate the TSIP uses, but so far attempting this has produced odd regression-test failures.
* Include <sys/select.h> everywhere fd_set us used.Eric S. Raymond2014-08-181-0/+1
| | | | | | | | This came up in connection with Android. According to SuS this shouln't be necessary if sys/time.h was included, but oh well. While we;re at it, rearrange some includes for more consistent order. All regression tests pass.
* ppsbar -> pps.Eric S. Raymond2013-11-131-4/+4
| | | | All regression tests pass. PPS is live in both gpsd and gpsmon.
* Teach the client library about ppsbar...Eric S. Raymond2013-11-101-0/+4
| | | | | ...against the extremmely unlikely evebtuality of anything but gpsmon wanting to use it.
* Code is fully cppcheck, splint, and Coverity clean.Eric S. Raymond2013-11-061-0/+1
| | | | All regression tests pass. PPS is live.
* More cppcheck cleanup. All regression tests pass. PPS is live.Eric S. Raymond2013-11-061-1/+1
|
* Full splint cleanup. Partial cppcheck cleanup.Eric S. Raymond2013-11-051-1/+1
|
* Split Type 24 reporting, including the -s option to gpsdecode.Eric S. Raymond2013-09-141-0/+4
| | | | All regression tests pass.
* Nuke trailing whitespace in C source.Eric S. Raymond2012-09-071-2/+2
|
* More cppcheck warning fixups. All regression tests pass.Eric S. Raymond2012-05-181-0/+3
|
* Simplify code for parsing old protocol.Eric S. Raymond2012-05-101-22/+9
| | | | And prevent it from raising spurious Coverity warnings.
* The shm export gets a waiting method.Eric S. Raymond2011-10-031-1/+0
|
* Remove duplicate code.Michael Tatarinov2011-09-301-1/+0
| | | | Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
* splint cleanup.Eric S. Raymond2011-09-301-0/+2
|
* Re-do runtime dispatch in the client library.Eric S. Raymond2011-09-301-4/+0
|
* splint cleanup.Eric S. Raymond2011-09-281-0/+2
|
* Avoid a name collision.Eric S. Raymond2011-09-281-2/+2
|
* First step in runtime export dispatch for the client library.Eric S. Raymond2011-09-281-0/+2
|
* splint cleanup.Eric S. Raymond2011-09-281-2/+2
|
* Break out prototypes for client library export methgods into a new heasder.Eric S. Raymond2011-09-281-0/+1
| | | | All regression tests pass. All three exports work in gpxlogger.
* Get back to a state where the shm export works.Eric S. Raymond2011-09-271-6/+6
|
* More API convergence.Eric S. Raymond2011-09-271-3/+1
|
* Converge the library APIs for different transports more closely.Eric S. Raymond2011-09-271-5/+7
|
* More refactoring.Eric S. Raymond2011-09-271-0/+16
| | | | | gpxlogger currently works with socket and DBUS methods but fails with a segfault in the shm code.
* Uniform use of safe_atof(). All regression tests pass.Eric S. Raymond2011-08-271-1/+5
|