Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 1 | // 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_OBJECT_H |
| 9 | #define SHILL_CALLBACK80211_OBJECT_H |
| 10 | |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 11 | #include <base/basictypes.h> |
Wade Guthrie | 5020b57 | 2012-10-12 15:51:14 -0700 | [diff] [blame] | 12 | #include <base/memory/weak_ptr.h> |
| 13 | |
| 14 | #include "shill/config80211.h" |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 15 | |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 16 | namespace shill { |
| 17 | |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 18 | class Nl80211Message; |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 19 | |
| 20 | // Example Config80211 callback object; the callback prints a description of |
Wade Guthrie | 5020b57 | 2012-10-12 15:51:14 -0700 | [diff] [blame] | 21 | // each message with its attributes. |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 22 | class Callback80211Object { |
| 23 | public: |
Christopher Wiley | fe34be0 | 2012-11-12 16:02:46 -0800 | [diff] [blame] | 24 | Callback80211Object(); |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 25 | virtual ~Callback80211Object(); |
| 26 | |
Christopher Wiley | fe34be0 | 2012-11-12 16:02:46 -0800 | [diff] [blame] | 27 | bool InstallAsBroadcastCallback(); |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 28 | bool DeinstallAsCallback(); |
| 29 | |
Christopher Wiley | fe34be0 | 2012-11-12 16:02:46 -0800 | [diff] [blame] | 30 | const Config80211::Callback &callback() const { return callback_; } |
| 31 | protected: |
Wade Guthrie | 5020b57 | 2012-10-12 15:51:14 -0700 | [diff] [blame] | 32 | // When installed, this is the method Config80211 will call when it gets a |
| 33 | // message from the mac80211 drivers. |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 34 | virtual void Config80211MessageCallback(const Nl80211Message &msg); |
Wade Guthrie | d4977f2 | 2012-08-22 12:37:54 -0700 | [diff] [blame] | 35 | |
Wade Guthrie | 5d3d6de | 2012-11-02 11:08:34 -0700 | [diff] [blame] | 36 | private: |
repo sync | dc085c8 | 2012-12-28 08:54:41 -0800 | [diff] [blame] | 37 | void ReceiveConfig80211Message(const Nl80211Message &msg); |
Christopher Wiley | fe34be0 | 2012-11-12 16:02:46 -0800 | [diff] [blame] | 38 | |
| 39 | base::WeakPtrFactory<Callback80211Object> weak_ptr_factory_; |
| 40 | Config80211::Callback callback_; |
| 41 | |
Wade Guthrie | 5020b57 | 2012-10-12 15:51:14 -0700 | [diff] [blame] | 42 | DISALLOW_COPY_AND_ASSIGN(Callback80211Object); |
Wade Guthrie | 64b4c14 | 2012-08-20 15:21:01 -0700 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | } // namespace shill |
| 46 | |
| 47 | #endif // SHILL_CALLBACK80211_OBJECT_H |