| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_ADDRESS_TRACKER_LINUX_H_ | 5 #ifndef NET_BASE_ADDRESS_TRACKER_LINUX_H_ |
| 6 #define NET_BASE_ADDRESS_TRACKER_LINUX_H_ | 6 #define NET_BASE_ADDRESS_TRACKER_LINUX_H_ |
| 7 | 7 |
| 8 #include <sys/socket.h> // Needed to include netlink. | 8 #include <sys/socket.h> // Needed to include netlink. |
| 9 // Mask superfluous definition of |struct net|. This is fixed in Linux 2.6.38. | 9 // Mask superfluous definition of |struct net|. This is fixed in Linux 2.6.38. |
| 10 #define net net_kernel | 10 #define net net_kernel |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
| 23 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
| 24 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
| 25 #include "net/base/network_change_notifier.h" | 25 #include "net/base/network_change_notifier.h" |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 namespace internal { | 28 namespace internal { |
| 29 | 29 |
| 30 // Keeps track of network interface addresses using rtnetlink. Used by | 30 // Keeps track of network interface addresses using rtnetlink. Used by |
| 31 // NetworkChangeNotifier to provide signals to registered IPAddressObservers. | 31 // NetworkChangeNotifier to provide signals to registered IPAddressObservers. |
| 32 class NET_EXPORT_PRIVATE AddressTrackerLinux : | 32 class NET_EXPORT_PRIVATE AddressTrackerLinux |
| 33 public base::MessageLoopForIO::Watcher { | 33 : public base::MessageLoopForIO::Watcher { |
| 34 public: | 34 public: |
| 35 typedef std::map<IPAddressNumber, struct ifaddrmsg> AddressMap; | 35 typedef std::map<IPAddressNumber, struct ifaddrmsg> AddressMap; |
| 36 | 36 |
| 37 // Non-tracking version constructor: it takes a snapshot of the | 37 // Non-tracking version constructor: it takes a snapshot of the |
| 38 // current system configuration. Once Init() returns, the | 38 // current system configuration. Once Init() returns, the |
| 39 // configuration is available through GetOnlineLinks() and | 39 // configuration is available through GetOnlineLinks() and |
| 40 // GetAddressMap(). | 40 // GetAddressMap(). |
| 41 AddressTrackerLinux(); | 41 AddressTrackerLinux(); |
| 42 | 42 |
| 43 // Tracking version constructor: it will run |address_callback| when | 43 // Tracking version constructor: it will run |address_callback| when |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 bool tracking_; | 143 bool tracking_; |
| 144 | 144 |
| 145 // Used to verify single-threaded access in non-tracking mode. | 145 // Used to verify single-threaded access in non-tracking mode. |
| 146 base::ThreadChecker thread_checker_; | 146 base::ThreadChecker thread_checker_; |
| 147 }; | 147 }; |
| 148 | 148 |
| 149 } // namespace internal | 149 } // namespace internal |
| 150 } // namespace net | 150 } // namespace net |
| 151 | 151 |
| 152 #endif // NET_BASE_ADDRESS_TRACKER_LINUX_H_ | 152 #endif // NET_BASE_ADDRESS_TRACKER_LINUX_H_ |
| OLD | NEW |