blob: 908ff9c40a63685508f9779948b5b4eea30c3995 [file] [log] [blame]
Chris Masonec1e50412011-06-07 13:04:53 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
Paul Stewart25379f12011-05-26 06:41:38 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Paul Stewartf0aae102011-10-19 12:11:44 -07005#ifndef SHILL_GLIB_IO_INPUT_HANDLER_
6#define SHILL_GLIB_IO_INPUT_HANDLER_
Paul Stewart25379f12011-05-26 06:41:38 -07007
8#include <stdio.h>
9#include <glib.h>
10
Eric Shienbrood3e20a232012-02-16 11:35:56 -050011#include <base/callback.h>
Paul Stewart25379f12011-05-26 06:41:38 -070012
13#include "shill/io_handler.h"
14
15namespace shill {
16
Paul Stewart26b327e2011-10-19 11:38:09 -070017class GlibIOInputHandler : public IOHandler {
Paul Stewart25379f12011-05-26 06:41:38 -070018 public:
Eric Shienbrood3e20a232012-02-16 11:35:56 -050019 GlibIOInputHandler(int fd, const base::Callback<void(InputData *)> &callback);
Paul Stewart26b327e2011-10-19 11:38:09 -070020 ~GlibIOInputHandler();
Paul Stewartf0aae102011-10-19 12:11:44 -070021
22 virtual void Start();
23 virtual void Stop();
Paul Stewart26b327e2011-10-19 11:38:09 -070024
Eric Shienbrood3e20a232012-02-16 11:35:56 -050025 const base::Callback<void(InputData *)> &callback() { return callback_; }
26
Paul Stewart26b327e2011-10-19 11:38:09 -070027 private:
Paul Stewart25379f12011-05-26 06:41:38 -070028 GIOChannel *channel_;
Eric Shienbrood3e20a232012-02-16 11:35:56 -050029 base::Callback<void(InputData *)> callback_;
Paul Stewart25379f12011-05-26 06:41:38 -070030 guint source_id_;
Paul Stewart25379f12011-05-26 06:41:38 -070031};
32
33
34} // namespace shill
35
Paul Stewartf0aae102011-10-19 12:11:44 -070036#endif // SHILL_GLIB_IO_INPUT_HANDLER_