ohos-netstack-sys 0.1.0

Raw bindings to the OpenHarmony NetworkKit (netstack) native APIs
Documentation
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
use crate::net_http_type::*;

extern "C" {
    /// Creates headers for a request or response.
    ///
    ///
    /// # Returns
    ///
    /// * Http_Headers* Pointer to [`Http_Headers`].
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_CreateHeaders() -> *mut Http_Headers;
    /// Destroys the headers of a request or response.
    ///
    /// # Arguments
    ///
    /// * `headers` - Pointer to the [`Http_Headers`] to be destroyed, headers ends with null.
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_DestroyHeaders(headers: *mut *mut Http_Headers);
    /// Sets the key-value pair of the request or response header.
    ///
    /// # Arguments
    ///
    /// * `headers` - Pointer to the [`Http_Headers`] to be set.
    ///
    /// * `name` - Key.
    ///
    /// * `value` - Value.
    ///
    /// # Returns
    ///
    /// * uint32_t 0 - success. 401 - Parameter error. 2300027 - Out of memory.
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_SetHeaderValue(
        headers: *mut Http_Headers,
        name: *const ::core::ffi::c_char,
        value: *const ::core::ffi::c_char,
    ) -> u32;
    /// Obtains the value of a request or response header by key.
    ///
    /// # Arguments
    ///
    /// * `headers` - Pointer to [`Http_Headers`].
    ///
    /// * `name` - Key.
    ///
    /// # Returns
    ///
    /// * Http_HeaderValue* Pointer to the obtained [`Http_HeaderValue`].
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_GetHeaderValue(
        headers: *mut Http_Headers,
        name: *const ::core::ffi::c_char,
    ) -> *mut Http_HeaderValue;
    /// Obtains all the key-value pairs of a request or response header.
    ///
    /// # Arguments
    ///
    /// * `headers` - Pointer to [`Http_Headersaders`].
    ///
    /// # Returns
    ///
    /// * Http_HeaderEntry* Pointers to all obtained key-value pairs [`Http_HeaderEntry`].
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_GetHeaderEntries(headers: *mut Http_Headers) -> *mut Http_HeaderEntry;
    /// Destroys all key-value pairs obtained in [`OH_Http_GetHeaderEntries`].
    ///
    /// # Arguments
    ///
    /// * `headerEntry` - Pointer to the [`Http_HeaderEntry`] to be destroyed, headerEntry ends with null.
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_DestroyHeaderEntries(headerEntry: *mut *mut Http_HeaderEntry);
    /// Create a http request.
    ///
    /// # Arguments
    ///
    /// * `url` - Http request url.
    ///
    /// # Returns
    ///
    /// * Pointer of HttpRequest if success; Null otherwise.
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_CreateRequest(url: *const ::core::ffi::c_char) -> *mut Http_Request;
    /// Initiates an HTTP request.
    ///
    /// # Arguments
    ///
    /// * `request` - Pointer to [`Http_Request`].
    ///
    /// * `callback` - Http response info, pointer to [`Http_ResponseCallback`]
    ///
    /// * `handler` - Callbacks to watch different events, pointer to [`Http_EventsHandler`].
    ///
    /// # Returns
    ///
    /// * 0 if success; non-0 otherwise. For details about error codes, see [`Http_ErrCode`].
    /// ohos.permission.INTERNET
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_Request(
        request: *mut Http_Request,
        callback: Http_ResponseCallback,
        handler: Http_EventsHandler,
    ) -> ::core::ffi::c_int;
    /// Destroy the HTTP request.
    ///
    /// # Arguments
    ///
    /// * `request` - Pointer to the http request [`Http_Request`].
    ///
    /// Required System Capabilities: SystemCapability.Communication.NetStack
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_Http_Destroy(request: *mut *mut Http_Request);
}