mirror of
https://gitee.com/openharmony/interface_sdk_c
synced 2024-11-27 00:41:01 +00:00
!1246 netmanager_base增加应用级代理的部分NDK接口
Merge pull request !1246 from Tiga Ultraman/wechat
This commit is contained in:
commit
6e51fb9127
@ -219,6 +219,99 @@ int32_t OHOS_NetConn_UnregisterDnsResolver(void);
|
||||
*/
|
||||
int32_t OH_NetConn_BindSocket(int32_t socketFd, NetConn_NetHandle *netHandle);
|
||||
|
||||
/**
|
||||
* @brief Sets http proxy information to current application.
|
||||
*
|
||||
* @param httpProxy Information about the proxy that needs to be set.
|
||||
* @return 0 - Success.
|
||||
* 401 - Parameter error.
|
||||
* @syscap SystemCapability.Communication.NetManager.Core
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NetConn_SetAppHttpProxy(NetConn_HttpProxy *httpProxy);
|
||||
|
||||
/**
|
||||
* @brief Registers callback to listen for changes to the application-level http proxy.
|
||||
*
|
||||
* @param appHttpProxyChange Callback that need to be registered to listen for changes to the http proxy.
|
||||
* @param callbackId Callback id returned after registration, associated with a registered callback.
|
||||
* @return 0 - Success.
|
||||
* 401 - Parameter error.
|
||||
* @syscap SystemCapability.Communication.NetManager.Core
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NetConn_RegisterAppHttpProxyCallback(OH_NetConn_AppHttpProxyChange appHttpProxyChange, uint32_t *callbackId);
|
||||
|
||||
/**
|
||||
* @brief Unregisters a callback function that listens for application-level proxy changes.
|
||||
*
|
||||
* @param callbackId Id of the callback function that needs to be deregistered.
|
||||
* @syscap SystemCapability.Communication.NetManager.Core
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
void OH_NetConn_UnregisterAppHttpProxyCallback(uint32_t callbackId);
|
||||
|
||||
/**
|
||||
* @brief Registers callback, used to monitor specific network status.
|
||||
*
|
||||
* @param netSpecifier specifier information.
|
||||
* @param callback The callback needed to be registered.
|
||||
* @param timeout The timeout period in milliseconds.
|
||||
* @param callbackId out param, corresponding to a registered callback.
|
||||
* @return 0 - Success.
|
||||
* 201 - Permission denied.
|
||||
* 401 - Parameter error.
|
||||
* 2100002 - Failed to connect to the service.
|
||||
* 2100003 - System internal error.
|
||||
* 2101008 - The callback already exists.
|
||||
* 2101022 - The number of requests exceeded the maximum allowed.
|
||||
* @permission ohos.permission.GET_NETWORK_INFO
|
||||
* @syscap SystemCapability.Communication.NetManager.Core
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NetConn_RegisterNetConnCallback(NetConn_NetSpecifier *specifier, NetConn_NetConnCallback *netConnCallback,
|
||||
uint32_t timeout, uint32_t *callbackId);
|
||||
|
||||
/**
|
||||
* @brief Registers a callback to listen default network's status changed.
|
||||
*
|
||||
* @param callback The callback needed to be registered.
|
||||
* @param callbackId out param, corresponding to a registered callback.
|
||||
* @return 0 - Success.
|
||||
* 201 - Permission denied.
|
||||
* 401 - Parameter error.
|
||||
* 2100002 - Failed to connect to the service.
|
||||
* 2100003 - System internal error.
|
||||
* 2101008 - The callback already exists.
|
||||
* 2101022 - The number of requests exceeded the maximum allowed.
|
||||
* @permission ohos.permission.GET_NETWORK_INFO
|
||||
* @syscap SystemCapability.Communication.NetManager.Core
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NetConn_RegisterDefaultNetConnCallback(NetConn_NetConnCallback *netConnCallback, uint32_t *callbackId);
|
||||
|
||||
/**
|
||||
* @brief Unregisters network status callback.
|
||||
*
|
||||
* @param callBackId the id corresponding to a registered callback.
|
||||
* @return 0 - Success.
|
||||
* 201 - Permission denied.
|
||||
* 401 - Parameter error.
|
||||
* 2100002 - Failed to connect to the service.
|
||||
* 2100003 - System internal error.
|
||||
* 2101007 - The callback does not exists.
|
||||
* @permission ohos.permission.GET_NETWORK_INFO
|
||||
* @syscap SystemCapability.Communication.NetManager.Core
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
int32_t OH_NetConn_UnregisterNetConnCallback(uint32_t callBackId);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -248,6 +248,114 @@ typedef struct NetConn_NetHandleList {
|
||||
*/
|
||||
typedef int (*OH_NetConn_CustomDnsResolver)(const char *host, const char *serv,
|
||||
const struct addrinfo *hint, struct addrinfo **res);
|
||||
|
||||
/**
|
||||
* @brief Callback for application’s http proxy information changed.
|
||||
*
|
||||
* @param proxy The changed proxy information, may be a null pointer.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_AppHttpProxyChange)(NetConn_HttpProxy *proxy);
|
||||
|
||||
/**
|
||||
* @brief Definition of network specifier.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef struct NetConn_NetSpecifier {
|
||||
/** Network capabilities. */
|
||||
NetConn_NetCapabilities caps;
|
||||
/** Network identifier */
|
||||
char *bearerPrivateIdentifier;
|
||||
} NetConn_NetSpecifier;
|
||||
|
||||
/**
|
||||
* @brief Callback for network available.
|
||||
*
|
||||
* @param netHandle The network handle.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_NetworkAvailable)(NetConn_NetHandle *netHandle);
|
||||
|
||||
/**
|
||||
* @brief Callback for network capabilities changed.
|
||||
*
|
||||
* @param netHandle The network handle.
|
||||
* @param netCapabilities The network capabilities.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_NetCapabilitiesChange)(NetConn_NetHandle *netHandle,
|
||||
NetConn_NetCapabilities *netCapabilities);
|
||||
|
||||
/**
|
||||
* @brief Callback for network connection properties changed.
|
||||
*
|
||||
* @param netHandle The network handle.
|
||||
* @param connConnetionProperties The network connection properties.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_NetConnectionPropertiesChange)(NetConn_NetHandle *netHandle,
|
||||
NetConn_ConnectionProperties *connConnetionProperties);
|
||||
|
||||
/**
|
||||
* @brief Callback for network lost.
|
||||
*
|
||||
* @param netHandle The network handle.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_NetLost)(NetConn_NetHandle *netHandle);
|
||||
|
||||
/**
|
||||
* @brief Callback for network unavailable, this function invoked while network can not be available in given timeout.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_NetUnavailable)(void);
|
||||
|
||||
/**
|
||||
* @brief Callback for network blocked status changed.
|
||||
*
|
||||
* @param netHandle The network handle.
|
||||
* @param blocked The flag used to indicate whether the network will be blocked.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef void (*OH_NetConn_NetBlockStatusChange)(NetConn_NetHandle *netHandle, bool blocked);
|
||||
|
||||
/**
|
||||
* @brief Defines the network connection callbacks.
|
||||
*
|
||||
* @since 12
|
||||
* @version 1.0
|
||||
*/
|
||||
typedef struct NetConn_NetConnCallback {
|
||||
/** Callback for network available */
|
||||
OH_NetConn_NetworkAvailable onNetworkAvailable;
|
||||
/** Callback for network capabilities changed */
|
||||
OH_NetConn_NetCapabilitiesChange onNetCapabilitiesChange;
|
||||
/** Callback for network connection properties changed */
|
||||
OH_NetConn_NetConnectionPropertiesChange onConnetionProperties;
|
||||
/** Callback for network lost */
|
||||
OH_NetConn_NetLost onNetLost;
|
||||
/** Callback for network unavailable, this function invoked while network can not be available in given timeout */
|
||||
OH_NetConn_NetUnavailable onNetUnavailable;
|
||||
/** Callback for network blocked status changed */
|
||||
OH_NetConn_NetBlockStatusChange onNetBlockStatusChange;
|
||||
} NetConn_NetConnCallback;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -46,5 +46,29 @@
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_BindSocket"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_SetAppHttpProxy"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_RegisterAppHttpProxyCallback"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_UnregisterAppHttpProxyCallback"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_RegisterNetConnCallback"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_RegisterDefaultNetConnCallback"
|
||||
},
|
||||
{
|
||||
"first_introduced": "12",
|
||||
"name": "OH_NetConn_UnregisterNetConnCallback"
|
||||
}
|
||||
]
|
||||
]
|
Loading…
Reference in New Issue
Block a user