PacketHandler

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

Windows
MacOS
Linux

Inheritance Hierarchy

FVirtualDestructor

PacketHandler

References

Module

PacketHandler

Header

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

Include

#include "PacketHandler.h"

Syntax

class PacketHandler : public FVirtualDestructor

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

Functions

Name Description

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

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

 

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 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

const Proces...

 

Incoming

(
    uint8* Packet,
    int32 CountBytes
)

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

Protected function

const Proces...

 

Incoming_Internal

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

Internal handling for Incoming/IncomingConnectionless

Public function

const Proces...

 

IncomingConnectionless

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

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 NOTE: Connectionless packets are unreliable.

Public function

void

 

IncomingHigh

(
    FBitReader& Reader
)

Processes incoming packets at the UNetConnection level, after uncapping the packet into an FBitReader.

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) NOTE: Can also mean disabled, e.g. during hotfix

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 NOTE: Connectionless packets are unreliable.

Public function

void

 

OutgoingHigh

(
    FBitWriter& Writer
)

Processes outgoing packets at the UNetConnection level, after game data is written, and just before the packet is capped.

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
)

Typedefs

Name

Description

NetDriverAddressFunc

Deprecated Functions

Name Description

Public function

TSharedPtr< ...

 

GetAddressFromString

(
    const FString& Address
)

This function should not be used except for backwards compatibility with deprecated functions.

Protected function

const Proces...

 

Incoming_Internal

(
    uint8* Packet,
    int32 CountBytes,
    bool bConnectionless,
    const FString& Address
)

Address is now taken as a shared pointer to remove the burden of format differences from the packethandler

Public function

const Proces...

 

IncomingConnectionless

(
    const FString& Address,
    uint8* Packet,
    int32 CountBytes
)

Use the FInternetAddr structure version.

Public function

void

 

InitializeAddressSerializer

(
    NetDriverAddressFunc InAddressSeria...
)

Do not use this function directly, it is provided for backwards compatibility with older versions of LowLevelSend

Public function

void

 

InitializeDelegates

(
    FPacketHandlerLowLevelSend InLowLev...
)

Use the traits based delegate instead for compatibility with other systems.

Public function

const Proces...

 

Outgoing

(
    uint8* Packet,
    int32 CountBits
)

Please move to the functional flow that includes support for PacketTraits.

Protected function

const Proces...

 

Outgoing_Internal

(
    uint8* Packet,
    int32 CountBits,
    FOutPacketTraits& Traits,
    bool bConnectionless,
    const FString& Address
)

Address is now taken as a shared pointer to remove the burden of format differences from the packethandler

Public function

const Proces...

 

OutgoingConnectionless

(
    const FString& Address,
    uint8* Packet,
    int32 CountBits
)

Please use the member that supports PacketTraits for alllowing additional flags on sends.

Public function

const Proces...

 

OutgoingConnectionless

(
    const FString& Address,
    uint8* Packet,
    int32 CountBits,
    FOutPacketTraits& Traits
)

Use the FInternetAddr structure version.

Public function

void

 

SendHandlerPacket

(
    HandlerComponent* InComponent,
    FBitWriter& Writer
)

Please use the packet traits when sending to handle modifications of packets and analytics.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss