Amazon Kinesis Webrtc C SDK
Loading...
Searching...
No Matches
Dtls.h File Reference
#include "Tls.h"
Include dependency graph for Dtls.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  DtlsSessionCallbacks
struct  DtlsSessionOptions
struct  DtlsKeyingMaterial
struct  __DtlsSession

Macros

#define MAX_SRTP_MASTER_KEY_LEN   16
#define MAX_SRTP_SALT_KEY_LEN   14
#define MAX_DTLS_RANDOM_BYTES_LEN   32
#define MAX_DTLS_MASTER_KEY_LEN   48
#define GENERATED_CERTIFICATE_MAX_SIZE   4096
#define GENERATED_CERTIFICATE_BITS   2048
#define DTLS_CERT_MIN_SERIAL_NUM_SIZE   8
#define DTLS_CERT_MAX_SERIAL_NUM_SIZE   20
#define GENERATED_CERTIFICATE_DAYS   365
#define GENERATED_CERTIFICATE_NAME   "KVS-WebRTC-Client"
#define KEYING_EXTRACTOR_LABEL   "EXTRACTOR-dtls_srtp"
#define DTLS_FINGERPRINT_SHA256_HASH_NAME   "sha-256"
#define DTLS_FINGERPRINT_SHA256_PREFIX   DTLS_FINGERPRINT_SHA256_HASH_NAME " "
#define DTLS_FINGERPRINT_SHA256_PREFIX_LEN   (SIZEOF(DTLS_FINGERPRINT_SHA256_PREFIX) - 1)
#define DTLS_TRANSMISSION_INTERVAL   (200 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)
#define DTLS_SESSION_TIMER_START_DELAY   (100 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)
#define SECONDS_IN_A_DAY   (24 * 60 * 60LL)
#define HUNDREDS_OF_NANOS_IN_A_DAY   (HUNDREDS_OF_NANOS_IN_AN_HOUR * 24LL)

Typedefs

typedef VOID(* DtlsSessionOutboundPacketFunc) (UINT64, PBYTE, UINT32)
typedef VOID(* DtlsSessionOnStateChange) (UINT64, RTC_DTLS_TRANSPORT_STATE)
typedef struct DtlsSessionCallbacks * PDtlsSessionCallbacks
typedef struct DtlsSessionOptions * PDtlsSessionOptions
typedef struct DtlsKeyingMaterial * PDtlsKeyingMaterial
typedef struct __DtlsSession DtlsSession
typedef struct __DtlsSession * PDtlsSession

Enumerations

enum  RTC_DTLS_TRANSPORT_STATE {
  RTC_DTLS_TRANSPORT_STATE_NEW , RTC_DTLS_TRANSPORT_STATE_CONNECTING , RTC_DTLS_TRANSPORT_STATE_CONNECTED , RTC_DTLS_TRANSPORT_STATE_CLOSED ,
  RTC_DTLS_TRANSPORT_STATE_FAILED
}
enum  DTLS_HANDSHAKE_STATE { DTLS_STATE_HANDSHAKE_NEW , DTLS_STATE_HANDSHAKE_IN_PROGRESS , DTLS_STATE_HANDSHAKE_COMPLETED , DTLS_STATE_HANDSHAKE_ERROR }
enum  DTLS_SESSION_VALIDATION_MODE { DTLS_SESSION_VALIDATION_MODE_RELAXED , DTLS_SESSION_VALIDATION_MODE_STRICT_SERVER }

Functions

STATUS createDtlsSession (PDtlsSessionCallbacks, TIMER_QUEUE_HANDLE, INT32, BOOL, PRtcCertificate, PDtlsSession *)
STATUS createDtlsSessionWithOptions (PDtlsSessionCallbacks, TIMER_QUEUE_HANDLE, INT32, BOOL, PRtcCertificate, PDtlsSessionOptions, PDtlsSession *)
STATUS freeDtlsSession (PDtlsSession *)
STATUS dtlsSessionStart (PDtlsSession, BOOL)
STATUS dtlsSessionProcessPacket (PDtlsSession, PBYTE, PINT32)
STATUS dtlsSessionIsInitFinished (PDtlsSession, PBOOL)
STATUS dtlsSessionPopulateKeyingMaterial (PDtlsSession, PDtlsKeyingMaterial)
STATUS dtlsSessionGetLocalCertificateFingerprint (PDtlsSession, PCHAR, UINT32)
STATUS dtlsSessionVerifyRemoteCertificateFingerprint (PDtlsSession, PCHAR)
STATUS dtlsSessionPutApplicationData (PDtlsSession, PBYTE, INT32)
STATUS dtlsSessionShutdown (PDtlsSession)
STATUS dtlsSessionOnOutBoundData (PDtlsSession, UINT64, DtlsSessionOutboundPacketFunc)
STATUS dtlsSessionOnStateChange (PDtlsSession, UINT64, DtlsSessionOnStateChange)
STATUS dtlsSessionHandshakeInThread (PDtlsSession, BOOL)
STATUS dtlsValidateRtcCertificates (PRtcCertificate, PUINT32)
STATUS dtlsSessionChangeState (PDtlsSession, RTC_DTLS_TRANSPORT_STATE)
STATUS dtlsSessionCopyOptions (PDtlsSession, PDtlsSessionOptions)
STATUS dtlsFillPseudoRandomBits (PBYTE, UINT32)

Macro Definition Documentation

◆ DTLS_CERT_MAX_SERIAL_NUM_SIZE

#define DTLS_CERT_MAX_SERIAL_NUM_SIZE   20

◆ DTLS_CERT_MIN_SERIAL_NUM_SIZE

#define DTLS_CERT_MIN_SERIAL_NUM_SIZE   8

◆ DTLS_FINGERPRINT_SHA256_HASH_NAME

#define DTLS_FINGERPRINT_SHA256_HASH_NAME   "sha-256"

◆ DTLS_FINGERPRINT_SHA256_PREFIX

#define DTLS_FINGERPRINT_SHA256_PREFIX   DTLS_FINGERPRINT_SHA256_HASH_NAME " "

◆ DTLS_FINGERPRINT_SHA256_PREFIX_LEN

#define DTLS_FINGERPRINT_SHA256_PREFIX_LEN   (SIZEOF(DTLS_FINGERPRINT_SHA256_PREFIX) - 1)

◆ DTLS_SESSION_TIMER_START_DELAY

#define DTLS_SESSION_TIMER_START_DELAY   (100 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)

◆ DTLS_TRANSMISSION_INTERVAL

#define DTLS_TRANSMISSION_INTERVAL   (200 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)

◆ GENERATED_CERTIFICATE_BITS

#define GENERATED_CERTIFICATE_BITS   2048

◆ GENERATED_CERTIFICATE_DAYS

#define GENERATED_CERTIFICATE_DAYS   365

◆ GENERATED_CERTIFICATE_MAX_SIZE

#define GENERATED_CERTIFICATE_MAX_SIZE   4096

◆ GENERATED_CERTIFICATE_NAME

#define GENERATED_CERTIFICATE_NAME   "KVS-WebRTC-Client"

◆ HUNDREDS_OF_NANOS_IN_A_DAY

#define HUNDREDS_OF_NANOS_IN_A_DAY   (HUNDREDS_OF_NANOS_IN_AN_HOUR * 24LL)

◆ KEYING_EXTRACTOR_LABEL

#define KEYING_EXTRACTOR_LABEL   "EXTRACTOR-dtls_srtp"

◆ MAX_DTLS_MASTER_KEY_LEN

#define MAX_DTLS_MASTER_KEY_LEN   48

◆ MAX_DTLS_RANDOM_BYTES_LEN

#define MAX_DTLS_RANDOM_BYTES_LEN   32

◆ MAX_SRTP_MASTER_KEY_LEN

#define MAX_SRTP_MASTER_KEY_LEN   16

◆ MAX_SRTP_SALT_KEY_LEN

#define MAX_SRTP_SALT_KEY_LEN   14

◆ SECONDS_IN_A_DAY

#define SECONDS_IN_A_DAY   (24 * 60 * 60LL)

Typedef Documentation

◆ DtlsSession

typedef struct __DtlsSession DtlsSession

◆ DtlsSessionOnStateChange

typedef VOID(* DtlsSessionOnStateChange) (UINT64, RTC_DTLS_TRANSPORT_STATE)

◆ DtlsSessionOutboundPacketFunc

typedef VOID(* DtlsSessionOutboundPacketFunc) (UINT64, PBYTE, UINT32)

◆ PDtlsKeyingMaterial

◆ PDtlsSession

typedef struct __DtlsSession * PDtlsSession

◆ PDtlsSessionCallbacks

◆ PDtlsSessionOptions

Enumeration Type Documentation

◆ DTLS_HANDSHAKE_STATE

Enumerator
DTLS_STATE_HANDSHAKE_NEW 
DTLS_STATE_HANDSHAKE_IN_PROGRESS 
DTLS_STATE_HANDSHAKE_COMPLETED 
DTLS_STATE_HANDSHAKE_ERROR 

◆ DTLS_SESSION_VALIDATION_MODE

Enumerator
DTLS_SESSION_VALIDATION_MODE_RELAXED 
DTLS_SESSION_VALIDATION_MODE_STRICT_SERVER 

◆ RTC_DTLS_TRANSPORT_STATE

Enumerator
RTC_DTLS_TRANSPORT_STATE_NEW 
RTC_DTLS_TRANSPORT_STATE_CONNECTING 
RTC_DTLS_TRANSPORT_STATE_CONNECTED 
RTC_DTLS_TRANSPORT_STATE_CLOSED 
RTC_DTLS_TRANSPORT_STATE_FAILED 

Function Documentation

◆ createDtlsSession()

STATUS createDtlsSession ( PDtlsSessionCallbacks pDtlsSessionCallbacks,
TIMER_QUEUE_HANDLE timerQueueHandle,
INT32 certificateBits,
BOOL generateRSACertificate,
PRtcCertificate pRtcCertificates,
PDtlsSession * ppDtlsSession )

Create DTLS session. Not thread safe.

Parameters
PDtlsSessionCallbacks- callbacks
TIMER_QUEUE_HANDLE- timer handle to schedule timer task with
INT32- size of generated certificate
BOOL- whether to generate certificate or not
PRtcCertificate- user provided certificate
PDtlsSession*- pointer to created DtlsSession object
Returns
STATUS - status of operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ createDtlsSessionWithOptions()

STATUS createDtlsSessionWithOptions ( PDtlsSessionCallbacks pDtlsSessionCallbacks,
TIMER_QUEUE_HANDLE timerQueueHandle,
INT32 certificateBits,
BOOL generateRSACertificate,
PRtcCertificate pRtcCertificates,
PDtlsSessionOptions pDtlsSessionOptions,
PDtlsSession * ppDtlsSession )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsFillPseudoRandomBits()

STATUS dtlsFillPseudoRandomBits ( PBYTE pBuf,
UINT32 bufSize )
Here is the caller graph for this function:

◆ dtlsSessionChangeState()

STATUS dtlsSessionChangeState ( PDtlsSession pDtlsSession,
RTC_DTLS_TRANSPORT_STATE newState )
Here is the caller graph for this function:

◆ dtlsSessionCopyOptions()

STATUS dtlsSessionCopyOptions ( PDtlsSession pDtlsSession,
PDtlsSessionOptions pDtlsSessionOptions )

Copy DTLS validation options into the session, defaulting to relaxed validation when options are omitted. Strict server validation requires a non-empty expected hostname.

Here is the caller graph for this function:

◆ dtlsSessionGetLocalCertificateFingerprint()

STATUS dtlsSessionGetLocalCertificateFingerprint ( PDtlsSession pDtlsSession,
PCHAR pBuff,
UINT32 buffLen )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionHandshakeInThread()

STATUS dtlsSessionHandshakeInThread ( PDtlsSession pDtlsSession,
BOOL isServer )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionIsInitFinished()

STATUS dtlsSessionIsInitFinished ( PDtlsSession pDtlsSession,
PBOOL pIsFinished )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionOnOutBoundData()

STATUS dtlsSessionOnOutBoundData ( PDtlsSession pDtlsSession,
UINT64 customData,
DtlsSessionOutboundPacketFunc callbackFn )
Here is the caller graph for this function:

◆ dtlsSessionOnStateChange()

STATUS dtlsSessionOnStateChange ( PDtlsSession pDtlsSession,
UINT64 customData,
DtlsSessionOnStateChange callbackFn )
Here is the caller graph for this function:

◆ dtlsSessionPopulateKeyingMaterial()

STATUS dtlsSessionPopulateKeyingMaterial ( PDtlsSession pDtlsSession,
PDtlsKeyingMaterial pDtlsKeyingMaterial )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionProcessPacket()

STATUS dtlsSessionProcessPacket ( PDtlsSession pDtlsSession,
PBYTE pData,
PINT32 pDataLen )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionPutApplicationData()

STATUS dtlsSessionPutApplicationData ( PDtlsSession pDtlsSession,
PBYTE pData,
INT32 dataLen )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionShutdown()

STATUS dtlsSessionShutdown ( PDtlsSession pDtlsSession)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionStart()

STATUS dtlsSessionStart ( PDtlsSession pDtlsSession,
BOOL isServer )

Start DTLS handshake. Not thread safe.

Parameters
PDtlsSession- DtlsSession object
BOOL- is server
Returns
STATUS - status of operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsSessionVerifyRemoteCertificateFingerprint()

STATUS dtlsSessionVerifyRemoteCertificateFingerprint ( PDtlsSession pDtlsSession,
PCHAR pExpectedFingerprint )
Here is the call graph for this function:
Here is the caller graph for this function:

◆ dtlsValidateRtcCertificates()

STATUS dtlsValidateRtcCertificates ( PRtcCertificate pRtcCertificates,
PUINT32 pCount )
Here is the caller graph for this function:

◆ freeDtlsSession()

STATUS freeDtlsSession ( PDtlsSession * ppDtlsSession)

Free DTLS session. Not thread safe.

Parameters
PDtlsSession- DtlsSession object to free
Returns
STATUS - status of operation
Here is the call graph for this function:
Here is the caller graph for this function: