diff options
| -rw-r--r-- | src/usbmuxd-proto.h | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/src/usbmuxd-proto.h b/src/usbmuxd-proto.h new file mode 100644 index 0000000..7842975 --- /dev/null +++ b/src/usbmuxd-proto.h | |||
| @@ -0,0 +1,96 @@ | |||
| 1 | /* | ||
| 2 | usbmuxd - iPhone/iPod Touch USB multiplex server daemon | ||
| 3 | |||
| 4 | Copyright (C) 2009 Paul Sladen <libiphone@paul.sladen.org> | ||
| 5 | Copyright (C) 2009 Nikias Bassen <nikias@gmx.li> | ||
| 6 | Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com> | ||
| 7 | |||
| 8 | This program is free software; you can redistribute it and/or modify | ||
| 9 | it under the terms of the GNU General Public License as published by | ||
| 10 | the Free Software Foundation, either version 2 or version 3. | ||
| 11 | |||
| 12 | This program is distributed in the hope that it will be useful, | ||
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | GNU General Public License for more details. | ||
| 16 | |||
| 17 | You should have received a copy of the GNU General Public License | ||
| 18 | along with this program; if not, write to the Free Software | ||
| 19 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | |||
| 21 | */ | ||
| 22 | |||
| 23 | /* Protocol defintion for usbmuxd proxy protocol */ | ||
| 24 | #ifndef __USBMUXD_PROTO_H | ||
| 25 | #define __USBMUXD_PROTO_H | ||
| 26 | |||
| 27 | #include <stdint.h> | ||
| 28 | #define USBMUXD_PROTOCOL_VERSION 0 | ||
| 29 | |||
| 30 | #if defined(WIN32) || defined(__CYGWIN__) | ||
| 31 | #define USBMUXD_SOCKET_PORT 27015 | ||
| 32 | #else | ||
| 33 | #define USBMUXD_SOCKET_FILE "/var/run/usbmuxd" | ||
| 34 | #endif | ||
| 35 | |||
| 36 | #ifdef __cplusplus | ||
| 37 | extern "C" { | ||
| 38 | #endif | ||
| 39 | |||
| 40 | enum usbmuxd_result { | ||
| 41 | RESULT_OK = 0, | ||
| 42 | RESULT_BADCOMMAND = 1, | ||
| 43 | RESULT_BADDEV = 2, | ||
| 44 | RESULT_CONNREFUSED = 3, | ||
| 45 | // ??? | ||
| 46 | // ??? | ||
| 47 | RESULT_BADVERSION = 6, | ||
| 48 | }; | ||
| 49 | |||
| 50 | enum usbmuxd_msgtype { | ||
| 51 | MESSAGE_RESULT = 1, | ||
| 52 | MESSAGE_CONNECT = 2, | ||
| 53 | MESSAGE_LISTEN = 3, | ||
| 54 | MESSAGE_DEVICE_ADD = 4, | ||
| 55 | MESSAGE_DEVICE_REMOVE = 5, | ||
| 56 | //??? | ||
| 57 | //??? | ||
| 58 | MESSAGE_PLIST = 8, | ||
| 59 | }; | ||
| 60 | |||
| 61 | struct usbmuxd_header { | ||
| 62 | uint32_t length; // length of message, including header | ||
| 63 | uint32_t version; // protocol version | ||
| 64 | uint32_t message; // message type | ||
| 65 | uint32_t tag; // responses to this query will echo back this tag | ||
| 66 | } __attribute__((__packed__)); | ||
| 67 | |||
| 68 | struct usbmuxd_result_msg { | ||
| 69 | struct usbmuxd_header header; | ||
| 70 | uint32_t result; | ||
| 71 | } __attribute__((__packed__)); | ||
| 72 | |||
| 73 | struct usbmuxd_connect_request { | ||
| 74 | struct usbmuxd_header header; | ||
| 75 | uint32_t device_id; | ||
| 76 | uint16_t port; // TCP port number | ||
| 77 | uint16_t reserved; // set to zero | ||
| 78 | } __attribute__((__packed__)); | ||
| 79 | |||
| 80 | struct usbmuxd_listen_request { | ||
| 81 | struct usbmuxd_header header; | ||
| 82 | } __attribute__((__packed__)); | ||
| 83 | |||
| 84 | struct usbmuxd_device_record { | ||
| 85 | uint32_t device_id; | ||
| 86 | uint16_t product_id; | ||
| 87 | char serial_number[256]; | ||
| 88 | uint16_t padding; | ||
| 89 | uint32_t location; | ||
| 90 | } __attribute__((__packed__)); | ||
| 91 | |||
| 92 | #ifdef __cplusplus | ||
| 93 | } | ||
| 94 | #endif | ||
| 95 | |||
| 96 | #endif /* __USBMUXD_PROTO_H */ | ||
