Connection class for udp endpoints.
More...
#include <UdpConnection.h>
Inherits AzNetworking::IConnection.
|
bool | PrepareReliablePacketForSend (PacketId packetId, SequenceId reliableSequenceId, const IPacket &packet) |
|
void | ProcessSent (PacketId packetId, const IPacket &packet, uint32_t packetSize, ReliabilityType reliability) |
|
PacketTimeoutResult | ProcessTimeout (PacketId packetId, ReliabilityType reliability) |
|
bool | ProcessReceived (UdpPacketHeader &header, const NetworkOutputSerializer &serializer, uint32_t packetSize, AZ::TimeMs currentTimeMs) |
|
PacketDispatchResult | HandleCorePacket (IConnectionListener &listener, UdpPacketHeader &header, ISerializer &serializer) |
|
| AZ_DISABLE_COPY_MOVE (UdpConnection) |
|
|
UdpNetworkInterface & | m_networkInterface |
|
UdpPacketTracker | m_packetTracker |
|
UdpReliableQueue | m_reliableQueue |
|
UdpFragmentQueue | m_fragmentQueue |
|
ConnectionState | m_state = ConnectionState::Disconnected |
|
ConnectionRole | m_connectionRole = ConnectionRole::Connector |
|
DtlsEndpoint | m_dtlsEndpoint |
|
AZ::TimeMs | m_lastSentPacketMs |
|
uint32_t | m_unackedPacketCount = 0 |
|
uint32_t | m_connectionMtu = MaxUdpTransmissionUnit |
|
TimeoutId | m_timeoutId |
|
uint32_t | m_timeoutCounter = 0 |
|
AZStd::mutex | m_sendPacketMutex |
|
|
class | UdpFragmentQueue |
|
class | UdpNetworkInterface |
|
Connection class for udp endpoints.
◆ UdpConnection()
AzNetworking::UdpConnection::UdpConnection |
( |
ConnectionId |
connectionId, |
|
|
const IpAddress & |
remoteAddress, |
|
|
UdpNetworkInterface & |
networkInterface, |
|
|
ConnectionRole |
connectionRole |
|
) |
| |
Constructor
- Parameters
-
connectionId | the connection identifier to use for this connection |
remoteAddress | the remote address this connection |
networkInterface | reference of the network interface that owns this connection instance |
connectionRole | whether this connection was the connector or acceptor |
◆ Disconnect()
bool AzNetworking::UdpConnection::Disconnect |
( |
DisconnectReason |
reason, |
|
|
TerminationEndpoint |
endpoint |
|
) |
| |
|
overridevirtual |
Disconnects the connection with the provided termination reason
- Parameters
-
reason | reason for the disconnect |
endpoint | which endpoint initiated the disconnect, local or remote |
- Returns
- boolean true on success
Implements AzNetworking::IConnection.
◆ GetConnectionMtu()
uint32_t AzNetworking::UdpConnection::GetConnectionMtu |
( |
| ) |
const |
|
overridevirtual |
Returns the connection maximum transmission unit. Currently unsupported on TcpConnections
- Returns
- the max transmission unit for this connection
Implements AzNetworking::IConnection.
◆ GetConnectionRole()
ConnectionRole AzNetworking::UdpConnection::GetConnectionRole |
( |
| ) |
const |
|
overridevirtual |
Retrieves the connection role of this connection instance, whether it was initiated or accepted.
- Returns
- whether this connection was initiated or accepted
Implements AzNetworking::IConnection.
◆ GetConnectionState()
ConnectionState AzNetworking::UdpConnection::GetConnectionState |
( |
| ) |
const |
|
overridevirtual |
◆ GetDtlsEndpoint()
DtlsEndpoint & AzNetworking::UdpConnection::GetDtlsEndpoint |
( |
| ) |
|
|
inline |
Returns a suitable encryption endpoint for this connection type.
- Returns
- reference to the connections encryption endpoint
◆ GetPacketTracker() [1/2]
Retrieves packet delivery tracker instance for the specified connection.
- Returns
- reference to the requested packet tracker instance
◆ GetPacketTracker() [2/2]
const UdpPacketTracker & AzNetworking::UdpConnection::GetPacketTracker |
( |
| ) |
const |
|
inline |
Retrieves packet delivery tracker instance for the specified connection.
- Returns
- reference to the requested packet tracker instance
◆ GetReliableQueueSize()
uint32_t AzNetworking::UdpConnection::GetReliableQueueSize |
( |
| ) |
const |
|
inline |
Returns the number of unacked reliable messages still pending in the reliable queue.
- Returns
- the number of unacked reliable messages still pending in the reliable queue
◆ GetTimeoutId()
TimeoutId AzNetworking::UdpConnection::GetTimeoutId |
( |
| ) |
const |
|
inline |
Retrieves the timeout identifier for this connection instance.
- Returns
- the timeout identifier for this connection instance
◆ HandleCorePacket()
Handle a core network packet.
- Parameters
-
listener | a connection listener to receive connection related events |
header | the packet header received to process |
serializer | the output serializer containing the transmitted packet data |
- Returns
- PacketDispatchResult result of processing the core packet
◆ PrepareReliablePacketForSend()
bool AzNetworking::UdpConnection::PrepareReliablePacketForSend |
( |
PacketId |
packetId, |
|
|
SequenceId |
reliableSequenceId, |
|
|
const IPacket & |
packet |
|
) |
| |
|
inlineprotected |
Prepare a reliable packet for transmission.
- Parameters
-
packetId | identifier of the packet being sent |
packet | reference to the packet being transmitted |
- Returns
- boolean true on success, false on failure
◆ ProcessAcked()
void AzNetworking::UdpConnection::ProcessAcked |
( |
PacketId |
packetId, |
|
|
AZ::TimeMs |
currentTimeMs |
|
) |
| |
Acks a packetId.
- Parameters
-
packetId | the PacketId of the packet being acked |
currentTimeMs | current wall clock time in milliseconds |
◆ ProcessHandshakeData()
DtlsEndpoint::ConnectResult AzNetworking::UdpConnection::ProcessHandshakeData |
( |
const UdpPacketEncodingBuffer & |
dtlsData | ) |
|
Helper to exchange dtls handshake data during connection handshake
- Parameters
-
dtlsData | data buffer containing dtls handshake packet |
- Returns
- the current result code for the dtls handshake operation, failed, pending, or complete
◆ ProcessReceived()
Process a received packet header.
- Parameters
-
header | the packet header received to process |
serializer | the output serializer containing the transmitted packet data |
packetSize | the size of the received packet in bytes |
currentTimeMs | current wall clock time in milliseconds |
- Returns
- boolean true on successful handling of the received header
◆ ProcessSent()
void AzNetworking::UdpConnection::ProcessSent |
( |
PacketId |
packetId, |
|
|
const IPacket & |
packet, |
|
|
uint32_t |
packetSize, |
|
|
ReliabilityType |
reliability |
|
) |
| |
|
protected |
Process a packet for sending.
- Parameters
-
packetId | identifier of the packet being sent |
packet | reference to the packet being transmitted |
packetSize | packet size in bytes |
reliability | whether or not to guarantee delivery |
◆ ProcessTimeout()
PacketTimeoutResult AzNetworking::UdpConnection::ProcessTimeout |
( |
PacketId |
packetId, |
|
|
ReliabilityType |
reliability |
|
) |
| |
|
protected |
Process a timed out packet header.
- Parameters
-
packetId | identifier of the packet that timed out |
reliability | whether or not the packet that timed out was marked reliable |
- Returns
- PacketTimeoutResult::Acked if the packet was confirmed to be received prior to timeout, PacketTimeoutResult::Lost if not
◆ SendUnreliablePacket()
PacketId AzNetworking::UdpConnection::SendUnreliablePacket |
( |
const IPacket & |
packet | ) |
|
|
overridevirtual |
A helper function that transmits a packet on this connection unreliably.
- Parameters
-
- Returns
- the unreliable packet identifier of the transmitted packet
Implements AzNetworking::IConnection.
◆ SetConnectionMtu()
void AzNetworking::UdpConnection::SetConnectionMtu |
( |
uint32_t |
connectionMtu | ) |
|
|
overridevirtual |
Sets connection maximum transmission unit for this connection. Currently unsupported on TcpConnections
- Parameters
-
connectionMtu | the max transmission unit for this connection |
Implements AzNetworking::IConnection.
◆ SetTimeoutId()
void AzNetworking::UdpConnection::SetTimeoutId |
( |
TimeoutId |
timeoutId | ) |
|
|
inline |
Sets the timeout identifier for this connection instance.
- Parameters
-
timeoutId | the timeoutId to use for this connection instance |
◆ UpdateHeartbeat()
void AzNetworking::UdpConnection::UpdateHeartbeat |
( |
AZ::TimeMs |
currentTimeMs | ) |
|
Updates the connection heartbeat if active.
- Parameters
-
currentTimeMs | current wall clock time in milliseconds |
◆ WasPacketAcked()
bool AzNetworking::UdpConnection::WasPacketAcked |
( |
PacketId |
packetId | ) |
const |
|
overridevirtual |
Returns true if the given packet id was confirmed acknowledged by the remote endpoint, false otherwise.
- Parameters
-
packetId | the packet id of the packet to confirm acknowledgment of |
- Returns
- boolean true if the packet is confirmed acknowledged, false if the packet number is out of range, lost, or still pending acknowledgment
Implements AzNetworking::IConnection.
The documentation for this class was generated from the following files:
- Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.h
- Code/Framework/AzNetworking/AzNetworking/UdpTransport/UdpConnection.inl