UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FPacketAudit Class Reference

#include <PacketAudit.h>

Classes

struct  FScopedAuditAccess
 

Static Public Member Functions

static NETCORE_API void Init ()
 
static NETCORE_API void Destruct ()
 
static void AddStage (FString StageName, FBitWriter &OutPacket, bool bByteAligned=false)
 
static void CheckStage (FString StageName, FBitReader &InPacket, bool bByteAligned=false)
 
static void NotifyLowLevelSend (FBitWriter &OutPacket)
 
static void NotifyLowLevelReceive (FBitReader &InPacket)
 
static void NotifyLowLevelSend (uint8 *Data, uint32 DataLen, uint32 DataLenBits)
 
static void NotifyLowLevelReceive (uint8 *Data, uint32 DataLen)
 

Protected Member Functions

NETCORE_API void AddStage_Internal (FString StageName, FBitWriter &OutPacket, bool bByteAligned)
 
NETCORE_API void CheckStage_Internal (FString StageName, FBitReader &InPacket, bool bByteAligned)
 
NETCORE_API void NotifyLowLevelSend_Internal (FBitWriter &OutPacket)
 
NETCORE_API void NotifyLowLevelReceive_Internal (FBitReader &InPacket)
 
NETCORE_API void DumpAuditData (FScopedAuditAccess &AuditLock, uint32 InPacketCRC=0)
 

Static Protected Member Functions

static NETCORE_API uint32 PacketCRC (uint8 *Data, uint32 DataLenBits)
 

Protected Attributes

FPlatformProcess::FSemaphoreGameMutex
 
FPlatformProcess::FSemaphoreSharedMutex
 
FPlatformMemory::FSharedMemoryRegionSendSharedMemory
 
FPlatformMemory::FSharedMemoryRegionReceiveSharedMemory
 

Detailed Description

FPacketAudit

Uses inter-process-communication, to audit every stage of packet processing, for verifying that packets are processing properly, and that the client/server are in sync at every stage of reading/writing.

Since this relies on IPC, it is only suitable for testing on a single machine.

IMPORTANT: Only supports interaction between a single server, and a single client.

Member Function Documentation

◆ AddStage()

static void FPacketAudit::AddStage ( FString  StageName,
FBitWriter OutPacket,
bool  bByteAligned = false 
)
inlinestatic

On the send side, marks a named stage during packet writing, which should be audited on the receive side.

Parameters
StageNameThe unique name to provide this stage of packet writing
OutPacketThe packet the data is being written to - used for gathering audit information
bByteAlignedWhether or not to treat the packet as if it is byte aligned (used in rare circumstances)

◆ AddStage_Internal()

void FPacketAudit::AddStage_Internal ( FString  StageName,
FBitWriter OutPacket,
bool  bByteAligned 
)
protected

◆ CheckStage()

static void FPacketAudit::CheckStage ( FString  StageName,
FBitReader InPacket,
bool  bByteAligned = false 
)
inlinestatic

On the receive side, checks to see that a named stage was marked for auditing on the send side, and audits the packet data.

Parameters
StageNameThe unique name to this stage of packet processing
InPacketThe packet the data is being read from - used for gathering audit information
bByteAlignedWhether or not to treat the packet as if it is byte aligned (used in rare circumstances)

◆ CheckStage_Internal()

void FPacketAudit::CheckStage_Internal ( FString  StageName,
FBitReader InPacket,
bool  bByteAligned 
)
protected

◆ Destruct()

void FPacketAudit::Destruct ( )
static

Destroy GPacketAuditor

◆ DumpAuditData()

void FPacketAudit::DumpAuditData ( FScopedAuditAccess AuditLock,
uint32  InPacketCRC = 0 
)
protected

Dumps the collected packet audit data to the log

◆ Init()

void FPacketAudit::Init ( )
static

Initialize GPacketAudtor

◆ NotifyLowLevelReceive() [1/2]

static void FPacketAudit::NotifyLowLevelReceive ( FBitReader InPacket)
inlinestatic

Low level netcode hook, notifying of incoming packets

Parameters
InPacketThe current incoming packet

◆ NotifyLowLevelReceive() [2/2]

static void FPacketAudit::NotifyLowLevelReceive ( uint8 Data,
uint32  DataLen 
)
inlinestatic

◆ NotifyLowLevelReceive_Internal()

void FPacketAudit::NotifyLowLevelReceive_Internal ( FBitReader InPacket)
protected

◆ NotifyLowLevelSend() [1/2]

static void FPacketAudit::NotifyLowLevelSend ( FBitWriter OutPacket)
inlinestatic

Low level netcode hook, notifying of outgoing packets

Parameters
OutPacketThe current outgoing packet

◆ NotifyLowLevelSend() [2/2]

static void FPacketAudit::NotifyLowLevelSend ( uint8 Data,
uint32  DataLen,
uint32  DataLenBits 
)
inlinestatic

◆ NotifyLowLevelSend_Internal()

void FPacketAudit::NotifyLowLevelSend_Internal ( FBitWriter OutPacket)
protected

◆ PacketCRC()

uint32 FPacketAudit::PacketCRC ( uint8 Data,
uint32  DataLenBits 
)
staticprotected

Gets the CRC of a packet, zeroing any unwritten bits in the last byte beforehand.

Parameters
DataThe packet data
DataLenBitsThe length of the data, in bits
Returns
Returns the CRC of the packet

Member Data Documentation

◆ GameMutex

FPlatformProcess::FSemaphore* FPacketAudit::GameMutex
protected

Mutex used for enforcing a single instance of client/server packet auditing

◆ ReceiveSharedMemory

FPlatformMemory::FSharedMemoryRegion* FPacketAudit::ReceiveSharedMemory
protected

Shared memory region for packet receives

◆ SendSharedMemory

FPlatformMemory::FSharedMemoryRegion* FPacketAudit::SendSharedMemory
protected

Shared memory region for packet sends

◆ SharedMutex

FPlatformProcess::FSemaphore* FPacketAudit::SharedMutex
protected

Mutex used for exclusive access to shared memory


The documentation for this class was generated from the following files: