/* automatically generated by rust-bindgen 0.72.1 */
pub const RICE_PROTO_MAJOR: u32 = 0;
pub const RICE_PROTO_MINOR: u32 = 4;
pub const RICE_PROTO_PATCH: u32 = 2;
#[doc = " Component is in initial state and no connectivity checks are in progress."]
pub const RICE_COMPONENT_CONNECTION_STATE_NEW: RiceComponentConnectionState = 0;
#[doc = " Connectivity checks are in progress for this candidate"]
pub const RICE_COMPONENT_CONNECTION_STATE_CONNECTING: RiceComponentConnectionState = 1;
#[doc = " A [`CandidatePair`](crate::candidate::CandidatePair`) has been selected for this component"]
pub const RICE_COMPONENT_CONNECTION_STATE_CONNECTED: RiceComponentConnectionState = 2;
#[doc = " No connection could be found for this Component"]
pub const RICE_COMPONENT_CONNECTION_STATE_FAILED: RiceComponentConnectionState = 3;
pub type RiceComponentConnectionState = u32;
#[doc = " IP version 4."]
pub const RICE_ADDRESS_FAMILY_IPV4: RiceAddressFamily = 1;
#[doc = " IP version 6."]
pub const RICE_ADDRESS_FAMILY_IPV6: RiceAddressFamily = 2;
pub type RiceAddressFamily = u32;
#[doc = " The candidate is a local network interface"]
pub const RICE_CANDIDATE_TYPE_HOST: RiceCandidateType = 0;
#[doc = " The candidate was discovered from incoming data"]
pub const RICE_CANDIDATE_TYPE_PEER_REFLEXIVE: RiceCandidateType = 1;
#[doc = " The candidate was discovered by asking an external server (STUN/TURN)"]
pub const RICE_CANDIDATE_TYPE_SERVER_REFLEXIVE: RiceCandidateType = 2;
#[doc = " The candidate will relay all data through an external server (TURN)."]
pub const RICE_CANDIDATE_TYPE_RELAYED: RiceCandidateType = 3;
pub type RiceCandidateType = u32;
#[doc = " Not an error. The operation was completed successfully."]
pub const RICE_ERROR_SUCCESS: RiceError = 0;
#[doc = " The operation failed for an unspecified reason."]
pub const RICE_ERROR_FAILED: RiceError = -1;
#[doc = " A required resource was not found."]
pub const RICE_ERROR_RESOURCE_NOT_FOUND: RiceError = -2;
#[doc = " The operation is already in progress."]
pub const RICE_ERROR_ALREADY_IN_PROGRESS: RiceError = -3;
pub type RiceError = i32;
#[doc = " The configuration will automatically be used when supported."]
pub const RICE_FEATURE_DISABLED: RiceFeature = -1;
#[doc = " The configuration will automatically be used when supported."]
pub const RICE_FEATURE_AUTO: RiceFeature = 0;
#[doc = " The configuration is enabled and required."]
pub const RICE_FEATURE_REQUIRED: RiceFeature = 1;
pub type RiceFeature = i32;
#[doc = " The SHA-1 HMAC."]
pub const RICE_INTEGRITY_ALGORITHM_SHA1: RiceIntegrityAlgorithm = 0;
#[doc = " The SHA-256 HMAC."]
pub const RICE_INTEGRITY_ALGORITHM_SHA256: RiceIntegrityAlgorithm = 1;
pub type RiceIntegrityAlgorithm = u32;
#[doc = " No error."]
pub const RICE_PARSE_CANDIDATE_ERROR_SUCCESS: RiceParseCandidateError = 0;
#[doc = " Not a candidate message."]
pub const RICE_PARSE_CANDIDATE_ERROR_NOT_CANDIDATE: RiceParseCandidateError = -1;
#[doc = " Invalid foundation value."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_FOUNDATION: RiceParseCandidateError = -2;
#[doc = " Invalid component id."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_COMPONENT_ID: RiceParseCandidateError = -3;
#[doc = " Invalid transport type."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_TRANSPORT_TYPE: RiceParseCandidateError = -4;
#[doc = " Invalid priority value."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_PRIORITY: RiceParseCandidateError = -5;
#[doc = " Invalid network address."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_ADDRESS: RiceParseCandidateError = -6;
#[doc = " Invalid candidate type."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_CANDIDATE_TYPE: RiceParseCandidateError = -7;
#[doc = " Invalid extension format."]
pub const RICE_PARSE_CANDIDATE_ERROR_BAD_EXTENSION: RiceParseCandidateError = -8;
#[doc = " Data is not well formed."]
pub const RICE_PARSE_CANDIDATE_ERROR_MALFORMED: RiceParseCandidateError = -9;
pub type RiceParseCandidateError = i32;
#[doc = " Not a TCP candidate."]
pub const RICE_TCP_TYPE_NONE: RiceTcpType = 0;
#[doc = " The candidate address will connect to a remote address."]
pub const RICE_TCP_TYPE_ACTIVE: RiceTcpType = 1;
#[doc = " The candidate will listen for incominng TCP connections."]
pub const RICE_TCP_TYPE_PASSIVE: RiceTcpType = 2;
#[doc = " Simultaneous open. The candidate will both listen for incoming connections, and connect to\n remote addresses."]
pub const RICE_TCP_TYPE_SO: RiceTcpType = 3;
pub type RiceTcpType = u32;
#[doc = " Openssl."]
pub const RICE_TLS_VARIANT_OPENSSL: RiceTlsVariant = 1;
#[doc = " Rustls."]
pub const RICE_TLS_VARIANT_RUSTLS: RiceTlsVariant = 2;
#[doc = " Dimpl."]
pub const RICE_TLS_VARIANT_DIMPL: RiceTlsVariant = 3;
pub type RiceTlsVariant = u32;
#[doc = " The UDP transport"]
pub const RICE_TRANSPORT_TYPE_UDP: RiceTransportType = 0;
#[doc = " The TCP transport"]
pub const RICE_TRANSPORT_TYPE_TCP: RiceTransportType = 1;
pub type RiceTransportType = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct Credentials {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct RiceAddress {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgent {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceComponent {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceStream {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceTlsConfig {
_unused: [u8; 0],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceTurnConfig {
_unused: [u8; 0],
}
#[doc = " A pointer to a sequence of bytes and the associated size."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceDataImpl {
#[doc = " A pointer to a sequence of bytes."]
pub ptr: *mut u8,
#[doc = " Number of bytes pointed to in `ptr`."]
pub size: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceDataImpl"][::core::mem::size_of::<RiceDataImpl>() - 16usize];
["Alignment of RiceDataImpl"][::core::mem::align_of::<RiceDataImpl>() - 8usize];
["Offset of field: RiceDataImpl::ptr"][::core::mem::offset_of!(RiceDataImpl, ptr) - 0usize];
["Offset of field: RiceDataImpl::size"][::core::mem::offset_of!(RiceDataImpl, size) - 8usize];
};
#[doc = " The data is borrowed and will not be freed on destruction."]
pub const RICE_DATA_BORROWED: RiceData_Tag = 0;
#[doc = " The data is owned and will be freed on destruction."]
pub const RICE_DATA_OWNED: RiceData_Tag = 1;
#[doc = " A pointer to a sequence of bytes and size."]
pub type RiceData_Tag = ::core::ffi::c_uint;
#[repr(C)]
pub struct RiceData {
pub tag: RiceData_Tag,
pub field1: RiceData__bindgen_ty_1,
}
#[repr(C)]
pub union RiceData__bindgen_ty_1 {
pub field1: ::core::mem::ManuallyDrop<RiceData__bindgen_ty_1__bindgen_ty_1>,
pub field2: ::core::mem::ManuallyDrop<RiceData__bindgen_ty_1__bindgen_ty_2>,
}
#[repr(C)]
#[derive(Debug)]
pub struct RiceData__bindgen_ty_1__bindgen_ty_1 {
pub borrowed: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceData__bindgen_ty_1__bindgen_ty_1"]
[::core::mem::size_of::<RiceData__bindgen_ty_1__bindgen_ty_1>() - 16usize];
["Alignment of RiceData__bindgen_ty_1__bindgen_ty_1"]
[::core::mem::align_of::<RiceData__bindgen_ty_1__bindgen_ty_1>() - 8usize];
["Offset of field: RiceData__bindgen_ty_1__bindgen_ty_1::borrowed"]
[::core::mem::offset_of!(RiceData__bindgen_ty_1__bindgen_ty_1, borrowed) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceData__bindgen_ty_1__bindgen_ty_2 {
pub owned: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceData__bindgen_ty_1__bindgen_ty_2"]
[::core::mem::size_of::<RiceData__bindgen_ty_1__bindgen_ty_2>() - 16usize];
["Alignment of RiceData__bindgen_ty_1__bindgen_ty_2"]
[::core::mem::align_of::<RiceData__bindgen_ty_1__bindgen_ty_2>() - 8usize];
["Offset of field: RiceData__bindgen_ty_1__bindgen_ty_2::owned"]
[::core::mem::offset_of!(RiceData__bindgen_ty_1__bindgen_ty_2, owned) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceData__bindgen_ty_1"][::core::mem::size_of::<RiceData__bindgen_ty_1>() - 16usize];
["Alignment of RiceData__bindgen_ty_1"]
[::core::mem::align_of::<RiceData__bindgen_ty_1>() - 8usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceData"][::core::mem::size_of::<RiceData>() - 24usize];
["Alignment of RiceData"][::core::mem::align_of::<RiceData>() - 8usize];
["Offset of field: RiceData::tag"][::core::mem::offset_of!(RiceData, tag) - 0usize];
};
#[doc = " Transmit the data using the specified 5-tuple."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceTransmit {
#[doc = " The associated stream identifier."]
pub stream_id: usize,
#[doc = " The transport type for the transmission."]
pub transport: RiceTransportType,
#[doc = " The socket source address to send from."]
pub from: *const RiceAddress,
#[doc = " The socket destination address to send to."]
pub to: *const RiceAddress,
#[doc = " The data to send."]
pub data: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceTransmit"][::core::mem::size_of::<RiceTransmit>() - 48usize];
["Alignment of RiceTransmit"][::core::mem::align_of::<RiceTransmit>() - 8usize];
["Offset of field: RiceTransmit::stream_id"]
[::core::mem::offset_of!(RiceTransmit, stream_id) - 0usize];
["Offset of field: RiceTransmit::transport"]
[::core::mem::offset_of!(RiceTransmit, transport) - 8usize];
["Offset of field: RiceTransmit::from"][::core::mem::offset_of!(RiceTransmit, from) - 16usize];
["Offset of field: RiceTransmit::to"][::core::mem::offset_of!(RiceTransmit, to) - 24usize];
["Offset of field: RiceTransmit::data"][::core::mem::offset_of!(RiceTransmit, data) - 32usize];
};
#[doc = " A socket with the specified network 5-tuple."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentSocket {
#[doc = " The ICE stream id."]
pub stream_id: usize,
#[doc = " The ICE component id."]
pub component_id: usize,
#[doc = " The transport type to allocate."]
pub transport: RiceTransportType,
#[doc = " The source address to allocate from."]
pub from: *const RiceAddress,
#[doc = " The destination address to connect to."]
pub to: *const RiceAddress,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentSocket"][::core::mem::size_of::<RiceAgentSocket>() - 40usize];
["Alignment of RiceAgentSocket"][::core::mem::align_of::<RiceAgentSocket>() - 8usize];
["Offset of field: RiceAgentSocket::stream_id"]
[::core::mem::offset_of!(RiceAgentSocket, stream_id) - 0usize];
["Offset of field: RiceAgentSocket::component_id"]
[::core::mem::offset_of!(RiceAgentSocket, component_id) - 8usize];
["Offset of field: RiceAgentSocket::transport"]
[::core::mem::offset_of!(RiceAgentSocket, transport) - 16usize];
["Offset of field: RiceAgentSocket::from"]
[::core::mem::offset_of!(RiceAgentSocket, from) - 24usize];
["Offset of field: RiceAgentSocket::to"]
[::core::mem::offset_of!(RiceAgentSocket, to) - 32usize];
};
#[doc = " An ICE candidate."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceCandidate {
pub component_id: usize,
pub candidate_type: RiceCandidateType,
pub transport_type: RiceTransportType,
pub foundation: *const ::core::ffi::c_char,
pub priority: u32,
pub address: *const RiceAddress,
pub base_address: *const RiceAddress,
pub related_address: *const RiceAddress,
pub tcp_type: RiceTcpType,
pub extensions: *mut *mut ::core::ffi::c_char,
pub extensions_len: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceCandidate"][::core::mem::size_of::<RiceCandidate>() - 80usize];
["Alignment of RiceCandidate"][::core::mem::align_of::<RiceCandidate>() - 8usize];
["Offset of field: RiceCandidate::component_id"]
[::core::mem::offset_of!(RiceCandidate, component_id) - 0usize];
["Offset of field: RiceCandidate::candidate_type"]
[::core::mem::offset_of!(RiceCandidate, candidate_type) - 8usize];
["Offset of field: RiceCandidate::transport_type"]
[::core::mem::offset_of!(RiceCandidate, transport_type) - 12usize];
["Offset of field: RiceCandidate::foundation"]
[::core::mem::offset_of!(RiceCandidate, foundation) - 16usize];
["Offset of field: RiceCandidate::priority"]
[::core::mem::offset_of!(RiceCandidate, priority) - 24usize];
["Offset of field: RiceCandidate::address"]
[::core::mem::offset_of!(RiceCandidate, address) - 32usize];
["Offset of field: RiceCandidate::base_address"]
[::core::mem::offset_of!(RiceCandidate, base_address) - 40usize];
["Offset of field: RiceCandidate::related_address"]
[::core::mem::offset_of!(RiceCandidate, related_address) - 48usize];
["Offset of field: RiceCandidate::tcp_type"]
[::core::mem::offset_of!(RiceCandidate, tcp_type) - 56usize];
["Offset of field: RiceCandidate::extensions"]
[::core::mem::offset_of!(RiceCandidate, extensions) - 64usize];
["Offset of field: RiceCandidate::extensions_len"]
[::core::mem::offset_of!(RiceCandidate, extensions_len) - 72usize];
};
#[doc = " A new pair has been selected for a component."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentSelectedPair {
#[doc = " The ICE stream id."]
pub stream_id: usize,
#[doc = " The ICE component id."]
pub component_id: usize,
#[doc = " The local candidate of a selected pair."]
pub local: RiceCandidate,
#[doc = " The remote candidate of a selected pair."]
pub remote: RiceCandidate,
#[doc = " The local TURN transport type (if any)."]
pub local_turn_transport: RiceTransportType,
#[doc = " The local TURN address to send data from."]
pub local_turn_local_addr: *const RiceAddress,
#[doc = " The local TURN address to send data to."]
pub local_turn_remote_addr: *const RiceAddress,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentSelectedPair"][::core::mem::size_of::<RiceAgentSelectedPair>() - 200usize];
["Alignment of RiceAgentSelectedPair"]
[::core::mem::align_of::<RiceAgentSelectedPair>() - 8usize];
["Offset of field: RiceAgentSelectedPair::stream_id"]
[::core::mem::offset_of!(RiceAgentSelectedPair, stream_id) - 0usize];
["Offset of field: RiceAgentSelectedPair::component_id"]
[::core::mem::offset_of!(RiceAgentSelectedPair, component_id) - 8usize];
["Offset of field: RiceAgentSelectedPair::local"]
[::core::mem::offset_of!(RiceAgentSelectedPair, local) - 16usize];
["Offset of field: RiceAgentSelectedPair::remote"]
[::core::mem::offset_of!(RiceAgentSelectedPair, remote) - 96usize];
["Offset of field: RiceAgentSelectedPair::local_turn_transport"]
[::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_transport) - 176usize];
["Offset of field: RiceAgentSelectedPair::local_turn_local_addr"]
[::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_local_addr) - 184usize];
["Offset of field: RiceAgentSelectedPair::local_turn_remote_addr"]
[::core::mem::offset_of!(RiceAgentSelectedPair, local_turn_remote_addr) - 192usize];
};
#[doc = " A [`Component`](crate::component::Component) has changed state."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentComponentStateChange {
#[doc = " The ICE stream id."]
pub stream_id: usize,
#[doc = " The ICE component id."]
pub component_id: usize,
#[doc = " The new state of the component."]
pub state: RiceComponentConnectionState,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentComponentStateChange"]
[::core::mem::size_of::<RiceAgentComponentStateChange>() - 24usize];
["Alignment of RiceAgentComponentStateChange"]
[::core::mem::align_of::<RiceAgentComponentStateChange>() - 8usize];
["Offset of field: RiceAgentComponentStateChange::stream_id"]
[::core::mem::offset_of!(RiceAgentComponentStateChange, stream_id) - 0usize];
["Offset of field: RiceAgentComponentStateChange::component_id"]
[::core::mem::offset_of!(RiceAgentComponentStateChange, component_id) - 8usize];
["Offset of field: RiceAgentComponentStateChange::state"]
[::core::mem::offset_of!(RiceAgentComponentStateChange, state) - 16usize];
};
#[doc = " A local candidate that has been gathered."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceGatheredCandidate {
pub candidate: RiceCandidate,
pub turn_agent: *mut ::core::ffi::c_void,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceGatheredCandidate"][::core::mem::size_of::<RiceGatheredCandidate>() - 88usize];
["Alignment of RiceGatheredCandidate"]
[::core::mem::align_of::<RiceGatheredCandidate>() - 8usize];
["Offset of field: RiceGatheredCandidate::candidate"]
[::core::mem::offset_of!(RiceGatheredCandidate, candidate) - 0usize];
["Offset of field: RiceGatheredCandidate::turn_agent"]
[::core::mem::offset_of!(RiceGatheredCandidate, turn_agent) - 80usize];
};
#[doc = " A [`Component`](crate::component::Component) has gathered a candidate."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentGatheredCandidate {
#[doc = " The ICE stream id."]
pub stream_id: usize,
#[doc = " The candidate gathered."]
pub gathered: RiceGatheredCandidate,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentGatheredCandidate"]
[::core::mem::size_of::<RiceAgentGatheredCandidate>() - 96usize];
["Alignment of RiceAgentGatheredCandidate"]
[::core::mem::align_of::<RiceAgentGatheredCandidate>() - 8usize];
["Offset of field: RiceAgentGatheredCandidate::stream_id"]
[::core::mem::offset_of!(RiceAgentGatheredCandidate, stream_id) - 0usize];
["Offset of field: RiceAgentGatheredCandidate::gathered"]
[::core::mem::offset_of!(RiceAgentGatheredCandidate, gathered) - 8usize];
};
#[doc = " A [`Component`](crate::component::Component) has completed gathering."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentGatheringComplete {
#[doc = " The ICE stream id."]
pub stream_id: usize,
#[doc = " The ICE component id."]
pub component_id: usize,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentGatheringComplete"]
[::core::mem::size_of::<RiceAgentGatheringComplete>() - 16usize];
["Alignment of RiceAgentGatheringComplete"]
[::core::mem::align_of::<RiceAgentGatheringComplete>() - 8usize];
["Offset of field: RiceAgentGatheringComplete::stream_id"]
[::core::mem::offset_of!(RiceAgentGatheringComplete, stream_id) - 0usize];
["Offset of field: RiceAgentGatheringComplete::component_id"]
[::core::mem::offset_of!(RiceAgentGatheringComplete, component_id) - 8usize];
};
#[doc = " The Agent is closed. No further progress will be made."]
pub const RICE_AGENT_POLL_CLOSED: RiceAgentPoll_Tag = 0;
#[doc = " Wait until the specified `Instant` has been reached (or an external event)."]
pub const RICE_AGENT_POLL_WAIT_UNTIL_NANOS: RiceAgentPoll_Tag = 1;
#[doc = " Connect from the specified interface to the specified address. Reply (success or failure)\n should be notified using `rice_stream_handle_allocated_socket()`."]
pub const RICE_AGENT_POLL_ALLOCATE_SOCKET: RiceAgentPoll_Tag = 2;
#[doc = " It is possible to remove the specified 5-tuple. The socket will not be referenced any\n further."]
pub const RICE_AGENT_POLL_REMOVE_SOCKET: RiceAgentPoll_Tag = 3;
#[doc = " A new pair has been selected for a component."]
pub const RICE_AGENT_POLL_SELECTED_PAIR: RiceAgentPoll_Tag = 4;
#[doc = " A [`Component`](crate::component::Component) has changed state."]
pub const RICE_AGENT_POLL_COMPONENT_STATE_CHANGE: RiceAgentPoll_Tag = 5;
#[doc = " A [`Component`](crate::component::Component) has gathered a candidate."]
pub const RICE_AGENT_POLL_GATHERED_CANDIDATE: RiceAgentPoll_Tag = 6;
#[doc = " A [`Component`](crate::component::Component) has completed gathering."]
pub const RICE_AGENT_POLL_GATHERING_COMPLETE: RiceAgentPoll_Tag = 7;
#[doc = " Return value of `rice_agent_poll()`."]
pub type RiceAgentPoll_Tag = ::core::ffi::c_uint;
#[repr(C)]
pub struct RiceAgentPoll {
pub tag: RiceAgentPoll_Tag,
pub field1: RiceAgentPoll__bindgen_ty_1,
}
#[repr(C)]
pub union RiceAgentPoll__bindgen_ty_1 {
pub field1: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>,
pub field2: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>,
pub field3: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>,
pub field4: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>,
pub field5: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>,
pub field6: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>,
pub field7: ::core::mem::ManuallyDrop<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_1 {
pub wait_until_nanos: i64,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_1"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>() - 8usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_1"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_1>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_1::wait_until_nanos"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_1,
wait_until_nanos
) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_2 {
pub allocate_socket: RiceAgentSocket,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_2"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>() - 40usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_2"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_2>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_2::allocate_socket"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_2,
allocate_socket
) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_3 {
pub remove_socket: RiceAgentSocket,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_3"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>() - 40usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_3"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_3>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_3::remove_socket"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_3,
remove_socket
) - 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_4 {
pub selected_pair: RiceAgentSelectedPair,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_4"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>() - 200usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_4"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_4>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_4::selected_pair"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_4,
selected_pair
) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_5 {
pub component_state_change: RiceAgentComponentStateChange,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_5"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>() - 24usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_5"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_5>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_5::component_state_change"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_5,
component_state_change
)
- 0usize];
};
#[repr(C)]
#[derive(Debug)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_6 {
pub gathered_candidate: RiceAgentGatheredCandidate,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_6"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>() - 96usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_6"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_6>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_6::gathered_candidate"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_6,
gathered_candidate
) - 0usize];
};
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct RiceAgentPoll__bindgen_ty_1__bindgen_ty_7 {
pub gathering_complete: RiceAgentGatheringComplete,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1__bindgen_ty_7"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>() - 16usize];
["Alignment of RiceAgentPoll__bindgen_ty_1__bindgen_ty_7"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1__bindgen_ty_7>() - 8usize];
["Offset of field: RiceAgentPoll__bindgen_ty_1__bindgen_ty_7::gathering_complete"][::core::mem::offset_of!(
RiceAgentPoll__bindgen_ty_1__bindgen_ty_7,
gathering_complete
) - 0usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll__bindgen_ty_1"]
[::core::mem::size_of::<RiceAgentPoll__bindgen_ty_1>() - 200usize];
["Alignment of RiceAgentPoll__bindgen_ty_1"]
[::core::mem::align_of::<RiceAgentPoll__bindgen_ty_1>() - 8usize];
};
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceAgentPoll"][::core::mem::size_of::<RiceAgentPoll>() - 208usize];
["Alignment of RiceAgentPoll"][::core::mem::align_of::<RiceAgentPoll>() - 8usize];
["Offset of field: RiceAgentPoll::tag"][::core::mem::offset_of!(RiceAgentPoll, tag) - 0usize];
};
#[doc = " ICE/TURN credentials."]
pub type RiceCredentials = Credentials;
#[doc = " Return value for `rice_stream_handle_incoming_data()`."]
#[repr(C)]
#[derive(Debug)]
pub struct RiceStreamIncomingData {
#[doc = " The data was handled internally. `rice_agent_poll()` should be called at the\n next earliest opportunity."]
pub handled: bool,
#[doc = " Whether there is more data to pull using `rice_stream_poll_recv()`."]
pub have_more_data: bool,
#[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."]
pub data: RiceDataImpl,
}
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
const _: () = {
["Size of RiceStreamIncomingData"][::core::mem::size_of::<RiceStreamIncomingData>() - 24usize];
["Alignment of RiceStreamIncomingData"]
[::core::mem::align_of::<RiceStreamIncomingData>() - 8usize];
["Offset of field: RiceStreamIncomingData::handled"]
[::core::mem::offset_of!(RiceStreamIncomingData, handled) - 0usize];
["Offset of field: RiceStreamIncomingData::have_more_data"]
[::core::mem::offset_of!(RiceStreamIncomingData, have_more_data) - 1usize];
["Offset of field: RiceStreamIncomingData::data"]
[::core::mem::offset_of!(RiceStreamIncomingData, data) - 8usize];
};
unsafe extern "C" {
#[doc = " Query the built version of `rice-proto`."]
pub fn rice_version(major: *mut u32, minor: *mut u32, patch: *mut u32);
}
unsafe extern "C" {
#[doc = " Create a new ICE Agent."]
pub fn rice_agent_new(controlling: bool, trickle_ice: bool) -> *mut RiceAgent;
}
unsafe extern "C" {
#[doc = " Increase the reference count of the `RiceAgent`.\n\n This function is multi-threading safe."]
pub fn rice_agent_ref(agent: *const RiceAgent) -> *mut RiceAgent;
}
unsafe extern "C" {
#[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."]
pub fn rice_agent_unref(agent: *mut RiceAgent);
}
unsafe extern "C" {
#[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`."]
pub fn rice_agent_close(agent: *const RiceAgent, now_nanos: i64);
}
unsafe extern "C" {
#[doc = " Return the process-local unique id for this agent."]
pub fn rice_agent_id(agent: *const RiceAgent) -> u64;
}
unsafe extern "C" {
#[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."]
pub fn rice_agent_get_timing_advance(agent: *const RiceAgent) -> u64;
}
unsafe extern "C" {
#[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."]
pub fn rice_agent_set_timing_advance(agent: *const RiceAgent, ta: u64);
}
unsafe extern "C" {
#[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."]
pub fn rice_agent_set_request_retransmits(
agent: *const RiceAgent,
initial_nanos: u64,
max_nanos: u64,
retransmits: u32,
final_retransmit_timeout_nanos: u64,
);
}
unsafe extern "C" {
#[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."]
pub fn rice_agent_get_controlling(agent: *const RiceAgent) -> bool;
}
unsafe extern "C" {
#[doc = " The number of bytes in a `RiceData`."]
pub fn rice_data_len(data: *const RiceData) -> usize;
}
unsafe extern "C" {
#[doc = " The data pointer for a `RiceData`."]
pub fn rice_data_ptr(data: *const RiceData) -> *mut u8;
}
unsafe extern "C" {
#[doc = " Free any resources allocated within a `RiceTransmit`.\n\n The `RiceTransmit` must have been previously initialized with `rice_transmit_init()`."]
pub fn rice_transmit_clear(transmit: *mut RiceTransmit);
}
unsafe extern "C" {
#[doc = " Initialize a `RiceTransmit` with default values."]
pub fn rice_transmit_init(transmit: *mut RiceTransmit);
}
unsafe extern "C" {
#[doc = " Initialize a `RiceAgentPoll` with a default value."]
pub fn rice_agent_poll_init(poll: *mut RiceAgentPoll);
}
unsafe extern "C" {
#[doc = " Clear a `RiceAgentPoll` of any allocated values.\n\n `rice_agent_poll_init()` must have been called previously."]
pub fn rice_agent_poll_clear(poll: *mut RiceAgentPoll);
}
unsafe extern "C" {
#[doc = " Poll the `RiceAgent` for further progress.\n\n The returned value indicates what should be done to continue making progress."]
pub fn rice_agent_poll(agent: *mut RiceAgent, now_nanos: i64, poll: *mut RiceAgentPoll);
}
unsafe extern "C" {
#[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."]
pub fn rice_agent_poll_transmit(
agent: *mut RiceAgent,
now_nanos: i64,
transmit: *mut RiceTransmit,
);
}
unsafe extern "C" {
#[doc = " Add a STUN server to this `RiceAgent`."]
pub fn rice_agent_add_stun_server(
agent: *const RiceAgent,
transport: RiceTransportType,
addr: *const RiceAddress,
);
}
unsafe extern "C" {
#[doc = " Create a new TURN configuration."]
pub fn rice_turn_config_new(
transport: RiceTransportType,
addr: *const RiceAddress,
credentials: *const RiceCredentials,
) -> *mut RiceTurnConfig;
}
unsafe extern "C" {
#[doc = " Copy a [`RiceTurnConfig`]."]
pub fn rice_turn_config_copy(config: *const RiceTurnConfig) -> *mut RiceTurnConfig;
}
unsafe extern "C" {
#[doc = " Free a [`RiceTurnConfig`]."]
pub fn rice_turn_config_free(config: *mut RiceTurnConfig);
}
unsafe extern "C" {
#[doc = " The transport to connect to the TURN server."]
pub fn rice_turn_config_get_client_transport(
config: *const RiceTurnConfig,
) -> RiceTransportType;
}
unsafe extern "C" {
#[doc = " The address of the TURN server."]
pub fn rice_turn_config_get_addr(config: *const RiceTurnConfig) -> *mut RiceAddress;
}
unsafe extern "C" {
#[doc = " Set the allocation transport requested from the TURN server."]
pub fn rice_turn_config_set_allocation_transport(
config: *const RiceTurnConfig,
transport: RiceTransportType,
);
}
unsafe extern "C" {
#[doc = " Retrieve the allocation transport that will be requested from the TURN server."]
pub fn rice_turn_config_get_allocation_transport(
config: *const RiceTurnConfig,
) -> RiceTransportType;
}
unsafe extern "C" {
#[doc = " Add an [`RiceAddressFamily`] that will be requested.\n\n Duplicate [`RiceAddressFamily`]s are ignored."]
pub fn rice_turn_config_add_address_family(
config: *mut RiceTurnConfig,
family: RiceAddressFamily,
);
}
unsafe extern "C" {
#[doc = " Set the [`RiceAddressFamily`] that will be requested.\n\n This will override all previously set [`RiceAddressFamily`]s."]
pub fn rice_turn_config_set_address_family(
config: *mut RiceTurnConfig,
family: RiceAddressFamily,
);
}
unsafe extern "C" {
#[doc = " The address family to allocate as a relayed address on the TURN server."]
pub fn rice_turn_config_get_address_families(
config: *const RiceTurnConfig,
n_families: *mut usize,
families: *mut RiceAddressFamily,
);
}
unsafe extern "C" {
#[doc = " The credentials to use for accessing the TURN server."]
pub fn rice_turn_config_get_credentials(config: *const RiceTurnConfig) -> *mut RiceCredentials;
}
unsafe extern "C" {
#[doc = " Connect to the TURN server over TLS."]
pub fn rice_turn_config_set_tls_config(
config: *mut RiceTurnConfig,
tls_config: *const RiceTlsConfig,
);
}
unsafe extern "C" {
#[doc = " The TLS config associated with this TURN configuration."]
pub fn rice_turn_config_get_tls_config(config: *const RiceTurnConfig) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
#[doc = " Add a supported integrity algorithm for authentication with the TURN server."]
pub fn rice_turn_config_add_supported_integrity(
config: *mut RiceTurnConfig,
integrity: RiceIntegrityAlgorithm,
);
}
unsafe extern "C" {
#[doc = " Set the supported integrity algorithm for authentication with the TURN server.\n\n This will override all previously set values."]
pub fn rice_turn_config_set_supported_integrity(
config: *mut RiceTurnConfig,
integrity: RiceIntegrityAlgorithm,
);
}
unsafe extern "C" {
#[doc = " The address family to allocate as a relayed address on the TURN server."]
pub fn rice_turn_config_get_supported_integrity(
config: *const RiceTurnConfig,
n_integrities: *mut usize,
integrities: *mut RiceIntegrityAlgorithm,
);
}
unsafe extern "C" {
#[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."]
pub fn rice_turn_config_set_anonymous_username(config: *mut RiceTurnConfig, anon: RiceFeature);
}
unsafe extern "C" {
#[doc = " Whether anonymous username usage is required.\n\n A value of `Required` requires the server to support RFC 8489 and the `Userhash` attribute."]
pub fn rice_turn_config_get_anonymous_username(config: *mut RiceTurnConfig) -> RiceFeature;
}
unsafe extern "C" {
#[doc = " Increase the reference count of the `RiceTlsConfig`.\n\n This function is multi-threading safe."]
pub fn rice_tls_config_ref(config: *const RiceTlsConfig) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
#[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."]
pub fn rice_tls_config_unref(config: *mut RiceTlsConfig);
}
unsafe extern "C" {
#[doc = " The TLS variant for a [`RiceTlsConfig`]"]
pub fn rice_tls_config_variant(config: *const RiceTlsConfig) -> RiceTlsVariant;
}
unsafe extern "C" {
#[doc = " Construct a new TLS configuration using Openssl."]
pub fn rice_tls_config_new_openssl(transport: RiceTransportType) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
#[doc = " Construct a new TLS configuration using Rustls."]
pub fn rice_tls_config_new_rustls_with_dns(
server_name: *const ::core::ffi::c_char,
) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
#[doc = " Construct a new TLS configuration using Rustls."]
pub fn rice_tls_config_new_rustls_with_ip(addr: *const RiceAddress) -> *mut RiceTlsConfig;
}
unsafe extern "C" {
#[doc = " Construct a new TLS configuration using Rustls."]
pub fn rice_tls_config_new_dimpl() -> *mut RiceTlsConfig;
}
unsafe extern "C" {
#[doc = " Add an ICE stream to the `RiceAgent`."]
pub fn rice_agent_add_stream(agent: *mut RiceAgent) -> *mut RiceStream;
}
unsafe extern "C" {
#[doc = " Retrieve a previously added stream from the `RiceAgent`.\n\n Will return `NULL` if the stream does not exist."]
pub fn rice_agent_get_stream(agent: *const RiceAgent, stream_id: usize) -> *mut RiceStream;
}
unsafe extern "C" {
#[doc = " Increase the reference count of the `RiceStream`.\n\n This function is multi-threading safe."]
pub fn rice_stream_ref(stream: *const RiceStream) -> *mut RiceStream;
}
unsafe extern "C" {
#[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."]
pub fn rice_stream_unref(stream: *mut RiceStream);
}
unsafe extern "C" {
#[doc = " Retrieve the stream id of the `RiceStream`."]
pub fn rice_stream_get_id(stream: *const RiceStream) -> usize;
}
unsafe extern "C" {
#[doc = " Retrieve the `RiceAgent` of the `RiceStream`."]
pub fn rice_stream_get_agent(stream: *const RiceStream) -> *mut RiceAgent;
}
unsafe extern "C" {
#[doc = " Notify success or failure to create a socket to the `RiceStream`.\n\n `socket_addr` can be `NULL` to indicate failure."]
pub fn rice_stream_handle_allocated_socket(
stream: *mut RiceStream,
component_id: usize,
transport: RiceTransportType,
from: *const RiceAddress,
to: *const RiceAddress,
socket_addr: *mut RiceAddress,
now_nanos: i64,
);
}
unsafe extern "C" {
#[doc = " Construct a new set of ICE/TURN credentials."]
pub fn rice_credentials_new(
ufrag: *const ::core::ffi::c_char,
passwd: *const ::core::ffi::c_char,
) -> *mut RiceCredentials;
}
unsafe extern "C" {
#[doc = " Construct a new set of ICE/TURN credentials."]
pub fn rice_credentials_copy(creds: *const RiceCredentials) -> *mut RiceCredentials;
}
unsafe extern "C" {
#[doc = " Free a set of ICE/TURN credentials."]
pub fn rice_credentials_free(credentials: *mut RiceCredentials);
}
unsafe extern "C" {
#[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."]
pub fn rice_credentials_get_ufrag_bytes(
credentials: *const RiceCredentials,
ptr: *mut ::core::ffi::c_char,
) -> usize;
}
unsafe extern "C" {
#[doc = " Compare two sets of Credentials.\n\n This function is NULL safe."]
pub fn rice_credentials_eq(
creds1: *const RiceCredentials,
creds2: *const RiceCredentials,
) -> bool;
}
unsafe extern "C" {
#[doc = " Retrieve the local ICE credentials currently set on the `RiceStream`."]
pub fn rice_stream_get_local_credentials(stream: *const RiceStream) -> *mut RiceCredentials;
}
unsafe extern "C" {
#[doc = " Retrieve the remote ICE credentials currently set on the `RiceStream`."]
pub fn rice_stream_get_remote_credentials(stream: *const RiceStream) -> *mut RiceCredentials;
}
unsafe extern "C" {
#[doc = " Set the local credentials to use for this `RiceStream`."]
pub fn rice_stream_set_local_credentials(
stream: *mut RiceStream,
credentials: *const RiceCredentials,
);
}
unsafe extern "C" {
#[doc = " Set the remote credentials to use for this `RiceStream`."]
pub fn rice_stream_set_remote_credentials(
stream: *mut RiceStream,
credentials: *const RiceCredentials,
);
}
unsafe extern "C" {
#[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'."]
pub fn rice_candidate_new_from_sdp_string(
cand_str: *const ::core::ffi::c_char,
) -> *mut RiceCandidate;
}
unsafe extern "C" {
#[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'."]
pub fn rice_candidate_init_from_sdp_string(
candidate: *mut RiceCandidate,
cand_str: *const ::core::ffi::c_char,
) -> RiceParseCandidateError;
}
unsafe extern "C" {
#[doc = " Return a SDP candidate string as specified in RFC5245 Section 15.1."]
pub fn rice_candidate_to_sdp_string(
candidate: *const RiceCandidate,
) -> *mut ::core::ffi::c_char;
}
unsafe extern "C" {
#[doc = " Free an allocated string."]
pub fn rice_string_free(string: *mut ::core::ffi::c_char);
}
unsafe extern "C" {
#[doc = " Construct a new `RiceCandidate` with the provided values.\n\n Will return NULL on error."]
pub fn rice_candidate_new(
component_id: usize,
ctype: RiceCandidateType,
ttype: RiceTransportType,
foundation: *const ::core::ffi::c_char,
address: *mut RiceAddress,
) -> *mut RiceCandidate;
}
unsafe extern "C" {
#[doc = " Construct a new `RiceCandidate` with the provided values."]
pub fn rice_candidate_init(
candidate: *mut RiceCandidate,
component_id: usize,
ctype: RiceCandidateType,
ttype: RiceTransportType,
foundation: *const ::core::ffi::c_char,
address: *mut RiceAddress,
) -> RiceError;
}
unsafe extern "C" {
#[doc = " Set the base address of a `RiceCandidate`."]
pub fn rice_candidate_set_priority(candidate: *mut RiceCandidate, priority: u32);
}
unsafe extern "C" {
#[doc = " Set the base address of a `RiceCandidate`."]
pub fn rice_candidate_set_base_address(
candidate: *mut RiceCandidate,
base_address: *mut RiceAddress,
);
}
unsafe extern "C" {
#[doc = " Set the related address of a `RiceCandidate`."]
pub fn rice_candidate_set_related_address(
candidate: *mut RiceCandidate,
related_address: *mut RiceAddress,
);
}
unsafe extern "C" {
#[doc = " Set the tcp type of a `RiceCandidate`."]
pub fn rice_candidate_set_tcp_type(candidate: *mut RiceCandidate, tcp_type: RiceTcpType);
}
unsafe extern "C" {
#[doc = " Perform a deep copy of a `RiceCandidate`."]
pub fn rice_candidate_copy(candidate: *const RiceCandidate) -> *mut RiceCandidate;
}
unsafe extern "C" {
#[doc = " Perform a deep copy of a `RiceCandidate`."]
pub fn rice_candidate_copy_into(candidate: *const RiceCandidate, ret: *mut RiceCandidate);
}
unsafe extern "C" {
#[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."]
pub fn rice_candidate_clear(candidate: *mut RiceCandidate);
}
unsafe extern "C" {
#[doc = " Free a `RiceCandidate`.\n\n This function is NULL safe."]
pub fn rice_candidate_free(candidate: *mut RiceCandidate);
}
unsafe extern "C" {
#[doc = " Free a `RiceCandidate`."]
pub fn rice_candidate_eq(candidate: *const RiceCandidate, other: *const RiceCandidate) -> bool;
}
unsafe extern "C" {
#[doc = " Add a local `RiceGatheredCandidate` to a `RiceStream`."]
pub fn rice_stream_add_local_gathered_candidate(
stream: *mut RiceStream,
candidate: *const RiceGatheredCandidate,
) -> bool;
}
unsafe extern "C" {
#[doc = " Add a remote candidate to the `RiceStream`."]
pub fn rice_stream_add_remote_candidate(
stream: *mut RiceStream,
candidate: *const RiceCandidate,
);
}
unsafe extern "C" {
#[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."]
pub fn rice_stream_end_of_local_candidates(stream: *mut RiceStream);
}
unsafe extern "C" {
#[doc = " Retrieve previously set local candidates for connection checks from this stream."]
pub fn rice_stream_get_local_candidates(
stream: *mut RiceStream,
n_candidates: *mut usize,
candidates: *mut RiceCandidate,
);
}
unsafe extern "C" {
#[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."]
pub fn rice_stream_end_of_remote_candidates(stream: *mut RiceStream);
}
unsafe extern "C" {
#[doc = " Retrieve previously set remote candidates for connection checks from this stream."]
pub fn rice_stream_get_remote_candidates(
stream: *mut RiceStream,
n_candidates: *mut usize,
candidates: *mut RiceCandidate,
);
}
unsafe extern "C" {
#[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."]
pub fn rice_stream_handle_incoming_data(
stream: *mut RiceStream,
component_id: usize,
transport: RiceTransportType,
from: *const RiceAddress,
to: *const RiceAddress,
data: *const u8,
data_len: usize,
now_nanos: i64,
ret: *mut RiceStreamIncomingData,
);
}
unsafe extern "C" {
#[doc = " Poll for further application data that has been received.\n\n Free the returned data with `rice_free_data()`."]
pub fn rice_stream_poll_recv(
stream: *mut RiceStream,
component_id: *mut usize,
data_len: *mut usize,
) -> *mut u8;
}
unsafe extern "C" {
#[doc = " Free allocated data."]
pub fn rice_free_data(data: *mut u8);
}
unsafe extern "C" {
#[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."]
pub fn rice_stream_component_ids(stream: *mut RiceStream, len: *mut usize, ret: *mut usize);
}
unsafe extern "C" {
#[doc = " Add an ICE component to a `RiceStream`."]
pub fn rice_stream_add_component(stream: *mut RiceStream) -> *mut RiceComponent;
}
unsafe extern "C" {
#[doc = " Increase the reference count of the `RiceComponent`.\n\n This function is multi-threading safe."]
pub fn rice_component_ref(component: *const RiceComponent) -> *mut RiceComponent;
}
unsafe extern "C" {
#[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."]
pub fn rice_component_unref(component: *mut RiceComponent);
}
unsafe extern "C" {
#[doc = " Retrieve the component id of the `RiceComponent`."]
pub fn rice_component_get_id(component: *const RiceComponent) -> usize;
}
unsafe extern "C" {
#[doc = " Retrieve the component id of the `RiceComponent`."]
pub fn rice_component_get_stream(component: *const RiceComponent) -> *mut RiceStream;
}
unsafe extern "C" {
#[doc = " Retrieve the component connection state of the `RiceComponent`."]
pub fn rice_component_get_state(
component: *const RiceComponent,
) -> RiceComponentConnectionState;
}
unsafe extern "C" {
#[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."]
pub fn rice_component_selected_pair(
component: *const RiceComponent,
local: *mut RiceCandidate,
remote: *mut RiceCandidate,
);
}
unsafe extern "C" {
#[doc = " Retrieve a previously added `RiceComponent`.\n\n If the `RiceComponent` does not exist, `NULL` is returned."]
pub fn rice_stream_get_component(
stream: *const RiceStream,
component_id: usize,
) -> *mut RiceComponent;
}
unsafe extern "C" {
#[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`."]
pub fn rice_component_gather_candidates(
component: *mut RiceComponent,
sockets_len: usize,
sockets_addr: *const *const RiceAddress,
sockets_transports: *const RiceTransportType,
turn_len: usize,
turn_sockets: *const *const RiceAddress,
turn_config: *const *mut RiceTurnConfig,
) -> RiceError;
}
unsafe extern "C" {
#[doc = " Send data to the connected peer.\n\n This will fail before a connection is successfully completed."]
pub fn rice_component_send(
component: *mut RiceComponent,
data: *mut u8,
len: usize,
now_nanos: i64,
transmit: *mut RiceTransmit,
) -> RiceError;
}
unsafe extern "C" {
#[doc = " Start gathering candidates for a component with the provided local socket addresses."]
pub fn rice_component_set_selected_pair(
component: *mut RiceComponent,
local: *const RiceCandidate,
remote: *const RiceCandidate,
) -> RiceError;
}
unsafe extern "C" {
#[doc = " Create a `RiceAddress` from a string representation of the socket address."]
pub fn rice_address_new_from_string(string: *const ::core::ffi::c_char) -> *mut RiceAddress;
}
unsafe extern "C" {
#[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."]
pub fn rice_address_new_from_bytes(
family: RiceAddressFamily,
bytes: *const u8,
port: u16,
) -> *mut RiceAddress;
}
unsafe extern "C" {
#[doc = " The address family of the `RiceAddress`."]
pub fn rice_address_get_family(addr: *const RiceAddress) -> RiceAddressFamily;
}
unsafe extern "C" {
#[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."]
pub fn rice_address_get_address_bytes(addr: *const RiceAddress, bytes: *mut u8) -> usize;
}
unsafe extern "C" {
#[doc = " Retrieve the port of a `RiceAddress`."]
pub fn rice_address_get_port(addr: *const RiceAddress) -> u16;
}
unsafe extern "C" {
#[doc = " Compare whether two `RiceAddress`es are equal."]
pub fn rice_address_cmp(
addr: *const RiceAddress,
other: *const RiceAddress,
) -> ::core::ffi::c_int;
}
unsafe extern "C" {
#[doc = " Copy a `RiceAddress`."]
pub fn rice_address_copy(addr: *const RiceAddress) -> *mut RiceAddress;
}
unsafe extern "C" {
#[doc = " Free a `RiceAddress`."]
pub fn rice_address_free(addr: *mut RiceAddress);
}
unsafe extern "C" {
#[doc = " Generate a random sequence of characters suitable for username fragments and passwords."]
pub fn rice_random_string(length: usize) -> *mut ::core::ffi::c_char;
}