Successfully write transaction commands.
[minibind.git] / jni / minibind / channel.h
1 // Copyright 2015 The Chromium 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 MINIBIND_CHANNEL_H_
6 #define MINIBIND_CHANNEL_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "parcel.h"
13
14 namespace minibind {
15
16 class Command;
17
18 class Channel {
19 public:
20 enum {
21 FIRST_CALL_CODE = 0x00000001,
22 LAST_CALL_CODE = 0x00ffffff,
23
24 PING_TRANSACTION = B_PACK_CHARS('_','P','N','G'),
25 };
26
27 explicit Channel(uint32_t handle);
28 ~Channel();
29
30 int Call(uint32_t code, const Parcel& in, Parcel* out);
31
32 Parcel* reader() { return &reader_; }
33
34 uint32_t handle() const { return handle_; }
35
36 private:
37 uint32_t handle_;
38 int driver_;
39
40 Parcel reader_;
41 };
42
43 } // namespace minibind
44
45 #endif // MINIBIND_CHANNEL_H_