目录

RemoteCommunication

Overview

This module provides APIs related to remote communication.

It supports HTTP sessions.

Since: 5.0.0(12)

Supports the QUIC function.

Since: 26.0.0

Summary

[h2]Files

Name Description
rcp.h Declares the APIs used to access Remote Communication, and defines basic functions, structs, and constants.
rcp_quic.h Declares the APIs related to the QUIC protocol, and defines basic functions, structs, and constants.

[h2]Structs

Name Description
struct Rcp_Buffer Text storage struct.
struct Rcp_ContentOrPathOrCallback Simple form data field value used in Rcp_FormFieldFileValue.
struct Rcp_FormFieldFileValue Form field file value.
struct Rcp_FormFieldValue Simple form data field value. For details, please refer to Rcp_Form and Rcp_MultipartFormFieldValue.
struct Rcp_MultipartFormFieldValue Multi-part form field value, which will be used in Rcp_MultipartForm.
struct Rcp_FormOrder Sequence in which key-value pairs in the form are sent.
struct Rcp_RequestContent Request content.
struct Rcp_HeaderValue Value type of a mapped value in a request or response header.
struct Rcp_HeaderEntry All key-value pairs in the request or response header.
struct Rcp_Credential Credential used for server identity verification, including the user name and password.
struct Rcp_ServerAuthentication Server identity verification information.
struct Rcp_Urls URL, which is used to determine whether a host is using a proxy.
struct Rcp_Exclusions URLs excluded from proxy processing.
struct Rcp_CertificateAuthority CA used to verify the identity of a remote server.
struct Rcp_ClientCertificate Client certificate sent to a remote server, which will be used by the server to verify the identity of the client.
struct Rcp_SecurityConfiguration Request security configuration.
struct Rcp_WebProxy Custom proxy configuration.
struct Rcp_IpAndPort IP address and port number of a DNS server, which will be used in Rcp_DnsServers.
struct Rcp_DnsServers DNS server, which is one of the types defined in Rcp_DnsConfiguration.dnsRules.
struct Rcp_IpAddress IP address group used by the static DNS rule Rcp_StaticDnsRuleItem.
struct Rcp_StaticDnsRuleItem Description about a single static DNS rule.
struct Rcp_StaticDnsRule Static DNS rule.
struct Rcp_DnsRule DNS rule configuration.
struct Rcp_OnDataReceiveCallback Callback triggered upon data receiving events, which is configured in Rcp_EventsHandler.
struct Rcp_OnProgressCallback Callback triggered upon data transmission events, which is configured in Rcp_EventsHandler.
struct Rcp_OnHeaderReceiveCallback Callback triggered upon header receiving events, which is configured in Rcp_EventsHandler.
struct Rcp_OnVoidCallback Callback triggered upon transmigration ending or cancellation events, which is configured in Rcp_EventsHandler.
struct Rcp_EventsHandler Callback function for listening for various HTTP events.
struct Rcp_Timeout Request timeout configuration.
struct Rcp_DnsOverHttps DNS over HTTPS. If this information is configured, addresses resolved by the DOH DNS server will be preferred.
struct Rcp_TransferConfiguration Transmission configuration.
struct Rcp_InfoToCollect Request processing events to be collected. You can check the response object for collected events.
struct Rcp_TracingConfiguration Request tracing configuration.
struct Rcp_ProxyConfiguration Proxy configuration.
struct Rcp_DnsConfiguration DNS resolution configuration.
struct Rcp_Configuration Request configuration.
struct Rcp_TransferRange HTTP transmission range. This configuration will be converted into the HTTP Range header. An HTTP request with such a header requires the server to return only a part of the HTTP response.
struct Rcp_Request Network request.
struct Rcp_RequestCookieEntry All cookie key-value pairs in the request.
struct Rcp_DebugInfo Structure of the debugging information stored in Rcp_Response.
struct Rcp_CookieAttributeEntry Response cookie attribute entry.
struct Rcp_ResponseCookies Response cookies.
struct Rcp_TimeInfo Response timer information.
struct Rcp_ResponseCallbackObject Response callback struct.
struct Rcp_Response Response to a network request.
struct Rcp_Interceptor Asynchronous interceptor.
struct Rcp_SyncInterceptor Synchronous interceptor.
struct Rcp_InterceptorArray Asynchronous interceptor array.
struct Rcp_SyncInterceptorArray Synchronous interceptor array.
struct Rcp_SessionListener Callback function for listening on session closing or cancellation events.
struct Rcp_ConnectionConfiguration Connection configuration.
struct Rcp_SessionConfiguration Session configuration.
struct Rcp_OnBinaryReceiveCallback Callback triggered when the binary data in the response is received.
struct Rcp_OnStatusCodeReceiveCallback Callback triggered when a response status code is received.
struct Rcp_OnGetDataCallback Callback used to obtain data.
struct Rcp_QuicSlist Data structure of linked list data.
struct Rcp_QuicIpAddress Data structure used to store IP addresses.
struct Rcp_QuicIoVec Data structure used to store binary content.
struct Rcp_QuicStreamData Storage structure used to receive streaming data in a QUIC connection.

[h2]Macros

Name Description
RCP_MAX_REQUEST_ID_LEN 32 Maximum length of a request ID.
RCP_MAX_CONTENT_TYPE_LEN 64 Maximum length of the content type.
RCP_MAX_FILENAME_LEN 128 Maximum length of a file name.
RCP_MAX_PATH_LEN 128 Maximum path length.
RCP_METHOD_GET "GET" HTTP GET method.
RCP_METHOD_HEAD "HEAD" HTTP HEAD method.
RCP_METHOD_OPTIONS "OPTIONS" HTTP OPTIONS method.
RCP_METHOD_TRACE "TRACE" HTTP TRACE method.
RCP_METHOD_DELETE "DELETE" HTTP DELETE method.
RCP_METHOD_POST "POST" HTTP POST method.
RCP_METHOD_PUT "PUT" HTTP PUT method.
RCP_METHOD_PATCH "PATCH" HTTP PATCH method.
RCP_IP_MAX_LEN 40 Maximum length of an IP address.
RCP_HOST_MAX_LEN 256 Maximum length of a host name.
RCP_QUIC_IP_MAX_LEN 40 Maximum length of an IP address in a QUIC connection.

[h2]Types

Name Description
typedef enum Rcp_FormValueType Rcp_FormValueType Form value type.
typedef int(* Rcp_GetDataCallback) (char *out, uint32_t size) Data obtained through a callback function. This callback is used when the API needs to send the next part of the data to the server.
typedef enum Rcp_ContentOrPathOrCallbackType Rcp_ContentOrPathOrCallbackType Content, path, or callback type, which is used to distinguish the data used in Rcp_ContentOrPathOrCallback.
typedef struct Rcp_Buffer Rcp_Buffer Text storage struct.
typedef struct Rcp_ContentOrPathOrCallback Rcp_ContentOrPathOrCallback Simple form data field value used in Rcp_FormFieldFileValue.
typedef enum Rcp_MultipartValueType Rcp_MultipartValueType Multi-part form value type, which is used to distinguish the data used in Rcp_MultipartFormFieldValue.
typedef struct Rcp_FormFieldFileValue Rcp_FormFieldFileValue Form field file value.
typedef struct Rcp_FormFieldValue Rcp_FormFieldValue Simple form data field value. For details, please refer to Rcp_Form and Rcp_MultipartFormFieldValue.
typedef struct Rcp_MultipartFormFieldValue Rcp_MultipartFormFieldValue Multi-part form field value, which will be used in Rcp_MultipartForm.
typedef enum Rcp_ContentType Rcp_ContentType Content type in Rcp_RequestContent.
typedef struct Rcp_Form Rcp_Form Simple form data.
typedef struct Rcp_MultipartForm Rcp_MultipartForm Multi-part form data.
typedef struct Rcp_FormOrder Rcp_FormOrder Sequence in which key-value pairs in the form are sent.
typedef struct Rcp_RequestContent Rcp_RequestContent Request content.
typedef struct Rcp_Headers Rcp_Headers Header of a request or response.
typedef struct Rcp_HeaderValue Rcp_HeaderValue Value type of a mapped value in a request or response header.
typedef struct Rcp_HeaderEntry Rcp_HeaderEntry All key-value pairs in the request or response header.
typedef enum Rcp_AuthenticationType Rcp_AuthenticationType Enumeration type, which indicates the server identity verification type. If the type is not set, negotiation with the server is required.
typedef struct Rcp_Credential Rcp_Credential Credential used for server identity verification, including the user name and password.
typedef struct Rcp_ServerAuthentication Rcp_ServerAuthentication Server identity verification information.
typedef bool(* Rcp_ExclusionFunction) (const char *url) Pointer to the function for determining whether a host uses a proxy. The value true indicates that a proxy is used, and the value false indicates that no proxy is used.
typedef struct Rcp_Urls Rcp_Urls URL, which is used to determine whether a host is using a proxy.
typedef enum Rcp_ExclusionsValueType Rcp_ExclusionsValueType Data type in Rcp_Exclusions.
typedef struct Rcp_Exclusions Rcp_Exclusions URLs excluded from proxy processing.
typedef enum Rcp_CertType Rcp_CertType Client certificate type.
typedef struct Rcp_CertificateAuthority Rcp_CertificateAuthority CA used to verify the identity of a remote server.
typedef struct Rcp_ClientCertificate Rcp_ClientCertificate Client certificate sent to a remote server, which will be used by the server to verify the identity of the client.
typedef enum Rcp_RemoteValidationType Rcp_RemoteValidationType Remote server validation type.
typedef struct Rcp_SecurityConfiguration Rcp_SecurityConfiguration Request security configuration.
typedef enum Rcp_ProxyTunnelMode Rcp_ProxyTunnelMode Indicates when a proxy tunnel needs to be established. Tunneling, or tunnel transmission, is a process where an HTTP CONNECT request is sent to a proxy server, instructing it to establish a connection to the remote host of a specified port number. Once this connection is set up, all subsequent traffic is routed through the proxy. The value auto indicates that a tunnel will be created for HTTPS traffic but not for HTTP traffic. The value always indicates that tunneling is enabled for all traffic.
typedef struct Rcp_WebProxy Rcp_WebProxy Custom proxy configuration.
typedef struct Rcp_IpAndPort Rcp_IpAndPort IP address and port number of a DNS server, which will be used in Rcp_DnsServers.
typedef struct Rcp_DnsServers Rcp_DnsServers DNS server, which is one of the types defined in Rcp_DnsConfiguration.dnsRules.
typedef struct Rcp_IpAddress Rcp_IpAddress IP address group used by the static DNS rule Rcp_StaticDnsRuleItem.
typedef struct Rcp_StaticDnsRuleItem Rcp_StaticDnsRuleItem Description about a single static DNS rule.
typedef struct Rcp_StaticDnsRule Rcp_StaticDnsRule Static DNS rule.
typedef Rcp_IpAddress *(* Rcp_DynamicDnsRuleFunction) (const char *host, uint16_t port) Function that can directly return an IP address based on the host name and port number. It is used for dynamic DNS resolution.
typedef enum Rcp_DnsRuleType Rcp_DnsRuleType DNS rule type in Rcp_DnsRule.
typedef struct Rcp_DnsRule Rcp_DnsRule DNS rule configuration.
typedef size_t(* Rcp_OnDataReceiveCallbackFunc) (void *usrObject, const char *data) Callback function triggered when a response body (character data type) is returned.
typedef size_t(* Rcp_OnBinaryReceiveCallbackFunc) (void *usrObject, Rcp_Buffer *buffer) Callback function triggered when a response body (binary data type) is returned.
typedef void (* Rcp_OnStatusCodeReceiveCallbackFunc)(void *usrObject, uint32_t statusCode) Callback function triggered when a response status code is returned.
typedef void(* Rcp_OnProgressCallbackFunc) (void *usrObject, uint64_t totalSize, uint64_t transferredSize) Callback function triggered during request/response data transmission.
typedef void(* Rcp_OnHeaderReceiveCallbackFunc) (void *usrObject, Rcp_Headers *headers) Callback function triggered when all requests are received.
typedef void(* Rcp_OnVoidCallbackFunc) (void *usrObject) Callback function for listening on DataEnd and Canceled events of requests.
typedef struct Rcp_OnDataReceiveCallback Rcp_OnDataReceiveCallback Callback triggered upon data receiving events, which is configured in Rcp_EventsHandler.
typedef struct Rcp_OnProgressCallback Rcp_OnProgressCallback Callback triggered upon data transmission events, which is configured in Rcp_EventsHandler.
typedef struct Rcp_OnHeaderReceiveCallback Rcp_OnHeaderReceiveCallback Callback triggered upon header receiving events, which is configured in Rcp_EventsHandler.
typedef struct Rcp_OnVoidCallback Rcp_OnVoidCallback Callback triggered upon transmigration ending or cancellation events, which is configured in Rcp_EventsHandler.
typedef struct Rcp_EventsHandler Rcp_EventsHandler Callback function for listening for various HTTP events.
typedef struct Rcp_Timeout Rcp_Timeout Request timeout configuration.
typedef struct Rcp_DnsOverHttps Rcp_DnsOverHttps DNS over HTTPS. If this information is configured, addresses resolved by the DOH DNS server will be preferred.
typedef enum Rcp_PathPreference Rcp_PathPreference Request path preferences.
typedef struct Rcp_TransferConfiguration Rcp_TransferConfiguration Transmission configuration.
typedef struct Rcp_InfoToCollect Rcp_InfoToCollect Request processing events to be collected. You can check the response object for collected events.
typedef struct Rcp_TracingConfiguration Rcp_TracingConfiguration Request tracing configuration.
typedef enum Rcp_ProxyType Rcp_ProxyType Proxy type, which will be used to determine which proxy configuration will be used.
typedef struct Rcp_ProxyConfiguration Rcp_ProxyConfiguration Proxy configuration.
typedef struct Rcp_DnsConfiguration Rcp_DnsConfiguration DNS resolution configuration.
typedef struct Rcp_Configuration Rcp_Configuration Request configuration.
typedef struct Rcp_TransferRange Rcp_TransferRange HTTP transmission range. This configuration will be converted into the HTTP Range header. An HTTP request with such a header requires the server to return only a part of the HTTP response.
typedef struct Rcp_RequestCookies Rcp_RequestCookies Request cookies.
typedef struct Rcp_Request Rcp_Request Network request.
typedef struct Rcp_RequestCookieEntry Rcp_RequestCookieEntry All cookie key-value pairs in the request.
typedef enum Rcp_StatusCode Rcp_StatusCode Status code of the request response.
typedef enum Rcp_DebugEvent Rcp_DebugEvent Debugging event type.
typedef struct Rcp_DebugInfo Rcp_DebugInfo Structure of the debugging information stored in Rcp_Response.
typedef struct Rcp_CookieAttributes Rcp_CookieAttributes Cookie attribute type in Rcp_Response.
typedef struct Rcp_CookieAttributeEntry Rcp_CookieAttributeEntry Response cookie attribute entry.
typedef struct Rcp_ResponseCookies Rcp_ResponseCookies Response cookies.
typedef struct Rcp_TimeInfo Rcp_TimeInfo Response timer information.
typedef struct Rcp_Response Rcp_Response Response to a network request.
typedef void(* Rcp_ResponseCallback) (void *usrCtx, Rcp_Response *response, uint32_t errCode) Pointer to the response callback function.
typedef struct Rcp_ResponseCallbackObject Rcp_ResponseCallbackObject Response callback struct.
typedef struct Rcp_RequestHandler Rcp_RequestHandler Asynchronous handler associated with Rcp_Interceptor.
typedef struct Rcp_SyncRequestHandler Rcp_SyncRequestHandler Synchronous handler associated with Rcp_SyncInterceptor.
typedef struct Rcp_Interceptor Rcp_Interceptor Asynchronous interceptor.
typedef struct Rcp_SyncInterceptor Rcp_SyncInterceptor Synchronous interceptor.
typedef struct Rcp_InterceptorArray Rcp_InterceptorArray Asynchronous interceptor array.
typedef struct Rcp_SyncInterceptorArray Rcp_SyncInterceptorArray Synchronous interceptor array.
typedef enum Rcp_SessionType Rcp_SessionType Session type.
typedef struct Rcp_Session Rcp_Session Session.
typedef struct Rcp_SessionListener Rcp_SessionListener Callback function for listening on session closing or cancellation events.
typedef struct Rcp_ConnectionConfiguration Rcp_ConnectionConfiguration Connection configuration.
typedef struct Rcp_SessionConfiguration Rcp_SessionConfiguration Session configuration.
typedef struct Rcp_OnBinaryReceiveCallback Rcp_OnBinaryReceiveCallback Callback triggered when the binary data in the response is received.
typedef struct Rcp_OnStatusCodeReceiveCallback Rcp_OnStatusCodeReceiveCallback Callback triggered when a response status code is received.
typedef struct Rcp_OnGetDataCallback Rcp_OnGetDataCallback Callback used to obtain data.
typedef size_t(* Rcp_GetDataCallbackFunc) (void *userObject, uint8_t *outData, size_t size) Callback function used to obtain data.
typedef void Rcp_QuicConn Type of a QUIC connection instance.
typedef void Rcp_QuicSession Type of a QUIC session, which can manage multiple connection instances.
typedef struct Rcp_QuicSlist Rcp_QuicSlist Data structure of linked list data.
typedef enum RCP_QuicIpResolve RCP_QuicIpResolve IP address resolution type used for DNS requests.
typedef struct Rcp_QuicIpAddress Rcp_QuicIpAddress Data structure used to store IP addresses.
typedef Rcp_QuicIpAddress (*Rcp_QuicDynamicDnsRuleFunction) (Rcp_QuicConn *conn, void *userObject, const char *host, uint16_t port) Custom DNS resolution callback function, which returns the IP address based on the host name and port number.
typedef enum Rcp_QuicConnOpt QUIC connection option type, which is used to configure connection parameters and callbacks.
typedef enum Rcp_QuicStreamOpt QUIC stream option type, which is used to configure connection parameters and callbacks.
typedef enum Rcp_QuicConnInfo Type of QUIC connection information, which is used to query connection information.
typedef enum Rcp_QuicStreamInfo Type of QUIC stream information, which is used to query stream information.
typedef enum Rcp_QuicErrorCode Error code that may be reported for a QUIC request.
typedef enum Rcp_QuicStreamDirection QUIC stream direction type.
typedef enum Rcp_QuicStreamShutdown Close operation type of a QUIC stream, which specifies whether to close the read or write direction.
typedef struct Rcp_QuicIoVec Rcp_QuicIoVec Data structure used to store binary content.
typedef struct Rcp_QuicStreamData Rcp_QuicStreamData Storage structure used to receive streaming data in a QUIC connection.
typedef Rcp_QuicErrorCode (*Rcp_QuicConnectionOnCertAuthority) (Rcp_QuicConn *conn, void *userObject, const unsigned char *const *certs, const size_t *certLens, size_t certsCount) Certificate verification callback function, which is used for custom verification of the peer end's certificate during QUIC connection establishment.
typedef void (*Rcp_QuicConnectionOnSessionTicketUpdate) (Rcp_QuicConn *conn, void *userObject, const char *sessionTicket, size_t length) QUIC session ticket update callback function, which is triggered when the ticket is updated in a QUIC session, returning the new ticket.
typedef void (*Rcp_QuicConnectionOnConnected) (Rcp_QuicConn *conn, void *userObject) QUIC connection success callback function, which is triggered when a QUIC connection is successfully established.
typedef void (*Rcp_QuicConnectionOnError) (Rcp_QuicConn *conn, void *userObject, Rcp_QuicErrorCode errCode, const char *errDetail) QUIC connection failure callback function, which is triggered when a QUIC connection fails to be established, returning the failure cause.
typedef void (*Rcp_QuicConnectionOnClosed) (Rcp_QuicConn *conn, void *userObject) QUIC connection close callback function, which is triggered when a QUIC connection is closed, returning a notification.
typedef void (*Rcp_QuicConnectionOnStreamInbound) (Rcp_QuicConn *conn, void *userObject, uint64_t streamId) QUIC inbound stream callback function, which is triggered when the peer end creates a stream in a QUIC connection. It handles the stream and sets the stream options and callback.
typedef void (*Rcp_QuicStreamOnEvent) (Rcp_QuicConn *conn, void *userObject, uint64_t streamId, Rcp_QuicErrorCode errCode, const char *errDetail) QUIC stream event callback function, which is triggered when an event occurs in a stream in a QUIC connection. It handles the stream status change and errors.
typedef uint64_t (*Rcp_QuicStreamOnReceiveData) (Rcp_QuicConn *conn, void *userObject, uint64_t streamId, const Rcp_QuicStreamData *streamData) QUIC stream data receiving callback function, which is triggered when stream data is received in a QUIC connection. It processes the received data.

[h2]Enums

Name Description

Rcp_FormValueType {

RCP_FORM_VALUE_TYPE_INT32, RCP_FORM_VALUE_TYPE_INT64, RCP_FORM_VALUE_TYPE_BOOL, RCP_FORM_VALUE_TYPE_STRING,

RCP_FORM_VALUE_TYPE_DOUBLE

}

Form value type.
Rcp_ContentOrPathOrCallbackType { RCP_FILE_VALUE_TYPE_CONTENT, RCP_FILE_VALUE_TYPE_PATH, RCP_FILE_VALUE_TYPE_CALLBACK } Content, path, or callback type, which is used to distinguish the data used in Rcp_ContentOrPathOrCallback.
Rcp_MultipartValueType { RCP_TYPE_FORM_FIELD_VALUE, RCP_TYPE_FORM_FIELD_FILE_VALUE } Multi-part form value type, which is used to distinguish the data used in Rcp_MultipartFormFieldValue.
Rcp_ContentType { RCP_CONTENT_TYPE_STRING, RCP_CONTENT_TYPE_FORM, RCP_CONTENT_TYPE_MULTIPARTFORM, RCP_CONTENT_TYPE_GETCALLBACK } Content type in Rcp_RequestContent.
Rcp_AuthenticationType { RCP_AUTHENTICATION_AUTO, RCP_AUTHENTICATION_BASIC, RCP_AUTHENTICATION_NTLM, RCP_AUTHENTICATION_DIGEST } Enumeration type, which indicates the server identity verification type. If the type is not set, negotiation with the server is required.
Rcp_ExclusionsValueType { RCP_EXCLUSION_USE_URL_ARRAY, RCP_EXCLUSION_USE_CALLBACK } Data type in Rcp_Exclusions.
Rcp_CertType { RCP_CERT_PEM, RCP_CERT_DER, RCP_CERT_P12 } Client certificate type.
Rcp_RemoteValidationType { RCP_REMOTE_VALIDATION_SYSTEM, RCP_REMOTE_VALIDATION_SKIP, RCP_REMOTE_VALIDATION_CERTIFICATE_AUTHORITY } Remote server validation type.
Rcp_ProxyTunnelMode { RCP_PROXY_TUNNEL_AUTO, RCP_PROXY_TUNNEL_ALWAYS } Indicates when a proxy tunnel needs to be established. Tunneling, or tunnel transmission, is a process where an HTTP CONNECT request is sent to a proxy server, instructing it to establish a connection to the remote host of a specified port number. Once this connection is set up, all subsequent traffic is routed through the proxy. The value auto indicates that a tunnel will be created for HTTPS traffic but not for HTTP traffic. The value always indicates that tunneling is enabled for all traffic.
Rcp_DnsRuleType { RCP_DNS_RULE_DNS_SERVERS, RCP_DNS_RULE_STATIC, RCP_DNS_RULE_DYNAMIC } DNS rule type in Rcp_DnsRule.
Rcp_PathPreference { RCP_PATH_PREFERENCE_AUTO, RCP_PATH_PREFERENCE_WIFI, RCP_PATH_PREFERENCE_CELLULAR } Request path preferences.
Rcp_ProxyType { RCP_PROXY_SYSTEM, RCP_PROXY_CUSTOM, RCP_PROXY_NO_PROXY } Proxy type, which will be used to determine which proxy configuration will be used.

Rcp_StatusCode {

RCP_NONE = 0, RCP_OK = 200, RCP_CREATED, RCP_ACCEPTED,

RCP_NOT_AUTHORITATIVE, RCP_NO_CONTENT, RCP_RESET, RCP_PARTIAL,

RCP_MULTI_CHOICE = 300, RCP_MOVED_PERMANENTLY, RCP_MOVED_TEMPORARILY, RCP_SEE_OTHER,

RCP_NOT_MODIFIED, RCP_USE_PROXY, RCP_BAD_REQUEST = 400, RCP_UNAUTHORIZED,

RCP_PAYMENT_REQUIRED, RCP_FORBIDDEN, RCP_NOT_FOUND, RCP_BAD_METHOD,

RCP_NOT_ACCEPTABLE, RCP_PROXY_AUTH, RCP_CLIENT_TIMEOUT, RCP_CONFLICT,

RCP_GONE, RCP_LENGTH_REQUIRED, RCP_PRECON_FAILED, RCP_ENTITY_TOO_LARGE,

RCP_REQ_TOO_LONG, RCP_UNSUPPORTED_TYPE, RCP_INTERNAL_ERROR = 500, RCP_NOT_IMPLEMENTED,

RCP_BAD_GATEWAY, RCP_UNAVAILABLE, RCP_GATEWAY_TIMEOUT, RCP_VERSION

}

Status code of the request response.

Rcp_DebugEvent {

RCP_DEBUG_EVENT_TEXT, RCP_DEBUG_EVENT_HEADER_IN, RCP_DEBUG_EVENT_HEADER_OUT, RCP_DEBUG_EVENT_DATA_IN,

RCP_DEBUG_EVENT_DATA_OUT, RCP_DEBUG_EVENT_SSL_DATA_IN, RCP_DEBUG_EVENT_SSL_DATA_OUT

}

Debugging event type.
Rcp_SessionType { RCP_SESSION_TYPE_HTTP = 0, RCP_SESSION_TYPE_MAX = 100 } Session type.
RCP_QuicIpResolve {RCP_QUIC_IP_RESOLVE_WHATEVER = 0, RCP_QUIC_IP_RESOLVE_V4, RCP_QUIC_IP_RESOLVE_V6} IP address resolution type used for DNS requests.
Rcp_QuicConnOpt { RCP_QUIC_CONN_IP_ADDRESS = 0, RCP_QUIC_CONN_IP_RESOLVE, RCP_QUIC_CONN_DNS_FUNCTION, RCP_QUIC_CONN_ON_CONNECTED_FUNCTION, RCP_QUIC_CONN_ON_ERROR_FUNCTION, RCP_QUIC_CONN_ON_CLOSED_FUNCTION, RCP_QUIC_CONN_STREAM_INBOUND_FUNCTION, RCP_QUIC_CONN_CONNECT_TIMEOUT_MS, RCP_QUIC_CONN_IDLE_TIMEOUT_MS, RCP_QUIC_TLS_CERT_AUTHORITY_FUNCTION = 1000, RCP_QUIC_TLS_CERT_AUTHORITY_CONTENT, RCP_QUIC_TLS_SESSION_TICKET_UPDATE_FUNCTION, RCP_QUIC_TLS_SESSION_TICKET_CONTENT, RCP_QUIC_TP_INITIAL_MAX_BIDIRECTIONAL_STREAMS = 2000, RCP_QUIC_TP_INITIAL_MAX_DATA, RCP_QUIC_TP_INITIAL_MAX_STREAMDATA_BIDIRECTIONAL_LOCAL, RCP_QUIC_TP_INITIAL_MAX_STREAMDATA_BIDIRECTIONAL_REMOTE, RCP_QUIC_TP_INITIAL_MAX_STREAMDATA_UNIDIRECTIONAL, RCP_QUIC_TP_INITIAL_MAX_UNIDIRECTIONAL_STREAMS} Type of QUIC connection options.
Rcp_QuicStreamOpt { RCP_QUIC_STREAM_EVENT_FUNCTION = 0, RCP_QUIC_STREAM_DATA_FUNCTION, RCP_QUIC_INBOUND_STREAM_USER_OBJECT, RCP_QUIC_STREAM_SND_BUFFER_SIZE_KB} Stream options in a QUIC connection.
Rcp_QuicConnInfo { RCP_INFO_CONN_GET_LOCALADDR = 0, RCP_INFO_CONN_GET_PEERADDR, RCP_INFO_CONN_DNS_TIME_MS, RCP_INFO_CONN_CONNECT_TIME_MS, RCP_INFO_CONN_SCID, RCP_INFO_CONN_DCID } Type of information in a QUIC connection.
Rcp_QuicStreamInfo { RCP_INFO_STREAM_SND_BUFFER_SIZE_KB = 0 } Type of information in a QUIC stream.
Rcp_QuicErrorCode { RCP_QUIC_ERROR_CODE_SUCCESS, RCP_QUIC_PERMISSION_DENIED, RCP_QUIC_ERROR_CODE_FAILED, RCP_QUIC_ERROR_CODE_INVALID_PARAM, RCP_QUIC_ERROR_CODE_INVALID_STATE, RCP_QUIC_ERROR_CODE_OUT_OF_MEM, RCP_QUIC_ERROR_CODE_CLOSE_FROM_PEER, RCP_QUIC_ERROR_CODE_HANDSHAKE_TIMEOUT, RCP_QUIC_ERROR_CODE_NETWORK_IDLE_TIMEOUT, RCP_QUIC_ERROR_INVALID_FRAME, RCP_QUIC_ERROR_CODE_SEND_PENDING, RCP_QUIC_ERROR_CODE_FINALIZE_PENDING, RCP_QUIC_ERROR_CODE_NETWORK_UNREACHABLE, RCP_QUIC_ERROR_CODE_ENCRYPT_ERROR, RCP_QUIC_ERROR_CODE_BUFFER_TOO_SMALL, RCP_QUIC_ERROR_CODE_EAGAIN, RCP_QUIC_ERROR_CODE_STREAM_CLOSED, RCP_QUIC_ERROR_CODE_STREAM_RESET_RECEIVED, RCP_QUIC_ERROR_CODE_STREAM_STOP_SENDING_RECEIVED } Error code that may be reported for a QUIC request.
Rcp_QuicStreamDirection { RCP_QUIC_STREAM_BIDI = 0, RCP_QUIC_STREAM_UNI } QUIC stream direction type.
Rcp_QuicStreamShutdown { RCP_QUIC_STREAM_SHUTDOWN_READ = 1, RCP_QUIC_STREAM_SHUTDOWN_WRITE = 2 } Close operation type of a QUIC stream, which specifies whether to close the read or write direction.

[h2]Functions

Name Description
Rcp_Form * HMS_Rcp_CreateForm (void) Creates a simple form.
void HMS_Rcp_DestroyForm (Rcp_Form *form) Destroys a simple form.
uint32_t HMS_Rcp_SetFormValue (Rcp_Form *form, const char *key, const Rcp_FormFieldValue *value) Sets key-value pairs in a simple form.
Rcp_FormFieldValue * HMS_Rcp_GetFormValue (Rcp_Form *form, const char *key) Obtains a value based on a key from a simple form.
Rcp_MultipartForm * HMS_Rcp_CreateMultipartForm (void) Creates a multi-part form.
void HMS_Rcp_DestroyMultipartForm (Rcp_MultipartForm *multipartForm) Destroys a multi-part form.
uint32_t HMS_Rcp_SetMultipartFormValue (Rcp_MultipartForm *multipartForm, const char *key, const Rcp_MultipartFormFieldValue *value) Sets key-value pairs in a multi-part form.
Rcp_MultipartFormFieldValue * HMS_Rcp_GetMultipartFormValue (Rcp_MultipartForm *multipartForm, const char *key) Obtains a value based on a key from a multi-part form.
uint32_t HMS_Rcp_SetFormOrder (Rcp_Form *form, Rcp_FormOrder order) Sets the sequence in which key-value pairs in a form are sent.
uint32_t HMS_Rcp_SetMultipartFormOrder (Rcp_MultipartForm *multipartForm, Rcp_FormOrder order) Sets the sequence in which key-value pairs in a multi-part form are sent.
Rcp_Headers * HMS_Rcp_CreateHeaders (void) Creates a header for a request or response.
void HMS_Rcp_DestroyHeaders (Rcp_Headers *headers) Destroys the header of a request or response.
uint32_t HMS_Rcp_SetHeaderValue (Rcp_Headers *headers, const char *name, const char *value) Sets key-value pairs in a request or response header.
Rcp_HeaderValue * HMS_Rcp_GetHeaderValue (Rcp_Headers *headers, const char *name) Obtains a value based on a key from a request or response header.
Rcp_HeaderEntry * HMS_Rcp_GetHeaderEntries (Rcp_Headers *headers) Obtains all key-value pairs from an HTTP request or response header.
void HMS_Rcp_DestroyHeaderEntries (Rcp_HeaderEntry *headerEntry) Destroys all key-value pairs obtained in HMS_Rcp_GetHeaderEntries.
Rcp_Request * HMS_Rcp_CreateRequest (const char *url) Creates a request.
void HMS_Rcp_DestroyRequest (Rcp_Request *request) Destroys a request.
Rcp_RequestCookies * HMS_Rcp_CreateRequestCookies (void) Creates empty request cookies.
void HMS_Rcp_DestroyRequestCookies (Rcp_RequestCookies *cookies) Destroys request cookies.
uint32_t HMS_Rcp_SetRequestCookieValue (Rcp_RequestCookies *cookies, const char *name, const char *value) Sets request cookies.
char * HMS_Rcp_GetRequestCookieValue (Rcp_RequestCookies *cookies, const char *name) Obtains the request cookie value by name.
Rcp_RequestCookieEntry * HMS_Rcp_GetRequestCookieEntries (Rcp_RequestCookies *cookies) Obtains all key-value pairs from the request cookies.
void HMS_Rcp_DestroyRequestCookieEntries (Rcp_RequestCookieEntry *cookieEntry) Destroys all key-value pairs related to request cookies obtained from HMS_Rcp_GetRequestCookieValue.
const char * HMS_Rcp_GetResponseCookieAttrValue (Rcp_CookieAttributes *cookieAttributes, const char *name) Obtains the cookie attribute value by name.
Rcp_CookieAttributeEntry * HMS_Rcp_GetResponseCookieAttrEntries (Rcp_CookieAttributes *cookieAttributes) Obtains all response cookie attributes from Rcp_CookieAttributes.
void HMS_Rcp_DestroyResponseCookieAttrEntries (Rcp_CookieAttributeEntry *entries) Destroys response cookie attributes.
uint32_t HMS_Rcp_CallNextRequestHandler (Rcp_Request *request, const Rcp_RequestHandler *next, const Rcp_ResponseCallbackObject *responseCallback) Calls the next interceptor or the defaultHandler in Rcp_Interceptor.
Rcp_Response * HMS_Rcp_CallNextSyncRequestHandler (Rcp_Request *request, const Rcp_SyncRequestHandler *next, uint32_t *errCode) Calls the next interceptor or the default handler in Rcp_SyncInterceptor.
Rcp_Session * HMS_Rcp_CreateSession (const Rcp_SessionConfiguration *configuration, uint32_t *errCode) Creates a session.
const char * HMS_Rcp_GetSessionId (Rcp_Session *session) Obtains the session ID.
const Rcp_SessionConfiguration * HMS_Rcp_GetSessionConfiguration (Rcp_Session *session) Obtains the session configuration.
Rcp_Response * HMS_Rcp_FetchSync (Rcp_Session *session, Rcp_Request *request, uint32_t *errCode) Sends a synchronous request and obtains a response.
uint32_t HMS_Rcp_Fetch (Rcp_Session *session, Rcp_Request *request, const Rcp_ResponseCallbackObject *responseCallback) Sends an asynchronous request and obtains a response.
uint32_t HMS_Rcp_CancelRequest (Rcp_Session *session, const Rcp_Request *request) Cancels a request.
uint32_t HMS_Rcp_CancelSession (Rcp_Session *session) Cancels a session.
uint32_t HMS_Rcp_CloseSession (Rcp_Session **session) Closes a session.
uint32_t HMS_Rcp_SetRequestOnBinaryDataRecvCallback (Rcp_Request *request, Rcp_OnBinaryReceiveCallback onBinaryReceiveCallback) Sets a callback function for receiving binary data upon a request. The callback function works the same as Rcp_OnDataReceiveCallback in Rcp_Configuration. Once set, the callback function will replace Rcp_OnDataReceiveCallback configured in Rcp_Configuration.
uint32_t HMS_Rcp_SetRequestOnStatusCodeReceiveCallback (Rcp_Request *request, Rcp_OnStatusCodeReceiveCallback onStatusCodeReceiveCallback) Sets the callback function for receiving a response status code.
uint32_t HMS_Rcp_GetDefaultSession (Rcp_Session **session) Obtains the default session.
uint32_t HMS_Rcp_SetRequestConnectOnly (Rcp_Request *request, bool connectOnly) Configures the request to establish a connection only, without performing data transmission.
uint32_t HMS_Rcp_SetRequestGetDataCallback (Rcp_Request *request, Rcp_OnGetDataCallback getDataCallback) Sets the callback function for obtaining data.
Rcp_QuicErrorCode HMS_Rcp_QuicConnSetOpt (Rcp_QuicConn *conn, Rcp_QuicConnOpt opt, const void *optVal, uint32_t optLen) Sets QUIC connection options, including various parameters and callbacks.
Rcp_QuicErrorCode HMS_Rcp_QuicConnGetInfo (Rcp_QuicConn *conn, Rcp_QuicConnInfo info, void *infoVal, uint32_t *infoLen) Obtains QUIC connection information after a QUIC connection is successfully established.
Rcp_QuicErrorCode HMS_Rcp_QuicStreamSetOpt (Rcp_QuicConn *conn, uint64_t streamId, Rcp_QuicStreamOpt opt, const void *optVal, uint32_t optLen) Sets stream parameters for a QUIC connection.
Rcp_QuicErrorCode HMS_Rcp_QuicStreamGetInfo (Rcp_QuicConn *conn, uint64_t streamId, Rcp_QuicStreamInfo info, void *infoVal, uint32_t *infoLen) Obtains information about the stream corresponding to streamId in a QUIC connection.
Rcp_QuicSession * HMS_Rcp_QuicCreateSession () Creates a QUIC session object. A QUIC session can manage multiple QUIC connections.
void HMS_Rcp_QuicDestroySession (Rcp_QuicSession *session) Destroys a QUIC session object and releases relevant session resources.
Rcp_QuicConn * HMS_Rcp_QuicConnCreate (char *alpn, void *userObject) Creates a QUIC connection object.
Rcp_QuicErrorCode HMS_Rcp_QuicConnConnect (Rcp_QuicSession *session, Rcp_QuicConn *conn, const char *serverName, uint16_t port) Initiates a QUIC connection handshake. The handshake result is returned through the connection callback.
Rcp_QuicErrorCode HMS_Rcp_QuicConnDestroy (Rcp_QuicConn *conn) Destroys a QUIC connection object, and releases relevant connection resources.
Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamOpen (Rcp_QuicConn *conn, Rcp_QuicStreamDirection direction, uint64_t *streamId, void *userObject) Opens a QUIC stream in a QUIC connection only after the connection is successfully established.
Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamSend (Rcp_QuicConn *conn, uint64_t streamId, const Rcp_QuicIoVec *ioVec, uint32_t ioVecCount, bool fin) Sends data through a QUIC stream.
Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamWantRead (Rcp_QuicConn *conn, uint64_t streamId) Triggers the QUIC stream data reading callback.
Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamReset (Rcp_QuicConn *conn, uint64_t streamId, uint64_t appErr) Resets a QUIC stream immediately and discards all data that has not been sent or received.
Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamShutdown (Rcp_QuicConn *conn, uint64_t streamId, Rcp_QuicStreamShutdown flag, uint64_t appErr) Disables the read or write operation on the stream specified by streamId in a connection.
Rcp_QuicStreamDirection HMS_Rcp_QuicStreamGetDirection (uint64_t streamId) Obtains the QUIC stream direction type.
void HMS_Rcp_QuicFreeSlist (Rcp_QuicSlist *list) Releases all nodes and data in the Rcp_QuicSlist linked list.

Macro Description

[h2]RCP_HOST_MAX_LEN

#define RCP_HOST_MAX_LEN   256

Description

Maximum length of a host name.

Since: 5.0.0(12)

[h2]RCP_IP_MAX_LEN

#define RCP_IP_MAX_LEN   40

Description

Maximum length of an IP address.

Since: 5.0.0(12)

[h2]RCP_MAX_CONTENT_TYPE_LEN

#define RCP_MAX_CONTENT_TYPE_LEN   64

Description

Maximum length of the content type.

Since: 5.0.0(12)

[h2]RCP_MAX_FILENAME_LEN

#define RCP_MAX_FILENAME_LEN   128

Description

Maximum length of a file name.

Since: 5.0.0(12)

[h2]RCP_MAX_PATH_LEN

#define RCP_MAX_PATH_LEN   128

Description

Maximum path length.

Since: 5.0.0(12)

[h2]RCP_MAX_REQUEST_ID_LEN

#define RCP_MAX_REQUEST_ID_LEN   32

Description

Maximum length of a request ID.

Since: 5.0.0(12)

[h2]RCP_METHOD_DELETE

#define RCP_METHOD_DELETE   "DELETE"

Description

HTTP DELETE method.

Since: 5.0.0(12)

[h2]RCP_METHOD_GET

#define RCP_METHOD_GET   "GET"

Description

HTTP GET method.

Since: 5.0.0(12)

[h2]RCP_METHOD_HEAD

#define RCP_METHOD_HEAD   "HEAD"

Description

HTTP HEAD method.

Since: 5.0.0(12)

[h2]RCP_METHOD_OPTIONS

#define RCP_METHOD_OPTIONS   "OPTIONS"

Description

HTTP OPTIONS method.

Since: 5.0.0(12)

[h2]RCP_METHOD_PATCH

#define RCP_METHOD_PATCH   "PATCH"

Description

HTTP PATCH method.

Since: 5.0.0(12)

[h2]RCP_METHOD_POST

#define RCP_METHOD_POST   "POST"

Description

HTTP POST method.

Since: 5.0.0(12)

[h2]RCP_METHOD_PUT

#define RCP_METHOD_PUT   "PUT"

Description

HTTP PUT method.

Since: 5.0.0(12)

[h2]RCP_METHOD_TRACE

#define RCP_METHOD_TRACE   "TRACE"

Description

HTTP TRACE method.

Since: 5.0.0(12)

[h2]RCP_QUIC_IP_MAX_LEN

#define RCP_QUIC_IP_MAX_LEN   40

Description

Maximum length of an IP address in a QUIC connection.

Since: 26.0.0

Type Description

[h2]Rcp_AuthenticationType

typedef enum Rcp_AuthenticationType Rcp_AuthenticationType

Description

Enumeration type, which indicates the server identity verification type. If the type is not set, negotiation with the server is required.

Since: 5.0.0(12)

[h2]Rcp_Buffer

typedef struct Rcp_Buffer Rcp_Buffer

Description

Text storage struct.

Since: 5.0.0(12)

[h2]Rcp_CertificateAuthority

typedef struct Rcp_CertificateAuthority Rcp_CertificateAuthority

Description

CA used to verify the identity of a remote server.

Since: 5.0.0(12)

[h2]Rcp_CertType

typedef enum Rcp_CertType Rcp_CertType

Description

Client certificate type.

Since: 5.0.0(12)

[h2]Rcp_ClientCertificate

typedef struct Rcp_ClientCertificate Rcp_ClientCertificate

Description

Client certificate sent to a remote server, which will be used by the server to verify the identity of the client.

Since: 5.0.0(12)

[h2]Rcp_Configuration

typedef struct Rcp_Configuration Rcp_Configuration

Description

Request configuration.

Since: 5.0.0(12)

[h2]Rcp_ConnectionConfiguration

typedef struct Rcp_ConnectionConfiguration Rcp_ConnectionConfiguration

Description

Connection configuration.

Since: 5.0.0(12)

[h2]Rcp_ContentOrPathOrCallback

typedef struct Rcp_ContentOrPathOrCallback Rcp_ContentOrPathOrCallback

Description

Simple form data field value used in Rcp_FormFieldFileValue.

Since: 5.0.0(12)

[h2]Rcp_ContentOrPathOrCallbackType

typedef enum Rcp_ContentOrPathOrCallbackType Rcp_ContentOrPathOrCallbackType

Description

Content, path, or callback type, which is used to distinguish the data used in Rcp_ContentOrPathOrCallback.

Since: 5.0.0(12)

[h2]Rcp_ContentType

typedef enum Rcp_ContentType Rcp_ContentType

Description

Content type in Rcp_RequestContent.

Since: 5.0.0(12)

[h2]Rcp_CookieAttributeEntry

typedef struct Rcp_CookieAttributeEntry Rcp_CookieAttributeEntry

Description

Response cookie attribute entry.

Since: 5.0.0(12)

[h2]Rcp_CookieAttributes

typedef struct Rcp_CookieAttributes Rcp_CookieAttributes

Description

Cookie attribute type in Rcp_Response.

Since: 5.0.0(12)

[h2]Rcp_Credential

typedef struct Rcp_Credential Rcp_Credential

Description

Credential used for server identity verification, including the user name and password.

Since: 5.0.0(12)

[h2]Rcp_DebugEvent

typedef enum Rcp_DebugEvent Rcp_DebugEvent

Description

Debugging event type.

Since: 5.0.0(12)

[h2]Rcp_DebugInfo

typedef struct Rcp_DebugInfo Rcp_DebugInfo

Description

Structure of the debugging information stored in Rcp_Response.

Since: 5.0.0(12)

[h2]Rcp_DnsConfiguration

typedef struct Rcp_DnsConfiguration Rcp_DnsConfiguration

Description

DNS resolution configuration.

Since: 5.0.0(12)

[h2]Rcp_DnsOverHttps

typedef struct Rcp_DnsOverHttps Rcp_DnsOverHttps

Description

DNS over HTTPS. If this information is configured, addresses resolved by the DOH DNS server will be preferred.

Since: 5.0.0(12)

[h2]Rcp_DnsRule

typedef struct Rcp_DnsRule Rcp_DnsRule

Description

DNS rule configuration.

Since: 5.0.0(12)

[h2]Rcp_DnsRuleType

typedef enum Rcp_DnsRuleType Rcp_DnsRuleType

Description

DNS rule type in Rcp_DnsRule.

Since: 5.0.0(12)

[h2]Rcp_DnsServers

typedef struct Rcp_DnsServers Rcp_DnsServers

Description

DNS server, which is one of the types defined in Rcp_DnsConfiguration.dnsRules.

Since: 5.0.0(12)

[h2]Rcp_DynamicDnsRuleFunction

typedef Rcp_IpAddress*(* Rcp_DynamicDnsRuleFunction) (const char *host, uint16_t port)

Description

Function that can directly return an IP address based on the host name and port number. It is used for dynamic DNS resolution.

Since: 5.0.0(12)

Parameters:

Name Description
host Host name.
port Port number.

Returns:

Rcp_IpAddress*: pointer to Rcp_IpAddress. The IP address is matched based on the host name and port number.

[h2]Rcp_EventsHandler

typedef struct Rcp_EventsHandler Rcp_EventsHandler

Description

Callback function for listening for various HTTP events.

Since: 5.0.0(12)

[h2]Rcp_ExclusionFunction

typedef bool(* Rcp_ExclusionFunction) (const char *url)

Description

Pointer to the function for determining whether a host uses a proxy. The value true indicates that a proxy is used, and the value false indicates that no proxy is used.

Since: 5.0.0(12)

Parameters:

Name Description
url URL of a request.

Returns:

A Boolean value indicating that whether to use a proxy server. The options are true (yes) and false (no).

[h2]Rcp_Exclusions

typedef struct Rcp_Exclusions Rcp_Exclusions

Description

URLs excluded from proxy processing.

If Rcp_Request.url matches a pattern defined in Rcp_Exclusions, Rcp_Request will not go through proxy processing.

Since: 5.0.0(12)

[h2]Rcp_ExclusionsValueType

typedef enum Rcp_ExclusionsValueType Rcp_ExclusionsValueType

Description

Data type in Rcp_Exclusions.

Since: 5.0.0(12)

[h2]Rcp_Form

typedef struct Rcp_Form Rcp_Form

Description

Simple form data.

Since: 5.0.0(12)

[h2]Rcp_FormFieldFileValue

typedef struct Rcp_FormFieldFileValue Rcp_FormFieldFileValue

Description

Form field file value.

Since: 5.0.0(12)

[h2]Rcp_FormFieldValue

typedef struct Rcp_FormFieldValue Rcp_FormFieldValue

Description

Simple form data field value. For details, please refer to Rcp_Form and Rcp_MultipartFormFieldValue.

Since: 5.0.0(12)

[h2]Rcp_FormValueType

typedef enum Rcp_FormValueType Rcp_FormValueType

Description

Form value type.

Since: 5.0.0(12)

[h2]Rcp_GetDataCallback

typedef int(* Rcp_GetDataCallback) (char *out, uint32_t size)

Description

Data obtained through a callback function. This callback is used when the API needs to send the next part of the data to the server.

This callback function can be used in Rcp_FormFieldFileValue.contentOrPathOrCb and Rcp_RequestContent.

Since: 5.0.0(12)

Parameters:

Name Description
out Output data.
size Data size.

Returns:

-1 if an error occurs and 0 if the transmission stops. The return value is an integer.

[h2]Rcp_HeaderEntry

typedef struct Rcp_HeaderEntry Rcp_HeaderEntry

Description

All key-value pairs in the request or response header.

Since: 5.0.0(12)

[h2]Rcp_Headers

typedef struct Rcp_Headers Rcp_Headers

Description

Header of a request or response.

Since: 5.0.0(12)

[h2]Rcp_HeaderValue

typedef struct Rcp_HeaderValue Rcp_HeaderValue

Description

Value type of a mapped value in a request or response header.

Since: 5.0.0(12)

[h2]Rcp_InfoToCollect

typedef struct Rcp_InfoToCollect Rcp_InfoToCollect

Description

Request processing events to be collected. You can check the response object for collected events.

Since: 5.0.0(12)

[h2]Rcp_Interceptor

typedef struct Rcp_Interceptor Rcp_Interceptor

Description

Asynchronous interceptor.

Since: 5.0.0(12)

[h2]Rcp_InterceptorArray

typedef struct Rcp_InterceptorArray Rcp_InterceptorArray

Description

Asynchronous interceptor array.

Since: 5.0.0(12)

[h2]Rcp_IpAddress

typedef struct Rcp_IpAddress Rcp_IpAddress

Description

IP address group used by the static DNS rule Rcp_StaticDnsRuleItem.

Since: 5.0.0(12)

[h2]Rcp_IpAndPort

typedef struct Rcp_IpAndPort Rcp_IpAndPort

Description

IP address and port number of a DNS server, which will be used in Rcp_DnsServers.

Since: 5.0.0(12)

[h2]Rcp_MultipartForm

typedef struct Rcp_MultipartForm Rcp_MultipartForm

Description

Multi-part form data.

Since: 5.0.0(12)

[h2]Rcp_MultipartFormFieldValue

typedef struct Rcp_MultipartFormFieldValue Rcp_MultipartFormFieldValue

Description

Multi-part form field value, which will be used in Rcp_MultipartForm.

Since: 5.0.0(12)

[h2]Rcp_MultipartValueType

typedef enum Rcp_MultipartValueType Rcp_MultipartValueType

Description

Multi-part form value type, which is used to distinguish the data used in Rcp_MultipartFormFieldValue.

Since: 5.0.0(12)

[h2]Rcp_OnDataReceiveCallback

typedef struct Rcp_OnDataReceiveCallback Rcp_OnDataReceiveCallback

Description

Callback triggered upon data receiving events, which is configured in Rcp_EventsHandler.

Since: 5.0.0(12)

[h2]Rcp_OnDataReceiveCallbackFunc

typedef size_t(* Rcp_OnDataReceiveCallbackFunc) (void *usrObject, const char *data)

Description

Callback function triggered when a response body is returned.

Since: 5.0.0(12)

Parameters:

Name Description
usrObject Custom object.
data Response body.

Returns:

size_t, which indicates the length of the response body.

[h2]Rcp_OnBinaryReceiveCallback

typedef struct Rcp_OnBinaryReceiveCallback Rcp_OnBinaryReceiveCallback

Description

Callback function for receiving binary data in a response.

Since: 5.0.1(13)

[h2]Rcp_OnBinaryReceiveCallbackFunc

typedef size_t(* Rcp_OnBinaryReceiveCallbackFunc) (void *usrObject, Rcp_Buffer *buffer)

Description

Defines the binary data callback function triggered when a response body is returned. The callback point is the same as Rcp_OnDataReceiveCallback in Rcp_Configuration. If the callback function is configured, it will substitute Rcp_OnDataReceiveCallback configured in Rcp_Configuration for receiving data of the character type.

Since: 5.0.1(13)

Parameters:

Name Description
usrObject Custom object.
buffer Binary data in the response body.

Returns:

size_t, which indicates length of the binary data in the response body.

[h2]Rcp_OnStatusCodeReceiveCallback

typedef struct Rcp_OnStatusCodeReceiveCallback Rcp_OnStatusCodeReceiveCallback

Description

Callback function used to receive a response status code.

Since: 6.0.1(21)

[h2]Rcp_OnStatusCodeReceiveCallbackFunc

typedef void (*Rcp_OnStatusCodeReceiveCallbackFunc) (void *usrObject, uint32_t statusCode)

Description

Callback function triggered when a response status code is returned.

Since: 6.0.1(21)

Parameters:

Name Description
usrObject Custom object.
statusCode Response status code.

[h2]Rcp_OnHeaderReceiveCallback

typedef struct Rcp_OnHeaderReceiveCallback Rcp_OnHeaderReceiveCallback

Description

Callback triggered upon header receiving events, which is configured in Rcp_EventsHandler.

Since: 5.0.0(12)

[h2]Rcp_OnHeaderReceiveCallbackFunc

typedef void(* Rcp_OnHeaderReceiveCallbackFunc) (void *usrObject, Rcp_Headers *headers)

Description

Callback function triggered when all requests are received.

Since: 5.0.0(12)

Parameters:

Name Description
usrObject Custom object.
headers Received request header, which points to Rcp_Headers.

[h2]Rcp_OnProgressCallback

typedef struct Rcp_OnProgressCallback Rcp_OnProgressCallback

Description

Callback triggered upon data transmission events, which is configured in Rcp_EventsHandler.

Since: 5.0.0(12)

[h2]Rcp_OnProgressCallbackFunc

typedef void(* Rcp_OnProgressCallbackFunc) (void *usrObject, uint64_t totalSize, uint64_t transferredSize)

Description

Callback function triggered during request/response data transmission.

Since: 5.0.0(12)

Parameters:

Name Description
usrObject Custom object.
totalSize Total data size.
transferredSize Size of transferred data.

[h2]Rcp_OnVoidCallback

typedef struct Rcp_OnVoidCallback Rcp_OnVoidCallback

Description

Callback triggered upon transmigration ending or cancellation events, which is configured in Rcp_EventsHandler.

Since: 5.0.0(12)

[h2]Rcp_OnVoidCallbackFunc

typedef void(* Rcp_OnVoidCallbackFunc) (void *usrObject)

Description

Callback function for listening on DataEnd and Canceled events of requests.

Since: 5.0.0(12)

Parameters:

Name Description
usrObject Custom object.

[h2]Rcp_PathPreference

typedef enum Rcp_PathPreference Rcp_PathPreference

Description

Request path preferences.

The configuration is only for system reference and the final path is determined by the system.

Since: 5.0.0(12)

[h2]Rcp_ProxyConfiguration

typedef struct Rcp_ProxyConfiguration Rcp_ProxyConfiguration

Description

Proxy configuration.

Since: 5.0.0(12)

[h2]Rcp_ProxyTunnelMode

typedef enum Rcp_ProxyTunnelMode Rcp_ProxyTunnelMode

Description

Indicates when a proxy tunnel needs to be established. Tunneling, or tunnel transmission, is a process where an HTTP CONNECT request is sent to a proxy server, instructing it to establish a connection to the remote host of a specified port number. Once this connection is set up, all subsequent traffic is routed through the proxy. The value auto indicates that a tunnel will be created for HTTPS traffic but not for HTTP traffic. The value always indicates that tunneling is enabled for all traffic.

Since: 5.0.0(12)

[h2]Rcp_ProxyType

typedef enum Rcp_ProxyType Rcp_ProxyType

Description

Proxy type, which will be used to determine which proxy configuration will be used.

Since: 5.0.0(12)

[h2]Rcp_RemoteValidationType

typedef enum Rcp_RemoteValidationType Rcp_RemoteValidationType

Description

Remote server validation type.

It is used to specify the CA used to verify the identity of the remote server and is described in Rcp_SecurityConfiguration.

Since: 5.0.0(12)

[h2]Rcp_Request

typedef struct Rcp_Request Rcp_Request

Description

Network request.

Since: 5.0.0(12)

[h2]Rcp_FormOrder

typedef struct Rcp_FormOrder Rcp_FormOrder

Description

Sequence in which key-value pairs in the form are sent.

Since: 26.0.0

[h2]Rcp_RequestContent

typedef struct Rcp_RequestContent Rcp_RequestContent

Description

Request content.

Since: 5.0.0(12)

[h2]Rcp_RequestCookieEntry

typedef struct Rcp_RequestCookieEntry Rcp_RequestCookieEntry

Description

All cookie key-value pairs in the request.

Since: 5.0.0(12)

[h2]Rcp_RequestCookies

typedef struct Rcp_RequestCookies Rcp_RequestCookies

Description

Request cookies.

You can specify all cookies you need in an object, for example, {'name1':'value1','name2':'value2'}.

Since: 5.0.0(12)

[h2]Rcp_RequestHandler

typedef struct Rcp_RequestHandler Rcp_RequestHandler

Description

Asynchronous handler associated with Rcp_Interceptor.

Since: 5.0.0(12)

[h2]Rcp_Response

typedef struct Rcp_Response Rcp_Response

Description

Response to a network request.

Since: 5.0.0(12)

[h2]Rcp_ResponseCallback

typedef void(* Rcp_ResponseCallback) (void *usrCtx, Rcp_Response *response, uint32_t errCode)

Description

Pointer to the response callback function.

Since: 5.0.0(12)

Parameters:

Name Description
usrCtx User context.
response Response to the request, which points to Rcp_Response.
errCode

[out]: common error codes.

0: Successful.

1007900001: Unsupported protocol.

1007900003: Invalid URL format or missing URL.

1007900005: Unable to resolve the proxy name.

1007900006: Unable to resolve the host name.

1007900007: Unable to connect to the server.

1007900008: Abnormal server response.

1007900009: Access to a remote resource was rejected.

1007900016: An HTTP/2-frame error occurred.

1007900018: A part of the file has been transmitted.

1007900025: Upload failed.

1007900026: Failed to open or read local data from a file or app.

1007900027: Insufficient memory.

1007900028: The timeout interval has expired.

1007900047: The number of redirections has reached the maximum.

1007900052: No data returned from the server.

1007900055: Failed to send data to the peer.

1007900056: Failed to receive data from the peer.

1007900058: Invalid local SSL certificate.

1007900059: Unable to use the specified SSL key.

1007900060: The SSL peer certificate or SSH remote key is invalid.

1007900061: The HTTP content or transport encoding cannot be identified or is incorrect.

1007900063: The file size exceeded the maximum.

1007900070: The disk is full or the allocated quota is used up.

1007900073: The remote file already exists.

1007900077: Invalid SSL CA certificate .

1007900078: Cannot find the remote file.

1007900992: The request has been canceled.

1007900993: The session is closed or invalid.

1007900094: The identity verification function returned an error.

1007900201: Plaintext transmission is not allowed. This error code is supported since version 6.1.0(23).

1007900995: Failed to obtain the system proxy.

1007900996: The proxy type is not supported.

1007900997: Invalid content type.

1007900998: The method is not supported.

1007900999: Internal error.

Other error codes are in the format of 1007900000 + Curl error code. For more error codes, please refer to Curl error codes.

[h2]Rcp_ResponseCallbackObject

typedef struct Rcp_ResponseCallbackObject Rcp_ResponseCallbackObject

Description

Response callback struct.

Since: 5.0.0(12)

[h2]Rcp_ResponseCookies

typedef struct Rcp_ResponseCookies Rcp_ResponseCookies

Description

Response cookies.

Since: 5.0.0(12)

[h2]Rcp_SecurityConfiguration

typedef struct Rcp_SecurityConfiguration Rcp_SecurityConfiguration

Description

Request security configuration.

Since: 5.0.0(12)

[h2]Rcp_ServerAuthentication

typedef struct Rcp_ServerAuthentication Rcp_ServerAuthentication

Description

Server identity verification information.

Since: 5.0.0(12)

[h2]Rcp_Session

typedef struct Rcp_Session Rcp_Session

Description

Session.

Since: 5.0.0(12)

[h2]Rcp_SessionConfiguration

typedef struct Rcp_SessionConfiguration Rcp_SessionConfiguration

Description

Session configuration.

Since: 5.0.0(12)

[h2]Rcp_SessionListener

typedef struct Rcp_SessionListener Rcp_SessionListener

Description

Callback function for listening on session closing or cancellation events.

Since: 5.0.0(12)

[h2]Rcp_SessionType

typedef enum Rcp_SessionType Rcp_SessionType

Description

Session type.

Since: 5.0.0(12)

[h2]Rcp_StaticDnsRule

typedef struct Rcp_StaticDnsRule Rcp_StaticDnsRule

Description

Static DNS rule.

Since: 5.0.0(12)

[h2]Rcp_StaticDnsRuleItem

typedef struct Rcp_StaticDnsRuleItem Rcp_StaticDnsRuleItem

Description

Description about a single static DNS rule.

Since: 5.0.0(12)

[h2]Rcp_StatusCode

typedef enum Rcp_StatusCode Rcp_StatusCode

Description

Status code of the request response.

Since: 5.0.0(12)

[h2]Rcp_SyncInterceptor

typedef struct Rcp_SyncInterceptor Rcp_SyncInterceptor

Description

Synchronous interceptor.

Since: 5.0.0(12)

[h2]Rcp_SyncInterceptorArray

typedef struct Rcp_SyncInterceptorArray Rcp_SyncInterceptorArray

Description

Synchronous interceptor array.

Since: 5.0.0(12)

[h2]Rcp_SyncRequestHandler

typedef struct Rcp_SyncRequestHandler Rcp_SyncRequestHandler

Description

Synchronous handler associated with Rcp_SyncInterceptor.

Since: 5.0.0(12)

[h2]Rcp_TimeInfo

typedef struct Rcp_TimeInfo Rcp_TimeInfo

Description

Response timer information.

It will be collected in Rcp_Response.timeInfo. Rcp_TracingConfiguration.collectTimeInfo specifies whether to collect the information.

Since: 5.0.0(12)

[h2]Rcp_Timeout

typedef struct Rcp_Timeout Rcp_Timeout

Description

Request timeout configuration.

Since: 5.0.0(12)

[h2]Rcp_TracingConfiguration

typedef struct Rcp_TracingConfiguration Rcp_TracingConfiguration

Description

Request tracing configuration.

Since: 5.0.0(12)

[h2]Rcp_TransferConfiguration

typedef struct Rcp_TransferConfiguration Rcp_TransferConfiguration

Description

Transmission configuration.

Since: 5.0.0(12)

[h2]Rcp_TransferRange

typedef struct Rcp_TransferRange Rcp_TransferRange

Description

HTTP transmission range. This configuration will be converted into the HTTP Range header. An HTTP request with such a header requires the server to return only a part of the HTTP response.

Since: 5.0.0(12)

[h2]Rcp_Urls

typedef struct Rcp_Urls Rcp_Urls

Description

URLs, which are used to determine whether a host is using a proxy.

Since: 5.0.0(12)

[h2]Rcp_WebProxy

typedef struct Rcp_WebProxy Rcp_WebProxy

Description

Custom proxy configuration.

Since: 5.0.0(12)

[h2]Rcp_OnGetDataCallback

typedef struct Rcp_OnGetDataCallback  Rcp_OnGetDataCallback

Description

Callback used to obtain data.

Since: 26.0.0

[h2]Rcp_GetDataCallbackFunc

typedef size_t(* Rcp_GetDataCallbackFunc) (void *userObject, uint8_t *outData, size_t size)

Description

Callback function used to obtain data.

Since: 26.0.0

Parameters:

Name Description
userObject Custom object.
outData Buffer for outputting data.
size Buffer length.

Returns:

Length of the data to be sent (size_t).

[h2]Rcp_QuicConn

typedef void Rcp_QuicConn

Description

Type of a QUIC connection instance.

Since: 26.0.0

[h2]Rcp_QuicSession

typedef void Rcp_QuicSession

Description

Type of a QUIC session, which can manage multiple connection instances.

Since: 26.0.0

[h2]Rcp_QuicSlist

typedef struct Rcp_QuicSlist Rcp_QuicSlist

Description

Data structure of linked list data.

Since: 26.0.0

[h2]Rcp_QuicIpAddress

typedef struct Rcp_QuicIpAddress Rcp_QuicIpAddress

Description

Data structure used to store IP addresses.

Since: 26.0.0

[h2]Rcp_QuicDynamicDnsRuleFunction

typedef Rcp_QuicIpAddress (*Rcp_QuicDynamicDnsRuleFunction)(Rcp_QuicConn *conn, void *userObject, const char *host, uint16_t port)

Description

Custom DNS resolution callback function, which returns the IP address based on the host name and port number.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
host Host name in the request.
port Port number in the request.

Returns:

Rcp_QuicIpAddress, which indicates the IP address resolved based on the host name and port number.

[h2]Rcp_QuicIoVec

typedef struct Rcp_QuicIoVec Rcp_QuicIoVec

Description

Data structure used to store binary content.

Since: 26.0.0

[h2]Rcp_QuicStreamData

typedef struct Rcp_QuicStreamData Rcp_QuicStreamData

Description

Storage structure used to receive streaming data in a QUIC connection.

Since: 26.0.0

[h2]Rcp_QuicConnectionOnCertAuthority

typedef Rcp_QuicErrorCode (*Rcp_QuicConnectionOnCertAuthority)(Rcp_QuicConn *conn, void *userObject, const unsigned char *const *certs, const size_t *certLens, size_t certsCount)

Description

Certificate verification callback function, which is used for custom verification of the peer end's certificate during QUIC connection establishment.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
certs X.509 certificates, in DER format.
certLens Array of certificate lengths.
certsCount Number of certificates.

Returns:

Rcp_QuicErrorCode: custom certificate verification result. If the value is RCP_QUIC_ERROR_CODE_SUCCESS, the verification is successful. Other values indicate that the verification fails.

[h2]Rcp_QuicConnectionOnSessionTicketUpdate

typedef void (*Rcp_QuicConnectionOnSessionTicketUpdate)(Rcp_QuicConn *conn, void *userObject, const char *sessionTicket, size_t length)

Description

QUIC session ticket update callback function, which is triggered when the ticket is updated in a QUIC session, returning the new ticket.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
sessionTicket Content of a QUIC session ticket.
length Length of the session ticket.

[h2]Rcp_QuicConnectionOnConnected

typedef void (*Rcp_QuicConnectionOnConnected)(Rcp_QuicConn *conn, void *userObject)

Description

QUIC connection success callback function, which is triggered when a QUIC connection is successfully established.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.

[h2]Rcp_QuicConnectionOnError

typedef void (*Rcp_QuicConnectionOnError)(Rcp_QuicConn *conn, void *userObject, Rcp_QuicErrorCode errCode, const char *errDetail)

Description

QUIC connection failure callback function, which is triggered when a QUIC connection fails to be established, returning the failure cause.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
errCode Error code indicating that a QUIC connection fails to be established.
errDetail Error details.

[h2]Rcp_QuicConnectionOnClosed

typedef void (*Rcp_QuicConnectionOnClosed)(Rcp_QuicConn *conn, void *userObject)

Description

QUIC connection close callback function, which is triggered when a QUIC connection is closed, returning a notification.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.

[h2]Rcp_QuicConnectionOnStreamInbound

typedef void (*Rcp_QuicConnectionOnStreamInbound)(Rcp_QuicConn *conn, void *userObject, uint64_t streamId)

Description

QUIC inbound stream callback function, which is triggered when the peer end creates a stream in a QUIC connection. It handles the stream and sets the stream options and callback.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
streamId ID of an inbound stream.

[h2]Rcp_QuicStreamOnEvent

typedef void (*Rcp_QuicStreamOnEvent)(Rcp_QuicConn *conn, void *userObject, uint64_t streamId, Rcp_QuicErrorCode errCode, const char *errDetail)

Description

QUIC stream event callback function, which is triggered when an event occurs in a stream in a QUIC connection. It handles the stream status change and errors.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
streamId ID of an inbound stream.
errCode Error code indicating that a QUIC connection fails to be established.
errDetail Error details.

[h2]Rcp_QuicStreamOnReceiveData

typedef uint64_t (*Rcp_QuicStreamOnReceiveData)(Rcp_QuicConn *conn, void *userObject, uint64_t streamId, const Rcp_QuicStreamData *streamData)

Description

QUIC stream data receiving callback function, which is triggered when stream data is received in a QUIC connection. It processes the received data.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
userObject Custom object.
streamId ID of a QUIC stream.
streamData QUIC stream data.

Returns:

uint64_t: number of bytes received in a QUIC stream.

Enum Description

[h2]Rcp_AuthenticationType

enum Rcp_AuthenticationType

Description

Enumeration type, which indicates the server identity verification type. If the type is not set, negotiation with the server is required.

Since: 5.0.0(12)

Enumerated Value Description
RCP_AUTHENTICATION_AUTO Automatic.
RCP_AUTHENTICATION_BASIC Basic.
RCP_AUTHENTICATION_NTLM NTLM.
RCP_AUTHENTICATION_DIGEST DIGEST.

[h2]Rcp_CertType

enum Rcp_CertType

Description

Client certificate type.

Since: 5.0.0(12)

Enumerated Value Description
RCP_CERT_PEM PEM certificate.
RCP_CERT_DER DER certificate.
RCP_CERT_P12 P12 certificate.

[h2]Rcp_ContentOrPathOrCallbackType

enum Rcp_ContentOrPathOrCallbackType

Description

Content, path, or callback type, which is used to distinguish the data used in Rcp_ContentOrPathOrCallback.

Since: 5.0.0(12)

Enumerated Value Description
RCP_FILE_VALUE_TYPE_CONTENT Content.
RCP_FILE_VALUE_TYPE_PATH Path.
RCP_FILE_VALUE_TYPE_CALLBACK Callback.

[h2]Rcp_ContentType

enum Rcp_ContentType

Description

Content type in Rcp_RequestContent.

Since: 5.0.0(12)

Enumerated Value Description
RCP_CONTENT_TYPE_STRING Text.
RCP_CONTENT_TYPE_FORM Simple form.
RCP_CONTENT_TYPE_MULTIPARTFORM Multi-part form.
RCP_CONTENT_TYPE_GETCALLBACK Callback function.

[h2]Rcp_DebugEvent

enum Rcp_DebugEvent

Description

Debugging event type.

Since: 5.0.0(12)

Enumerated Value Description
RCP_DEBUG_EVENT_TEXT Text event.
RCP_DEBUG_EVENT_HEADER_IN Header transfer-in event.
RCP_DEBUG_EVENT_HEADER_OUT Header transfer-out event.
RCP_DEBUG_EVENT_DATA_IN Data transfer-in event.
RCP_DEBUG_EVENT_DATA_OUT Data transfer-out event.
RCP_DEBUG_EVENT_SSL_DATA_IN SSL/TLS transfer-in event.
RCP_DEBUG_EVENT_SSL_DATA_OUT SSL/TLS transfer-out event.

[h2]Rcp_DnsRuleType

enum Rcp_DnsRuleType

Description

DNS rule type in Rcp_DnsRule.

Since: 5.0.0(12)

Enumerated Value Description
RCP_DNS_RULE_DNS_SERVERS DNS server.
RCP_DNS_RULE_STATIC Static DNS rule.
RCP_DNS_RULE_DYNAMIC Dynamic DNS rule.

[h2]Rcp_ExclusionsValueType

enum Rcp_ExclusionsValueType

Description

Data type in Rcp_Exclusions.

Since: 5.0.0(12)

Enumerated Value Description
RCP_EXCLUSION_USE_URL_ARRAY URLs are used in Rcp_Exclusions.
RCP_EXCLUSION_USE_CALLBACK The callback function Rcp_ExclusionFunction is used in Rcp_Exclusions.

[h2]Rcp_FormValueType

enum Rcp_FormValueType

Description

Form value type.

Since: 5.0.0(12)

Enumerated Value Description
RCP_FORM_VALUE_TYPE_INT32 Int32 data.
RCP_FORM_VALUE_TYPE_INT64 Int64 data.
RCP_FORM_VALUE_TYPE_BOOL Boolean value.
RCP_FORM_VALUE_TYPE_STRING String.
RCP_FORM_VALUE_TYPE_DOUBLE Double value.

[h2]Rcp_MultipartValueType

enum Rcp_MultipartValueType

Description

Multi-part form value type, which is used to distinguish the data used in Rcp_MultipartFormFieldValue.

Since: 5.0.0(12)

Enumerated Value Description
RCP_TYPE_FORM_FIELD_VALUE Rcp_FormFieldValue.
RCP_TYPE_FORM_FIELD_FILE_VALUE Rcp_FormFieldFileValue.

[h2]Rcp_PathPreference

enum Rcp_PathPreference

Description

Request path preferences.

The configuration is only for system reference and the final path is determined by the system.

Since: 5.0.0(12)

Enumerated Value Description
RCP_PATH_PREFERENCE_AUTO Automatic.
RCP_PATH_PREFERENCE_WIFI Wi-Fi network preferred.
RCP_PATH_PREFERENCE_CELLULAR Cellular network preferred.

[h2]Rcp_ProxyTunnelMode

enum Rcp_ProxyTunnelMode

Description

Indicates when a proxy tunnel needs to be established. Tunneling, or tunnel transmission, is a process where an HTTP CONNECT request is sent to a proxy server, instructing it to establish a connection to the remote host of a specified port number. Once this connection is set up, all subsequent traffic is routed through the proxy. The value auto indicates that a tunnel will be created for HTTPS traffic but not for HTTP traffic. The value always indicates that tunneling is enabled for all traffic.

Since: 5.0.0(12)

Enumerated Value Description
RCP_PROXY_TUNNEL_AUTO Automatic.
RCP_PROXY_TUNNEL_ALWAYS Tunneling is enabled for all traffic.

[h2]Rcp_ProxyType

enum Rcp_ProxyType

Description

Proxy type, which will be used to determine which proxy configuration will be used.

Since: 5.0.0(12)

Enumerated Value Description
RCP_PROXY_SYSTEM System proxy.
RCP_PROXY_CUSTOM Custom proxy. If this option is selected, Rcp_ProxyConfiguration.customProxy will be resolved.
RCP_PROXY_NO_PROXY No proxy.

[h2]Rcp_RemoteValidationType

enum Rcp_RemoteValidationType

Description

Remote server validation type.

It is used to specify the CA used to verify the identity of the remote server and is described in Rcp_SecurityConfiguration.

Since: 5.0.0(12)

Enumerated Value Description
RCP_REMOTE_VALIDATION_SYSTEM System verification.
RCP_REMOTE_VALIDATION_SKIP Verification skipped.
RCP_REMOTE_VALIDATION_CERTIFICATE_AUTHORITY CA verification.

[h2]Rcp_SessionType

enum Rcp_SessionType

Description

Session type.

Since: 5.0.0(12)

Enumerated Value Description
RCP_SESSION_TYPE_HTTP = 0 HTTP session.
RCP_SESSION_TYPE_MAX = 100 Session represented by the maximum value of Rcp_SessionType.

[h2]Rcp_StatusCode

enum Rcp_StatusCode

Description

Status code of the request response.

Since: 5.0.0(12)

Enumerated Value Description
RCP_NONE = 0 This value is used by default.
RCP_OK = 200 The request is successful.
RCP_CREATED = 201 The request has been successfully sent and a new resource is created.
RCP_ACCEPTED = 202 The request has been received but has not been processed.
RCP_NOT_AUTHORITATIVE = 203 The returned information is not authoritative.
RCP_NO_CONTENT = 204 The request is successful, but no content is returned.
RCP_RESET= 205 The request has been successfully processed, but the content needs to be reset.
RCP_PARTIAL = 206 Partial content is requested successfully.
RCP_MULTI_CHOICE = 300 The server supports multiple handling types for the request.
RCP_MOVED_PERMANENTLY = 301 The resource is moved permanently.
RCP_MOVED_TEMPORARILY = 302 The resource is moved temporarily.
RCP_SEE_OTHER = 303 Retrieve the content from another location.
RCP_NOT_MODIFIED = 304 The resource is not modified.
RCP_USE_PROXY = 305 The requested resource can only be accessed through the proxy.
RCP_BAD_REQUEST = 400 Request syntax error.
RCP_UNAUTHORIZED = 401 Permission not granted.
RCP_PAYMENT_REQUIRED = 402 A payment is required.
RCP_FORBIDDEN = 403 Access denied.
RCP_NOT_FOUND = 404 The resource is not found.
RCP_BAD_METHOD = 405 The method is not allowed.
RCP_NOT_ACCEPTABLE = 406 Not acceptable.
RCP_PROXY_AUTH = 407 Proxy authorization is required.
RCP_CLIENT_TIMEOUT = 408 Request timeout.
RCP_CONFLICT = 409 A conflict occurred.
RCP_GONE = 410 The resource has been permanently deleted.
RCP_LENGTH_REQUIRED = 411 A valid length is required.
RCP_PRECON_FAILED = 412 Prerequisites are not met.
RCP_ENTITY_TOO_LARGE = 413 The request entity is too large.
RCP_REQ_TOO_LONG = 414 The request URI is too long.
RCP_UNSUPPORTED_TYPE = 415 Unsupported media type.
RCP_INTERNAL_ERROR = 500 Internal server error.
RCP_NOT_IMPLEMENTED = 501 Not implemented yet.
RCP_BAD_GATEWAY = 502 Gateway error.
RCP_UNAVAILABLE = 503 Service unavailable.
RCP_GATEWAY_TIMEOUT = 504 The gateway timed out.
RCP_VERSION = 505 Unsupported HTTP version.

[h2]RCP_QuicIpResolve

enum RCP_QuicIpResolve

Description

IP address resolution type used for DNS requests.

Since: 26.0.0

Enumerated Value Description
RCP_QUIC_IP_RESOLVE_WHATEVER = 0 IPv4 or IPv6 address. This value is used by default.
RCP_QUIC_IP_RESOLVE_V4 IPv4 address only.
RCP_QUIC_IP_RESOLVE_V6 IPv6 address only.

[h2]Rcp_QuicConnOpt

enum Rcp_QuicConnOpt

Description

QUIC connection option type, which is used to configure connection parameters and callbacks.

Since: 26.0.0

Enumerated Value Description
RCP_QUIC_CONN_IP_ADDRESS = 0 IP address used to establish a QUIC connection.
RCP_QUIC_CONN_IP_RESOLVE = 1 IP address type used to establish a TCP connection.
RCP_QUIC_CONN_DNS_FUNCTION = 2 Custom DNS resolution function.
RCP_QUIC_CONN_ON_CONNECTED_FUNCTION = 3 Callback function used when a QUIC connection is successfully established.
RCP_QUIC_CONN_ON_ERROR_FUNCTION = 4 Callback function used when an error occurs during a QUIC connection.
RCP_QUIC_CONN_ON_CLOSED_FUNCTION = 5 Callback function used when a QUIC connection is closed.
RCP_QUIC_CONN_STREAM_INBOUND_FUNCTION = 6 Callback function used when a QUIC connection receives an inbound stream.
RCP_QUIC_CONN_CONNECT_TIMEOUT_MS = 7 Timeout interval (in milliseconds) of a QUIC connection.
RCP_QUIC_CONN_IDLE_TIMEOUT_MS = 8 Idle timeout interval (in milliseconds) of a QUIC connection.
RCP_QUIC_TLS_CERT_AUTHORITY_FUNCTION = 1000 Callback function used for certificate verification of a QUIC connection.
RCP_QUIC_TLS_CERT_AUTHORITY_CONTENT = 1001 CA certificate used for verifying the peer end in a QUIC connection.
RCP_QUIC_TLS_SESSION_TICKET_UPDATE_FUNCTION = 1002 Callback function used for QUIC session ticket update.
RCP_QUIC_TLS_SESSION_TICKET_CONTENT = 1003 Content of a QUIC session ticket.
RCP_QUIC_TP_INITIAL_MAX_BIDIRECTIONAL_STREAMS = 2000 Initial maximum number of bidirectional streams of a QUIC connection.
RCP_QUIC_TP_INITIAL_MAX_DATA = 2001 Initial maximum transmission data volume of a QUIC connection.
RCP_QUIC_TP_INITIAL_MAX_STREAMDATA_BIDIRECTIONAL_LOCAL = 2002 Initial maximum local data volume of bidirectional streams of a QUIC connection.
RCP_QUIC_TP_INITIAL_MAX_STREAMDATA_BIDIRECTIONAL_REMOTE = 2003 Initial maximum remote data volume of bidirectional streams of a QUIC connection.
RCP_QUIC_TP_INITIAL_MAX_STREAMDATA_UNIDIRECTIONAL = 2004 Initial maximum data volume of unidirectional streams of a QUIC connection.
RCP_QUIC_TP_INITIAL_MAX_UNIDIRECTIONAL_STREAMS = 2005 Initial maximum number of unidirectional streams of a QUIC connection.

[h2]Rcp_QuicStreamOpt

enum Rcp_QuicStreamOpt

Description

QUIC stream option type, which is used to configure connection parameters and callbacks.

Since: 26.0.0

Enumerated Value Description
RCP_QUIC_STREAM_EVENT_FUNCTION = 0 Callback function triggered when a QUIC stream event occurs.
RCP_QUIC_STREAM_DATA_FUNCTION = 1 Callback function triggered when QUIC stream data is received.
RCP_QUIC_INBOUND_STREAM_USER_OBJECT = 2 User object of inbound QUIC streams.
RCP_QUIC_STREAM_SND_BUFFER_SIZE_KB = 3 Size of the QUIC stream sending buffer, in KB.

[h2]Rcp_QuicConnInfo

enum Rcp_QuicConnInfo

Description

Type of QUIC connection information, which is used to query connection information.

Since: 26.0.0

Enumerated Value Description
RCP_INFO_CONN_GET_LOCALADDR = 0 Obtains the local IP address in a QUIC connection.
RCP_INFO_CONN_GET_PEERADDR = 1 Obtains the peer IP address in a QUIC connection.
RCP_INFO_CONN_DNS_TIME_MS = 2 Obtains the DNS resolution time (in milliseconds) in a QUIC connection.
RCP_INFO_CONN_CONNECT_TIME_MS = 3 Obtains the connection time (in milliseconds) in a QUIC connection.
RCP_INFO_CONN_SCID = 4 Obtains the source connection ID (CID) in a QUIC connection.
RCP_INFO_CONN_DCID = 5 Obtains the destination connection ID (CID) in a QUIC connection.

[h2]Rcp_QuicStreamInfo

enum Rcp_QuicStreamInfo

Description

Type of QUIC stream information, which is used to query stream information.

Since: 26.0.0

Enumerated Value Description
RCP_INFO_STREAM_SND_BUFFER_SIZE_KB = 0 Obtains the size of the QUIC stream sending buffer, in KB.

[h2]Rcp_QuicErrorCode

enum Rcp_QuicErrorCode

Description

Error code that may be reported for a QUIC request.

Since: 26.0.0

Enumerated Value Description
RCP_QUIC_ERROR_CODE_SUCCESS = 0 Operation successful.
RCP_QUIC_PERMISSION_DENIED = 201 Permission denied. The ohos.permission.INTERNET permission is required.
RCP_QUIC_ERROR_CODE_FAILED = 1007920001 A QUIC-related operation failed.
RCP_QUIC_ERROR_CODE_INVALID_PARAM = 1007920002 Invalid parameter.
RCP_QUIC_ERROR_CODE_INVALID_STATE = 1007920003 Invalid connection status. This operation is not allowed in the current status.
RCP_QUIC_ERROR_CODE_OUT_OF_MEM = 1007920004 Failed to allocate the required memory due to insufficient memory.
RCP_QUIC_ERROR_CODE_CLOSE_FROM_PEER = 1007920005 The QUIC connection is closed by the peer end.
RCP_QUIC_ERROR_CODE_HANDSHAKE_TIMEOUT = 1007920006 The handshake of the QUIC connection timed out.
RCP_QUIC_ERROR_CODE_NETWORK_IDLE_TIMEOUT = 1007920007 The network of the QUIC connection is idle for a long time.
RCP_QUIC_ERROR_INVALID_FRAME = 1007920008 An invalid frame is received in the QUIC connection.
RCP_QUIC_ERROR_CODE_SEND_PENDING = 1007920009 The sending of the QUIC connection is suspended because the buffer is full.
RCP_QUIC_ERROR_CODE_FINALIZE_PENDING = 1007920010 QUIC connection closing is pending.
RCP_QUIC_ERROR_CODE_NETWORK_UNREACHABLE = 1007920011 The network is unreachable.
RCP_QUIC_ERROR_CODE_ENCRYPT_ERROR = 1007920012 Encryption error. The TLS handshake or data encryption failed.
RCP_QUIC_ERROR_CODE_BUFFER_TOO_SMALL = 1007920013 The internal buffer is too small.
RCP_QUIC_ERROR_CODE_EAGAIN = 1007920015 The resource for the non-blocking I/O operation is temporarily unavailable. Please try again later.
RCP_QUIC_ERROR_CODE_STREAM_CLOSED = 1007920018 The QUIC stream has been closed.
RCP_QUIC_ERROR_CODE_STREAM_RESET_RECEIVED = 1007920019 The QUIC stream has been reset by the peer end.
RCP_QUIC_ERROR_CODE_STREAM_STOP_SENDING_RECEIVED = 1007920020 A request to stop sending data has been received for the QUIC stream.

[h2]Rcp_QuicStreamDirection

enum Rcp_QuicStreamDirection

Description

QUIC stream direction type.

Since: 26.0.0

Enumerated Value Description
RCP_QUIC_STREAM_BIDI = 0 Bidirectional stream: Both ends of the stream can send and receive data.
RCP_QUIC_STREAM_UNI = 1 Unidirectional stream: Data can only be sent by the sending end, and the receiving end can only receive it.

[h2]Rcp_QuicStreamShutdown

enum Rcp_QuicStreamShutdown

Description

Close operation type of a QUIC stream, which specifies whether to close the read or write direction.

Since: 26.0.0

Enumerated Value Description
RCP_QUIC_STREAM_SHUTDOWN_READ = 1 Closes the read direction of the stream and stops receiving data.
RCP_QUIC_STREAM_SHUTDOWN_WRITE = 2 Closes the write direction of the stream and stops sending data.

Function Description

[h2]HMS_Rcp_CallNextRequestHandler()

uint32_t HMS_Rcp_CallNextRequestHandler (Rcp_Request * request, const Rcp_RequestHandler * next, const Rcp_ResponseCallbackObject * responseCallback )

Description

Calls the next interceptor or the defaultHandler in Rcp_Interceptor.

Since: 5.0.0(12)

Parameters:

Name Description
request Pointer to Rcp_Request.
next Pointer to the next asynchronous handler Rcp_RequestHandler.
responseCallback Response callback, which points to Rcp_ResponseCallbackObject.

Returns:

uint32_t, which is 401 (parameter error) or a return value representing the next asynchronous handler.

[h2]HMS_Rcp_CallNextSyncRequestHandler()

Rcp_Response* HMS_Rcp_CallNextSyncRequestHandler (Rcp_Request * request, const Rcp_SyncRequestHandler * next, uint32_t * errCode )

Description

Calls the next interceptor or the default handler in Rcp_SyncInterceptor.

Since: 5.0.0(12)

Parameters:

Name Description
request Pointer to Rcp_Request.
next Pointer to the next synchronous handler Rcp_SyncRequestHandler.
errCode Output value, which is 401 (parameter error) or a return value representing the next synchronous handler.

Returns:

Rcp_Response*: pointer to the response.

[h2]HMS_Rcp_CancelRequest()

uint32_t HMS_Rcp_CancelRequest (Rcp_Session * session, const Rcp_Request * request )

Description

Cancels a request.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session for which the request needs to be canceled, which points to Rcp_Session.
request Request to be canceled, which points to the Rcp_Request to be closed.

Returns:

Value 0 if the cancellation is successful; 201 if the permission is insufficient; 401 if the input parameter is a null pointer; 1007900993 if the session has been closed or is invalid.

[h2]HMS_Rcp_CancelSession()

uint32_t HMS_Rcp_CancelSession (Rcp_Session * session)

Description

Cancels a session.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session to be canceled, which points to the Rcp_Session to be closed.

Returns:

Value 0 if the cancellation is successful; 201 if the permission is insufficient; 401 if the input parameter is a null pointer; 1007900993 if the session has been closed or is invalid.

[h2]HMS_Rcp_CloseSession()

uint32_t HMS_Rcp_CloseSession (Rcp_Session ** session)

Description

Closes a session.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session to be closed, which points to Rcp_Session.

Returns:

Value 0 if the destruction is successful; 201 if the permission is insufficient; 401 if the input parameter is a null pointer; 1007900993 if the session has been closed or is invalid.

[h2]HMS_Rcp_CreateForm()

Rcp_Form* HMS_Rcp_CreateForm (void)

Description

Creates a simple form.

Since: 5.0.0(12)

Returns:

Rcp_Form*: pointer to Rcp_Form.

[h2]HMS_Rcp_CreateHeaders()

Rcp_Headers* HMS_Rcp_CreateHeaders (void)

Description

Creates a header for a request or response.

Since: 5.0.0(12)

Returns:

Rcp_Headers*: pointer to Rcp_Headers.

[h2]HMS_Rcp_CreateMultipartForm()

Rcp_MultipartForm* HMS_Rcp_CreateMultipartForm (void)

Description

Creates a multi-part form.

Since: 5.0.0(12)

Returns:

Rcp_MultipartForm*: pointer to Rcp_MultipartForm.

[h2]HMS_Rcp_CreateRequest()

Rcp_Request* HMS_Rcp_CreateRequest (const char * url)

Description

Creates a request.

Since: 5.0.0(12)

Parameters:

Name Description
url Request URL.

Returns:

Rcp_Request*: pointer to Rcp_Request.

[h2]HMS_Rcp_CreateRequestCookies()

Rcp_RequestCookies* HMS_Rcp_CreateRequestCookies (void)

Description

Creates empty request cookies.

Since: 5.0.0(12)

Returns:

Rcp_RequestCookies*: pointer to Rcp_RequestCookies.

[h2]HMS_Rcp_CreateSession()

Rcp_Session* HMS_Rcp_CreateSession (const Rcp_SessionConfiguration * configuration, uint32_t * errCode )

Description

Creates a session.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
configuration Session configuration.
errCode

0: Successful.

401: Parameter error.

201: Insufficient permission.

1007900027: Insufficient memory.

Returns:

Rcp_Session*: pointer to Rcp_Session.

[h2]HMS_Rcp_GetDefaultSession()

uint32_t HMS_Rcp_GetDefaultSession (Rcp_Session ** session)

Description

Obtains the default session.

Required permissions: ohos.permission.INTERNET (If the RCP_PATH_PREFERENCE_CELLULAR option of PathPreference is used, the ohos.permission.GET_NETWORK_INFO permission is also required.)

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 6.1.1(24)

Parameters:

Name Description
session Default session output parameter. The default session pointer will be copied to the location pointed to by the Rcp_Session pointer.

Returns:

Value 0 if the configuration is successful; 201 if the permission is insufficient; 1007900401 if the input parameter is a null pointer; 1007900027 if a memory error occurs.

[h2]HMS_Rcp_DestroyForm()

void HMS_Rcp_DestroyForm (Rcp_Form * form)

Description

Destroys a simple form.

Since: 5.0.0(12)

Parameters:

Name Description
form Form to be destroyed, which points to Rcp_Form.

[h2]HMS_Rcp_DestroyHeaderEntries()

void HMS_Rcp_DestroyHeaderEntries (Rcp_HeaderEntry * headerEntry)

Description

Destroys all key-value pairs obtained in HMS_Rcp_GetHeaderEntries.

Since: 5.0.0(12)

Parameters:

Name Description
headerEntry Pointer to the Rcp_HeaderEntry to be destroyed.

[h2]HMS_Rcp_DestroyHeaders()

void HMS_Rcp_DestroyHeaders (Rcp_Headers * headers)

Description

Destroys the header of a request or response.

Since: 5.0.0(12)

Parameters:

Name Description
headers Pointer to the Rcp_Headers to be destroyed.

[h2]HMS_Rcp_DestroyMultipartForm()

void HMS_Rcp_DestroyMultipartForm (Rcp_MultipartForm * multipartForm)

Description

Destroys a multi-part form.

Since: 5.0.0(12)

Parameters:

Name Description
multipartForm Multi-part form to be destroyed, which points to Rcp_MultipartForm.

[h2]HMS_Rcp_DestroyRequest()

void HMS_Rcp_DestroyRequest (Rcp_Request * request)

Description

Destroys a request.

Since: 5.0.0(12)

Parameters:

Name Description
request Pointer to the Rcp_Request to be destroyed.

[h2]HMS_Rcp_DestroyRequestCookieEntries()

void HMS_Rcp_DestroyRequestCookieEntries (Rcp_RequestCookieEntry * cookieEntry)

Description

Destroys all key-value pairs related to request cookies obtained from HMS_Rcp_GetRequestCookieValue.

Since: 5.0.0(12)

Parameters:

Name Description
cookieEntry Pointer to the Rcp_RequestCookieEntry to be destroyed.

[h2]HMS_Rcp_DestroyRequestCookies()

void HMS_Rcp_DestroyRequestCookies (Rcp_RequestCookies * cookies)

Description

Destroys request cookies.

Since: 5.0.0(12)

Parameters:

Name Description
cookies Pointer to the Rcp_RequestCookies to be destroyed.

[h2]HMS_Rcp_DestroyResponseCookieAttrEntries()

void HMS_Rcp_DestroyResponseCookieAttrEntries (Rcp_CookieAttributeEntry * entries)

Description

Destroys response cookie attributes.

Since: 5.0.0(12)

Parameters:

Name Description
entries Pointer to the Rcp_CookieAttributeEntry to be destroyed.

[h2]HMS_Rcp_Fetch()

uint32_t HMS_Rcp_Fetch (Rcp_Session * session, Rcp_Request * request, const Rcp_ResponseCallbackObject * responseCallback )

Description

Sends an asynchronous request and obtains a response.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session used to initiate a request, which points to Rcp_Session.
request Request to be sent, which points to Rcp_Request.
responseCallback Pointer to the custom response callback function. For details, please refer to Rcp_ResponseCallbackObject.

Returns:

Value 0 if the operation is successful; 201 if the permission is insufficient; 401 if the input parameter is a null pointer; 1007900993 if the session has been closed or is invalid.

Permissions:

ohos.permission.INTERNET (If the RCP_PATH_PREFERENCE_CELLULAR option of PathPreference is used, the ohos.permission.GET_NETWORK_INFO permission is also required.)

[h2]HMS_Rcp_FetchSync()

Rcp_Response* HMS_Rcp_FetchSync (Rcp_Session * session, Rcp_Request * request, uint32_t * errCode )

Description

Sends a synchronous request and obtains a response.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session used to initiate a request, which points to Rcp_Session.
request Request to be sent, which points to Rcp_Request.
errCode

[out]: common error codes.

0: Successful.

201: Insufficient permission.

401: Parameter error.

1007900001: Unsupported protocol.

1007900003: Invalid URL format or missing URL.

1007900005: Unable to resolve the proxy name.

1007900006: Unable to resolve the host name.

1007900007: Unable to connect to the server.

1007900008: Abnormal server response.

1007900009: Access to a remote resource was rejected.

1007900016: An HTTP/2-frame error occurred.

1007900018: A part of the file has been transmitted.

1007900025: Upload failed.

1007900026: Failed to open or read local data from a file or app.

1007900027: Insufficient memory.

1007900028: The timeout interval has expired.

1007900047: The number of redirections has reached the maximum.

1007900052: No data returned from the server.

1007900055: Failed to send data to the peer.

1007900056: Failed to receive data from the peer.

1007900058: Invalid local SSL certificate.

1007900059: Unable to use the specified SSL key.

1007900060: The SSL peer certificate or SSH remote key is invalid.

1007900061: The HTTP content or transport encoding cannot be identified or is incorrect.

1007900063: The file size exceeded the maximum.

1007900070: The disk is full or the allocated quota is used up.

1007900073: The remote file already exists.

1007900077: Invalid SSL CA certificate.

1007900078: Cannot find the remote file.

1007900992: The request has been canceled.

1007900993: The session is closed or invalid.

1007900094: The identity verification function returned an error.

1007900201: Plaintext transmission is not allowed. This error code is added since version 6.1.0(23).

1007900995: Failed to obtain the system proxy.

1007900996: The proxy type is not supported.

1007900997: Invalid content type.

1007900998: The method is not supported.

1007900999: Internal error.

Other error codes are in the format of 1007900000 + Curl error code. For more error codes, please refer to Curl error codes.

Returns:

Rcp_Response*: pointer to the response, which points to Rcp_Response.

Permissions:

ohos.permission.INTERNET (If the RCP_PATH_PREFERENCE_CELLULAR option of PathPreference is used, the ohos.permission.GET_NETWORK_INFO permission is also required.)

[h2]HMS_Rcp_GetFormValue()

Rcp_FormFieldValue* HMS_Rcp_GetFormValue (Rcp_Form * form, const char * key )

Description

Obtains a value based on a key from a simple form.

Since: 5.0.0(12)

Parameters:

Name Description
form Pointer to Rcp_Form.
key Key.

Returns:

Rcp_FormFieldValue*: pointer to {@Rcp_FormFieldValue}.

[h2]HMS_Rcp_GetHeaderEntries()

Rcp_HeaderEntry* HMS_Rcp_GetHeaderEntries (Rcp_Headers * headers)

Description

Obtains all key-value pairs from a request or response header.

Since: 5.0.0(12)

Parameters:

Name Description
headers Pointer to Rcp_Headers for which all key-value pairs need to be obtained.

Returns:

Rcp_HeaderEntry*: pointer to the obtained Rcp_HeaderEntry.

[h2]HMS_Rcp_GetHeaderValue()

Rcp_HeaderValue* HMS_Rcp_GetHeaderValue (Rcp_Headers * headers, const char * name)

Description

Obtains a value based on a key from a request or response header.

Since: 5.0.0(12)

Parameters:

Name Description
headers Pointer to the Rcp_Headers to be obtained.
name Key.

Returns:

Rcp_HeaderValue*: pointer to the obtained Rcp_HeaderValue.

[h2]HMS_Rcp_GetMultipartFormValue()

Rcp_MultipartFormFieldValue* HMS_Rcp_GetMultipartFormValue (Rcp_MultipartForm * multipartForm, const char * key)

Description

Obtains a value based on a key from a multi-part form.

Since: 5.0.0(12)

Parameters:

Name Description
multipartForm Multi-part form from which a value needs to be obtained, which points to Rcp_MultipartForm.
key Key.

Returns:

Rcp_MultipartFormFieldValue*: pointer to Rcp_MultipartFormFieldValue.

[h2]HMS_Rcp_SetFormOrder()

uint32_t HMS_Rcp_SetFormOrder (Rcp_Form * form, Rcp_FormOrder order)

Description

Sets the sequence in which key-value pairs in a form are sent.

Since: 26.0.0

Parameters:

Name Description
form Form to be set, which points to Rcp_Form.
order Sequence of the keys.

Returns:

Value 0 if the operation is successful; 1007900401 if an input parameter is a null pointer or the size is 0; 1007900027 if the memory is insufficient.

[h2]HMS_Rcp_SetMultipartFormOrder()

uint32_t HMS_Rcp_SetMultipartFormOrder (Rcp_MultipartForm * multipartForm, Rcp_FormOrder order)

Description

Sets the sequence in which key-value pairs in a multi-part form are sent.

Since: 26.0.0

Parameters:

Name Description
multipartForm Pointer to the which points to Rcp_MultipartForm.
order Sequence of the keys.

Returns:

Value 0 if the operation is successful; 1007900401 if an input parameter is a null pointer or the size is 0; 1007900027 if the memory is insufficient.

[h2]HMS_Rcp_GetRequestCookieEntries()

Rcp_RequestCookieEntry* HMS_Rcp_GetRequestCookieEntries (Rcp_RequestCookies * cookies)

Description

Obtains all key-value pairs from the request cookies.

Since: 5.0.0(12)

Parameters:

Name Description
cookies Request cookie from which all key-value pairs need to be obtained, which points to Rcp_RequestCookies.

Returns:

Rcp_RequestCookieEntry*: pointer to Rcp_RequestCookieEntry.

[h2]HMS_Rcp_GetRequestCookieValue()

char* HMS_Rcp_GetRequestCookieValue (Rcp_RequestCookies * cookies, const char * name)

Description

Obtains the request cookie value by name.

Since: 5.0.0(12)

Parameters:

Name Description
cookies Request cookie whose value needs to be obtained, which points to Rcp_RequestCookies.
name Key.

Returns:

**char* **: pointer to the returned cookie value.

[h2]HMS_Rcp_GetResponseCookieAttrEntries()

Rcp_CookieAttributeEntry* HMS_Rcp_GetResponseCookieAttrEntries (Rcp_CookieAttributes * cookieAttributes)

Description

Obtains all response cookie attributes from Rcp_CookieAttributes.

Since: 5.0.0(12)

Parameters:

Name Description
cookieAttributes Pointer to the Rcp_CookieAttributes for which all cookie attribute values need to be obtained.

Returns:

Rcp_CookieAttributeEntry *: list of cookie attributes.

[h2]HMS_Rcp_GetResponseCookieAttrValue()

const char* HMS_Rcp_GetResponseCookieAttrValue (Rcp_CookieAttributes * cookieAttributes, const char * name)

Description

Obtains the cookie attribute value by name.

Since: 5.0.0(12)

Parameters:

Name Description
cookieAttributes Pointer to the Rcp_CookieAttributes to be obtained.
name Key.

Returns:

char*: pointer to cookie attribute values.

[h2]HMS_Rcp_GetSessionConfiguration()

const Rcp_SessionConfiguration* HMS_Rcp_GetSessionConfiguration (Rcp_Session * session)

Description

Obtains the session configuration.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session whose configuration needs to be obtained, which points to Rcp_Session.

Returns:

Rcp_SessionConfiguration*: pointer to Rcp_SessionConfiguration.

[h2]HMS_Rcp_GetSessionId()

const char* HMS_Rcp_GetSessionId (Rcp_Session * session)

Description

Obtains the session ID.

System capability: SystemCapability.Collaboration.RemoteCommunication

Since: 5.0.0(12)

Parameters:

Name Description
session Session whose ID needs to be obtained, which points to Rcp_Session.

Returns:

char*: pointer to the returned session ID.

[h2]HMS_Rcp_SetFormValue()

uint32_t HMS_Rcp_SetFormValue (Rcp_Form * form, const char * key, const Rcp_FormFieldValue * value)

Description

Sets key-value pairs in a simple form.

Since: 5.0.0(12)

Parameters:

Name Description
form Form for which key-value pairs need to be set, which points to Rcp_Form.
key Key.
value Value.

Returns:

Value 0 if the configuration is successful; 401 if the input parameter is a null pointer or the size is 0; 1007900027 if the memory is insufficient.

[h2]HMS_Rcp_SetHeaderValue()

uint32_t HMS_Rcp_SetHeaderValue (Rcp_Headers * headers, const char * name, const char * value)

Description

Sets key-value pairs in a request or response header.

Since: 5.0.0(12)

Parameters:

Name Description
headers Pointer to Rcp_Headers.
name Key.
value Value.

Returns:

Value 0 if the configuration is successful; 401 if the input parameter is a null pointer or the size is 0; 1007900027 if the memory is insufficient.

[h2]HMS_Rcp_SetMultipartFormValue()

uint32_t HMS_Rcp_SetMultipartFormValue (Rcp_MultipartForm * multipartForm, const char * key, const Rcp_MultipartFormFieldValue * value)

Description

Sets key-value pairs in a multi-part form.

Since: 5.0.0(12)

Parameters:

Name Description
multipartForm Multi-part form to be set, which points to Rcp_MultipartForm.
key Key.
value Value.

Returns:

Value 0 if the configuration is successful; 401 if the input parameter is a null pointer or the size is 0; 1007900027 if the memory is insufficient.

[h2]HMS_Rcp_SetRequestCookieValue()

uint32_t HMS_Rcp_SetRequestCookieValue (Rcp_RequestCookies * cookies, const char * name, const char * value)

Description

Sets request cookies.

Since: 5.0.0(12)

Parameters:

Name Description
cookies Request cookie to be set, which points to Rcp_RequestCookies.
name Key.
value Value.

Returns:

Value 0 if the configuration is successful; 401 if the input parameter is a null pointer or the size is 0; 1007900027 if the memory is insufficient.

[h2]HMS_Rcp_SetRequestOnBinaryDataRecvCallback()

uint32_t HMS_Rcp_SetRequestOnBinaryDataRecvCallback (Rcp_Request * request, Rcp_OnBinaryReceiveCallback onBinaryReceiveCallback)

Description

Sets a callback function for receiving binary data upon a request. The callback function works the same as Rcp_OnDataReceiveCallback in Rcp_Configuration. Once set, the callback function will replace Rcp_OnDataReceiveCallback configured in Rcp_Configuration.

Since: 5.0.1(13)

Parameters:

Name Description
request Request for which the binary data callback needs to be set, which points to Rcp_Request.
onBinaryReceiveCallback Callback function for receiving binary data.

Returns:

Value 0 if the configuration is successful; 401 if a parameter error occurs.

[h2]HMS_Rcp_SetRequestConnectOnly()

uint32_t HMS_Rcp_SetRequestConnectOnly (Rcp_Request * request, bool connectOnly)

Description

Configures the request to establish a connection only, without performing data transmission.

Since: 6.1.1(24)

Parameters:

Name Description
request Request that is used only for establishing a connection, which points to Rcp_Request.
connectOnly Indicates whether a request is used only for establishing a connection. The options are true (yes) and false (no). If this parameter is set to false, the request can be used to transmit data. The default value is false.

Returns:

Value 0 if the configuration is successful; 1007900401 if the input parameter is a null pointer.

[h2]HMS_Rcp_SetRequestOnStatusCodeReceiveCallback()

uint32_t HMS_Rcp_SetRequestOnStatusCodeReceiveCallback (Rcp_Request * request, Rcp_OnStatusCodeReceiveCallback onStatusCodeReceiveCallback)

Description

Sets the callback function for a response status code. This callback function is triggered when a response status code is received from the peer end. You cannot cancel listening by setting Rcp_OnStatusCodeReceiveCallbackFunc to NULL.

Since: 6.0.1(21)

Parameters:

Name Description
request Request for which the response status code callback function needs to be set, which points to Rcp_Request.
onStatusCodeReceiveCallback Callback function for receiving a response status code.

Returns:

Value 0 if the configuration is successful; 401 if a parameter error occurs.

[h2]HMS_Rcp_SetRequestGetDataCallback()

uint32_t HMS_Rcp_SetRequestGetDataCallback (Rcp_Request * request, Rcp_OnGetDataCallback  getDataCallback)

Description

Sets the callback function for obtaining data. You cannot cancel listening by setting Rcp_GetDataCallbackFunc to NULL. After this function is called to set a non-null Rcp_GetDataCallbackFunc, the content of Rcp_Request becomes invalid.

Since: 26.0.0

Parameters:

Name Description
request Request for which the response callback function needs to be set, which points to Rcp_Request.
getDataCallback Callback function used to obtain data.

Returns:

Value 0 if the configuration is successful; 1007900401 if the input parameter request is a null pointer.

[h2]HMS_Rcp_QuicConnSetOpt()

Rcp_QuicErrorCode HMS_Rcp_QuicConnSetOpt (Rcp_QuicConn *conn, Rcp_QuicConnOpt opt, const void *optVal, uint32_t optLen)

Description

Sets QUIC connection options, including various parameters and callbacks.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
opt QUIC connection option type, allowing setting options of the Rcp_QuicConnOpt type.
optVal Value of a QUIC connection option.
optLen Length of a QUIC connection option.

Returns:

Rcp_QuicErrorCode: QUIC connection option configuration result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC connection option is successfully configured. Other return values indicate that the configuration fails.

[h2]HMS_Rcp_QuicConnGetInfo()

Rcp_QuicErrorCode HMS_Rcp_QuicConnGetInfo (Rcp_QuicConn *conn, Rcp_QuicConnInfo info, void *infoVal, uint32_t *infoLen)

Description

Obtains QUIC connection information after a QUIC connection is successfully established.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
info QUIC connection information type, which can be used to obtain parameters related to Rcp_QuicConnInfo.
infoVal QUIC connection information value.
infoLen Length of the QUIC connection information.

Returns:

Rcp_QuicErrorCode: QUIC connection information obtaining result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC connection parameters are successfully obtained. Other return values indicate that the obtaining fails.

[h2]HMS_Rcp_QuicStreamSetOpt()

Rcp_QuicErrorCode HMS_Rcp_QuicStreamSetOpt (Rcp_QuicConn *conn, uint64_t streamId, Rcp_QuicStreamOpt opt, const void *optVal, uint32_t optLen)

Description

Sets stream parameters for a QUIC connection.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
streamId ID of a QUIC stream.
opt QUIC stream option type, allowing setting options of the Rcp_QuicStreamOpt type.
optVal Value of a QUIC stream option.
optLen Length of a QUIC stream option.

Returns:

Rcp_QuicErrorCode: QUIC stream option configuration result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC stream option is successfully configured. Other return values indicate that the configuration fails.

[h2]HMS_Rcp_QuicStreamGetInfo()

Rcp_QuicErrorCode HMS_Rcp_QuicStreamGetInfo (Rcp_QuicConn *conn, uint64_t streamId, Rcp_QuicStreamInfo info, void *infoVal, uint32_t *infoLen)

Description

Obtains information about the stream corresponding to streamId in a QUIC connection.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
streamId ID of a QUIC stream.
info QUIC stream information type, which can be used to obtain information of the Rcp_QuicStreamInfo type.
infoVal Value of the QUIC stream information.
infoLen Length of the QUIC stream information.

Returns:

Rcp_QuicErrorCode: QUIC stream information obtaining result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC stream parameters are successfully obtained. Other return values indicate that the obtaining fails.

[h2]HMS_Rcp_QuicCreateSession()

Rcp_QuicSession *HMS_Rcp_QuicCreateSession ()

Description

Creates a QUIC session object. A QUIC session can manage multiple QUIC connections.

Since: 26.0.0

Returns:

Rcp_QuicSession*: pointer to the QUIC session object. If the operation fails, NULL is returned.

[h2]HMS_Rcp_QuicDestroySession()

void HMS_Rcp_QuicDestroySession (Rcp_QuicSession *session)

Description

Destroys a QUIC session object and releases relevant session resources.

Since: 26.0.0

Parameters:

Name Description
session QUIC session object.

[h2]HMS_Rcp_QuicConnCreate()

Rcp_QuicConn *HMS_Rcp_QuicConnCreate (char *alpn, void *userObject)

Description

Creates a QUIC connection object.

Since: 26.0.0

Parameters:

Name Description
alpn Application-Layer Protocol Negotiation (ALPN) string.
userObject Custom object.

Returns:

Rcp_QuicConn*: pointer to the QUIC connection object. If the operation fails, NULL is returned.

[h2]HMS_Rcp_QuicConnConnect()

Rcp_QuicErrorCode HMS_Rcp_QuicConnConnect (Rcp_QuicSession *session, Rcp_QuicConn *conn, const char *serverName, uint16_t port)

Description

Initiates a QUIC connection handshake. The handshake result is returned through the connection callback.

Since: 26.0.0

Parameters:

Name Description
session QUIC session object.
conn QUIC connection object.
serverName Server name (domain name or IP address).
port Server port number.

Returns:

Rcp_QuicErrorCode: QUIC connection initiation result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC connection is successfully initiated. Other return values indicate that the QUIC connection fails to be initiated.

Permissions:

ohos.permission.INTERNET

[h2]HMS_Rcp_QuicConnDestroy()

Rcp_QuicErrorCode HMS_Rcp_QuicConnDestroy (Rcp_QuicConn *conn)

Description

Destroys a QUIC connection. After the connection is destroyed, the Rcp_QuicConnectionOnClosed event is triggered. Do not perform this operation repeatedly on the same Rcp_QuicConn instance.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.

Returns:

Rcp_QuicErrorCode: result of destroying the QUIC connection object. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC connection object is successfully destroyed. Other return values indicate that the destruction fails.

[h2]HMS_Rcp_QuicConnStreamOpen()

Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamOpen (Rcp_QuicConn *conn, Rcp_QuicStreamDirection direction, uint64_t *streamId, void *userObject)

Description

Opens a QUIC stream in a QUIC connection only after the connection is successfully established.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
direction QUIC stream direction, which is used to configure the enumeration type of Rcp_QuicStreamDirection.
streamId Pointer to the ID of the created QUIC stream.
userObject User object of the stream callback.

Returns:

Rcp_QuicErrorCode: QUIC stream creation result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC stream is successfully created. Other return values indicate that the creation fails.

Permissions:

ohos.permission.INTERNET

[h2]HMS_Rcp_QuicConnStreamSend()

Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamSend (Rcp_QuicConn *conn, uint64_t streamId, const Rcp_QuicIoVec *ioVec, uint32_t ioVecCount, bool fin)

Description

Sends data through a QUIC stream.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
streamId ID of a QUIC stream.
ioVec Array of content data vectors to be sent.
ioVecCount Number of content data vectors to be sent.
fin Indicates whether the sent content is the last segment of data. The options are true (yes) and false (no).

Returns:

Rcp_QuicErrorCode: result of sending data in a QUIC stream. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the data is successfully sent. Other values indicate that the data fails to be sent.

Permissions:

ohos.permission.INTERNET

[h2]HMS_Rcp_QuicConnStreamWantRead()

Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamWantRead (Rcp_QuicConn *conn, uint64_t streamId)

Description

Triggers the QUIC stream data reading callback.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
streamId ID of a QUIC stream.

Returns:

Rcp_QuicErrorCode: result of enabling the QUIC stream data read callback. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the callback is enabled successfully. Other return values indicate that the callback fails to be enabled.

[h2]HMS_Rcp_QuicConnStreamReset()

Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamReset (Rcp_QuicConn *conn, uint64_t streamId, uint64_t appErr)

Description

Resets a QUIC stream immediately and discards all data that has not been sent or received.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
streamId ID of a QUIC stream.
appErr App error code.

Returns:

Rcp_QuicErrorCode: QUIC stream reset result. The value RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC stream is successfully reset. Other return values indicate that the reset fails.

Permissions:

ohos.permission.INTERNET

[h2]HMS_Rcp_QuicConnStreamShutdown()

Rcp_QuicErrorCode HMS_Rcp_QuicConnStreamShutdown (Rcp_QuicConn *conn, uint64_t streamId, Rcp_QuicStreamShutdown flag, uint64_t appErr)

Description

Disables the read or write operation on the stream specified by streamId in a connection.

Since: 26.0.0

Parameters:

Name Description
conn QUIC connection object.
streamId ID of a QUIC stream.
flag QUIC stream close flag. The value can be of the Rcp_QuicStreamShutdown type.
appErr App error code.

Returns:

Rcp_QuicErrorCode: QUIC stream closing result. RCP_QUIC_ERROR_CODE_SUCCESS indicates that the QUIC stream is successfully closed. Other return values indicate that the QUIC stream fails to be closed.

Permissions:

ohos.permission.INTERNET

[h2]HMS_Rcp_QuicStreamGetDirection()

Rcp_QuicStreamDirection HMS_Rcp_QuicStreamGetDirection (uint64_t streamId)

Description

Obtains the QUIC stream direction type.

Since: 26.0.0

Parameters:

Name Description
streamId ID of a QUIC stream.

Returns:

Rcp_QuicStreamDirection: direction of a QUIC stream. RCP_QUIC_STREAM_BIDI indicates a bidirectional stream, and RCP_QUIC_STREAM_UNI indicates a unidirectional stream.

[h2]HMS_Rcp_QuicFreeSlist()

void HMS_Rcp_QuicFreeSlist (Rcp_QuicSlist *list)

Description

Releases all nodes and data in the Rcp_QuicSlist linked list.

Since: 26.0.0

Parameters:

Name Description
list Rcp_QuicSlist linked list pointer.