implement basic protocol handling
separate protocol code from module main
get rid of duplicate defines in protocol.c
get rid of goto
change kfifo macros used