Implement packet type switch

Signed-off-by: Peter Lemenkov <lemenkov@gmail.com>