FDDoSDetection

The main DDoS detection tracking class, for counting packets and applying restrictions.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

NetCore

Header

/Engine/Source/Runtime/Net/Core/Public/Net/Core/Misc/DDoSDetection.h

Include

#include "Net/Core/Misc/DDoSDetection.h"

Syntax

class FDDoSDetection :
    protected FDDoSPacketCounters,
    protected FDDoSState

Remarks

The main DDoS detection tracking class, for counting packets and applying restrictions. Implemented separate to the NetDriver, to allow wider use e.g. potentially at socket level, if useful.

Variables

Name Description

Protected variable

int8

 

ActiveState

The currently active DDoS severity state settings

Protected variable

bool

 

bDDoSAnalytics

Whether or not analytics for DDoS detection is enabled

Protected variable

bool

 

bDDoSDetection

Whether or not DDoS detection is presently enabled

Protected variable

bool

 

bDDoSLogRestrictions

Whether or not restriction of log messages from non-NetConnection packets is enabled

Protected variable

bool

 

bHitFrameNetConnLimit

Whether or not the current frame has reached NetConnection packet limits, and should block ALL further packets

Protected variable

bool

 

bHitFrameNonConnLimit

Whether or not the current frame has reached non-NetConnection packet limits, and should block non-NetConnection packets

Protected variable

bool

 

bMetEscalationConditionsThisFrame

Limit checking previous states escalation conditions to once per frame

Protected variable

TArray< FDDoSPa...

 

CounterPerSecHistory

Stores enough per second quota history, to allow all DetectionSeverity states to recalculate if their CooloffTime is reached

Protected variable

int32

 

DDoSLogSpamLimit

The maximum number of non-NetConnection triggered log messages per frame, before further logs are dropped this frame

Protected variable

TArray< FDDoSSt...

 

DetectionSeverity

The different DDoS detection states, of escalating severity, depending on the strength of the DDoS

Protected variable

double

 

EndFrameRecvTimestamp

Timestamp for the end of the last frames receive loop

Protected variable

double

 

ExpectedFrameTime

The expected time between frames (1.0 / MaxTickRate) - used for adjusting limits/quota's based on DeltaTime

Protected variable

float

 

FrameAdjustment

The current frames adjustment/deviation, from ExpectedFrameTime

Protected variable

int32

 

HitchFrameCount

The number of consecutive frames spent hitching

Protected variable

int8

 

HitchFrameTolerance

The number of frames spent hitching, before disabling false positive detection, and treating packet buildup as potential DDoS

Protected variable

int32

 

HitchTimeQuotaMS

The amount of time since the previous frame, for detecting frame hitches, to prevent DDoS detection false positives

Protected variable

int32

 

LastCounterPerSecHistoryIdx

The last written index of CounterPerSecHistory

Protected variable

double

 

LastMetEscalationConditions

The last time the previous severity states escalation conditions were met (to prevent bouncing up/down between states)

Protected variable

double

 

LastPerSecQuotaBegin

Timestamp for the last time per-second quota counting began

Protected variable

int32

 

LogHitCounter

Counter for log restriction hits, in the current frame

Public variable

FDDoSSeverityEs...

 

NotifySeverityEscalation

Analytics delegate for notifying of severity state escalations

Protected variable

int32

 

StartFramePacketCount

Counts the packets from the start of the current frame

Protected variable

double

 

StartFrameRecvTimestamp

The timestamp for the start of the current frames receive

Protected variable

int8

 

WorstActiveState

The worst DDoS severity state that has been active - used for limiting analytics events

Constructors

Name Description

Public function

FDDoSDetection()

Default constructor

Functions

Name Description

Public function

bool

 

CheckLogRestrictions()

Accessor for bDDoSLogRestrictions - doubles as a per-frame logspam counter, automatically disabling logs after a quota

Protected function

bool

 

CheckNetConnLimits()

Performs periodic checks on NetConnection packet limits

Protected function

bool

 

CheckNonConnQuotasAndLimits()

Performs periodic checks on trigger quota's and packet limits, for non-NetConnection packets

Public function

void

 

CondCheckNetConnLimits()

Rate limited call to CheckNetConnLimits

Public function

void

 

CondCheckNonConnQuotasAndLimits()

Rate limited call to CheckNonConnQuotasAndLimits

Public function Const

int32

 

GetBadPacketCounter()

Public function Const

int32

 

GetDisconnPacketCounter()

Public function Const

int32

 

GetDroppedPacketCounter()

Public function Const

int32

 

GetErrorPacketCounter()

Public function Const

int32

 

GetNetConnPacketCounter()

Public function Const

int32

 

GetNonConnPacketCounter()

Public function

void

 

IncBadPacketCounter()

Public function

void

 

IncDisconnPacketCounter()

Public function

void

 

IncDroppedPacketCounter

(
    int32 Count
)

Public function

void

 

IncErrorPacketCounter()

Public function

void

 

IncNetConnPacketCounter()

Public function

void

 

IncNonConnPacketCounter()

Public function

void

 

Init

(
    int32 MaxTickRate
)

Initializes the DDoS detection settings

Public function

void

 

InitConfig()

Initializes the settings from the .ini file - must support reloading of settings on-the-fly

Public function Const

bool

 

IsDDoSAnalyticsEnabled()

Public function Const

bool

 

IsDDoSDetectionEnabled()

Public function

void

 

PostFrameReceive()

Triggered after packet receive ends, during the current frame

Public function

void

 

PreFrameReceive

(
    float DeltaTime
)

Triggered before packet receive begins, during the current frame

Public function Const

bool

 

ShouldBlockNetConnPackets()

Public function Const

bool

 

ShouldBlockNonConnPackets()

Public function

void

 

UpdateSeverity

(
    bool bEscalate
)

Updates the current DDoS detection severity state

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