Added protocol byte encapsulate and de-capsulate code.