summaryrefslogtreecommitdiff
path: root/doc/explan_packet.c.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/explan_packet.c.xml')
-rw-r--r--doc/explan_packet.c.xml57
1 files changed, 57 insertions, 0 deletions
diff --git a/doc/explan_packet.c.xml b/doc/explan_packet.c.xml
new file mode 100644
index 00000000..d459d714
--- /dev/null
+++ b/doc/explan_packet.c.xml
@@ -0,0 +1,57 @@
+<sect1 id="packet.c"><title><filename>packet.c</filename></title>
+<informaltable frame='all' pgwide='1'>
+<tgroup cols='2'>
+<colspec colname='c1'></colspec>
+<colspec colname='c2'></colspec>
+<spanspec spanname='s1' namest='c1' nameend='c2'></spanspec>
+
+<thead>
+<row>
+ <entry>Functions:-</entry><entry>The packet-sniffing engine for reading data packets from GPS devices.</entry>
+</row>
+</thead>
+
+<tbody>
+<row>
+ <entry><function>static void nextstate(struct gps_packet_t *lexer, unsigned char c)</function></entry>
+ <entry><para>This is the main parser loop. It scans the character against the definitions of all the packet structures known to <application>gpsd</application> and, if possible, sets a new packet state.</para><para>If the state is <quote>xxx_RECOGNIZED</quote>, the packet_parse routine will despatch the packet to the appropriate driver.</para></entry>
+</row>
+<row>
+ <entry><function>static void packet_accept(struct gps_packet_t *lexer, int packet_type)</function></entry>
+ <entry><para>This shifts a packet that has been recognized into the output buffer, provided it is not bigger than the buffer.</para></entry>
+</row>
+<row>
+ <entry><function>static void packet_discard(struct gps_packet_t *lexer)</function></entry>
+ <entry><para>This clears a handled packet out of the the input buffer.</para></entry>
+</row>
+<row>
+ <entry><function>static void character_discard(struct gps_packet_t *lexer)</function></entry>
+ <entry><para>This is called if the <function>nextstate()</function> function returns <quote>GROUND_STATE</quote>.</para><para>In this case the character does not match any pattern, so to discard it, the input buffer is shifted back by one character to overwrite the <quote>bad</quote> character.</para></entry>
+</row>
+<row>
+ <entry><function>ssize_t packet_parse(struct gps_packet_t *lexer, size_t fix)</function></entry>
+ <entry><para>Call the <function>nextstate()</function> function to process the available data and set the recognition state correctly. Return the number of characters handled.</para></entry>
+</row>
+<row>
+ <entry><function>ssize_t packet_get(int fd, struct gps_packet_t *lexer)</function></entry>
+ <entry><para>Reads raw data from the input port. Returns the number of characters read (0 or more) or BAD_PACKET if there was an error in reading. Errors <errortype>EAGAIN</errortype> and <errortype>EINTR</errortype> are not classed as failures and cause a return of 0.</para></entry>
+</row>
+<row>
+ <entry><function>void packet_reset(struct gps_packet_t *lexer)</function></entry>
+ <entry><para>This simply resets the entire packet state machine to the ground state.</para></entry>
+</row>
+<row>
+ <entry><function>void packet_pushback(struct gps_packet_t *lexer)</function></entry>
+ <entry><para>This pushes back the last packet from the output buffer to the input buffer, provided doing so would not overflow the input buffer.</para></entry>
+</row>
+</tbody>
+
+<tfoot>
+<row>
+ <entry spanname='s1' align='left'>Notes based on <function>$Id: packet.c 4299 2007-03-11 19:51:22Z ckuethe $</function></entry>
+</row>
+</tfoot>
+
+</tgroup>
+</informaltable>
+</sect1>