net_connection.h

Overview

Provides the C APIs of the network connection module for network management.

System capability: SystemCapability.Communication.NetManager.Core

Library: libnet_connection.so

Since: 11

Related module: NetConnection

Summary

Functions

Name Description
OH_NetConn_HasDefaultNet (int32_t *hasDefaultNet) Checks whether a default activated data network is available.
OH_NetConn_GetDefaultNet (NetConn_NetHandle *netHandle) Obtains the default activated data network.
OH_NetConn_IsDefaultNetMetered (int32_t *isMetered) Checks whether data traffic usage on the current network is metered.
OH_NetConn_GetConnectionProperties (NetConn_NetHandle *netHandle, NetConn_ConnectionProperties *prop) Obtains the link information of a data network.
OH_NetConn_GetNetCapabilities (NetConn_NetHandle *netHandle, NetConn_NetCapabilities *netCapacities) Obtains the capabilities of a data network.
OH_NetConn_GetDefaultHttpProxy (NetConn_HttpProxy *httpProxy) Obtains the default network proxy.
OH_NetConn_GetAddrInfo (char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId) Obtains the DNS result using netId.
OH_NetConn_FreeDnsResult (struct addrinfo *res) Releases the DNS query result.
OH_NetConn_GetAllNets (NetConn_NetHandleList *netHandleList) Obtains all activated data networks.
OHOS_NetConn_RegisterDnsResolver (OH_NetConn_CustomDnsResolver resolver) Registers a custom DNS resolver.
OHOS_NetConn_UnregisterDnsResolver (void) Unregisters a custom DNS resolver.