blob: 4545be1ec9abb1792ca7c45da9ec5524c65bf99b [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
8#ifndef SHILL_CALLBACK80211_METRICS_H
9#define SHILL_CALLBACK80211_METRICS_H
10
11#include <iomanip>
12#include <map>
13#include <string>
14
15#include <base/basictypes.h>
16#include <base/bind.h>
17#include <base/memory/weak_ptr.h>
18
19#include "shill/callback80211_object.h"
20
21namespace shill {
22
23class Config80211;
24class Metrics;
25class UserBoundNlMessage;
26
27// Config80211 callback object that sends stuff to UMA metrics.
28class Callback80211Metrics : public Callback80211Object {
29 public:
30 Callback80211Metrics(Config80211 *config80211, Metrics *metrics);
31
Wade Guthrieb1ec8602012-10-18 17:26:14 -070032 // Install ourselves as a callback.
33 virtual bool InstallAsBroadcastCallback();
Wade Guthrie5020b572012-10-12 15:51:14 -070034
35 private:
36 // When installed, this is the method Config80211 will call when it gets a
37 // message from the mac80211 drivers.
38 virtual void Config80211MessageCallback(const UserBoundNlMessage &msg);
39
40 static const char kMetricLinkDisconnectCount[];
41
42 Metrics *metrics_;
43
44 // Config80211MessageCallback method bound to this object to install as a
45 // callback.
46 base::WeakPtrFactory<Callback80211Metrics> weak_ptr_factory_;
47
48 DISALLOW_COPY_AND_ASSIGN(Callback80211Metrics);
49};
50
51} // namespace shill
52
53#endif // SHILL_CALLBACK80211_METRICS_H