blob: f2d2746a89d8a58ba8f78ecef8b120409dd0f541 [file] [log] [blame]
// Copyright 2018 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_NET_RTNL_LISTENER_H_
#define SHILL_NET_RTNL_LISTENER_H_
#include <base/callback.h>
#include <base/observer_list_types.h>
#include "shill/net/shill_export.h"
namespace shill {
class RTNLHandler;
class RTNLMessage;
class SHILL_EXPORT RTNLListener : public base::CheckedObserver {
public:
RTNLListener(int listen_flags,
const base::Callback<void(const RTNLMessage&)>& callback);
RTNLListener(int listen_flags,
const base::Callback<void(const RTNLMessage&)>& callback,
RTNLHandler* rtnl_handler);
RTNLListener(const RTNLListener&) = delete;
RTNLListener& operator=(const RTNLListener&) = delete;
~RTNLListener();
void NotifyEvent(int type, const RTNLMessage& msg) const;
private:
const int listen_flags_;
const base::Callback<void(const RTNLMessage&)> callback_;
RTNLHandler* const rtnl_handler_;
};
} // namespace shill
#endif // SHILL_NET_RTNL_LISTENER_H_