summaryrefslogtreecommitdiff
path: root/gpsd.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-11-30 07:29:25 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-11-30 07:29:25 +0000
commit2f6775a8769ed7a2250bb90a68c5fa2617123604 (patch)
treeb0a90a20de3049daf781390419172d628bb83fc0 /gpsd.c
parent1c2b3463912566fa8a5841385a56ed1d966138db (diff)
downloadgpsd-2f6775a8769ed7a2250bb90a68c5fa2617123604.tar.gz
Split the packet-sniffer internals out of the session structure.
This is a big, super-intrusive patch but changes no logic at all -- it's all about ripping out some of the gps_device_t structure members into a new gps_packet_t structure. Even the driver API doesn't change at all, this is all libgpsd(3) internals being rearranged. The motivation here is that we want to kill off the ad-hoc Python implementation of a packet-sniffer in gpsfake. To do that we need to be able to write a "pure" packet sniffer that uses the same C code as the daemon's but without being welded to the rest of the libgpsd(3) code. This is the first step towards that.
Diffstat (limited to 'gpsd.c')
-rw-r--r--gpsd.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/gpsd.c b/gpsd.c
index 4c373a4b..cad5d5f9 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -518,14 +518,14 @@ static bool allocation_policy(struct gps_device_t *channel,
/* maybe we have already bound a more recently active device */
if (user->device!=NULL && channel->gpsdata.sentence_time < most_recent)
return false;
- gpsd_report(LOG_PROG, "User requires %d, channel type is %d\n", user->requires, channel->packet_type);
+ gpsd_report(LOG_PROG, "User requires %d, channel type is %d\n", user->requires, channel->packet.type);
/* we might have type constraints */
if (user->requires == ANY)
return true;
- else if (user->requires==RTCM104 && (channel->packet_type==RTCM_PACKET))
+ else if (user->requires==RTCM104 && (channel->packet.type==RTCM_PACKET))
return true;
else if (user->requires == GPS
- && (channel->packet_type!=RTCM_PACKET) && (channel->packet_type!=BAD_PACKET))
+ && (channel->packet.type!=RTCM_PACKET) && (channel->packet.type!=BAD_PACKET))
return true;
else
return false;
@@ -775,9 +775,9 @@ static int handle_gpsd_request(struct subscriber_t* sub, char *buf, int buflen)
p += strcspn(p, ",\r\n");
}
(void)assign_channel(sub);
- if (sub->device==NULL||sub->device->packet_type==BAD_PACKET)
+ if (sub->device==NULL||sub->device->packet.type==BAD_PACKET)
(void)strlcpy(phrase, ",G=?", BUFSIZ);
- else if (sub->device->packet_type == RTCM_PACKET)
+ else if (sub->device->packet.type == RTCM_PACKET)
(void)snprintf(phrase, sizeof(phrase), ",G=RTCM104");
else
(void)snprintf(phrase, sizeof(phrase), ",G=GPS");
@@ -1743,7 +1743,7 @@ int main(int argc, char *argv[])
if (!nowait)
for (channel=channels; channel < channels+MAXDEVICES; channel++) {
if (allocated_channel(channel)) {
- if (channel->packet_type != BAD_PACKET) {
+ if (channel->packet.type != BAD_PACKET) {
bool need_gps = false;
for (cfd = 0; cfd < MAXSUBSCRIBERS; cfd++)