1# net_connection.h
2
3
4## Overview
5
6Provides the C APIs of the network connection module for network management.
7
8**System capability**: SystemCapability.Communication.NetManager.Core
9
10**Library**: libnet_connection.so
11
12**Since**: 11
13
14**Related module**: [NetConnection](_net_connection.md)
15
16
17## Summary
18
19
20### Functions
21
22| Name| Description|
23| -------- | -------- |
24| [OH_NetConn_HasDefaultNet](_net_connection.md#oh_netconn_hasdefaultnet) (int32_t \*hasDefaultNet) | Checks whether a default activated data network is available.|
25| [OH_NetConn_GetDefaultNet](_net_connection.md#oh_netconn_getdefaultnet) ([NetConn_NetHandle](_net_conn___net_handle.md) \*netHandle) | Obtains the default activated data network.|
26| [OH_NetConn_IsDefaultNetMetered](_net_connection.md#oh_netconn_isdefaultnetmetered) (int32_t \*isMetered) | Checks whether data traffic usage on the current network is metered.|
27| [OH_NetConn_GetConnectionProperties](_net_connection.md#oh_netconn_getconnectionproperties) ([NetConn_NetHandle](_net_conn___net_handle.md) \*netHandle, [NetConn_ConnectionProperties](_net_conn___connection_properties.md) \*prop) | Obtains the link information of a data network.|
28| [OH_NetConn_GetNetCapabilities](_net_connection.md#oh_netconn_getnetcapabilities) ([NetConn_NetHandle](_net_conn___net_handle.md) \*netHandle, [NetConn_NetCapabilities](_net_conn___net_capabilities.md) \*netCapacities) | Obtains the capabilities of a data network.|
29| [OH_NetConn_GetDefaultHttpProxy](_net_connection.md#oh_netconn_getdefaulthttpproxy) ([NetConn_HttpProxy](_net_conn___http_proxy.md) \*httpProxy) | Obtains the default network proxy.|
30| [OH_NetConn_GetAddrInfo](_net_connection.md#oh_netconn_getaddrinfo) (char \*host, char \*serv, struct addrinfo \*hint, struct addrinfo \*\*res, int32_t netId) | Obtains the DNS result using **netId**.|
31| [OH_NetConn_FreeDnsResult](_net_connection.md#oh_netconn_freednsresult) (struct addrinfo \*res) | Releases the DNS query result.|
32| [OH_NetConn_GetAllNets](_net_connection.md#oh_netconn_getallnets) ([NetConn_NetHandleList](_net_conn___net_handle_list.md) \*netHandleList) | Obtains all activated data networks.|
33| [OHOS_NetConn_RegisterDnsResolver](_net_connection.md#ohos_netconn_registerdnsresolver-deprecated) ([OH_NetConn_CustomDnsResolver](_net_connection.md#oh_netconn_customdnsresolver) resolver) | Registers a custom DNS resolver.<br>Note: This API is deprecated since API version 13. You are advised to use **OH_NetConn_RegisterDnsResolver** instead.|
34| [OHOS_NetConn_UnregisterDnsResolver](_net_connection.md#ohos_netconn_unregisterdnsresolver-deprecated) (void) | Unregisters a custom DNS resolver.<br>Note: This API is deprecated since API version 13. You are advised to use **OH_NetConn_UnregisterDnsResolver** instead.|
35| [OH_NetConn_RegisterDnsResolver](_net_connection.md#oh_netconn_registerdnsresolver) ([OH_NetConn_CustomDnsResolver](_net_connection.md#oh_netconn_customdnsresolver) resolver) | Registers a custom DNS resolver.|
36| [OH_NetConn_UnregisterDnsResolver](_net_connection.md#oh_netconn_unregisterdnsresolver) (void) | Unregisters a custom DNS resolver.|
37