SLIP protocol implementation
-
Somebody please tell me how to implement SLIP? I have no much idea about it. I dont know how i must start with it. It would be of great help if someone can help me as to how to start..
Take a look at the RFC (http://www.cse.ohio-state.edu/cgi-bin/rfc/rfc1055.html) PROTOCOL The SLIP protocol defines two special characters: END and ESC. END is octal 300 (decimal 192) and ESC is octal 333 (decimal 219) not to be confused with the ASCII ESCape character; for the purposes of this discussion, ESC will indicate the SLIP ESC character. To send a packet, a SLIP host simply starts sending the data in the packet. If a data byte is the same code as END character, a two byte sequence of ESC and octal 334 (decimal 220) is sent instead. If it the same as an ESC character, an two byte sequence of ESC and octal 335 (decimal 221) is sent instead. When the last byte in the packet has been sent, an END character is then transmitted. Are you implementing this on Windows ? I would recommend creating layers ( translated as C++ Classes ) Transport Layer Slip Layer You will have to have two threads that do the job of sending and receiving data . In other words the job of the SLIP layer is to send packets by adding SLIP characters and the reverse ( receive packets and then sense the SLIP characters , then strip out these characters and notify the top layer that data has come ) I would suggest implementing callbacks so that the layers above can be notified upon data reception / successful sending of data / error conditions Additionally you can add CRC checking in the transport layer The transport layer can contain additionals such as retries , retry counts etc As for the low level IO , use the standard serial port API's such as PurgeCOmm and readfile and writefile
Engineering is the effort !