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 | |
| 11 | #include <base/callback_old.h> |
| 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: |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 19 | GlibIOInputHandler(int fd, Callback1<InputData*>::Type *callback); |
| 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 | |
| 25 | private: |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 26 | GIOChannel *channel_; |
| 27 | Callback1<InputData *>::Type *callback_; |
| 28 | guint source_id_; |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 29 | }; |
| 30 | |
| 31 | |
| 32 | } // namespace shill |
| 33 | |
Paul Stewart | f0aae10 | 2011-10-19 12:11:44 -0700 | [diff] [blame] | 34 | #endif // SHILL_GLIB_IO_INPUT_HANDLER_ |