blob: 3a3d3100ed76fa6860576b421e9f358742fbf0cf [file] [log] [blame]
Paul Stewartf0aae102011-10-19 12:11:44 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SHILL_GLIB_IO_READY_HANDLER_
6#define SHILL_GLIB_IO_READY_HANDLER_
7
8#include <stdio.h>
9#include <glib.h>
10
11#include <base/callback_old.h>
12
13#include "shill/io_handler.h"
14
15namespace shill {
16
17// This handler is different from the GlibIOInputHandler
18// in that we don't read/write from the file handle and
19// leave that to the caller. This is useful in accept()ing
20// sockets and effort to working with peripheral libraries.
21class GlibIOReadyHandler : public IOHandler {
22 public:
Paul Stewartc2350ee2011-10-19 12:28:40 -070023 GlibIOReadyHandler(int fd,
24 IOHandler::ReadyMode mode,
25 Callback1<int>::Type *callback);
Paul Stewartf0aae102011-10-19 12:11:44 -070026 ~GlibIOReadyHandler();
27
28 virtual void Start();
29 virtual void Stop();
30
31 private:
32 GIOChannel *channel_;
33 GIOCondition condition_;
34 Callback1<int>::Type *callback_;
35 guint source_id_;
36};
37
38
39} // namespace shill
40
41#endif // SHILL_GLIB_IO_READY_HANDLER_