network_framework_sys/
endpoint.rs

1use crate::*;
2
3use libc::c_int;
4use libc::c_char;
5use libc::sockaddr;
6
7
8pub enum nw_endpoint {}
9pub type nw_endpoint_t = *mut nw_endpoint;
10
11pub type nw_endpoint_type_t = c_int;
12pub const nw_endpoint_type_invalid: nw_endpoint_type_t         = 0;
13pub const nw_endpoint_type_address: nw_endpoint_type_t         = 1;
14pub const nw_endpoint_type_host: nw_endpoint_type_t            = 2;
15pub const nw_endpoint_type_bonjour_service: nw_endpoint_type_t = 3;
16
17
18extern "C" {
19    pub fn nw_endpoint_get_type(endpoint: nw_endpoint_t) -> nw_endpoint_type_t;
20    pub fn nw_endpoint_create_host(hostname: *const c_char, port: *const c_char) -> nw_endpoint_t;
21    pub fn nw_endpoint_get_hostname(endpoint: nw_endpoint_t) -> *const c_char;
22    pub fn nw_endpoint_copy_port_string(endpoint: nw_endpoint_t) -> *mut c_char;
23    pub fn nw_endpoint_get_port(endpoint: nw_endpoint_t) -> u16;
24    pub fn nw_endpoint_create_address(address: *const sockaddr) -> nw_endpoint_t;
25    pub fn nw_endpoint_copy_address_string(endpoint: nw_endpoint_t) -> *mut c_char;
26    pub fn nw_endpoint_get_address(endpoint: nw_endpoint_t) -> *const sockaddr;
27
28    pub fn nw_endpoint_create_bonjour_service(name: *const c_char,
29                                              type_: *const c_char,
30                                              domain: *const c_char) -> nw_endpoint_t;
31    pub fn nw_endpoint_get_bonjour_service_name(endpoint: nw_endpoint_t) -> *const c_char;
32    pub fn nw_endpoint_get_bonjour_service_type(endpoint: nw_endpoint_t) -> *const c_char;
33    pub fn nw_endpoint_get_bonjour_service_domain(endpoint: nw_endpoint_t) -> *const c_char;
34}
35