Open 3D Engine AzNetworking API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AzNetworking::DtlsEndpoint Class Referencefinal

Helper class defining an encrypted DTLS endpoint. Note that multiple connections are multiplexed onto a single DTLS socket. More...

#include <DtlsEndpoint.h>

Public Types

enum class  ConnectResult { Failed , Pending , Complete }
 
enum class  HandshakeState {
  None , Connecting , Accepting , Complete ,
  Failed
}
 

Public Member Functions

ConnectResult Connect (const DtlsSocket &socket, const IpAddress &address, UdpPacketEncodingBuffer &outDtlsData)
 
ConnectResult Accept (const DtlsSocket &socket, const IpAddress &address)
 
bool IsConnecting () const
 
ConnectResult ProcessHandshakeData (UdpConnection &connection, const UdpPacketEncodingBuffer &dtlsData)
 
const uint8_t * DecodePacket (UdpConnection &connection, const uint8_t *encryptedData, int32_t encryptedSize, uint8_t *outDecodedData, int32_t &outDecodedSize)
 

Friends

class DtlsSocket
 

Detailed Description

Helper class defining an encrypted DTLS endpoint. Note that multiple connections are multiplexed onto a single DTLS socket.

Member Function Documentation

◆ Accept()

ConnectResult AzNetworking::DtlsEndpoint::Accept ( const DtlsSocket socket,
const IpAddress address 
)

Accepts a connection from the remote encrypted endpoint.

Parameters
socketthe dtls socket being used for data transmission
addressthe address of the remote endpoint connecting to us
Returns
a connect result specifying whether the connection is still pending, failed, or complete

◆ Connect()

ConnectResult AzNetworking::DtlsEndpoint::Connect ( const DtlsSocket socket,
const IpAddress address,
UdpPacketEncodingBuffer outDtlsData 
)

Opens a connection with the remote encrypted endpoint.

Parameters
socketthe dtls socket being used for data transmission
addressthe address of the remote endpoint being connected to
outDtlsDatadata buffer to store the dtls handshake packet
Returns
a connect result specifying whether the connection is still pending, failed, or complete

◆ DecodePacket()

const uint8_t * AzNetworking::DtlsEndpoint::DecodePacket ( UdpConnection connection,
const uint8_t *  encryptedData,
int32_t  encryptedSize,
uint8_t *  outDecodedData,
int32_t &  outDecodedSize 
)

If the endpoint has encryption enabled, this will decrypt the transmitted data and return the result.

Note
sizes have to be signed since OpenSSL often returns negative values to represent error results
Parameters
connectionthe UDP connection being used for data transmission
encryptedDatathe potentially encrypted data received from the socket
encryptedSizethe size of the received raw data
outDecodedDataan appropriately sized output buffer to store decrypted data
outDecodedSizethe size of the output buffer
Returns
pointer to the decoded data

◆ IsConnecting()

bool AzNetworking::DtlsEndpoint::IsConnecting ( ) const

Returns whether or not the endpoint is still negotiating the dtls handshake.

Returns
true if the endpoint is still in a connecting state

◆ ProcessHandshakeData()

ConnectResult AzNetworking::DtlsEndpoint::ProcessHandshakeData ( UdpConnection connection,
const UdpPacketEncodingBuffer dtlsData 
)

Attempts to complete the dtls handshake and establish an encrypted connection.

Parameters
connectionthe UDP connection being used for data transmission
dtlsDatadata buffer containing dtls handshake packet
Returns
a connect result specifying whether the connection is still pending, failed, or complete

The documentation for this class was generated from the following file: