Successfully write transaction commands.
[minibind.git] / jni / minibind / parcel.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_PARCEL_H_
6 #define MINIBIND_PARCEL_H_
7
8 #include <stdint.h>
9 #include <sys/types.h>
10
11 #include <linux/binder.h>
12
13 #include <string>
14 #include <vector>
15
16 namespace minibind {
17
18 class Parcel {
19 public:
20 Parcel();
21 ~Parcel();
22
23 void WriteInterfaceToken(const std::string& str);
24 void WriteUTF8(const std::string& str);
25 void WriteUInt32(uint32_t ui32);
26
27 bool ReadUInt32(uint32_t* ui32);
28 bool ReadBytes(size_t count, void* buffer);
29
30 binder_uintptr_t DataPointer() const;
31 size_t DataSize() const;
32 void SetDataSize(size_t size);
33
34 void SetDataPosition(size_t pos);
35
36 void Print() const;
37
38 private:
39 size_t data_position_;
40 std::vector<uint8_t> data_;
41 std::vector<struct flat_binder_object> objects_;
42 };
43
44 } // namespace minibind
45
46 #endif // MINIBIND_PARCEL_H_