According to the spec, a frame should not be read as "FEND frame FEND". Upon reception of a FEND we should consider everything read up to this point a frame and clear the read buffer. When writing a frame, we should start by writing a FEND, so any noise on the receiving end gets flushed out.
Drop search-and-replace for escaping
It works, but is error prone. One could easily, by mistake, apply the replace functions several times and thus potentially corrupt the data. Consider the string FESC TFESC. Escaping this would yield FESC TFESC TFESC. Restoring this would of course give us FESC TFESC again, but if we apply the restore function one more time it will remove the second TFESC, and the data is corrupted.
Write arbitrary commands to the TNC
Sone TNCs implements nonstandard commands. By introducing a command argument in the write method, defaulting it to 0x00, we can pass any command while retaining backwards compatibility.
Read method is more conformant to the KISS spec
According to the spec, a frame should not be read as "FEND frame FEND". Upon reception of a FEND we should consider everything read up to this point a frame and clear the read buffer. When writing a frame, we should start by writing a FEND, so any noise on the receiving end gets flushed out.
Drop search-and-replace for escaping
It works, but is error prone. One could easily, by mistake, apply the replace functions several times and thus potentially corrupt the data. Consider the string
FESC TFESC
. Escaping this would yieldFESC TFESC TFESC
. Restoring this would of course give usFESC TFESC
again, but if we apply the restore function one more time it will remove the secondTFESC
, and the data is corrupted.Write arbitrary commands to the TNC
Sone TNCs implements nonstandard commands. By introducing a
command
argument in the write method, defaulting it to0x00
, we can pass any command while retaining backwards compatibility.