Paul Stewart | 5f06a0e | 2012-12-20 11:11:33 -0800 | [diff] [blame] | 1 | // Copyright (c) 2012 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 | |
| 5 | #ifndef SHILL_IO_HANDLER_ |
| 6 | #define SHILL_IO_HANDLER_ |
| 7 | |
| 8 | namespace shill { |
| 9 | |
Paul Stewart | 5f06a0e | 2012-12-20 11:11:33 -0800 | [diff] [blame] | 10 | class Error; |
| 11 | |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 12 | struct InputData { |
Darin Petkov | 633ac6f | 2011-07-08 13:56:13 -0700 | [diff] [blame] | 13 | InputData() : buf(NULL), len(0) {} |
| 14 | InputData(unsigned char *in_buf, size_t in_len) : buf(in_buf), len(in_len) {} |
| 15 | |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 16 | unsigned char *buf; |
| 17 | size_t len; |
| 18 | }; |
| 19 | |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 20 | class IOHandler { |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 21 | public: |
Paul Stewart | f0aae10 | 2011-10-19 12:11:44 -0700 | [diff] [blame] | 22 | enum ReadyMode { |
| 23 | kModeInput, |
| 24 | kModeOutput |
| 25 | }; |
| 26 | |
Paul Stewart | 5f06a0e | 2012-12-20 11:11:33 -0800 | [diff] [blame] | 27 | typedef base::Callback<void(const Error &)> ErrorCallback; |
| 28 | typedef base::Callback<void(InputData *)> InputCallback; |
| 29 | typedef base::Callback<void(int)> ReadyCallback; |
| 30 | |
Paul Stewart | 26b327e | 2011-10-19 11:38:09 -0700 | [diff] [blame] | 31 | IOHandler() {} |
| 32 | virtual ~IOHandler() {} |
Paul Stewart | f0aae10 | 2011-10-19 12:11:44 -0700 | [diff] [blame] | 33 | |
| 34 | virtual void Start() {} |
| 35 | virtual void Stop() {} |
Paul Stewart | 25379f1 | 2011-05-26 06:41:38 -0700 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | } // namespace shill |
| 39 | |
| 40 | #endif // SHILL_IO_HANDLER_ |