Debian Codegraph @

include/usbmuxd-proto.h

raw
1 /*
2 * usbmuxd-proto.h - Protocol definition for the usbmux protocol.
3 *
4 * Copyright (C) 2009 Paul Sladen <[email protected]>
5 * Copyright (C) 2009 Nikias Bassen <[email protected]>
6 * Copyright (C) 2009 Hector Martin <[email protected]>
7 *
8 * This library is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU Lesser General Public License as
10 * published by the Free Software Foundation, either version 2.1 of the
11 * License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
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
36 extern "C" {
37 #endif
38
39 enum 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
49 enum 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
60 #pragma pack(push, 1)
61
62 struct usbmuxd_header {
63 uint32_t length; // length of message, including header
64 uint32_t version; // protocol version
65 uint32_t message; // message type
66 uint32_t tag; // responses to this query will echo back this tag
67 };
68
69 struct usbmuxd_result_msg {
70 struct usbmuxd_header header;
71 uint32_t result;
72 };
73
74 struct usbmuxd_connect_request {
75 struct usbmuxd_header header;
76 uint32_t device_id;
77 uint16_t port; // TCP port number
78 uint16_t reserved; // set to zero
79 };
80
81 struct usbmuxd_listen_request {
82 struct usbmuxd_header header;
83 };
84
85 struct usbmuxd_device_record {
86 uint32_t device_id;
87 uint16_t product_id;
88 char serial_number[256];
89 uint16_t padding;
90 uint32_t location;
91 };
92
93 #pragma pack(pop)
94
95 #ifdef __cplusplus
96 }
97 #endif
98
99 #endif /* USBMUXD_PROTO_H */