summaryrefslogtreecommitdiffstats
path: root/usbmuxd.h
diff options
context:
space:
mode:
Diffstat (limited to 'usbmuxd.h')
-rw-r--r--usbmuxd.h97
1 files changed, 45 insertions, 52 deletions
diff --git a/usbmuxd.h b/usbmuxd.h
index cc9b9d7..da99f1f 100644
--- a/usbmuxd.h
+++ b/usbmuxd.h
@@ -1,52 +1,45 @@
1/* Protocol defintion for usbmuxd proxy protocol */ 1#ifndef __LIBUSBMUXD_H
2 2#define __LIBUSBMUXD_H
3#ifndef __USBMUXD_H 3
4#define __USBMUXD_H 4/**
5 5 * Array entry returned by 'usbmuxd_scan()' scanning.
6#include <stdint.h> 6 *
7 7 * If more than one device is available, 'product_id' and
8#define USBMUXD_SOCKET_FILE "/var/run/usbmuxd" 8 * 'serial_number' and be analysed to help make a selection.
9 9 * The relevant 'handle' should be passed to 'usbmuxd_connect()', to
10struct usbmuxd_header { 10 * start a proxy connection. The value 'handle' should be considered
11 uint32_t length; // length of message, including header 11 * opaque and no presumption made about the meaning of its value.
12 uint32_t reserved; // always zero 12 */
13 uint32_t type; // message type 13typedef struct {
14 uint32_t tag; // responses to this query will echo back this tag 14 int handle;
15} __attribute__((__packed__)); 15 int product_id;
16 16 char serial_number[41];
17struct usbmuxd_result { 17} usbmuxd_scan_result;
18 struct usbmuxd_header header; 18
19 uint32_t result; 19/**
20} __attribute__((__packed__)); 20 * Contacts usbmuxd and performs a scan for connected devices.
21 21 *
22struct usbmuxd_connect_request { 22 * @param available_devices pointer to array of usbmuxd_scan_result.
23 struct usbmuxd_header header; 23 * Array of available devices. The required 'handle'
24 uint32_t device_id; 24 * should be passed to 'usbmuxd_connect()'. The returned array
25 uint16_t tcp_dport; // TCP port number 25 * is zero-terminated for convenience; the final (unused)
26 uint16_t reserved; // set to zero 26 * entry containing handle == 0. The returned array pointer
27} __attribute__((__packed__)); 27 * should be freed by passing to 'free()' after use.
28 28 *
29struct usbmuxd_device { 29 * @return number of available devices, zero on no devices, or negative on error
30 uint32_t device_id; 30 */
31 uint16_t product_id; 31int usbmuxd_scan(usbmuxd_scan_result **available_devices);
32 char serial_number[40]; 32
33} __attribute__((__packed__)); 33/**
34 34 * Request proxy connect to
35struct usbmuxd_device_info_record { 35 *
36 struct usbmuxd_header header; 36 * @param handle returned by 'usbmuxd_scan()'
37 struct usbmuxd_device device; 37 *
38 char padding[222]; 38 * @param tcp_port TCP port number on device, in range 0-65535.
39} __attribute__((__packed__)); 39 * common values are 62078 for lockdown, and 22 for SSH.
40 40 *
41struct usbmuxd_scan_request { 41 * @return file descriptor socket of the connection, or -1 on error
42 struct usbmuxd_header header; 42 */
43} __attribute__((__packed__)); 43int usbmuxd_connect(const int handle, const unsigned short tcp_port);
44 44
45enum { 45#endif /* __LIBUSBMUXD_H */
46 USBMUXD_RESULT = 1,
47 USBMUXD_CONNECT = 2,
48 USBMUXD_SCAN = 3,
49 USBMUXD_DEVICE_INFO = 4,
50};
51
52#endif