Skip to main content

rice_c/
bindings.rs

1/* automatically generated by rust-bindgen 0.72.1 */
2
3pub const RICE_PROTO_MAJOR: u32 = 0;
4pub const RICE_PROTO_MINOR: u32 = 4;
5pub const RICE_PROTO_PATCH: u32 = 2;
6#[doc = " Component is in initial state and no connectivity checks are in progress."]
7pub const RICE_COMPONENT_CONNECTION_STATE_NEW: RiceComponentConnectionState = 0;
8#[doc = " Connectivity checks are in progress for this candidate"]
9pub const RICE_COMPONENT_CONNECTION_STATE_CONNECTING: RiceComponentConnectionState = 1;
10#[doc = " A [`CandidatePair`](crate::candidate::CandidatePair`) has been selected for this component"]
11pub const RICE_COMPONENT_CONNECTION_STATE_CONNECTED: RiceComponentConnectionState = 2;
12#[doc = " No connection could be found for this Component"]
13pub const RICE_COMPONENT_CONNECTION_STATE_FAILED: RiceComponentConnectionState = 3;
14pub type RiceComponentConnectionState = u32;
15#[doc = " IP version 4."]
16pub const RICE_ADDRESS_FAMILY_IPV4: RiceAddressFamily = 1;
17#[doc = " IP version 6."]
18pub const RICE_ADDRESS_FAMILY_IPV6: RiceAddressFamily = 2;
19pub type RiceAddressFamily = u32;
20#[doc = " The candidate is a local network interface"]
21pub const RICE_CANDIDATE_TYPE_HOST: RiceCandidateType = 0;
22#[doc = " The candidate was discovered from incoming data"]
23pub const RICE_CANDIDATE_TYPE_PEER_REFLEXIVE: RiceCandidateType = 1;
24#[doc = " The candidate was discovered by asking an external server (STUN/TURN)"]
25pub const RICE_CANDIDATE_TYPE_SERVER_REFLEXIVE: RiceCandidateType = 2;
26#[doc = " The candidate will relay all data through an external server (TURN)."]
27pub const RICE_CANDIDATE_TYPE_RELAYED: RiceCandidateType = 3;
28pub type RiceCandidateType = u32;
29#[doc = " Not an error. The operation was completed successfully."]
30pub const RICE_ERROR_SUCCESS: RiceError = 0;
31#[doc = " The operation failed for an unspecified reason."]
32pub const RICE_ERROR_FAILED: RiceError = -1;
33#[doc = " A required resource was not found."]
34pub const RICE_ERROR_RESOURCE_NOT_FOUND: RiceError = -2;
35#[doc = " The operation is already in progress."]
36pub const RICE_ERROR_ALREADY_IN_PROGRESS: RiceError = -3;
37pub type RiceError = i32;
38#[doc = " The configuration will automatically be used when supported."]
39pub const RICE_FEATURE_DISABLED: RiceFeature = -1;
40#[doc = " The configuration will automatically be used when supported."]
41pub const RICE_FEATURE_AUTO: RiceFeature = 0;
42#[doc = " The configuration is enabled and required."]
43pub const RICE_FEATURE_REQUIRED: RiceFeature = 1;
44pub type RiceFeature = i32;
45#[doc = " The SHA-1 HMAC."]
46pub const RICE_INTEGRITY_ALGORITHM_SHA1: RiceIntegrityAlgorithm = 0;
47#[doc = " The SHA-256 HMAC."]
48pub const RICE_INTEGRITY_ALGORITHM_SHA256: RiceIntegrityAlgorithm = 1;
49pub type RiceIntegrityAlgorithm = u32;
50#[doc = " No error."]
51pub const RICE_PARSE_CANDIDATE_ERROR_SUCCESS: RiceParseCandidateError = 0;
52#[doc = " Not a candidate message."]
53pub const RICE_PARSE_CANDIDATE_ERROR_NOT_CANDIDATE: RiceParseCandidateError = -1;
54#[doc = " Invalid foundation value."]
55pub const RICE_PARSE_CANDIDATE_ERROR_BAD_FOUNDATION: RiceParseCandidateError = -2;
56#[doc = " Invalid component id."]
57pub const RICE_PARSE_CANDIDATE_ERROR_BAD_COMPONENT_ID: RiceParseCandidateError = -3;
58#[doc = " Invalid transport type."]
59pub const RICE_PARSE_CANDIDATE_ERROR_BAD_TRANSPORT_TYPE: RiceParseCandidateError = -4;
60#[doc = " Invalid priority value."]
61pub const RICE_PARSE_CANDIDATE_ERROR_BAD_PRIORITY: RiceParseCandidateError = -5;
62#[doc = " Invalid network address."]
63pub const RICE_PARSE_CANDIDATE_ERROR_BAD_ADDRESS: RiceParseCandidateError = -6;
64#[doc = " Invalid candidate type."]
65pub const RICE_PARSE_CANDIDATE_ERROR_BAD_CANDIDATE_TYPE: RiceParseCandidateError = -7;
66#[doc = " Invalid extension format."]
67pub const RICE_PARSE_CANDIDATE_ERROR_BAD_EXTENSION: RiceParseCandidateError = -8;
68#[doc = " Data is not well formed."]
69pub const RICE_PARSE_CANDIDATE_ERROR_MALFORMED: RiceParseCandidateError = -9;
70pub type RiceParseCandidateError = i32;
71#[doc = " Not a TCP candidate."]
72pub const RICE_TCP_TYPE_NONE: RiceTcpType = 0;
73#[doc = " The candidate address will connect to a remote address."]
74pub const RICE_TCP_TYPE_ACTIVE: RiceTcpType = 1;
75#[doc = " The candidate will listen for incominng TCP connections."]
76pub const RICE_TCP_TYPE_PASSIVE: RiceTcpType = 2;
77#[doc = " Simultaneous open.  The candidate will both listen for incoming connections, and connect to\n remote addresses."]
78pub const RICE_TCP_TYPE_SO: RiceTcpType = 3;
79pub type RiceTcpType = u32;
80#[doc = " Openssl."]
81pub const RICE_TLS_VARIANT_OPENSSL: RiceTlsVariant = 1;
82#[doc = " Rustls."]
83pub const RICE_TLS_VARIANT_RUSTLS: RiceTlsVariant = 2;
84#[doc = " Dimpl."]
85pub const RICE_TLS_VARIANT_DIMPL: RiceTlsVariant = 3;
86pub type RiceTlsVariant = u32;
87#[doc = " The UDP transport"]
88pub const RICE_TRANSPORT_TYPE_UDP: RiceTransportType = 0;
89#[doc = " The TCP transport"]
90pub const RICE_TRANSPORT_TYPE_TCP: RiceTransportType = 1;
91pub type RiceTransportType = u32;
92#[repr(C)]
93#[derive(Debug, Copy, Clone)]
94pub struct Credentials {
95    _unused: [u8; 0],
96}
97#[repr(C)]
98#[derive(Copy, Clone)]
99pub struct RiceAddress {
100    _unused: [u8; 0],
101}
102#[repr(C)]
103#[derive(Debug, Copy, Clone)]
104pub struct RiceAgent {
105    _unused: [u8; 0],
106}
107#[repr(C)]
108#[derive(Debug, Copy, Clone)]
109pub struct RiceComponent {
110    _unused: [u8; 0],
111}
112#[repr(C)]
113#[derive(Debug, Copy, Clone)]
114pub struct RiceStream {
115    _unused: [u8; 0],
116}
117#[repr(C)]
118#[derive(Debug, Copy, Clone)]
119pub struct RiceTlsConfig {
120    _unused: [u8; 0],
121}
122#[repr(C)]
123#[derive(Debug, Copy, Clone)]
124pub struct RiceTurnConfig {
125    _unused: [u8; 0],
126}
127#[doc = " A pointer to a sequence of bytes and the associated size."]
128#[repr(C)]
129#[derive(Debug)]
130pub struct RiceDataImpl {
131    #[doc = " A pointer to a sequence of bytes."]
132    pub ptr: *mut u8,
133    #[doc = " Number of bytes pointed to in `ptr`."]
134    pub size: usize,
135}
136#[allow(clippy::unnecessary_operation, clippy::identity_op)]
137const _: () = {
138    ["Size of RiceDataImpl"][::core::mem::size_of::<RiceDataImpl>() - 16usize];
139    ["Alignment of RiceDataImpl"][::core::mem::align_of::<RiceDataImpl>() - 8usize];
140    ["Offset of field: RiceDataImpl::ptr"][::core::mem::offset_of!(RiceDataImpl, ptr) - 0usize];
141    ["Offset of field: RiceDataImpl::size"][::core::mem::offset_of!(RiceDataImpl, size) - 8usize];
142};
143#[doc = " The data is borrowed and will not be freed on destruction."]
144pub const RICE_DATA_BORROWED: RiceData_Tag = 0;
145#[doc = " The data is owned and will be freed on destruction."]
146pub const RICE_DATA_OWNED: RiceData_Tag = 1;
147#[doc = " A pointer to a sequence of bytes and size."]
148pub type RiceData_Tag = ::core::ffi::c_uint;
149#[repr(C)]
150pub struct RiceData {
151    pub tag: RiceData_Tag,
152    pub field1: RiceData__bindgen_ty_1,
153}
154#[repr(C)]
155pub union RiceData__bindgen_ty_1 {
156    pub field1: ::core::mem::ManuallyDrop<RiceData__bindgen_ty_1__bindgen_ty_1>,
157    pub field2: ::core::mem::ManuallyDrop<RiceData__bindgen_ty_1__bindgen_ty_2>,
158}
159#[repr(C)]
160#[derive(Debug)]
161pub struct RiceData__bindgen_ty_1__bindgen_ty_1 {
162    pub borrowed: RiceDataImpl,
163}
164#[allow(clippy::unnecessary_operation, clippy::identity_op)]
165const _: () = {
166    ["Size of RiceData__bindgen_ty_1__bindgen_ty_1"]
167        [::core::mem::size_of::<RiceData__bindgen_ty_1__bindgen_ty_1>() - 16usize];
168    ["Alignment of RiceData__bindgen_ty_1__bindgen_ty_1"]
169        [::core::mem::align_of::<RiceData__bindgen_ty_1__bindgen_ty_1>() - 8usize];
170    ["Offset of field: RiceData__bindgen_ty_1__bindgen_ty_1::borrowed"]
171        [::core::mem::offset_of!(RiceData__bindgen_ty_1__bindgen_ty_1, borrowed) - 0usize];
172};
173#[repr(C)]
174#[derive(Debug)]
175pub struct RiceData__bindgen_ty_1__bindgen_ty_2 {
176    pub owned: RiceDataImpl,
177}
178#[allow(clippy::unnecessary_operation, clippy::identity_op)]
179const _: () = {
180    ["Size of RiceData__bindgen_ty_1__bindgen_ty_2"]
181        [::core::mem::size_of::<RiceData__bindgen_ty_1__bindgen_ty_2>() - 16usize];
182    ["Alignment of RiceData__bindgen_ty_1__bindgen_ty_2"]
183        [::core::mem::align_of::<RiceData__bindgen_ty_1__bindgen_ty_2>() - 8usize];
184    ["Offset of field: RiceData__bindgen_ty_1__bindgen_ty_2::owned"]
185        [::core::mem::offset_of!(RiceData__bindgen_ty_1__bindgen_ty_2, owned) - 0usize];
186};
187#[allow(clippy::unnecessary_operation, clippy::identity_op)]
188const _: () = {
189    ["Size of RiceData__bindgen_ty_1"][::core::mem::size_of::<RiceData__bindgen_ty_1>() - 16usize];
190    ["Alignment of RiceData__bindgen_ty_1"]
191        [::core::mem::align_of::<RiceData__bindgen_ty_1>() - 8usize];
192};
193#[allow(clippy::unnecessary_operation, clippy::identity_op)]
194const _: () = {
195    ["Size of RiceData"][::core::mem::size_of::<RiceData>() - 24usize];
196    ["Alignment of RiceData"][::core::mem::align_of::<RiceData>() - 8usize];
197    ["Offset of field: RiceData::tag"][::core::mem::offset_of!(RiceData, tag) - 0usize];
198};
199#[doc = " Transmit the data using the specified 5-tuple."]
200#[repr(C)]
201#[derive(Debug)]
202pub struct RiceTransmit {
203    #[doc = " The associated stream identifier."]
204    pub stream_id: usize,
205    #[doc = " The transport type for the transmission."]
206    pub transport: RiceTransportType,
207    #[doc = " The socket source address to send from."]
208    pub from: *const RiceAddress,
209    #[doc = " The socket destination address to send to."]
210    pub to: *const RiceAddress,
211    #[doc = " The data to send."]
212    pub data: RiceDataImpl,
213}
214#[allow(clippy::unnecessary_operation, clippy::identity_op)]
215const _: () = {
216    ["Size of RiceTransmit"][::core::mem::size_of::<RiceTransmit>() - 48usize];
217    ["Alignment of RiceTransmit"][::core::mem::align_of::<RiceTransmit>() - 8usize];
218    ["Offset of field: RiceTransmit::stream_id"]
219        [::core::mem::offset_of!(RiceTransmit, stream_id) - 0usize];
220    ["Offset of field: RiceTransmit::transport"]
221        [::core::mem::offset_of!(RiceTransmit, transport) - 8usize];
222    ["Offset of field: RiceTransmit::from"][::core::mem::offset_of!(RiceTransmit, from) - 16usize];
223    ["Offset of field: RiceTransmit::to"][::core::mem::offset_of!(RiceTransmit, to) - 24usize];
224    ["Offset of field: RiceTransmit::data"][::core::mem::offset_of!(RiceTransmit, data) - 32usize];
225};
226#[doc = " A socket with the specified network 5-tuple."]
227#[repr(C)]
228#[derive(Debug)]
229pub struct RiceAgentSocket {
230    #[doc = " The ICE stream id."]
231    pub stream_id: usize,
232    #[doc = " The ICE component id."]
233    pub component_id: usize,
234    #[doc = " The transport type to allocate."]
235    pub transport: RiceTransportType,
236    #[doc = " The source address to allocate from."]
237    pub from: *const RiceAddress,
238    #[doc = " The destination address to connect to."]
239    pub to: *const RiceAddress,
240}
241#[allow(clippy::unnecessary_operation, clippy::identity_op)]
242const _: () = {
243    ["Size of RiceAgentSocket"][::core::mem::size_of::<RiceAgentSocket>() - 40usize];
244    ["Alignment of RiceAgentSocket"][::core::mem::align_of::<RiceAgentSocket>() - 8usize];
245    ["Offset of field: RiceAgentSocket::stream_id"]
246        [::core::mem::offset_of!(RiceAgentSocket, stream_id) - 0usize];
247    ["Offset of field: RiceAgentSocket::component_id"]
248        [::core::mem::offset_of!(RiceAgentSocket, component_id) - 8usize];
249    ["Offset of field: RiceAgentSocket::transport"]
250        [::core::mem::offset_of!(RiceAgentSocket, transport) - 16usize];
251    ["Offset of field: RiceAgentSocket::from"]
252        [::core::mem::offset_of!(RiceAgentSocket, from) - 24usize];
253    ["Offset of field: RiceAgentSocket::to"]
254        [::core::mem::offset_of!(RiceAgentSocket, to) - 32usize];
255};
256#[doc = " An ICE candidate."]
257#[repr(C)]
258#[derive(Debug)]
259pub struct RiceCandidate {
260    pub component_id: usize,
261    pub candidate_type: RiceCandidateType,
262    pub transport_type: RiceTransportType,
263    pub foundation: *const ::core::ffi::c_char,
264    pub priority: u32,
265    pub address: *const RiceAddress,
266    pub base_address: *const RiceAddress,
267    pub related_address: *const RiceAddress,
268    pub tcp_type: RiceTcpType,
269    pub extensions: *mut *mut ::core::ffi::c_char,
270    pub extensions_len: usize,
271}
272#[allow(clippy::unnecessary_operation, clippy::identity_op)]
273const _: () = {
274    ["Size of RiceCandidate"][::core::mem::size_of::<RiceCandidate>() - 80usize];
275    ["Alignment of RiceCandidate"][::core::mem::align_of::<RiceCandidate>() - 8usize];
276    ["Offset of field: RiceCandidate::component_id"]
277        [::core::mem::offset_of!(RiceCandidate, component_id) - 0usize];
278    ["Offset of field: RiceCandidate::candidate_type"]
279        [::core::mem::offset_of!(RiceCandidate, candidate_type) - 8usize];
280    ["Offset of field: RiceCandidate::transport_type"]
281        [::core::mem::offset_of!(RiceCandidate, transport_type) - 12usize];
282    ["Offset of field: RiceCandidate::foundation"]
283        [::core::mem::offset_of!(RiceCandidate, foundation) - 16usize];
284    ["Offset of field: RiceCandidate::priority"]
285        [::core::mem::offset_of!(RiceCandidate, priority) - 24usize];
286    ["Offset of field: RiceCandidate::address"]
287        [::core::mem::offset_of!(RiceCandidate, address) - 32usize];
288    ["Offset of field: RiceCandidate::base_address"]
289        [::core::mem::offset_of!(RiceCandidate, base_address) - 40usize];
290    ["Offset of field: RiceCandidate::related_address"]
291        [::core::mem::offset_of!(RiceCandidate, related_address) - 48usize];
292    ["Offset of field: RiceCandidate::tcp_type"]
293        [::core::mem::offset_of!(RiceCandidate, tcp_type) - 56usize];
294    ["Offset of field: RiceCandidate::extensions"]
295        [::core::mem::offset_of!(RiceCandidate, extensions) - 64usize];
296    ["Offset of field: RiceCandidate::extensions_len"]
297        [::core::mem::offset_of!(RiceCandidate, extensions_len) - 72usize];
298};
299#[doc = " A new pair has been selected for a component."]
300#[repr(C)]
301#[derive(Debug)]
302pub struct RiceAgentSelectedPair {
303    #[doc = " The ICE stream id."]
304    pub stream_id: usize,
305    #[doc = " The ICE component id."]
306    pub component_id: usize,
307    #[doc = " The local candidate of a selected pair."]
308    pub local: RiceCandidate,
309    #[doc = " The remote candidate of a selected pair."]
310    pub remote: RiceCandidate,
311    #[doc = " The local TURN transport type (if any)."]
312    pub local_turn_transport: RiceTransportType,
313    #[doc = " The local TURN address to send data from."]
314    pub local_turn_local_addr: *const RiceAddress,
315    #[doc = " The local TURN address to send data to."]
316    pub local_turn_remote_addr: *const RiceAddress,
317}
318#[allow(clippy::unnecessary_operation, clippy::identity_op)]
319const _: () = {
320    ["Size of RiceAgentSelectedPair"][::core::mem::size_of::<RiceAgentSelectedPair>() - 200usize];
321    ["Alignment of RiceAgentSelectedPair"]
322        [::core::mem::align_of::<RiceAgentSelectedPair>() - 8usize];
323    ["Offset of field: RiceAgentSelectedPair::stream_id"]
324        [::core::mem::offset_of!(RiceAgentSelectedPair, stream_id) - 0usize];
325    ["Offset of field: RiceAgentSelectedPair::component_id"]
326        [::core::mem::offset_of!(RiceAgentSelectedPair, component_id) - 8usize];
327    ["Offset of field: RiceAgentSelectedPair::local"]
328        [::core::mem::offset_of!(RiceAgentSelectedPair, local) - 16usize];
329    ["Offset of field: RiceAgentSelectedPair::remote"]
330        [::core::mem::offset_of!(RiceAgentSelectedPair, remote) - 96usize];
331    ["Offset of field: RiceAgentSelectedPair::local_turn_transport"]
332        [::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_transport) - 176usize];
333    ["Offset of field: RiceAgentSelectedPair::local_turn_local_addr"]
334        [::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_local_addr) - 184usize];
335    ["Offset of field: RiceAgentSelectedPair::local_turn_remote_addr"]
336        [::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_remote_addr) - 192usize];
337};
338#[doc = " A [`Component`](crate::component::Component) has changed state."]
339#[repr(C)]
340#[derive(Debug, Copy, Clone)]
341pub struct RiceAgentComponentStateChange {
342    #[doc = " The ICE stream id."]
343    pub stream_id: usize,
344    #[doc = " The ICE component id."]
345    pub component_id: usize,
346    #[doc = " The new state of the component."]
347    pub state: RiceComponentConnectionState,
348}
349#[allow(clippy::unnecessary_operation, clippy::identity_op)]
350const _: () = {
351    ["Size of RiceAgentComponentStateChange"]
352        [::core::mem::size_of::<RiceAgentComponentStateChange>() - 24usize];
353    ["Alignment of RiceAgentComponentStateChange"]
354        [::core::mem::align_of::<RiceAgentComponentStateChange>() - 8usize];
355    ["Offset of field: RiceAgentComponentStateChange::stream_id"]
356        [::core::mem::offset_of!(RiceAgentComponentStateChange, stream_id) - 0usize];
357    ["Offset of field: RiceAgentComponentStateChange::component_id"]
358        [::core::mem::offset_of!(RiceAgentComponentStateChange, component_id) - 8usize];
359    ["Offset of field: RiceAgentComponentStateChange::state"]
360        [::core::mem::offset_of!(RiceAgentComponentStateChange, state) - 16usize];
361};
362#[doc = " A local candidate that has been gathered."]
363#[repr(C)]
364#[derive(Debug)]
365pub struct RiceGatheredCandidate {
366    pub candidate: RiceCandidate,
367    pub turn_agent: *mut ::core::ffi::c_void,
368}
369#[allow(clippy::unnecessary_operation, clippy::identity_op)]
370const _: () = {
371    ["Size of RiceGatheredCandidate"][::core::mem::size_of::<RiceGatheredCandidate>() - 88usize];
372    ["Alignment of RiceGatheredCandidate"]
373        [::core::mem::align_of::<RiceGatheredCandidate>() - 8usize];
374    ["Offset of field: RiceGatheredCandidate::candidate"]
375        [::core::mem::offset_of!(RiceGatheredCandidate, candidate) - 0usize];
376    ["Offset of field: RiceGatheredCandidate::turn_agent"]
377        [::core::mem::offset_of!(RiceGatheredCandidate, turn_agent) - 80usize];
378};
379#[doc = " A [`Component`](crate::component::Component) has gathered a candidate."]
380#[repr(C)]
381#[derive(Debug)]
382pub struct RiceAgentGatheredCandidate {
383    #[doc = " The ICE stream id."]
384    pub stream_id: usize,
385    #[doc = " The candidate gathered."]
386    pub gathered: RiceGatheredCandidate,
387}
388#[allow(clippy::unnecessary_operation, clippy::identity_op)]
389const _: () = {
390    ["Size of RiceAgentGatheredCandidate"]
391        [::core::mem::size_of::<RiceAgentGatheredCandidate>() - 96usize];
392    ["Alignment of RiceAgentGatheredCandidate"]
393        [::core::mem::align_of::<RiceAgentGatheredCandidate>() - 8usize];
394    ["Offset of field: RiceAgentGatheredCandidate::stream_id"]
395        [::core::mem::offset_of!(RiceAgentGatheredCandidate, stream_id) - 0usize];
396    ["Offset of field: RiceAgentGatheredCandidate::gathered"]
397        [::core::mem::offset_of!(RiceAgentGatheredCandidate, gathered) - 8usize];
398};
399#[doc = " A [`Component`](crate::component::Component) has completed gathering."]
400#[repr(C)]
401#[derive(Debug, Copy, Clone)]
402pub struct RiceAgentGatheringComplete {
403    #[doc = " The ICE stream id."]
404    pub stream_id: usize,
405    #[doc = " The ICE component id."]
406    pub component_id: usize,
407}
408#[allow(clippy::unnecessary_operation, clippy::identity_op)]
409const _: () = {
410    ["Size of RiceAgentGatheringComplete"]
411        [::core::mem::size_of::<RiceAgentGatheringComplete>() - 16usize];
412    ["Alignment of RiceAgentGatheringComplete"]
413        [::core::mem::align_of::<RiceAgentGatheringComplete>() - 8usize];
414    ["Offset of field: RiceAgentGatheringComplete::stream_id"]
415        [::core::mem::offset_of!(RiceAgentGatheringComplete, stream_id) - 0usize];
416    ["Offset of field: RiceAgentGatheringComplete::component_id"]
417        [::core::mem::offset_of!(RiceAgentGatheringComplete, component_id) - 8usize];
418};
419#[doc = " The Agent is closed.  No further progress will be made."]
420pub const RICE_AGENT_POLL_CLOSED: RiceAgentPoll_Tag = 0;
421#[doc = " Wait until the specified `Instant` has been reached (or an external event)."]
422pub const RICE_AGENT_POLL_WAIT_UNTIL_NANOS: RiceAgentPoll_Tag = 1;
423#[doc = " Connect from the specified interface to the specified address.  Reply (success or failure)\n should be notified using `rice_stream_handle_allocated_socket()`."]
424pub const RICE_AGENT_POLL_ALLOCATE_SOCKET: RiceAgentPoll_Tag = 2;
425#[doc = " It is possible to remove the specified 5-tuple. The socket will not be referenced any\n further."]
426pub const RICE_AGENT_POLL_REMOVE_SOCKET: RiceAgentPoll_Tag = 3;
427#[doc = " A new pair has been selected for a component."]
428pub const RICE_AGENT_POLL_SELECTED_PAIR: RiceAgentPoll_Tag = 4;
429#[doc = " A [`Component`](crate::component::Component) has changed state."]
430pub const RICE_AGENT_POLL_COMPONENT_STATE_CHANGE: RiceAgentPoll_Tag = 5;
431#[doc = " A [`Component`](crate::component::Component) has gathered a candidate."]
432pub const RICE_AGENT_POLL_GATHERED_CANDIDATE: RiceAgentPoll_Tag = 6;
433#[doc = " A [`Component`](crate::component::Component) has completed gathering."]
434pub const RICE_AGENT_POLL_GATHERING_COMPLETE: RiceAgentPoll_Tag = 7;
435#[doc = " Return value of `rice_agent_poll()`."]
436pub type RiceAgentPoll_Tag = ::core::ffi::c_uint;
437#[repr(C)]
438pub struct RiceAgentPoll {
439    pub tag: RiceAgentPoll_Tag,
440    pub field1: RiceAgentPoll__bindgen_ty_1,
441}
442#[repr(C)]
443pub union RiceAgentPoll__bindgen_ty_1 {
444    pub field1: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>,
445    pub field2: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>,
446    pub field3: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>,
447    pub field4: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>,
448    pub field5: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>,
449    pub field6: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>,
450    pub field7: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>,
451}
452#[repr(C)]
453#[derive(Debug, Copy, Clone)]
454pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_1 {
455    pub wait_until_nanos: i64,
456}
457#[allow(clippy::unnecessary_operation, clippy::identity_op)]
458const _: () = {
459    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_1"]
460        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>() - 8usize];
461    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_1"]
462        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>() - 8usize];
463    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_1::wait_until_nanos"][::core::mem::offset_of!(
464        RiceAgentPoll__bindgen_ty_1__bindgen_ty_1,
465        wait_until_nanos
466    ) - 0usize];
467};
468#[repr(C)]
469#[derive(Debug)]
470pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_2 {
471    pub allocate_socket: RiceAgentSocket,
472}
473#[allow(clippy::unnecessary_operation, clippy::identity_op)]
474const _: () = {
475    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_2"]
476        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>() - 40usize];
477    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_2"]
478        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>() - 8usize];
479    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_2::allocate_socket"][::core::mem::offset_of!(
480        RiceAgentPoll__bindgen_ty_1__bindgen_ty_2,
481        allocate_socket
482    ) - 0usize];
483};
484#[repr(C)]
485#[derive(Debug)]
486pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_3 {
487    pub remove_socket: RiceAgentSocket,
488}
489#[allow(clippy::unnecessary_operation, clippy::identity_op)]
490const _: () = {
491    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_3"]
492        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>() - 40usize];
493    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_3"]
494        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>() - 8usize];
495    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_3::remove_socket"][::core::mem::offset_of!(
496        RiceAgentPoll__bindgen_ty_1__bindgen_ty_3,
497        remove_socket
498    ) - 0usize];
499};
500#[repr(C)]
501#[derive(Debug)]
502pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_4 {
503    pub selected_pair: RiceAgentSelectedPair,
504}
505#[allow(clippy::unnecessary_operation, clippy::identity_op)]
506const _: () = {
507    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_4"]
508        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>() - 200usize];
509    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_4"]
510        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>() - 8usize];
511    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_4::selected_pair"][::core::mem::offset_of!(
512        RiceAgentPoll__bindgen_ty_1__bindgen_ty_4,
513        selected_pair
514    ) - 0usize];
515};
516#[repr(C)]
517#[derive(Debug, Copy, Clone)]
518pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_5 {
519    pub component_state_change: RiceAgentComponentStateChange,
520}
521#[allow(clippy::unnecessary_operation, clippy::identity_op)]
522const _: () = {
523    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_5"]
524        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>() - 24usize];
525    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_5"]
526        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>() - 8usize];
527    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_5::component_state_change"][::core::mem::offset_of!(
528        RiceAgentPoll__bindgen_ty_1__bindgen_ty_5,
529        component_state_change
530    )
531        - 0usize];
532};
533#[repr(C)]
534#[derive(Debug)]
535pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_6 {
536    pub gathered_candidate: RiceAgentGatheredCandidate,
537}
538#[allow(clippy::unnecessary_operation, clippy::identity_op)]
539const _: () = {
540    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_6"]
541        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>() - 96usize];
542    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_6"]
543        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>() - 8usize];
544    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_6::gathered_candidate"][::core::mem::offset_of!(
545        RiceAgentPoll__bindgen_ty_1__bindgen_ty_6,
546        gathered_candidate
547    ) - 0usize];
548};
549#[repr(C)]
550#[derive(Debug, Copy, Clone)]
551pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_7 {
552    pub gathering_complete: RiceAgentGatheringComplete,
553}
554#[allow(clippy::unnecessary_operation, clippy::identity_op)]
555const _: () = {
556    ["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_7"]
557        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>() - 16usize];
558    ["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_7"]
559        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>() - 8usize];
560    ["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_7::gathering_complete"][::core::mem::offset_of!(
561        RiceAgentPoll__bindgen_ty_1__bindgen_ty_7,
562        gathering_complete
563    ) - 0usize];
564};
565#[allow(clippy::unnecessary_operation, clippy::identity_op)]
566const _: () = {
567    ["Size of RiceAgentPoll__bindgen_ty_1"]
568        [::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1>() - 200usize];
569    ["Alignment of RiceAgentPoll__bindgen_ty_1"]
570        [::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1>() - 8usize];
571};
572#[allow(clippy::unnecessary_operation, clippy::identity_op)]
573const _: () = {
574    ["Size of RiceAgentPoll"][::core::mem::size_of::<RiceAgentPoll>() - 208usize];
575    ["Alignment of RiceAgentPoll"][::core::mem::align_of::<RiceAgentPoll>() - 8usize];
576    ["Offset of field: RiceAgentPoll::tag"][::core::mem::offset_of!(RiceAgentPoll, tag) - 0usize];
577};
578#[doc = " ICE/TURN credentials."]
579pub type RiceCredentials = Credentials;
580#[doc = " Return value for `rice_stream_handle_incoming_data()`."]
581#[repr(C)]
582#[derive(Debug)]
583pub struct RiceStreamIncomingData {
584    #[doc = " The data was handled internally. `rice_agent_poll()` should be called at the\n next earliest opportunity."]
585    pub handled: bool,
586    #[doc = " Whether there is more data to pull using `rice_stream_poll_recv()`."]
587    pub have_more_data: bool,
588    #[doc = " The data pointer. If non-NULL, this is the same value as provided to\n `rice_stream_handle_incoming_data()` and has the same lifetime contraints as that original\n data pointer."]
589    pub data: RiceDataImpl,
590}
591#[allow(clippy::unnecessary_operation, clippy::identity_op)]
592const _: () = {
593    ["Size of RiceStreamIncomingData"][::core::mem::size_of::<RiceStreamIncomingData>() - 24usize];
594    ["Alignment of RiceStreamIncomingData"]
595        [::core::mem::align_of::<RiceStreamIncomingData>() - 8usize];
596    ["Offset of field: RiceStreamIncomingData::handled"]
597        [::core::mem::offset_of!(RiceStreamIncomingData, handled) - 0usize];
598    ["Offset of field: RiceStreamIncomingData::have_more_data"]
599        [::core::mem::offset_of!(RiceStreamIncomingData, have_more_data) - 1usize];
600    ["Offset of field: RiceStreamIncomingData::data"]
601        [::core::mem::offset_of!(RiceStreamIncomingData, data) - 8usize];
602};
603unsafe extern "C" {
604    #[doc = " Query the built version of `rice-proto`."]
605    pub fn rice_version(major: *mut u32, minor: *mut u32, patch: *mut u32);
606}
607unsafe extern "C" {
608    #[doc = " Create a new ICE Agent."]
609    pub fn rice_agent_new(controlling: bool, trickle_ice: bool) -> *mut RiceAgent;
610}
611unsafe extern "C" {
612    #[doc = " Increase the reference count of the `RiceAgent`.\n\n This function is multi-threading safe."]
613    pub fn rice_agent_ref(agent: *const RiceAgent) -> *mut RiceAgent;
614}
615unsafe extern "C" {
616    #[doc = " Decrease the reference count of the `RiceAgent`.\n\n If this is the last reference, then the `RiceAgent` is freed.\n\n This function is multi-threading safe."]
617    pub fn rice_agent_unref(agent: *mut RiceAgent);
618}
619unsafe extern "C" {
620    #[doc = " Close the `RiceAgent`.\n\n Closure does involve closing network resources (signalled through calls to\n `rice_agent_poll()`) and will only succesfully complete once `rice_agent_poll`() returns\n `Closed`."]
621    pub fn rice_agent_close(agent: *const RiceAgent, now_nanos: i64);
622}
623unsafe extern "C" {
624    #[doc = " Return the process-local unique id for this agent."]
625    pub fn rice_agent_id(agent: *const RiceAgent) -> u64;
626}
627unsafe extern "C" {
628    #[doc = " Get the timing advance time in nanoseconds of the `RiceAgent`.\n\n This is known as the Ta value in the ICE specification.\n\n The default value is 50ms."]
629    pub fn rice_agent_get_timing_advance(agent: *const RiceAgent) -> u64;
630}
631unsafe extern "C" {
632    #[doc = " Set the timing advance time in nanoseconds of the `RiceAgent`.\n\n This is known as the Ta value in the ICE specification.\n\n The default value is 50ms."]
633    pub fn rice_agent_set_timing_advance(agent: *const RiceAgent, ta: u64);
634}
635unsafe extern "C" {
636    #[doc = " Configure the default timeouts and retransmissions for each STUN request.\n\n - `initial` - the initial time between consecutive transmissions. If 0, or 1, then only a\n   single request will be performed.\n - `max` - the maximum amount of time between consecutive retransmits.\n - `retransmits` - the total number of transmissions of the request.\n - `final_retransmit_timeout` - the amount of time after the final transmission to wait\n   for a response before considering the request as having timed out.\n\n As specified in RFC 8489, `initial_rto` should be >= 500ms (unless specific information is\n available on the RTT, `max` is `Duration::MAX`, `retransmits` has a default value of 7,\n and `last_retransmit_timeout` should be `16 * initial_rto`.\n\n STUN transactions over TCP will only send a single request and have a timeout of the sum of\n the timeouts of a UDP transaction."]
637    pub fn rice_agent_set_request_retransmits(
638        agent: *const RiceAgent,
639        initial_nanos: u64,
640        max_nanos: u64,
641        retransmits: u32,
642        final_retransmit_timeout_nanos: u64,
643    );
644}
645unsafe extern "C" {
646    #[doc = " Get the controlling state of the `RiceAgent`.\n\n A return value of `true` indicates the `RiceAgent` is in controlling mode, false the controlled\n mode.  This value can change during ICE processing."]
647    pub fn rice_agent_get_controlling(agent: *const RiceAgent) -> bool;
648}
649unsafe extern "C" {
650    #[doc = " The number of bytes in a `RiceData`."]
651    pub fn rice_data_len(data: *const RiceData) -> usize;
652}
653unsafe extern "C" {
654    #[doc = " The data pointer for a `RiceData`."]
655    pub fn rice_data_ptr(data: *const RiceData) -> *mut u8;
656}
657unsafe extern "C" {
658    #[doc = " Free any resources allocated within a `RiceTransmit`.\n\n The `RiceTransmit` must have been previously initialized with `rice_transmit_init()`."]
659    pub fn rice_transmit_clear(transmit: *mut RiceTransmit);
660}
661unsafe extern "C" {
662    #[doc = " Initialize a `RiceTransmit` with default values."]
663    pub fn rice_transmit_init(transmit: *mut RiceTransmit);
664}
665unsafe extern "C" {
666    #[doc = " Initialize a `RiceAgentPoll` with a default value."]
667    pub fn rice_agent_poll_init(poll: *mut RiceAgentPoll);
668}
669unsafe extern "C" {
670    #[doc = " Clear a `RiceAgentPoll` of any allocated values.\n\n `rice_agent_poll_init()` must have been called previously."]
671    pub fn rice_agent_poll_clear(poll: *mut RiceAgentPoll);
672}
673unsafe extern "C" {
674    #[doc = " Poll the `RiceAgent` for further progress.\n\n The returned value indicates what should be done to continue making progress."]
675    pub fn rice_agent_poll(agent: *mut RiceAgent, now_nanos: i64, poll: *mut RiceAgentPoll);
676}
677unsafe extern "C" {
678    #[doc = " Poll the `RiceAgent` for a transmission to send.\n\n If there is no transmission, then `transmit` will be filled with empty data.\n\n `rice_transmit_init()` or `rice_transmit_clear()` must be called before this function."]
679    pub fn rice_agent_poll_transmit(
680        agent: *mut RiceAgent,
681        now_nanos: i64,
682        transmit: *mut RiceTransmit,
683    );
684}
685unsafe extern "C" {
686    #[doc = " Add a STUN server to this `RiceAgent`."]
687    pub fn rice_agent_add_stun_server(
688        agent: *const RiceAgent,
689        transport: RiceTransportType,
690        addr: *const RiceAddress,
691    );
692}
693unsafe extern "C" {
694    #[doc = " Create a new TURN configuration."]
695    pub fn rice_turn_config_new(
696        transport: RiceTransportType,
697        addr: *const RiceAddress,
698        credentials: *const RiceCredentials,
699    ) -> *mut RiceTurnConfig;
700}
701unsafe extern "C" {
702    #[doc = " Copy a [`RiceTurnConfig`]."]
703    pub fn rice_turn_config_copy(config: *const RiceTurnConfig) -> *mut RiceTurnConfig;
704}
705unsafe extern "C" {
706    #[doc = " Free a [`RiceTurnConfig`]."]
707    pub fn rice_turn_config_free(config: *mut RiceTurnConfig);
708}
709unsafe extern "C" {
710    #[doc = " The transport to connect to the TURN server."]
711    pub fn rice_turn_config_get_client_transport(
712        config: *const RiceTurnConfig,
713    ) -> RiceTransportType;
714}
715unsafe extern "C" {
716    #[doc = " The address of the TURN server."]
717    pub fn rice_turn_config_get_addr(config: *const RiceTurnConfig) -> *mut RiceAddress;
718}
719unsafe extern "C" {
720    #[doc = " Set the allocation transport requested from the TURN server."]
721    pub fn rice_turn_config_set_allocation_transport(
722        config: *const RiceTurnConfig,
723        transport: RiceTransportType,
724    );
725}
726unsafe extern "C" {
727    #[doc = " Retrieve the allocation transport that will be requested from the TURN server."]
728    pub fn rice_turn_config_get_allocation_transport(
729        config: *const RiceTurnConfig,
730    ) -> RiceTransportType;
731}
732unsafe extern "C" {
733    #[doc = " Add an [`RiceAddressFamily`] that will be requested.\n\n Duplicate [`RiceAddressFamily`]s are ignored."]
734    pub fn rice_turn_config_add_address_family(
735        config: *mut RiceTurnConfig,
736        family: RiceAddressFamily,
737    );
738}
739unsafe extern "C" {
740    #[doc = " Set the [`RiceAddressFamily`] that will be requested.\n\n This will override all previously set [`RiceAddressFamily`]s."]
741    pub fn rice_turn_config_set_address_family(
742        config: *mut RiceTurnConfig,
743        family: RiceAddressFamily,
744    );
745}
746unsafe extern "C" {
747    #[doc = " The address family to allocate as a relayed address on the TURN server."]
748    pub fn rice_turn_config_get_address_families(
749        config: *const RiceTurnConfig,
750        n_families: *mut usize,
751        families: *mut RiceAddressFamily,
752    );
753}
754unsafe extern "C" {
755    #[doc = " The credentials to use for accessing the TURN server."]
756    pub fn rice_turn_config_get_credentials(config: *const RiceTurnConfig) -> *mut RiceCredentials;
757}
758unsafe extern "C" {
759    #[doc = " Connect to the TURN server over TLS."]
760    pub fn rice_turn_config_set_tls_config(
761        config: *mut RiceTurnConfig,
762        tls_config: *const RiceTlsConfig,
763    );
764}
765unsafe extern "C" {
766    #[doc = " The TLS config associated with this TURN configuration."]
767    pub fn rice_turn_config_get_tls_config(config: *const RiceTurnConfig) -> *mut RiceTlsConfig;
768}
769unsafe extern "C" {
770    #[doc = " Add a supported integrity algorithm for authentication with the TURN server."]
771    pub fn rice_turn_config_add_supported_integrity(
772        config: *mut RiceTurnConfig,
773        integrity: RiceIntegrityAlgorithm,
774    );
775}
776unsafe extern "C" {
777    #[doc = " Set the supported integrity algorithm for authentication with the TURN server.\n\n This will override all previously set values."]
778    pub fn rice_turn_config_set_supported_integrity(
779        config: *mut RiceTurnConfig,
780        integrity: RiceIntegrityAlgorithm,
781    );
782}
783unsafe extern "C" {
784    #[doc = " The address family to allocate as a relayed address on the TURN server."]
785    pub fn rice_turn_config_get_supported_integrity(
786        config: *const RiceTurnConfig,
787        n_integrities: *mut usize,
788        integrities: *mut RiceIntegrityAlgorithm,
789    );
790}
791unsafe extern "C" {
792    #[doc = " Set whether anonymous username usage is required.\n\n A value of `Required` requires the server to support RFC 8489 and the `Userhash` attribute."]
793    pub fn rice_turn_config_set_anonymous_username(config: *mut RiceTurnConfig, anon: RiceFeature);
794}
795unsafe extern "C" {
796    #[doc = " Whether anonymous username usage is required.\n\n A value of `Required` requires the server to support RFC 8489 and the `Userhash` attribute."]
797    pub fn rice_turn_config_get_anonymous_username(config: *mut RiceTurnConfig) -> RiceFeature;
798}
799unsafe extern "C" {
800    #[doc = " Increase the reference count of the `RiceTlsConfig`.\n\n This function is multi-threading safe."]
801    pub fn rice_tls_config_ref(config: *const RiceTlsConfig) -> *mut RiceTlsConfig;
802}
803unsafe extern "C" {
804    #[doc = " Decrease the reference count of the `RiceTlsConfig`.\n\n If this is the last reference, then the `RiceTlsConfig` is freed.\n\n This function is multi-threading safe."]
805    pub fn rice_tls_config_unref(config: *mut RiceTlsConfig);
806}
807unsafe extern "C" {
808    #[doc = " The TLS variant for a [`RiceTlsConfig`]"]
809    pub fn rice_tls_config_variant(config: *const RiceTlsConfig) -> RiceTlsVariant;
810}
811unsafe extern "C" {
812    #[doc = " Construct a new TLS configuration using Openssl."]
813    pub fn rice_tls_config_new_openssl(transport: RiceTransportType) -> *mut RiceTlsConfig;
814}
815unsafe extern "C" {
816    #[doc = " Construct a new TLS configuration using Rustls."]
817    pub fn rice_tls_config_new_rustls_with_dns(
818        server_name: *const ::core::ffi::c_char,
819    ) -> *mut RiceTlsConfig;
820}
821unsafe extern "C" {
822    #[doc = " Construct a new TLS configuration using Rustls."]
823    pub fn rice_tls_config_new_rustls_with_ip(addr: *const RiceAddress) -> *mut RiceTlsConfig;
824}
825unsafe extern "C" {
826    #[doc = " Construct a new TLS configuration using Rustls."]
827    pub fn rice_tls_config_new_dimpl() -> *mut RiceTlsConfig;
828}
829unsafe extern "C" {
830    #[doc = " Add an ICE stream to the `RiceAgent`."]
831    pub fn rice_agent_add_stream(agent: *mut RiceAgent) -> *mut RiceStream;
832}
833unsafe extern "C" {
834    #[doc = " Retrieve a previously added stream from the `RiceAgent`.\n\n Will return `NULL` if the stream does not exist."]
835    pub fn rice_agent_get_stream(agent: *const RiceAgent, stream_id: usize) -> *mut RiceStream;
836}
837unsafe extern "C" {
838    #[doc = " Increase the reference count of the `RiceStream`.\n\n This function is multi-threading safe."]
839    pub fn rice_stream_ref(stream: *const RiceStream) -> *mut RiceStream;
840}
841unsafe extern "C" {
842    #[doc = " Decrease the reference count of the `RiceStream`.\n\n If this is the last reference, then the `RiceStream` is freed (but will still be referenced by\n the `RiceAgent`).\n\n This function is multi-threading safe."]
843    pub fn rice_stream_unref(stream: *mut RiceStream);
844}
845unsafe extern "C" {
846    #[doc = " Retrieve the stream id of the `RiceStream`."]
847    pub fn rice_stream_get_id(stream: *const RiceStream) -> usize;
848}
849unsafe extern "C" {
850    #[doc = " Retrieve the `RiceAgent` of the `RiceStream`."]
851    pub fn rice_stream_get_agent(stream: *const RiceStream) -> *mut RiceAgent;
852}
853unsafe extern "C" {
854    #[doc = " Notify success or failure to create a socket to the `RiceStream`.\n\n `socket_addr` can be `NULL` to indicate failure."]
855    pub fn rice_stream_handle_allocated_socket(
856        stream: *mut RiceStream,
857        component_id: usize,
858        transport: RiceTransportType,
859        from: *const RiceAddress,
860        to: *const RiceAddress,
861        socket_addr: *mut RiceAddress,
862        now_nanos: i64,
863    );
864}
865unsafe extern "C" {
866    #[doc = " Construct a new set of ICE/TURN credentials."]
867    pub fn rice_credentials_new(
868        ufrag: *const ::core::ffi::c_char,
869        passwd: *const ::core::ffi::c_char,
870    ) -> *mut RiceCredentials;
871}
872unsafe extern "C" {
873    #[doc = " Construct a new set of ICE/TURN credentials."]
874    pub fn rice_credentials_copy(creds: *const RiceCredentials) -> *mut RiceCredentials;
875}
876unsafe extern "C" {
877    #[doc = " Free a set of ICE/TURN credentials."]
878    pub fn rice_credentials_free(credentials: *mut RiceCredentials);
879}
880unsafe extern "C" {
881    #[doc = " Retrieve the `RiceCandidate` ufrag attribute bytes.\n The pre-allocated array should be 256 bytes at most.\n\n Returns the actual length of the ufrag attribute."]
882    pub fn rice_credentials_get_ufrag_bytes(
883        credentials: *const RiceCredentials,
884        ptr: *mut ::core::ffi::c_char,
885    ) -> usize;
886}
887unsafe extern "C" {
888    #[doc = " Compare two sets of Credentials.\n\n This function is NULL safe."]
889    pub fn rice_credentials_eq(
890        creds1: *const RiceCredentials,
891        creds2: *const RiceCredentials,
892    ) -> bool;
893}
894unsafe extern "C" {
895    #[doc = " Retrieve the local ICE credentials currently set on the `RiceStream`."]
896    pub fn rice_stream_get_local_credentials(stream: *const RiceStream) -> *mut RiceCredentials;
897}
898unsafe extern "C" {
899    #[doc = " Retrieve the remote ICE credentials currently set on the `RiceStream`."]
900    pub fn rice_stream_get_remote_credentials(stream: *const RiceStream) -> *mut RiceCredentials;
901}
902unsafe extern "C" {
903    #[doc = " Set the local credentials to use for this `RiceStream`."]
904    pub fn rice_stream_set_local_credentials(
905        stream: *mut RiceStream,
906        credentials: *const RiceCredentials,
907    );
908}
909unsafe extern "C" {
910    #[doc = " Set the remote credentials to use for this `RiceStream`."]
911    pub fn rice_stream_set_remote_credentials(
912        stream: *mut RiceStream,
913        credentials: *const RiceCredentials,
914    );
915}
916unsafe extern "C" {
917    #[doc = " Construct a `RiceCandidate` from a string as formatted in an SDP and specified in RFC5245\n Section 15.1.\n\n Takes the form 'a=candidate:foundation 1 UDP 12345 127.0.0.1 23456 typ host'."]
918    pub fn rice_candidate_new_from_sdp_string(
919        cand_str: *const ::core::ffi::c_char,
920    ) -> *mut RiceCandidate;
921}
922unsafe extern "C" {
923    #[doc = " Construct a `RiceCandidate` from a string as formatted in an SDP and specified in RFC5245\n Section 15.1.\n\n Takes the form 'a=candidate:foundation 1 UDP 12345 127.0.0.1 23456 typ host'."]
924    pub fn rice_candidate_init_from_sdp_string(
925        candidate: *mut RiceCandidate,
926        cand_str: *const ::core::ffi::c_char,
927    ) -> RiceParseCandidateError;
928}
929unsafe extern "C" {
930    #[doc = " Return a SDP candidate string as specified in RFC5245 Section 15.1."]
931    pub fn rice_candidate_to_sdp_string(
932        candidate: *const RiceCandidate,
933    ) -> *mut ::core::ffi::c_char;
934}
935unsafe extern "C" {
936    #[doc = " Free an allocated string."]
937    pub fn rice_string_free(string: *mut ::core::ffi::c_char);
938}
939unsafe extern "C" {
940    #[doc = " Construct a new `RiceCandidate` with the provided values.\n\n Will return NULL on error."]
941    pub fn rice_candidate_new(
942        component_id: usize,
943        ctype: RiceCandidateType,
944        ttype: RiceTransportType,
945        foundation: *const ::core::ffi::c_char,
946        address: *mut RiceAddress,
947    ) -> *mut RiceCandidate;
948}
949unsafe extern "C" {
950    #[doc = " Construct a new `RiceCandidate` with the provided values."]
951    pub fn rice_candidate_init(
952        candidate: *mut RiceCandidate,
953        component_id: usize,
954        ctype: RiceCandidateType,
955        ttype: RiceTransportType,
956        foundation: *const ::core::ffi::c_char,
957        address: *mut RiceAddress,
958    ) -> RiceError;
959}
960unsafe extern "C" {
961    #[doc = " Set the base address of a `RiceCandidate`."]
962    pub fn rice_candidate_set_priority(candidate: *mut RiceCandidate, priority: u32);
963}
964unsafe extern "C" {
965    #[doc = " Set the base address of a `RiceCandidate`."]
966    pub fn rice_candidate_set_base_address(
967        candidate: *mut RiceCandidate,
968        base_address: *mut RiceAddress,
969    );
970}
971unsafe extern "C" {
972    #[doc = " Set the related address of a `RiceCandidate`."]
973    pub fn rice_candidate_set_related_address(
974        candidate: *mut RiceCandidate,
975        related_address: *mut RiceAddress,
976    );
977}
978unsafe extern "C" {
979    #[doc = " Set the tcp type of a `RiceCandidate`."]
980    pub fn rice_candidate_set_tcp_type(candidate: *mut RiceCandidate, tcp_type: RiceTcpType);
981}
982unsafe extern "C" {
983    #[doc = " Perform a deep copy of a `RiceCandidate`."]
984    pub fn rice_candidate_copy(candidate: *const RiceCandidate) -> *mut RiceCandidate;
985}
986unsafe extern "C" {
987    #[doc = " Perform a deep copy of a `RiceCandidate`."]
988    pub fn rice_candidate_copy_into(candidate: *const RiceCandidate, ret: *mut RiceCandidate);
989}
990unsafe extern "C" {
991    #[doc = " Clear any resources allocated within a `RiceCandidate`.\n\n Useful for stack-allocated `RiceCandidate`s or when embedded in other structures.\n\n This function is NULL safe."]
992    pub fn rice_candidate_clear(candidate: *mut RiceCandidate);
993}
994unsafe extern "C" {
995    #[doc = " Free a `RiceCandidate`.\n\n This function is NULL safe."]
996    pub fn rice_candidate_free(candidate: *mut RiceCandidate);
997}
998unsafe extern "C" {
999    #[doc = " Free a `RiceCandidate`."]
1000    pub fn rice_candidate_eq(candidate: *const RiceCandidate, other: *const RiceCandidate) -> bool;
1001}
1002unsafe extern "C" {
1003    #[doc = " Add a local `RiceGatheredCandidate` to a `RiceStream`."]
1004    pub fn rice_stream_add_local_gathered_candidate(
1005        stream: *mut RiceStream,
1006        candidate: *const RiceGatheredCandidate,
1007    ) -> bool;
1008}
1009unsafe extern "C" {
1010    #[doc = " Add a remote candidate to the `RiceStream`."]
1011    pub fn rice_stream_add_remote_candidate(
1012        stream: *mut RiceStream,
1013        candidate: *const RiceCandidate,
1014    );
1015}
1016unsafe extern "C" {
1017    #[doc = " Signal the end of a set of local candidates.\n\n Any local candidates provided after calling this function will result in an error."]
1018    pub fn rice_stream_end_of_local_candidates(stream: *mut RiceStream);
1019}
1020unsafe extern "C" {
1021    #[doc = " Retrieve previously set local candidates for connection checks from this stream."]
1022    pub fn rice_stream_get_local_candidates(
1023        stream: *mut RiceStream,
1024        n_candidates: *mut usize,
1025        candidates: *mut RiceCandidate,
1026    );
1027}
1028unsafe extern "C" {
1029    #[doc = " Signal the end of a set of remote candidates.\n\n Any remote candidates provided after calling this function will result in an error."]
1030    pub fn rice_stream_end_of_remote_candidates(stream: *mut RiceStream);
1031}
1032unsafe extern "C" {
1033    #[doc = " Retrieve previously set remote candidates for connection checks from this stream."]
1034    pub fn rice_stream_get_remote_candidates(
1035        stream: *mut RiceStream,
1036        n_candidates: *mut usize,
1037        candidates: *mut RiceCandidate,
1038    );
1039}
1040unsafe extern "C" {
1041    #[doc = " Provide data to the `RiceStream` for processing.\n\n The returned value contains what processing was completed on the provided data and any\n application data that needs to be handled."]
1042    pub fn rice_stream_handle_incoming_data(
1043        stream: *mut RiceStream,
1044        component_id: usize,
1045        transport: RiceTransportType,
1046        from: *const RiceAddress,
1047        to: *const RiceAddress,
1048        data: *const u8,
1049        data_len: usize,
1050        now_nanos: i64,
1051        ret: *mut RiceStreamIncomingData,
1052    );
1053}
1054unsafe extern "C" {
1055    #[doc = " Poll for further application data that has been received.\n\n Free the returned data with `rice_free_data()`."]
1056    pub fn rice_stream_poll_recv(
1057        stream: *mut RiceStream,
1058        component_id: *mut usize,
1059        data_len: *mut usize,
1060    ) -> *mut u8;
1061}
1062unsafe extern "C" {
1063    #[doc = " Free allocated data."]
1064    pub fn rice_free_data(data: *mut u8);
1065}
1066unsafe extern "C" {
1067    #[doc = " Return the component ids currently in use by a `RiceStream`.\n\n `ret` can be NULL to discover the length of the data that would be provided."]
1068    pub fn rice_stream_component_ids(stream: *mut RiceStream, len: *mut usize, ret: *mut usize);
1069}
1070unsafe extern "C" {
1071    #[doc = " Add an ICE component to a `RiceStream`."]
1072    pub fn rice_stream_add_component(stream: *mut RiceStream) -> *mut RiceComponent;
1073}
1074unsafe extern "C" {
1075    #[doc = " Increase the reference count of the `RiceComponent`.\n\n This function is multi-threading safe."]
1076    pub fn rice_component_ref(component: *const RiceComponent) -> *mut RiceComponent;
1077}
1078unsafe extern "C" {
1079    #[doc = " Decrease the reference count of the `RiceComponent`.\n\n If this is the last reference, then the `RiceComponent` is freed (but will still be referenced by\n the `RiceStream`).\n\n This function is multi-threading safe."]
1080    pub fn rice_component_unref(component: *mut RiceComponent);
1081}
1082unsafe extern "C" {
1083    #[doc = " Retrieve the component id of the `RiceComponent`."]
1084    pub fn rice_component_get_id(component: *const RiceComponent) -> usize;
1085}
1086unsafe extern "C" {
1087    #[doc = " Retrieve the component id of the `RiceComponent`."]
1088    pub fn rice_component_get_stream(component: *const RiceComponent) -> *mut RiceStream;
1089}
1090unsafe extern "C" {
1091    #[doc = " Retrieve the component connection state of the `RiceComponent`."]
1092    pub fn rice_component_get_state(
1093        component: *const RiceComponent,
1094    ) -> RiceComponentConnectionState;
1095}
1096unsafe extern "C" {
1097    #[doc = " Retrieve the ICE candidates selected pair of the `RiceComponent`.\n\n Before the pair has been selected through ICE, `local` and `remote` will be zeroed to signal\n unset."]
1098    pub fn rice_component_selected_pair(
1099        component: *const RiceComponent,
1100        local: *mut RiceCandidate,
1101        remote: *mut RiceCandidate,
1102    );
1103}
1104unsafe extern "C" {
1105    #[doc = " Retrieve a previously added `RiceComponent`.\n\n If the `RiceComponent` does not exist, `NULL` is returned."]
1106    pub fn rice_stream_get_component(
1107        stream: *const RiceStream,
1108        component_id: usize,
1109    ) -> *mut RiceComponent;
1110}
1111unsafe extern "C" {
1112    #[doc = " Start gathering candidates for a component with the provided local socket addresses.\n\n - `component`: The component to start gathering.\n - `sockets_len`: The number of entries in both `sockets_addr` and `sockets_transports`.\n - `sockets_addr`: An array of addresses for producing host and STUN server-reflexive\n   candidates.\n - `sockets_transports`: An array of transport types for producing host and STUN\n   server-reflexive candidates.\n - `turn_len`: the number of entries in both `turn_sockets` and `turn_config`.\n - `turn_sockets`: An array of local addresses for producing TURN candidates.\n - `turn_config`: An array of TURN server configurations.\n\n Candidates will be generated as follows (if they succeed):\n\n 1. A host candidate for each `(sockets_transports[i], socket_addr[i])`. If TCP, then both an\n    active and passive host candidate will be generated.\n 2. For each configured STUN server, a reflexive candidate for each\n    `(sockets_transports[i], socket_addr[i])` if different from any other candidate\n    produced. The local address for each STUN server connection will be one of the entries\n    provided in `sockets_addr`.\n 3. For each `(turn_sockets[i], turn_config[i])` a TURN allocation will be attempted and a\n    relayed candidate produced on success.  If you would like multiple options for relayed\n    candidates, e.g. UDP, TCP, TCP/TLS, then provide each options as different entries in the\n    provided array. The `turn_sockets[i]` value is the local address to communicate with the\n    TURN server in `turn_config[i]` and should be different than any value provided through\n    `sockets_addr`."]
1113    pub fn rice_component_gather_candidates(
1114        component: *mut RiceComponent,
1115        sockets_len: usize,
1116        sockets_addr: *const *const RiceAddress,
1117        sockets_transports: *const RiceTransportType,
1118        turn_len: usize,
1119        turn_sockets: *const *const RiceAddress,
1120        turn_config: *const *mut RiceTurnConfig,
1121    ) -> RiceError;
1122}
1123unsafe extern "C" {
1124    #[doc = " Send data to the connected peer.\n\n This will fail before a connection is successfully completed."]
1125    pub fn rice_component_send(
1126        component: *mut RiceComponent,
1127        data: *mut u8,
1128        len: usize,
1129        now_nanos: i64,
1130        transmit: *mut RiceTransmit,
1131    ) -> RiceError;
1132}
1133unsafe extern "C" {
1134    #[doc = " Start gathering candidates for a component with the provided local socket addresses."]
1135    pub fn rice_component_set_selected_pair(
1136        component: *mut RiceComponent,
1137        local: *const RiceCandidate,
1138        remote: *const RiceCandidate,
1139    ) -> RiceError;
1140}
1141unsafe extern "C" {
1142    #[doc = " Create a `RiceAddress` from a string representation of the socket address."]
1143    pub fn rice_address_new_from_string(string: *const ::core::ffi::c_char) -> *mut RiceAddress;
1144}
1145unsafe extern "C" {
1146    #[doc = " Construct a `RiceAddress` from a sequence of bytes.\n\n The number of bytes required depends on the address family being constructed:\n - IPv4 -> 4.\n - IPv6 -> 16."]
1147    pub fn rice_address_new_from_bytes(
1148        family: RiceAddressFamily,
1149        bytes: *const u8,
1150        port: u16,
1151    ) -> *mut RiceAddress;
1152}
1153unsafe extern "C" {
1154    #[doc = " The address family of the `RiceAddress`."]
1155    pub fn rice_address_get_family(addr: *const RiceAddress) -> RiceAddressFamily;
1156}
1157unsafe extern "C" {
1158    #[doc = " Retrieve the bytes of a `RiceAddress`.\n\n The number of bytes required depends on the address family being constructed:\n - IPv4 -> 4.\n - IPv6 -> 16."]
1159    pub fn rice_address_get_address_bytes(addr: *const RiceAddress, bytes: *mut u8) -> usize;
1160}
1161unsafe extern "C" {
1162    #[doc = " Retrieve the port of a `RiceAddress`."]
1163    pub fn rice_address_get_port(addr: *const RiceAddress) -> u16;
1164}
1165unsafe extern "C" {
1166    #[doc = " Compare whether two `RiceAddress`es are equal."]
1167    pub fn rice_address_cmp(
1168        addr: *const RiceAddress,
1169        other: *const RiceAddress,
1170    ) -> ::core::ffi::c_int;
1171}
1172unsafe extern "C" {
1173    #[doc = " Copy a `RiceAddress`."]
1174    pub fn rice_address_copy(addr: *const RiceAddress) -> *mut RiceAddress;
1175}
1176unsafe extern "C" {
1177    #[doc = " Free a `RiceAddress`."]
1178    pub fn rice_address_free(addr: *mut RiceAddress);
1179}
1180unsafe extern "C" {
1181    #[doc = " Generate a random sequence of characters suitable for username fragments and passwords."]
1182    pub fn rice_random_string(length: usize) -> *mut ::core::ffi::c_char;
1183}