blob: 47a7962a0bf1b0a64a5072775fd84c11b7e839bc [file] [log] [blame]
// 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.
// This class is a callback object that observes all nl80211 events that come
// up from the kernel.
#ifndef SHILL_CALLBACK80211_OBJECT_H
#define SHILL_CALLBACK80211_OBJECT_H
#include <base/basictypes.h>
#include <base/memory/weak_ptr.h>
#include "shill/config80211.h"
namespace shill {
class NetlinkMessage;
// Example Config80211 callback object; the callback prints a description of
// each message with its attributes.
class Callback80211Object {
public:
Callback80211Object();
virtual ~Callback80211Object();
bool InstallAsBroadcastHandler();
bool DeinstallAsHandler();
const Config80211::NetlinkMessageHandler &message_handler() const {
return message_handler_;
}
protected:
// When installed, this is the method Config80211 will call when it gets a
// message from the mac80211 drivers.
virtual void Config80211MessageHandler(const NetlinkMessage &msg);
private:
void ReceiveConfig80211Message(const NetlinkMessage &msg);
base::WeakPtrFactory<Callback80211Object> weak_ptr_factory_;
Config80211::NetlinkMessageHandler message_handler_;
DISALLOW_COPY_AND_ASSIGN(Callback80211Object);
};
} // namespace shill
#endif // SHILL_CALLBACK80211_OBJECT_H