pub mod protocol {
    pub const AUTH: u8 = 0;
    pub const SEND_COMMAND: u8 = 1;

    pub const PLAYERS_LIST: u8 = 2;
    pub const ERROR: u8 = 3;
}

pub mod pkt_type {
    pub const ENCRYPTED: u8   = 0b1;
    pub const UNENCRYPTED: u8 = 0b0;

    #[inline(always)]
    pub fn unpack_type(data: u8) -> (u8, bool) {
        (data >> 1, (data & 0b1) != 0)
    }

    #[inline(always)]
    pub fn pack_type(type_: u8, is_compressed: bool) -> u8 {
        (type_ >> 1) | (is_compressed as u8)
    }
}
