#ifndef CDUTILS_PROTOCOL_H
#define CDUTILS_PROTOCOL_H

#include "pibytearray.h"

namespace CDUtils {

enum CDPacketType {CD_Ping, CD_Pong, CD_KQuery, CD_KSend, CD_Command, CD_XData, CD_XQuery};

# pragma pack(push,1)

	struct PacketHeader {
		int type; // CDPacketType
		int session_id;
	};

# pragma pack(pop)


inline PIByteArray & operator <<(PIByteArray & s, const PacketHeader & v) {s << v.type << v.session_id; return s;}
inline PIByteArray & operator >>(PIByteArray & s, PacketHeader & v) {s >> v.type >> v.session_id; return s;}

}

#endif // CDUTILS_PROTOCOL_H
