summaryrefslogtreecommitdiff
path: root/device_info.h
diff options
context:
space:
mode:
authorPaul Stewart <pstew@chromium.org>2011-05-10 17:38:08 -0700
committerPaul Stewart <pstew@chromium.org>2011-05-11 16:01:52 -0700
commit0af98bf87e8fc3cf29293f62d7f3b73cd9adb571 (patch)
tree01152bc1ac6625279becf67d764350db2d9f038e /device_info.h
parent31d90f0b7abf5cd64505bdc0c6f5e4556dff6f3e (diff)
downloadshill-0af98bf87e8fc3cf29293f62d7f3b73cd9adb571.tar.gz
shill: First step for rtnl code -- device discovery
Add device_info object and add it to the manager. Once started, this will perform rtnl enumeration. Current tests just assert that each enumeration completes successfully, but since our code does not yet store any information based on what it sees, this cannot be tested yet. BUG=chromium-os:12933 TEST=New unit tests added Change-Id: Ie1958222d9831c6117d0ace127857340a11b0bb1 Reviewed-on: http://gerrit.chromium.org/gerrit/655 Reviewed-by: Paul Stewart <pstew@chromium.org> Tested-by: Paul Stewart <pstew@chromium.org>
Diffstat (limited to 'device_info.h')
-rw-r--r--device_info.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/device_info.h b/device_info.h
new file mode 100644
index 00000000..5b6b18d3
--- /dev/null
+++ b/device_info.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SHILL_DEVICE_INFO_
+#define SHILL_DEVICE_INFO_
+
+#include <base/hash_tables.h>
+#include <base/scoped_ptr.h>
+
+#include "shill/shill_event.h"
+
+namespace shill {
+
+class DeviceInfo {
+ public:
+ DeviceInfo(EventDispatcher *dispatcher);
+ ~DeviceInfo();
+ void Start();
+ void Stop();
+
+ private:
+ void ParseRTNL(InputData *data);
+ void NextRequest(uint32_t seq);
+ void LinkMsg(unsigned char *buf, bool del);
+ void AddrMsg(unsigned char *buf, bool del);
+ void RouteMsg(unsigned char *buf, bool del);
+
+ bool running_;
+ EventDispatcher *dispatcher_;
+ ClassCallback<DeviceInfo, InputData *> rtnl_callback_;
+ int rtnl_socket_;
+ base::hash_map<int, Device *> devices_;
+ scoped_ptr<IOInputHandler> rtnl_handler_;
+ int request_flags_;
+ uint32_t request_sequence_;
+ friend class ShillDaemonTest;
+};
+
+enum {
+ REQUEST_LINK = 1,
+ REQUEST_ADDR = 2,
+ REQUEST_ROUTE = 4
+};
+
+} // namespace shill
+
+#endif // SHILL_DEVICE_INFO_