Amazon Kinesis Webrtc C SDK
 
Loading...
Searching...
No Matches
Sctp.h
Go to the documentation of this file.
1//
2// Sctp
3//
4
5#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_SCTP_SCTP__
6#define __KINESIS_VIDEO_WEBRTC_CLIENT_SCTP_SCTP__
7
8#pragma once
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14// 1200 - 12 (SCTP header Size)
15#define SCTP_MTU 1188
16#define SCTP_ASSOCIATION_DEFAULT_PORT 5000
17#define SCTP_DCEP_HEADER_LENGTH 12
18#define SCTP_DCEP_LABEL_LEN_OFFSET 8
19#define SCTP_DCEP_LABEL_OFFSET 12
20#define SCTP_MAX_ALLOWABLE_PACKET_LENGTH (SCTP_DCEP_HEADER_LENGTH + MAX_DATA_CHANNEL_NAME_LEN + MAX_DATA_CHANNEL_PROTOCOL_LEN + 2)
21
22#define SCTP_SESSION_ACTIVE 0
23#define SCTP_SESSION_SHUTDOWN_INITIATED 1
24#define SCTP_SESSION_SHUTDOWN_COMPLETED 2
25
26#define DEFAULT_SCTP_SHUTDOWN_TIMEOUT 2 * HUNDREDS_OF_NANOS_IN_A_SECOND
27
28#define DEFAULT_USRSCTP_TEARDOWN_POLLING_INTERVAL (10 * HUNDREDS_OF_NANOS_IN_A_MILLISECOND)
29
31
32enum {
34};
35
42
43// Callback that is fired when SCTP Association wishes to send packet
44typedef VOID (*SctpSessionOutboundPacketFunc)(UINT64, PBYTE, UINT32);
45
46// Callback that is fired when SCTP has a new DataChannel
47// Argument is ChannelID and ChannelName + Len
48typedef VOID (*SctpSessionDataChannelOpenFunc)(UINT64, UINT32, PBYTE, UINT32);
49
50// Callback that is fired when SCTP has a DataChannel Message.
51// Argument is ChannelID and Message + Len
52typedef VOID (*SctpSessionDataChannelMessageFunc)(UINT64, UINT32, BOOL, PBYTE, UINT32);
53
60
61typedef struct {
62 volatile SIZE_T shutdownStatus;
63 struct socket* socket;
64 struct sctp_sendv_spa spa;
66 UINT32 packetSize;
69
70STATUS initSctpSession();
74STATUS putSctpPacket(PSctpSession, PBYTE, UINT32);
75STATUS sctpSessionWriteMessage(PSctpSession, UINT32, BOOL, PBYTE, UINT32);
76STATUS sctpSessionWriteDcep(PSctpSession, UINT32, PCHAR, UINT32, PRtcDataChannelInit);
77
78// Callbacks used by usrsctp
79INT32 onSctpOutboundPacket(PVOID, PVOID, ULONG, UINT8, UINT8);
80INT32 onSctpInboundPacket(struct socket*, union sctp_sockstore, PVOID, ULONG, struct sctp_rcvinfo, INT32, PVOID);
81
82#ifdef __cplusplus
83}
84#endif
85#endif //__KINESIS_VIDEO_WEBRTC_CLIENT_SCTP_SCTP__
@ SCTP_PPID_STRING
Definition Sctp.h:30
@ SCTP_PPID_BINARY
Definition Sctp.h:30
@ SCTP_PPID_DCEP
Definition Sctp.h:30
@ SCTP_PPID_STRING_EMPTY
Definition Sctp.h:30
@ SCTP_PPID_BINARY_EMPTY
Definition Sctp.h:30
STATUS freeSctpSession(PSctpSession *)
Definition Sctp.c:129
STATUS createSctpSession(PSctpSessionCallbacks, PSctpSession *)
Definition Sctp.c:78
VOID(* SctpSessionDataChannelMessageFunc)(UINT64, UINT32, BOOL, PBYTE, UINT32)
Definition Sctp.h:52
STATUS sctpSessionWriteDcep(PSctpSession, UINT32, PCHAR, UINT32, PRtcDataChannelInit)
Definition Sctp.c:219
VOID(* SctpSessionOutboundPacketFunc)(UINT64, PBYTE, UINT32)
Definition Sctp.h:44
#define SCTP_MAX_ALLOWABLE_PACKET_LENGTH
Definition Sctp.h:20
INT32 onSctpInboundPacket(struct socket *, union sctp_sockstore, PVOID, ULONG, struct sctp_rcvinfo, INT32, PVOID)
Definition Sctp.c:330
VOID deinitSctpSession()
Definition Sctp.c:70
struct SctpSession * PSctpSession
INT32 onSctpOutboundPacket(PVOID, PVOID, ULONG, UINT8, UINT8)
Definition Sctp.c:272
STATUS putSctpPacket(PSctpSession, PBYTE, UINT32)
Definition Sctp.c:292
STATUS sctpSessionWriteMessage(PSctpSession, UINT32, BOOL, PBYTE, UINT32)
Definition Sctp.c:168
VOID(* SctpSessionDataChannelOpenFunc)(UINT64, UINT32, PBYTE, UINT32)
Definition Sctp.h:48
DATA_CHANNEL_TYPE
Definition Sctp.h:36
@ DCEP_DATA_CHANNEL_TIMED
Definition Sctp.h:40
@ DCEP_DATA_CHANNEL_RELIABLE_UNORDERED
Definition Sctp.h:38
@ DCEP_DATA_CHANNEL_RELIABLE_ORDERED
Definition Sctp.h:37
@ DCEP_DATA_CHANNEL_REXMIT
Definition Sctp.h:39
STATUS initSctpSession()
Definition Sctp.c:58
@ DCEP_DATA_CHANNEL_OPEN
Definition Sctp.h:33
struct SctpSessionCallbacks * PSctpSessionCallbacks
RtcDataChannelInit dictionary used to configure properties of the underlying channel such as data rel...
Definition Include.h:1502
Definition Sctp.h:54
SctpSessionDataChannelOpenFunc dataChannelOpenFunc
Definition Sctp.h:57
SctpSessionOutboundPacketFunc outboundPacketFunc
Definition Sctp.h:56
UINT64 customData
Definition Sctp.h:55
SctpSessionDataChannelMessageFunc dataChannelMessageFunc
Definition Sctp.h:58
Definition Sctp.h:61
UINT32 packetSize
Definition Sctp.h:66
struct socket * socket
Definition Sctp.h:63
SctpSessionCallbacks sctpSessionCallbacks
Definition Sctp.h:67
volatile SIZE_T shutdownStatus
Definition Sctp.h:62