GRPC Objective-C  1.73.0
GRPCCallOptions.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2018 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #import <Foundation/Foundation.h>
20 
21 #import "GRPCTypes.h"
22 
23 NS_ASSUME_NONNULL_BEGIN
24 
25 @protocol GRPCInterceptorFactory;
26 
32 @interface GRPCCallOptions : NSObject <NSCopying, NSMutableCopying>
33 
34 // Call parameters
42 @property(nonatomic, copy, readonly, nullable) NSString *serverAuthority;
43 
49 @property(nonatomic, readonly) NSTimeInterval timeout;
50 
57 @property(nonatomic, readonly) BOOL flowControlEnabled;
58 
65 @property(nonatomic, copy, readonly) NSArray<id<GRPCInterceptorFactory>> *interceptorFactories;
66 
67 // OAuth2 parameters. Users of gRPC may specify one of the following two parameters.
68 
74 @property(nonatomic, copy, readonly, nullable) NSString *oauth2AccessToken;
75 
80 @property(nonatomic, readonly, nullable) id<GRPCAuthorizationProtocol> authTokenProvider;
81 
87 @property(nonatomic, copy, readonly, nullable) GRPCMetadataDictionary *initialMetadata;
88 
89 // Channel parameters; take into account of channel signature.
90 
95 @property(nonatomic, copy, readonly, nullable) NSString *userAgentPrefix;
96 
101 @property(nonatomic, copy, readonly, nullable) NSString *userAgentSuffix;
102 
107 @property(nonatomic, readonly) NSUInteger responseSizeLimit;
108 
113 @property(nonatomic, readonly) GRPCCompressionAlgorithm compressionAlgorithm;
114 
120 @property(nonatomic, readonly) BOOL retryEnabled;
121 
126 @property(nonatomic, readonly) NSTimeInterval maxRetryInterval;
127 
132 @property(nonatomic, readonly) NSTimeInterval minRetryInterval;
133 
138 @property(readonly) double retryFactor;
139 
140 // HTTP/2 keep-alive feature. The parameter \a keepaliveInterval specifies the interval between two
141 // PING frames. The parameter \a keepaliveTimeout specifies the length of the period for which the
142 // call should wait for PING ACK. If PING ACK is not received after this period, the call fails.
143 // Negative values are not allowed.
144 @property(nonatomic, readonly) NSTimeInterval keepaliveInterval;
145 @property(nonatomic, readonly) NSTimeInterval keepaliveTimeout;
146 
147 // Parameters for connection backoff. Negative values are not allowed.
148 // For details of gRPC's backoff behavior, refer to
149 // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
150 @property(nonatomic, readonly) NSTimeInterval connectMinTimeout;
151 @property(nonatomic, readonly) NSTimeInterval connectInitialBackoff;
152 @property(nonatomic, readonly) NSTimeInterval connectMaxBackoff;
153 
158 @property(nonatomic, copy, readonly, nullable) GRPCMetadataDictionary *additionalChannelArgs;
159 
160 // Parameters for SSL authentication.
161 
166 @property(nonatomic, copy, readonly, nullable) NSString *PEMRootCertificates;
167 
171 @property(nonatomic, copy, readonly, nullable) NSString *PEMPrivateKey;
172 
176 @property(nonatomic, copy, readonly, nullable) NSString *PEMCertificateChain;
177 
184 @property(nonatomic, readonly) GRPCTransportType transportType;
185 
194 @property(nonatomic, readonly) GRPCTransportID transport;
195 
199 @property(nonatomic, copy, readonly, nullable) NSString *hostNameOverride;
200 
205 @property(nonatomic, copy, readonly, nullable) NSString *channelPoolDomain;
206 
213 @property(nonatomic, readonly) NSUInteger channelID;
214 
218 @property(nonatomic, readonly) NSUInteger channelOptionsHash;
219 
223 - (BOOL)hasChannelOptionsEqualTo:(GRPCCallOptions *)callOptions;
224 
225 @end
226 
231 @interface GRPCMutableCallOptions : GRPCCallOptions <NSCopying, NSMutableCopying>
232 
233 // Call parameters
241 @property(nonatomic, copy, readwrite, nullable) NSString *serverAuthority;
242 
249 @property(nonatomic, readwrite) NSTimeInterval timeout;
250 
262 @property(nonatomic, readwrite) BOOL flowControlEnabled;
263 
270 @property(nonatomic, copy, readwrite) NSArray<id<GRPCInterceptorFactory>> *interceptorFactories;
271 
272 // OAuth2 parameters. Users of gRPC may specify one of the following two parameters.
273 
279 @property(nonatomic, copy, readwrite, nullable) NSString *oauth2AccessToken;
280 
285 @property(nonatomic, readwrite, nullable) id<GRPCAuthorizationProtocol> authTokenProvider;
286 
292 @property(nonatomic, nonatomic, copy, readwrite, nullable) GRPCMetadataDictionary *initialMetadata;
293 
294 // Channel parameters; take into account of channel signature.
295 
300 @property(nonatomic, copy, readwrite, nullable) NSString *userAgentPrefix;
301 
306 @property(nonatomic, copy, readwrite, nullable) NSString *userAgentSuffix;
307 
312 @property(nonatomic, readwrite) NSUInteger responseSizeLimit;
313 
318 @property(nonatomic, readwrite) GRPCCompressionAlgorithm compressionAlgorithm;
319 
325 @property(nonatomic, readwrite) BOOL retryEnabled;
326 
331 @property(nonatomic, readwrite) NSTimeInterval maxRetryInterval;
332 
337 @property(nonatomic, readwrite) NSTimeInterval minRetryInterval;
338 
343 @property(nonatomic, readwrite) double retryFactor;
344 
345 // HTTP/2 keep-alive feature. The parameter \a keepaliveInterval specifies the interval between two
346 // PING frames. The parameter \a keepaliveTimeout specifies the length of the period for which the
347 // call should wait for PING ACK. If PING ACK is not received after this period, the call fails.
348 // Negative values are invalid; setting these parameters to negative value will reset the
349 // corresponding parameter to 0.
350 @property(nonatomic, readwrite) NSTimeInterval keepaliveInterval;
351 @property(nonatomic, readwrite) NSTimeInterval keepaliveTimeout;
352 
353 // Parameters for connection backoff. Negative value is invalid; setting the parameters to negative
354 // value will reset corresponding parameter to 0.
355 // For details of gRPC's backoff behavior, refer to
356 // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
357 @property(nonatomic, readwrite) NSTimeInterval connectMinTimeout;
358 @property(nonatomic, readwrite) NSTimeInterval connectInitialBackoff;
359 @property(nonatomic, readwrite) NSTimeInterval connectMaxBackoff;
360 
365 @property(nonatomic, copy, readwrite, nullable) GRPCMetadataDictionary *additionalChannelArgs;
366 
367 // Parameters for SSL authentication.
368 
373 @property(nonatomic, copy, readwrite, nullable) NSString *PEMRootCertificates;
374 
378 @property(nonatomic, copy, readwrite, nullable) NSString *PEMPrivateKey;
379 
383 @property(nonatomic, copy, readwrite, nullable) NSString *PEMCertificateChain;
384 
391 @property(nonatomic, readwrite) GRPCTransportType transportType;
392 
401 @property(nonatomic, readwrite) GRPCTransportID transport;
402 
406 @property(nonatomic, copy, readwrite, nullable) NSString *hostNameOverride;
407 
414 @property(nonatomic, copy, readwrite, nullable) NSString *channelPoolDomain;
415 
420 @property(nonatomic, readwrite) NSUInteger channelID;
421 
422 @end
423 
424 NS_ASSUME_NONNULL_END
GRPCCallOptions::keepaliveTimeout
NSTimeInterval keepaliveTimeout
Definition: GRPCCallOptions.h:145
GRPCCallOptions::userAgentSuffix
NSString * userAgentSuffix
Custom string that is suffixed to a request's user-agent header field after gRPC's internal user-agen...
Definition: GRPCCallOptions.h:101
GRPCCallOptions::retryFactor
double retryFactor
Multiplier used to increase the interval between retries.
Definition: GRPCCallOptions.h:138
GRPCCallOptions::initialMetadata
GRPCMetadataDictionary * initialMetadata
Initial metadata key-value pairs that should be included in the request.
Definition: GRPCCallOptions.h:87
GRPCCallOptions
Immutable user configurable options for a gRPC call.
Definition: GRPCCallOptions.h:32
GRPCMutableCallOptions
Mutable user configurable options for a gRPC call.
Definition: GRPCCallOptions.h:231
GRPCCallOptions::channelOptionsHash
NSUInteger channelOptionsHash
Hash for channel options.
Definition: GRPCCallOptions.h:218
GRPCCallOptions::timeout
NSTimeInterval timeout
The timeout for the RPC call in seconds.
Definition: GRPCCallOptions.h:49
GRPCCallOptions::serverAuthority
NSString * serverAuthority
The authority for the RPC.
Definition: GRPCCallOptions.h:42
GRPCCallOptions::channelID
NSUInteger channelID
Channel id allows control of channel caching within a channelPoolDomain.
Definition: GRPCCallOptions.h:213
GRPCCallOptions::keepaliveInterval
NSTimeInterval keepaliveInterval
Definition: GRPCCallOptions.h:144
GRPCCallOptions::interceptorFactories
NSArray< id< GRPCInterceptorFactory > > * interceptorFactories
An array of interceptor factories.
Definition: GRPCCallOptions.h:65
GRPCCallOptions::hostNameOverride
NSString * hostNameOverride
Override the hostname during the TLS hostname validation process.
Definition: GRPCCallOptions.h:199
GRPCCallOptions::maxRetryInterval
NSTimeInterval maxRetryInterval
Maximum interval in seconds between two consecutive retries.
Definition: GRPCCallOptions.h:126
GRPCCallOptions::PEMCertificateChain
NSString * PEMCertificateChain
PEM format certificate chain for client authentication, if required by the server.
Definition: GRPCCallOptions.h:176
GRPCCallOptions::oauth2AccessToken
NSString * oauth2AccessToken
The OAuth2 access token string.
Definition: GRPCCallOptions.h:74
GRPCCallOptions::transportType
GRPCTransportType transportType
Deprecated: this option is deprecated.
Definition: GRPCCallOptions.h:184
GRPCMetadataDictionary
NSDictionary< NSString *, id > GRPCMetadataDictionary
gRPC metadata dictionary typedef
Definition: GRPCTypes.h:188
GRPCCallOptions::retryEnabled
BOOL retryEnabled
Enable/Disable gRPC call's retry feature.
Definition: GRPCCallOptions.h:120
GRPCCallOptions::minRetryInterval
NSTimeInterval minRetryInterval
Minimum interval in seconds between two consecutive retries.
Definition: GRPCCallOptions.h:132
GRPCCallOptions::authTokenProvider
id< GRPCAuthorizationProtocol > authTokenProvider
The interface to get the OAuth2 access token string.
Definition: GRPCCallOptions.h:80
GRPCCallOptions::responseSizeLimit
NSUInteger responseSizeLimit
The size limit for the response received from server.
Definition: GRPCCallOptions.h:107
GRPCCallOptions::connectMaxBackoff
NSTimeInterval connectMaxBackoff
Definition: GRPCCallOptions.h:152
GRPCTransportID
const typedef char *_Nonnull GRPCTransportID
The id of a transport implementation.
Definition: GRPCTypes.h:172
GRPCInterceptorFactory-p
An interceptor factory object is used to create interceptor object for the call at the call start tim...
Definition: GRPCInterceptor.h:164
GRPCCallOptions::PEMRootCertificates
NSString * PEMRootCertificates
PEM format root certifications that is trusted.
Definition: GRPCCallOptions.h:166
GRPCCallOptions::channelPoolDomain
NSString * channelPoolDomain
A string that specify the domain where channel is being cached.
Definition: GRPCCallOptions.h:205
GRPCTypes.h
GRPCCallOptions::userAgentPrefix
NSString * userAgentPrefix
Custom string that is prefixed to a request's user-agent header field before gRPC's internal user-age...
Definition: GRPCCallOptions.h:95
GRPCCallOptions::connectInitialBackoff
NSTimeInterval connectInitialBackoff
Definition: GRPCCallOptions.h:151
GRPCCallOptions::transport
GRPCTransportID transport
The transport to be used for this call.
Definition: GRPCCallOptions.h:194
GRPCCallOptions::additionalChannelArgs
GRPCMetadataDictionary * additionalChannelArgs
Specify channel args to be used for this call.
Definition: GRPCCallOptions.h:158
GRPCCallOptions::flowControlEnabled
BOOL flowControlEnabled
Enable flow control of a gRPC call.
Definition: GRPCCallOptions.h:57
GRPCCallOptions::connectMinTimeout
NSTimeInterval connectMinTimeout
Definition: GRPCCallOptions.h:150
GRPCCallOptions::compressionAlgorithm
GRPCCompressionAlgorithm compressionAlgorithm
The compression algorithm to be used by the gRPC call.
Definition: GRPCCallOptions.h:113
GRPCCallOptions::PEMPrivateKey
NSString * PEMPrivateKey
PEM format private key for client authentication, if required by the server.
Definition: GRPCCallOptions.h:171