diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-11-30 07:29:25 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-11-30 07:29:25 +0000 |
commit | 2f6775a8769ed7a2250bb90a68c5fa2617123604 (patch) | |
tree | b0a90a20de3049daf781390419172d628bb83fc0 /gpsd.c | |
parent | 1c2b3463912566fa8a5841385a56ed1d966138db (diff) | |
download | gpsd-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.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -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++) |