GRPC Objective-C  1.26.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 
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(readonly) NSUInteger responseSizeLimit;
99 
104 @property(readonly) GRPCCompressionAlgorithm compressionAlgorithm;
105 
111 @property(readonly) BOOL retryEnabled;
112 
113 // HTTP/2 keep-alive feature. The parameter \a keepaliveInterval specifies the interval between two
114 // PING frames. The parameter \a keepaliveTimeout specifies the length of the period for which the
115 // call should wait for PING ACK. If PING ACK is not received after this period, the call fails.
116 // Negative values are not allowed.
117 @property(readonly) NSTimeInterval keepaliveInterval;
118 @property(readonly) NSTimeInterval keepaliveTimeout;
119 
120 // Parameters for connection backoff. Negative values are not allowed.
121 // For details of gRPC's backoff behavior, refer to
122 // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
123 @property(readonly) NSTimeInterval connectMinTimeout;
124 @property(readonly) NSTimeInterval connectInitialBackoff;
125 @property(readonly) NSTimeInterval connectMaxBackoff;
126 
131 @property(copy, readonly, nullable) NSDictionary *additionalChannelArgs;
132 
133 // Parameters for SSL authentication.
134 
139 @property(copy, readonly, nullable) NSString *PEMRootCertificates;
140 
144 @property(copy, readonly, nullable) NSString *PEMPrivateKey;
145 
149 @property(copy, readonly, nullable) NSString *PEMCertificateChain;
150 
157 @property(readonly) GRPCTransportType transportType;
158 
167 @property(readonly) GRPCTransportID transport;
168 
172 @property(copy, readonly, nullable) NSString *hostNameOverride;
173 
178 @property(copy, readonly, nullable) NSString *channelPoolDomain;
179 
186 @property(readonly) NSUInteger channelID;
187 
191 - (BOOL)hasChannelOptionsEqualTo:(GRPCCallOptions *)callOptions;
192 
196 @property(readonly) NSUInteger channelOptionsHash;
197 
198 @end
199 
203 @interface GRPCMutableCallOptions : GRPCCallOptions<NSCopying, NSMutableCopying>
204 
205 // Call parameters
214 @property(copy, readwrite, nullable) NSString *serverAuthority;
215 
222 @property(readwrite) NSTimeInterval timeout;
223 
235 @property(readwrite) BOOL flowControlEnabled;
236 
243 @property(copy, readwrite) NSArray<id<GRPCInterceptorFactory>> *interceptorFactories;
244 
245 // OAuth2 parameters. Users of gRPC may specify one of the following two parameters.
246 
252 @property(copy, readwrite, nullable) NSString *oauth2AccessToken;
253 
258 @property(readwrite, nullable) id<GRPCAuthorizationProtocol> authTokenProvider;
259 
263 @property(copy, readwrite, nullable) NSDictionary *initialMetadata;
264 
265 // Channel parameters; take into account of channel signature.
266 
271 @property(copy, readwrite, nullable) NSString *userAgentPrefix;
272 
277 @property(readwrite) NSUInteger responseSizeLimit;
278 
283 @property(readwrite) GRPCCompressionAlgorithm compressionAlgorithm;
284 
290 @property(readwrite) BOOL retryEnabled;
291 
292 // HTTP/2 keep-alive feature. The parameter \a keepaliveInterval specifies the interval between two
293 // PING frames. The parameter \a keepaliveTimeout specifies the length of the period for which the
294 // call should wait for PING ACK. If PING ACK is not received after this period, the call fails.
295 // Negative values are invalid; setting these parameters to negative value will reset the
296 // corresponding parameter to 0.
297 @property(readwrite) NSTimeInterval keepaliveInterval;
298 @property(readwrite) NSTimeInterval keepaliveTimeout;
299 
300 // Parameters for connection backoff. Negative value is invalid; setting the parameters to negative
301 // value will reset corresponding parameter to 0.
302 // For details of gRPC's backoff behavior, refer to
303 // https://github.com/grpc/grpc/blob/master/doc/connection-backoff.md
304 @property(readwrite) NSTimeInterval connectMinTimeout;
305 @property(readwrite) NSTimeInterval connectInitialBackoff;
306 @property(readwrite) NSTimeInterval connectMaxBackoff;
307 
312 @property(copy, readwrite, nullable) NSDictionary *additionalChannelArgs;
313 
314 // Parameters for SSL authentication.
315 
320 @property(copy, readwrite, nullable) NSString *PEMRootCertificates;
321 
325 @property(copy, readwrite, nullable) NSString *PEMPrivateKey;
326 
330 @property(copy, readwrite, nullable) NSString *PEMCertificateChain;
331 
338 @property(readwrite) GRPCTransportType transportType;
339 
348 @property(readwrite) GRPCTransportID transport;
349 
353 @property(copy, readwrite, nullable) NSString *hostNameOverride;
354 
361 @property(copy, readwrite, nullable) NSString *channelPoolDomain;
362 
367 @property(readwrite) NSUInteger channelID;
368 
369 @end
370 
371 NS_ASSUME_NONNULL_END
char *_Nonnull GRPCTransportID
The id of a transport implementation.
Definition: GRPCTypes.h:179
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:124
NSTimeInterval connectMaxBackoff
Definition: GRPCCallOptions.h:125
NSArray< id< GRPCInterceptorFactory > > * interceptorFactories
An array of interceptor factories.
Definition: GRPCCallOptions.h:64
NSTimeInterval keepaliveInterval
Definition: GRPCCallOptions.h:117
NSUInteger channelOptionsHash
Hash for channel options.
Definition: GRPCCallOptions.h:196
NSString * PEMCertificateChain
PEM format certificate chain for client authentication, if required by the server.
Definition: GRPCCallOptions.h:149
GRPCTransportID transport
The transport to be used for this call.
Definition: GRPCCallOptions.h:167
NSString * hostNameOverride
Override the hostname during the TLS hostname validation process.
Definition: GRPCCallOptions.h:172
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:111
NSString * PEMRootCertificates
PEM format root certifications that is trusted.
Definition: GRPCCallOptions.h:139
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:104
NSTimeInterval keepaliveTimeout
Definition: GRPCCallOptions.h:118
GRPCTransportType transportType
Deprecated: this option is deprecated.
Definition: GRPCCallOptions.h:157
NSDictionary * additionalChannelArgs
Specify channel args to be used for this call.
Definition: GRPCCallOptions.h:131
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:98
NSString * PEMPrivateKey
PEM format private key for client authentication, if required by the server.
Definition: GRPCCallOptions.h:144
NSTimeInterval connectMinTimeout
Definition: GRPCCallOptions.h:123
NSUInteger channelID
Channel id allows control of channel caching within a channelPoolDomain.
Definition: GRPCCallOptions.h:186
NSString * channelPoolDomain
A string that specify the domain where channel is being cached.
Definition: GRPCCallOptions.h:178
Mutable user configurable options for a gRPC call.
Definition: GRPCCallOptions.h:203
An interceptor factory object is used to create interceptor object for the call at the call start tim...
Definition: GRPCInterceptor.h:164