Amazon Kinesis Webrtc C SDK
TurnConnection.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  TurnChannelData
 
struct  TurnConnectionCallbacks
 
struct  TurnPeer
 
struct  TurnProfileDiagnostics
 
struct  __TurnConnection
 

Macros

#define TURN_REQUEST_TRANSPORT_UDP   17
 
#define TURN_REQUEST_TRANSPORT_TCP   6
 
#define DEFAULT_TURN_ALLOCATION_LIFETIME_SECONDS   600
 
#define TURN_PERMISSION_LIFETIME   (300 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_TIMER_INTERVAL_BEFORE_READY   (50 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)
 
#define DEFAULT_TURN_TIMER_INTERVAL_AFTER_READY   (1 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_SEND_REFRESH_INVERVAL   (1 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_GET_CREDENTIAL_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_ALLOCATION_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_CREATE_PERMISSION_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_BIND_CHANNEL_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_CLEAN_UP_TIMEOUT   (10 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_ALLOCATION_REFRESH_GRACE_PERIOD   (30 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define DEFAULT_TURN_PERMISSION_REFRESH_GRACE_PERIOD   (30 * HUNDREDS_OF_NANOS_IN_A_SECOND)
 
#define MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE   4 + 65536 /* header + data */
 
#define DEFAULT_TURN_MESSAGE_SEND_CHANNEL_DATA_BUFFER_LEN   MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE
 
#define DEFAULT_TURN_MESSAGE_RECV_CHANNEL_DATA_BUFFER_LEN   MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE
 
#define DEFAULT_TURN_CHANNEL_DATA_BUFFER_SIZE   512
 
#define DEFAULT_TURN_MAX_PEER_COUNT   32
 
#define MAX_TURN_PROFILE_LOG_DESC_LEN   256
 
#define TURN_CHANNEL_BIND_CHANNEL_NUMBER_BASE   (UINT16) 0x4000
 
#define TURN_DATA_CHANNEL_SEND_OVERHEAD   4
 
#define TURN_DATA_CHANNEL_MSG_FIRST_BYTE   0x40
 
#define TURN_STATE_MACHINE_NAME   (PCHAR) "TURN"
 
#define TURN_STATE_NEW_STR   (PCHAR) "TURN_STATE_NEW"
 
#define TURN_STATE_CHECK_SOCKET_CONNECTION_STR   (PCHAR) "TURN_STATE_CHECK_SOCKET_CONNECTION"
 
#define TURN_STATE_GET_CREDENTIALS_STR   (PCHAR) "TURN_STATE_GET_CREDENTIALS"
 
#define TURN_STATE_ALLOCATION_STR   (PCHAR) "TURN_STATE_ALLOCATION"
 
#define TURN_STATE_CREATE_PERMISSION_STR   (PCHAR) "TURN_STATE_CREATE_PERMISSION"
 
#define TURN_STATE_BIND_CHANNEL_STR   (PCHAR) "TURN_STATE_BIND_CHANNEL"
 
#define TURN_STATE_READY_STR   (PCHAR) "TURN_STATE_READY"
 
#define TURN_STATE_CLEAN_UP_STR   (PCHAR) "TURN_STATE_CLEAN_UP"
 
#define TURN_STATE_FAILED_STR   (PCHAR) "TURN_STATE_FAILED"
 
#define TURN_STATE_UNKNOWN_STR   (PCHAR) "TURN_STATE_UNKNOWN"
 

Typedefs

typedef STATUS(* RelayAddressAvailableFunc) (UINT64, PKvsIpAddress, PSocketConnection)
 
typedef STATUS(* TurnStateFailedFunc) (PSocketConnection, UINT64)
 
typedef struct TurnChannelDataPTurnChannelData
 
typedef struct TurnConnectionCallbacksPTurnConnectionCallbacks
 
typedef struct TurnPeerPTurnPeer
 
typedef struct TurnProfileDiagnosticsPTurnProfileDiagnostics
 
typedef struct __TurnConnection TurnConnection
 
typedef struct __TurnConnectionPTurnConnection
 

Enumerations

enum  TURN_PEER_CONNECTION_STATE { TURN_PEER_CONN_STATE_CREATE_PERMISSION , TURN_PEER_CONN_STATE_BIND_CHANNEL , TURN_PEER_CONN_STATE_READY , TURN_PEER_CONN_STATE_FAILED }
 
enum  TURN_CONNECTION_DATA_TRANSFER_MODE { TURN_CONNECTION_DATA_TRANSFER_MODE_SEND_INDIDATION , TURN_CONNECTION_DATA_TRANSFER_MODE_DATA_CHANNEL }
 

Functions

STATUS createTurnConnection (PIceServer, TIMER_QUEUE_HANDLE, TURN_CONNECTION_DATA_TRANSFER_MODE, KVS_SOCKET_PROTOCOL, PTurnConnectionCallbacks, PSocketConnection, PConnectionListener, PTurnConnection *)
 
STATUS freeTurnConnection (PTurnConnection *)
 
STATUS turnConnectionAddPeer (PTurnConnection, PKvsIpAddress)
 
STATUS turnConnectionSendData (PTurnConnection, PBYTE, UINT32, PKvsIpAddress)
 
STATUS turnConnectionStart (PTurnConnection)
 
STATUS turnConnectionShutdown (PTurnConnection, UINT64)
 
BOOL turnConnectionIsShutdownComplete (PTurnConnection)
 
BOOL turnConnectionGetRelayAddress (PTurnConnection, PKvsIpAddress)
 
STATUS turnConnectionRefreshAllocation (PTurnConnection)
 
STATUS turnConnectionRefreshPermission (PTurnConnection, PBOOL)
 
STATUS turnConnectionFreePreAllocatedPackets (PTurnConnection)
 
UINT64 turnConnectionGetTime (UINT64)
 
STATUS turnConnectionUpdateNonce (PTurnConnection)
 
STATUS turnConnectionTimerCallback (UINT32, UINT64, UINT64)
 
STATUS turnConnectionGetLongTermKey (PCHAR, PCHAR, PCHAR, PBYTE, UINT32)
 
STATUS turnConnectionPackageTurnAllocationRequest (PCHAR, PCHAR, PBYTE, UINT16, UINT32, PStunPacket *)
 
STATUS turnConnectionIncomingDataHandler (PTurnConnection, PBYTE, UINT32, PKvsIpAddress, PKvsIpAddress, PTurnChannelData, PUINT32)
 
STATUS turnConnectionHandleStun (PTurnConnection, PBYTE, UINT32)
 
STATUS turnConnectionHandleStunError (PTurnConnection, PBYTE, UINT32)
 
STATUS turnConnectionHandleChannelData (PTurnConnection, PBYTE, UINT32, PTurnChannelData, PUINT32, PUINT32)
 
STATUS turnConnectionHandleChannelDataTcpMode (PTurnConnection, PBYTE, UINT32, PTurnChannelData, PUINT32, PUINT32)
 
VOID turnConnectionFatalError (PTurnConnection, STATUS)
 
PTurnPeer turnConnectionGetPeerWithChannelNumber (PTurnConnection, UINT16)
 
PTurnPeer turnConnectionGetPeerWithIp (PTurnConnection, PKvsIpAddress)
 
STATUS checkTurnPeerConnections (PTurnConnection)
 

Macro Definition Documentation

◆ DEFAULT_TURN_ALLOCATION_LIFETIME_SECONDS

#define DEFAULT_TURN_ALLOCATION_LIFETIME_SECONDS   600

◆ DEFAULT_TURN_ALLOCATION_REFRESH_GRACE_PERIOD

#define DEFAULT_TURN_ALLOCATION_REFRESH_GRACE_PERIOD   (30 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_ALLOCATION_TIMEOUT

#define DEFAULT_TURN_ALLOCATION_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_BIND_CHANNEL_TIMEOUT

#define DEFAULT_TURN_BIND_CHANNEL_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_CHANNEL_DATA_BUFFER_SIZE

#define DEFAULT_TURN_CHANNEL_DATA_BUFFER_SIZE   512

◆ DEFAULT_TURN_CLEAN_UP_TIMEOUT

#define DEFAULT_TURN_CLEAN_UP_TIMEOUT   (10 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_CREATE_PERMISSION_TIMEOUT

#define DEFAULT_TURN_CREATE_PERMISSION_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_GET_CREDENTIAL_TIMEOUT

#define DEFAULT_TURN_GET_CREDENTIAL_TIMEOUT   (5 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_MAX_PEER_COUNT

#define DEFAULT_TURN_MAX_PEER_COUNT   32

◆ DEFAULT_TURN_MESSAGE_RECV_CHANNEL_DATA_BUFFER_LEN

#define DEFAULT_TURN_MESSAGE_RECV_CHANNEL_DATA_BUFFER_LEN   MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE

◆ DEFAULT_TURN_MESSAGE_SEND_CHANNEL_DATA_BUFFER_LEN

#define DEFAULT_TURN_MESSAGE_SEND_CHANNEL_DATA_BUFFER_LEN   MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE

◆ DEFAULT_TURN_PERMISSION_REFRESH_GRACE_PERIOD

#define DEFAULT_TURN_PERMISSION_REFRESH_GRACE_PERIOD   (30 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_SEND_REFRESH_INVERVAL

#define DEFAULT_TURN_SEND_REFRESH_INVERVAL   (1 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_TIMER_INTERVAL_AFTER_READY

#define DEFAULT_TURN_TIMER_INTERVAL_AFTER_READY   (1 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ DEFAULT_TURN_TIMER_INTERVAL_BEFORE_READY

#define DEFAULT_TURN_TIMER_INTERVAL_BEFORE_READY   (50 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)

◆ MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE

#define MAX_TURN_CHANNEL_DATA_MESSAGE_SIZE   4 + 65536 /* header + data */

◆ MAX_TURN_PROFILE_LOG_DESC_LEN

#define MAX_TURN_PROFILE_LOG_DESC_LEN   256

◆ TURN_CHANNEL_BIND_CHANNEL_NUMBER_BASE

#define TURN_CHANNEL_BIND_CHANNEL_NUMBER_BASE   (UINT16) 0x4000

◆ TURN_DATA_CHANNEL_MSG_FIRST_BYTE

#define TURN_DATA_CHANNEL_MSG_FIRST_BYTE   0x40

◆ TURN_DATA_CHANNEL_SEND_OVERHEAD

#define TURN_DATA_CHANNEL_SEND_OVERHEAD   4

◆ TURN_PERMISSION_LIFETIME

#define TURN_PERMISSION_LIFETIME   (300 * HUNDREDS_OF_NANOS_IN_A_SECOND)

◆ TURN_REQUEST_TRANSPORT_TCP

#define TURN_REQUEST_TRANSPORT_TCP   6

◆ TURN_REQUEST_TRANSPORT_UDP

#define TURN_REQUEST_TRANSPORT_UDP   17

◆ TURN_STATE_ALLOCATION_STR

#define TURN_STATE_ALLOCATION_STR   (PCHAR) "TURN_STATE_ALLOCATION"

◆ TURN_STATE_BIND_CHANNEL_STR

#define TURN_STATE_BIND_CHANNEL_STR   (PCHAR) "TURN_STATE_BIND_CHANNEL"

◆ TURN_STATE_CHECK_SOCKET_CONNECTION_STR

#define TURN_STATE_CHECK_SOCKET_CONNECTION_STR   (PCHAR) "TURN_STATE_CHECK_SOCKET_CONNECTION"

◆ TURN_STATE_CLEAN_UP_STR

#define TURN_STATE_CLEAN_UP_STR   (PCHAR) "TURN_STATE_CLEAN_UP"

◆ TURN_STATE_CREATE_PERMISSION_STR

#define TURN_STATE_CREATE_PERMISSION_STR   (PCHAR) "TURN_STATE_CREATE_PERMISSION"

◆ TURN_STATE_FAILED_STR

#define TURN_STATE_FAILED_STR   (PCHAR) "TURN_STATE_FAILED"

◆ TURN_STATE_GET_CREDENTIALS_STR

#define TURN_STATE_GET_CREDENTIALS_STR   (PCHAR) "TURN_STATE_GET_CREDENTIALS"

◆ TURN_STATE_MACHINE_NAME

#define TURN_STATE_MACHINE_NAME   (PCHAR) "TURN"

◆ TURN_STATE_NEW_STR

#define TURN_STATE_NEW_STR   (PCHAR) "TURN_STATE_NEW"

◆ TURN_STATE_READY_STR

#define TURN_STATE_READY_STR   (PCHAR) "TURN_STATE_READY"

◆ TURN_STATE_UNKNOWN_STR

#define TURN_STATE_UNKNOWN_STR   (PCHAR) "TURN_STATE_UNKNOWN"

Typedef Documentation

◆ PTurnChannelData

◆ PTurnConnection

◆ PTurnConnectionCallbacks

◆ PTurnPeer

typedef struct TurnPeer * PTurnPeer

◆ PTurnProfileDiagnostics

◆ RelayAddressAvailableFunc

typedef STATUS(* RelayAddressAvailableFunc) (UINT64, PKvsIpAddress, PSocketConnection)

◆ TurnConnection

◆ TurnStateFailedFunc

typedef STATUS(* TurnStateFailedFunc) (PSocketConnection, UINT64)

Enumeration Type Documentation

◆ TURN_CONNECTION_DATA_TRANSFER_MODE

Enumerator
TURN_CONNECTION_DATA_TRANSFER_MODE_SEND_INDIDATION 
TURN_CONNECTION_DATA_TRANSFER_MODE_DATA_CHANNEL 

◆ TURN_PEER_CONNECTION_STATE

Enumerator
TURN_PEER_CONN_STATE_CREATE_PERMISSION 
TURN_PEER_CONN_STATE_BIND_CHANNEL 
TURN_PEER_CONN_STATE_READY 
TURN_PEER_CONN_STATE_FAILED 

Function Documentation

◆ checkTurnPeerConnections()

STATUS checkTurnPeerConnections ( PTurnConnection  pTurnConnection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createTurnConnection()

STATUS createTurnConnection ( PIceServer  pTurnServer,
TIMER_QUEUE_HANDLE  timerQueueHandle,
TURN_CONNECTION_DATA_TRANSFER_MODE  dataTransferMode,
KVS_SOCKET_PROTOCOL  protocol,
PTurnConnectionCallbacks  pTurnConnectionCallbacks,
PSocketConnection  pTurnSocket,
PConnectionListener  pConnectionListener,
PTurnConnection ppTurnConnection 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeTurnConnection()

STATUS freeTurnConnection ( PTurnConnection ppTurnConnection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionAddPeer()

STATUS turnConnectionAddPeer ( PTurnConnection  pTurnConnection,
PKvsIpAddress  pPeerAddress 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionFatalError()

VOID turnConnectionFatalError ( PTurnConnection  pTurnConnection,
STATUS  errorStatus 
)

◆ turnConnectionFreePreAllocatedPackets()

STATUS turnConnectionFreePreAllocatedPackets ( PTurnConnection  pTurnConnection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionGetLongTermKey()

STATUS turnConnectionGetLongTermKey ( PCHAR  username,
PCHAR  realm,
PCHAR  password,
PBYTE  pBuffer,
UINT32  bufferLen 
)
Here is the caller graph for this function:

◆ turnConnectionGetPeerWithChannelNumber()

PTurnPeer turnConnectionGetPeerWithChannelNumber ( PTurnConnection  pTurnConnection,
UINT16  channelNumber 
)
Here is the caller graph for this function:

◆ turnConnectionGetPeerWithIp()

PTurnPeer turnConnectionGetPeerWithIp ( PTurnConnection  pTurnConnection,
PKvsIpAddress  pKvsIpAddress 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionGetRelayAddress()

BOOL turnConnectionGetRelayAddress ( PTurnConnection  pTurnConnection,
PKvsIpAddress  pKvsIpAddress 
)
Here is the caller graph for this function:

◆ turnConnectionGetTime()

UINT64 turnConnectionGetTime ( UINT64  customData)
Here is the caller graph for this function:

◆ turnConnectionHandleChannelData()

STATUS turnConnectionHandleChannelData ( PTurnConnection  pTurnConnection,
PBYTE  pBuffer,
UINT32  bufferLen,
PTurnChannelData  pChannelData,
PUINT32  pChannelDataCount,
PUINT32  pProcessedDataLen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionHandleChannelDataTcpMode()

STATUS turnConnectionHandleChannelDataTcpMode ( PTurnConnection  pTurnConnection,
PBYTE  pBuffer,
UINT32  bufferLen,
PTurnChannelData  pChannelData,
PUINT32  pTurnChannelDataCount,
PUINT32  pProcessedDataLen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionHandleStun()

STATUS turnConnectionHandleStun ( PTurnConnection  pTurnConnection,
PBYTE  pBuffer,
UINT32  bufferLen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionHandleStunError()

STATUS turnConnectionHandleStunError ( PTurnConnection  pTurnConnection,
PBYTE  pBuffer,
UINT32  bufferLen 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionIncomingDataHandler()

STATUS turnConnectionIncomingDataHandler ( PTurnConnection  pTurnConnection,
PBYTE  pBuffer,
UINT32  bufferLen,
PKvsIpAddress  pSrc,
PKvsIpAddress  pDest,
PTurnChannelData  channelDataList,
PUINT32  pChannelDataCount 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionIsShutdownComplete()

BOOL turnConnectionIsShutdownComplete ( PTurnConnection  pTurnConnection)
Here is the caller graph for this function:

◆ turnConnectionPackageTurnAllocationRequest()

STATUS turnConnectionPackageTurnAllocationRequest ( PCHAR  username,
PCHAR  realm,
PBYTE  nonce,
UINT16  nonceLen,
UINT32  lifetime,
PStunPacket ppStunPacket 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionRefreshAllocation()

STATUS turnConnectionRefreshAllocation ( PTurnConnection  pTurnConnection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionRefreshPermission()

STATUS turnConnectionRefreshPermission ( PTurnConnection  pTurnConnection,
PBOOL  pNeedRefresh 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionSendData()

STATUS turnConnectionSendData ( PTurnConnection  pTurnConnection,
PBYTE  pBuf,
UINT32  bufLen,
PKvsIpAddress  pDestIp 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionShutdown()

STATUS turnConnectionShutdown ( PTurnConnection  pTurnConnection,
UINT64  waitUntilAllocationFreedTimeout 
)
Here is the caller graph for this function:

◆ turnConnectionStart()

STATUS turnConnectionStart ( PTurnConnection  pTurnConnection)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionTimerCallback()

STATUS turnConnectionTimerCallback ( UINT32  timerId,
UINT64  currentTime,
UINT64  customData 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ turnConnectionUpdateNonce()

STATUS turnConnectionUpdateNonce ( PTurnConnection  pTurnConnection)
Here is the call graph for this function:
Here is the caller graph for this function: