Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 1 | /* |
| 2 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 3 | * Copyright 2015 gRPC authors. |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 4 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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 |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 8 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 10 | * |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 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. |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 16 | * |
| 17 | */ |
| 18 | |
| 19 | #import "GRPCCall.h" |
| 20 | |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 21 | /** |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 22 | * Methods to let tune down the security of gRPC connections for specific hosts. These shouldn't be |
| 23 | * used in releases, but are sometimes needed for testing. |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 24 | */ |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 25 | @interface GRPCCall (Tests) |
| 26 | |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 27 | /** |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 28 | * Establish all SSL connections to the provided host using the passed SSL target name and the root |
| 29 | * certificates found in the file at |certsPath|. |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 30 | * |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 31 | * Must be called before any gRPC call to that host is made. It's illegal to pass the same host to |
| 32 | * more than one invocation of the methods of this category. |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 33 | */ |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 34 | + (void)useTestCertsPath:(NSString *)certsPath |
| 35 | testName:(NSString *)testName |
| 36 | forHost:(NSString *)host; |
| 37 | |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 38 | /** |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 39 | * Establish all connections to the provided host using cleartext instead of SSL. |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 40 | * |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 41 | * Must be called before any gRPC call to that host is made. It's illegal to pass the same host to |
| 42 | * more than one invocation of the methods of this category. |
Jorge Canizales | b10776c | 2015-10-26 10:44:55 -0700 | [diff] [blame] | 43 | */ |
Jorge Canizales | b2bd067 | 2015-08-01 23:19:11 -0700 | [diff] [blame] | 44 | + (void)useInsecureConnectionsForHost:(NSString *)host; |
Jorge Canizales | 6af4add | 2016-07-28 23:05:18 -0700 | [diff] [blame] | 45 | |
| 46 | /** |
Muxi Yan | 2c88b46 | 2016-10-28 10:47:25 -0700 | [diff] [blame] | 47 | * Resets all host configurations to their default values, and flushes all connections from the |
| 48 | * cache. |
Jorge Canizales | 6af4add | 2016-07-28 23:05:18 -0700 | [diff] [blame] | 49 | */ |
Jorge Canizales | 32fde7a | 2016-07-29 17:31:07 -0700 | [diff] [blame] | 50 | + (void)resetHostSettings; |
Jorge Canizales | e8543b0 | 2015-08-01 17:37:40 -0700 | [diff] [blame] | 51 | @end |