Chris Masone | c1e5041 | 2011-06-07 13:04:53 -0700 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium OS Authors. All rights reserved. |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Paul Stewart | f0aae10 | 2011-10-19 12:11:44 -0700 | [diff] [blame] | 5 | #ifndef SHILL_GLIB_IO_INPUT_HANDLER_ |
| 6 | #define SHILL_GLIB_IO_INPUT_HANDLER_ |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 7 | |
| 8 | #include <stdio.h> |
| 9 | #include <glib.h> |
| 10 | |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 11 | #include <base/callback.h> |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 12 | |
| 13 | #include "shill/io_handler.h" |
| 14 | |
| 15 | namespace shill { |
| 16 | |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 17 | class GlibIOInputHandler : public IOHandler { |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 18 | public: |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 19 | GlibIOInputHandler(int fd, const base::Callback<void(InputData *)> &callback); |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 20 | ~GlibIOInputHandler(); |
Paul Stewart | f0aae10 | 2011-10-19 12:11:44 -0700 | [diff] [blame] | 21 | |
| 22 | virtual void Start(); |
| 23 | virtual void Stop(); |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 24 | |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 25 | const base::Callback<void(InputData *)> &callback() { return callback_; } |
| 26 | |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 27 | private: |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 28 | GIOChannel *channel_; |
Eric Shienbrood | 3e20a23 | 2012-02-16 11:35:56 -0500 | [diff] [blame] | 29 | base::Callback<void(InputData *)> callback_; |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 30 | guint source_id_; |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | |
| 34 | } // namespace shill |
| 35 | |
Paul Stewart | f0aae10 | 2011-10-19 12:11:44 -0700 | [diff] [blame] | 36 | #endif // SHILL_GLIB_IO_INPUT_HANDLER_ |