[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-dev] [PATCH 3/8] Shift netlib function definitions into its own he
From: |
Rob Norris |
Subject: |
[gpsd-dev] [PATCH 3/8] Shift netlib function definitions into its own header file. |
Date: |
Tue, 19 Apr 2016 21:01:40 +0100 |
The reduces the reliance on gpsd.h from libgps code (especially libgps_sock.c)
TESTED:
'scons build-all check' passes.
---
gpsd.c | 1 +
gpsd.h-tail | 4 ----
gpsdctl.c | 1 +
libgps_core.c | 2 +-
libgps_sock.c | 3 ++-
libgpsd_core.c | 1 +
net_dgpsip.c | 1 +
net_ntrip.c | 1 +
netlib.c | 1 +
netlib.h | 22 ++++++++++++++++++++++
timehint.c | 1 +
11 files changed, 32 insertions(+), 6 deletions(-)
create mode 100644 netlib.h
diff --git a/gpsd.c b/gpsd.c
index 121d5de..3922b3d 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -42,6 +42,7 @@
#include "gpsd.h"
#include "hex.h"
+#include "netlib.h"
#include "sockaddr.h"
#include "gps_json.h"
#include "revision.h"
diff --git a/gpsd.h-tail b/gpsd.h-tail
index f5b87b2..7c52740 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -821,10 +821,6 @@ extern const char *gpsd_prettydump(struct gps_device_t *);
extern void gpsd_position_fix_dump(struct gps_device_t *,
char[], size_t);
extern void gpsd_clear_data(struct gps_device_t *);
-extern socket_t netlib_connectsock(int, const char *, const char *, const char
*);
-extern socket_t netlib_localsocket(const char *, int);
-extern const char *netlib_errstr(const int);
-extern char *netlib_sock2ip(socket_t);
extern void nmea_tpv_dump(struct gps_device_t *, char[], size_t);
extern void nmea_sky_dump(struct gps_device_t *, char[], size_t);
diff --git a/gpsdctl.c b/gpsdctl.c
index cd79418..d3cb815 100644
--- a/gpsdctl.c
+++ b/gpsdctl.c
@@ -16,6 +16,7 @@
#include <sys/socket.h>
#include "gpsd.h"
+#include "netlib.h"
#define DEFAULT_GPSD_TEST_SOCKET "/tmp/gpsd.sock"
diff --git a/libgps_core.c b/libgps_core.c
index 582e210..44e30d6 100644
--- a/libgps_core.c
+++ b/libgps_core.c
@@ -14,7 +14,7 @@
#include <errno.h>
#include <stdarg.h>
-#include "gpsd.h"
+#include "netlib.h"
#include "libgps.h"
#include "gps_json.h"
#include "strfuncs.h"
diff --git a/libgps_sock.c b/libgps_sock.c
index d056515..9eda2cc 100644
--- a/libgps_sock.c
+++ b/libgps_sock.c
@@ -13,6 +13,7 @@
#include <math.h>
#include <locale.h>
#include <assert.h>
+#include "gpsd_config.h"
#include <sys/time.h> /* expected to have a select(2) prototype a la SuS */
#include <sys/types.h>
#include <sys/stat.h>
@@ -25,8 +26,8 @@
#include <QTcpSocket>
#endif /* USE_QT */
+#include "netlib.h"
#include "gps.h"
-#include "gpsd.h"
#include "libgps.h"
#include "strfuncs.h"
#ifdef SOCKET_EXPORT_ENABLE
diff --git a/libgpsd_core.c b/libgpsd_core.c
index d4edde8..ad10d5a 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -31,6 +31,7 @@
#include "gpsd.h"
#include "hex.h"
+#include "netlib.h"
#include "matrix.h"
#include "strfuncs.h"
#if defined(NMEA2000_ENABLE)
diff --git a/net_dgpsip.c b/net_dgpsip.c
index 900e911..e91729e 100644
--- a/net_dgpsip.c
+++ b/net_dgpsip.c
@@ -14,6 +14,7 @@
#include <unistd.h>
#include "gpsd.h"
+#include "netlib.h"
int dgpsip_open(struct gps_device_t *device, const char *dgpsserver)
/* open a connection to a DGPSIP server */
diff --git a/net_ntrip.c b/net_ntrip.c
index fe651e5..a0147e1 100644
--- a/net_ntrip.c
+++ b/net_ntrip.c
@@ -19,6 +19,7 @@
#include "gpsd.h"
#include "strfuncs.h"
+#include "netlib.h"
#define NTRIP_SOURCETABLE "SOURCETABLE 200 OK\r\n"
#define NTRIP_ENDSOURCETABLE "ENDSOURCETABLE"
diff --git a/netlib.c b/netlib.c
index a0403cd..4505c37 100644
--- a/netlib.c
+++ b/netlib.c
@@ -19,6 +19,7 @@
#include <netinet/ip.h>
#include "gpsd.h"
+#include "netlib.h"
#include "sockaddr.h"
/* work around the unfinished ipv6 implementation on hurd and OSX <10.6 */
diff --git a/netlib.h b/netlib.h
new file mode 100644
index 0000000..dcc892e
--- /dev/null
+++ b/netlib.h
@@ -0,0 +1,22 @@
+/*
+ * This file is Copyright (h) 2016 by the GPSD project
+ * BSD terms apply: see the file COPYING in the distribution root for details.
+ */
+#ifndef _GPSD_NETLIB_H_
+#define _GPSD_NETLIB_H_
+
+#include "gps.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern socket_t netlib_connectsock(int, const char *, const char *, const char
*);
+extern socket_t netlib_localsocket(const char *, int);
+extern char *netlib_sock2ip(socket_t);
+extern const char *netlib_errstr(const int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _GPSD_NETLIB_H_ */
diff --git a/timehint.c b/timehint.c
index 3462223..60cd36c 100644
--- a/timehint.c
+++ b/timehint.c
@@ -21,6 +21,7 @@
#include "timespec.h"
#include "gpsd.h"
+#include "netlib.h"
#ifdef NTPSHM_ENABLE
#include "ntpshm.h"
--
2.8.0.rc3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gpsd-dev] [PATCH 3/8] Shift netlib function definitions into its own header file.,
Rob Norris <=