summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/usbmuxd-proto.h96
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
4Copyright (C) 2009 Paul Sladen <libiphone@paul.sladen.org>
5Copyright (C) 2009 Nikias Bassen <nikias@gmx.li>
6Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com>
7
8This program is free software; you can redistribute it and/or modify
9it under the terms of the GNU General Public License as published by
10the Free Software Foundation, either version 2 or version 3.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, 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
37extern "C" {
38#endif
39
40enum 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
50enum 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
61struct 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
68struct usbmuxd_result_msg {
69 struct usbmuxd_header header;
70 uint32_t result;
71} __attribute__((__packed__));
72
73struct 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
80struct usbmuxd_listen_request {
81 struct usbmuxd_header header;
82} __attribute__((__packed__));
83
84struct 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 */