OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // Starts listening for netlink messages. Also handles the messages if there | 38 // Starts listening for netlink messages. Also handles the messages if there |
39 // are any available on the netlink socket. | 39 // are any available on the netlink socket. |
40 void ListenForNotifications(); | 40 void ListenForNotifications(); |
41 | 41 |
42 // Attempts to read from the netlink socket into |buf| of length |len|. | 42 // Attempts to read from the netlink socket into |buf| of length |len|. |
43 // Returns the bytes read on synchronous success and ERR_IO_PENDING if the | 43 // Returns the bytes read on synchronous success and ERR_IO_PENDING if the |
44 // recv() would block. Otherwise, it returns a net error code. | 44 // recv() would block. Otherwise, it returns a net error code. |
45 int ReadNotificationMessage(char* buf, size_t len); | 45 int ReadNotificationMessage(char* buf, size_t len); |
46 | 46 |
47 // Handles the netlink message and notifies the observers. | |
48 void HandleNotifications(const char* buf, size_t len); | |
49 | |
50 ObserverList<Observer, true> observers_; | 47 ObserverList<Observer, true> observers_; |
51 | 48 |
52 int netlink_fd_; // This is the netlink socket descriptor. | 49 int netlink_fd_; // This is the netlink socket descriptor. |
53 MessageLoopForIO* const loop_; | 50 MessageLoopForIO* const loop_; |
54 MessageLoopForIO::FileDescriptorWatcher netlink_watcher_; | 51 MessageLoopForIO::FileDescriptorWatcher netlink_watcher_; |
55 | 52 |
56 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); | 53 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierLinux); |
57 }; | 54 }; |
58 | 55 |
59 } // namespace net | 56 } // namespace net |
60 | 57 |
61 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ | 58 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_LINUX_H_ |
OLD | NEW |