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 | ( | FDDoSDetection * | InDDoS = nullptr | ) |
Base constructor
| InDDoS | Reference to the owning net drivers DDoS detection handler |
| 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
| ComponentStr | The handler component to load |
| bDeferInitialize | Whether or not to defer triggering Initialize (for batch-adds - code calling this, triggers it instead) |
| void PacketHandler::AddHandler | ( | TSharedPtr< HandlerComponent > & | NewHandler, |
| bool | bDeferInitialize = false |
||
| ) |
Adds a HandlerComponent to the pipeline, prior to initialization (none can be added after initialization)
| NewHandler | The HandlerComponent to add |
| bDeferInitialize | Whether or not to defer triggering Initialize (for batch-adds - code calling this, triggers it instead) |
|
static |
Searches the PacketHandler profile configurations to find if a component is listed.
| InComponentName | The PacketHandler Component to search for |
|
static |
Searches the PacketHandler profile configuration for the given netdriver to find if a component is listed.
| InNetDriverName | The name of the netdriver to search configuration for |
| InComponentName | The component to search for |
| BufferedPacket * PacketHandler::GetQueuedConnectionlessPacket | ( | ) |
Gets a packet from the buffered connectionless packet queue for sending
| BufferedPacket * PacketHandler::GetQueuedPacket | ( | ) |
Gets a packet from the buffered packet queue for sending
| BufferedPacket * PacketHandler::GetQueuedRawPacket | ( | ) |
Gets a packet from the buffered packet queue for sending (as a raw packet)
| int32 PacketHandler::GetTotalReservedPacketBits | ( | ) |
Gets the combined reserved packet/protocol bits from all handlers, for reserving space in the parent connections packets
|
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.
| PacketView | View of the packet being processed - PacketView.Data should be used to return the result |
|
protected |
Internal handling for Incoming/IncomingConnectionless
| PacketView | View of the packet being processed - PacketView.Data should be used to return the result |
|
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.
| PacketView | View of the packet being processed - PacketView.Data should be used to return the result |
| void PacketHandler::IncomingHigh | ( | FBitReader & | Reader | ) |
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.
| Reader | The FBitReader for the incoming packet |
| 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
| Mode | The mode the manager should be initialized in |
| InMaxPacketBits | The maximum supported packet size |
| bConnectionlessOnly | Whether or not this is a connectionless-only manager (ignores .ini components) |
| InProvider | The analytics provider |
| InDDoS | Reference to the owning net drivers DDoS detection handler |
| InDriverProfile | The PacketHandler configuration profile to use |
|
inline |
Used for external initialization of delegates
| InLowLevelSendDel | The delegate the PacketHandler should use for triggering packet sends |
| 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
| InProvider | The analytics provider |
| InAggregator | The net analytics aggregator |
|
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.
| Packet | The packet data to be processed |
| CountBits | The size of the packet data in bits |
| Traits | Traits for the packet, passed down from the NetConnection |
|
inlineprotected |
Internal handling for Outgoing/OutgoingConnectionless
| Packet | The packet data to be processed |
| CountBits | The size of the packet data in bits |
| Traits | Traits for the packet, passed down from the NetConnection, if applicable |
| bConnectionless | Whether or not this should be sent as a connectionless packet |
| Address | The address the packet is being sent to (format is abstract, determined by active net driver) |
|
protected |
Internal handling for Outgoing/OutgoingConnectionless
| Packet | The packet data to be processed |
| CountBits | The size of the packet data in bits |
| Traits | Traits for the packet, passed down from the NetConnection, if applicable |
| bConnectionless | Whether or not this should be sent as a connectionless packet |
| Address | The address the packet is being sent to |
|
inline |
Processes outgoing packets without a UNetConnection, in the same manner as 'Outgoing' above NOTE: Connectionless packets are unreliable.
| Address | The address the packet is being sent to |
| Packet | The packet data to be processed |
| CountBits | The size of the packet data in bits |
| Traits | Traits for the packet, if applicable |
| void PacketHandler::OutgoingHigh | ( | FBitWriter & | Writer | ) |
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.
| Writer | The FBitWriter for the outgoing packet |
|
inline |
Queue's a packet to be sent through 'SendHandlerPacket'
| PacketToQueue | The packet to be queued |
|
inline |
Queue's a packet to be sent when the handler is ticked (as a raw packet, since it's already been processed)
| PacketToQueue | The packet to be queued |
| 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.
| Component | The HandlerComponent sending the packet |
| Writer | The packet being sent |
| Traits | The traits applied to the packet, if applicable |
|
inline |
Sets whether or not outgoing packets should bypass this handler - used when raw packet sends are necessary (such as for the stateless handshake)
| bInEnabled | Whether or not raw sends are enabled |