proper handling of incomplete packets
olv at openmoko.org
Mon Feb 25 15:53:19 CET 2008
I was playing with libgsmd and found that I can not properly handle
incomplete packets. The same error can be observed occasionally when
one issues `prr' (PB Read Range) under libgsmd-tool shell mode, with
enough PB entries on the SIM card.
When one read() from the socket, there is no guarantee that the last
packet (which might be the only one) is complete. In the case that the
last packet is incomplete, we need to move it to the head of the buffer,
and pass it to lgsm_handle_packet again when more data are read() from
the socket. To do this properly, lgsm_handle_packet should return the
number of bytes consumed, which it currently doesn't.
Is there some other way to handle incomplete packets properly? Or, is
it possible to avoid incomplete packets in the first place?
More information about the gsmd-devel