![]() |
Open 3D Engine GridMate API Reference
2205.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
|
#include <TrafficControl.h>
Inherited by GridMate::DefaultTrafficControl.
Classes | |
struct | CongestionState |
struct | DataGramControlData |
struct | Statistics |
struct | TrafficControlConnection |
Public Types | |
typedef TrafficControlConnection * | TrafficControlConnectionId |
Carrier thread connection identifier. | |
Public Member Functions | |
virtual void | OnConnect (TrafficControlConnectionId id, const AZStd::intrusive_ptr< DriverAddress > &address)=0 |
Called when Carrier has established a new connection. | |
virtual void | OnDisconnect (TrafficControlConnectionId id)=0 |
Called when Carrier has lost a connection. | |
virtual void | OnHandshakeComplete (TrafficControlConnectionId id)=0 |
Called when Carrier completed successful handshake. Usually NAT punch happens during the handshake, which can result is high packet loss. | |
virtual void | OnSend (TrafficControlConnectionId id, DataGramControlData &info)=0 |
Called when Carrier has send a package. | |
virtual void | OnSendAck (TrafficControlConnectionId id)=0 |
Called when Carrier has send an ACK/NACK data with the packet. | |
virtual void | OnReSend (TrafficControlConnectionId id, DataGramControlData &info, unsigned int resendDataSize)=0 |
Called when Carrier has resend a package. | |
virtual void | OnAck (TrafficControlConnectionId id, DataGramControlData &info, bool &windowChanged)=0 |
Called when Carrier confirmed a package delivery. | |
virtual void | OnNAck (TrafficControlConnectionId id, DataGramControlData &info)=0 |
Called when we receive a NAck for a package delivery. | |
virtual void | OnReceived (TrafficControlConnectionId id, DataGramControlData &info)=0 |
Called when Carrier receives a package. | |
virtual bool | IsSend (TrafficControlConnectionId id)=0 |
Return true if we can send a package. Otherwise false. | |
virtual bool | IsSendAck (TrafficControlConnectionId id)=0 |
Return true if you should send ACK/NACK data at this time. | |
virtual unsigned int | GetAvailableWindowSize (TrafficControlConnectionId id) const =0 |
Return number of bytes we are allowed to send at the moment. The size can/will vary over time. | |
virtual bool | IsResend (TrafficControlConnectionId id, const DataGramControlData &info, unsigned int resendDataSize)=0 |
virtual TimeStamp | GetResendTime (TrafficControlConnectionId id, const DataGramControlData &info)=0 |
virtual bool | IsDisconnect (TrafficControlConnectionId id, float conditionThreshold)=0 |
Verify traffic conditions and disconnect if needed. This usually happens when we have bad conditions. Too much latency or high packet loss. | |
virtual bool | IsCanReceiveData (TrafficControlConnectionId id) const =0 |
Verify we are able to receive data from a given address. | |
virtual bool | IsSendACKOnly (TrafficControlConnectionId id) const =0 |
virtual bool | Update ()=0 |
Update/Tick returns true if we have updated the statistics (which we can read by QueryStatistics) | |
virtual void | QueryStatistics (TrafficControlConnectionId id, Statistics *lastSecond=nullptr, Statistics *lifetime=nullptr, Statistics *effectiveLastSecond=nullptr, Statistics *effectiveLifetime=nullptr) const =0 |
virtual void | QueryCongestionState (TrafficControlConnectionId id, CongestionState *congestionState) const =0 |
Traffic control interface implements the traffic flow to all connections. It should handle issues like congestion, etc.
|
pure virtual |
Returns the timestamp for retransmission
Implemented in GridMate::DefaultTrafficControl.
|
pure virtual |
Called for every package waiting for Ack. If this function returns true the packet will be considered lost. You should resend it and call OnReSend function ASAP.
Implemented in GridMate::DefaultTrafficControl.
|
pure virtual |
Returns true if you need to send a ACK only (empty datagram) due to time and/or number of received datagrams. If you already have data to send ACK will be included in the datagram anyway. This function should be checked only if you have no data to send.
Implemented in GridMate::DefaultTrafficControl.
|
pure virtual |
Stores current congestion state into the provided block.
Implemented in GridMate::DefaultTrafficControl.
|
pure virtual |
Stores connection statistics, it's ok to pass NULL for any of the statistics
id | Connection ID |
lastSecond | last second statistics for all data |
lifetime | lifetime statistics for all data |
effectiveLastSecond | last second statistics for effective data (actual data - carrier overhead excluded) |
effectiveLifetime | lifetime statistics for effective data (actual data - carrier overhead excluded) |
Implemented in GridMate::DefaultTrafficControl.