kiss icon indicating copy to clipboard operation
kiss copied to clipboard

New frame detection and escaping

Open jlangvand opened this issue 4 years ago • 0 comments

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 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.

jlangvand avatar Nov 16 '20 23:11 jlangvand