summaryrefslogtreecommitdiffstats
path: root/src/usbmuxd-proto.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/usbmuxd-proto.h')
-rw-r--r--src/usbmuxd-proto.h95
1 files changed, 95 insertions, 0 deletions
diff --git a/src/usbmuxd-proto.h b/src/usbmuxd-proto.h
new file mode 100644
index 0000000..93df00e
--- /dev/null
+++ b/src/usbmuxd-proto.h
@@ -0,0 +1,95 @@
1/*
2 * usbmuxd-proto.h
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 <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/* Protocol definition for usbmuxd proxy protocol */
23#ifndef USBMUXD_PROTO_H
24#define USBMUXD_PROTO_H
25
26#include <stdint.h>
27#define USBMUXD_PROTOCOL_VERSION 0
28
29#if defined(WIN32) || defined(__CYGWIN__)
30#define USBMUXD_SOCKET_PORT 27015
31#else
32#define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"
33#endif
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39enum usbmuxd_result {
40 RESULT_OK = 0,
41 RESULT_BADCOMMAND = 1,
42 RESULT_BADDEV = 2,
43 RESULT_CONNREFUSED = 3,
44 // ???
45 // ???
46 RESULT_BADVERSION = 6,
47};
48
49enum usbmuxd_msgtype {
50 MESSAGE_RESULT = 1,
51 MESSAGE_CONNECT = 2,
52 MESSAGE_LISTEN = 3,
53 MESSAGE_DEVICE_ADD = 4,
54 MESSAGE_DEVICE_REMOVE = 5,
55 MESSAGE_DEVICE_PAIRED = 6,
56 //???
57 MESSAGE_PLIST = 8,
58};
59
60struct usbmuxd_header {
61 uint32_t length; // length of message, including header
62 uint32_t version; // protocol version
63 uint32_t message; // message type
64 uint32_t tag; // responses to this query will echo back this tag
65} __attribute__((__packed__));
66
67struct usbmuxd_result_msg {
68 struct usbmuxd_header header;
69 uint32_t result;
70} __attribute__((__packed__));
71
72struct usbmuxd_connect_request {
73 struct usbmuxd_header header;
74 uint32_t device_id;
75 uint16_t port; // TCP port number
76 uint16_t reserved; // set to zero
77} __attribute__((__packed__));
78
79struct usbmuxd_listen_request {
80 struct usbmuxd_header header;
81} __attribute__((__packed__));
82
83struct usbmuxd_device_record {
84 uint32_t device_id;
85 uint16_t product_id;
86 char serial_number[256];
87 uint16_t padding;
88 uint32_t location;
89} __attribute__((__packed__));
90
91#ifdef __cplusplus
92}
93#endif
94
95#endif /* USBMUXD_PROTO_H */