Paul Stewart | 0af98bf | 2011-05-10 17:38:08 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef SHILL_DEVICE_INFO_ |
| 6 | #define SHILL_DEVICE_INFO_ |
| 7 | |
Chris Masone | 487b8bf | 2011-05-13 16:27:57 -0700 | [diff] [blame] | 8 | #include <base/callback_old.h> |
Paul Stewart | 0af98bf | 2011-05-10 17:38:08 -0700 | [diff] [blame] | 9 | #include <base/hash_tables.h> |
Chris Masone | 487b8bf | 2011-05-13 16:27:57 -0700 | [diff] [blame] | 10 | #include <base/memory/scoped_ptr.h> |
Paul Stewart | 0af98bf | 2011-05-10 17:38:08 -0700 | [diff] [blame] | 11 | |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame^] | 12 | #include "shill/device.h" |
Paul Stewart | 0af98bf | 2011-05-10 17:38:08 -0700 | [diff] [blame] | 13 | #include "shill/shill_event.h" |
| 14 | |
| 15 | namespace shill { |
| 16 | |
| 17 | class DeviceInfo { |
| 18 | public: |
| 19 | DeviceInfo(EventDispatcher *dispatcher); |
| 20 | ~DeviceInfo(); |
| 21 | void Start(); |
| 22 | void Stop(); |
| 23 | |
| 24 | private: |
| 25 | void ParseRTNL(InputData *data); |
| 26 | void NextRequest(uint32_t seq); |
| 27 | void LinkMsg(unsigned char *buf, bool del); |
| 28 | void AddrMsg(unsigned char *buf, bool del); |
| 29 | void RouteMsg(unsigned char *buf, bool del); |
| 30 | |
| 31 | bool running_; |
| 32 | EventDispatcher *dispatcher_; |
Chris Masone | 0e1d104 | 2011-05-09 18:07:03 -0700 | [diff] [blame] | 33 | scoped_ptr<Callback1<InputData *>::Type> rtnl_callback_; |
Paul Stewart | 0af98bf | 2011-05-10 17:38:08 -0700 | [diff] [blame] | 34 | int rtnl_socket_; |
| 35 | base::hash_map<int, Device *> devices_; |
| 36 | scoped_ptr<IOInputHandler> rtnl_handler_; |
| 37 | int request_flags_; |
| 38 | uint32_t request_sequence_; |
Chris Masone | 9be4a9d | 2011-05-16 15:44:09 -0700 | [diff] [blame^] | 39 | friend class DeviceInfoTest; |
Paul Stewart | 0af98bf | 2011-05-10 17:38:08 -0700 | [diff] [blame] | 40 | }; |
| 41 | |
| 42 | enum { |
| 43 | REQUEST_LINK = 1, |
| 44 | REQUEST_ADDR = 2, |
| 45 | REQUEST_ROUTE = 4 |
| 46 | }; |
| 47 | |
| 48 | } // namespace shill |
| 49 | |
| 50 | #endif // SHILL_DEVICE_INFO_ |