blob: a036b757b084d1477e007827100d219c44ea0a38 [file] [log] [blame]
Paul Stewart5f06a0e2012-12-20 11:11:33 -08001// Copyright (c) 2012 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
5#ifndef SHILL_IO_HANDLER_
6#define SHILL_IO_HANDLER_
7
8namespace shill {
9
Paul Stewart5f06a0e2012-12-20 11:11:33 -080010class Error;
11
Paul Stewart25379f12011-05-26 06:41:38 -070012struct InputData {
Darin Petkov633ac6f2011-07-08 13:56:13 -070013 InputData() : buf(NULL), len(0) {}
14 InputData(unsigned char *in_buf, size_t in_len) : buf(in_buf), len(in_len) {}
15
Paul Stewart25379f12011-05-26 06:41:38 -070016 unsigned char *buf;
17 size_t len;
18};
19
Paul Stewart26b327e2011-10-19 11:38:09 -070020class IOHandler {
Paul Stewart25379f12011-05-26 06:41:38 -070021 public:
Paul Stewartf0aae102011-10-19 12:11:44 -070022 enum ReadyMode {
23 kModeInput,
24 kModeOutput
25 };
26
Paul Stewart5f06a0e2012-12-20 11:11:33 -080027 typedef base::Callback<void(const Error &)> ErrorCallback;
28 typedef base::Callback<void(InputData *)> InputCallback;
29 typedef base::Callback<void(int)> ReadyCallback;
30
Paul Stewart26b327e2011-10-19 11:38:09 -070031 IOHandler() {}
32 virtual ~IOHandler() {}
Paul Stewartf0aae102011-10-19 12:11:44 -070033
34 virtual void Start() {}
35 virtual void Stop() {}
Paul Stewart25379f12011-05-26 06:41:38 -070036};
37
38} // namespace shill
39
40#endif // SHILL_IO_HANDLER_