blob: 1b43243944a3a6006ce43a021d8d025a7b1a5ef8 [file] [log] [blame]
Patrik Höglunde2d6a062017-10-05 14:53:33 +02001/*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef RTC_BASE_NETWORK_CONSTANTS_H_
12#define RTC_BASE_NETWORK_CONSTANTS_H_
13
14#include <stdint.h>
15
Jonas Oreland71fda362020-03-20 16:11:56 +010016#include <string>
17
Patrik Höglunde2d6a062017-10-05 14:53:33 +020018namespace rtc {
19
20static const uint16_t kNetworkCostMax = 999;
21static const uint16_t kNetworkCostHigh = 900;
22static const uint16_t kNetworkCostUnknown = 50;
23static const uint16_t kNetworkCostLow = 10;
24static const uint16_t kNetworkCostMin = 0;
25
26enum AdapterType {
27 // This enum resembles the one in Chromium net::ConnectionType.
28 ADAPTER_TYPE_UNKNOWN = 0,
29 ADAPTER_TYPE_ETHERNET = 1 << 0,
30 ADAPTER_TYPE_WIFI = 1 << 1,
31 ADAPTER_TYPE_CELLULAR = 1 << 2,
32 ADAPTER_TYPE_VPN = 1 << 3,
Qingsi Wang9f1de692018-06-28 15:38:09 -070033 ADAPTER_TYPE_LOOPBACK = 1 << 4,
34 // ADAPTER_TYPE_ANY is used for a network, which only contains a single "any
35 // address" IP address (INADDR_ANY for IPv4 or in6addr_any for IPv6), and can
36 // use any/all network interfaces. Whereas ADAPTER_TYPE_UNKNOWN is used
37 // when the network uses a specific interface/IP, but its interface type can
38 // not be determined or not fit in this enum.
39 ADAPTER_TYPE_ANY = 1 << 5,
Patrik Höglunde2d6a062017-10-05 14:53:33 +020040};
41
Jonas Oreland71fda362020-03-20 16:11:56 +010042std::string AdapterTypeToString(AdapterType type);
43
Patrik Höglunde2d6a062017-10-05 14:53:33 +020044} // namespace rtc
45
46#endif // RTC_BASE_NETWORK_CONSTANTS_H_