| Index: webrtc/base/fakenetwork.h
|
| diff --git a/webrtc/base/fakenetwork.h b/webrtc/base/fakenetwork.h
|
| index 4d98c6c66d2dff1714c94687362a1270f139eff7..e3996e6649c5d21d4e6eb1d889d11d01120722a7 100644
|
| --- a/webrtc/base/fakenetwork.h
|
| +++ b/webrtc/base/fakenetwork.h
|
| @@ -12,6 +12,7 @@
|
| #define WEBRTC_BASE_FAKENETWORK_H_
|
|
|
| #include <string>
|
| +#include <utility>
|
| #include <vector>
|
|
|
| #include "webrtc/base/network.h"
|
| @@ -31,7 +32,7 @@ class FakeNetworkManager : public NetworkManagerBase,
|
| public:
|
| FakeNetworkManager() : thread_(Thread::Current()) {}
|
|
|
| - typedef std::vector<SocketAddress> IfaceList;
|
| + typedef std::vector<std::pair<SocketAddress, AdapterType>> IfaceList;
|
|
|
| void AddInterface(const SocketAddress& iface) {
|
| // Ensure a unique name for the interface if its name is not given.
|
| @@ -39,16 +40,22 @@ class FakeNetworkManager : public NetworkManagerBase,
|
| }
|
|
|
| void AddInterface(const SocketAddress& iface, const std::string& if_name) {
|
| + AddInterface(iface, if_name, ADAPTER_TYPE_UNKNOWN);
|
| + }
|
| +
|
| + void AddInterface(const SocketAddress& iface,
|
| + const std::string& if_name,
|
| + AdapterType type) {
|
| SocketAddress address(if_name, 0);
|
| address.SetResolvedIP(iface.ipaddr());
|
| - ifaces_.push_back(address);
|
| + ifaces_.push_back(std::make_pair(address, type));
|
| DoUpdateNetworks();
|
| }
|
|
|
| void RemoveInterface(const SocketAddress& iface) {
|
| for (IfaceList::iterator it = ifaces_.begin();
|
| it != ifaces_.end(); ++it) {
|
| - if (it->EqualIPs(iface)) {
|
| + if (it->first.EqualIPs(iface)) {
|
| ifaces_.erase(it);
|
| break;
|
| }
|
| @@ -86,18 +93,17 @@ class FakeNetworkManager : public NetworkManagerBase,
|
| for (IfaceList::iterator it = ifaces_.begin();
|
| it != ifaces_.end(); ++it) {
|
| int prefix_length = 0;
|
| - if (it->ipaddr().family() == AF_INET) {
|
| + if (it->first.ipaddr().family() == AF_INET) {
|
| prefix_length = kFakeIPv4NetworkPrefixLength;
|
| - } else if (it->ipaddr().family() == AF_INET6) {
|
| + } else if (it->first.ipaddr().family() == AF_INET6) {
|
| prefix_length = kFakeIPv6NetworkPrefixLength;
|
| }
|
| - IPAddress prefix = TruncateIP(it->ipaddr(), prefix_length);
|
| - scoped_ptr<Network> net(new Network(it->hostname(),
|
| - it->hostname(),
|
| - prefix,
|
| - prefix_length));
|
| + IPAddress prefix = TruncateIP(it->first.ipaddr(), prefix_length);
|
| + scoped_ptr<Network> net(new Network(it->first.hostname(),
|
| + it->first.hostname(), prefix,
|
| + prefix_length, it->second));
|
| net->set_default_local_address_provider(this);
|
| - net->AddIP(it->ipaddr());
|
| + net->AddIP(it->first.ipaddr());
|
| networks.push_back(net.release());
|
| }
|
| bool changed;
|
|
|