use libc;
pub const FALSE:libc::c_int = 0;
pub const TRUE:libc::c_int = !FALSE;
extern "C" {
pub fn g_free(addr: *mut libc::c_int);
}
extern "C" {
pub fn g_object_unref(addr: *mut _NiceAgent);
}
#[repr(C)]
pub struct _NiceAgent;
#[repr(C)]
pub struct _NiceAddress;
#[repr(C)]
pub struct _GList;
#[repr(C)]
pub struct _GSList;
#[repr(C)]
pub struct _GError;
#[repr(C)]
pub struct _GSocket;
#[repr(C)]
pub struct _GIOStream;
#[repr(C)]
pub struct _GObject;
#[repr(C)]
pub struct _GObjectClass;
#[repr(C)]
pub struct _GMainContext;
#[repr(C)]
pub struct _GCancellable;
#[repr(C)]
pub struct _GCancellablePrivate;
#[repr(C)]
pub struct _GOutputVector;
#[repr(C)]
pub struct _GInputVector;
#[repr(C)]
pub struct sockaddr;
#[repr(C)]
pub struct _NiceCandidate {
pub type_: libc::c_uint,
pub transport: libc::c_uint,
pub addr: _NiceAddress,
pub base_addr: _NiceAddress,
pub priority: libc::c_uint,
pub stream_id: libc::c_uint,
pub component_id: libc::c_uint,
pub foundation: [libc::c_char; 33],
pub username: *mut libc::c_char,
pub password: *mut libc::c_char,
pub turn: *mut _TurnServer,
pub sockptr: *mut libc::c_void,
}
#[repr(C)]
pub struct _TurnServer {
pub ref_count: libc::c_int,
pub server: _NiceAddress,
pub username: *mut libc::c_char,
pub password: *mut libc::c_char,
pub type_: libc::c_uint,
}
#[repr(C)]
pub struct _NiceAgentClass {
pub parent_class: _GObjectClass,
}
#[repr(C)]
pub struct NiceCandidate {
pub type_: libc::c_uint,
pub transport: libc::c_uint,
pub addr: _NiceAddress,
pub base_addr: _NiceAddress,
pub priority: libc::c_uint,
pub stream_id: libc::c_uint,
pub component_id: libc::c_uint,
pub foundation: [libc::c_char; 33],
pub username: *mut libc::c_char,
pub password: *mut libc::c_char,
pub turn: *mut _TurnServer,
pub sockptr: *mut libc::c_void,
}
#[repr(C)]
pub struct GMainContext;
#[repr(C)]
pub struct NiceAgent;
#[repr(C)]
pub struct GSList {
pub data: *mut libc::c_void,
pub next: *mut _GSList,
}
#[repr(C)]
pub struct NiceOutputMessage {
pub buffers: *mut _GOutputVector,
pub n_buffers: libc::c_int,
}
#[repr(C)]
pub struct GCancellable {
pub parent_instance: _GObject,
pub priv_: *mut _GCancellablePrivate,
}
#[repr(C)]
pub struct NiceInputMessage {
pub buffers: *mut _GInputVector,
pub n_buffers: libc::c_int,
pub from: *mut _NiceAddress,
pub length: libc::c_ulong,
}
#[link(name="glib-2.0")]
#[link(name="nice")]
#[link(name="glib-2.0")]
extern "C" {
pub fn nice_address_init(addr: *mut _NiceAddress);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_new() -> *mut _NiceAddress;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_free(addr: *mut _NiceAddress);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_dup(addr: *const _NiceAddress) -> *mut _NiceAddress;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_set_ipv4(addr: *mut _NiceAddress, addr_ipv4: libc::c_uint);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_set_ipv6(addr: *mut _NiceAddress, addr_ipv6: *const libc::c_uchar);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_set_port(addr: *mut _NiceAddress, port: libc::c_uint);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_get_port(addr: *const _NiceAddress) -> libc::c_uint;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_set_from_string(addr: *mut _NiceAddress, str: *const libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_set_from_sockaddr(addr: *mut _NiceAddress, sin: *const sockaddr);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_copy_to_sockaddr(addr: *const _NiceAddress, sin: *mut sockaddr);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_equal(a: *const _NiceAddress, b: *const _NiceAddress) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_to_string(addr: *const _NiceAddress, dst: *mut libc::c_char);
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_is_private(addr: *const _NiceAddress) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_is_valid(addr: *const _NiceAddress) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_address_ip_version(addr: *const _NiceAddress) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_new(type_: libc::c_uint) -> *mut _NiceCandidate;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_free(candidate: *mut _NiceCandidate);
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_copy(candidate: *const _NiceCandidate) -> *mut _NiceCandidate;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_jingle_priority(candidate: *mut _NiceCandidate) -> libc::c_uint;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_msn_priority(candidate: *mut _NiceCandidate) -> libc::c_uint;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_ice_priority_full(type_pref: libc::c_uint, local_pref: libc::c_uint, component_id: libc::c_uint) -> libc::c_uint;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_ice_priority(candidate: *const _NiceCandidate) -> libc::c_uint;
}
#[link(name="nice")]
extern "C" {
pub fn nice_candidate_pair_priority(o_prio: libc::c_uint, a_prio: libc::c_uint) -> libc::c_ulong;
}
#[link(name="nice")]
extern "C" {
pub fn nice_debug_enable(with_stun: libc::c_int);
}
#[link(name="nice")]
extern "C" {
pub fn nice_debug_disable(with_stun: libc::c_int);
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_type() -> libc::c_ulong;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_new(ctx: *mut _GMainContext, compat: libc::c_uint) -> *mut _NiceAgent;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_new_reliable(ctx: *mut _GMainContext, compat: libc::c_uint) -> *mut _NiceAgent;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_add_local_address(agent: *mut _NiceAgent, addr: *mut _NiceAddress) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_add_stream(agent: *mut _NiceAgent, n_components: libc::c_uint) -> libc::c_uint;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_remove_stream(agent: *mut _NiceAgent, stream_id: libc::c_uint);
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_port_range(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, min_port: libc::c_uint, max_port: libc::c_uint);
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_relay_info(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, server_ip: *const libc::c_char, server_port: libc::c_uint, username: *const libc::c_char, password: *const libc::c_char, type_: libc::c_uint) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_gather_candidates(agent: *mut _NiceAgent, stream_id: libc::c_uint) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_remote_credentials(agent: *mut _NiceAgent, stream_id: libc::c_uint, ufrag: *const libc::c_char, pwd: *const libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_local_credentials(agent: *mut _NiceAgent, stream_id: libc::c_uint, ufrag: *mut *mut libc::c_char, pwd: *mut *mut libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_remote_candidates(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, candidates: *const _GSList) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_send(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, len: libc::c_uint, buf: *const libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_send_messages_nonblocking(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, messages: *const NiceOutputMessage, n_messages: libc::c_uint, cancellable: *mut _GCancellable, error: *mut *mut _GError) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_local_candidates(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint) -> *mut _GSList;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_remote_candidates(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint) -> *mut _GSList;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_restart(agent: *mut _NiceAgent) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_restart_stream(agent: *mut _NiceAgent, stream_id: libc::c_uint) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_attach_recv(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, ctx: *mut _GMainContext, func: Option<extern fn(*mut _NiceAgent, libc::c_uint, libc::c_uint, libc::c_uint, *mut libc::c_char, *mut libc::c_void)>, data: *mut libc::c_void) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_recv(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, buf: *mut libc::c_uchar, buf_len: libc::c_ulong, cancellable: *mut _GCancellable, error: *mut *mut _GError) -> libc::c_long;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_recv_messages(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, messages: *mut NiceInputMessage, n_messages: libc::c_uint, cancellable: *mut _GCancellable, error: *mut *mut _GError) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_recv_nonblocking(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, buf: *mut libc::c_uchar, buf_len: libc::c_ulong, cancellable: *mut _GCancellable, error: *mut *mut _GError) -> libc::c_long;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_recv_messages_nonblocking(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, messages: *mut NiceInputMessage, n_messages: libc::c_uint, cancellable: *mut _GCancellable, error: *mut *mut _GError) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_selected_pair(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, lfoundation: *const libc::c_char, rfoundation: *const libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_selected_pair(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, local: *mut *mut _NiceCandidate, remote: *mut *mut _NiceCandidate) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_selected_socket(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint) -> *mut _GSocket;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_selected_remote_candidate(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint, candidate: *mut _NiceCandidate) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_stream_tos(agent: *mut _NiceAgent, stream_id: libc::c_uint, tos: libc::c_int);
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_software(agent: *mut _NiceAgent, software: *const libc::c_char);
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_set_stream_name(agent: *mut _NiceAgent, stream_id: libc::c_uint, name: *const libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_stream_name(agent: *mut _NiceAgent, stream_id: libc::c_uint) -> *const libc::c_char;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_default_local_candidate(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint) -> *mut _NiceCandidate;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_generate_local_sdp(agent: *mut _NiceAgent) -> *mut libc::c_char;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_generate_local_stream_sdp(agent: *mut _NiceAgent, stream_id: libc::c_uint, include_non_ice: libc::c_int) -> *mut libc::c_char;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_generate_local_candidate_sdp(agent: *mut _NiceAgent, candidate: *mut _NiceCandidate) -> *mut libc::c_char;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_parse_remote_sdp(agent: *mut _NiceAgent, sdp: *const libc::c_char) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_parse_remote_stream_sdp(agent: *mut _NiceAgent, stream_id: libc::c_uint, sdp: *const libc::c_char, ufrag: *mut *mut libc::c_char, pwd: *mut *mut libc::c_char) -> *mut _GSList;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_parse_remote_candidate_sdp(agent: *mut _NiceAgent, stream_id: libc::c_uint, sdp: *const libc::c_char) -> *mut _NiceCandidate;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_get_io_stream(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint) -> *mut _GIOStream;
}
#[link(name="nice")]
extern "C" {
pub fn nice_component_state_to_string(state: libc::c_uint) -> *const libc::c_char;
}
#[link(name="nice")]
extern "C" {
pub fn nice_agent_forget_relays(agent: *mut _NiceAgent, stream_id: libc::c_uint, component_id: libc::c_uint) -> libc::c_int;
}
#[link(name="nice")]
extern "C" {
pub fn nice_interfaces_get_ip_for_interface(interface_name: *mut libc::c_char) -> *mut libc::c_char;
}
#[link(name="nice")]
extern "C" {
pub fn nice_interfaces_get_local_ips(include_loopback: libc::c_int) -> *mut _GList;
}
#[link(name="nice")]
extern "C" {
pub fn nice_interfaces_get_local_interfaces() -> *mut _GList;
}
bitflags! {
flags NiceCandidateType: libc::c_uint {
const NICE_CANDIDATE_TYPE_HOST = 0 as libc::c_uint,
const NICE_CANDIDATE_TYPE_SERVER_REFLEXIVE = 1 as libc::c_uint,
const NICE_CANDIDATE_TYPE_PEER_REFLEXIVE = 2 as libc::c_uint,
const NICE_CANDIDATE_TYPE_RELAYED = 3 as libc::c_uint,
}
}
bitflags! {
flags NiceCandidateTransport: libc::c_uint {
const NICE_CANDIDATE_TRANSPORT_UDP = 0 as libc::c_uint,
}
}
bitflags! {
flags NiceRelayType: libc::c_uint {
const NICE_RELAY_TYPE_TURN_UDP = 0 as libc::c_uint,
const NICE_RELAY_TYPE_TURN_TCP = 1 as libc::c_uint,
const NICE_RELAY_TYPE_TURN_TLS = 2 as libc::c_uint,
}
}
#[repr(C)]
#[derive(Clone,PartialEq,Debug)]
pub enum NiceComponentState {
NICE_COMPONENT_STATE_DISCONNECTED = 0x00000000,
NICE_COMPONENT_STATE_GATHERING = 0x00000001,
NICE_COMPONENT_STATE_CONNECTING = 0x00000002,
NICE_COMPONENT_STATE_CONNECTED = 0x00000003,
NICE_COMPONENT_STATE_READY = 0x00000004,
NICE_COMPONENT_STATE_FAILED = 0x00000005,
NICE_COMPONENT_STATE_LAST = 0x00000006,
}
bitflags! {
flags NiceComponentType: libc::c_uint {
const NICE_COMPONENT_TYPE_RTP = 1 as libc::c_uint,
const NICE_COMPONENT_TYPE_RTCP = 2 as libc::c_uint,
}
}
bitflags! {
flags NiceCompatibility: libc::c_uint {
const NICE_COMPATIBILITY_RFC5245 = 0 as libc::c_uint,
const NICE_COMPATIBILITY_GOOGLE = 1 as libc::c_uint,
const NICE_COMPATIBILITY_MSN = 2 as libc::c_uint,
const NICE_COMPATIBILITY_WLM2009 = 3 as libc::c_uint,
const NICE_COMPATIBILITY_OC2007 = 4 as libc::c_uint,
const NICE_COMPATIBILITY_OC2007R2 = 5 as libc::c_uint,
const NICE_COMPATIBILITY_DRAFT19 = 0 as libc::c_uint,
const NICE_COMPATIBILITY_LAST = 5 as libc::c_uint,
}
}
bitflags! {
flags NiceProxyType: libc::c_uint {
const NICE_PROXY_TYPE_NONE = 0 as libc::c_uint,
const NICE_PROXY_TYPE_SOCKS5 = 1 as libc::c_uint,
const NICE_PROXY_TYPE_HTTP = 2 as libc::c_uint,
const NICE_PROXY_TYPE_LAST = 2 as libc::c_uint,
}
}
pub const NICE_CANDIDATE_TYPE_PREF_HOST: i32 = 120;
pub const NICE_CANDIDATE_TYPE_PREF_PEER_REFLEXIVE: i32 = 110;
pub const NICE_CANDIDATE_TYPE_PREF_SERVER_REFLEXIVE: i32 = 100;
pub const NICE_CANDIDATE_TYPE_PREF_RELAYED: i32 = 60;
pub const NICE_AGENT_MAX_REMOTE_CANDIDATES: i32 = 25;