Amazon Kinesis Webrtc C SDK
 
Loading...
Searching...
No Matches
Include_i.h
Go to the documentation of this file.
1/*******************************************
2Main internal include file
3*******************************************/
4#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_INCLUDE_I__
5#define __KINESIS_VIDEO_WEBRTC_CLIENT_INCLUDE_I__
6
7#pragma once
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#ifdef _WIN32
14#include <winsock2.h>
15#include <iphlpapi.h>
16#include <ws2tcpip.h>
17
18#ifndef MSG_NOSIGNAL
19#define MSG_NOSIGNAL 0
20#endif
21
22#endif
23
25// Project include files
28
29#ifdef KVS_USE_OPENSSL
30#include <openssl/bio.h>
31#include <openssl/err.h>
32#include <openssl/hmac.h>
33#include <openssl/md5.h>
34#include <openssl/rand.h>
35#include <openssl/sha.h>
36#include <openssl/ssl.h>
37#elif KVS_USE_MBEDTLS
38#include <mbedtls/ssl.h>
39#include <mbedtls/entropy.h>
40#include <mbedtls/ctr_drbg.h>
41#include <mbedtls/error.h>
42#include <mbedtls/certs.h>
43#include <mbedtls/sha256.h>
44#include <mbedtls/md5.h>
45#endif
46
47#include <srtp2/srtp.h>
48
49// INET/INET6 MUST be defined before usrsctp
50// If removed will cause corruption that is hard to determine at runtime
51#define INET 1
52#define INET6 1
53#include <usrsctp.h>
54
55#include <libwebsockets.h>
56
57#if !defined __WINDOWS_BUILD__
58#include <signal.h>
59#include <sys/types.h>
60#include <ifaddrs.h>
61#include <sys/types.h>
62#include <sys/socket.h>
63#include <netdb.h>
64#include <net/if.h>
65#include <arpa/inet.h>
66#include <fcntl.h>
67#include <netinet/tcp.h>
68#endif
69
70// Max uFrag and uPwd length as documented in https://tools.ietf.org/html/rfc5245#section-15.4
71#define ICE_MAX_UFRAG_LEN 256
72#define ICE_MAX_UPWD_LEN 256
73
74// Max stun username attribute len: https://tools.ietf.org/html/rfc5389#section-15.3
75#define STUN_MAX_USERNAME_LEN (UINT16) 512
76
77// https://tools.ietf.org/html/rfc5389#section-15.7
78#define STUN_MAX_REALM_LEN (UINT16) 128
79
80// https://tools.ietf.org/html/rfc5389#section-15.8
81#define STUN_MAX_NONCE_LEN (UINT16) 128
82
83// https://tools.ietf.org/html/rfc5389#section-15.6
84#define STUN_MAX_ERROR_PHRASE_LEN (UINT16) 128
85
86// Byte sizes of the IP addresses
87#define IPV6_ADDRESS_LENGTH (UINT16) 16
88#define IPV4_ADDRESS_LENGTH (UINT16) 4
89
90#define CERTIFICATE_FINGERPRINT_LENGTH 160
91
92#define MAX_UDP_PACKET_SIZE 65507
93
94typedef enum {
95 KVS_IP_FAMILY_TYPE_IPV4 = (UINT16) 0x0001,
96 KVS_IP_FAMILY_TYPE_IPV6 = (UINT16) 0x0002,
98
99typedef struct {
100 UINT16 family;
101 UINT16 port; // port is stored in network byte order
102 BYTE address[IPV6_ADDRESS_LENGTH]; // address is stored in network byte order
105
106#define IS_IPV4_ADDR(pAddress) ((pAddress)->family == KVS_IP_FAMILY_TYPE_IPV4)
107
108// Used for ensuring alignment
109#define ALIGN_UP_TO_MACHINE_WORD(x) ROUND_UP((x), SIZEOF(SIZE_T))
110
111typedef STATUS (*IceServerSetIpFunc)(UINT64, PCHAR, PKvsIpAddress);
112STATUS getIpAddrStr(PKvsIpAddress pKvsIpAddress, PCHAR pBuffer, UINT32 bufferLen);
113
115// Project forward declarations
117struct __TurnConnection;
118struct __SocketConnection;
119STATUS generateJSONSafeString(PCHAR, UINT32);
120
122// Project internal includes
125#include "Crypto/IOBuffer.h"
126#include "Crypto/Crypto.h"
127#include "Crypto/Dtls.h"
128#include "Crypto/Tls.h"
129#include "Ice/Network.h"
130#include "Ice/SocketConnection.h"
132#include "Stun/Stun.h"
133#include "Ice/IceUtils.h"
134#include "Sdp/Sdp.h"
135#include "Ice/IceAgent.h"
136#include "Ice/TurnConnection.h"
140#include "Srtp/SrtpSession.h"
141#include "Sctp/Sctp.h"
142#include "Signaling/FileCache.h"
143#include "Signaling/Signaling.h"
147#include "Rtp/RtpPacket.h"
148#include "Rtcp/RtcpPacket.h"
149#include "Rtcp/RollingBuffer.h"
155#include "PeerConnection/Rtp.h"
156#include "PeerConnection/Rtcp.h"
163#include "Metrics/Metrics.h"
164
166// Project internal defines
168
170// Project internal functions
172
173#define KVS_CONVERT_TIMESCALE(pts, from_timescale, to_timescale) (pts * to_timescale / from_timescale)
174
175#ifdef __cplusplus
176}
177#endif
178#endif /* __KINESIS_VIDEO_WEBRTC_CLIENT_INCLUDE_I__ */
STATUS(* IceServerSetIpFunc)(UINT64, PCHAR, PKvsIpAddress)
Definition Include_i.h:111
KVS_IP_FAMILY_TYPE
Definition Include_i.h:94
@ KVS_IP_FAMILY_TYPE_IPV4
Definition Include_i.h:95
@ KVS_IP_FAMILY_TYPE_IPV6
Definition Include_i.h:96
#define IPV6_ADDRESS_LENGTH
Definition Include_i.h:87
STATUS generateJSONSafeString(PCHAR, UINT32)
Definition PeerConnection.c:714
struct KvsIpAddress * PKvsIpAddress
STATUS getIpAddrStr(PKvsIpAddress pKvsIpAddress, PCHAR pBuffer, UINT32 bufferLen)
Definition Network.c:461
Definition Include_i.h:99
UINT16 port
Definition Include_i.h:101
BOOL isPointToPoint
Definition Include_i.h:103
UINT16 family
Definition Include_i.h:100
Definition SocketConnection.h:25
Definition TurnConnection.h:119