Amazon Kinesis Webrtc C SDK
 
Loading...
Searching...
No Matches
Sdp.h
Go to the documentation of this file.
1//
2// Session Description Protocol Utils
3//
4
5#ifndef __KINESIS_VIDEO_WEBRTC_CLIENT_SDP_SDP__
6#define __KINESIS_VIDEO_WEBRTC_CLIENT_SDP_SDP__
7
8#pragma once
9
10#ifdef __cplusplus
11extern "C" {
12#endif
13
14#define SDP_ATTRIBUTE_MARKER "a="
15#define SDP_BANDWIDTH_MARKER "b="
16#define SDP_CONNECTION_INFORMATION_MARKER "c="
17#define SDP_EMAIL_ADDRESS_MARKER "e="
18#define SDP_ENCRYPTION_KEY_MARKER "k="
19
20// Media title information or Session information
21#define SDP_INFORMATION_MARKER "i="
22
23#define SDP_MEDIA_NAME_MARKER "m="
24#define SDP_ORIGIN_MARKER "o="
25#define SDP_PHONE_NUMBER_MARKER "p="
26#define SDP_SESSION_NAME_MARKER "s="
27#define SDP_TIME_DESCRIPTION_MARKER "t="
28#define SDP_TIMEZONE_MARKER "z="
29#define SDP_URI_MARKER "u="
30#define SDP_VERSION_MARKER "v="
31
32// The sequence CRLF (0x0d0a) is used to end a record, although parsers SHOULD be
33// tolerant and also accept records terminated with a single newline
34// character.
35// Reference: https://tools.ietf.org/html/rfc4566#section-5
36#define SDP_LINE_SEPARATOR "\r\n"
37
38#define SDP_CANDIDATE_TYPE_HOST "host"
39#define SDP_CANDIDATE_TYPE_SERFLX "srflx"
40#define SDP_CANDIDATE_TYPE_PRFLX "prflx"
41#define SDP_CANDIDATE_TYPE_RELAY "relay"
42#define SDP_CANDIDATE_TYPE_UNKNOWN "unknown"
43
44#define SDP_ATTRIBUTE_LENGTH 2
45
46#define MAX_SDP_OFFSET_LENGTH 255
47#define MAX_SDP_ENCRYPTION_KEY_METHOD_LENGTH 255
48#define MAX_SDP_ENCRYPTION_KEY_LENGTH 255
49
50/* https://datatracker.ietf.org/doc/html/rfc4566#section-5.7 -- the SDK hardcodes this to be IN as per spec.
51 * Also, this SDK is to be used in the Internet realm. Allowing for some extra buffer
52 */
53#define MAX_SDP_NETWORK_TYPE_LENGTH 7
54
55/* https://datatracker.ietf.org/doc/html/rfc4566#section-5.7 -- Given the SDK is to operate in IP based sessions,
56 * the possible values are IP4/IP6 as registered with IANA. Allowing for some extra buffer
57 */
58#define MAX_SDP_ADDRESS_TYPE_LENGTH 7
59
60/* https://datatracker.ietf.org/doc/html/rfc4566#section-5.7 -- Given the SDK is to operate in IP based sessions,
61 * an IPv4 address can be a maximum of <IPv4(15)/TTL(3)/multicast number of addresses(3)> characters where TTL is
62 * between 0 and 255. IPv6 can be a maximum of <IPv6 uncompressed(39)>. Setting to 63 for additional padding
63 */
64#define MAX_SDP_CONNECTION_ADDRESS_LENGTH 63
65
66// https://datatracker.ietf.org/doc/html/rfc4566#section-5.2 -- the SDK sets it to "-" and the SDK does not parse incoming username either
67#define MAX_SDP_SESSION_USERNAME_LENGTH 32
68
69// https://datatracker.ietf.org/doc/html/rfc4566#section-6 -- name length restricted based on current supported attribute set
70#define MAX_SDP_ATTRIBUTE_NAME_LENGTH 32
71
72// One of the attributes is streamId + trackId which sums up to 512 maximum characters
73#define MAX_SDP_ATTRIBUTE_VALUE_LENGTH 512
74
75#define MAX_SDP_MEDIA_NAME_LENGTH 255
76
77/* https://tools.ietf.org/html/rfc4566#section-5.4. Given these are free-form textual strings, that is, the length could be anything.
78 * Although our SDK parses this information, the SDK does not use it. Leaving this attribute in if SDK uses it in
79 * the future, but keeping it at smaller size to ensure structure memory efficiency
80 */
81#define MAX_SDP_MEDIA_TITLE_LENGTH 127
82
83/* https://tools.ietf.org/html/rfc4566#section-5.4. Given these are free-form textual strings, that is, the length could be anything.
84 * Although our SDK parses this information, the SDK does not use it. Leaving this attribute in if SDK uses it in
85 * the future, but keeping it at smaller size to ensure structure memory efficiency
86 */
87#define MAX_SDP_SESSION_INFORMATION_LENGTH 127
88
89#define MAX_SDP_SESSION_NAME_LENGTH 255
90#define MAX_SDP_SESSION_URI_LENGTH 255
91#define MAX_SDP_SESSION_EMAIL_ADDRESS_LENGTH 255
92#define MAX_SDP_SESSION_PHONE_NUMBER_LENGTH 255
93
94#define MAX_SDP_TOKEN_LENGTH 128
95#define MAX_SDP_FMTP_VALUES 64
96
97#define MAX_SDP_SESSION_TIME_DESCRIPTION_COUNT 2
98#define MAX_SDP_SESSION_TIMEZONE_COUNT 2
99
111#ifndef MAX_SDP_SESSION_MEDIA_COUNT
112#define MAX_SDP_SESSION_MEDIA_COUNT 5
113#endif
114
115#define MAX_SDP_MEDIA_BANDWIDTH_COUNT 2
116
117#define MAX_SDP_ATTRIBUTES_COUNT 256
118
119/*
120 * c=<nettype> <addrtype> <connection-address>
121 * https://tools.ietf.org/html/rfc4566#section-5.7
122 */
128
129/*
130 * o=<username> <sess-id> <sess-version> <nettype> <addrtype> <unicast-address>
131 * https://tools.ietf.org/html/rfc4566#section-5.2
132 */
139
140/*
141 * https://tools.ietf.org/html/rfc4566#section-5.9
142 * https://tools.ietf.org/html/rfc4566#section-5.10
143 */
148
149/*
150 * z=<adjustment time> <offset> <adjustment time> <offset> ...
151 * https://tools.ietf.org/html/rfc4566#section-5.11
152 */
157
162
163/*
164 * a=<attribute>
165 * a=<attribute>:<value>
166 * https://tools.ietf.org/html/rfc4566#section-5.13
167 */
172
173typedef struct {
174 // m=<media> <port>/<number of ports> <proto> <fmt> ...
175 // https://tools.ietf.org/html/rfc4566#section-5.14
177
178 // i=<session description>
179 // https://tools.ietf.org/html/rfc4566#section-5.4. Given these are free-form strings, the length could be anything.
180 // Although our SDK parses this information, the SDK does not use it. Leaving this attribute in if SDK uses it in
181 // the future
183
185
187
189
191
194
195typedef struct {
196 // https://tools.ietf.org/html/rfc4566#section-5.1
198
200
201 // s=<session name>
202 // https://tools.ietf.org/html/rfc4566#section-5.3
204
205 // i=<session description>
206 // https://tools.ietf.org/html/rfc4566#section-5.4
208
209 // u=<uri>
210 // https://tools.ietf.org/html/rfc4566#section-5.5
212
213 // e=<email-address>
214 // https://tools.ietf.org/html/rfc4566#section-5.6
216
217 // p=<phone-number>
218 // https://tools.ietf.org/html/rfc4566#section-5.6
220
222
224
226
228
230
232
234
236
238
240
243
244// Return code maps to an errno just for SDP parsing
246
247// Return code maps to a code if we are trying to serialize an invalid session_description
249
253
254#ifdef __cplusplus
255}
256#endif
257#endif //__KINESIS_VIDEO_WEBRTC_CLIENT_SDP_SDP__
#define MAX_SDP_SESSION_URI_LENGTH
Definition Sdp.h:90
#define MAX_SDP_SESSION_NAME_LENGTH
Definition Sdp.h:89
#define MAX_SDP_SESSION_PHONE_NUMBER_LENGTH
Definition Sdp.h:92
#define MAX_SDP_SESSION_EMAIL_ADDRESS_LENGTH
Definition Sdp.h:91
STATUS deserializeSessionDescription(PSessionDescription, PCHAR)
Definition Deserialize.c:74
STATUS serializeSessionDescription(PSessionDescription, PCHAR, PUINT32)
Definition Serialize.c:166
#define MAX_SDP_NETWORK_TYPE_LENGTH
Definition Sdp.h:53
struct SdpOrigin * PSdpOrigin
#define MAX_SDP_MEDIA_NAME_LENGTH
Definition Sdp.h:75
#define MAX_SDP_ENCRYPTION_KEY_METHOD_LENGTH
Definition Sdp.h:47
struct SdpTimeDescription * PSdpTimeDescription
#define MAX_SDP_OFFSET_LENGTH
Definition Sdp.h:46
#define MAX_SDP_ATTRIBUTE_VALUE_LENGTH
Definition Sdp.h:73
#define MAX_SDP_SESSION_USERNAME_LENGTH
Definition Sdp.h:67
struct SdpMediaDescription * PSdpMediaDescription
#define MAX_SDP_SESSION_TIME_DESCRIPTION_COUNT
Definition Sdp.h:97
#define MAX_SDP_MEDIA_TITLE_LENGTH
Definition Sdp.h:81
struct SdpAttributes * PSdpAttributes
#define MAX_SDP_SESSION_MEDIA_COUNT
Definition Sdp.h:112
#define MAX_SDP_ENCRYPTION_KEY_LENGTH
Definition Sdp.h:48
struct SdpConnectionInformation * PSdpConnectionInformation
#define MAX_SDP_ATTRIBUTE_NAME_LENGTH
Definition Sdp.h:70
struct SessionDescription * PSessionDescription
struct SdpEncryptionKey * PSdpEncryptionKey
#define MAX_SDP_SESSION_INFORMATION_LENGTH
Definition Sdp.h:87
#define MAX_SDP_CONNECTION_ADDRESS_LENGTH
Definition Sdp.h:64
STATUS parseMediaAttributes(PSessionDescription, PCHAR, UINT32)
Definition Deserialize.c:46
struct SdpTimeZone * PSdpTimeZone
STATUS parseMediaName(PSessionDescription, PCHAR, UINT32)
Definition Deserialize.c:4
#define MAX_SDP_ATTRIBUTES_COUNT
Definition Sdp.h:117
#define MAX_SDP_ADDRESS_TYPE_LENGTH
Definition Sdp.h:58
STATUS parseSessionAttributes(PSessionDescription, PCHAR, UINT32)
Definition Deserialize.c:20
#define MAX_SDP_SESSION_TIMEZONE_COUNT
Definition Sdp.h:98
@ RTC_RTP_TRANSCEIVER_DIRECTION_UNINITIALIZED
Will use the default "sendrecv" after initialization.
Definition Include.h:1056
Definition Sdp.h:168
Definition Sdp.h:123
Definition Sdp.h:158
Definition Sdp.h:173
UINT8 mediaAttributesCount
Definition Sdp.h:190
UINT8 mediaBandwidthCount
Definition Sdp.h:192
SdpConnectionInformation sdpConnectionInformation
Definition Sdp.h:184
SdpEncryptionKey sdpEncryptionKey
Definition Sdp.h:186
Definition Sdp.h:133
UINT64 sessionVersion
Definition Sdp.h:136
SdpConnectionInformation sdpConnectionInformation
Definition Sdp.h:137
UINT64 sessionId
Definition Sdp.h:135
Definition Sdp.h:144
UINT64 startTime
Definition Sdp.h:145
UINT64 stopTime
Definition Sdp.h:146
Definition Sdp.h:153
UINT64 adjustmentTime
Definition Sdp.h:154
Definition Sdp.h:195
UINT16 mediaCount
Definition Sdp.h:235
SdpEncryptionKey sdpEncryptionKey
Definition Sdp.h:227
SdpConnectionInformation sdpConnectionInformation
Definition Sdp.h:221
UINT8 bandwidthCount
Definition Sdp.h:241
UINT64 version
Definition Sdp.h:197
UINT8 timezoneCount
Definition Sdp.h:237
UINT16 sessionAttributesCount
Definition Sdp.h:233
SdpOrigin sdpOrigin
Definition Sdp.h:199
UINT8 timeDescriptionCount
Definition Sdp.h:239