Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: webrtc/base/ifaddrs_converter.cc

Issue 1510173005: -mfix (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: remove logging Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/ifaddrs_converter.h ('k') | webrtc/base/mac_ifaddrs_converter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 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 #include "webrtc/base/ifaddrs_converter.h"
12
13 #include "webrtc/base/logging.h"
14
15 namespace rtc {
16
17 IfAddrsConverter::IfAddrsConverter() {}
18
19 IfAddrsConverter::~IfAddrsConverter() {}
20
21 bool IfAddrsConverter::Convert(const struct ifaddrs* interface,
22 InterfaceAddress* ip,
23 IPAddress* mask) {
24 switch (interface->ifa_addr->sa_family) {
25 case AF_INET: {
26 *ip = IPAddress(
27 reinterpret_cast<sockaddr_in*>(interface->ifa_addr)->sin_addr);
28 *mask = IPAddress(
29 reinterpret_cast<sockaddr_in*>(interface->ifa_netmask)->sin_addr);
30 return true;
31 }
32 case AF_INET6: {
33 int ip_attributes = IPV6_ADDRESS_FLAG_NONE;
34 if (!ConvertNativeToIPAttributes(interface, &ip_attributes)) {
35 return false;
36 }
37 *ip = InterfaceAddress(
38 reinterpret_cast<sockaddr_in6*>(interface->ifa_addr)->sin6_addr,
39 ip_attributes);
40 *mask = IPAddress(
41 reinterpret_cast<sockaddr_in6*>(interface->ifa_netmask)->sin6_addr);
42 LOG(LS_ERROR) << "IPv6 " << ip->ToString();
43 return true;
44 }
45 default: { return false; }
46 }
47 }
48
49 bool IfAddrsConverter::ConvertNativeToIPAttributes(
50 const struct ifaddrs* interface,
51 int* ip_attributes) {
52 *ip_attributes = IPV6_ADDRESS_FLAG_NONE;
53 return true;
54 }
55
56 #if !defined(WEBRTC_MAC)
57 IfAddrsConverter* CreateIfAddrsConverter() {
58 return new IfAddrsConverter();
59 }
60 #endif
61 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/base/ifaddrs_converter.h ('k') | webrtc/base/mac_ifaddrs_converter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698