diff options
author | Kristopher Wuollett <klw@google.com> | 2016-02-02 20:23:11 -0500 |
---|---|---|
committer | Kristopher Wuollett <klw@google.com> | 2016-02-02 20:23:11 -0500 |
commit | 2c6d2bd32787f9bdce1d46875dfee39e08881a3b (patch) | |
tree | 87181b6b9dca6c57b6fe21f308441a2938b45e0d /src/objective-c/GRPCClient/private/GRPCChannel.h | |
parent | 85bf57410602e8a706867f3bda7fa06af6dfde91 (diff) |
Removed (un)secure channel subclasses
Diffstat (limited to 'src/objective-c/GRPCClient/private/GRPCChannel.h')
-rw-r--r-- | src/objective-c/GRPCClient/private/GRPCChannel.h | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index e2d19d506a..3e277b0f1a 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -33,18 +33,51 @@ #import <Foundation/Foundation.h> -struct grpc_channel; +#include <grpc/grpc.h> + +struct grpc_channel_credentials; + /** * Each separate instance of this class represents at least one TCP connection to the provided host. - * Create them using one of the subclasses |GRPCSecureChannel| and |GRPCUnsecuredChannel|. */ @interface GRPCChannel : NSObject -@property(nonatomic, readonly) struct grpc_channel *unmanagedChannel; +@property(nonatomic, readonly, nonnull) struct grpc_channel *unmanagedChannel; +@property(nonatomic, readonly, getter=isSecure) BOOL secure; + +- (nullable instancetype)init NS_UNAVAILABLE; + +/** + * Creates a secure channel to the specified @c host using default credentials and channel + * arguments. If certificates could not be found to create a secure channel, then @c nil is + * returned. + */ ++ (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host; + +/** + * Creates a secure channel to the specified @c host using the specified @c pathToCertificates and + * @c channelArgs. Only in tests should @c pathToCertificates be nil or + * @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg be set. Passing nil for @c pathToCertificates + * results in using the default root certificates distributed with the library. If certificates + * could not be found in any case, then @c nil is returned. + */ ++ (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host + pathToCertificates:(nullable NSString *)pathToCertificates + channelArgs:(nullable NSDictionary *)channelArgs; + /** - * This initializer takes ownership of the passed channel, and will destroy it when this object is - * deallocated. It's illegal to pass the same grpc_channel to two different GRPCChannel objects. + * Creates a secure channel to the specified @c host using the specified @c credentials and + * @c channelArgs. Only in tests should @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg be set. */ -- (instancetype)initWithChannel:(struct grpc_channel *)unmanagedChannel NS_DESIGNATED_INITIALIZER; ++ (nonnull GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host + credentials:(nonnull struct grpc_channel_credentials *)credentials + channelArgs:(nullable NSDictionary *)channelArgs; + +/** + * Creates an insecure channel to the specified @c host using the specified @c channelArgs. + */ ++ (nonnull GRPCChannel *)insecureChannelWithHost:(nonnull NSString *)host + channelArgs:(nullable NSDictionary *)channelArgs; + @end |