Bumped copyright dates for 2013
[barry.git] / src / protocol.h
blobfa294519ec5ef6db9238be66568d01a72e5c24ef
1 ///
2 /// \file protocol.h
3 /// USB Blackberry bulk protocol API constants
4 ///
6 /*
7 Copyright (C) 2005-2013, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRY_PROTOCOL_H__
23 #define __BARRY_PROTOCOL_H__
25 // packet commands (Packet.command: has response codes too)
26 #define SB_COMMAND_ECHO 0x01
27 #define SB_COMMAND_ECHO_REPLY 0x02
28 #define SB_COMMAND_RESET 0x03
29 #define SB_COMMAND_RESET_REPLY 0x04
30 #define SB_COMMAND_FETCH_ATTRIBUTE 0x05
31 #define SB_COMMAND_FETCHED_ATTRIBUTE 0x06
32 #define SB_COMMAND_SELECT_MODE 0x07
33 #define SB_COMMAND_MODE_SELECTED 0x08
34 #define SB_COMMAND_MODE_NOT_SELECTED 0x09
35 #define SB_COMMAND_OPEN_SOCKET 0x0a
36 #define SB_COMMAND_CLOSE_SOCKET 0x0b
37 #define SB_COMMAND_CLOSED_SOCKET 0x0c
38 #define SB_COMMAND_REMOTE_CLOSE_SOCKET 0x0d
39 #define SB_COMMAND_PASSWORD_CHALLENGE 0x0e
40 #define SB_COMMAND_PASSWORD 0x0f
41 #define SB_COMMAND_OPENED_SOCKET 0x10
42 #define SB_COMMAND_PASSWORD_FAILED 0x11
43 #define SB_COMMAND_SEQUENCE_HANDSHAKE 0x13
44 #define SB_COMMAND_DB_DATA 0x40
45 #define SB_COMMAND_DB_FRAGMENTED 0x60
46 #define SB_COMMAND_DB_DONE 0x41
48 // JavaLoader commands
49 #define SB_COMMAND_JL_HELLO 0x64 // This could be a general ACK in both directions
50 #define SB_COMMAND_JL_HELLO_ACK 0x65 // From device after host HELLO
51 #define SB_COMMAND_JL_GOODBYE 0x8d
52 #define SB_COMMAND_JL_SET_UNKNOWN1 0x70 // Initial sequence, 0
53 #define SB_COMMAND_JL_SET_COD_FILENAME 0x80
54 #define SB_COMMAND_JL_SET_COD_SIZE 0x67 // Always big endian
55 #define SB_COMMAND_JL_SEND_DATA 0x68
56 #define SB_COMMAND_JL_SET_TIME 0x7c
57 #define SB_COMMAND_JL_GET_SCREENSHOT 0x87
58 #define SB_COMMAND_JL_DEVICE_INFO 0x71
59 #define SB_COMMAND_JL_OS_METRICS 0x78
60 #define SB_COMMAND_JL_BOOTROM_METRICS 0x79
61 #define SB_COMMAND_JL_GET_DIRECTORY 0x6d
62 #define SB_COMMAND_JL_GET_DATA_ENTRY 0x6e // Used for both DIR and SCREENSHOT
63 #define SB_COMMAND_JL_GET_SUBDIR 0x7f
64 #define SB_COMMAND_JL_GET_SUBDIR_ENTRY 0x7d
65 #define SB_COMMAND_JL_ERASE 0x69
66 #define SB_COMMAND_JL_FORCE_ERASE 0x7b
67 #define SB_COMMAND_JL_UNKNOWN3 0x63
68 #define SB_COMMAND_JL_GET_LOG 0x73
69 #define SB_COMMAND_JL_GET_LOG_ENTRY 0x74
70 #define SB_COMMAND_JL_CLEAR_LOG 0x88
71 #define SB_COMMAND_JL_SAVE_MODULE 0x7e
72 #define SB_COMMAND_JL_WIPE_APPS 0x6a
73 #define SB_COMMAND_JL_WIPE_FS 0x6b
74 #define SB_COMMAND_JL_LOG_STRACES 0x8e
75 #define SB_COMMAND_JL_RESET_FACTORY 0x91
77 // JavaLoader response
78 #define SB_COMMAND_JL_ACK 0x64
79 #define SB_COMMAND_JL_READY 0x01
80 #define SB_COMMAND_JL_RESET_REQUIRED 0x78 // Occurs after GOODBYE when handheld reset is required
81 #define SB_COMMAND_JL_COD_IN_USE 0x6c // Perhaps "BUSY" is also a good name?
82 #define SB_COMMAND_JL_COD_NOT_FOUND 0x69
83 #define SB_COMMAND_JL_NOT_ENOUGH_MEMORY 0x6a // Occurs when the internal memory isn't enough to install the new COD file
84 #define SB_COMMAND_JL_NOT_SUPPORTED 0x71 // Occurs when device does not support a command
86 // JavaLoader data
87 #define SB_DATA_JL_SUCCESS 0x64 // Device has accepted the data packet
88 #define SB_DATA_JL_INVALID 0x68 // Device returns this code if the application isn't valid.
91 // JDWP Command set list
92 #define JDWP_CMDSET_VIRTUALMACHINE 1
93 #define JDWP_CMDSET_REFERECENTYPE 2
94 #define JDWP_CMDSET_CLASSTYPE 3
95 #define JDWP_CMDSET_ARRAYTYPE 4
96 #define JDWP_CMDSET_INTERFACETYPE 5
97 #define JDWP_CMDSET_METHOD 6
98 #define JDWP_CMDSET_FIELD 8
99 #define JDWP_CMDSET_OBJECTREFERENCE 9
100 #define JDWP_CMDSET_STRINGREFERENCE 10
101 #define JDWP_CMDSET_THREADREFERENCE 11
102 #define JDWP_CMDSET_THREADGROUPREFERENCE 12
103 #define JDWP_CMDSET_ARRAYREFERENCE 13
104 #define JDWP_CMDSET_CLASSLOADERREFERENCE 14
105 #define JDWP_CMDSET_EVENTREQUEST 15
106 #define JDWP_CMDSET_STACKFRAME 16
107 #define JDWP_CMDSET_CLASSOBJECTREFERENCE 17
108 #define JDWP_CMDSET_EVENT 64
110 // JDWP Command list - VirtualMachine
111 #define JDWP_CMD_VERSION 1
112 #define JDWP_CMD_ALLCLASSES 3
113 #define JDWP_CMD_ALLTHREADS 4
114 #define JDWP_CMD_DISPOSE 6
115 #define JDWP_CMD_IDSIZES 7
116 #define JDWP_CMD_SUSPEND 8
117 #define JDWP_CMD_RESUME 9
118 #define JDWP_CMD_CLASSPATHS 13
120 // JDWP Command list - EventRequest
121 #define JDWP_CMD_SET 1
123 // JVMDebug commands
124 #define SB_COMMAND_JVM_UNKNOWN01 0x53
125 #define SB_COMMAND_JVM_UNKNOWN02 0x01
126 #define SB_COMMAND_JVM_UNKNOWN03 0x6f
127 #define SB_COMMAND_JVM_UNKNOWN04 0x8a
128 #define SB_COMMAND_JVM_UNKNOWN05 0x90
129 #define SB_COMMAND_JVM_UNKNOWN06 0x44
130 #define SB_COMMAND_JVM_UNKNOWN07 0x45
131 #define SB_COMMAND_JVM_UNKNOWN08 0x54
132 #define SB_COMMAND_JVM_UNKNOWN09 0x33
133 #define SB_COMMAND_JVM_UNKNOWN10 0x46
135 #define SB_COMMAND_JVM_UNKNOWN11 0x0e
136 #define SB_COMMAND_JVM_UNKNOWN12 0x50
137 #define SB_COMMAND_JVM_UNKNOWN13 0x0d
138 #define SB_COMMAND_JVM_UNKNOWN14 0x85
139 #define SB_COMMAND_JVM_UNKNOWN15 0x84
141 #define SB_COMMAND_JVM_GET_MODULES_LIST 0x8d // Get all Java modules list with their address and ID
142 #define SB_COMMAND_JVM_GET_THREADS_LIST 0x08 // Get all threads currently running in the virtual machine
143 #define SB_COMMAND_JVM_GET_CONSOLE_MSG 0x40 // Get console message
144 #define SB_COMMAND_JVM_GO 0x02 // Go
145 #define SB_COMMAND_JVM_GET_STATUS 0x06 // Get status
146 #define SB_COMMAND_JVM_SET_BREAKPOINT 0x21 // Set breakpoint
147 #define SB_COMMAND_JVM_RM_BREAKPOINT 0x22 // Remove breakpoint
149 #define SB_COMMAND_JVM_STOP 0xa502
151 // JavaDebug response
152 #define SB_COMMAND_JVM_GET_DATA_ENTRY 0x06
155 // mode constants
156 #define SB_MODE_REQUEST_SOCKET 0x00ff
159 // object and attribute ID codes (for ZeroPacket::GetAttribute())
160 // meanings for most of these are unknown
161 #define SB_OBJECT_INITIAL_UNKNOWN 0x14
162 #define SB_ATTR_INITIAL_UNKNOWN 0x01
163 #define SB_OBJECT_PROFILE 0x08
164 #define SB_ATTR_PROFILE_DESC 0x02
165 #define SB_ATTR_PROFILE_PIN 0x04
166 #define SB_OBJECT_SOCKET_UNKNOWN 0x04
169 // param command parameters
170 //#define SB_PARAM_DEFAULT 0xff
173 // DB Operation Command
174 #define SB_DBOP_ADD_RECORD 0x41
175 #define SB_DBOP_CLEAR_DATABASE 0x43
176 #define SB_DBOP_GET_DBDB 0x4a
177 #define SB_DBOP_OLD_GET_DBDB 0x4c
178 #define SB_DBOP_GET_COUNT 0x4e
179 #define SB_DBOP_GET_RECORDS 0x4f
180 #define SB_DBOP_OLD_GET_RECORDS 0x42
181 #define SB_DBOP_OLD_GET_RECORDS_REPLY 0x44
183 #define SB_DBOP_GET_RECORD_STATE_TABLE 0x53 // replies with 0x60, 0x41
184 #define SB_DBOP_SET_RECORD_FLAGS 0x54 // replies with 0x41
185 // used to clear dirty flag
186 #define SB_DBOP_GET_RECORD_BY_INDEX 0x46 // replies with 0x44
187 // John's device uses 0x50, with a reply of 0x4f (!)
188 // Then uses 0x55 as usual
189 // Delete uses 0x50/0x4f to check as well, then uses 0x52 as
190 // usual to do the actual delete.
191 #define SB_DBOP_SET_RECORD_BY_INDEX 0x55 // replies with 0x41
192 #define SB_DBOP_DELETE_RECORD_BY_INDEX 0x52 // intellisync does a GET(0x46)
193 // first, probably to make sure
194 // it has the right data and
195 // record
197 #endif