OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * |
| 3 * Copyright 2015-2016, Google Inc. |
| 4 * All rights reserved. |
| 5 * |
| 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions are |
| 8 * met: |
| 9 * |
| 10 * * Redistributions of source code must retain the above copyright |
| 11 * notice, this list of conditions and the following disclaimer. |
| 12 * * Redistributions in binary form must reproduce the above |
| 13 * copyright notice, this list of conditions and the following disclaimer |
| 14 * in the documentation and/or other materials provided with the |
| 15 * distribution. |
| 16 * * Neither the name of Google Inc. nor the names of its |
| 17 * contributors may be used to endorse or promote products derived from |
| 18 * this software without specific prior written permission. |
| 19 * |
| 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 31 * |
| 32 */ |
| 33 |
| 34 #import <Foundation/Foundation.h> |
| 35 |
| 36 #include <grpc/grpc.h> |
| 37 |
| 38 struct grpc_channel_credentials; |
| 39 |
| 40 |
| 41 /** |
| 42 * Each separate instance of this class represents at least one TCP connection t
o the provided host. |
| 43 */ |
| 44 @interface GRPCChannel : NSObject |
| 45 |
| 46 @property(nonatomic, readonly, nonnull) struct grpc_channel *unmanagedChannel; |
| 47 |
| 48 - (nullable instancetype)init NS_UNAVAILABLE; |
| 49 |
| 50 /** |
| 51 * Creates a secure channel to the specified @c host using default credentials a
nd channel |
| 52 * arguments. If certificates could not be found to create a secure channel, the
n @c nil is |
| 53 * returned. |
| 54 */ |
| 55 + (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host; |
| 56 |
| 57 /** |
| 58 * Creates a secure channel to the specified @c host using the specified @c path
ToCertificates and |
| 59 * @c channelArgs. Only in tests should @c pathToCertificates be nil or |
| 60 * @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG channel arg be set. Passing nil for @c p
athToCertificates |
| 61 * results in using the default root certificates distributed with the library.
If certificates |
| 62 * could not be found in any case, then @c nil is returned. |
| 63 */ |
| 64 + (nullable GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host |
| 65 pathToCertificates:(nullable NSString *)pathToCerti
ficates |
| 66 channelArgs:(nullable NSDictionary *)channel
Args; |
| 67 |
| 68 |
| 69 /** |
| 70 * Creates a secure channel to the specified @c host using the specified @c cred
entials and |
| 71 * @c channelArgs. Only in tests should @c GRPC_SSL_TARGET_NAME_OVERRIDE_ARG cha
nnel arg be set. |
| 72 */ |
| 73 + (nonnull GRPCChannel *)secureChannelWithHost:(nonnull NSString *)host |
| 74 credentials:(nonnull struct grpc_channel_credentials *)credentials |
| 75 channelArgs:(nullable NSDictionary *)channelArgs; |
| 76 |
| 77 /** |
| 78 * Creates an insecure channel to the specified @c host using the specified @c c
hannelArgs. |
| 79 */ |
| 80 + (nonnull GRPCChannel *)insecureChannelWithHost:(nonnull NSString *)host |
| 81 channelArgs:(nullable NSDictionary *)channe
lArgs; |
| 82 |
| 83 @end |
OLD | NEW |