diff --git a/Cronet.podspec b/Cronet.podspec index b334399..6055d9c 100644 --- a/Cronet.podspec +++ b/Cronet.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Cronet' - s.version = 'MASTER_BRANCH' + s.version = '87.0.4251.0-dev' s.summary = 'Cronet is the networking stack of Chromium put into a library for use on mobile' s.description = <<-DESC diff --git a/Frameworks/Cronet.framework/Cronet b/Frameworks/Cronet.framework/Cronet new file mode 100644 index 0000000..fb9a289 Binary files /dev/null and b/Frameworks/Cronet.framework/Cronet differ diff --git a/Frameworks/Cronet.framework/Headers/Cronet.h b/Frameworks/Cronet.framework/Headers/Cronet.h new file mode 100644 index 0000000..13bf535 --- /dev/null +++ b/Frameworks/Cronet.framework/Headers/Cronet.h @@ -0,0 +1,210 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +#include "bidirectional_stream_c.h" +#include "cronet.idl_c.h" +#include "cronet_c.h" +#include "cronet_export.h" + +// Type of HTTP cache; public interface to private implementation defined in +// URLRequestContextConfig class. +typedef NS_ENUM(NSInteger, CRNHttpCacheType) { + // Disabled HTTP cache. Some data may still be temporarily stored in memory. + CRNHttpCacheTypeDisabled, + // Enable on-disk HTTP cache, including HTTP data. + CRNHttpCacheTypeDisk, + // Enable in-memory cache, including HTTP data. + CRNHttpCacheTypeMemory, +}; + +/// Cronet error domain name. +FOUNDATION_EXPORT GRPC_SUPPORT_EXPORT NSString* const CRNCronetErrorDomain; + +/// Enum of Cronet NSError codes. +NS_ENUM(NSInteger){ + CRNErrorInvalidArgument = 1001, CRNErrorUnsupportedConfig = 1002, +}; + +/// The corresponding value is a String object that contains the name of +/// an invalid argument inside the NSError userInfo dictionary. +FOUNDATION_EXPORT GRPC_SUPPORT_EXPORT NSString* const CRNInvalidArgumentKey; + +// A block, that takes a request, and returns YES if the request should +// be handled. +typedef BOOL (^RequestFilterBlock)(NSURLRequest* request); + +// Interface for installing Cronet. +// TODO(gcasto): Should this macro be separate from the one defined in +// bidirectional_stream_c.h? +GRPC_SUPPORT_EXPORT +@interface Cronet : NSObject + +// Sets the HTTP Accept-Language header. This method only has any effect before +// |start| is called. ++ (void)setAcceptLanguages:(NSString*)acceptLanguages; + +// Sets whether HTTP/2 should be supported by CronetEngine. This method only has +// any effect before |start| is called. ++ (void)setHttp2Enabled:(BOOL)http2Enabled; + +// Sets whether QUIC should be supported by CronetEngine. This method only has +// any effect before |start| is called. ++ (void)setQuicEnabled:(BOOL)quicEnabled; + +// Sets whether Brotli should be supported by CronetEngine. This method only has +// any effect before |start| is called. ++ (void)setBrotliEnabled:(BOOL)brotliEnabled; + +// Sets whether Metrics should be collected by CronetEngine. This method only +// has any effect before |start| is called. ++ (void)setMetricsEnabled:(BOOL)metricsEnabled; + +// Set HTTP Cache type to be used by CronetEngine. This method only has any +// effect before |start| is called. See HttpCacheType enum for available +// options. ++ (void)setHttpCacheType:(CRNHttpCacheType)httpCacheType; + +// Adds hint that host supports QUIC on altPort. This method only has any effect +// before |start| is called. Returns NO if it fails to add hint (because the +// host is invalid). ++ (BOOL)addQuicHint:(NSString*)host port:(int)port altPort:(int)altPort; + +// Set experimental Cronet options. Argument is a JSON string; see +// |URLRequestContextConfig| for more details. This method only has +// any effect before |start| is called. ++ (void)setExperimentalOptions:(NSString*)experimentalOptions; + +// Sets the User-Agent request header string to be sent with all requests. +// If |partial| is set to YES, then actual user agent value is based on device +// model, OS version, and |userAgent| argument. For example "Foo/3.0.0.0" is +// sent as "Mozilla/5.0 (iPhone; CPU iPhone OS 9_3 like Mac OS X) +// AppleWebKit/601.1 (KHTML, like Gecko) Foo/3.0.0.0 Mobile/15G31 +// Safari/601.1.46". +// If |partial| is set to NO, then |userAgent| value is complete value sent to +// the remote. For Example: "Foo/3.0.0.0" is sent as "Foo/3.0.0.0". +// +// This method only has any effect before |start| is called. ++ (void)setUserAgent:(NSString*)userAgent partial:(BOOL)partial; + +// Sets SSLKEYLogFileName to export SSL key for Wireshark decryption of packet +// captures. This method only has any effect before |start| is called. ++ (void)setSslKeyLogFileName:(NSString*)sslKeyLogFileName; + +/// Pins a set of public keys for a given host. This method only has any effect +/// before |start| is called. By pinning a set of public keys, |pinHashes|, +/// communication with |host| is required to authenticate with a certificate +/// with a public key from the set of pinned ones. +/// An app can pin the public key of the root certificate, any of the +/// intermediate certificates or the end-entry certificate. Authentication will +/// fail and secure communication will not be established if none of the public +/// keys is present in the host's certificate chain, even if the host attempts +/// to authenticate with a certificate allowed by the device's trusted store of +/// certificates. +/// +/// Calling this method multiple times with the same host name overrides the +/// previously set pins for the host. +/// +/// More information about the public key pinning can be found in +/// [RFC 7469](https://tools.ietf.org/html/rfc7469). +/// +/// @param host name of the host to which the public keys should be pinned. +/// A host that consists only of digits and the dot character +/// is treated as invalid. +/// @param pinHashes a set of pins. Each pin is the SHA-256 cryptographic +/// hash of the DER-encoded ASN.1 representation of the +/// Subject Public Key Info (SPKI) of the host's X.509 +/// certificate. Although, the method does not mandate the +/// presence of the backup pin that can be used if the control +/// of the primary private key has been lost, it is highly +/// recommended to supply one. +/// @param includeSubdomains indicates whether the pinning policy should be +/// applied to subdomains of |host|. +/// @param expirationDate specifies the expiration date for the pins. +/// @param outError on return, if the pin cannot be added, a pointer to an +/// error object that encapsulates the reason for the error. +/// @return returns |YES| if the pins were added successfully; |NO|, otherwise. ++ (BOOL)addPublicKeyPinsForHost:(NSString*)host + pinHashes:(NSSet*)pinHashes + includeSubdomains:(BOOL)includeSubdomains + expirationDate:(NSDate*)expirationDate + error:(NSError**)outError; + +// Sets the block used to determine whether or not Cronet should handle the +// request. If the block is not set, Cronet will handle all requests. Cronet +// retains strong reference to the block, which can be released by calling this +// method with nil block. ++ (void)setRequestFilterBlock:(RequestFilterBlock)block; + +// Starts CronetEngine. It is recommended to call this method on the application +// main thread. If the method is called on any thread other than the main one, +// the method will internally try to execute synchronously using the main GCD +// queue. Please make sure that the main thread is not blocked by a job +// that calls this method; otherwise, a deadlock can occur. ++ (void)start; + +// Registers Cronet as HttpProtocol Handler. Once registered, Cronet intercepts +// and handles all requests made through NSURLConnection and shared +// NSURLSession. +// This method must be called after |start|. ++ (void)registerHttpProtocolHandler; + +// Unregister Cronet as HttpProtocol Handler. This means that Cronet will stop +// intercepting requests, however, it won't tear down the Cronet environment. +// This method must be called after |start|. ++ (void)unregisterHttpProtocolHandler; + +// Installs Cronet into NSURLSessionConfiguration so that all +// NSURLSessions created with this configuration will use the Cronet stack. +// Note that all Cronet settings are global and are shared between +// all NSURLSessions & NSURLConnections that use the Cronet stack. +// This method must be called after |start|. ++ (void)installIntoSessionConfiguration:(NSURLSessionConfiguration*)config; + +// Returns the absolute path that startNetLogToFile:fileName will actually +// write to. ++ (NSString*)getNetLogPathForFile:(NSString*)fileName; + +// Starts net-internals logging to a file named |fileName|. Where fileName is +// relative to the application documents directory. |fileName| must not be +// empty. Log level is determined by |logBytes| - if YES then LOG_ALL otherwise +// LOG_ALL_BUT_BYTES. If the file exists it is truncated before starting. If +// actively logging the call is ignored. ++ (BOOL)startNetLogToFile:(NSString*)fileName logBytes:(BOOL)logBytes; + +// Stop net-internals logging and flush file to disk. If a logging session is +// not in progress this call is ignored. ++ (void)stopNetLog; + +// Returns the full user-agent that will be used unless it is overridden on the +// NSURLRequest used. ++ (NSString*)getUserAgent; + +// Sets priority of the network thread. The |priority| should be a +// floating point number between 0.0 to 1.0, where 1.0 is highest priority. +// This method can be called multiple times before or after |start| method. ++ (void)setNetworkThreadPriority:(double)priority; + +// Get a pointer to global instance of cronet_engine for GRPC C API. ++ (stream_engine*)getGlobalEngine; + +// Returns differences in metrics collected by Cronet since the last call to +// getGlobalMetricsDeltas, serialized as a [protobuf] +// (https://developers.google.com/protocol-buffers). +// +// Cronet starts collecting these metrics after the first call to +// getGlobalMetricsDeltras, so the first call returns no +// useful data as no metrics have yet been collected. ++ (NSData*)getGlobalMetricsDeltas; + +// Sets Host Resolver Rules for testing. +// This method must be called after |start| has been called. ++ (void)setHostResolverRulesForTesting:(NSString*)hostResolverRulesForTesting; + +// Enables TestCertVerifier which accepts all certificates for testing. +// This method only has any effect before |start| is called. ++ (void)enableTestCertVerifierForTesting; + +@end diff --git a/Frameworks/Cronet.framework/Headers/bidirectional_stream_c.h b/Frameworks/Cronet.framework/Headers/bidirectional_stream_c.h new file mode 100644 index 0000000..3a6fae8 --- /dev/null +++ b/Frameworks/Cronet.framework/Headers/bidirectional_stream_c.h @@ -0,0 +1,245 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_GRPC_SUPPORT_INCLUDE_BIDIRECTIONAL_STREAM_C_H_ +#define COMPONENTS_GRPC_SUPPORT_INCLUDE_BIDIRECTIONAL_STREAM_C_H_ + +#if defined(WIN32) +#define GRPC_SUPPORT_EXPORT __declspec(dllexport) +#else +#define GRPC_SUPPORT_EXPORT __attribute__((visibility("default"))) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Engine API. */ + +/* Opaque object representing a Bidirectional stream creating engine. Created + * and configured outside of this API to facilitate sharing with other + * components */ +typedef struct stream_engine { + void* obj; + void* annotation; +} stream_engine; + +/* Bidirectional Stream API */ + +/* Opaque object representing Bidirectional Stream. */ +typedef struct bidirectional_stream { + void* obj; + void* annotation; +} bidirectional_stream; + +/* A single request or response header element. */ +typedef struct bidirectional_stream_header { + const char* key; + const char* value; +} bidirectional_stream_header; + +/* Array of request or response headers or trailers. */ +typedef struct bidirectional_stream_header_array { + size_t count; + size_t capacity; + bidirectional_stream_header* headers; +} bidirectional_stream_header_array; + +/* Set of callbacks used to receive callbacks from bidirectional stream. */ +typedef struct bidirectional_stream_callback { + /* Invoked when the stream is ready for reading and writing. + * Consumer may call bidirectional_stream_read() to start reading data. + * Consumer may call bidirectional_stream_write() to start writing + * data. + */ + void (*on_stream_ready)(bidirectional_stream* stream); + + /* Invoked when initial response headers are received. + * Consumer must call bidirectional_stream_read() to start reading. + * Consumer may call bidirectional_stream_write() to start writing or + * close the stream. Contents of |headers| is valid for duration of the call. + */ + void (*on_response_headers_received)( + bidirectional_stream* stream, + const bidirectional_stream_header_array* headers, + const char* negotiated_protocol); + + /* Invoked when data is read into the buffer passed to + * bidirectional_stream_read(). Only part of the buffer may be + * populated. To continue reading, call bidirectional_stream_read(). + * It may be invoked after on_response_trailers_received()}, if there was + * pending read data before trailers were received. + * + * If |bytes_read| is 0, it means the remote side has signaled that it will + * send no more data; future calls to bidirectional_stream_read() + * will result in the on_data_read() callback or on_succeded() callback if + * bidirectional_stream_write() was invoked with end_of_stream set to + * true. + */ + void (*on_read_completed)(bidirectional_stream* stream, + char* data, + int bytes_read); + + /** + * Invoked when all data passed to bidirectional_stream_write() is + * sent. To continue writing, call bidirectional_stream_write(). + */ + void (*on_write_completed)(bidirectional_stream* stream, const char* data); + + /* Invoked when trailers are received before closing the stream. Only invoked + * when server sends trailers, which it may not. May be invoked while there is + * read data remaining in local buffer. Contents of |trailers| is valid for + * duration of the call. + */ + void (*on_response_trailers_received)( + bidirectional_stream* stream, + const bidirectional_stream_header_array* trailers); + + /** + * Invoked when there is no data to be read or written and the stream is + * closed successfully remotely and locally. Once invoked, no further callback + * methods will be invoked. + */ + void (*on_succeded)(bidirectional_stream* stream); + + /** + * Invoked if the stream failed for any reason after + * bidirectional_stream_start(). HTTP/2 error codes are + * mapped to chrome net error codes. Once invoked, no further callback methods + * will be invoked. + */ + void (*on_failed)(bidirectional_stream* stream, int net_error); + + /** + * Invoked if the stream was canceled via + * bidirectional_stream_cancel(). Once invoked, no further callback + * methods will be invoked. + */ + void (*on_canceled)(bidirectional_stream* stream); +} bidirectional_stream_callback; + +/* Creates a new stream object that uses |engine| and |callback|. All stream + * tasks are performed asynchronously on the |engine| network thread. |callback| + * methods are invoked synchronously on the |engine| network thread, but must + * not run tasks on the current thread to prevent blocking networking operations + * and causing exceptions during shutdown. The |annotation| is stored in + * bidirectional stream for arbitrary use by application. + * + * Returned |bidirectional_stream*| is owned by the caller, and must be + * destroyed using |bidirectional_stream_destroy|. + * + * Both |calback| and |engine| must remain valid until stream is destroyed. + */ +GRPC_SUPPORT_EXPORT +bidirectional_stream* bidirectional_stream_create( + stream_engine* engine, + void* annotation, + bidirectional_stream_callback* callback); + +/* TBD: The following methods return int. Should it be a custom type? */ + +/* Destroys stream object. Destroy could be called from any thread, including + * network thread, but is posted, so |stream| is valid until calling task is + * complete. + */ +GRPC_SUPPORT_EXPORT +int bidirectional_stream_destroy(bidirectional_stream* stream); + +/** + * Disables or enables auto flush. By default, data is flushed after + * every bidirectional_stream_write(). If the auto flush is disabled, + * the client should explicitly call bidirectional_stream_flush to flush + * the data. + */ +GRPC_SUPPORT_EXPORT void bidirectional_stream_disable_auto_flush( + bidirectional_stream* stream, + bool disable_auto_flush); + +/** + * Delays sending request headers until bidirectional_stream_flush() + * is called. This flag is currently only respected when QUIC is negotiated. + * When true, QUIC will send request header frame along with data frame(s) + * as a single packet when possible. + */ +GRPC_SUPPORT_EXPORT +void bidirectional_stream_delay_request_headers_until_flush( + bidirectional_stream* stream, + bool delay_headers_until_flush); + +/* Starts the stream by sending request to |url| using |method| and |headers|. + * If |end_of_stream| is true, then no data is expected to be written. The + * |method| is HTTP verb. + */ +GRPC_SUPPORT_EXPORT +int bidirectional_stream_start(bidirectional_stream* stream, + const char* url, + int priority, + const char* method, + const bidirectional_stream_header_array* headers, + bool end_of_stream); + +/* Reads response data into |buffer| of |capacity| length. Must only be called + * at most once in response to each invocation of the + * on_stream_ready()/on_response_headers_received() and on_read_completed() + * methods of the bidirectional_stream_callback. + * Each call will result in an invocation of the callback's + * on_read_completed() method if data is read, or its on_failed() method if + * there's an error. The callback's on_succeeded() method is also invoked if + * there is no more data to read and |end_of_stream| was previously sent. + */ +GRPC_SUPPORT_EXPORT +int bidirectional_stream_read(bidirectional_stream* stream, + char* buffer, + int capacity); + +/* Writes request data from |buffer| of |buffer_length| length. If auto flush is + * disabled, data will be sent only after bidirectional_stream_flush() is + * called. + * Each call will result in an invocation the callback's on_write_completed() + * method if data is sent, or its on_failed() method if there's an error. + * The callback's on_succeeded() method is also invoked if |end_of_stream| is + * set and all response data has been read. + */ +GRPC_SUPPORT_EXPORT +int bidirectional_stream_write(bidirectional_stream* stream, + const char* buffer, + int buffer_length, + bool end_of_stream); + +/** + * Flushes pending writes. This method should not be called before invocation of + * on_stream_ready() method of the bidirectional_stream_callback. + * For each previously called bidirectional_stream_write() + * a corresponding on_write_completed() callback will be invoked when the buffer + * is sent. + */ +GRPC_SUPPORT_EXPORT +void bidirectional_stream_flush(bidirectional_stream* stream); + +/* Cancels the stream. Can be called at any time after + * bidirectional_stream_start(). The on_canceled() method of + * bidirectional_stream_callback will be invoked when cancelation + * is complete and no further callback methods will be invoked. If the + * stream has completed or has not started, calling + * bidirectional_stream_cancel() has no effect and on_canceled() will not + * be invoked. At most one callback method may be invoked after + * bidirectional_stream_cancel() has completed. + */ +GRPC_SUPPORT_EXPORT +void bidirectional_stream_cancel(bidirectional_stream* stream); + +/* Returns true if the |stream| was successfully started and is now done + * (succeeded, canceled, or failed). + * Returns false if the |stream| stream is not yet started or is in progress. + */ +GRPC_SUPPORT_EXPORT +bool bidirectional_stream_is_done(bidirectional_stream* stream); + +#ifdef __cplusplus +} +#endif + +#endif // COMPONENTS_GRPC_SUPPORT_INCLUDE_BIDIRECTIONAL_STREAM_C_H_ diff --git a/Frameworks/Cronet.framework/Headers/cronet.idl_c.h b/Frameworks/Cronet.framework/Headers/cronet.idl_c.h new file mode 100644 index 0000000..80a9efe --- /dev/null +++ b/Frameworks/Cronet.framework/Headers/cronet.idl_c.h @@ -0,0 +1,1271 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +/* DO NOT EDIT. Generated from components/cronet/native/generated/cronet.idl */ + +#ifndef COMPONENTS_CRONET_NATIVE_GENERATED_CRONET_IDL_C_H_ +#define COMPONENTS_CRONET_NATIVE_GENERATED_CRONET_IDL_C_H_ +#include "cronet_export.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +typedef const char* Cronet_String; +typedef void* Cronet_RawDataPtr; +typedef void* Cronet_ClientContext; + +// Forward declare interfaces. +typedef struct Cronet_Buffer Cronet_Buffer; +typedef struct Cronet_Buffer* Cronet_BufferPtr; +typedef struct Cronet_BufferCallback Cronet_BufferCallback; +typedef struct Cronet_BufferCallback* Cronet_BufferCallbackPtr; +typedef struct Cronet_Runnable Cronet_Runnable; +typedef struct Cronet_Runnable* Cronet_RunnablePtr; +typedef struct Cronet_Executor Cronet_Executor; +typedef struct Cronet_Executor* Cronet_ExecutorPtr; +typedef struct Cronet_Engine Cronet_Engine; +typedef struct Cronet_Engine* Cronet_EnginePtr; +typedef struct Cronet_UrlRequestStatusListener Cronet_UrlRequestStatusListener; +typedef struct Cronet_UrlRequestStatusListener* + Cronet_UrlRequestStatusListenerPtr; +typedef struct Cronet_UrlRequestCallback Cronet_UrlRequestCallback; +typedef struct Cronet_UrlRequestCallback* Cronet_UrlRequestCallbackPtr; +typedef struct Cronet_UploadDataSink Cronet_UploadDataSink; +typedef struct Cronet_UploadDataSink* Cronet_UploadDataSinkPtr; +typedef struct Cronet_UploadDataProvider Cronet_UploadDataProvider; +typedef struct Cronet_UploadDataProvider* Cronet_UploadDataProviderPtr; +typedef struct Cronet_UrlRequest Cronet_UrlRequest; +typedef struct Cronet_UrlRequest* Cronet_UrlRequestPtr; +typedef struct Cronet_RequestFinishedInfoListener + Cronet_RequestFinishedInfoListener; +typedef struct Cronet_RequestFinishedInfoListener* + Cronet_RequestFinishedInfoListenerPtr; + +// Forward declare structs. +typedef struct Cronet_Error Cronet_Error; +typedef struct Cronet_Error* Cronet_ErrorPtr; +typedef struct Cronet_QuicHint Cronet_QuicHint; +typedef struct Cronet_QuicHint* Cronet_QuicHintPtr; +typedef struct Cronet_PublicKeyPins Cronet_PublicKeyPins; +typedef struct Cronet_PublicKeyPins* Cronet_PublicKeyPinsPtr; +typedef struct Cronet_EngineParams Cronet_EngineParams; +typedef struct Cronet_EngineParams* Cronet_EngineParamsPtr; +typedef struct Cronet_HttpHeader Cronet_HttpHeader; +typedef struct Cronet_HttpHeader* Cronet_HttpHeaderPtr; +typedef struct Cronet_UrlResponseInfo Cronet_UrlResponseInfo; +typedef struct Cronet_UrlResponseInfo* Cronet_UrlResponseInfoPtr; +typedef struct Cronet_UrlRequestParams Cronet_UrlRequestParams; +typedef struct Cronet_UrlRequestParams* Cronet_UrlRequestParamsPtr; +typedef struct Cronet_DateTime Cronet_DateTime; +typedef struct Cronet_DateTime* Cronet_DateTimePtr; +typedef struct Cronet_Metrics Cronet_Metrics; +typedef struct Cronet_Metrics* Cronet_MetricsPtr; +typedef struct Cronet_RequestFinishedInfo Cronet_RequestFinishedInfo; +typedef struct Cronet_RequestFinishedInfo* Cronet_RequestFinishedInfoPtr; + +// Declare enums +typedef enum Cronet_RESULT { + Cronet_RESULT_SUCCESS = 0, + Cronet_RESULT_ILLEGAL_ARGUMENT = -100, + Cronet_RESULT_ILLEGAL_ARGUMENT_STORAGE_PATH_MUST_EXIST = -101, + Cronet_RESULT_ILLEGAL_ARGUMENT_INVALID_PIN = -102, + Cronet_RESULT_ILLEGAL_ARGUMENT_INVALID_HOSTNAME = -103, + Cronet_RESULT_ILLEGAL_ARGUMENT_INVALID_HTTP_METHOD = -104, + Cronet_RESULT_ILLEGAL_ARGUMENT_INVALID_HTTP_HEADER = -105, + Cronet_RESULT_ILLEGAL_STATE = -200, + Cronet_RESULT_ILLEGAL_STATE_STORAGE_PATH_IN_USE = -201, + Cronet_RESULT_ILLEGAL_STATE_CANNOT_SHUTDOWN_ENGINE_FROM_NETWORK_THREAD = -202, + Cronet_RESULT_ILLEGAL_STATE_ENGINE_ALREADY_STARTED = -203, + Cronet_RESULT_ILLEGAL_STATE_REQUEST_ALREADY_STARTED = -204, + Cronet_RESULT_ILLEGAL_STATE_REQUEST_NOT_INITIALIZED = -205, + Cronet_RESULT_ILLEGAL_STATE_REQUEST_ALREADY_INITIALIZED = -206, + Cronet_RESULT_ILLEGAL_STATE_REQUEST_NOT_STARTED = -207, + Cronet_RESULT_ILLEGAL_STATE_UNEXPECTED_REDIRECT = -208, + Cronet_RESULT_ILLEGAL_STATE_UNEXPECTED_READ = -209, + Cronet_RESULT_ILLEGAL_STATE_READ_FAILED = -210, + Cronet_RESULT_NULL_POINTER = -300, + Cronet_RESULT_NULL_POINTER_HOSTNAME = -301, + Cronet_RESULT_NULL_POINTER_SHA256_PINS = -302, + Cronet_RESULT_NULL_POINTER_EXPIRATION_DATE = -303, + Cronet_RESULT_NULL_POINTER_ENGINE = -304, + Cronet_RESULT_NULL_POINTER_URL = -305, + Cronet_RESULT_NULL_POINTER_CALLBACK = -306, + Cronet_RESULT_NULL_POINTER_EXECUTOR = -307, + Cronet_RESULT_NULL_POINTER_METHOD = -308, + Cronet_RESULT_NULL_POINTER_HEADER_NAME = -309, + Cronet_RESULT_NULL_POINTER_HEADER_VALUE = -310, + Cronet_RESULT_NULL_POINTER_PARAMS = -311, + Cronet_RESULT_NULL_POINTER_REQUEST_FINISHED_INFO_LISTENER_EXECUTOR = -312, +} Cronet_RESULT; + +typedef enum Cronet_Error_ERROR_CODE { + Cronet_Error_ERROR_CODE_ERROR_CALLBACK = 0, + Cronet_Error_ERROR_CODE_ERROR_HOSTNAME_NOT_RESOLVED = 1, + Cronet_Error_ERROR_CODE_ERROR_INTERNET_DISCONNECTED = 2, + Cronet_Error_ERROR_CODE_ERROR_NETWORK_CHANGED = 3, + Cronet_Error_ERROR_CODE_ERROR_TIMED_OUT = 4, + Cronet_Error_ERROR_CODE_ERROR_CONNECTION_CLOSED = 5, + Cronet_Error_ERROR_CODE_ERROR_CONNECTION_TIMED_OUT = 6, + Cronet_Error_ERROR_CODE_ERROR_CONNECTION_REFUSED = 7, + Cronet_Error_ERROR_CODE_ERROR_CONNECTION_RESET = 8, + Cronet_Error_ERROR_CODE_ERROR_ADDRESS_UNREACHABLE = 9, + Cronet_Error_ERROR_CODE_ERROR_QUIC_PROTOCOL_FAILED = 10, + Cronet_Error_ERROR_CODE_ERROR_OTHER = 11, +} Cronet_Error_ERROR_CODE; + +typedef enum Cronet_EngineParams_HTTP_CACHE_MODE { + Cronet_EngineParams_HTTP_CACHE_MODE_DISABLED = 0, + Cronet_EngineParams_HTTP_CACHE_MODE_IN_MEMORY = 1, + Cronet_EngineParams_HTTP_CACHE_MODE_DISK_NO_HTTP = 2, + Cronet_EngineParams_HTTP_CACHE_MODE_DISK = 3, +} Cronet_EngineParams_HTTP_CACHE_MODE; + +typedef enum Cronet_UrlRequestParams_REQUEST_PRIORITY { + Cronet_UrlRequestParams_REQUEST_PRIORITY_REQUEST_PRIORITY_IDLE = 0, + Cronet_UrlRequestParams_REQUEST_PRIORITY_REQUEST_PRIORITY_LOWEST = 1, + Cronet_UrlRequestParams_REQUEST_PRIORITY_REQUEST_PRIORITY_LOW = 2, + Cronet_UrlRequestParams_REQUEST_PRIORITY_REQUEST_PRIORITY_MEDIUM = 3, + Cronet_UrlRequestParams_REQUEST_PRIORITY_REQUEST_PRIORITY_HIGHEST = 4, +} Cronet_UrlRequestParams_REQUEST_PRIORITY; + +typedef enum Cronet_RequestFinishedInfo_FINISHED_REASON { + Cronet_RequestFinishedInfo_FINISHED_REASON_SUCCEEDED = 0, + Cronet_RequestFinishedInfo_FINISHED_REASON_FAILED = 1, + Cronet_RequestFinishedInfo_FINISHED_REASON_CANCELED = 2, +} Cronet_RequestFinishedInfo_FINISHED_REASON; + +typedef enum Cronet_UrlRequestStatusListener_Status { + Cronet_UrlRequestStatusListener_Status_INVALID = -1, + Cronet_UrlRequestStatusListener_Status_IDLE = 0, + Cronet_UrlRequestStatusListener_Status_WAITING_FOR_STALLED_SOCKET_POOL = 1, + Cronet_UrlRequestStatusListener_Status_WAITING_FOR_AVAILABLE_SOCKET = 2, + Cronet_UrlRequestStatusListener_Status_WAITING_FOR_DELEGATE = 3, + Cronet_UrlRequestStatusListener_Status_WAITING_FOR_CACHE = 4, + Cronet_UrlRequestStatusListener_Status_DOWNLOADING_PAC_FILE = 5, + Cronet_UrlRequestStatusListener_Status_RESOLVING_PROXY_FOR_URL = 6, + Cronet_UrlRequestStatusListener_Status_RESOLVING_HOST_IN_PAC_FILE = 7, + Cronet_UrlRequestStatusListener_Status_ESTABLISHING_PROXY_TUNNEL = 8, + Cronet_UrlRequestStatusListener_Status_RESOLVING_HOST = 9, + Cronet_UrlRequestStatusListener_Status_CONNECTING = 10, + Cronet_UrlRequestStatusListener_Status_SSL_HANDSHAKE = 11, + Cronet_UrlRequestStatusListener_Status_SENDING_REQUEST = 12, + Cronet_UrlRequestStatusListener_Status_WAITING_FOR_RESPONSE = 13, + Cronet_UrlRequestStatusListener_Status_READING_RESPONSE = 14, +} Cronet_UrlRequestStatusListener_Status; + +// Declare constants + +/////////////////////// +// Concrete interface Cronet_Buffer. + +// Create an instance of Cronet_Buffer. +CRONET_EXPORT Cronet_BufferPtr Cronet_Buffer_Create(void); +// Destroy an instance of Cronet_Buffer. +CRONET_EXPORT void Cronet_Buffer_Destroy(Cronet_BufferPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_Buffer_SetClientContext( + Cronet_BufferPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_Buffer_GetClientContext(Cronet_BufferPtr self); +// Concrete methods of Cronet_Buffer implemented by Cronet. +// The app calls them to manipulate Cronet_Buffer. +CRONET_EXPORT +void Cronet_Buffer_InitWithDataAndCallback(Cronet_BufferPtr self, + Cronet_RawDataPtr data, + uint64_t size, + Cronet_BufferCallbackPtr callback); +CRONET_EXPORT +void Cronet_Buffer_InitWithAlloc(Cronet_BufferPtr self, uint64_t size); +CRONET_EXPORT +uint64_t Cronet_Buffer_GetSize(Cronet_BufferPtr self); +CRONET_EXPORT +Cronet_RawDataPtr Cronet_Buffer_GetData(Cronet_BufferPtr self); +// Concrete interface Cronet_Buffer is implemented by Cronet. +// The app can implement these for testing / mocking. +typedef void (*Cronet_Buffer_InitWithDataAndCallbackFunc)( + Cronet_BufferPtr self, + Cronet_RawDataPtr data, + uint64_t size, + Cronet_BufferCallbackPtr callback); +typedef void (*Cronet_Buffer_InitWithAllocFunc)(Cronet_BufferPtr self, + uint64_t size); +typedef uint64_t (*Cronet_Buffer_GetSizeFunc)(Cronet_BufferPtr self); +typedef Cronet_RawDataPtr (*Cronet_Buffer_GetDataFunc)(Cronet_BufferPtr self); +// Concrete interface Cronet_Buffer is implemented by Cronet. +// The app can use this for testing / mocking. +CRONET_EXPORT Cronet_BufferPtr Cronet_Buffer_CreateWith( + Cronet_Buffer_InitWithDataAndCallbackFunc InitWithDataAndCallbackFunc, + Cronet_Buffer_InitWithAllocFunc InitWithAllocFunc, + Cronet_Buffer_GetSizeFunc GetSizeFunc, + Cronet_Buffer_GetDataFunc GetDataFunc); + +/////////////////////// +// Abstract interface Cronet_BufferCallback is implemented by the app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_BufferCallback. +CRONET_EXPORT void Cronet_BufferCallback_Destroy(Cronet_BufferCallbackPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_BufferCallback_SetClientContext( + Cronet_BufferCallbackPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_BufferCallback_GetClientContext(Cronet_BufferCallbackPtr self); +// Abstract interface Cronet_BufferCallback is implemented by the app. +// The following concrete methods forward call to app implementation. +// The app doesn't normally call them. +CRONET_EXPORT +void Cronet_BufferCallback_OnDestroy(Cronet_BufferCallbackPtr self, + Cronet_BufferPtr buffer); +// The app implements abstract interface Cronet_BufferCallback by defining +// custom functions for each method. +typedef void (*Cronet_BufferCallback_OnDestroyFunc)( + Cronet_BufferCallbackPtr self, + Cronet_BufferPtr buffer); +// The app creates an instance of Cronet_BufferCallback by providing custom +// functions for each method. +CRONET_EXPORT Cronet_BufferCallbackPtr Cronet_BufferCallback_CreateWith( + Cronet_BufferCallback_OnDestroyFunc OnDestroyFunc); + +/////////////////////// +// Abstract interface Cronet_Runnable is implemented by the app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_Runnable. +CRONET_EXPORT void Cronet_Runnable_Destroy(Cronet_RunnablePtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_Runnable_SetClientContext( + Cronet_RunnablePtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_Runnable_GetClientContext(Cronet_RunnablePtr self); +// Abstract interface Cronet_Runnable is implemented by the app. +// The following concrete methods forward call to app implementation. +// The app doesn't normally call them. +CRONET_EXPORT +void Cronet_Runnable_Run(Cronet_RunnablePtr self); +// The app implements abstract interface Cronet_Runnable by defining custom +// functions for each method. +typedef void (*Cronet_Runnable_RunFunc)(Cronet_RunnablePtr self); +// The app creates an instance of Cronet_Runnable by providing custom functions +// for each method. +CRONET_EXPORT Cronet_RunnablePtr +Cronet_Runnable_CreateWith(Cronet_Runnable_RunFunc RunFunc); + +/////////////////////// +// Abstract interface Cronet_Executor is implemented by the app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_Executor. +CRONET_EXPORT void Cronet_Executor_Destroy(Cronet_ExecutorPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_Executor_SetClientContext( + Cronet_ExecutorPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_Executor_GetClientContext(Cronet_ExecutorPtr self); +// Abstract interface Cronet_Executor is implemented by the app. +// The following concrete methods forward call to app implementation. +// The app doesn't normally call them. +CRONET_EXPORT +void Cronet_Executor_Execute(Cronet_ExecutorPtr self, + Cronet_RunnablePtr command); +// The app implements abstract interface Cronet_Executor by defining custom +// functions for each method. +typedef void (*Cronet_Executor_ExecuteFunc)(Cronet_ExecutorPtr self, + Cronet_RunnablePtr command); +// The app creates an instance of Cronet_Executor by providing custom functions +// for each method. +CRONET_EXPORT Cronet_ExecutorPtr +Cronet_Executor_CreateWith(Cronet_Executor_ExecuteFunc ExecuteFunc); + +/////////////////////// +// Concrete interface Cronet_Engine. + +// Create an instance of Cronet_Engine. +CRONET_EXPORT Cronet_EnginePtr Cronet_Engine_Create(void); +// Destroy an instance of Cronet_Engine. +CRONET_EXPORT void Cronet_Engine_Destroy(Cronet_EnginePtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_Engine_SetClientContext( + Cronet_EnginePtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_Engine_GetClientContext(Cronet_EnginePtr self); +// Concrete methods of Cronet_Engine implemented by Cronet. +// The app calls them to manipulate Cronet_Engine. +CRONET_EXPORT +Cronet_RESULT Cronet_Engine_StartWithParams(Cronet_EnginePtr self, + Cronet_EngineParamsPtr params); +CRONET_EXPORT +bool Cronet_Engine_StartNetLogToFile(Cronet_EnginePtr self, + Cronet_String file_name, + bool log_all); +CRONET_EXPORT +void Cronet_Engine_StopNetLog(Cronet_EnginePtr self); +CRONET_EXPORT +Cronet_RESULT Cronet_Engine_Shutdown(Cronet_EnginePtr self); +CRONET_EXPORT +Cronet_String Cronet_Engine_GetVersionString(Cronet_EnginePtr self); +CRONET_EXPORT +Cronet_String Cronet_Engine_GetDefaultUserAgent(Cronet_EnginePtr self); +CRONET_EXPORT +void Cronet_Engine_AddRequestFinishedListener( + Cronet_EnginePtr self, + Cronet_RequestFinishedInfoListenerPtr listener, + Cronet_ExecutorPtr executor); +CRONET_EXPORT +void Cronet_Engine_RemoveRequestFinishedListener( + Cronet_EnginePtr self, + Cronet_RequestFinishedInfoListenerPtr listener); +// Concrete interface Cronet_Engine is implemented by Cronet. +// The app can implement these for testing / mocking. +typedef Cronet_RESULT (*Cronet_Engine_StartWithParamsFunc)( + Cronet_EnginePtr self, + Cronet_EngineParamsPtr params); +typedef bool (*Cronet_Engine_StartNetLogToFileFunc)(Cronet_EnginePtr self, + Cronet_String file_name, + bool log_all); +typedef void (*Cronet_Engine_StopNetLogFunc)(Cronet_EnginePtr self); +typedef Cronet_RESULT (*Cronet_Engine_ShutdownFunc)(Cronet_EnginePtr self); +typedef Cronet_String (*Cronet_Engine_GetVersionStringFunc)( + Cronet_EnginePtr self); +typedef Cronet_String (*Cronet_Engine_GetDefaultUserAgentFunc)( + Cronet_EnginePtr self); +typedef void (*Cronet_Engine_AddRequestFinishedListenerFunc)( + Cronet_EnginePtr self, + Cronet_RequestFinishedInfoListenerPtr listener, + Cronet_ExecutorPtr executor); +typedef void (*Cronet_Engine_RemoveRequestFinishedListenerFunc)( + Cronet_EnginePtr self, + Cronet_RequestFinishedInfoListenerPtr listener); +// Concrete interface Cronet_Engine is implemented by Cronet. +// The app can use this for testing / mocking. +CRONET_EXPORT Cronet_EnginePtr Cronet_Engine_CreateWith( + Cronet_Engine_StartWithParamsFunc StartWithParamsFunc, + Cronet_Engine_StartNetLogToFileFunc StartNetLogToFileFunc, + Cronet_Engine_StopNetLogFunc StopNetLogFunc, + Cronet_Engine_ShutdownFunc ShutdownFunc, + Cronet_Engine_GetVersionStringFunc GetVersionStringFunc, + Cronet_Engine_GetDefaultUserAgentFunc GetDefaultUserAgentFunc, + Cronet_Engine_AddRequestFinishedListenerFunc AddRequestFinishedListenerFunc, + Cronet_Engine_RemoveRequestFinishedListenerFunc + RemoveRequestFinishedListenerFunc); + +/////////////////////// +// Abstract interface Cronet_UrlRequestStatusListener is implemented by the app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_UrlRequestStatusListener. +CRONET_EXPORT void Cronet_UrlRequestStatusListener_Destroy( + Cronet_UrlRequestStatusListenerPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_UrlRequestStatusListener_SetClientContext( + Cronet_UrlRequestStatusListenerPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_UrlRequestStatusListener_GetClientContext( + Cronet_UrlRequestStatusListenerPtr self); +// Abstract interface Cronet_UrlRequestStatusListener is implemented by the app. +// The following concrete methods forward call to app implementation. +// The app doesn't normally call them. +CRONET_EXPORT +void Cronet_UrlRequestStatusListener_OnStatus( + Cronet_UrlRequestStatusListenerPtr self, + Cronet_UrlRequestStatusListener_Status status); +// The app implements abstract interface Cronet_UrlRequestStatusListener by +// defining custom functions for each method. +typedef void (*Cronet_UrlRequestStatusListener_OnStatusFunc)( + Cronet_UrlRequestStatusListenerPtr self, + Cronet_UrlRequestStatusListener_Status status); +// The app creates an instance of Cronet_UrlRequestStatusListener by providing +// custom functions for each method. +CRONET_EXPORT Cronet_UrlRequestStatusListenerPtr +Cronet_UrlRequestStatusListener_CreateWith( + Cronet_UrlRequestStatusListener_OnStatusFunc OnStatusFunc); + +/////////////////////// +// Abstract interface Cronet_UrlRequestCallback is implemented by the app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_UrlRequestCallback. +CRONET_EXPORT void Cronet_UrlRequestCallback_Destroy( + Cronet_UrlRequestCallbackPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_UrlRequestCallback_SetClientContext( + Cronet_UrlRequestCallbackPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_UrlRequestCallback_GetClientContext(Cronet_UrlRequestCallbackPtr self); +// Abstract interface Cronet_UrlRequestCallback is implemented by the app. +// The following concrete methods forward call to app implementation. +// The app doesn't normally call them. +CRONET_EXPORT +void Cronet_UrlRequestCallback_OnRedirectReceived( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info, + Cronet_String new_location_url); +CRONET_EXPORT +void Cronet_UrlRequestCallback_OnResponseStarted( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info); +CRONET_EXPORT +void Cronet_UrlRequestCallback_OnReadCompleted( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info, + Cronet_BufferPtr buffer, + uint64_t bytes_read); +CRONET_EXPORT +void Cronet_UrlRequestCallback_OnSucceeded(Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info); +CRONET_EXPORT +void Cronet_UrlRequestCallback_OnFailed(Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info, + Cronet_ErrorPtr error); +CRONET_EXPORT +void Cronet_UrlRequestCallback_OnCanceled(Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info); +// The app implements abstract interface Cronet_UrlRequestCallback by defining +// custom functions for each method. +typedef void (*Cronet_UrlRequestCallback_OnRedirectReceivedFunc)( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info, + Cronet_String new_location_url); +typedef void (*Cronet_UrlRequestCallback_OnResponseStartedFunc)( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info); +typedef void (*Cronet_UrlRequestCallback_OnReadCompletedFunc)( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info, + Cronet_BufferPtr buffer, + uint64_t bytes_read); +typedef void (*Cronet_UrlRequestCallback_OnSucceededFunc)( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info); +typedef void (*Cronet_UrlRequestCallback_OnFailedFunc)( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info, + Cronet_ErrorPtr error); +typedef void (*Cronet_UrlRequestCallback_OnCanceledFunc)( + Cronet_UrlRequestCallbackPtr self, + Cronet_UrlRequestPtr request, + Cronet_UrlResponseInfoPtr info); +// The app creates an instance of Cronet_UrlRequestCallback by providing custom +// functions for each method. +CRONET_EXPORT Cronet_UrlRequestCallbackPtr Cronet_UrlRequestCallback_CreateWith( + Cronet_UrlRequestCallback_OnRedirectReceivedFunc OnRedirectReceivedFunc, + Cronet_UrlRequestCallback_OnResponseStartedFunc OnResponseStartedFunc, + Cronet_UrlRequestCallback_OnReadCompletedFunc OnReadCompletedFunc, + Cronet_UrlRequestCallback_OnSucceededFunc OnSucceededFunc, + Cronet_UrlRequestCallback_OnFailedFunc OnFailedFunc, + Cronet_UrlRequestCallback_OnCanceledFunc OnCanceledFunc); + +/////////////////////// +// Concrete interface Cronet_UploadDataSink. + +// Create an instance of Cronet_UploadDataSink. +CRONET_EXPORT Cronet_UploadDataSinkPtr Cronet_UploadDataSink_Create(void); +// Destroy an instance of Cronet_UploadDataSink. +CRONET_EXPORT void Cronet_UploadDataSink_Destroy(Cronet_UploadDataSinkPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_UploadDataSink_SetClientContext( + Cronet_UploadDataSinkPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_UploadDataSink_GetClientContext(Cronet_UploadDataSinkPtr self); +// Concrete methods of Cronet_UploadDataSink implemented by Cronet. +// The app calls them to manipulate Cronet_UploadDataSink. +CRONET_EXPORT +void Cronet_UploadDataSink_OnReadSucceeded(Cronet_UploadDataSinkPtr self, + uint64_t bytes_read, + bool final_chunk); +CRONET_EXPORT +void Cronet_UploadDataSink_OnReadError(Cronet_UploadDataSinkPtr self, + Cronet_String error_message); +CRONET_EXPORT +void Cronet_UploadDataSink_OnRewindSucceeded(Cronet_UploadDataSinkPtr self); +CRONET_EXPORT +void Cronet_UploadDataSink_OnRewindError(Cronet_UploadDataSinkPtr self, + Cronet_String error_message); +// Concrete interface Cronet_UploadDataSink is implemented by Cronet. +// The app can implement these for testing / mocking. +typedef void (*Cronet_UploadDataSink_OnReadSucceededFunc)( + Cronet_UploadDataSinkPtr self, + uint64_t bytes_read, + bool final_chunk); +typedef void (*Cronet_UploadDataSink_OnReadErrorFunc)( + Cronet_UploadDataSinkPtr self, + Cronet_String error_message); +typedef void (*Cronet_UploadDataSink_OnRewindSucceededFunc)( + Cronet_UploadDataSinkPtr self); +typedef void (*Cronet_UploadDataSink_OnRewindErrorFunc)( + Cronet_UploadDataSinkPtr self, + Cronet_String error_message); +// Concrete interface Cronet_UploadDataSink is implemented by Cronet. +// The app can use this for testing / mocking. +CRONET_EXPORT Cronet_UploadDataSinkPtr Cronet_UploadDataSink_CreateWith( + Cronet_UploadDataSink_OnReadSucceededFunc OnReadSucceededFunc, + Cronet_UploadDataSink_OnReadErrorFunc OnReadErrorFunc, + Cronet_UploadDataSink_OnRewindSucceededFunc OnRewindSucceededFunc, + Cronet_UploadDataSink_OnRewindErrorFunc OnRewindErrorFunc); + +/////////////////////// +// Abstract interface Cronet_UploadDataProvider is implemented by the app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_UploadDataProvider. +CRONET_EXPORT void Cronet_UploadDataProvider_Destroy( + Cronet_UploadDataProviderPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_UploadDataProvider_SetClientContext( + Cronet_UploadDataProviderPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_UploadDataProvider_GetClientContext(Cronet_UploadDataProviderPtr self); +// Abstract interface Cronet_UploadDataProvider is implemented by the app. +// The following concrete methods forward call to app implementation. +// The app doesn't normally call them. +CRONET_EXPORT +int64_t Cronet_UploadDataProvider_GetLength(Cronet_UploadDataProviderPtr self); +CRONET_EXPORT +void Cronet_UploadDataProvider_Read(Cronet_UploadDataProviderPtr self, + Cronet_UploadDataSinkPtr upload_data_sink, + Cronet_BufferPtr buffer); +CRONET_EXPORT +void Cronet_UploadDataProvider_Rewind( + Cronet_UploadDataProviderPtr self, + Cronet_UploadDataSinkPtr upload_data_sink); +CRONET_EXPORT +void Cronet_UploadDataProvider_Close(Cronet_UploadDataProviderPtr self); +// The app implements abstract interface Cronet_UploadDataProvider by defining +// custom functions for each method. +typedef int64_t (*Cronet_UploadDataProvider_GetLengthFunc)( + Cronet_UploadDataProviderPtr self); +typedef void (*Cronet_UploadDataProvider_ReadFunc)( + Cronet_UploadDataProviderPtr self, + Cronet_UploadDataSinkPtr upload_data_sink, + Cronet_BufferPtr buffer); +typedef void (*Cronet_UploadDataProvider_RewindFunc)( + Cronet_UploadDataProviderPtr self, + Cronet_UploadDataSinkPtr upload_data_sink); +typedef void (*Cronet_UploadDataProvider_CloseFunc)( + Cronet_UploadDataProviderPtr self); +// The app creates an instance of Cronet_UploadDataProvider by providing custom +// functions for each method. +CRONET_EXPORT Cronet_UploadDataProviderPtr Cronet_UploadDataProvider_CreateWith( + Cronet_UploadDataProvider_GetLengthFunc GetLengthFunc, + Cronet_UploadDataProvider_ReadFunc ReadFunc, + Cronet_UploadDataProvider_RewindFunc RewindFunc, + Cronet_UploadDataProvider_CloseFunc CloseFunc); + +/////////////////////// +// Concrete interface Cronet_UrlRequest. + +// Create an instance of Cronet_UrlRequest. +CRONET_EXPORT Cronet_UrlRequestPtr Cronet_UrlRequest_Create(void); +// Destroy an instance of Cronet_UrlRequest. +CRONET_EXPORT void Cronet_UrlRequest_Destroy(Cronet_UrlRequestPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_UrlRequest_SetClientContext( + Cronet_UrlRequestPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_UrlRequest_GetClientContext(Cronet_UrlRequestPtr self); +// Concrete methods of Cronet_UrlRequest implemented by Cronet. +// The app calls them to manipulate Cronet_UrlRequest. +CRONET_EXPORT +Cronet_RESULT Cronet_UrlRequest_InitWithParams( + Cronet_UrlRequestPtr self, + Cronet_EnginePtr engine, + Cronet_String url, + Cronet_UrlRequestParamsPtr params, + Cronet_UrlRequestCallbackPtr callback, + Cronet_ExecutorPtr executor); +CRONET_EXPORT +Cronet_RESULT Cronet_UrlRequest_Start(Cronet_UrlRequestPtr self); +CRONET_EXPORT +Cronet_RESULT Cronet_UrlRequest_FollowRedirect(Cronet_UrlRequestPtr self); +CRONET_EXPORT +Cronet_RESULT Cronet_UrlRequest_Read(Cronet_UrlRequestPtr self, + Cronet_BufferPtr buffer); +CRONET_EXPORT +void Cronet_UrlRequest_Cancel(Cronet_UrlRequestPtr self); +CRONET_EXPORT +bool Cronet_UrlRequest_IsDone(Cronet_UrlRequestPtr self); +CRONET_EXPORT +void Cronet_UrlRequest_GetStatus(Cronet_UrlRequestPtr self, + Cronet_UrlRequestStatusListenerPtr listener); +// Concrete interface Cronet_UrlRequest is implemented by Cronet. +// The app can implement these for testing / mocking. +typedef Cronet_RESULT (*Cronet_UrlRequest_InitWithParamsFunc)( + Cronet_UrlRequestPtr self, + Cronet_EnginePtr engine, + Cronet_String url, + Cronet_UrlRequestParamsPtr params, + Cronet_UrlRequestCallbackPtr callback, + Cronet_ExecutorPtr executor); +typedef Cronet_RESULT (*Cronet_UrlRequest_StartFunc)(Cronet_UrlRequestPtr self); +typedef Cronet_RESULT (*Cronet_UrlRequest_FollowRedirectFunc)( + Cronet_UrlRequestPtr self); +typedef Cronet_RESULT (*Cronet_UrlRequest_ReadFunc)(Cronet_UrlRequestPtr self, + Cronet_BufferPtr buffer); +typedef void (*Cronet_UrlRequest_CancelFunc)(Cronet_UrlRequestPtr self); +typedef bool (*Cronet_UrlRequest_IsDoneFunc)(Cronet_UrlRequestPtr self); +typedef void (*Cronet_UrlRequest_GetStatusFunc)( + Cronet_UrlRequestPtr self, + Cronet_UrlRequestStatusListenerPtr listener); +// Concrete interface Cronet_UrlRequest is implemented by Cronet. +// The app can use this for testing / mocking. +CRONET_EXPORT Cronet_UrlRequestPtr Cronet_UrlRequest_CreateWith( + Cronet_UrlRequest_InitWithParamsFunc InitWithParamsFunc, + Cronet_UrlRequest_StartFunc StartFunc, + Cronet_UrlRequest_FollowRedirectFunc FollowRedirectFunc, + Cronet_UrlRequest_ReadFunc ReadFunc, + Cronet_UrlRequest_CancelFunc CancelFunc, + Cronet_UrlRequest_IsDoneFunc IsDoneFunc, + Cronet_UrlRequest_GetStatusFunc GetStatusFunc); + +/////////////////////// +// Abstract interface Cronet_RequestFinishedInfoListener is implemented by the +// app. + +// There is no method to create a concrete implementation. + +// Destroy an instance of Cronet_RequestFinishedInfoListener. +CRONET_EXPORT void Cronet_RequestFinishedInfoListener_Destroy( + Cronet_RequestFinishedInfoListenerPtr self); +// Set and get app-specific Cronet_ClientContext. +CRONET_EXPORT void Cronet_RequestFinishedInfoListener_SetClientContext( + Cronet_RequestFinishedInfoListenerPtr self, + Cronet_ClientContext client_context); +CRONET_EXPORT Cronet_ClientContext +Cronet_RequestFinishedInfoListener_GetClientContext( + Cronet_RequestFinishedInfoListenerPtr self); +// Abstract interface Cronet_RequestFinishedInfoListener is implemented by the +// app. The following concrete methods forward call to app implementation. The +// app doesn't normally call them. +CRONET_EXPORT +void Cronet_RequestFinishedInfoListener_OnRequestFinished( + Cronet_RequestFinishedInfoListenerPtr self, + Cronet_RequestFinishedInfoPtr request_info, + Cronet_UrlResponseInfoPtr response_info, + Cronet_ErrorPtr error); +// The app implements abstract interface Cronet_RequestFinishedInfoListener by +// defining custom functions for each method. +typedef void (*Cronet_RequestFinishedInfoListener_OnRequestFinishedFunc)( + Cronet_RequestFinishedInfoListenerPtr self, + Cronet_RequestFinishedInfoPtr request_info, + Cronet_UrlResponseInfoPtr response_info, + Cronet_ErrorPtr error); +// The app creates an instance of Cronet_RequestFinishedInfoListener by +// providing custom functions for each method. +CRONET_EXPORT Cronet_RequestFinishedInfoListenerPtr +Cronet_RequestFinishedInfoListener_CreateWith( + Cronet_RequestFinishedInfoListener_OnRequestFinishedFunc + OnRequestFinishedFunc); + +/////////////////////// +// Struct Cronet_Error. +CRONET_EXPORT Cronet_ErrorPtr Cronet_Error_Create(void); +CRONET_EXPORT void Cronet_Error_Destroy(Cronet_ErrorPtr self); +// Cronet_Error setters. +CRONET_EXPORT +void Cronet_Error_error_code_set(Cronet_ErrorPtr self, + const Cronet_Error_ERROR_CODE error_code); +CRONET_EXPORT +void Cronet_Error_message_set(Cronet_ErrorPtr self, + const Cronet_String message); +CRONET_EXPORT +void Cronet_Error_internal_error_code_set(Cronet_ErrorPtr self, + const int32_t internal_error_code); +CRONET_EXPORT +void Cronet_Error_immediately_retryable_set(Cronet_ErrorPtr self, + const bool immediately_retryable); +CRONET_EXPORT +void Cronet_Error_quic_detailed_error_code_set( + Cronet_ErrorPtr self, + const int32_t quic_detailed_error_code); +// Cronet_Error getters. +CRONET_EXPORT +Cronet_Error_ERROR_CODE Cronet_Error_error_code_get(const Cronet_ErrorPtr self); +CRONET_EXPORT +Cronet_String Cronet_Error_message_get(const Cronet_ErrorPtr self); +CRONET_EXPORT +int32_t Cronet_Error_internal_error_code_get(const Cronet_ErrorPtr self); +CRONET_EXPORT +bool Cronet_Error_immediately_retryable_get(const Cronet_ErrorPtr self); +CRONET_EXPORT +int32_t Cronet_Error_quic_detailed_error_code_get(const Cronet_ErrorPtr self); + +/////////////////////// +// Struct Cronet_QuicHint. +CRONET_EXPORT Cronet_QuicHintPtr Cronet_QuicHint_Create(void); +CRONET_EXPORT void Cronet_QuicHint_Destroy(Cronet_QuicHintPtr self); +// Cronet_QuicHint setters. +CRONET_EXPORT +void Cronet_QuicHint_host_set(Cronet_QuicHintPtr self, + const Cronet_String host); +CRONET_EXPORT +void Cronet_QuicHint_port_set(Cronet_QuicHintPtr self, const int32_t port); +CRONET_EXPORT +void Cronet_QuicHint_alternate_port_set(Cronet_QuicHintPtr self, + const int32_t alternate_port); +// Cronet_QuicHint getters. +CRONET_EXPORT +Cronet_String Cronet_QuicHint_host_get(const Cronet_QuicHintPtr self); +CRONET_EXPORT +int32_t Cronet_QuicHint_port_get(const Cronet_QuicHintPtr self); +CRONET_EXPORT +int32_t Cronet_QuicHint_alternate_port_get(const Cronet_QuicHintPtr self); + +/////////////////////// +// Struct Cronet_PublicKeyPins. +CRONET_EXPORT Cronet_PublicKeyPinsPtr Cronet_PublicKeyPins_Create(void); +CRONET_EXPORT void Cronet_PublicKeyPins_Destroy(Cronet_PublicKeyPinsPtr self); +// Cronet_PublicKeyPins setters. +CRONET_EXPORT +void Cronet_PublicKeyPins_host_set(Cronet_PublicKeyPinsPtr self, + const Cronet_String host); +CRONET_EXPORT +void Cronet_PublicKeyPins_pins_sha256_add(Cronet_PublicKeyPinsPtr self, + const Cronet_String element); +CRONET_EXPORT +void Cronet_PublicKeyPins_include_subdomains_set(Cronet_PublicKeyPinsPtr self, + const bool include_subdomains); +CRONET_EXPORT +void Cronet_PublicKeyPins_expiration_date_set(Cronet_PublicKeyPinsPtr self, + const int64_t expiration_date); +// Cronet_PublicKeyPins getters. +CRONET_EXPORT +Cronet_String Cronet_PublicKeyPins_host_get(const Cronet_PublicKeyPinsPtr self); +CRONET_EXPORT +uint32_t Cronet_PublicKeyPins_pins_sha256_size( + const Cronet_PublicKeyPinsPtr self); +CRONET_EXPORT +Cronet_String Cronet_PublicKeyPins_pins_sha256_at( + const Cronet_PublicKeyPinsPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_PublicKeyPins_pins_sha256_clear(Cronet_PublicKeyPinsPtr self); +CRONET_EXPORT +bool Cronet_PublicKeyPins_include_subdomains_get( + const Cronet_PublicKeyPinsPtr self); +CRONET_EXPORT +int64_t Cronet_PublicKeyPins_expiration_date_get( + const Cronet_PublicKeyPinsPtr self); + +/////////////////////// +// Struct Cronet_EngineParams. +CRONET_EXPORT Cronet_EngineParamsPtr Cronet_EngineParams_Create(void); +CRONET_EXPORT void Cronet_EngineParams_Destroy(Cronet_EngineParamsPtr self); +// Cronet_EngineParams setters. +CRONET_EXPORT +void Cronet_EngineParams_enable_check_result_set( + Cronet_EngineParamsPtr self, + const bool enable_check_result); +CRONET_EXPORT +void Cronet_EngineParams_user_agent_set(Cronet_EngineParamsPtr self, + const Cronet_String user_agent); +CRONET_EXPORT +void Cronet_EngineParams_accept_language_set( + Cronet_EngineParamsPtr self, + const Cronet_String accept_language); +CRONET_EXPORT +void Cronet_EngineParams_storage_path_set(Cronet_EngineParamsPtr self, + const Cronet_String storage_path); +CRONET_EXPORT +void Cronet_EngineParams_enable_quic_set(Cronet_EngineParamsPtr self, + const bool enable_quic); +CRONET_EXPORT +void Cronet_EngineParams_enable_http2_set(Cronet_EngineParamsPtr self, + const bool enable_http2); +CRONET_EXPORT +void Cronet_EngineParams_enable_brotli_set(Cronet_EngineParamsPtr self, + const bool enable_brotli); +CRONET_EXPORT +void Cronet_EngineParams_http_cache_mode_set( + Cronet_EngineParamsPtr self, + const Cronet_EngineParams_HTTP_CACHE_MODE http_cache_mode); +CRONET_EXPORT +void Cronet_EngineParams_http_cache_max_size_set( + Cronet_EngineParamsPtr self, + const int64_t http_cache_max_size); +CRONET_EXPORT +void Cronet_EngineParams_quic_hints_add(Cronet_EngineParamsPtr self, + const Cronet_QuicHintPtr element); +CRONET_EXPORT +void Cronet_EngineParams_public_key_pins_add( + Cronet_EngineParamsPtr self, + const Cronet_PublicKeyPinsPtr element); +CRONET_EXPORT +void Cronet_EngineParams_enable_public_key_pinning_bypass_for_local_trust_anchors_set( + Cronet_EngineParamsPtr self, + const bool enable_public_key_pinning_bypass_for_local_trust_anchors); +CRONET_EXPORT +void Cronet_EngineParams_network_thread_priority_set( + Cronet_EngineParamsPtr self, + const double network_thread_priority); +CRONET_EXPORT +void Cronet_EngineParams_experimental_options_set( + Cronet_EngineParamsPtr self, + const Cronet_String experimental_options); +// Cronet_EngineParams getters. +CRONET_EXPORT +bool Cronet_EngineParams_enable_check_result_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_String Cronet_EngineParams_user_agent_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_String Cronet_EngineParams_accept_language_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_String Cronet_EngineParams_storage_path_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +bool Cronet_EngineParams_enable_quic_get(const Cronet_EngineParamsPtr self); +CRONET_EXPORT +bool Cronet_EngineParams_enable_http2_get(const Cronet_EngineParamsPtr self); +CRONET_EXPORT +bool Cronet_EngineParams_enable_brotli_get(const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_EngineParams_HTTP_CACHE_MODE Cronet_EngineParams_http_cache_mode_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +int64_t Cronet_EngineParams_http_cache_max_size_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +uint32_t Cronet_EngineParams_quic_hints_size(const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_QuicHintPtr Cronet_EngineParams_quic_hints_at( + const Cronet_EngineParamsPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_EngineParams_quic_hints_clear(Cronet_EngineParamsPtr self); +CRONET_EXPORT +uint32_t Cronet_EngineParams_public_key_pins_size( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_PublicKeyPinsPtr Cronet_EngineParams_public_key_pins_at( + const Cronet_EngineParamsPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_EngineParams_public_key_pins_clear(Cronet_EngineParamsPtr self); +CRONET_EXPORT +bool Cronet_EngineParams_enable_public_key_pinning_bypass_for_local_trust_anchors_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +double Cronet_EngineParams_network_thread_priority_get( + const Cronet_EngineParamsPtr self); +CRONET_EXPORT +Cronet_String Cronet_EngineParams_experimental_options_get( + const Cronet_EngineParamsPtr self); + +/////////////////////// +// Struct Cronet_HttpHeader. +CRONET_EXPORT Cronet_HttpHeaderPtr Cronet_HttpHeader_Create(void); +CRONET_EXPORT void Cronet_HttpHeader_Destroy(Cronet_HttpHeaderPtr self); +// Cronet_HttpHeader setters. +CRONET_EXPORT +void Cronet_HttpHeader_name_set(Cronet_HttpHeaderPtr self, + const Cronet_String name); +CRONET_EXPORT +void Cronet_HttpHeader_value_set(Cronet_HttpHeaderPtr self, + const Cronet_String value); +// Cronet_HttpHeader getters. +CRONET_EXPORT +Cronet_String Cronet_HttpHeader_name_get(const Cronet_HttpHeaderPtr self); +CRONET_EXPORT +Cronet_String Cronet_HttpHeader_value_get(const Cronet_HttpHeaderPtr self); + +/////////////////////// +// Struct Cronet_UrlResponseInfo. +CRONET_EXPORT Cronet_UrlResponseInfoPtr Cronet_UrlResponseInfo_Create(void); +CRONET_EXPORT void Cronet_UrlResponseInfo_Destroy( + Cronet_UrlResponseInfoPtr self); +// Cronet_UrlResponseInfo setters. +CRONET_EXPORT +void Cronet_UrlResponseInfo_url_set(Cronet_UrlResponseInfoPtr self, + const Cronet_String url); +CRONET_EXPORT +void Cronet_UrlResponseInfo_url_chain_add(Cronet_UrlResponseInfoPtr self, + const Cronet_String element); +CRONET_EXPORT +void Cronet_UrlResponseInfo_http_status_code_set( + Cronet_UrlResponseInfoPtr self, + const int32_t http_status_code); +CRONET_EXPORT +void Cronet_UrlResponseInfo_http_status_text_set( + Cronet_UrlResponseInfoPtr self, + const Cronet_String http_status_text); +CRONET_EXPORT +void Cronet_UrlResponseInfo_all_headers_list_add( + Cronet_UrlResponseInfoPtr self, + const Cronet_HttpHeaderPtr element); +CRONET_EXPORT +void Cronet_UrlResponseInfo_was_cached_set(Cronet_UrlResponseInfoPtr self, + const bool was_cached); +CRONET_EXPORT +void Cronet_UrlResponseInfo_negotiated_protocol_set( + Cronet_UrlResponseInfoPtr self, + const Cronet_String negotiated_protocol); +CRONET_EXPORT +void Cronet_UrlResponseInfo_proxy_server_set(Cronet_UrlResponseInfoPtr self, + const Cronet_String proxy_server); +CRONET_EXPORT +void Cronet_UrlResponseInfo_received_byte_count_set( + Cronet_UrlResponseInfoPtr self, + const int64_t received_byte_count); +// Cronet_UrlResponseInfo getters. +CRONET_EXPORT +Cronet_String Cronet_UrlResponseInfo_url_get( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +uint32_t Cronet_UrlResponseInfo_url_chain_size( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +Cronet_String Cronet_UrlResponseInfo_url_chain_at( + const Cronet_UrlResponseInfoPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_UrlResponseInfo_url_chain_clear(Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +int32_t Cronet_UrlResponseInfo_http_status_code_get( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +Cronet_String Cronet_UrlResponseInfo_http_status_text_get( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +uint32_t Cronet_UrlResponseInfo_all_headers_list_size( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +Cronet_HttpHeaderPtr Cronet_UrlResponseInfo_all_headers_list_at( + const Cronet_UrlResponseInfoPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_UrlResponseInfo_all_headers_list_clear( + Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +bool Cronet_UrlResponseInfo_was_cached_get( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +Cronet_String Cronet_UrlResponseInfo_negotiated_protocol_get( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +Cronet_String Cronet_UrlResponseInfo_proxy_server_get( + const Cronet_UrlResponseInfoPtr self); +CRONET_EXPORT +int64_t Cronet_UrlResponseInfo_received_byte_count_get( + const Cronet_UrlResponseInfoPtr self); + +/////////////////////// +// Struct Cronet_UrlRequestParams. +CRONET_EXPORT Cronet_UrlRequestParamsPtr Cronet_UrlRequestParams_Create(void); +CRONET_EXPORT void Cronet_UrlRequestParams_Destroy( + Cronet_UrlRequestParamsPtr self); +// Cronet_UrlRequestParams setters. +CRONET_EXPORT +void Cronet_UrlRequestParams_http_method_set(Cronet_UrlRequestParamsPtr self, + const Cronet_String http_method); +CRONET_EXPORT +void Cronet_UrlRequestParams_request_headers_add( + Cronet_UrlRequestParamsPtr self, + const Cronet_HttpHeaderPtr element); +CRONET_EXPORT +void Cronet_UrlRequestParams_disable_cache_set(Cronet_UrlRequestParamsPtr self, + const bool disable_cache); +CRONET_EXPORT +void Cronet_UrlRequestParams_priority_set( + Cronet_UrlRequestParamsPtr self, + const Cronet_UrlRequestParams_REQUEST_PRIORITY priority); +CRONET_EXPORT +void Cronet_UrlRequestParams_upload_data_provider_set( + Cronet_UrlRequestParamsPtr self, + const Cronet_UploadDataProviderPtr upload_data_provider); +CRONET_EXPORT +void Cronet_UrlRequestParams_upload_data_provider_executor_set( + Cronet_UrlRequestParamsPtr self, + const Cronet_ExecutorPtr upload_data_provider_executor); +CRONET_EXPORT +void Cronet_UrlRequestParams_allow_direct_executor_set( + Cronet_UrlRequestParamsPtr self, + const bool allow_direct_executor); +CRONET_EXPORT +void Cronet_UrlRequestParams_annotations_add(Cronet_UrlRequestParamsPtr self, + const Cronet_RawDataPtr element); +CRONET_EXPORT +void Cronet_UrlRequestParams_request_finished_listener_set( + Cronet_UrlRequestParamsPtr self, + const Cronet_RequestFinishedInfoListenerPtr request_finished_listener); +CRONET_EXPORT +void Cronet_UrlRequestParams_request_finished_executor_set( + Cronet_UrlRequestParamsPtr self, + const Cronet_ExecutorPtr request_finished_executor); +// Cronet_UrlRequestParams getters. +CRONET_EXPORT +Cronet_String Cronet_UrlRequestParams_http_method_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +uint32_t Cronet_UrlRequestParams_request_headers_size( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_HttpHeaderPtr Cronet_UrlRequestParams_request_headers_at( + const Cronet_UrlRequestParamsPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_UrlRequestParams_request_headers_clear( + Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +bool Cronet_UrlRequestParams_disable_cache_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_UrlRequestParams_REQUEST_PRIORITY Cronet_UrlRequestParams_priority_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_UploadDataProviderPtr Cronet_UrlRequestParams_upload_data_provider_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_ExecutorPtr Cronet_UrlRequestParams_upload_data_provider_executor_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +bool Cronet_UrlRequestParams_allow_direct_executor_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +uint32_t Cronet_UrlRequestParams_annotations_size( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_RawDataPtr Cronet_UrlRequestParams_annotations_at( + const Cronet_UrlRequestParamsPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_UrlRequestParams_annotations_clear(Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_RequestFinishedInfoListenerPtr +Cronet_UrlRequestParams_request_finished_listener_get( + const Cronet_UrlRequestParamsPtr self); +CRONET_EXPORT +Cronet_ExecutorPtr Cronet_UrlRequestParams_request_finished_executor_get( + const Cronet_UrlRequestParamsPtr self); + +/////////////////////// +// Struct Cronet_DateTime. +CRONET_EXPORT Cronet_DateTimePtr Cronet_DateTime_Create(void); +CRONET_EXPORT void Cronet_DateTime_Destroy(Cronet_DateTimePtr self); +// Cronet_DateTime setters. +CRONET_EXPORT +void Cronet_DateTime_value_set(Cronet_DateTimePtr self, const int64_t value); +// Cronet_DateTime getters. +CRONET_EXPORT +int64_t Cronet_DateTime_value_get(const Cronet_DateTimePtr self); + +/////////////////////// +// Struct Cronet_Metrics. +CRONET_EXPORT Cronet_MetricsPtr Cronet_Metrics_Create(void); +CRONET_EXPORT void Cronet_Metrics_Destroy(Cronet_MetricsPtr self); +// Cronet_Metrics setters. +CRONET_EXPORT +void Cronet_Metrics_request_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr request_start); +// Move data from |request_start|. The caller retains ownership of +// |request_start| and must destroy it. +void Cronet_Metrics_request_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr request_start); +CRONET_EXPORT +void Cronet_Metrics_dns_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr dns_start); +// Move data from |dns_start|. The caller retains ownership of |dns_start| and +// must destroy it. +void Cronet_Metrics_dns_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr dns_start); +CRONET_EXPORT +void Cronet_Metrics_dns_end_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr dns_end); +// Move data from |dns_end|. The caller retains ownership of |dns_end| and must +// destroy it. +void Cronet_Metrics_dns_end_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr dns_end); +CRONET_EXPORT +void Cronet_Metrics_connect_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr connect_start); +// Move data from |connect_start|. The caller retains ownership of +// |connect_start| and must destroy it. +void Cronet_Metrics_connect_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr connect_start); +CRONET_EXPORT +void Cronet_Metrics_connect_end_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr connect_end); +// Move data from |connect_end|. The caller retains ownership of |connect_end| +// and must destroy it. +void Cronet_Metrics_connect_end_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr connect_end); +CRONET_EXPORT +void Cronet_Metrics_ssl_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr ssl_start); +// Move data from |ssl_start|. The caller retains ownership of |ssl_start| and +// must destroy it. +void Cronet_Metrics_ssl_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr ssl_start); +CRONET_EXPORT +void Cronet_Metrics_ssl_end_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr ssl_end); +// Move data from |ssl_end|. The caller retains ownership of |ssl_end| and must +// destroy it. +void Cronet_Metrics_ssl_end_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr ssl_end); +CRONET_EXPORT +void Cronet_Metrics_sending_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr sending_start); +// Move data from |sending_start|. The caller retains ownership of +// |sending_start| and must destroy it. +void Cronet_Metrics_sending_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr sending_start); +CRONET_EXPORT +void Cronet_Metrics_sending_end_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr sending_end); +// Move data from |sending_end|. The caller retains ownership of |sending_end| +// and must destroy it. +void Cronet_Metrics_sending_end_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr sending_end); +CRONET_EXPORT +void Cronet_Metrics_push_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr push_start); +// Move data from |push_start|. The caller retains ownership of |push_start| and +// must destroy it. +void Cronet_Metrics_push_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr push_start); +CRONET_EXPORT +void Cronet_Metrics_push_end_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr push_end); +// Move data from |push_end|. The caller retains ownership of |push_end| and +// must destroy it. +void Cronet_Metrics_push_end_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr push_end); +CRONET_EXPORT +void Cronet_Metrics_response_start_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr response_start); +// Move data from |response_start|. The caller retains ownership of +// |response_start| and must destroy it. +void Cronet_Metrics_response_start_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr response_start); +CRONET_EXPORT +void Cronet_Metrics_request_end_set(Cronet_MetricsPtr self, + const Cronet_DateTimePtr request_end); +// Move data from |request_end|. The caller retains ownership of |request_end| +// and must destroy it. +void Cronet_Metrics_request_end_move(Cronet_MetricsPtr self, + Cronet_DateTimePtr request_end); +CRONET_EXPORT +void Cronet_Metrics_socket_reused_set(Cronet_MetricsPtr self, + const bool socket_reused); +CRONET_EXPORT +void Cronet_Metrics_sent_byte_count_set(Cronet_MetricsPtr self, + const int64_t sent_byte_count); +CRONET_EXPORT +void Cronet_Metrics_received_byte_count_set(Cronet_MetricsPtr self, + const int64_t received_byte_count); +// Cronet_Metrics getters. +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_request_start_get( + const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_dns_start_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_dns_end_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_connect_start_get( + const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_connect_end_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_ssl_start_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_ssl_end_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_sending_start_get( + const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_sending_end_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_push_start_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_push_end_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_response_start_get( + const Cronet_MetricsPtr self); +CRONET_EXPORT +Cronet_DateTimePtr Cronet_Metrics_request_end_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +bool Cronet_Metrics_socket_reused_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +int64_t Cronet_Metrics_sent_byte_count_get(const Cronet_MetricsPtr self); +CRONET_EXPORT +int64_t Cronet_Metrics_received_byte_count_get(const Cronet_MetricsPtr self); + +/////////////////////// +// Struct Cronet_RequestFinishedInfo. +CRONET_EXPORT Cronet_RequestFinishedInfoPtr +Cronet_RequestFinishedInfo_Create(void); +CRONET_EXPORT void Cronet_RequestFinishedInfo_Destroy( + Cronet_RequestFinishedInfoPtr self); +// Cronet_RequestFinishedInfo setters. +CRONET_EXPORT +void Cronet_RequestFinishedInfo_metrics_set(Cronet_RequestFinishedInfoPtr self, + const Cronet_MetricsPtr metrics); +// Move data from |metrics|. The caller retains ownership of |metrics| and must +// destroy it. +void Cronet_RequestFinishedInfo_metrics_move(Cronet_RequestFinishedInfoPtr self, + Cronet_MetricsPtr metrics); +CRONET_EXPORT +void Cronet_RequestFinishedInfo_annotations_add( + Cronet_RequestFinishedInfoPtr self, + const Cronet_RawDataPtr element); +CRONET_EXPORT +void Cronet_RequestFinishedInfo_finished_reason_set( + Cronet_RequestFinishedInfoPtr self, + const Cronet_RequestFinishedInfo_FINISHED_REASON finished_reason); +// Cronet_RequestFinishedInfo getters. +CRONET_EXPORT +Cronet_MetricsPtr Cronet_RequestFinishedInfo_metrics_get( + const Cronet_RequestFinishedInfoPtr self); +CRONET_EXPORT +uint32_t Cronet_RequestFinishedInfo_annotations_size( + const Cronet_RequestFinishedInfoPtr self); +CRONET_EXPORT +Cronet_RawDataPtr Cronet_RequestFinishedInfo_annotations_at( + const Cronet_RequestFinishedInfoPtr self, + uint32_t index); +CRONET_EXPORT +void Cronet_RequestFinishedInfo_annotations_clear( + Cronet_RequestFinishedInfoPtr self); +CRONET_EXPORT +Cronet_RequestFinishedInfo_FINISHED_REASON +Cronet_RequestFinishedInfo_finished_reason_get( + const Cronet_RequestFinishedInfoPtr self); + +#ifdef __cplusplus +} +#endif + +#endif // COMPONENTS_CRONET_NATIVE_GENERATED_CRONET_IDL_C_H_ diff --git a/Frameworks/Cronet.framework/Headers/cronet_c.h b/Frameworks/Cronet.framework/Headers/cronet_c.h new file mode 100644 index 0000000..d9cd111 --- /dev/null +++ b/Frameworks/Cronet.framework/Headers/cronet_c.h @@ -0,0 +1,38 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_CRONET_NATIVE_INCLUDE_CRONET_C_H_ +#define COMPONENTS_CRONET_NATIVE_INCLUDE_CRONET_C_H_ + +#include "cronet_export.h" + +// Cronet public C API is generated from cronet.idl +#include "cronet.idl_c.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Stream Engine used by Bidirectional Stream C API for GRPC. +typedef struct stream_engine stream_engine; + +// Additional Cronet C API not generated from cronet.idl. + +// Sets net::CertVerifier* raw_mock_cert_verifier for testing of Cronet_Engine. +// Must be called before Cronet_Engine_InitWithParams(). +CRONET_EXPORT void Cronet_Engine_SetMockCertVerifierForTesting( + Cronet_EnginePtr engine, + /* net::CertVerifier* */ void* raw_mock_cert_verifier); + +// Returns "stream_engine" interface for bidirectionsl stream support for GRPC. +// Returned stream engine is owned by Cronet Engine and is only valid until +// Cronet_Engine_Shutdown(). +CRONET_EXPORT stream_engine* Cronet_Engine_GetStreamEngine( + Cronet_EnginePtr engine); + +#ifdef __cplusplus +} +#endif + +#endif // COMPONENTS_CRONET_NATIVE_INCLUDE_CRONET_C_H_ diff --git a/Frameworks/Cronet.framework/Headers/cronet_export.h b/Frameworks/Cronet.framework/Headers/cronet_export.h new file mode 100644 index 0000000..68379ae --- /dev/null +++ b/Frameworks/Cronet.framework/Headers/cronet_export.h @@ -0,0 +1,14 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef COMPONENTS_CRONET_NATIVE_INCLUDE_CRONET_EXPORT_H_ +#define COMPONENTS_CRONET_NATIVE_INCLUDE_CRONET_EXPORT_H_ + +#if defined(WIN32) +#define CRONET_EXPORT __declspec(dllexport) +#else +#define CRONET_EXPORT __attribute__((visibility("default"))) +#endif + +#endif // COMPONENTS_CRONET_NATIVE_INCLUDE_CRONET_EXPORT_H_ diff --git a/Frameworks/Cronet.framework/Info.plist b/Frameworks/Cronet.framework/Info.plist new file mode 100644 index 0000000..6e06444 Binary files /dev/null and b/Frameworks/Cronet.framework/Info.plist differ diff --git a/Frameworks/Cronet.framework/Modules/module.modulemap b/Frameworks/Cronet.framework/Modules/module.modulemap new file mode 100644 index 0000000..88f216a --- /dev/null +++ b/Frameworks/Cronet.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Cronet { + umbrella header "Cronet.h" + + export * + module * { export * } +} diff --git a/Frameworks/Cronet.framework/_CodeSignature/CodeResources b/Frameworks/Cronet.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..91d0a61 --- /dev/null +++ b/Frameworks/Cronet.framework/_CodeSignature/CodeResources @@ -0,0 +1,192 @@ + + + + + files + + Headers/Cronet.h + + YRvDrL9oawVVBGG4n/Srq6meuPs= + + Headers/bidirectional_stream_c.h + + y7aXYnqRjwtNEl3JsI4abbd8Bwk= + + Headers/cronet.idl_c.h + + rbzKgUQxPsdgIRsdcVupsqC6Nu8= + + Headers/cronet_c.h + + hVJ+w6jPPI8w7nXl58+ztlRMVeM= + + Headers/cronet_export.h + + UPTD8+nePj6VS9hIFE/o98omjBQ= + + Info.plist + + 1KCwQjBVsSkG+Kf3xCxvedS8uDU= + + Modules/module.modulemap + + uZWHRvfNWdFmm5OkzTH4twUn2cE= + + + files2 + + Headers/Cronet.h + + hash + + YRvDrL9oawVVBGG4n/Srq6meuPs= + + hash2 + + xA23JSNekEVT2K5pTIxzGXBLBaJSRYFwXF9cxHUMqcw= + + + Headers/bidirectional_stream_c.h + + hash + + y7aXYnqRjwtNEl3JsI4abbd8Bwk= + + hash2 + + 0w3odpPoob+mPa7FndWJKmZNJ+kjE7N4QFDp181OPz0= + + + Headers/cronet.idl_c.h + + hash + + rbzKgUQxPsdgIRsdcVupsqC6Nu8= + + hash2 + + twanng4XCItB99F33heLiMbU6lRK/yAv06A9oR+7Vlo= + + + Headers/cronet_c.h + + hash + + hVJ+w6jPPI8w7nXl58+ztlRMVeM= + + hash2 + + 201LsiAFRUw3Q8b9QXlhDPXgWq1rPwRjbc0Ny242nmk= + + + Headers/cronet_export.h + + hash + + UPTD8+nePj6VS9hIFE/o98omjBQ= + + hash2 + + Z+8/MTC0eoLf55J2pL44PhLCrM6EBF5IISZtfvA1+PM= + + + Modules/module.modulemap + + hash + + uZWHRvfNWdFmm5OkzTH4twUn2cE= + + hash2 + + RgrQawCr3vwhZ4F3cvaacmoWFEopEky9R6sP2yQoYiQ= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + +