blob: 01311cf739e9f93987ae7de5e6e3de79f76c0c4e [file] [log] [blame]
Wade Guthrie5020b572012-10-12 15:51:14 -07001// Copyright (c) 2012 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// This class is a callback object that observes all nl80211 events that come
6// up from the kernel.
7
Wade Guthrie89e6cb32013-03-07 08:03:45 -08008#ifndef SHILL_CALLBACK80211_METRICS_H_
9#define SHILL_CALLBACK80211_METRICS_H_
Wade Guthrie5020b572012-10-12 15:51:14 -070010
Wade Guthrie5020b572012-10-12 15:51:14 -070011#include <base/basictypes.h>
Wade Guthriec6c81962013-03-06 15:47:13 -080012#include <base/memory/weak_ptr.h>
Wade Guthrie5020b572012-10-12 15:51:14 -070013
Wade Guthriebb9fca22013-04-10 17:21:42 -070014#include "shill/netlink_manager.h"
Wade Guthrie5020b572012-10-12 15:51:14 -070015
16namespace shill {
17
Wade Guthrie5020b572012-10-12 15:51:14 -070018class Metrics;
Wade Guthriebb9fca22013-04-10 17:21:42 -070019class NetlinkManager;
Wade Guthriec6c81962013-03-06 15:47:13 -080020class NetlinkMessage;
Wade Guthrie5020b572012-10-12 15:51:14 -070021
Wade Guthriebb9fca22013-04-10 17:21:42 -070022// NetlinkManager callback object that sends stuff to UMA metrics.
Wade Guthriec6c81962013-03-06 15:47:13 -080023class Callback80211Metrics :
24 public base::SupportsWeakPtr<Callback80211Metrics> {
Wade Guthrie5020b572012-10-12 15:51:14 -070025 public:
Wade Guthriebb9fca22013-04-10 17:21:42 -070026 Callback80211Metrics(const NetlinkManager &netlink_manager, Metrics *metrics);
Wade Guthrie5020b572012-10-12 15:51:14 -070027
Wade Guthriebb9fca22013-04-10 17:21:42 -070028 // Called with each broadcast netlink message that arrives to NetlinkManager.
Wade Guthriec6c81962013-03-06 15:47:13 -080029 // If the message is a deauthenticate message, the method collects the reason
30 // for the deauthentication and communicates those to UMA.
31 void CollectDisconnectStatistics(const NetlinkMessage &msg);
Wade Guthrie5020b572012-10-12 15:51:14 -070032
Christopher Wileyfe34be02012-11-12 16:02:46 -080033 private:
Wade Guthrie5020b572012-10-12 15:51:14 -070034 static const char kMetricLinkDisconnectCount[];
35
36 Metrics *metrics_;
37
Wade Guthrie5020b572012-10-12 15:51:14 -070038 DISALLOW_COPY_AND_ASSIGN(Callback80211Metrics);
39};
40
41} // namespace shill
42
Wade Guthrie89e6cb32013-03-07 08:03:45 -080043#endif // SHILL_CALLBACK80211_METRICS_H_