| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/cancelable_callback.h" | 9 #include "base/cancelable_callback.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 void Start(); | 34 void Start(); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 friend struct content::BrowserThread::DeleteOnThread< | 37 friend struct content::BrowserThread::DeleteOnThread< |
| 38 content::BrowserThread::IO>; | 38 content::BrowserThread::IO>; |
| 39 friend class base::DeleteHelper<PrivetTrafficDetector>; | 39 friend class base::DeleteHelper<PrivetTrafficDetector>; |
| 40 virtual ~PrivetTrafficDetector(); | 40 virtual ~PrivetTrafficDetector(); |
| 41 | 41 |
| 42 // net::NetworkChangeNotifier::NetworkChangeObserver implementation. | 42 // net::NetworkChangeNotifier::NetworkChangeObserver implementation. |
| 43 virtual void OnNetworkChanged( | 43 virtual void OnNetworkChanged( |
| 44 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 44 net::NetworkChangeNotifier::ConnectionType type) override; |
| 45 | 45 |
| 46 void StartOnIOThread(); | 46 void StartOnIOThread(); |
| 47 void ScheduleRestart(); | 47 void ScheduleRestart(); |
| 48 void Restart(const net::NetworkInterfaceList& networks); | 48 void Restart(const net::NetworkInterfaceList& networks); |
| 49 int Bind(); | 49 int Bind(); |
| 50 bool IsSourceAcceptable() const; | 50 bool IsSourceAcceptable() const; |
| 51 bool IsPrivetPacket(int rv) const; | 51 bool IsPrivetPacket(int rv) const; |
| 52 int DoLoop(int rv); | 52 int DoLoop(int rv); |
| 53 | 53 |
| 54 base::Closure on_traffic_detected_; | 54 base::Closure on_traffic_detected_; |
| 55 scoped_refptr<base::TaskRunner> callback_runner_; | 55 scoped_refptr<base::TaskRunner> callback_runner_; |
| 56 net::NetworkInterfaceList networks_; | 56 net::NetworkInterfaceList networks_; |
| 57 net::AddressFamily address_family_; | 57 net::AddressFamily address_family_; |
| 58 net::IPEndPoint recv_addr_; | 58 net::IPEndPoint recv_addr_; |
| 59 scoped_ptr<net::DatagramServerSocket> socket_; | 59 scoped_ptr<net::DatagramServerSocket> socket_; |
| 60 scoped_refptr<net::IOBufferWithSize> io_buffer_; | 60 scoped_refptr<net::IOBufferWithSize> io_buffer_; |
| 61 base::Time start_time_; | 61 base::Time start_time_; |
| 62 int restart_attempts_; | 62 int restart_attempts_; |
| 63 | 63 |
| 64 base::WeakPtrFactory<PrivetTrafficDetector> weak_ptr_factory_; | 64 base::WeakPtrFactory<PrivetTrafficDetector> weak_ptr_factory_; |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(PrivetTrafficDetector); | 66 DISALLOW_COPY_AND_ASSIGN(PrivetTrafficDetector); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 } // namespace local_discovery | 69 } // namespace local_discovery |
| 70 | 70 |
| 71 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_ | 71 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_TRAFFIC_DETECTOR_H_ |
| OLD | NEW |