shill: LinkMonitor: Skeleton of the class
BUG=chromium-os:32600
TEST=Compile; unit test compile
Change-Id: I134ad8fb75d4cb66b3767a7cf93e59d206bba332
Reviewed-on: https://gerrit.chromium.org/gerrit/27899
Commit-Ready: Paul Stewart <pstew@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/link_monitor.h b/link_monitor.h
new file mode 100644
index 0000000..cd6e0ab
--- /dev/null
+++ b/link_monitor.h
@@ -0,0 +1,46 @@
+// Copyright (c) 2012 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_LINK_MONITOR_
+#define SHILL_LINK_MONITOR_
+
+#include <base/callback.h>
+#include <base/memory/scoped_ptr.h>
+
+#include "shill/refptr_types.h"
+
+namespace shill {
+
+class EventDispatcher;
+class Sockets;
+
+// LinkMonitor tracks the status of a connection by sending ARP
+// messages to the default gateway for a connection. It keeps
+// a log of response times which can show a trend in link quality.
+// It signals to caller that the link has failed if too many
+// requests go unanswered.
+class LinkMonitor {
+ public:
+ typedef base::Callback<void()> FailureCallback;
+
+ LinkMonitor(const ConnectionRefPtr &connection,
+ EventDispatcher *dispatcher,
+ const FailureCallback &failure_callback);
+ virtual ~LinkMonitor();
+
+ bool Start();
+ void Stop();
+
+ private:
+ ConnectionRefPtr connection_;
+ EventDispatcher *dispatcher_;
+ FailureCallback failure_callback_;
+ scoped_ptr<Sockets> sockets_;
+
+ DISALLOW_COPY_AND_ASSIGN(LinkMonitor);
+};
+
+} // namespace shill
+
+#endif // SHILL_LINK_MONITOR_