// Handles all packets and calls the service designated to the packet type. public void HandlePacket(SteamClient Client) { redBuffer InternalBuffer; Byte[] ServiceData = new Byte[1]; NetworkPacket ServicePacket = new NetworkPacket(); // Serialize and create the packet. InternalBuffer = new redBuffer(Client.Buffer); InternalBuffer.ReadBlob(ref ServiceData); ServicePacket.Deserialize(new redBuffer(ServiceData), Client); // Log that we got a packet for debug. Log.Debug(String.Format("PacketType: {0}", ServicePacket._Type)); // If it's a heartbeat packet, drop it. if (ServicePacket._Type == 64) { return; } // Send the packet to the right service. if (ServiceMap.ContainsKey(ServicePacket._Type)) { ServiceMap[ServicePacket._Type].HandlePacket(ref ServicePacket, ref Client); } else { Log.Debug(String.Format("Couldn't find a service for {0}", ServicePacket._Type)); } }
public bool Serialize(ref redBuffer Buffer) { try { Buffer.ReadUInt64(ref IM.FromXUID); Buffer.ReadUInt64(ref IM.ToXUID); Buffer.ReadUInt32(ref IM.TimeStamp); Buffer.ReadBlob(ref IM.Message); } catch (Exception e) { Log.Error(e.Message); return false; } return true; }
public bool Serialize(ref redBuffer Buffer) { try { Buffer.ReadUInt64(ref IM.FromXUID); Buffer.ReadUInt64(ref IM.ToXUID); Buffer.ReadUInt32(ref IM.TimeStamp); Buffer.ReadBlob(ref IM.Message); } catch (Exception e) { Log.Error(e.Message); return(false); } return(true); }
// Handles all packets and calls the service designated to the packet type. public void HandlePacket(SteamClient Client) { redBuffer InternalBuffer; Byte[] ServiceData = new Byte[1]; NetworkPacket ServicePacket = new NetworkPacket(); // Serialize and create the packet. InternalBuffer = new redBuffer(Client.Buffer); InternalBuffer.ReadBlob(ref ServiceData); ServicePacket.Deserialize(new redBuffer(ServiceData), Client); // Log that we got a packet for debug. Log.Debug(String.Format("PacketType: {0}", ServicePacket._Type)); // If it's a heartbeat packet, drop it. if(ServicePacket._Type == 64) return; // Send the packet to the right service. if(ServiceMap.ContainsKey(ServicePacket._Type)) ServiceMap[ServicePacket._Type].HandlePacket(ref ServicePacket, ref Client); else Log.Debug(String.Format("Couldn't find a service for {0}", ServicePacket._Type)); }
public void Deserialize(redBuffer Buffer, SteamClient Client) { Byte[] IV = new Byte[24]; Byte[] Key = new Byte[24]; Byte[] EncryptedData = new Byte[1]; // Read the packet. Buffer.ReadUInt64(ref _TransactionID); Buffer.ReadUInt64(ref _XUID); Buffer.ReadUInt64(ref _Username); Buffer.ReadUInt32(ref _Type); Buffer.ReadUInt32(ref _Seed); Buffer.ReadUInt32(ref _IP); Buffer.ReadBlob(ref EncryptedData); // Generate the IV and key. IV = SteamCrypto.CalculateIV(_Seed); Key = SteamCrypto.CalculateIV(Client.SessionID); Array.Resize <Byte>(ref IV, 8); // Create a new buffer and encrypt the data. _Data = new Byte[EncryptedData.Length]; _Data = SteamCrypto.Decrypt(EncryptedData, Key, IV); }
public void Deserialize(redBuffer Buffer, SteamClient Client) { Byte[] IV = new Byte[24]; Byte[] Key = new Byte[24]; Byte[] EncryptedData = new Byte[1]; // Read the packet. Buffer.ReadUInt64(ref _TransactionID); Buffer.ReadUInt64(ref _XUID); Buffer.ReadUInt64(ref _Username); Buffer.ReadUInt32(ref _Type); Buffer.ReadUInt32(ref _Seed); Buffer.ReadUInt32(ref _IP); Buffer.ReadBlob(ref EncryptedData); // Generate the IV and key. IV = SteamCrypto.CalculateIV(_Seed); Key = SteamCrypto.CalculateIV(Client.SessionID); Array.Resize<Byte>(ref IV, 8); // Create a new buffer and encrypt the data. _Data = new Byte[EncryptedData.Length]; _Data = SteamCrypto.Decrypt(EncryptedData, Key, IV); }