Modify patty_kiss_tnc_new_fd() to avoid tcgetattr()/tcsetattr() when
passed a file descriptor for a PTY master, to address incompatibility
with BSD kernelspace Unix98 PTY implementations
Fix patty_kiss_tnc_new_fd() to only attempt tcgetattr()/tcsetattr() on
file descriptors for whom isatty() is true, allowing files and sockets
to once again be used
Changes:
* Use cfmakeraw() to set raw TTY attributes in KISS TNC constructor
patty_kiss_tnc_new_fd()
* Restore previous TTY attributes in patty_kiss_tnc_destroy()
Implement better handling of situations when read() captures multiple
TNC frames; ensure each frame is handled in src/server.c, function
handle_iface(), to ensure packets aren't ignored before the next
select() call
Use KISS framing for raw sockets to avoid multiple write() calls from
being buffered, which caused read() on the other end of a file
descriptor to read more than frame at once
Fix patty_kiss_tnc_recv() issues with small buffers (~330 bytes) by
more properly detecting EOF being the condition at which the current
decoder offset in the buffer is equal to the last buffer read size; the
offset can never be the number of bytes read, and the initial read
length is -1, so early EOF conditions are avoided
Refactor patty_kiss_tnc_recv() to always read a fixed number of bytes
into a circular buffer
Other changes:
* Avoid needing memmove() per packet processed
* Allow processing packets larger than the internal read buffer
Changes:
* Modify patty_kiss_tnc_recv() to accept a pointer to a read buffer,
and a maximum length argument, to receive one packet
* Modify src/decode.c to use the new patty_kiss_tnc_recv() calling
form
Refactor patty_kiss_tnc_recv() to be much more compact and correct;
ensure the KISS command byte is absolutely required, and that
consecutive frame end markers are handled without error