Packet // Content Header // name type ?value /// EAX Message Authentication Code mac [u8; 8] /// Packet id p_id u16 /// Client id ?c_id u16 // Pre condition ++ *from_client /// Flags: /// /// - 0x80 Unencrypted /// - 0x40 Compressed /// - 0x20 Newprotocol /// - 0x10 Fragmented flags - /// Packet type: Higher nibble: Flags; Lower nibble: Packet type /// /// Packet types: /// /// - 0x0 Voice /// - 0x1 Voice whisper /// - 0x2 Command /// - 0x3 Command low /// - 0x4 Ping /// - 0x5 Pong /// - 0x6 Ack /// - 0x7 Ack low /// - 0x8 Init p_type u8 // Post conditions ++ (res.p_type & 0xf) <= 8 // Enum #Data #C2SInit ++ header.mac.iter().eq(b"TS3INIT1") ++ header.c_id.is_some() ++ header.get_type() == PacketType::Init Init0 /// Teamspeak version as timestamp version u32 /// Init packet step number - u8 0 /// Current timestamp timestamp u32 random0 [u8; 4] /// Reserved - [u8; 8] [0; 8] Init2 /// Teamspeak version as timestamp version u32 /// Init packet step number - u8 2 random1 [u8; 16] random0_r [u8; 4] Init4 /// Teamspeak version as timestamp version u32 /// Init packet step number - u8 4 x [u8; 64] n [u8; 64] level u32 random2 [u8; 100] /// y = x ^ (2 ^ level) % n y [u8; 64] command Command ++ if let C2SInit::Init4 { ref command, .. } = res { command.command == "clientinitiv" && command.has_arg("alpha") && command.has_arg("omega") } else { true } #S2CInit ++ header.mac.iter().eq(b"TS3INIT1") ++ header.c_id.is_none() ++ header.get_type() == PacketType::Init Init1 /// Init packet step number - u8 1 random1 [u8; 16] /// Reversed `random0` random0_r [u8; 4] Init3 /// Init packet step number - u8 3 x [u8; 64] n [u8; 64] level u32 random2 [u8; 100] Init127 /// Init packet step number - u8 127 - u8 0 VoiceC2S ++ header.get_type() == PacketType::Voice ++ header.c_id.is_some() id u16 codec_type u8 voice_data Vec VoiceS2C ++ header.get_type() == PacketType::Voice ++ header.c_id.is_none() id u16 /// The id of the talking client from_id u16 codec_type u8 voice_data Vec VoiceWhisperC2S ++ header.get_type() == PacketType::VoiceWhisper ++ header.c_id.is_some() ++ !header.get_newprotocol() id u16 codec_type u8 channel_count u8 client_count u8 /// [u64; channel_count], [u16; client_count], voice_data data Vec VoiceWhisperNewC2S ++ header.get_type() == PacketType::VoiceWhisper ++ header.c_id.is_some() ++ header.get_newprotocol() id u16 codec_type u8 whisper_type u8 whisper_target u8 /// The targeted channel or group id (or 0 if not applicable) target_id u64 voice_data Vec VoiceWhisperS2C ++ header.get_type() == PacketType::VoiceWhisper ++ header.c_id.is_none() id u16 /// The id of the talking client from_id u16 codec_type u8 voice_data Vec Command Command ++ header.get_type() == PacketType::Command CommandLow Command ++ header.get_type() == PacketType::CommandLow Ping ++ header.get_type() == PacketType::Ping //- u16 0xeee9 /// Pong with packet id Pong u16 ++ header.get_type() == PacketType::Pong /// Pong with packet id Ack u16 ++ header.get_type() == PacketType::Ack /// Pong with packet id AckLow u16 ++ header.get_type() == PacketType::AckLow