| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright 2016 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 |
/** |
| 20 |
* "X-macro" file that lists the flags names of Apple's Network Reachability |
| 21 |
API, along with a nice |
| 22 |
* Objective-C method name used to query each of them. |
| 23 |
* |
| 24 |
* Example usage: To generate a dictionary from flag value to name, one can do: |
| 25 |
|
| 26 |
NSDictionary *flagNames = @{ |
| 27 |
#define GRPC_XMACRO_ITEM(methodName, FlagName) \ |
| 28 |
@(kSCNetworkReachabilityFlags ## FlagName): @#methodName, |
| 29 |
#include "GRXReachabilityFlagNames.xmacro.h" |
| 30 |
#undef GRPC_XMACRO_ITEM |
| 31 |
}; |
| 32 |
|
| 33 |
XCTAssertEqualObjects(flagNames[@(kSCNetworkReachabilityFlagsIsWWAN)], |
| 34 |
@"isCell"); |
| 35 |
|
| 36 |
*/ |
| 37 |
|
| 38 |
#ifndef GRPC_XMACRO_ITEM |
| 39 |
#error This file is to be used with the "X-macro" pattern: Please #define \ |
| 40 |
GRPC_XMACRO_ITEM(methodName, FlagName), then #include this file, and then #undef \ |
| 41 |
GRPC_XMACRO_ITEM. |
| 42 |
#endif |
| 43 |
|
| 44 |
#if TARGET_OS_IPHONE |
| 45 |
GRPC_XMACRO_ITEM(isWWAN, IsWWAN) |
| 46 |
#endif |
| 47 |
GRPC_XMACRO_ITEM(reachable, Reachable) |
| 48 |
GRPC_XMACRO_ITEM(transientConnection, TransientConnection) |
| 49 |
GRPC_XMACRO_ITEM(connectionRequired, ConnectionRequired) |
| 50 |
GRPC_XMACRO_ITEM(connectionOnTraffic, ConnectionOnTraffic) |
| 51 |
GRPC_XMACRO_ITEM(interventionRequired, InterventionRequired) |
| 52 |
GRPC_XMACRO_ITEM(connectionOnDemand, ConnectionOnDemand) |
| 53 |
GRPC_XMACRO_ITEM(isLocalAddress, IsLocalAddress) |
| 54 |
GRPC_XMACRO_ITEM(isDirect, IsDirect) |