Amazon Kinesis Webrtc C SDK
IceUtils.h
Go to the documentation of this file.
1 /*******************************************
2 Ice Utils internal include file
3 *******************************************/
4 #ifndef __KINESIS_VIDEO_WEBRTC_ICE_UTILS__
5 #define __KINESIS_VIDEO_WEBRTC_ICE_UTILS__
6 
7 #pragma once
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #define DEFAULT_MAX_STORED_TRANSACTION_ID_COUNT 20
14 #define MAX_STORED_TRANSACTION_ID_COUNT 100
15 
16 #define ICE_STUN_DEFAULT_PORT 3478
17 
18 #define ICE_URL_PREFIX_STUN "stun:"
19 #define ICE_URL_PREFIX_TURN "turn:"
20 #define ICE_URL_PREFIX_TURN_SECURE "turns:"
21 #define ICE_URL_TRANSPORT_UDP "transport=udp"
22 #define ICE_URL_TRANSPORT_TCP "transport=tcp"
23 
24 #define ICE_TRANSPORT_TYPE_UDP "udp"
25 #define ICE_TRANSPORT_TYPE_TCP "tcp"
26 #define ICE_TRANSPORT_TYPE_TLS "tls"
27 
31 typedef struct {
38 
45 
46 STATUS iceUtilsGenerateTransactionId(PBYTE, UINT32);
47 
48 // Stun packaging and sending functions
49 STATUS iceUtilsPackageStunPacket(PStunPacket, PBYTE, UINT32, PBYTE, PUINT32);
51 STATUS iceUtilsSendData(PBYTE, UINT32, PKvsIpAddress, PSocketConnection, struct __TurnConnection*, BOOL);
52 
53 typedef struct {
54  BOOL isTurn;
55  BOOL isSecure;
56  CHAR url[MAX_ICE_CONFIG_URI_LEN + 1];
58  CHAR username[MAX_ICE_CONFIG_USER_NAME_LEN + 1];
59  CHAR credential[MAX_ICE_CONFIG_CREDENTIAL_LEN + 1];
63 
64 STATUS parseIceServer(PIceServer, PCHAR, PCHAR, PCHAR);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 #endif /* __KINESIS_VIDEO_WEBRTC_ICE_UTILS__ */
VOID transactionIdStoreClear(PTransactionIdStore)
Definition: IceUtils.c:111
STATUS freeTransactionIdStore(PTransactionIdStore *)
Definition: IceUtils.c:36
STATUS createTransactionIdStore(UINT32, PTransactionIdStore *)
Definition: IceUtils.c:7
STATUS iceUtilsSendStunPacket(PStunPacket, PBYTE, UINT32, PKvsIpAddress, PSocketConnection, struct __TurnConnection *, BOOL)
VOID transactionIdStoreRemove(PTransactionIdStore, PBYTE)
Definition: IceUtils.c:95
struct IceServer * PIceServer
struct TransactionIdStore * PTransactionIdStore
STATUS iceUtilsPackageStunPacket(PStunPacket, PBYTE, UINT32, PBYTE, PUINT32)
Definition: IceUtils.c:139
STATUS parseIceServer(PIceServer, PCHAR, PCHAR, PCHAR)
Definition: IceUtils.c:218
STATUS iceUtilsSendData(PBYTE, UINT32, PKvsIpAddress, PSocketConnection, struct __TurnConnection *, BOOL)
STATUS iceUtilsGenerateTransactionId(PBYTE, UINT32)
Definition: IceUtils.c:120
BOOL transactionIdStoreHasId(PTransactionIdStore, PBYTE)
Definition: IceUtils.c:77
VOID transactionIdStoreInsert(PTransactionIdStore, PBYTE)
Definition: IceUtils.c:56
STATUS(* IceServerSetIpFunc)(UINT64, PCHAR, PKvsIpAddress)
Definition: Include_i.h:111
KVS_SOCKET_PROTOCOL
Definition: Network.h:48
#define MAX_ICE_CONFIG_URI_LEN
Definition: Include.h:466
#define MAX_ICE_CONFIG_CREDENTIAL_LEN
Definition: Include.h:456
#define MAX_ICE_CONFIG_USER_NAME_LEN
Definition: Include.h:450
Definition: IceUtils.h:53
KVS_SOCKET_PROTOCOL transport
Definition: IceUtils.h:60
IceServerSetIpFunc setIpFn
Definition: IceUtils.h:61
BOOL isTurn
Definition: IceUtils.h:54
BOOL isSecure
Definition: IceUtils.h:55
KvsIpAddress ipAddress
Definition: IceUtils.h:57
Definition: Include_i.h:99
Definition: Stun.h:357
Definition: IceUtils.h:31
UINT32 earliestTransactionIdIndex
Definition: IceUtils.h:34
UINT32 maxTransactionIdsCount
Definition: IceUtils.h:32
PBYTE transactionIds
Definition: IceUtils.h:36
UINT32 nextTransactionIdIndex
Definition: IceUtils.h:33
UINT32 transactionIdCount
Definition: IceUtils.h:35
Definition: SocketConnection.h:25
Definition: TurnConnection.h:119