http_interceptor_type.h
概述
为HTTP全局拦截器模块提供C接口的数据结构定义,包含拦截器的请求/响应头信息、HTTP请求/响应数据包结构、拦截器配置信息以及相关的枚举类型和函数指针。
引用文件: <network/netstack/http_interceptor_type.h>
库: libhttp_interceptor.so
系统能力: SystemCapability.Communication.NetStack
起始版本: 24
相关模块: netstack
汇总
结构体
| 名称 | typedef关键字 | 描述 |
|---|---|---|
| OH_Http_Interceptor_Headers | OH_Http_Interceptor_Headers | 定义拦截器的请求/响应头信息。 |
| OH_Http_Interceptor_Request | OH_Http_Interceptor_Request | 定义拦截器的HTTP请求数据包结构。 |
| OH_Http_Interceptor_Response | OH_Http_Interceptor_Response | 定义拦截器的HTTP响应数据包结构。 |
| OH_Http_Interceptor | OH_Http_Interceptor | 定义HTTP全局拦截器的配置信息。 |
枚举
| 名称 | typedef关键字 | 描述 |
|---|---|---|
| OH_Interceptor_Stage | OH_Interceptor_Stage | 定义拦截器的执行阶段。 |
| OH_Interceptor_Type | OH_Interceptor_Type | 定义拦截器的类型。 |
| OH_Interceptor_Result | OH_Interceptor_Result | 定义拦截器的处理结果。 |
函数
| 名称 | typedef关键字 | 描述 |
|---|---|---|
| typedef OH_Interceptor_Result (*OH_Http_InterceptorHandler)(OH_Http_Interceptor_Request *request, OH_Http_Interceptor_Response *response, int32_t *isModified) | OH_Http_InterceptorHandler | 指向HTTP拦截器处理函数的指针。 |
枚举类型说明
OH_Interceptor_Stage
typedef enum OH_Interceptor_Stage {
OH_STAGE_REQUEST,
OH_STAGE_RESPONSE
} OH_Interceptor_Stage;
描述
定义拦截器的执行阶段。
起始版本: 24
参数:
| 枚举项 | 描述 |
|---|---|
| OH_STAGE_REQUEST | 拦截器处理请求。 |
| OH_STAGE_RESPONSE | 拦截器处理响应。 |
OH_Interceptor_Type
typedef enum OH_Interceptor_Type {
OH_TYPE_READ_ONLY
} OH_Interceptor_Type;
描述
定义拦截器的类型。
起始版本: 24
参数:
| 枚举项 | 描述 |
|---|---|
| OH_TYPE_READ_ONLY | 只读拦截器。 |
OH_Interceptor_Result
typedef enum OH_Interceptor_Result {
OH_CONTINUE,
OH_ABORT
} OH_Interceptor_Result;
描述
定义拦截器的处理结果。
起始版本: 24
参数:
| 枚举项 | 描述 |
|---|---|
| OH_CONTINUE | 继续处理。 |
| OH_ABORT | 拦截处理。 |
函数说明
OH_Http_InterceptorHandler()
typedef OH_Interceptor_Result (*OH_Http_InterceptorHandler)(
OH_Http_Interceptor_Request *request,
OH_Http_Interceptor_Response *response,
int32_t *isModified);
描述
定义HTTP拦截器处理函数。
起始版本: 24
参数:
| 参数项 | 描述 |
|---|---|
| OH_Http_Interceptor_Request *request | HTTP请求数据包指针(仅在请求阶段有效)。 |
| OH_Http_Interceptor_Response *response | HTTP响应数据包指针(仅在响应阶段有效)。 |
| int32_t *isModified | 输出参数,标识拦截器是否修改了数据包,对OH_TYPE_READ_ONLY类型拦截器不生效。 |
返回:
| 类型 | 说明 |
|---|---|
| OH_Interceptor_Result | 拦截器处理结果:- OH_CONTINUE:继续处理 - OH_ABORT:拦截处理。 |
你可能感兴趣的鸿蒙文章
openharmony 鸿蒙 capi-netconnection-netconn-connectionproperties
openharmony 鸿蒙 errorcode-net-mdns
openharmony 鸿蒙 js-apis-net-ethernet-sys
openharmony 鸿蒙 errorcode-net-http
openharmony 鸿蒙 capi-netstack-http-proxy
openharmony 鸿蒙 js-apis-system-fetch
openharmony 鸿蒙 errorcode-kernel
openharmony 鸿蒙 capi-netstack-netstack-certblob