/* automatically generated by rust-bindgen 0.65.1 */
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(clippy::missing_safety_doc)]
#[link(name = "net_connection")]
unsafe extern "C" {}
pub const NETCONN_MAX_NET_SIZE: u32 = 32;
pub const NETCONN_MAX_BEARER_TYPE_SIZE: u32 = 32;
pub const NETCONN_MAX_CAP_SIZE: u32 = 32;
pub const NETCONN_MAX_ADDR_SIZE: u32 = 32;
pub const NETCONN_MAX_ROUTE_SIZE: u32 = 64;
pub const NETCONN_MAX_EXCLUSION_SIZE: u32 = 256;
pub const NETCONN_MAX_STR_LEN: u32 = 256;
pub const NETCONN_MAX_RTT_NUM: u32 = 4;
pub type socklen_t = ::std::os::raw::c_uint;
pub type sa_family_t = ::std::os::raw::c_ushort;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct sockaddr {
pub sa_family: sa_family_t,
pub sa_data: [::std::os::raw::c_char; 14usize],
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct addrinfo {
pub ai_flags: ::std::os::raw::c_int,
pub ai_family: ::std::os::raw::c_int,
pub ai_socktype: ::std::os::raw::c_int,
pub ai_protocol: ::std::os::raw::c_int,
pub ai_addrlen: socklen_t,
pub ai_addr: *mut sockaddr,
pub ai_canonname: *mut ::std::os::raw::c_char,
pub ai_next: *mut addrinfo,
}
#[doc = " MMS"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_MMS: NetConn_NetCap = 0;
#[doc = " Not Metered"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_NOT_METERED: NetConn_NetCap = 11;
#[doc = " Internet"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_INTERNET: NetConn_NetCap = 12;
#[doc = " Not VPN"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_NOT_VPN: NetConn_NetCap = 15;
#[doc = " Validated"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_VALIDATED: NetConn_NetCap = 16;
#[doc = " Portal\n @since 12"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_PORTAL: NetConn_NetCap = 17;
#[doc = " In checking network connectivity.\n @since 12"]
pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_CHECKING_CONNECTIVITY: NetConn_NetCap = 31;
#[doc = " @brief Defines network capabilities.\n\n @since 11\n @version 1.0"]
pub type NetConn_NetCap = u32;
#[doc = " Cellular network"]
pub const NetConn_NetBearerType_NETCONN_BEARER_CELLULAR: NetConn_NetBearerType = 0;
#[doc = " WIFI"]
pub const NetConn_NetBearerType_NETCONN_BEARER_WIFI: NetConn_NetBearerType = 1;
#[doc = " Bluetooth\n @since 12"]
pub const NetConn_NetBearerType_NETCONN_BEARER_BLUETOOTH: NetConn_NetBearerType = 2;
#[doc = " Ethernet"]
pub const NetConn_NetBearerType_NETCONN_BEARER_ETHERNET: NetConn_NetBearerType = 3;
#[doc = " VPN\n @since 12"]
pub const NetConn_NetBearerType_NETCONN_BEARER_VPN: NetConn_NetBearerType = 4;
#[doc = " @brief Defines network bearer types.\n\n @since 11\n @version 1.0"]
pub type NetConn_NetBearerType = u32;
#[doc = " @error Success return code on success"]
#[cfg(feature = "api-15")]
pub const NetConn_ErrorCode_NETCONN_SUCCESS: NetConn_ErrorCode = 0;
#[doc = " @error Permission verification failed"]
#[cfg(feature = "api-15")]
pub const NetConn_ErrorCode_NETCONN_PERMISSION_DENIED: NetConn_ErrorCode = 201;
#[doc = " @error Parameter check failed"]
#[cfg(feature = "api-15")]
pub const NetConn_ErrorCode_NETCONN_PARAMETER_ERROR: NetConn_ErrorCode = 401;
#[doc = " @error Failed to connect to the service"]
#[cfg(feature = "api-15")]
pub const NetConn_ErrorCode_NETCONN_OPERATION_FAILED: NetConn_ErrorCode = 2100002;
#[doc = " @error System internal error.\n 1. Memory-related error, for example, insufficient memory or memory data copy failures.\n 2. Null pointer error, for example, using memory that has already been released."]
#[cfg(feature = "api-15")]
pub const NetConn_ErrorCode_NETCONN_INTERNAL_ERROR: NetConn_ErrorCode = 2100003;
#[doc = " @brief Enumerates NetConn error codes.\n\n @since 15"]
#[cfg(feature = "api-15")]
pub type NetConn_ErrorCode = u32;
#[doc = " ICMP"]
#[cfg(feature = "api-20")]
pub const NetConn_PacketsType_NETCONN_PACKETS_ICMP: NetConn_PacketsType = 0;
#[doc = " UDP"]
#[cfg(feature = "api-20")]
pub const NetConn_PacketsType_NETCONN_PACKETS_UDP: NetConn_PacketsType = 1;
#[doc = " @brief Enumerates packets type of trace route.\n\n @since 20"]
#[cfg(feature = "api-20")]
pub type NetConn_PacketsType = u32;
#[doc = " @brief Defines the network handle.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_NetHandle {
#[doc = " Network ID"]
pub netId: i32,
}
#[doc = " @brief Defines all network capabilities.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_NetCapabilities {
#[doc = " Uplink bandwidth"]
pub linkUpBandwidthKbps: u32,
#[doc = " Downlink bandwidth"]
pub linkDownBandwidthKbps: u32,
#[doc = " Network capability list"]
pub netCaps: [NetConn_NetCap; 32usize],
#[doc = " Actual size of the network capability list"]
pub netCapsSize: i32,
#[doc = " Bearer type list"]
pub bearerTypes: [NetConn_NetBearerType; 32usize],
#[doc = " Actual size of the bearer type list"]
pub bearerTypesSize: i32,
}
#[doc = " @brief Defines the network address.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_NetAddr {
#[doc = " Network address family"]
pub family: u8,
#[doc = " Prefix length"]
pub prefixlen: u8,
#[doc = " Port number"]
pub port: u8,
#[doc = " Address"]
pub address: [::std::os::raw::c_char; 256usize],
}
#[doc = " @brief Defines the route configuration information.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_Route {
#[doc = " Network interface"]
pub iface: [::std::os::raw::c_char; 256usize],
#[doc = " Destination address"]
pub destination: NetConn_NetAddr,
#[doc = " Gateway address"]
pub gateway: NetConn_NetAddr,
#[doc = " Gateway exists or not"]
pub hasGateway: i32,
#[doc = " Default route or not"]
pub isDefaultRoute: i32,
}
#[doc = " @brief Defines the proxy configuration information.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_HttpProxy {
#[doc = " Host name"]
pub host: [::std::os::raw::c_char; 256usize],
#[doc = " Exclusion list of proxy servers"]
pub exclusionList: [[::std::os::raw::c_char; 256usize]; 256usize],
#[doc = " Actual size of the exclusion list"]
pub exclusionListSize: i32,
#[doc = " Port number"]
pub port: u16,
}
#[doc = " @brief Defines the network connection properties.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_ConnectionProperties {
#[doc = " Network interface name"]
pub ifaceName: [::std::os::raw::c_char; 256usize],
#[doc = " Domain name of the network connection"]
pub domain: [::std::os::raw::c_char; 256usize],
#[doc = " TCP buffer size"]
pub tcpBufferSizes: [::std::os::raw::c_char; 256usize],
#[doc = " MTU"]
pub mtu: u16,
#[doc = " Address list"]
pub netAddrList: [NetConn_NetAddr; 32usize],
#[doc = " Actual size of the address list"]
pub netAddrListSize: i32,
#[doc = " DNS list"]
pub dnsList: [NetConn_NetAddr; 32usize],
#[doc = " Actual size of the DNS list"]
pub dnsListSize: i32,
#[doc = " Route list"]
pub routeList: [NetConn_Route; 64usize],
#[doc = " Actual size of the route list"]
pub routeListSize: i32,
#[doc = " HTTP proxy information"]
pub httpProxy: NetConn_HttpProxy,
}
#[doc = " @brief Defines the network handle list.\n\n @since 11\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_NetHandleList {
#[doc = " Network handle list"]
pub netHandles: [NetConn_NetHandle; 32usize],
#[doc = " Actual size of the network handle list"]
pub netHandleListSize: i32,
}
#[doc = " @brief Pointer to the custom DNS resolver.\n\n @param host The host name to query.\n @param serv Service name.\n @param hint Pointer to the addrinfo structure.\n @param res Store DNS query results and return them in a linked list format.\n\n @since 11\n @version 1.0"]
pub type OH_NetConn_CustomDnsResolver = ::std::option::Option<
unsafe extern "C" fn(
host: *const ::std::os::raw::c_char,
serv: *const ::std::os::raw::c_char,
hint: *const addrinfo,
res: *mut *mut addrinfo,
) -> ::std::os::raw::c_int,
>;
#[doc = " @brief Callback for application’s http proxy information changed.\n\n @param proxy The changed proxy information, may be a null pointer.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_AppHttpProxyChange =
::std::option::Option<unsafe extern "C" fn(proxy: *mut NetConn_HttpProxy)>;
#[doc = " @brief Definition of network specifier.\n\n @since 12\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_NetSpecifier {
#[doc = " Network capabilities."]
pub caps: NetConn_NetCapabilities,
#[doc = " Network identifier"]
pub bearerPrivateIdentifier: *mut ::std::os::raw::c_char,
}
#[doc = " @brief Callback for network available.\n\n @param netHandle The network handle.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_NetworkAvailable =
::std::option::Option<unsafe extern "C" fn(netHandle: *mut NetConn_NetHandle)>;
#[doc = " @brief Callback for network capabilities changed.\n\n @param netHandle The network handle.\n @param netCapabilities The network capabilities.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_NetCapabilitiesChange = ::std::option::Option<
unsafe extern "C" fn(
netHandle: *mut NetConn_NetHandle,
netCapabilities: *mut NetConn_NetCapabilities,
),
>;
#[doc = " @brief Callback for network connection properties changed.\n\n @param netHandle The network handle.\n @param connConnetionProperties The network connection properties.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_NetConnectionPropertiesChange = ::std::option::Option<
unsafe extern "C" fn(
netHandle: *mut NetConn_NetHandle,
connConnetionProperties: *mut NetConn_ConnectionProperties,
),
>;
#[doc = " @brief Callback for network lost.\n\n @param netHandle The network handle.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_NetLost =
::std::option::Option<unsafe extern "C" fn(netHandle: *mut NetConn_NetHandle)>;
#[doc = " @brief Callback for network unavailable, this function invoked while network can not be available in given timeout.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_NetUnavailable = ::std::option::Option<unsafe extern "C" fn()>;
#[doc = " @brief Callback for network blocked status changed.\n\n @param netHandle The network handle.\n @param blocked The flag used to indicate whether the network will be blocked.\n\n @since 12\n @version 1.0"]
pub type OH_NetConn_NetBlockStatusChange =
::std::option::Option<unsafe extern "C" fn(netHandle: *mut NetConn_NetHandle, blocked: bool)>;
#[doc = " @brief Defines the network connection callbacks.\n\n @since 12\n @version 1.0"]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_NetConnCallback {
#[doc = " Callback for network available"]
pub onNetworkAvailable: OH_NetConn_NetworkAvailable,
#[doc = " Callback for network capabilities changed"]
pub onNetCapabilitiesChange: OH_NetConn_NetCapabilitiesChange,
#[doc = " Callback for network connection properties changed"]
pub onConnetionProperties: OH_NetConn_NetConnectionPropertiesChange,
#[doc = " Callback for network lost"]
pub onNetLost: OH_NetConn_NetLost,
#[doc = " Callback for network unavailable, this function invoked while network can not be available in given timeout"]
pub onNetUnavailable: OH_NetConn_NetUnavailable,
#[doc = " Callback for network blocked status changed"]
pub onNetBlockStatusChange: OH_NetConn_NetBlockStatusChange,
}
#[doc = " @brief Defines the probe result information.\n\n @since 20"]
#[cfg(feature = "api-20")]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_ProbeResultInfo {
#[doc = " Number of jumps"]
pub lossRate: u8,
#[doc = " RTT in micro seconds, min/avg/max/std"]
pub rtt: [u32; 4usize],
}
#[doc = " @brief Defines the network trace route option.\n\n @since 20"]
#[cfg(feature = "api-20")]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_TraceRouteOption {
#[doc = " Maximum number of jumps, default is 30"]
pub maxJumpNumber: u8,
#[doc = " Packets type"]
pub packetsType: NetConn_PacketsType,
}
#[doc = " @brief Defines the trace route information.\n\n @since 20"]
#[cfg(feature = "api-20")]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct NetConn_TraceRouteInfo {
#[doc = " Number of jumps"]
pub jumpNo: u8,
#[doc = " host name or address"]
pub address: [::std::os::raw::c_char; 256usize],
#[doc = " RTT in micro seconds"]
pub rtt: [u32; 4usize],
}
extern "C" {
#[doc = " @brief Checks whether a default activated data network is available.\n\n @param hasDefaultNet Pointer to the result that specifies whether a default activated data network is available.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_HasDefaultNet(hasDefaultNet: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the default activated data network.\n\n @param netHandle Pointer to the network handle that contains the network ID.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_GetDefaultNet(netHandle: *mut NetConn_NetHandle) -> i32;
}
extern "C" {
#[doc = " @brief Checks whether metering is enabled for the default data network.\n\n @param isMetered Pointer to the result that specifies whether metering is enabled.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_IsDefaultNetMetered(isMetered: *mut i32) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the connection properties of a data network.\n\n @param netHandle Pointer to the network handle that contains the network ID.\n @param prop Pointer to the connection properties.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_GetConnectionProperties(
netHandle: *mut NetConn_NetHandle,
prop: *mut NetConn_ConnectionProperties,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the capabilities of a data network.\n\n @param netHandle Pointer to the network handle that contains the network ID.\n @param netCapacities Pointer to the network capabilities.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_GetNetCapabilities(
netHandle: *mut NetConn_NetHandle,
netCapabilities: *mut NetConn_NetCapabilities,
) -> i32;
}
extern "C" {
#[doc = " @brief Obtains the default http proxy.\n\n @param httpProxy Pointer to the HTTP proxy.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_GetDefaultHttpProxy(httpProxy: *mut NetConn_HttpProxy) -> i32;
}
extern "C" {
#[doc = " @brief Get DNS result with netId.\n\n @param host The host name to query.\n @param serv Service name.\n @param hint Pointer to the addrinfo structure.\n @param res Store DNS query results and return them in a linked list format.\n @param netId DNS query netId, 0 is used for default netid query.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.INTERNET\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_GetAddrInfo(
host: *mut ::std::os::raw::c_char,
serv: *mut ::std::os::raw::c_char,
hint: *mut addrinfo,
res: *mut *mut addrinfo,
netId: i32,
) -> i32;
}
extern "C" {
#[doc = " @brief Free DNS result.\n\n @param res DNS query result chain header.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.INTERNET\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_FreeDnsResult(res: *mut addrinfo) -> i32;
}
extern "C" {
#[doc = " @brief Queries all activated data networks.\n\n @param netHandleList Network handle that stores the network ID list.\n @return 0 - Success. 201 - Missing permissions.\n 401 - Parameter error. 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 11\n @version 1.0"]
pub fn OH_NetConn_GetAllNets(netHandleList: *mut NetConn_NetHandleList) -> i32;
}
extern "C" {
#[doc = " @brief Registers a custom DNS resolver.\n\n @param resolver Pointer to the custom DNS resolver.\n @return Returns the result code.\n {@link NETMANAGER_EXT_SUCCESS} if the operation is successful.\n {@link NETMANAGER_ERR_PARAMETER_ERROR} Parameter error. Please enter a correct parameter.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 13\n @version 1.0"]
#[cfg(feature = "api-13")]
pub fn OH_NetConn_RegisterDnsResolver(resolver: OH_NetConn_CustomDnsResolver) -> i32;
}
extern "C" {
#[doc = " @brief Unregisters a custom DNS resolver.\n\n @return 0 - Success.\n 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 13\n @version 1.0"]
#[cfg(feature = "api-13")]
pub fn OH_NetConn_UnregisterDnsResolver() -> i32;
}
extern "C" {
#[doc = " @brief Binds a socket to the specific network.\n\n @param socketFd Socket constructed by user.\n @param netHandle Pointer to the network handle that contains the network ID.\n @return 0 - Success.\n 401 - Parameter error.\n 2100002 - Unable to connect to service.\n 2100003 - Internal error.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_BindSocket(socketFd: i32, netHandle: *mut NetConn_NetHandle) -> i32;
}
extern "C" {
#[doc = " @brief Sets http proxy information to current application.\n\n @param httpProxy Information about the proxy that needs to be set.\n @return 0 - Success.\n 401 - Parameter error.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_SetAppHttpProxy(httpProxy: *mut NetConn_HttpProxy) -> i32;
}
extern "C" {
#[doc = " @brief Registers callback to listen for changes to the application-level http proxy.\n\n @param appHttpProxyChange Callback that need to be registered to listen for changes to the http proxy.\n @param callbackId Callback id returned after registration, associated with a registered callback.\n @return 0 - Success.\n 401 - Parameter error.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_RegisterAppHttpProxyCallback(
appHttpProxyChange: OH_NetConn_AppHttpProxyChange,
callbackId: *mut u32,
) -> i32;
}
extern "C" {
#[doc = " @brief Unregisters a callback function that listens for application-level proxy changes.\n\n @param callbackId Id of the callback function that needs to be deregistered.\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_UnregisterAppHttpProxyCallback(callbackId: u32);
}
extern "C" {
#[doc = " @brief Registers callback, used to monitor specific network status.\n\n @param netSpecifier specifier information.\n @param callback The callback needed to be registered.\n @param timeout The timeout period in milliseconds.\n @param callbackId out param, corresponding to a registered callback.\n @return 0 - Success.\n 201 - Permission denied.\n 401 - Parameter error.\n 2100002 - Failed to connect to the service.\n 2100003 - System internal error.\n 2101008 - The callback already exists.\n 2101022 - The number of requests exceeded the maximum allowed.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_RegisterNetConnCallback(
specifier: *mut NetConn_NetSpecifier,
netConnCallback: *mut NetConn_NetConnCallback,
timeout: u32,
callbackId: *mut u32,
) -> i32;
}
extern "C" {
#[doc = " @brief Registers a callback to listen default network's status changed.\n\n @param callback The callback needed to be registered.\n @param callbackId out param, corresponding to a registered callback.\n @return 0 - Success.\n 201 - Permission denied.\n 401 - Parameter error.\n 2100002 - Failed to connect to the service.\n 2100003 - System internal error.\n 2101008 - The callback already exists.\n 2101022 - The number of requests exceeded the maximum allowed.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_RegisterDefaultNetConnCallback(
netConnCallback: *mut NetConn_NetConnCallback,
callbackId: *mut u32,
) -> i32;
}
extern "C" {
#[doc = " @brief Unregisters network status callback.\n\n @param callBackId the id corresponding to a registered callback.\n @return 0 - Success.\n 201 - Permission denied.\n 401 - Parameter error.\n 2100002 - Failed to connect to the service.\n 2100003 - System internal error.\n 2101007 - The callback does not exists.\n @permission ohos.permission.GET_NETWORK_INFO\n @syscap SystemCapability.Communication.NetManager.Core\n @since 12\n @version 1.0"]
pub fn OH_NetConn_UnregisterNetConnCallback(callBackId: u32) -> i32;
}
extern "C" {
#[doc = " @brief Sets the URL of the current PAC script.\n\n @param pacUrl the URL of the current PAC script.\n @return the result defines in {@link NetConn_ErrorCode}.\n {@link NETCONN_SUCCESS} Success.\n {@link NETCONN_PERMISSION_DENIED} Permission denied.\n {@link NETCONN_PARAMETER_ERROR} Parameter check failed.\n {@link NETCONN_OPERATION_FAILED} Failed to connect to the service.\n {@link NETCONN_INTERNAL_ERROR} System internal error.\n @permission ohos.permission.SET_PAC_URL\n @since 15"]
#[cfg(feature = "api-15")]
pub fn OH_NetConn_SetPacUrl(pacUrl: *const ::std::os::raw::c_char) -> NetConn_ErrorCode;
}
extern "C" {
#[doc = " @brief Obtains the URL of the current PAC script.\n\n @param pacUrl the URL of the current PAC script.\n @return the result defines in {@link NetConn_ErrorCode}.\n {@link NETCONN_SUCCESS} Success.\n {@link NETCONN_PARAMETER_ERROR} Parameter check failed.\n {@link NETCONN_OPERATION_FAILED} Failed to connect to the service.\n {@link NETCONN_INTERNAL_ERROR} System internal error.\n @since 15"]
#[cfg(feature = "api-15")]
pub fn OH_NetConn_GetPacUrl(pacUrl: *mut ::std::os::raw::c_char) -> NetConn_ErrorCode;
}
extern "C" {
#[doc = " @brief Query a network probe result.\n\n @param destination Pointer to the destination.\n @param duration probe duration. Unit: second.\n @param probeResultInfo Pointer to probe loss rate and rtt.\n @return 0 - Success.\n 201 - Missing permissions.\n 401 - Parameter error.\n 2100003 - Internal error.\n @permission ohos.permission.INTERNET\n @since 20"]
#[cfg(feature = "api-20")]
pub fn OH_NetConn_QueryProbeResult(
destination: *mut ::std::os::raw::c_char,
duration: i32,
probeResultInfo: *mut NetConn_ProbeResultInfo,
) -> i32;
}
extern "C" {
#[doc = " @brief Query a network trace route.\n\n @param destination Pointer to the destination.\n @param option Pointer to the trace route option\n @param traceRouteInfo Pointer to trace route result.\n @return 0 - Success.\n 201 - Missing permissions.\n @permission ohos.permission.INTERNET and ohos.permission.LOCATION and ohos.permission.ACCESS_NET_TRACE_INFO\n @since 20"]
#[cfg(feature = "api-20")]
pub fn OH_NetConn_QueryTraceRoute(
destination: *mut ::std::os::raw::c_char,
option: *mut NetConn_TraceRouteOption,
traceRouteInfo: *mut NetConn_TraceRouteInfo,
) -> i32;
}