1 /*
2  * Copyright (C) 2010 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef _MTP_TYPES_H
18 #define _MTP_TYPES_H
19 
20 #include <stdint.h>
21 #include "utils/String8.h"
22 #include "utils/Vector.h"
23 
24 namespace android {
25 
26 typedef int32_t int128_t[4];
27 typedef uint32_t uint128_t[4];
28 
29 typedef uint16_t MtpOperationCode;
30 typedef uint16_t MtpResponseCode;
31 typedef uint16_t MtpEventCode;
32 typedef uint32_t MtpSessionID;
33 typedef uint32_t MtpStorageID;
34 typedef uint32_t MtpTransactionID;
35 typedef uint16_t MtpPropertyCode;
36 typedef uint16_t MtpDataType;
37 typedef uint16_t MtpObjectFormat;
38 typedef MtpPropertyCode MtpDeviceProperty;
39 typedef MtpPropertyCode MtpObjectProperty;
40 
41 // object handles are unique across all storage but only within a single session.
42 // object handles cannot be reused after an object is deleted.
43 // values 0x00000000 and 0xFFFFFFFF are reserved for special purposes.
44 typedef uint32_t MtpObjectHandle;
45 
46 // Special values
47 #define MTP_PARENT_ROOT         0xFFFFFFFF       // parent is root of the storage
48 #define kInvalidObjectHandle    0xFFFFFFFF
49 
50 class MtpStorage;
51 class MtpDevice;
52 class MtpProperty;
53 
54 typedef Vector<MtpStorage *> MtpStorageList;
55 typedef Vector<MtpDevice*> MtpDeviceList;
56 typedef Vector<MtpProperty*> MtpPropertyList;
57 
58 typedef Vector<uint8_t> UInt8List;
59 typedef Vector<uint16_t> UInt16List;
60 typedef Vector<uint32_t> UInt32List;
61 typedef Vector<uint64_t> UInt64List;
62 typedef Vector<int8_t> Int8List;
63 typedef Vector<int16_t> Int16List;
64 typedef Vector<int32_t> Int32List;
65 typedef Vector<int64_t> Int64List;
66 
67 typedef UInt16List MtpObjectPropertyList;
68 typedef UInt16List MtpDevicePropertyList;
69 typedef UInt16List MtpObjectFormatList;
70 typedef UInt32List MtpObjectHandleList;
71 typedef UInt16List MtpObjectPropertyList;
72 typedef UInt32List MtpStorageIDList;
73 
74 typedef String8    MtpString;
75 
76 }; // namespace android
77 
78 #endif // _MTP_TYPES_H
79