blob: 9c37b8c1a9a797a69ce7a24c0ace63c3555f51bc [file] [log] [blame]
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -04001/*
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 *
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -05008 * http://www.apache.org/licenses/LICENSE-2.0
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -04009 *
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.
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040015 */
16
17#ifndef _MTP_TYPES_H
18#define _MTP_TYPES_H
19
20#include <stdint.h>
21#include <vector>
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040022
23typedef int32_t int128_t[4];
24typedef uint32_t uint128_t[4];
25
26typedef uint16_t MtpOperationCode;
27typedef uint16_t MtpResponseCode;
28typedef uint16_t MtpEventCode;
29typedef uint32_t MtpSessionID;
30typedef uint32_t MtpStorageID;
31typedef uint32_t MtpTransactionID;
32typedef uint16_t MtpPropertyCode;
33typedef uint16_t MtpDataType;
34typedef uint16_t MtpObjectFormat;
35typedef MtpPropertyCode MtpDeviceProperty;
36typedef MtpPropertyCode MtpObjectProperty;
37
38// object handles are unique across all storage but only within a single session.
39// object handles cannot be reused after an object is deleted.
40// values 0x00000000 and 0xFFFFFFFF are reserved for special purposes.
41typedef uint32_t MtpObjectHandle;
42
43// Special values
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -050044#define MTP_PARENT_ROOT 0xFFFFFFFF // parent is root of the storage
45#define kInvalidObjectHandle 0xFFFFFFFF
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040046
47class MtpStorage;
48class MtpDevice;
49class MtpProperty;
50
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -050051typedef std::vector<MtpStorage *> MtpStorageList;
52typedef std::vector<MtpDevice*> MtpDeviceList;
53typedef std::vector<MtpProperty*> MtpPropertyList;
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040054
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -050055typedef std::vector<uint8_t> UInt8List;
56typedef std::vector<uint16_t> UInt16List;
57typedef std::vector<uint32_t> UInt32List;
58typedef std::vector<uint64_t> UInt64List;
59typedef std::vector<int8_t> Int8List;
60typedef std::vector<int16_t> Int16List;
61typedef std::vector<int32_t> Int32List;
62typedef std::vector<int64_t> Int64List;
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040063
64typedef UInt16List MtpObjectPropertyList;
65typedef UInt16List MtpDevicePropertyList;
66typedef UInt16List MtpObjectFormatList;
67typedef UInt32List MtpObjectHandleList;
68typedef UInt16List MtpObjectPropertyList;
69typedef UInt32List MtpStorageIDList;
70
bigbiff bigbiffaf32bb92018-12-18 18:39:53 -050071enum UrbPacketDivisionMode {
72 // First packet only contains a header.
73 FIRST_PACKET_ONLY_HEADER,
74 // First packet contains payload much as possible.
75 FIRST_PACKET_HAS_PAYLOAD
76};
bigbiff bigbiffc7eee6f2014-09-02 18:59:01 -040077
78#endif // _MTP_TYPES_H