engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | Public 属性 | Protected 成员函数 | 所有成员列表
PacketHandler类 参考

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

#include <PacketHandler.h>

继承自 FVirtualDestructor .

Public 成员函数

TSharedPtr< HandlerComponent > AddHandler (const FString &ComponentStr, bool bDeferInitialize=false)
 As above, but initializes from a string specifying the component module, and (optionally) additional options 更多...
 
void AddHandler (TSharedPtr< HandlerComponent > &NewHandler, bool bDeferInitialize=false)
 Adds a HandlerComponent to the pipeline, prior to initialization (none can be added after initialization) 更多...
 
void BeginHandshaking (FPacketHandlerHandshakeComplete InHandshakeDel=FPacketHandlerHandshakeComplete())
 Triggered by the higher level netcode, to begin any required HandlerComponent handshakes
 
TSharedPtr< FNetAnalyticsAggregator > GetAggregator () const
 Returns the analytics aggregator
 
TSharedPtr< HandlerComponent > GetComponentByName (FName ComponentName) const
 Returns a pointer to the first component in the HandlerComponents array with the specified name.
 
FDDoSDetection * GetDDoS () const
 Returns a pointer to the DDoS detection handler
 
TSharedPtr< FEncryptionComponent > GetEncryptionComponent ()
 Returns a pointer to the component set as the encryption handler, if any.
 
TSharedPtr< IAnalyticsProvider > GetProvider () const
 Returns the analytics provider
 
BufferedPacket * GetQueuedConnectionlessPacket ()
 Gets a packet from the buffered connectionless packet queue for sending 更多...
 
BufferedPacket * GetQueuedPacket ()
 Gets a packet from the buffered packet queue for sending 更多...
 
BufferedPacket * GetQueuedRawPacket ()
 Gets a packet from the buffered packet queue for sending (as a raw packet) 更多...
 
FORCEINLINE bool GetRawSend ()
 Whether or not raw packet sends are enabled
 
int32 GetTotalReservedPacketBits ()
 Gets the combined reserved packet/protocol bits from all handlers, for reserving space in the parent connections packets 更多...
 
void HandlerComponentInitialized (HandlerComponent *InComponent)
 Triggered when a child HandlerComponent has been initialized
 
FORCEINLINE EIncomingResult Incoming (FReceivedPacketView &PacketView)
 Processes incoming packets at the PacketHandler level, before any UNetConnection processing takes place on the packet. 更多...
 
FORCEINLINE EIncomingResult 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 NOTE: Connectionless packets are unreliable. 更多...
 
void IncomingHigh (FBitReader &Reader)
 
void Initialize (Handler::Mode Mode, uint32 InMaxPacketBits, bool bConnectionlessOnly=false, TSharedPtr< class IAnalyticsProvider > InProvider=nullptr, FDDoSDetection *InDDoS=nullptr, FName InDriverProfile=NAME_None)
 Handles initialization of manager 更多...
 
void InitializeComponents ()
 Triggers initialization of HandlerComponents.
 
void InitializeDelegates (FPacketHandlerLowLevelSendTraits InLowLevelSendDel)
 Used for external initialization of delegates 更多...
 
FORCEINLINE bool IsFullyInitialized ()
 Whether or not the packet handler is fully initialized, post-handshake etc.
 
void NotifyAnalyticsProvider (TSharedPtr< IAnalyticsProvider > InProvider, TSharedPtr< FNetAnalyticsAggregator > InAggregator)
 Notification that the NetDriver analytics provider has been updated (NOT called on first initialization) NOTE: Can also mean disabled, e.g. 更多...
 
FORCEINLINE const ProcessedPacket Outgoing (uint8 *Packet, int32 CountBits, FOutPacketTraits &Traits)
 Processes outgoing packets at the PacketHandler level, after all UNetConnection processing. 更多...
 
FORCEINLINE const ProcessedPacket OutgoingConnectionless (const TSharedPtr< const FInternetAddr > &Address, uint8 *Packet, int32 CountBits, FOutPacketTraits &Traits)
 Processes outgoing packets without a UNetConnection, in the same manner as 'Outgoing' above NOTE: Connectionless packets are unreliable. 更多...
 
void OutgoingHigh (FBitWriter &Writer)
 
 PacketHandler (FDDoSDetection *InDDoS=nullptr)
 Base constructor 更多...
 
FORCEINLINE void QueueHandlerPacketForSending (BufferedPacket *PacketToQueue)
 Queue's a packet to be sent through 'SendHandlerPacket' 更多...
 
FORCEINLINE 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) 更多...
 
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. 更多...
 
FORCEINLINE 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 成员函数

static bool DoesAnyProfileHaveComponent (const FString &InComponentName)
 Searches the PacketHandler profile configurations to find if a component is listed. 更多...
 
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 属性

Handler::Mode Mode
 Mode of the handler, Client or Server
 

Protected 成员函数

EIncomingResult Incoming_Internal (FReceivedPacketView &PacketView)
 Internal handling for Incoming/IncomingConnectionless 更多...
 
const ProcessedPacket Outgoing_Internal (uint8 *Packet, int32 CountBits, FOutPacketTraits &Traits, bool bConnectionless, const FString &Address)
 Internal handling for Outgoing/OutgoingConnectionless 更多...
 
const ProcessedPacket Outgoing_Internal (uint8 *Packet, int32 CountBits, FOutPacketTraits &Traits, bool bConnectionless, const TSharedPtr< const FInternetAddr > &Address)
 Internal handling for Outgoing/OutgoingConnectionless 更多...
 

详细描述

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

构造及析构函数说明

◆ PacketHandler()

PacketHandler::PacketHandler ( FDDoSDetection *  InDDoS = nullptr)

Base constructor

参数
InDDoSReference to the owning net drivers DDoS detection handler

成员函数说明

◆ AddHandler() [1/2]

TSharedPtr< HandlerComponent > PacketHandler::AddHandler ( const FString &  ComponentStr,
bool  bDeferInitialize = false 
)

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

参数
ComponentStrThe handler component to load
bDeferInitializeWhether or not to defer triggering Initialize (for batch-adds - code calling this, triggers it instead)

◆ AddHandler() [2/2]

void PacketHandler::AddHandler ( TSharedPtr< HandlerComponent > &  NewHandler,
bool  bDeferInitialize = false 
)

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

参数
NewHandlerThe HandlerComponent to add
bDeferInitializeWhether or not to defer triggering Initialize (for batch-adds - code calling this, triggers it instead)

◆ DoesAnyProfileHaveComponent()

static bool PacketHandler::DoesAnyProfileHaveComponent ( const FString &  InComponentName)
static

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

参数
InComponentNameThe PacketHandler Component to search for
返回
if there is a profile that has the component included.

◆ DoesProfileHaveComponent()

static bool PacketHandler::DoesProfileHaveComponent ( const FName  InNetDriverName,
const FString &  InComponentName 
)
static

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

参数
InNetDriverNameThe name of the netdriver to search configuration for
InComponentNameThe component to search for
返回
if the component is listed in the profile configuration.

◆ GetQueuedConnectionlessPacket()

BufferedPacket * PacketHandler::GetQueuedConnectionlessPacket ( )

Gets a packet from the buffered connectionless packet queue for sending

返回
The packet to be sent, or nullptr if none are to be sent

◆ GetQueuedPacket()

BufferedPacket * PacketHandler::GetQueuedPacket ( )

Gets a packet from the buffered packet queue for sending

返回
The packet to be sent, or nullptr if none are to be sent

◆ GetQueuedRawPacket()

BufferedPacket * PacketHandler::GetQueuedRawPacket ( )

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

返回
The packet to be sent, or nullptr if none are to be sent

◆ GetTotalReservedPacketBits()

int32 PacketHandler::GetTotalReservedPacketBits ( )

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

返回
The combined reserved packet/protocol bits

◆ Incoming()

FORCEINLINE EIncomingResult PacketHandler::Incoming ( FReceivedPacketView &  PacketView)
inline

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

Use this for more complex changes to packets, such as compression/encryption, but be aware that compatibility problems with other HandlerComponent's are more likely.

参数
PacketViewView of the packet being processed - PacketView.Data should be used to return the result
返回
Returns Success/Failure

◆ Incoming_Internal()

EIncomingResult PacketHandler::Incoming_Internal ( FReceivedPacketView &  PacketView)
protected

Internal handling for Incoming/IncomingConnectionless

参数
PacketViewView of the packet being processed - PacketView.Data should be used to return the result
返回
Returns Success/Failure

◆ IncomingConnectionless()

FORCEINLINE EIncomingResult PacketHandler::IncomingConnectionless ( FReceivedPacketView &  PacketView)
inline

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.

参数
PacketViewView of the packet being processed - PacketView.Data should be used to return the result
返回
Returns Success/Failure

◆ IncomingHigh()

void PacketHandler::IncomingHigh ( FBitReader &  Reader)
待办事项:
#JohnB: Work in progress, don't use yet.

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

Use this for simple data additions to packets, and for maximum compatibility with other HandlerComponent's.

参数
ReaderThe FBitReader for the incoming packet

◆ Initialize()

void PacketHandler::Initialize ( Handler::Mode  Mode,
uint32  InMaxPacketBits,
bool  bConnectionlessOnly = false,
TSharedPtr< class IAnalyticsProvider >  InProvider = nullptr,
FDDoSDetection *  InDDoS = nullptr,
FName  InDriverProfile = NAME_None 
)

Handles initialization of manager

参数
ModeThe mode the manager should be initialized in
InMaxPacketBitsThe maximum supported packet size
bConnectionlessOnlyWhether or not this is a connectionless-only manager (ignores .ini components)
InProviderThe analytics provider
InDDoSReference to the owning net drivers DDoS detection handler
InDriverProfileThe PacketHandler configuration profile to use

◆ InitializeDelegates()

void PacketHandler::InitializeDelegates ( FPacketHandlerLowLevelSendTraits  InLowLevelSendDel)
inline

Used for external initialization of delegates

参数
InLowLevelSendDelThe delegate the PacketHandler should use for triggering packet sends

◆ NotifyAnalyticsProvider()

void PacketHandler::NotifyAnalyticsProvider ( TSharedPtr< IAnalyticsProvider >  InProvider,
TSharedPtr< FNetAnalyticsAggregator >  InAggregator 
)

Notification that the NetDriver analytics provider has been updated (NOT called on first initialization) NOTE: Can also mean disabled, e.g.

during hotfix

参数
InProviderThe analytics provider
InAggregatorThe net analytics aggregator

◆ Outgoing()

FORCEINLINE const ProcessedPacket PacketHandler::Outgoing ( uint8 *  Packet,
int32  CountBits,
FOutPacketTraits &  Traits 
)
inline

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

Use this for more complex changes to packets, such as compression/encryption, but be aware that compatibility problems with other HandlerComponent's are more likely.

参数
PacketThe packet data to be processed
CountBitsThe size of the packet data in bits
TraitsTraits for the packet, passed down from the NetConnection
返回
Returns the final packet

◆ Outgoing_Internal() [1/2]

const ProcessedPacket PacketHandler::Outgoing_Internal ( uint8 *  Packet,
int32  CountBits,
FOutPacketTraits &  Traits,
bool  bConnectionless,
const FString &  Address 
)
inlineprotected

Internal handling for Outgoing/OutgoingConnectionless

参数
PacketThe packet data to be processed
CountBitsThe size of the packet data in bits
TraitsTraits for the packet, passed down from the NetConnection, if applicable
bConnectionlessWhether or not this should be sent as a connectionless packet
AddressThe address the packet is being sent to (format is abstract, determined by active net driver)
返回
Returns the final packet

◆ Outgoing_Internal() [2/2]

const ProcessedPacket PacketHandler::Outgoing_Internal ( uint8 *  Packet,
int32  CountBits,
FOutPacketTraits &  Traits,
bool  bConnectionless,
const TSharedPtr< const FInternetAddr > &  Address 
)
protected

Internal handling for Outgoing/OutgoingConnectionless

参数
PacketThe packet data to be processed
CountBitsThe size of the packet data in bits
TraitsTraits for the packet, passed down from the NetConnection, if applicable
bConnectionlessWhether or not this should be sent as a connectionless packet
AddressThe address the packet is being sent to
返回
Returns the final packet

◆ OutgoingConnectionless()

FORCEINLINE const ProcessedPacket PacketHandler::OutgoingConnectionless ( const TSharedPtr< const FInternetAddr > &  Address,
uint8 *  Packet,
int32  CountBits,
FOutPacketTraits &  Traits 
)
inline

Processes outgoing packets without a UNetConnection, in the same manner as 'Outgoing' above NOTE: Connectionless packets are unreliable.

参数
AddressThe address the packet is being sent to
PacketThe packet data to be processed
CountBitsThe size of the packet data in bits
TraitsTraits for the packet, if applicable
返回
Returns the final packet

◆ OutgoingHigh()

void PacketHandler::OutgoingHigh ( FBitWriter &  Writer)
待办事项:
#JohnB: Work in progress, don't use yet.

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

Use this for simple data additions to packets, and for maximum compatibility with other HandlerComponent's.

参数
WriterThe FBitWriter for the outgoing packet

◆ QueueHandlerPacketForSending()

FORCEINLINE void PacketHandler::QueueHandlerPacketForSending ( BufferedPacket *  PacketToQueue)
inline

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

参数
PacketToQueueThe packet to be queued

◆ QueuePacketForRawSending()

FORCEINLINE void PacketHandler::QueuePacketForRawSending ( BufferedPacket *  PacketToQueue)
inline

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

参数
PacketToQueueThe packet to be queued

◆ SendHandlerPacket()

void PacketHandler::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.

NOTE: Requires that InitializeDelegates is called, with a valid LowLevelSend delegate.

参数
ComponentThe HandlerComponent sending the packet
WriterThe packet being sent
TraitsThe traits applied to the packet, if applicable

◆ SetRawSend()

FORCEINLINE void PacketHandler::SetRawSend ( bool  bInEnabled)
inline

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

参数
bInEnabledWhether or not raw sends are enabled

该类的文档由以下文件生成: