PacketHandler

This class maintains an array of all [PacketHandler](API\Runtime\PacketHandler\PacketHandler) Components and forwards incoming and outgoing packets the each component

Choose your operating system:

Windows

macOS

Linux

References

Module

PacketHandler

Header

/Engine/Source/Runtime/PacketHandlers/PacketHandler/Public/PacketHandler.h

Include

#include "PacketHandler.h"

Syntax

class PacketHandler

Remarks

This class maintains an array of all PacketHandler Components and forwards incoming and outgoing packets the each component

Variables

Name Description

Public variable

Handler::Mode

 

Mode

Mode of the handler, Client or Server

Constructors

Name Description

Public function

PacketHandler

(
    FDDoSDetection* InDDoS
)

Base constructor

PacketHandler

Destructors

Name Description

Public function Virtual

~PacketHandler()

Functions

Name Description

Public function

TSharedPtr< ...

 

AddHandler

(
    const FString& ComponentStr,
    bool bDeferInitialize
)

As above, but initializes from a string specifying the component module, and (optionally) additional options

Public function

void

 

AddHandler

(
    TSharedPtr< HandlerComponent >& Ne...,
    bool bDeferInitialize
)

Adds a HandlerComponent to the pipeline, prior to initialization (none can be added after initialization)

Public function

void

 

BeginHandshaking

Triggered by the higher level netcode, to begin any required HandlerComponent handshakes

Public function Virtual Const

void

 

CountBytes

(
    FArchive& Ar
)

Public function Static

bool

 

DoesAnyProfileHaveComponent

(
    const FString& InComponentName
)

Searches the PacketHandler profile configurations to find if a component is listed.

Public function Static

bool

 

DoesProfileHaveComponent

(
    const FName InNetDriverName,
    const FString& InComponentName
)

Searches the PacketHandler profile configuration for the given netdriver to find if a component is listed.

Public function Static

FPacketHandl...

 

GetAddComponentByNameDelegate()

Public function Static

FPacketHandl...

 

GetAddComponentDelegate()

Public function Const

TSharedPtr< ...

 

GetAggregator()

Returns the analytics aggregator

Public function Const

TSharedPtr< ...

 

GetComponentByName

(
    FName ComponentName
)

Returns a pointer to the first component in the HandlerComponents array with the specified name.

Public function Const

FDDoSDetecti...

 

GetDDoS()

Returns a pointer to the DDoS detection handler

Public function

TSharedPtr< ...

 

GetEncryptionComponent()

Returns a pointer to the component set as the encryption handler, if any.

Public function Const

TSharedPtr< ...

 

GetProvider()

Returns the analytics provider

Public function

BufferedPack...

 

GetQueuedConnectionlessPacket()

Gets a packet from the buffered connectionless packet queue for sending

Public function

BufferedPack...

 

GetQueuedPacket()

Gets a packet from the buffered packet queue for sending

Public function

BufferedPack...

 

GetQueuedRawPacket()

Gets a packet from the buffered packet queue for sending (as a raw packet)

Public function

bool

 

GetRawSend()

Whether or not raw packet sends are enabled

Public function

int32

 

GetTotalReservedPacketBits()

Gets the combined reserved packet/protocol bits from all handlers, for reserving space in the parent connections packets

Public function

void

 

HandlerComponentInitialized

(
    HandlerComponent* InComponent
)

Triggered when a child HandlerComponent has been initialized

Public function

EIncomingRes...

 

Incoming

(
    FReceivedPacketView& PacketView
)

Processes incoming packets at the PacketHandler level, before any UNetConnection processing takes place on the packet.

Protected function

EIncomingRes...

 

Incoming_Internal

(
    FReceivedPacketView& PacketView
)

Internal handling for Incoming/IncomingConnectionless

Public function

EIncomingRes...

 

IncomingConnectionless

(
    FReceivedPacketView& PacketView
)

Processes incoming packets without a UNetConnection, in the same manner as 'Incoming' above IMPORTANT: Net drivers triggering this, should call 'UNetDriver::FlushHandler' shortly afterwards, to minimize packet buffering

Public function

void

 

IncomingHigh

(
    FBitReader& Reader
)

Add runtime-calculated arrays for each packet pipeline type, to reduce redundant iterations, (there are 3x iterations now, 1 for each packet pipeline type), and to ignore inactive HandlerComponent's

Public function

void

 

InitFaultRecovery

Initializes a reference to the NetConnection fault recovery interface (does not require Engine dependency)

Public function

void

 

Initialize

(
    Handler::Mode Mode,
    uint32 InMaxPacketBits,
    bool bConnectionlessOnly,
    TSharedPtr< class IAnalyticsProvide...,
    FDDoSDetection* InDDoS,
    FName InDriverProfile
)

Handles initialization of manager

Public function

void

 

InitializeComponents()

Triggers initialization of HandlerComponents.

Public function

void

 

InitializeDelegates

Used for external initialization of delegates

Public function

bool

 

IsFullyInitialized()

Whether or not the packet handler is fully initialized, post-handshake etc.

Public function

void

 

NotifyAnalyticsProvider

Notification that the NetDriver analytics provider has been updated (NOT called on first initialization)

Public function

const Proces...

 

Outgoing

(
    uint8* Packet,
    int32 CountBits,
    FOutPacketTraits& Traits
)

Processes outgoing packets at the PacketHandler level, after all UNetConnection processing.

Protected function

const Proces...

 

Outgoing_Internal

(
    uint8* Packet,
    int32 CountBits,
    FOutPacketTraits& Traits,
    bool bConnectionless,
    const TSharedPtr< const FInternetAd...
)

Internal handling for Outgoing/OutgoingConnectionless

Public function

const Proces...

 

OutgoingConnectionless

(
    const TSharedPtr< const FInternetAd...,
    uint8* Packet,
    int32 CountBits,
    FOutPacketTraits& Traits
)

Processes outgoing packets without a UNetConnection, in the same manner as 'Outgoing' above

Public function

void

 

OutgoingHigh

(
    FBitWriter& Writer
)

Work in progress, don't use yet.

Public function

void

 

QueueHandlerPacketForSending

(
    BufferedPacket* PacketToQueue
)

Queue's a packet to be sent through 'SendHandlerPacket'

Public function

void

 

QueuePacketForRawSending

(
    BufferedPacket* PacketToQueue
)

Queue's a packet to be sent when the handler is ticked (as a raw packet, since it's already been processed)

Public function

void

 

SendHandlerPacket

(
    HandlerComponent* InComponent,
    FBitWriter& Writer,
    FOutPacketTraits& Traits
)

Send a packet originating from a HandlerComponent - will process through the HandlerComponents chain, starting after the triggering component.

Public function

void

 

SetRawSend

(
    bool bInEnabled
)

Sets whether or not outgoing packets should bypass this handler - used when raw packet sends are necessary (such as for the stateless handshake)

Public function

void

 

Tick

(
    float DeltaTime
)

Deprecated Functions

Name Description

Public function

const Proces...

 

Incoming

(
    uint8* Packet,
    int32 CountBytes
)

Incoming now uses FReceivedPacketView.

Protected function

const Proces...

 

Incoming_Internal

(
    uint8* Packet,
    int32 CountBytes,
    bool bConnectionless,
    const TSharedPtr< const FInternetAd...
)

Incoming_Internal now uses FReceivedPacketView

Public function

const Proces...

 

IncomingConnectionless

(
    const TSharedPtr< const FInternetAd...,
    uint8* Packet,
    int32 CountBytes
)

IncomingConnectionless now uses FReceivedPacketView.