webrtc/rtc_base/network_constants.cc
Jonas Oreland 08d1806e54 Extend rtc::AdapterType with 2g, 3G, 4G & 5G enum values.
This patch adds new enum values for different types of cellular
connections.

The new costs are currently blocked when sending to remote,
(so that arbitrary network switches does not starts occurring).

The end-game for this series to be able to distinguish between
different type of cellular connections in the ice-layer (e.g when
selecting/switching connections).

BUG: webrtc:11473
Change-Id: I587ac8fdff4f6cdd0f8905f327232f58818db4f6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/172582
Commit-Queue: Jonas Oreland <jonaso@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30970}
2020-04-02 07:48:36 +00:00

47 lines
1.3 KiB
C++

/*
* Copyright 2020 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.
*/
#include "rtc_base/network_constants.h"
#include "rtc_base/checks.h"
namespace rtc {
std::string AdapterTypeToString(AdapterType type) {
switch (type) {
case ADAPTER_TYPE_ANY:
return "Wildcard";
case ADAPTER_TYPE_UNKNOWN:
return "Unknown";
case ADAPTER_TYPE_ETHERNET:
return "Ethernet";
case ADAPTER_TYPE_WIFI:
return "Wifi";
case ADAPTER_TYPE_CELLULAR:
return "Cellular";
case ADAPTER_TYPE_CELLULAR_2G:
return "Cellular2G";
case ADAPTER_TYPE_CELLULAR_3G:
return "Cellular3G";
case ADAPTER_TYPE_CELLULAR_4G:
return "Cellular4G";
case ADAPTER_TYPE_CELLULAR_5G:
return "Cellular5G";
case ADAPTER_TYPE_VPN:
return "VPN";
case ADAPTER_TYPE_LOOPBACK:
return "Loopback";
default:
RTC_NOTREACHED() << "Invalid type " << type;
return std::string();
}
}
} // namespace rtc