webrtc/rtc_base/network_constants.h
Qingsi Wang 9f1de69008 Add ADAPTER_TYPE_ANY in AdapterType.
ADAPTER_TYPE_ANY can be used to set the network ignore mask if an
application does not want candidates from the any address ports, the
underlying network interface types of which are not determined in
gathering. The ADAPTER_TYPE_ANY is also given the maximum network cost
so that when there are candidates from explicit network interfaces,
these candidates from the any address ports as backups, if they ever
surface, are not preferred if the other candidates have at least the
same network condition.

Bug: webrtc:9468
Change-Id: I20c3a40e9a75b8fb34fad741ba5f835ecc3b0d92
Reviewed-on: https://webrtc-review.googlesource.com/85880
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Tommi <tommi@webrtc.org>
Commit-Queue: Qingsi Wang <qingsi@google.com>
Cr-Commit-Position: refs/heads/master@{#23807}
2018-07-02 17:59:11 +00:00

42 lines
1.4 KiB
C++

/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef RTC_BASE_NETWORK_CONSTANTS_H_
#define RTC_BASE_NETWORK_CONSTANTS_H_
#include <stdint.h>
namespace rtc {
static const uint16_t kNetworkCostMax = 999;
static const uint16_t kNetworkCostHigh = 900;
static const uint16_t kNetworkCostUnknown = 50;
static const uint16_t kNetworkCostLow = 10;
static const uint16_t kNetworkCostMin = 0;
enum AdapterType {
// This enum resembles the one in Chromium net::ConnectionType.
ADAPTER_TYPE_UNKNOWN = 0,
ADAPTER_TYPE_ETHERNET = 1 << 0,
ADAPTER_TYPE_WIFI = 1 << 1,
ADAPTER_TYPE_CELLULAR = 1 << 2,
ADAPTER_TYPE_VPN = 1 << 3,
ADAPTER_TYPE_LOOPBACK = 1 << 4,
// ADAPTER_TYPE_ANY is used for a network, which only contains a single "any
// address" IP address (INADDR_ANY for IPv4 or in6addr_any for IPv6), and can
// use any/all network interfaces. Whereas ADAPTER_TYPE_UNKNOWN is used
// when the network uses a specific interface/IP, but its interface type can
// not be determined or not fit in this enum.
ADAPTER_TYPE_ANY = 1 << 5,
};
} // namespace rtc
#endif // RTC_BASE_NETWORK_CONSTANTS_H_