1#![allow(non_snake_case)]
4#![allow(non_upper_case_globals)]
5#![allow(non_camel_case_types)]
6#![allow(clippy::missing_safety_doc)]
7
8#[link(name = "net_connection")]
9unsafe extern "C" {}
10
11pub const NETCONN_MAX_NET_SIZE: u32 = 32;
12pub const NETCONN_MAX_BEARER_TYPE_SIZE: u32 = 32;
13pub const NETCONN_MAX_CAP_SIZE: u32 = 32;
14pub const NETCONN_MAX_ADDR_SIZE: u32 = 32;
15pub const NETCONN_MAX_ROUTE_SIZE: u32 = 64;
16pub const NETCONN_MAX_EXCLUSION_SIZE: u32 = 256;
17pub const NETCONN_MAX_STR_LEN: u32 = 256;
18pub const NETCONN_MAX_RTT_NUM: u32 = 4;
19pub type socklen_t = ::std::os::raw::c_uint;
20pub type sa_family_t = ::std::os::raw::c_ushort;
21#[repr(C)]
22#[derive(Debug, Copy, Clone)]
23pub struct sockaddr {
24 pub sa_family: sa_family_t,
25 pub sa_data: [::std::os::raw::c_char; 14usize],
26}
27#[repr(C)]
28#[derive(Debug, Copy, Clone)]
29pub struct addrinfo {
30 pub ai_flags: ::std::os::raw::c_int,
31 pub ai_family: ::std::os::raw::c_int,
32 pub ai_socktype: ::std::os::raw::c_int,
33 pub ai_protocol: ::std::os::raw::c_int,
34 pub ai_addrlen: socklen_t,
35 pub ai_addr: *mut sockaddr,
36 pub ai_canonname: *mut ::std::os::raw::c_char,
37 pub ai_next: *mut addrinfo,
38}
39#[doc = " MMS"]
40pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_MMS: NetConn_NetCap = 0;
41#[doc = " Not Metered"]
42pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_NOT_METERED: NetConn_NetCap = 11;
43#[doc = " Internet"]
44pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_INTERNET: NetConn_NetCap = 12;
45#[doc = " Not VPN"]
46pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_NOT_VPN: NetConn_NetCap = 15;
47#[doc = " Validated"]
48pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_VALIDATED: NetConn_NetCap = 16;
49#[doc = " Portal\n @since 12"]
50pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_PORTAL: NetConn_NetCap = 17;
51#[doc = " In checking network connectivity.\n @since 12"]
52pub const NetConn_NetCap_NETCONN_NET_CAPABILITY_CHECKING_CONNECTIVITY: NetConn_NetCap = 31;
53#[doc = " @brief Defines network capabilities.\n\n @since 11\n @version 1.0"]
54pub type NetConn_NetCap = u32;
55#[doc = " Cellular network"]
56pub const NetConn_NetBearerType_NETCONN_BEARER_CELLULAR: NetConn_NetBearerType = 0;
57#[doc = " WIFI"]
58pub const NetConn_NetBearerType_NETCONN_BEARER_WIFI: NetConn_NetBearerType = 1;
59#[doc = " Bluetooth\n @since 12"]
60pub const NetConn_NetBearerType_NETCONN_BEARER_BLUETOOTH: NetConn_NetBearerType = 2;
61#[doc = " Ethernet"]
62pub const NetConn_NetBearerType_NETCONN_BEARER_ETHERNET: NetConn_NetBearerType = 3;
63#[doc = " VPN\n @since 12"]
64pub const NetConn_NetBearerType_NETCONN_BEARER_VPN: NetConn_NetBearerType = 4;
65#[doc = " @brief Defines network bearer types.\n\n @since 11\n @version 1.0"]
66pub type NetConn_NetBearerType = u32;
67#[doc = " @error Success return code on success"]
68#[cfg(feature = "api-15")]
69pub const NetConn_ErrorCode_NETCONN_SUCCESS: NetConn_ErrorCode = 0;
70#[doc = " @error Permission verification failed"]
71#[cfg(feature = "api-15")]
72pub const NetConn_ErrorCode_NETCONN_PERMISSION_DENIED: NetConn_ErrorCode = 201;
73#[doc = " @error Parameter check failed"]
74#[cfg(feature = "api-15")]
75pub const NetConn_ErrorCode_NETCONN_PARAMETER_ERROR: NetConn_ErrorCode = 401;
76#[doc = " @error Failed to connect to the service"]
77#[cfg(feature = "api-15")]
78pub const NetConn_ErrorCode_NETCONN_OPERATION_FAILED: NetConn_ErrorCode = 2100002;
79#[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."]
80#[cfg(feature = "api-15")]
81pub const NetConn_ErrorCode_NETCONN_INTERNAL_ERROR: NetConn_ErrorCode = 2100003;
82#[doc = " @brief Enumerates NetConn error codes.\n\n @since 15"]
83#[cfg(feature = "api-15")]
84pub type NetConn_ErrorCode = u32;
85#[doc = " ICMP"]
86#[cfg(feature = "api-20")]
87pub const NetConn_PacketsType_NETCONN_PACKETS_ICMP: NetConn_PacketsType = 0;
88#[doc = " UDP"]
89#[cfg(feature = "api-20")]
90pub const NetConn_PacketsType_NETCONN_PACKETS_UDP: NetConn_PacketsType = 1;
91#[doc = " @brief Enumerates packets type of trace route.\n\n @since 20"]
92#[cfg(feature = "api-20")]
93pub type NetConn_PacketsType = u32;
94#[doc = " @brief Defines the network handle.\n\n @since 11\n @version 1.0"]
95#[repr(C)]
96#[derive(Debug, Copy, Clone)]
97pub struct NetConn_NetHandle {
98 #[doc = " Network ID"]
99 pub netId: i32,
100}
101#[doc = " @brief Defines all network capabilities.\n\n @since 11\n @version 1.0"]
102#[repr(C)]
103#[derive(Debug, Copy, Clone)]
104pub struct NetConn_NetCapabilities {
105 #[doc = " Uplink bandwidth"]
106 pub linkUpBandwidthKbps: u32,
107 #[doc = " Downlink bandwidth"]
108 pub linkDownBandwidthKbps: u32,
109 #[doc = " Network capability list"]
110 pub netCaps: [NetConn_NetCap; 32usize],
111 #[doc = " Actual size of the network capability list"]
112 pub netCapsSize: i32,
113 #[doc = " Bearer type list"]
114 pub bearerTypes: [NetConn_NetBearerType; 32usize],
115 #[doc = " Actual size of the bearer type list"]
116 pub bearerTypesSize: i32,
117}
118#[doc = " @brief Defines the network address.\n\n @since 11\n @version 1.0"]
119#[repr(C)]
120#[derive(Debug, Copy, Clone)]
121pub struct NetConn_NetAddr {
122 #[doc = " Network address family"]
123 pub family: u8,
124 #[doc = " Prefix length"]
125 pub prefixlen: u8,
126 #[doc = " Port number"]
127 pub port: u8,
128 #[doc = " Address"]
129 pub address: [::std::os::raw::c_char; 256usize],
130}
131#[doc = " @brief Defines the route configuration information.\n\n @since 11\n @version 1.0"]
132#[repr(C)]
133#[derive(Debug, Copy, Clone)]
134pub struct NetConn_Route {
135 #[doc = " Network interface"]
136 pub iface: [::std::os::raw::c_char; 256usize],
137 #[doc = " Destination address"]
138 pub destination: NetConn_NetAddr,
139 #[doc = " Gateway address"]
140 pub gateway: NetConn_NetAddr,
141 #[doc = " Gateway exists or not"]
142 pub hasGateway: i32,
143 #[doc = " Default route or not"]
144 pub isDefaultRoute: i32,
145}
146#[doc = " @brief Defines the proxy configuration information.\n\n @since 11\n @version 1.0"]
147#[repr(C)]
148#[derive(Debug, Copy, Clone)]
149pub struct NetConn_HttpProxy {
150 #[doc = " Host name"]
151 pub host: [::std::os::raw::c_char; 256usize],
152 #[doc = " Exclusion list of proxy servers"]
153 pub exclusionList: [[::std::os::raw::c_char; 256usize]; 256usize],
154 #[doc = " Actual size of the exclusion list"]
155 pub exclusionListSize: i32,
156 #[doc = " Port number"]
157 pub port: u16,
158}
159#[doc = " @brief Defines the network connection properties.\n\n @since 11\n @version 1.0"]
160#[repr(C)]
161#[derive(Debug, Copy, Clone)]
162pub struct NetConn_ConnectionProperties {
163 #[doc = " Network interface name"]
164 pub ifaceName: [::std::os::raw::c_char; 256usize],
165 #[doc = " Domain name of the network connection"]
166 pub domain: [::std::os::raw::c_char; 256usize],
167 #[doc = " TCP buffer size"]
168 pub tcpBufferSizes: [::std::os::raw::c_char; 256usize],
169 #[doc = " MTU"]
170 pub mtu: u16,
171 #[doc = " Address list"]
172 pub netAddrList: [NetConn_NetAddr; 32usize],
173 #[doc = " Actual size of the address list"]
174 pub netAddrListSize: i32,
175 #[doc = " DNS list"]
176 pub dnsList: [NetConn_NetAddr; 32usize],
177 #[doc = " Actual size of the DNS list"]
178 pub dnsListSize: i32,
179 #[doc = " Route list"]
180 pub routeList: [NetConn_Route; 64usize],
181 #[doc = " Actual size of the route list"]
182 pub routeListSize: i32,
183 #[doc = " HTTP proxy information"]
184 pub httpProxy: NetConn_HttpProxy,
185}
186#[doc = " @brief Defines the network handle list.\n\n @since 11\n @version 1.0"]
187#[repr(C)]
188#[derive(Debug, Copy, Clone)]
189pub struct NetConn_NetHandleList {
190 #[doc = " Network handle list"]
191 pub netHandles: [NetConn_NetHandle; 32usize],
192 #[doc = " Actual size of the network handle list"]
193 pub netHandleListSize: i32,
194}
195#[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"]
196pub type OH_NetConn_CustomDnsResolver = ::std::option::Option<
197 unsafe extern "C" fn(
198 host: *const ::std::os::raw::c_char,
199 serv: *const ::std::os::raw::c_char,
200 hint: *const addrinfo,
201 res: *mut *mut addrinfo,
202 ) -> ::std::os::raw::c_int,
203>;
204#[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"]
205pub type OH_NetConn_AppHttpProxyChange =
206 ::std::option::Option<unsafe extern "C" fn(proxy: *mut NetConn_HttpProxy)>;
207#[doc = " @brief Definition of network specifier.\n\n @since 12\n @version 1.0"]
208#[repr(C)]
209#[derive(Debug, Copy, Clone)]
210pub struct NetConn_NetSpecifier {
211 #[doc = " Network capabilities."]
212 pub caps: NetConn_NetCapabilities,
213 #[doc = " Network identifier"]
214 pub bearerPrivateIdentifier: *mut ::std::os::raw::c_char,
215}
216#[doc = " @brief Callback for network available.\n\n @param netHandle The network handle.\n\n @since 12\n @version 1.0"]
217pub type OH_NetConn_NetworkAvailable =
218 ::std::option::Option<unsafe extern "C" fn(netHandle: *mut NetConn_NetHandle)>;
219#[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"]
220pub type OH_NetConn_NetCapabilitiesChange = ::std::option::Option<
221 unsafe extern "C" fn(
222 netHandle: *mut NetConn_NetHandle,
223 netCapabilities: *mut NetConn_NetCapabilities,
224 ),
225>;
226#[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"]
227pub type OH_NetConn_NetConnectionPropertiesChange = ::std::option::Option<
228 unsafe extern "C" fn(
229 netHandle: *mut NetConn_NetHandle,
230 connConnetionProperties: *mut NetConn_ConnectionProperties,
231 ),
232>;
233#[doc = " @brief Callback for network lost.\n\n @param netHandle The network handle.\n\n @since 12\n @version 1.0"]
234pub type OH_NetConn_NetLost =
235 ::std::option::Option<unsafe extern "C" fn(netHandle: *mut NetConn_NetHandle)>;
236#[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"]
237pub type OH_NetConn_NetUnavailable = ::std::option::Option<unsafe extern "C" fn()>;
238#[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"]
239pub type OH_NetConn_NetBlockStatusChange =
240 ::std::option::Option<unsafe extern "C" fn(netHandle: *mut NetConn_NetHandle, blocked: bool)>;
241#[doc = " @brief Defines the network connection callbacks.\n\n @since 12\n @version 1.0"]
242#[repr(C)]
243#[derive(Debug, Copy, Clone)]
244pub struct NetConn_NetConnCallback {
245 #[doc = " Callback for network available"]
246 pub onNetworkAvailable: OH_NetConn_NetworkAvailable,
247 #[doc = " Callback for network capabilities changed"]
248 pub onNetCapabilitiesChange: OH_NetConn_NetCapabilitiesChange,
249 #[doc = " Callback for network connection properties changed"]
250 pub onConnetionProperties: OH_NetConn_NetConnectionPropertiesChange,
251 #[doc = " Callback for network lost"]
252 pub onNetLost: OH_NetConn_NetLost,
253 #[doc = " Callback for network unavailable, this function invoked while network can not be available in given timeout"]
254 pub onNetUnavailable: OH_NetConn_NetUnavailable,
255 #[doc = " Callback for network blocked status changed"]
256 pub onNetBlockStatusChange: OH_NetConn_NetBlockStatusChange,
257}
258#[doc = " @brief Defines the probe result information.\n\n @since 20"]
259#[cfg(feature = "api-20")]
260#[repr(C)]
261#[derive(Debug, Copy, Clone)]
262pub struct NetConn_ProbeResultInfo {
263 #[doc = " Number of jumps"]
264 pub lossRate: u8,
265 #[doc = " RTT in micro seconds, min/avg/max/std"]
266 pub rtt: [u32; 4usize],
267}
268#[doc = " @brief Defines the network trace route option.\n\n @since 20"]
269#[cfg(feature = "api-20")]
270#[repr(C)]
271#[derive(Debug, Copy, Clone)]
272pub struct NetConn_TraceRouteOption {
273 #[doc = " Maximum number of jumps, default is 30"]
274 pub maxJumpNumber: u8,
275 #[doc = " Packets type"]
276 pub packetsType: NetConn_PacketsType,
277}
278#[doc = " @brief Defines the trace route information.\n\n @since 20"]
279#[cfg(feature = "api-20")]
280#[repr(C)]
281#[derive(Debug, Copy, Clone)]
282pub struct NetConn_TraceRouteInfo {
283 #[doc = " Number of jumps"]
284 pub jumpNo: u8,
285 #[doc = " host name or address"]
286 pub address: [::std::os::raw::c_char; 256usize],
287 #[doc = " RTT in micro seconds"]
288 pub rtt: [u32; 4usize],
289}
290extern "C" {
291 #[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"]
292 pub fn OH_NetConn_HasDefaultNet(hasDefaultNet: *mut i32) -> i32;
293}
294extern "C" {
295 #[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"]
296 pub fn OH_NetConn_GetDefaultNet(netHandle: *mut NetConn_NetHandle) -> i32;
297}
298extern "C" {
299 #[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"]
300 pub fn OH_NetConn_IsDefaultNetMetered(isMetered: *mut i32) -> i32;
301}
302extern "C" {
303 #[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"]
304 pub fn OH_NetConn_GetConnectionProperties(
305 netHandle: *mut NetConn_NetHandle,
306 prop: *mut NetConn_ConnectionProperties,
307 ) -> i32;
308}
309extern "C" {
310 #[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"]
311 pub fn OH_NetConn_GetNetCapabilities(
312 netHandle: *mut NetConn_NetHandle,
313 netCapabilities: *mut NetConn_NetCapabilities,
314 ) -> i32;
315}
316extern "C" {
317 #[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"]
318 pub fn OH_NetConn_GetDefaultHttpProxy(httpProxy: *mut NetConn_HttpProxy) -> i32;
319}
320extern "C" {
321 #[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"]
322 pub fn OH_NetConn_GetAddrInfo(
323 host: *mut ::std::os::raw::c_char,
324 serv: *mut ::std::os::raw::c_char,
325 hint: *mut addrinfo,
326 res: *mut *mut addrinfo,
327 netId: i32,
328 ) -> i32;
329}
330extern "C" {
331 #[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"]
332 pub fn OH_NetConn_FreeDnsResult(res: *mut addrinfo) -> i32;
333}
334extern "C" {
335 #[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"]
336 pub fn OH_NetConn_GetAllNets(netHandleList: *mut NetConn_NetHandleList) -> i32;
337}
338extern "C" {
339 #[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"]
340 #[cfg(feature = "api-13")]
341 pub fn OH_NetConn_RegisterDnsResolver(resolver: OH_NetConn_CustomDnsResolver) -> i32;
342}
343extern "C" {
344 #[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"]
345 #[cfg(feature = "api-13")]
346 pub fn OH_NetConn_UnregisterDnsResolver() -> i32;
347}
348extern "C" {
349 #[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"]
350 pub fn OH_NetConn_BindSocket(socketFd: i32, netHandle: *mut NetConn_NetHandle) -> i32;
351}
352extern "C" {
353 #[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"]
354 pub fn OH_NetConn_SetAppHttpProxy(httpProxy: *mut NetConn_HttpProxy) -> i32;
355}
356extern "C" {
357 #[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"]
358 pub fn OH_NetConn_RegisterAppHttpProxyCallback(
359 appHttpProxyChange: OH_NetConn_AppHttpProxyChange,
360 callbackId: *mut u32,
361 ) -> i32;
362}
363extern "C" {
364 #[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"]
365 pub fn OH_NetConn_UnregisterAppHttpProxyCallback(callbackId: u32);
366}
367extern "C" {
368 #[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"]
369 pub fn OH_NetConn_RegisterNetConnCallback(
370 specifier: *mut NetConn_NetSpecifier,
371 netConnCallback: *mut NetConn_NetConnCallback,
372 timeout: u32,
373 callbackId: *mut u32,
374 ) -> i32;
375}
376extern "C" {
377 #[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"]
378 pub fn OH_NetConn_RegisterDefaultNetConnCallback(
379 netConnCallback: *mut NetConn_NetConnCallback,
380 callbackId: *mut u32,
381 ) -> i32;
382}
383extern "C" {
384 #[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"]
385 pub fn OH_NetConn_UnregisterNetConnCallback(callBackId: u32) -> i32;
386}
387extern "C" {
388 #[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"]
389 #[cfg(feature = "api-15")]
390 pub fn OH_NetConn_SetPacUrl(pacUrl: *const ::std::os::raw::c_char) -> NetConn_ErrorCode;
391}
392extern "C" {
393 #[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"]
394 #[cfg(feature = "api-15")]
395 pub fn OH_NetConn_GetPacUrl(pacUrl: *mut ::std::os::raw::c_char) -> NetConn_ErrorCode;
396}
397extern "C" {
398 #[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"]
399 #[cfg(feature = "api-20")]
400 pub fn OH_NetConn_QueryProbeResult(
401 destination: *mut ::std::os::raw::c_char,
402 duration: i32,
403 probeResultInfo: *mut NetConn_ProbeResultInfo,
404 ) -> i32;
405}
406extern "C" {
407 #[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"]
408 #[cfg(feature = "api-20")]
409 pub fn OH_NetConn_QueryTraceRoute(
410 destination: *mut ::std::os::raw::c_char,
411 option: *mut NetConn_TraceRouteOption,
412 traceRouteInfo: *mut NetConn_TraceRouteInfo,
413 ) -> i32;
414}