net_connection.h

概述

为网络管理数据网络连接模块提供C接口。

系统能力: SystemCapability.Communication.NetManager.Core

库: libnet_connection.so

起始版本: 11

相关模块:NetConnection

汇总

函数

名称 描述
OH_NetConn_HasDefaultNet (int32_t *hasDefaultNet) 查询是否有默认激活的数据网络。
OH_NetConn_GetDefaultNet (NetConn_NetHandle *netHandle) 获取激活的默认的数据网络。
OH_NetConn_IsDefaultNetMetered (int32_t *isMetered) 查询默认网络是否按流量计费。
OH_NetConn_GetConnectionProperties (NetConn_NetHandle *netHandle, NetConn_ConnectionProperties *prop) 查询某个数据网络的链路信息。
OH_NetConn_GetNetCapabilities (NetConn_NetHandle *netHandle, NetConn_NetCapabilities *netCapacities) 查询某个网络的能力集。
OH_NetConn_GetDefaultHttpProxy (NetConn_HttpProxy *httpProxy) 查询默认的网络代理。
OH_NetConn_GetAddrInfo (char *host, char *serv, struct addrinfo *hint, struct addrinfo **res, int32_t netId) 通过netId获取DNS结果。
OH_NetConn_FreeDnsResult (struct addrinfo *res) 释放DNS结果。
OH_NetConn_GetAllNets (NetConn_NetHandleList *netHandleList) 查询所有激活的数据网络。
OHOS_NetConn_RegisterDnsResolver (OH_NetConn_CustomDnsResolver resolver) 注册自定义 DNS 解析器。
OHOS_NetConn_UnregisterDnsResolver (void) 取消注册自定义 DNS 解析器。