GRPC Objective-C  1.39.1
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 
30 @interface GRPCCallOptions : NSObject <NSCopying, NSMutableCopying>
31 
32 // Call parameters
41 @property(copy, readonly, nullable) NSString *serverAuthority;
42 
48 @property(readonly) NSTimeInterval timeout;
49 
56 @property(readonly) BOOL flowControlEnabled;
57 
64 @property(copy, readonly) NSArray<id<GRPCInterceptorFactory>> *interceptorFactories;
65 
66 // OAuth2 parameters. Users of gRPC may specify one of the following two parameters.
67 
73 @property(copy, readonly, nullable) NSString *oauth2AccessToken;
74 
79 @property(readonly, nullable) id<GRPCAuthorizationProtocol> authTokenProvider;
80 
84 @property(copy, readonly, nullable) NSDictionary *initialMetadata;
85 
86 // Channel parameters; take into account of channel signature.
87 
92 @property(copy, readonly, nullable) NSString *userAgentPrefix;
93 
98 @property(copy, readonly, nullable) NSString *userAgentSuffix;
99 
104 @property(readonly) NSUInteger responseSizeLimit;
105 
110 @property(readonly) GRPCCompressionAlgorithm compressionAlgorithm;
111 
117 @property(readonly) BOOL retryEnabled;
118 
119 // HTTP/2 keep-alive feature. The parameter \a keepaliveInterval specifies the interval between two
120 // PING frames. The parameter \a keepaliveTimeout specifies the length of the period for which the
121 // call should wait for PING ACK. If PING ACK is not received after this period, the call fails.
122 // Negative values are not allowed.
123 @property(readonly) NSTimeInterval keepaliveInterval;
124 @property(readonly) NSTimeInterval keepaliveTimeout;
125 
126 // Parameters for connection backoff. Negative values are not allowed.
127 // For details of gRPC's backoff behavior, refer to
128 // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
129 @property(readonly) NSTimeInterval connectMinTimeout;
130 @property(readonly) NSTimeInterval connectInitialBackoff;
131 @property(readonly) NSTimeInterval connectMaxBackoff;
132 
137 @property(copy, readonly, nullable) NSDictionary *additionalChannelArgs;
138 
139 // Parameters for SSL authentication.
140 
145 @property(copy, readonly, nullable) NSString *PEMRootCertificates;
146 
150 @property(copy, readonly, nullable) NSString *PEMPrivateKey;
151 
155 @property(copy, readonly, nullable) NSString *PEMCertificateChain;
156 
163 @property(readonly) GRPCTransportType transportType;
164 
173 @property(readonly) GRPCTransportID transport;
174 
178 @property(copy, readonly, nullable) NSString *hostNameOverride;
179 
184 @property(copy, readonly, nullable) NSString *channelPoolDomain;
185 
192 @property(readonly) NSUInteger channelID;
193 
197 - (BOOL)hasChannelOptionsEqualTo:(GRPCCallOptions *)callOptions;
198 
202 @property(readonly) NSUInteger channelOptionsHash;
203 
204 @end
205 
209 @interface GRPCMutableCallOptions : GRPCCallOptions <NSCopying, NSMutableCopying>
210 
211 // Call parameters
220 @property(copy, readwrite, nullable) NSString *serverAuthority;
221 
228 @property(readwrite) NSTimeInterval timeout;
229 
241 @property(readwrite) BOOL flowControlEnabled;
242 
249 @property(copy, readwrite) NSArray<id<GRPCInterceptorFactory>> *interceptorFactories;
250 
251 // OAuth2 parameters. Users of gRPC may specify one of the following two parameters.
252 
258 @property(copy, readwrite, nullable) NSString *oauth2AccessToken;
259 
264 @property(readwrite, nullable) id<GRPCAuthorizationProtocol> authTokenProvider;
265 
269 @property(copy, readwrite, nullable) NSDictionary *initialMetadata;
270 
271 // Channel parameters; take into account of channel signature.
272 
277 @property(copy, readwrite, nullable) NSString *userAgentPrefix;
278 
283 @property(copy, readwrite, nullable) NSString *userAgentSuffix;
284 
289 @property(readwrite) NSUInteger responseSizeLimit;
290 
295 @property(readwrite) GRPCCompressionAlgorithm compressionAlgorithm;
296 
302 @property(readwrite) BOOL retryEnabled;
303 
304 // HTTP/2 keep-alive feature. The parameter \a keepaliveInterval specifies the interval between two
305 // PING frames. The parameter \a keepaliveTimeout specifies the length of the period for which the
306 // call should wait for PING ACK. If PING ACK is not received after this period, the call fails.
307 // Negative values are invalid; setting these parameters to negative value will reset the
308 // corresponding parameter to 0.
309 @property(readwrite) NSTimeInterval keepaliveInterval;
310 @property(readwrite) NSTimeInterval keepaliveTimeout;
311 
312 // Parameters for connection backoff. Negative value is invalid; setting the parameters to negative
313 // value will reset corresponding parameter to 0.
314 // For details of gRPC's backoff behavior, refer to
315 // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
316 @property(readwrite) NSTimeInterval connectMinTimeout;
317 @property(readwrite) NSTimeInterval connectInitialBackoff;
318 @property(readwrite) NSTimeInterval connectMaxBackoff;
319 
324 @property(copy, readwrite, nullable) NSDictionary *additionalChannelArgs;
325 
326 // Parameters for SSL authentication.
327 
332 @property(copy, readwrite, nullable) NSString *PEMRootCertificates;
333 
337 @property(copy, readwrite, nullable) NSString *PEMPrivateKey;
338 
342 @property(copy, readwrite, nullable) NSString *PEMCertificateChain;
343 
350 @property(readwrite) GRPCTransportType transportType;
351 
360 @property(readwrite) GRPCTransportID transport;
361 
365 @property(copy, readwrite, nullable) NSString *hostNameOverride;
366 
373 @property(copy, readwrite, nullable) NSString *channelPoolDomain;
374 
379 @property(readwrite) NSUInteger channelID;
380 
381 @end
382 
383 NS_ASSUME_NONNULL_END
char *_Nonnull GRPCTransportID
The id of a transport implementation.
Definition: GRPCTypes.h:181
Immutable user configurable options for a gRPC call.
Definition: GRPCCallOptions.h:30
NSString * userAgentPrefix
Custom string that is prefixed to a request's user-agent header field before gRPC's internal user-age...
Definition: GRPCCallOptions.h:92
NSString * oauth2AccessToken
The OAuth2 access token string.
Definition: GRPCCallOptions.h:73
NSTimeInterval connectInitialBackoff
Definition: GRPCCallOptions.h:130
NSTimeInterval connectMaxBackoff
Definition: GRPCCallOptions.h:131
NSString * userAgentSuffix
Custom string that is suffixed to a request's user-agent header field after gRPC's internal user-agen...
Definition: GRPCCallOptions.h:98
NSArray< id< GRPCInterceptorFactory > > * interceptorFactories
An array of interceptor factories.
Definition: GRPCCallOptions.h:64
NSTimeInterval keepaliveInterval
Definition: GRPCCallOptions.h:123
NSUInteger channelOptionsHash
Hash for channel options.
Definition: GRPCCallOptions.h:202
NSString * PEMCertificateChain
PEM format certificate chain for client authentication, if required by the server.
Definition: GRPCCallOptions.h:155
GRPCTransportID transport
The transport to be used for this call.
Definition: GRPCCallOptions.h:173
NSString * hostNameOverride
Override the hostname during the TLS hostname validation process.
Definition: GRPCCallOptions.h:178
BOOL flowControlEnabled
Enable flow control of a gRPC call.
Definition: GRPCCallOptions.h:56
BOOL retryEnabled
Enable/Disable gRPC call's retry feature.
Definition: GRPCCallOptions.h:117
NSString * PEMRootCertificates
PEM format root certifications that is trusted.
Definition: GRPCCallOptions.h:145
NSString * serverAuthority
The authority for the RPC.
Definition: GRPCCallOptions.h:41
GRPCCompressionAlgorithm compressionAlgorithm
The compression algorithm to be used by the gRPC call.
Definition: GRPCCallOptions.h:110
NSTimeInterval keepaliveTimeout
Definition: GRPCCallOptions.h:124
GRPCTransportType transportType
Deprecated: this option is deprecated.
Definition: GRPCCallOptions.h:163
NSDictionary * additionalChannelArgs
Specify channel args to be used for this call.
Definition: GRPCCallOptions.h:137
id< GRPCAuthorizationProtocol > authTokenProvider
The interface to get the OAuth2 access token string.
Definition: GRPCCallOptions.h:79
NSDictionary * initialMetadata
Initial metadata key-value pairs that should be included in the request.
Definition: GRPCCallOptions.h:84
NSTimeInterval timeout
The timeout for the RPC call in seconds.
Definition: GRPCCallOptions.h:48
NSUInteger responseSizeLimit
The size limit for the response received from server.
Definition: GRPCCallOptions.h:104
NSString * PEMPrivateKey
PEM format private key for client authentication, if required by the server.
Definition: GRPCCallOptions.h:150
NSTimeInterval connectMinTimeout
Definition: GRPCCallOptions.h:129
NSUInteger channelID
Channel id allows control of channel caching within a channelPoolDomain.
Definition: GRPCCallOptions.h:192
NSString * channelPoolDomain
A string that specify the domain where channel is being cached.
Definition: GRPCCallOptions.h:184
Mutable user configurable options for a gRPC call.
Definition: GRPCCallOptions.h:209
An interceptor factory object is used to create interceptor object for the call at the call start tim...
Definition: GRPCInterceptor.h:164