blob: 5b6b18d3950f384d1c64182c17edf0225c62b577 [file] [log] [blame]
Paul Stewart0af98bf2011-05-10 17:38:08 -07001// 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
8#include <base/hash_tables.h>
9#include <base/scoped_ptr.h>
10
11#include "shill/shill_event.h"
12
13namespace shill {
14
15class DeviceInfo {
16 public:
17 DeviceInfo(EventDispatcher *dispatcher);
18 ~DeviceInfo();
19 void Start();
20 void Stop();
21
22 private:
23 void ParseRTNL(InputData *data);
24 void NextRequest(uint32_t seq);
25 void LinkMsg(unsigned char *buf, bool del);
26 void AddrMsg(unsigned char *buf, bool del);
27 void RouteMsg(unsigned char *buf, bool del);
28
29 bool running_;
30 EventDispatcher *dispatcher_;
31 ClassCallback<DeviceInfo, InputData *> rtnl_callback_;
32 int rtnl_socket_;
33 base::hash_map<int, Device *> devices_;
34 scoped_ptr<IOInputHandler> rtnl_handler_;
35 int request_flags_;
36 uint32_t request_sequence_;
37 friend class ShillDaemonTest;
38};
39
40enum {
41 REQUEST_LINK = 1,
42 REQUEST_ADDR = 2,
43 REQUEST_ROUTE = 4
44};
45
46} // namespace shill
47
48#endif // SHILL_DEVICE_INFO_