void packetBuilder::FinalizePacket() { m_packet->_header.Command = m_command; m_packet->_header.subCommand = m_subCommand; m_packet->_header.Options = m_option; m_packet->_header.subOption = m_subOption; SerializePacket(); }
void FPacketCaptureArchive::AppendPacketFile(FPacketCaptureArchive& InPacketFile) { check(IsSaving()); check(Tell() != 0); // Can't append a packet before writing the header check(InPacketFile.IsLoading()); check(InPacketFile.Tell() == 0); // Read past the header InPacketFile.SerializeCaptureHeader(); check(Header.CaptureVersion == InPacketFile.Header.CaptureVersion); // For appending, only support 1MB packets const uint32 BufferSize = 1024 * 1024; uint8* ReadBuffer = new uint8[BufferSize]; // Iterate through all packets while (InPacketFile.Tell() < InPacketFile.TotalSize()) { uint32 PacketSize = BufferSize; InPacketFile.SerializePacket((void*)ReadBuffer, PacketSize); if (InPacketFile.IsError()) { UE_LOG(OodleHandlerComponentLog, Warning, TEXT("Error reading packet capture data. Skipping rest of file.")); break; } SerializePacket(ReadBuffer, PacketSize); } delete[] ReadBuffer; if (IsSaving() && bImmediateFlush) { Flush(); } }
void UDPNetwork::serialize(PacketBase *packet) { std::memset(m_packet->data, 0, m_packet->maxlen); // TODO: может не весь пакет чистить? SerializePacket(m_packet->data, packet); m_packet->len = m_sizePacket; }