17777dab0Sopenharmony_ci/*
27777dab0Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
37777dab0Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
47777dab0Sopenharmony_ci * you may not use this file except in compliance with the License.
57777dab0Sopenharmony_ci * You may obtain a copy of the License at
67777dab0Sopenharmony_ci *
77777dab0Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
87777dab0Sopenharmony_ci *
97777dab0Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
107777dab0Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
117777dab0Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
127777dab0Sopenharmony_ci * See the License for the specific language governing permissions and
137777dab0Sopenharmony_ci * limitations under the License.
147777dab0Sopenharmony_ci */
157777dab0Sopenharmony_ci
167777dab0Sopenharmony_ci/**
177777dab0Sopenharmony_ci * @addtogroup Web
187777dab0Sopenharmony_ci * @{
197777dab0Sopenharmony_ci *
207777dab0Sopenharmony_ci * @brief Provides APIs to intercept the request from ArkWeb.
217777dab0Sopenharmony_ci * @since 12
227777dab0Sopenharmony_ci */
237777dab0Sopenharmony_ci/**
247777dab0Sopenharmony_ci * @file arkweb_scheme_handler.h
257777dab0Sopenharmony_ci *
267777dab0Sopenharmony_ci * @brief Declares the APIs to intercept the request from ArkWeb.
277777dab0Sopenharmony_ci * @kit ArkWeb
287777dab0Sopenharmony_ci * @library libohweb.so
297777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
307777dab0Sopenharmony_ci * @since 12
317777dab0Sopenharmony_ci */
327777dab0Sopenharmony_ci#ifndef ARKWEB_SCHEME_HANDLER_H
337777dab0Sopenharmony_ci#define ARKWEB_SCHEME_HANDLER_H
347777dab0Sopenharmony_ci
357777dab0Sopenharmony_ci#include <stdbool.h>
367777dab0Sopenharmony_ci#include "stdint.h"
377777dab0Sopenharmony_ci
387777dab0Sopenharmony_ci#include "arkweb_error_code.h"
397777dab0Sopenharmony_ci#include "arkweb_net_error_list.h"
407777dab0Sopenharmony_ci
417777dab0Sopenharmony_ci#ifdef __cplusplus
427777dab0Sopenharmony_ciextern "C" {
437777dab0Sopenharmony_ci#endif
447777dab0Sopenharmony_ci
457777dab0Sopenharmony_ci/**
467777dab0Sopenharmony_ci * @brief Configuration information for custom schemes.
477777dab0Sopenharmony_ci *
487777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
497777dab0Sopenharmony_ci * @since 12
507777dab0Sopenharmony_ci */
517777dab0Sopenharmony_citypedef enum ArkWeb_CustomSchemeOption {
527777dab0Sopenharmony_ci    OH_ARKWEB_SCHEME_OPTION_NONE = 0,
537777dab0Sopenharmony_ci
547777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_STANDARD is set, the scheme will be handled as a standard scheme. The standard
557777dab0Sopenharmony_ci     *  schemes need to comply with the URL normalization and parsing rules defined in Section 3.1 of RFC 1738,
567777dab0Sopenharmony_ci     *  which can be found in the http://www.ietf.org/rfc/rfc1738.txt.
577777dab0Sopenharmony_ci     */
587777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_STANDARD = 1 << 0,
597777dab0Sopenharmony_ci
607777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_LOCAL is set, the same security rules as those applied to the "file" URL will be
617777dab0Sopenharmony_ci     *  used to handle the scheme.
627777dab0Sopenharmony_ci     */
637777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_LOCAL = 1 << 1,
647777dab0Sopenharmony_ci
657777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED is set, then the scheme can only be displayed from other content
667777dab0Sopenharmony_ci     *  hosted using the same scheme.
677777dab0Sopenharmony_ci     */
687777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_DISPLAY_ISOLATED = 1 << 2,
697777dab0Sopenharmony_ci
707777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_SECURE is set, the same security rules as those applied to the "https" URL will be
717777dab0Sopenharmony_ci     *  used to handle the scheme.
727777dab0Sopenharmony_ci     */
737777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_SECURE = 1 << 3,
747777dab0Sopenharmony_ci
757777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_CORS_ENABLED is set, then the scheme can be sent CORS requests. In most cases this
767777dab0Sopenharmony_ci     *  value should be set when ARKWEB_SCHEME_OPTION_STANDARD is set.
777777dab0Sopenharmony_ci     */
787777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_CORS_ENABLED = 1 << 4,
797777dab0Sopenharmony_ci
807777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_CSP_BYPASSING is set, then this scheme can bypass Content Security Policy (CSP)
817777dab0Sopenharmony_ci     *  checks. In most cases, this value should not be set when ARKWEB_SCHEME_OPTION_STANDARD is set.
827777dab0Sopenharmony_ci     */
837777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_CSP_BYPASSING = 1 << 5,
847777dab0Sopenharmony_ci
857777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_FETCH_ENABLED is set, then this scheme can perform FETCH API requests. */
867777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_FETCH_ENABLED = 1 << 6,
877777dab0Sopenharmony_ci
887777dab0Sopenharmony_ci    /** If ARKWEB_SCHEME_OPTION_CODE_CACHE_ENABLED is set, then the js of this scheme can generate code cache. */
897777dab0Sopenharmony_ci    ARKWEB_SCHEME_OPTION_CODE_CACHE_ENABLED = 1 << 7,
907777dab0Sopenharmony_ci} ArkWeb_CustomSchemeOption;
917777dab0Sopenharmony_ci
927777dab0Sopenharmony_ci/**
937777dab0Sopenharmony_ci * @brief Resource type for a request.
947777dab0Sopenharmony_ci *
957777dab0Sopenharmony_ci * These constants match their equivalents in Chromium's ResourceType and should not be renumbered.\n
967777dab0Sopenharmony_ci *
977777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
987777dab0Sopenharmony_ci * @since 12
997777dab0Sopenharmony_ci */
1007777dab0Sopenharmony_citypedef enum ArkWeb_ResourceType {
1017777dab0Sopenharmony_ci    /** Top level page. */
1027777dab0Sopenharmony_ci    MAIN_FRAME = 0,
1037777dab0Sopenharmony_ci
1047777dab0Sopenharmony_ci    /** Frame or Iframe. */
1057777dab0Sopenharmony_ci    SUB_FRAME = 1,
1067777dab0Sopenharmony_ci
1077777dab0Sopenharmony_ci    /** CSS stylesheet. */
1087777dab0Sopenharmony_ci    STYLE_SHEET = 2,
1097777dab0Sopenharmony_ci
1107777dab0Sopenharmony_ci    /** External script. */
1117777dab0Sopenharmony_ci    SCRIPT = 3,
1127777dab0Sopenharmony_ci
1137777dab0Sopenharmony_ci    /** Image(jpg/gif/png/etc). */
1147777dab0Sopenharmony_ci    IMAGE = 4,
1157777dab0Sopenharmony_ci
1167777dab0Sopenharmony_ci    /** Font. */
1177777dab0Sopenharmony_ci    FONT_RESOURCE = 5,
1187777dab0Sopenharmony_ci
1197777dab0Sopenharmony_ci    /** Some other subresource. This is the default type if the actual type is unknown. */
1207777dab0Sopenharmony_ci    SUB_RESOURCE = 6,
1217777dab0Sopenharmony_ci
1227777dab0Sopenharmony_ci    /** Object (or embed) tag for a plugin, or a resource that a plugin requested. */
1237777dab0Sopenharmony_ci    OBJECT = 7,
1247777dab0Sopenharmony_ci
1257777dab0Sopenharmony_ci    /** Media resource. */
1267777dab0Sopenharmony_ci    MEDIA = 8,
1277777dab0Sopenharmony_ci
1287777dab0Sopenharmony_ci    /** Main resource of a dedicated worker. */
1297777dab0Sopenharmony_ci    WORKER = 9,
1307777dab0Sopenharmony_ci
1317777dab0Sopenharmony_ci    /** Main resource of a shared worker. */
1327777dab0Sopenharmony_ci    SHARED_WORKER = 10,
1337777dab0Sopenharmony_ci
1347777dab0Sopenharmony_ci    /** Explicitly requested prefetch. */
1357777dab0Sopenharmony_ci    PREFETCH = 11,
1367777dab0Sopenharmony_ci
1377777dab0Sopenharmony_ci    /** Favicon. */
1387777dab0Sopenharmony_ci    FAVICON = 12,
1397777dab0Sopenharmony_ci
1407777dab0Sopenharmony_ci    /** XMLHttpRequest. */
1417777dab0Sopenharmony_ci    XHR = 13,
1427777dab0Sopenharmony_ci
1437777dab0Sopenharmony_ci    /** Ping request for <a ping>/sendBeacon. */
1447777dab0Sopenharmony_ci    PING = 14,
1457777dab0Sopenharmony_ci
1467777dab0Sopenharmony_ci    /** The main resource of a service worker. */
1477777dab0Sopenharmony_ci    SERVICE_WORKER = 15,
1487777dab0Sopenharmony_ci
1497777dab0Sopenharmony_ci    /** Report of Content Security Policy violations. */
1507777dab0Sopenharmony_ci    CSP_REPORT = 16,
1517777dab0Sopenharmony_ci
1527777dab0Sopenharmony_ci    /** Resource that a plugin requested. */
1537777dab0Sopenharmony_ci    PLUGIN_RESOURCE = 17,
1547777dab0Sopenharmony_ci
1557777dab0Sopenharmony_ci    /** A main-frame service worker navigation preload request. */
1567777dab0Sopenharmony_ci    NAVIGATION_PRELOAD_MAIN_FRAME = 19,
1577777dab0Sopenharmony_ci
1587777dab0Sopenharmony_ci    /** A sub-frame service worker navigation preload request. */
1597777dab0Sopenharmony_ci    NAVIGATION_PRELOAD_SUB_FRAME = 20,
1607777dab0Sopenharmony_ci} ArkWeb_ResourceType;
1617777dab0Sopenharmony_ci
1627777dab0Sopenharmony_ci/**
1637777dab0Sopenharmony_ci * @brief This class is used to intercept requests for a specified scheme.
1647777dab0Sopenharmony_ci *
1657777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
1667777dab0Sopenharmony_ci * @since 12
1677777dab0Sopenharmony_ci */
1687777dab0Sopenharmony_citypedef struct ArkWeb_SchemeHandler_ ArkWeb_SchemeHandler;
1697777dab0Sopenharmony_ci
1707777dab0Sopenharmony_ci/**
1717777dab0Sopenharmony_ci * @brief Used to intercept url requests.
1727777dab0Sopenharmony_ci *
1737777dab0Sopenharmony_ci * Response headers and body can be sent through ArkWeb_ResourceHandler.\n
1747777dab0Sopenharmony_ci *
1757777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
1767777dab0Sopenharmony_ci * @since 12
1777777dab0Sopenharmony_ci */
1787777dab0Sopenharmony_citypedef struct ArkWeb_ResourceHandler_ ArkWeb_ResourceHandler;
1797777dab0Sopenharmony_ci
1807777dab0Sopenharmony_ci/**
1817777dab0Sopenharmony_ci * @brief The response of the intercepted request.
1827777dab0Sopenharmony_ci *
1837777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
1847777dab0Sopenharmony_ci * @since 12
1857777dab0Sopenharmony_ci */
1867777dab0Sopenharmony_citypedef struct ArkWeb_Response_ ArkWeb_Response;
1877777dab0Sopenharmony_ci
1887777dab0Sopenharmony_ci/**
1897777dab0Sopenharmony_ci * @brief The info of the request.
1907777dab0Sopenharmony_ci *
1917777dab0Sopenharmony_ci * You can obtain the requested URL, method, post data, and other information through OH_ArkWeb_ResourceRequest.\n
1927777dab0Sopenharmony_ci *
1937777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
1947777dab0Sopenharmony_ci * @since 12
1957777dab0Sopenharmony_ci */
1967777dab0Sopenharmony_citypedef struct ArkWeb_ResourceRequest_ ArkWeb_ResourceRequest;
1977777dab0Sopenharmony_ci
1987777dab0Sopenharmony_ci/**
1997777dab0Sopenharmony_ci * @brief The request headers of the request.
2007777dab0Sopenharmony_ci *
2017777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2027777dab0Sopenharmony_ci * @since 12
2037777dab0Sopenharmony_ci */
2047777dab0Sopenharmony_citypedef struct ArkWeb_RequestHeaderList_ ArkWeb_RequestHeaderList;
2057777dab0Sopenharmony_ci
2067777dab0Sopenharmony_ci/**
2077777dab0Sopenharmony_ci * @brief The http body of the request.
2087777dab0Sopenharmony_ci *
2097777dab0Sopenharmony_ci * Use OH_ArkWebHttpBodyStream_* interface to read the body.\n
2107777dab0Sopenharmony_ci *
2117777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2127777dab0Sopenharmony_ci * @since 12
2137777dab0Sopenharmony_ci */
2147777dab0Sopenharmony_citypedef struct ArkWeb_HttpBodyStream_ ArkWeb_HttpBodyStream;
2157777dab0Sopenharmony_ci
2167777dab0Sopenharmony_ci
2177777dab0Sopenharmony_ci/**
2187777dab0Sopenharmony_ci * @brief Callback for handling the request.
2197777dab0Sopenharmony_ci *
2207777dab0Sopenharmony_ci * This will be called on the IO thread.\n
2217777dab0Sopenharmony_ci *
2227777dab0Sopenharmony_ci * @param schemeHandler The ArkWeb_SchemeHandler.
2237777dab0Sopenharmony_ci * @param resourceRequest Obtain request's information through this.
2247777dab0Sopenharmony_ci * @param resourceHandler The ArkWeb_ResourceHandler for the request. It should not be used if intercept is set to
2257777dab0Sopenharmony_ci *                        false.
2267777dab0Sopenharmony_ci * @param intercept If true will intercept the request, if false otherwise.
2277777dab0Sopenharmony_ci *
2287777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2297777dab0Sopenharmony_ci * @since 12
2307777dab0Sopenharmony_ci */
2317777dab0Sopenharmony_citypedef void (*ArkWeb_OnRequestStart)(const ArkWeb_SchemeHandler* schemeHandler,
2327777dab0Sopenharmony_ci                                      ArkWeb_ResourceRequest* resourceRequest,
2337777dab0Sopenharmony_ci                                      const ArkWeb_ResourceHandler* resourceHandler,
2347777dab0Sopenharmony_ci                                      bool* intercept);
2357777dab0Sopenharmony_ci
2367777dab0Sopenharmony_ci/**
2377777dab0Sopenharmony_ci * @brief Callback when the request is completed.
2387777dab0Sopenharmony_ci *
2397777dab0Sopenharmony_ci * This will be called on the IO thread.\n
2407777dab0Sopenharmony_ci * Should destory the resourceRequest by ArkWeb_ResourceRequest_Destroy and use ArkWeb_ResourceHandler_Destroy\n
2417777dab0Sopenharmony_ci * destroy the ArkWeb_ResourceHandler received in ArkWeb_OnRequestStart.\n
2427777dab0Sopenharmony_ci *
2437777dab0Sopenharmony_ci * @param schemeHandler The ArkWeb_SchemeHandler.
2447777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
2457777dab0Sopenharmony_ci *
2467777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2477777dab0Sopenharmony_ci * @since 12
2487777dab0Sopenharmony_ci */
2497777dab0Sopenharmony_citypedef void (*ArkWeb_OnRequestStop)(const ArkWeb_SchemeHandler* schemeHandler,
2507777dab0Sopenharmony_ci                                     const ArkWeb_ResourceRequest* resourceRequest);
2517777dab0Sopenharmony_ci
2527777dab0Sopenharmony_ci/**
2537777dab0Sopenharmony_ci * @brief Callback when the read operation done.
2547777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
2557777dab0Sopenharmony_ci * @param buffer The buffer to receive data.
2567777dab0Sopenharmony_ci * @param bytesRead Callback after OH_ArkWebHttpBodyStream_Read. bytesRead greater than 0 means that the buffer is
2577777dab0Sopenharmony_ci *                  filled with data of bytesRead size. Caller can read from the buffer, and if
2587777dab0Sopenharmony_ci *                  OH_ArkWebHttpBodyStream_IsEOF is false, caller can continue to read the remaining data.
2597777dab0Sopenharmony_ci *
2607777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2617777dab0Sopenharmony_ci * @since 12
2627777dab0Sopenharmony_ci */
2637777dab0Sopenharmony_citypedef void (*ArkWeb_HttpBodyStreamReadCallback)(const ArkWeb_HttpBodyStream* httpBodyStream,
2647777dab0Sopenharmony_ci                                                  uint8_t* buffer,
2657777dab0Sopenharmony_ci                                                  int bytesRead);
2667777dab0Sopenharmony_ci
2677777dab0Sopenharmony_ci/**
2687777dab0Sopenharmony_ci * @brief  Callback when the init operation done.
2697777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
2707777dab0Sopenharmony_ci * @param result {@link ARKWEB_NET_OK} on success otherwise refer to arkweb_net_error_list.h.
2717777dab0Sopenharmony_ci *
2727777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2737777dab0Sopenharmony_ci * @since 12
2747777dab0Sopenharmony_ci */
2757777dab0Sopenharmony_citypedef void (*ArkWeb_HttpBodyStreamInitCallback)(const ArkWeb_HttpBodyStream* httpBodyStream, ArkWeb_NetError result);
2767777dab0Sopenharmony_ci
2777777dab0Sopenharmony_ci/**
2787777dab0Sopenharmony_ci * @brief Destroy the ArkWeb_RequestHeaderList.
2797777dab0Sopenharmony_ci * @param requestHeaderList The ArkWeb_RequestHeaderList to be destroyed.
2807777dab0Sopenharmony_ci *
2817777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2827777dab0Sopenharmony_ci * @since 12
2837777dab0Sopenharmony_ci */
2847777dab0Sopenharmony_civoid OH_ArkWebRequestHeaderList_Destroy(ArkWeb_RequestHeaderList* requestHeaderList);
2857777dab0Sopenharmony_ci
2867777dab0Sopenharmony_ci/**
2877777dab0Sopenharmony_ci * @brief Get the request headers size.
2887777dab0Sopenharmony_ci * @param requestHeaderList The list of request header.
2897777dab0Sopenharmony_ci * @return The size of request headers. -1 if requestHeaderList is invalid.
2907777dab0Sopenharmony_ci *
2917777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
2927777dab0Sopenharmony_ci * @since 12
2937777dab0Sopenharmony_ci */
2947777dab0Sopenharmony_ciint32_t OH_ArkWebRequestHeaderList_GetSize(const ArkWeb_RequestHeaderList* requestHeaderList);
2957777dab0Sopenharmony_ci
2967777dab0Sopenharmony_ci/**
2977777dab0Sopenharmony_ci * @brief Get the specified request header.
2987777dab0Sopenharmony_ci * @param requestHeaderList The list of request header.
2997777dab0Sopenharmony_ci * @param index The index of request header.
3007777dab0Sopenharmony_ci * @param key The header key. Caller must release the string by OH_ArkWeb_ReleaseString.
3017777dab0Sopenharmony_ci * @param value The header value. Caller must release the string by OH_ArkWeb_ReleaseString.
3027777dab0Sopenharmony_ci *
3037777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3047777dab0Sopenharmony_ci * @since 12
3057777dab0Sopenharmony_ci */
3067777dab0Sopenharmony_civoid OH_ArkWebRequestHeaderList_GetHeader(const ArkWeb_RequestHeaderList* requestHeaderList,
3077777dab0Sopenharmony_ci                                          int32_t index,
3087777dab0Sopenharmony_ci                                          char** key,
3097777dab0Sopenharmony_ci                                          char** value);
3107777dab0Sopenharmony_ci
3117777dab0Sopenharmony_ci/**
3127777dab0Sopenharmony_ci * @brief Set a user data to ArkWeb_ResourceRequest.
3137777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3147777dab0Sopenharmony_ci * @param userData The user data to set.
3157777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
3167777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
3177777dab0Sopenharmony_ci *
3187777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3197777dab0Sopenharmony_ci * @since 12
3207777dab0Sopenharmony_ci */
3217777dab0Sopenharmony_ciint32_t OH_ArkWebResourceRequest_SetUserData(ArkWeb_ResourceRequest* resourceRequest, void* userData);
3227777dab0Sopenharmony_ci
3237777dab0Sopenharmony_ci/**
3247777dab0Sopenharmony_ci * @brief Get the user data from ArkWeb_ResourceRequest.
3257777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3267777dab0Sopenharmony_ci * @return The set user data.
3277777dab0Sopenharmony_ci *
3287777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3297777dab0Sopenharmony_ci * @since 12
3307777dab0Sopenharmony_ci */
3317777dab0Sopenharmony_civoid* OH_ArkWebResourceRequest_GetUserData(const ArkWeb_ResourceRequest* resourceRequest);
3327777dab0Sopenharmony_ci
3337777dab0Sopenharmony_ci/**
3347777dab0Sopenharmony_ci * @brief Get the method of request.
3357777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3367777dab0Sopenharmony_ci * @param method The request's http method. This function will allocate memory for the method string and caller must
3377777dab0Sopenharmony_ci *               release the string by OH_ArkWeb_ReleaseString.
3387777dab0Sopenharmony_ci *
3397777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3407777dab0Sopenharmony_ci * @since 12
3417777dab0Sopenharmony_ci */
3427777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_GetMethod(const ArkWeb_ResourceRequest* resourceRequest, char** method);
3437777dab0Sopenharmony_ci
3447777dab0Sopenharmony_ci/**
3457777dab0Sopenharmony_ci * @brief Get the url of request.
3467777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3477777dab0Sopenharmony_ci * @param url The request's url. This function will allocate memory for the url string and caller must release the
3487777dab0Sopenharmony_ci *            string by OH_ArkWeb_ReleaseString.
3497777dab0Sopenharmony_ci *
3507777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3517777dab0Sopenharmony_ci * @since 12
3527777dab0Sopenharmony_ci */
3537777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_GetUrl(const ArkWeb_ResourceRequest* resourceRequest, char** url);
3547777dab0Sopenharmony_ci
3557777dab0Sopenharmony_ci/**
3567777dab0Sopenharmony_ci * @brief Create a ArkWeb_HttpBodyStream which used to read the http body.
3577777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3587777dab0Sopenharmony_ci * @param httpBodyStream The request's http body. This function will allocate memory for the http body stream and
3597777dab0Sopenharmony_ci *                       caller must release the httpBodyStream by OH_ArkWebResourceRequest_DestroyHttpBodyStream.
3607777dab0Sopenharmony_ci *
3617777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3627777dab0Sopenharmony_ci * @since 12
3637777dab0Sopenharmony_ci */
3647777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_GetHttpBodyStream(const ArkWeb_ResourceRequest* resourceRequest,
3657777dab0Sopenharmony_ci                                                ArkWeb_HttpBodyStream** httpBodyStream);
3667777dab0Sopenharmony_ci
3677777dab0Sopenharmony_ci/**
3687777dab0Sopenharmony_ci * @brief Destroy the http body stream.
3697777dab0Sopenharmony_ci * @param httpBodyStream The httpBodyStream to be destroyed.
3707777dab0Sopenharmony_ci *
3717777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3727777dab0Sopenharmony_ci * @since 12
3737777dab0Sopenharmony_ci */
3747777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_DestroyHttpBodyStream(ArkWeb_HttpBodyStream* httpBodyStream);
3757777dab0Sopenharmony_ci
3767777dab0Sopenharmony_ci/**
3777777dab0Sopenharmony_ci * @brief Get the resource type of request.
3787777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3797777dab0Sopenharmony_ci * @return The resource type of request. -1 if resourceRequest is invalid.
3807777dab0Sopenharmony_ci *
3817777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3827777dab0Sopenharmony_ci * @since 12
3837777dab0Sopenharmony_ci */
3847777dab0Sopenharmony_ciint32_t OH_ArkWebResourceRequest_GetResourceType(const ArkWeb_ResourceRequest* resourceRequest);
3857777dab0Sopenharmony_ci
3867777dab0Sopenharmony_ci/**
3877777dab0Sopenharmony_ci * @brief Get the url of frame which trigger this request.
3887777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
3897777dab0Sopenharmony_ci * @param frameUrl The url of frame which trigger this request. This function will allocate memory for the url string
3907777dab0Sopenharmony_ci *            and caller must release the string by OH_ArkWeb_ReleaseString.
3917777dab0Sopenharmony_ci *
3927777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
3937777dab0Sopenharmony_ci * @since 12
3947777dab0Sopenharmony_ci */
3957777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_GetFrameUrl(const ArkWeb_ResourceRequest* resourceRequest, char** frameUrl);
3967777dab0Sopenharmony_ci
3977777dab0Sopenharmony_ci/**
3987777dab0Sopenharmony_ci * @brief Set a user data to ArkWeb_HttpBodyStream.
3997777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4007777dab0Sopenharmony_ci * @param userData The user data to set.
4017777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
4027777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
4037777dab0Sopenharmony_ci *
4047777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4057777dab0Sopenharmony_ci * @since 12
4067777dab0Sopenharmony_ci */
4077777dab0Sopenharmony_ciint32_t OH_ArkWebHttpBodyStream_SetUserData(ArkWeb_HttpBodyStream* httpBodyStream, void* userData);
4087777dab0Sopenharmony_ci
4097777dab0Sopenharmony_ci/**
4107777dab0Sopenharmony_ci * @brief Get the user data from ArkWeb_HttpBodyStream.
4117777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4127777dab0Sopenharmony_ci * @return The set user data.
4137777dab0Sopenharmony_ci *
4147777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4157777dab0Sopenharmony_ci * @since 12
4167777dab0Sopenharmony_ci */
4177777dab0Sopenharmony_civoid* OH_ArkWebHttpBodyStream_GetUserData(const ArkWeb_HttpBodyStream* httpBodyStream);
4187777dab0Sopenharmony_ci
4197777dab0Sopenharmony_ci/**
4207777dab0Sopenharmony_ci * @brief Set the callback for OH_ArkWebHttpBodyStream_Read.
4217777dab0Sopenharmony_ci *
4227777dab0Sopenharmony_ci * The result of OH_ArkWebHttpBodyStream_Read will be notified to caller through the readCallback.\n
4237777dab0Sopenharmony_ci * The callback will run in the same thread as OH_ArkWebHttpBodyStream_Read.\n
4247777dab0Sopenharmony_ci *
4257777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4267777dab0Sopenharmony_ci * @param readCallback The callback of read function.
4277777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
4287777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
4297777dab0Sopenharmony_ci *
4307777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4317777dab0Sopenharmony_ci * @since 12
4327777dab0Sopenharmony_ci */
4337777dab0Sopenharmony_ciint32_t OH_ArkWebHttpBodyStream_SetReadCallback(ArkWeb_HttpBodyStream* httpBodyStream,
4347777dab0Sopenharmony_ci                                                ArkWeb_HttpBodyStreamReadCallback readCallback);
4357777dab0Sopenharmony_ci
4367777dab0Sopenharmony_ci/**
4377777dab0Sopenharmony_ci * @brief Init the http body stream.
4387777dab0Sopenharmony_ci *
4397777dab0Sopenharmony_ci * This function must be called before calling any other functions.\n
4407777dab0Sopenharmony_ci *
4417777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4427777dab0Sopenharmony_ci * @param initCallback The callback of init.
4437777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
4447777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
4457777dab0Sopenharmony_ci *
4467777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4477777dab0Sopenharmony_ci * @since 12
4487777dab0Sopenharmony_ci */
4497777dab0Sopenharmony_ciint32_t OH_ArkWebHttpBodyStream_Init(ArkWeb_HttpBodyStream* httpBodyStream,
4507777dab0Sopenharmony_ci                                     ArkWeb_HttpBodyStreamInitCallback initCallback);
4517777dab0Sopenharmony_ci
4527777dab0Sopenharmony_ci/**
4537777dab0Sopenharmony_ci * @brief Read the http body to the buffer.
4547777dab0Sopenharmony_ci *
4557777dab0Sopenharmony_ci * The buffer must be larger than the bufLen. We will be reading data from a worker thread to the buffer,\n
4567777dab0Sopenharmony_ci * so should not use the buffer in other threads before the callback to avoid concurrency issues.\n
4577777dab0Sopenharmony_ci *
4587777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4597777dab0Sopenharmony_ci * @param buffer The buffer to receive data.
4607777dab0Sopenharmony_ci * @param bufLen The size of bytes to read.
4617777dab0Sopenharmony_ci *
4627777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4637777dab0Sopenharmony_ci * @since 12
4647777dab0Sopenharmony_ci */
4657777dab0Sopenharmony_civoid OH_ArkWebHttpBodyStream_Read(const ArkWeb_HttpBodyStream* httpBodyStream, uint8_t* buffer, int bufLen);
4667777dab0Sopenharmony_ci
4677777dab0Sopenharmony_ci/**
4687777dab0Sopenharmony_ci * @brief Get the total size of the data stream.
4697777dab0Sopenharmony_ci *
4707777dab0Sopenharmony_ci * When data is chunked or httpBodyStream is invalid, always return zero.\n
4717777dab0Sopenharmony_ci *
4727777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4737777dab0Sopenharmony_ci * @return The size of data stream.
4747777dab0Sopenharmony_ci *
4757777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4767777dab0Sopenharmony_ci * @since 12
4777777dab0Sopenharmony_ci */
4787777dab0Sopenharmony_ciuint64_t OH_ArkWebHttpBodyStream_GetSize(const ArkWeb_HttpBodyStream* httpBodyStream);
4797777dab0Sopenharmony_ci
4807777dab0Sopenharmony_ci/**
4817777dab0Sopenharmony_ci * @brief Get the current position of the data stream.
4827777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4837777dab0Sopenharmony_ci * @return The current position of data stream. 0 if httpBodyStream is invalid.
4847777dab0Sopenharmony_ci *
4857777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4867777dab0Sopenharmony_ci * @since 12
4877777dab0Sopenharmony_ci */
4887777dab0Sopenharmony_ciuint64_t OH_ArkWebHttpBodyStream_GetPosition(const ArkWeb_HttpBodyStream* httpBodyStream);
4897777dab0Sopenharmony_ci
4907777dab0Sopenharmony_ci/**
4917777dab0Sopenharmony_ci * @brief Get if the data stream is chunked.
4927777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
4937777dab0Sopenharmony_ci * @return True if is chunked; false otherwise.
4947777dab0Sopenharmony_ci *
4957777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
4967777dab0Sopenharmony_ci * @since 12
4977777dab0Sopenharmony_ci */
4987777dab0Sopenharmony_cibool OH_ArkWebHttpBodyStream_IsChunked(const ArkWeb_HttpBodyStream* httpBodyStream);
4997777dab0Sopenharmony_ci
5007777dab0Sopenharmony_ci
5017777dab0Sopenharmony_ci/**
5027777dab0Sopenharmony_ci * @brief Returns true if all data has been consumed from this upload data stream.
5037777dab0Sopenharmony_ci *
5047777dab0Sopenharmony_ci * For chunked uploads, returns false until the first read attempt.\n
5057777dab0Sopenharmony_ci *
5067777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
5077777dab0Sopenharmony_ci * @return True if all data has been consumed; false otherwise.
5087777dab0Sopenharmony_ci *
5097777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5107777dab0Sopenharmony_ci * @since 12
5117777dab0Sopenharmony_ci */
5127777dab0Sopenharmony_cibool OH_ArkWebHttpBodyStream_IsEof(const ArkWeb_HttpBodyStream* httpBodyStream);
5137777dab0Sopenharmony_ci
5147777dab0Sopenharmony_ci/**
5157777dab0Sopenharmony_ci * @brief Returns true if the upload data in the stream is entirely in memory,
5167777dab0Sopenharmony_ci *        and all read requests will succeed synchronously.
5177777dab0Sopenharmony_ci *
5187777dab0Sopenharmony_ci * Expected to return false for chunked requests.\n
5197777dab0Sopenharmony_ci *
5207777dab0Sopenharmony_ci * @param httpBodyStream The ArkWeb_HttpBodyStream.
5217777dab0Sopenharmony_ci * @return True if the upload data is in memory; false otherwise.
5227777dab0Sopenharmony_ci *
5237777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5247777dab0Sopenharmony_ci * @since 12
5257777dab0Sopenharmony_ci */
5267777dab0Sopenharmony_cibool OH_ArkWebHttpBodyStream_IsInMemory(const ArkWeb_HttpBodyStream* httpBodyStream);
5277777dab0Sopenharmony_ci
5287777dab0Sopenharmony_ci/**
5297777dab0Sopenharmony_ci * @brief Destroy the ArkWeb_ResourceRequest.
5307777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
5317777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
5327777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
5337777dab0Sopenharmony_ci *
5347777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5357777dab0Sopenharmony_ci * @since 12
5367777dab0Sopenharmony_ci */
5377777dab0Sopenharmony_ciint32_t OH_ArkWebResourceRequest_Destroy(const ArkWeb_ResourceRequest* resourceRequest);
5387777dab0Sopenharmony_ci
5397777dab0Sopenharmony_ci/**
5407777dab0Sopenharmony_ci * @brief Get the referrer of request.
5417777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
5427777dab0Sopenharmony_ci * @param referrer The request's referrer. This function will allocate memory for the post data string and caller
5437777dab0Sopenharmony_ci *                 must release the string by OH_ArkWeb_ReleaseString.
5447777dab0Sopenharmony_ci *
5457777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5467777dab0Sopenharmony_ci * @since 12
5477777dab0Sopenharmony_ci */
5487777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_GetReferrer(const ArkWeb_ResourceRequest* resourceRequest, char** referrer);
5497777dab0Sopenharmony_ci
5507777dab0Sopenharmony_ci/**
5517777dab0Sopenharmony_ci * @brief Get the OH_ArkWeb_RequestHeaderList of the request.
5527777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
5537777dab0Sopenharmony_ci * @param requestHeaderList The RequestHeaderList of request.
5547777dab0Sopenharmony_ci *
5557777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5567777dab0Sopenharmony_ci * @since 12
5577777dab0Sopenharmony_ci */
5587777dab0Sopenharmony_civoid OH_ArkWebResourceRequest_GetRequestHeaders(const ArkWeb_ResourceRequest* resourceRequest,
5597777dab0Sopenharmony_ci                                                ArkWeb_RequestHeaderList** requestHeaderList);
5607777dab0Sopenharmony_ci
5617777dab0Sopenharmony_ci/**
5627777dab0Sopenharmony_ci * @brief Get if this is a redirect request.
5637777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
5647777dab0Sopenharmony_ci * @return True if this is a redirect; false otherwise.
5657777dab0Sopenharmony_ci *
5667777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5677777dab0Sopenharmony_ci * @since 12
5687777dab0Sopenharmony_ci */
5697777dab0Sopenharmony_cibool OH_ArkWebResourceRequest_IsRedirect(const ArkWeb_ResourceRequest* resourceRequest);
5707777dab0Sopenharmony_ci
5717777dab0Sopenharmony_ci/**
5727777dab0Sopenharmony_ci * @brief Get if this is a request from main frame.
5737777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
5747777dab0Sopenharmony_ci * @return True if this is from main frame; false otherwise.
5757777dab0Sopenharmony_ci *
5767777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5777777dab0Sopenharmony_ci * @since 12
5787777dab0Sopenharmony_ci */
5797777dab0Sopenharmony_cibool OH_ArkWebResourceRequest_IsMainFrame(const ArkWeb_ResourceRequest* resourceRequest);
5807777dab0Sopenharmony_ci
5817777dab0Sopenharmony_ci/**
5827777dab0Sopenharmony_ci * @brief Get if this is a request is triggered by user gesutre.
5837777dab0Sopenharmony_ci * @param resourceRequest The ArkWeb_ResourceRequest.
5847777dab0Sopenharmony_ci * @return True if this is triggered by user gesture; false otherwise.
5857777dab0Sopenharmony_ci *
5867777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
5877777dab0Sopenharmony_ci * @since 12
5887777dab0Sopenharmony_ci */
5897777dab0Sopenharmony_cibool OH_ArkWebResourceRequest_HasGesture(const ArkWeb_ResourceRequest* resourceRequest);
5907777dab0Sopenharmony_ci
5917777dab0Sopenharmony_ci/**
5927777dab0Sopenharmony_ci * @brief Register custom scheme to the ArkWeb.
5937777dab0Sopenharmony_ci *
5947777dab0Sopenharmony_ci * Should not be called for built-in HTTP, HTTPS, FILE, FTP, ABOUT and DATA schemes.\n
5957777dab0Sopenharmony_ci * This function should be called on main thread.\n
5967777dab0Sopenharmony_ci *
5977777dab0Sopenharmony_ci * @param scheme The scheme to regist.
5987777dab0Sopenharmony_ci * @param option The configuration of the scheme.
5997777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
6007777dab0Sopenharmony_ci *         {@link ARKWEB_ERROR_UNKNOWN} 17100100 - Unknown error.
6017777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
6027777dab0Sopenharmony_ci *         {@link ARKWEB_SCHEME_REGISTER_FAILED} 17100102 - Register custom schemes should be called
6037777dab0Sopenharmony_ci *                                                          before create any ArkWeb.
6047777dab0Sopenharmony_ci *
6057777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6067777dab0Sopenharmony_ci * @since 12
6077777dab0Sopenharmony_ci */
6087777dab0Sopenharmony_ciint32_t OH_ArkWeb_RegisterCustomSchemes(const char* scheme, int32_t option);
6097777dab0Sopenharmony_ci
6107777dab0Sopenharmony_ci/**
6117777dab0Sopenharmony_ci * @brief Set a ArkWeb_SchemeHandler for a specific scheme to intercept requests of that scheme type.
6127777dab0Sopenharmony_ci *
6137777dab0Sopenharmony_ci * SchemeHandler should be set after the BrowserContext created.\n
6147777dab0Sopenharmony_ci * Use WebviewController.initializeWebEngine to initialize the BrowserContext without create a ArkWeb.\n
6157777dab0Sopenharmony_ci *
6167777dab0Sopenharmony_ci * @param scheme Scheme that need to be intercepted.
6177777dab0Sopenharmony_ci * @param schemeHandler The SchemeHandler for the scheme. Only requests triggered by ServiceWorker will be notified
6187777dab0Sopenharmony_ci *                      through this handler.
6197777dab0Sopenharmony_ci * @return Return true if set SchemeHandler for specific scheme successful, return false otherwise.
6207777dab0Sopenharmony_ci *
6217777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6227777dab0Sopenharmony_ci * @since 12
6237777dab0Sopenharmony_ci */
6247777dab0Sopenharmony_cibool OH_ArkWebServiceWorker_SetSchemeHandler(const char* scheme, ArkWeb_SchemeHandler* schemeHandler);
6257777dab0Sopenharmony_ci
6267777dab0Sopenharmony_ci/**
6277777dab0Sopenharmony_ci * @brief Set a ArkWeb_SchemeHandler for a specific scheme to intercept requests of that scheme type.
6287777dab0Sopenharmony_ci *
6297777dab0Sopenharmony_ci * SchemeHandler should be set after the BrowserContext created.\n
6307777dab0Sopenharmony_ci * Use WebviewController.initializeWebEngine to initialize the BrowserContext without create a ArkWeb.\n
6317777dab0Sopenharmony_ci *
6327777dab0Sopenharmony_ci * @param scheme Scheme that need to be intercepted.
6337777dab0Sopenharmony_ci * @param webTag The name of the web component.
6347777dab0Sopenharmony_ci * @param schemeHandler The SchemeHandler for the scheme. Only requests triggered from the specified web will be
6357777dab0Sopenharmony_ci *                      notified through this handler.
6367777dab0Sopenharmony_ci * @return Return true if set SchemeHandler for specific scheme successful, return false otherwise.
6377777dab0Sopenharmony_ci *
6387777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6397777dab0Sopenharmony_ci * @since 12
6407777dab0Sopenharmony_ci */
6417777dab0Sopenharmony_cibool OH_ArkWeb_SetSchemeHandler(const char* scheme, const char* webTag, ArkWeb_SchemeHandler* schemeHandler);
6427777dab0Sopenharmony_ci
6437777dab0Sopenharmony_ci/**
6447777dab0Sopenharmony_ci * @brief Clear the handler registered on the specified web for service worker.
6457777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
6467777dab0Sopenharmony_ci *
6477777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6487777dab0Sopenharmony_ci * @since 12
6497777dab0Sopenharmony_ci */
6507777dab0Sopenharmony_ciint32_t OH_ArkWebServiceWorker_ClearSchemeHandlers();
6517777dab0Sopenharmony_ci
6527777dab0Sopenharmony_ci/**
6537777dab0Sopenharmony_ci * @brief Clear the handler registered on the specified web.
6547777dab0Sopenharmony_ci * @param webTag The name of the web component.
6557777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
6567777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
6577777dab0Sopenharmony_ci *
6587777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6597777dab0Sopenharmony_ci * @since 12
6607777dab0Sopenharmony_ci */
6617777dab0Sopenharmony_ciint32_t OH_ArkWeb_ClearSchemeHandlers(const char* webTag);
6627777dab0Sopenharmony_ci
6637777dab0Sopenharmony_ci/**
6647777dab0Sopenharmony_ci * @brief Create a SchemeHandler.
6657777dab0Sopenharmony_ci * @param schemeHandler Return the created SchemeHandler. Use OH_ArkWeb_DestroySchemeHandler destroy it when donn't
6667777dab0Sopenharmony_ci *                      need it.
6677777dab0Sopenharmony_ci *
6687777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6697777dab0Sopenharmony_ci * @since 12
6707777dab0Sopenharmony_ci */
6717777dab0Sopenharmony_civoid OH_ArkWeb_CreateSchemeHandler(ArkWeb_SchemeHandler** schemeHandler);
6727777dab0Sopenharmony_ci
6737777dab0Sopenharmony_ci/**
6747777dab0Sopenharmony_ci * @brief Destroy a SchemeHandler.
6757777dab0Sopenharmony_ci * @param The ArkWeb_SchemeHandler to be destroy.
6767777dab0Sopenharmony_ci *
6777777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6787777dab0Sopenharmony_ci * @since 12
6797777dab0Sopenharmony_ci */
6807777dab0Sopenharmony_civoid OH_ArkWeb_DestroySchemeHandler(ArkWeb_SchemeHandler* schemeHandler);
6817777dab0Sopenharmony_ci
6827777dab0Sopenharmony_ci/**
6837777dab0Sopenharmony_ci * @brief Set a user data to ArkWeb_SchemeHandler.
6847777dab0Sopenharmony_ci * @param schemeHandler The ArkWeb_SchemeHandler.
6857777dab0Sopenharmony_ci * @param userData The user data to set.
6867777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
6877777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
6887777dab0Sopenharmony_ci *
6897777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
6907777dab0Sopenharmony_ci * @since 12
6917777dab0Sopenharmony_ci */
6927777dab0Sopenharmony_ciint32_t OH_ArkWebSchemeHandler_SetUserData(ArkWeb_SchemeHandler* schemeHandler, void* userData);
6937777dab0Sopenharmony_ci
6947777dab0Sopenharmony_ci/**
6957777dab0Sopenharmony_ci * @brief Get the user data from ArkWeb_SchemeHandler.
6967777dab0Sopenharmony_ci * @param schemeHandler The ArkWeb_SchemeHandler.
6977777dab0Sopenharmony_ci * @return The set user data.
6987777dab0Sopenharmony_ci *
6997777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7007777dab0Sopenharmony_ci * @since 12
7017777dab0Sopenharmony_ci */
7027777dab0Sopenharmony_civoid* OH_ArkWebSchemeHandler_GetUserData(const ArkWeb_SchemeHandler* schemeHandler);
7037777dab0Sopenharmony_ci
7047777dab0Sopenharmony_ci/**
7057777dab0Sopenharmony_ci * @brief Set the OnRequestStart callback for SchemeHandler.
7067777dab0Sopenharmony_ci * @param schemeHandler The SchemeHandler for the scheme.
7077777dab0Sopenharmony_ci * @param onRequestStart The OnRequestStart callback.
7087777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
7097777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
7107777dab0Sopenharmony_ci *
7117777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7127777dab0Sopenharmony_ci * @since 12
7137777dab0Sopenharmony_ci */
7147777dab0Sopenharmony_ciint32_t OH_ArkWebSchemeHandler_SetOnRequestStart(ArkWeb_SchemeHandler* schemeHandler,
7157777dab0Sopenharmony_ci                                                 ArkWeb_OnRequestStart onRequestStart);
7167777dab0Sopenharmony_ci
7177777dab0Sopenharmony_ci/**
7187777dab0Sopenharmony_ci * @brief Set the OnRequestStop callback for SchemeHandler.
7197777dab0Sopenharmony_ci * @param schemeHandler The SchemeHandler for the scheme.
7207777dab0Sopenharmony_ci * @param onRequestStop The OnRequestStop callback.
7217777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
7227777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
7237777dab0Sopenharmony_ci *
7247777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7257777dab0Sopenharmony_ci * @since 12
7267777dab0Sopenharmony_ci */
7277777dab0Sopenharmony_ciint32_t OH_ArkWebSchemeHandler_SetOnRequestStop(ArkWeb_SchemeHandler* schemeHandler,
7287777dab0Sopenharmony_ci                                                ArkWeb_OnRequestStop onRequestStop);
7297777dab0Sopenharmony_ci
7307777dab0Sopenharmony_ci/**
7317777dab0Sopenharmony_ci * @brief Create a Response for a request.
7327777dab0Sopenharmony_ci * @param response The created Response. Use OH_ArkWeb_DestroyResponse to destroy when donn't need it.
7337777dab0Sopenharmony_ci *
7347777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7357777dab0Sopenharmony_ci * @since 12
7367777dab0Sopenharmony_ci */
7377777dab0Sopenharmony_civoid OH_ArkWeb_CreateResponse(ArkWeb_Response** response);
7387777dab0Sopenharmony_ci
7397777dab0Sopenharmony_ci/**
7407777dab0Sopenharmony_ci * @brief Destroy the Reponse.
7417777dab0Sopenharmony_ci * @param response The Response needs destroy.
7427777dab0Sopenharmony_ci *
7437777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7447777dab0Sopenharmony_ci * @since 12
7457777dab0Sopenharmony_ci */
7467777dab0Sopenharmony_civoid OH_ArkWeb_DestroyResponse(ArkWeb_Response* response);
7477777dab0Sopenharmony_ci
7487777dab0Sopenharmony_ci/**
7497777dab0Sopenharmony_ci * @brief Set the resolved URL after redirects or changed as a result of HSTS.
7507777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
7517777dab0Sopenharmony_ci * @param url The resolved URL.
7527777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
7537777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
7547777dab0Sopenharmony_ci *
7557777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7567777dab0Sopenharmony_ci * @since 12
7577777dab0Sopenharmony_ci */
7587777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetUrl(ArkWeb_Response* response, const char* url);
7597777dab0Sopenharmony_ci
7607777dab0Sopenharmony_ci/**
7617777dab0Sopenharmony_ci * @brief Get the resolved URL after redirects or changed as a result of HSTS.
7627777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
7637777dab0Sopenharmony_ci * @param url The resolved URL.
7647777dab0Sopenharmony_ci *
7657777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7667777dab0Sopenharmony_ci * @since 12
7677777dab0Sopenharmony_ci */
7687777dab0Sopenharmony_civoid OH_ArkWebResponse_GetUrl(const ArkWeb_Response* response, char** url);
7697777dab0Sopenharmony_ci
7707777dab0Sopenharmony_ci/**
7717777dab0Sopenharmony_ci * @brief Set a error code to ArkWeb_Response.
7727777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
7737777dab0Sopenharmony_ci * @param errorCode The error code for the failed request.
7747777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
7757777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
7767777dab0Sopenharmony_ci *
7777777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7787777dab0Sopenharmony_ci * @since 12
7797777dab0Sopenharmony_ci */
7807777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetError(ArkWeb_Response* response, ArkWeb_NetError errorCode);
7817777dab0Sopenharmony_ci
7827777dab0Sopenharmony_ci/**
7837777dab0Sopenharmony_ci * @brief Get the response's error code.
7847777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
7857777dab0Sopenharmony_ci * @return The response's error code.
7867777dab0Sopenharmony_ci *
7877777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
7887777dab0Sopenharmony_ci * @since 12
7897777dab0Sopenharmony_ci */
7907777dab0Sopenharmony_ciArkWeb_NetError OH_ArkWebResponse_GetError(const ArkWeb_Response* response);
7917777dab0Sopenharmony_ci
7927777dab0Sopenharmony_ci/**
7937777dab0Sopenharmony_ci * @brief Set a status code to ArkWebResponse.
7947777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
7957777dab0Sopenharmony_ci * @param status The http status code for the request.
7967777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
7977777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
7987777dab0Sopenharmony_ci *
7997777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8007777dab0Sopenharmony_ci * @since 12
8017777dab0Sopenharmony_ci */
8027777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetStatus(ArkWeb_Response* response, int status);
8037777dab0Sopenharmony_ci
8047777dab0Sopenharmony_ci/**
8057777dab0Sopenharmony_ci * @brief Get the response's status code.
8067777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8077777dab0Sopenharmony_ci * @return The response's http status code. -1 if response is invalid.
8087777dab0Sopenharmony_ci *
8097777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8107777dab0Sopenharmony_ci * @since 12
8117777dab0Sopenharmony_ci */
8127777dab0Sopenharmony_ciint OH_ArkWebResponse_GetStatus(const ArkWeb_Response* response);
8137777dab0Sopenharmony_ci
8147777dab0Sopenharmony_ci/**
8157777dab0Sopenharmony_ci * @brief Set a status text to ArkWebResponse.
8167777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8177777dab0Sopenharmony_ci * @param statusText The status text for the request.
8187777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
8197777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
8207777dab0Sopenharmony_ci *
8217777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8227777dab0Sopenharmony_ci * @since 12
8237777dab0Sopenharmony_ci */
8247777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetStatusText(ArkWeb_Response* response, const char* statusText);
8257777dab0Sopenharmony_ci
8267777dab0Sopenharmony_ci/**
8277777dab0Sopenharmony_ci * @brief Get the response's status text.
8287777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8297777dab0Sopenharmony_ci * @param statusText Return the response's statusText. This function will allocate memory for the statusText string and
8307777dab0Sopenharmony_ci *                   caller must release the string by OH_ArkWeb_ReleaseString.
8317777dab0Sopenharmony_ci *
8327777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8337777dab0Sopenharmony_ci * @since 12
8347777dab0Sopenharmony_ci */
8357777dab0Sopenharmony_civoid OH_ArkWebResponse_GetStatusText(const ArkWeb_Response* response, char** statusText);
8367777dab0Sopenharmony_ci
8377777dab0Sopenharmony_ci/**
8387777dab0Sopenharmony_ci * @brief Set mime type to ArkWebResponse.
8397777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8407777dab0Sopenharmony_ci * @param mimeType The mime type for the request.
8417777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
8427777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
8437777dab0Sopenharmony_ci *
8447777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8457777dab0Sopenharmony_ci * @since 12
8467777dab0Sopenharmony_ci */
8477777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetMimeType(ArkWeb_Response* response, const char* mimeType);
8487777dab0Sopenharmony_ci
8497777dab0Sopenharmony_ci/**
8507777dab0Sopenharmony_ci * @brief Get the response's mime type.
8517777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8527777dab0Sopenharmony_ci * @param mimeType Return the response's mime type. This function will allocate memory for the mime type string and
8537777dab0Sopenharmony_ci *                 caller must release the string by OH_ArkWeb_ReleaseString.
8547777dab0Sopenharmony_ci *
8557777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8567777dab0Sopenharmony_ci * @since 12
8577777dab0Sopenharmony_ci */
8587777dab0Sopenharmony_civoid OH_ArkWebResponse_GetMimeType(const ArkWeb_Response* response, char** mimeType);
8597777dab0Sopenharmony_ci
8607777dab0Sopenharmony_ci/**
8617777dab0Sopenharmony_ci * @brief Set charset to ArkWeb_Response.
8627777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8637777dab0Sopenharmony_ci * @param charset The charset for the request.
8647777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
8657777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
8667777dab0Sopenharmony_ci *
8677777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8687777dab0Sopenharmony_ci * @since 12
8697777dab0Sopenharmony_ci */
8707777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetCharset(ArkWeb_Response* response, const char* charset);
8717777dab0Sopenharmony_ci
8727777dab0Sopenharmony_ci/**
8737777dab0Sopenharmony_ci * @brief Get the response's charset.
8747777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8757777dab0Sopenharmony_ci * @param charset Return the response's charset. This function will allocate memory for the charset string and caller
8767777dab0Sopenharmony_ci *                must release the string by OH_ArkWeb_ReleaseString.
8777777dab0Sopenharmony_ci *
8787777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8797777dab0Sopenharmony_ci * @since 12
8807777dab0Sopenharmony_ci */
8817777dab0Sopenharmony_civoid OH_ArkWebResponse_GetCharset(const ArkWeb_Response* response, char** charset);
8827777dab0Sopenharmony_ci
8837777dab0Sopenharmony_ci/**
8847777dab0Sopenharmony_ci * @brief Set a header to ArkWeb_Response.
8857777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
8867777dab0Sopenharmony_ci * @param name The name of the header.
8877777dab0Sopenharmony_ci * @param value The value of the header.
8887777dab0Sopenharmony_ci * @param overwirte If true will overwrite the exsits header, if false otherwise.
8897777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
8907777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
8917777dab0Sopenharmony_ci *
8927777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
8937777dab0Sopenharmony_ci * @since 12
8947777dab0Sopenharmony_ci */
8957777dab0Sopenharmony_ciint32_t OH_ArkWebResponse_SetHeaderByName(ArkWeb_Response* response,
8967777dab0Sopenharmony_ci                                          const char* name,
8977777dab0Sopenharmony_ci                                          const char* value,
8987777dab0Sopenharmony_ci                                          bool overwrite);
8997777dab0Sopenharmony_ci
9007777dab0Sopenharmony_ci/**
9017777dab0Sopenharmony_ci * @brief Get the header from the response.
9027777dab0Sopenharmony_ci * @param response The ArkWeb_Response.
9037777dab0Sopenharmony_ci * @param name The name of the header.
9047777dab0Sopenharmony_ci * @param value Return the header's value. This function will allocate memory for the value string and caller must
9057777dab0Sopenharmony_ci *              release the string by OH_ArkWeb_ReleaseString.
9067777dab0Sopenharmony_ci *
9077777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9087777dab0Sopenharmony_ci * @since 12
9097777dab0Sopenharmony_ci */
9107777dab0Sopenharmony_civoid OH_ArkWebResponse_GetHeaderByName(const ArkWeb_Response* response, const char* name, char** value);
9117777dab0Sopenharmony_ci
9127777dab0Sopenharmony_ci/**
9137777dab0Sopenharmony_ci * @brief Destroy the ArkWeb_ResourceHandler.
9147777dab0Sopenharmony_ci * @param resourceHandler The ArkWeb_ResourceHandler.
9157777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
9167777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
9177777dab0Sopenharmony_ci *
9187777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9197777dab0Sopenharmony_ci * @since 12
9207777dab0Sopenharmony_ci */
9217777dab0Sopenharmony_ciint32_t OH_ArkWebResourceHandler_Destroy(const ArkWeb_ResourceHandler* resourceHandler);
9227777dab0Sopenharmony_ci
9237777dab0Sopenharmony_ci/**
9247777dab0Sopenharmony_ci * @brief Pass response headers to intercepted requests.
9257777dab0Sopenharmony_ci * @param resourceHandler The ArkWeb_ResourceHandler for the request.
9267777dab0Sopenharmony_ci * @param response The ArkWeb_Response for the intercepting requests.
9277777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
9287777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
9297777dab0Sopenharmony_ci *
9307777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9317777dab0Sopenharmony_ci * @since 12
9327777dab0Sopenharmony_ci */
9337777dab0Sopenharmony_ciint32_t OH_ArkWebResourceHandler_DidReceiveResponse(const ArkWeb_ResourceHandler* resourceHandler,
9347777dab0Sopenharmony_ci                                                    const ArkWeb_Response* response);
9357777dab0Sopenharmony_ci
9367777dab0Sopenharmony_ci/**
9377777dab0Sopenharmony_ci * @brief Pass response body data to intercepted requests.
9387777dab0Sopenharmony_ci * @param resourceHandler The ArkWeb_ResourceHandler for the request.
9397777dab0Sopenharmony_ci * @param buffer Buffer data to send.
9407777dab0Sopenharmony_ci * @param bufLen The size of buffer.
9417777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
9427777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
9437777dab0Sopenharmony_ci *
9447777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9457777dab0Sopenharmony_ci * @since 12
9467777dab0Sopenharmony_ci */
9477777dab0Sopenharmony_ciint32_t OH_ArkWebResourceHandler_DidReceiveData(const ArkWeb_ResourceHandler* resourceHandler,
9487777dab0Sopenharmony_ci                                                const uint8_t* buffer,
9497777dab0Sopenharmony_ci                                                int64_t bufLen);
9507777dab0Sopenharmony_ci
9517777dab0Sopenharmony_ci/**
9527777dab0Sopenharmony_ci * @brief Notify the ArkWeb that this request should be finished and there is no more data available.
9537777dab0Sopenharmony_ci * @param resourceHandler The ArkWeb_ResourceHandler for the request.
9547777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
9557777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
9567777dab0Sopenharmony_ci *
9577777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9587777dab0Sopenharmony_ci * @since 12
9597777dab0Sopenharmony_ci */
9607777dab0Sopenharmony_ciint32_t OH_ArkWebResourceHandler_DidFinish(const ArkWeb_ResourceHandler* resourceHandler);
9617777dab0Sopenharmony_ci
9627777dab0Sopenharmony_ci/**
9637777dab0Sopenharmony_ci * @brief Notify the ArkWeb that this request should be failed.
9647777dab0Sopenharmony_ci * @param resourceHandler The ArkWeb_ResourceHandler for the request.
9657777dab0Sopenharmony_ci * @param errorCode The error code for this request. Refer to arkweb_net_error_list.h.
9667777dab0Sopenharmony_ci * @return {@link ARKWEB_NET_OK} 0 - Success.
9677777dab0Sopenharmony_ci *         {@link ARKWEB_INVALID_PARAM} 17100101 - Invalid param.
9687777dab0Sopenharmony_ci *
9697777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9707777dab0Sopenharmony_ci * @since 12
9717777dab0Sopenharmony_ci */
9727777dab0Sopenharmony_ciint32_t OH_ArkWebResourceHandler_DidFailWithError(const ArkWeb_ResourceHandler* resourceHandler,
9737777dab0Sopenharmony_ci                                                  ArkWeb_NetError errorCode);
9747777dab0Sopenharmony_ci
9757777dab0Sopenharmony_ci/**
9767777dab0Sopenharmony_ci * @brief Release the string acquired by native function.
9777777dab0Sopenharmony_ci * @param string The string to be released.
9787777dab0Sopenharmony_ci *
9797777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9807777dab0Sopenharmony_ci * @since 12
9817777dab0Sopenharmony_ci */
9827777dab0Sopenharmony_civoid OH_ArkWeb_ReleaseString(char* string);
9837777dab0Sopenharmony_ci
9847777dab0Sopenharmony_ci/**
9857777dab0Sopenharmony_ci * @brief Release the byte array acquired by native function.
9867777dab0Sopenharmony_ci * @param byteArray The byte array to be released.
9877777dab0Sopenharmony_ci *
9887777dab0Sopenharmony_ci * @syscap SystemCapability.Web.Webview.Core
9897777dab0Sopenharmony_ci * @since 12
9907777dab0Sopenharmony_ci */
9917777dab0Sopenharmony_civoid OH_ArkWeb_ReleaseByteArray(uint8_t* byteArray);
9927777dab0Sopenharmony_ci
9937777dab0Sopenharmony_ci
9947777dab0Sopenharmony_ci#ifdef __cplusplus
9957777dab0Sopenharmony_ci};
9967777dab0Sopenharmony_ci#endif
9977777dab0Sopenharmony_ci#endif // ARKWEB_SCHEME_HANDLER_H
998