summaryrefslogtreecommitdiffstats
path: root/usbmuxd-proto.h
blob: 7f8c2d665d2471a78145da3fb762a839e9b98fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/* Protocol defintion for usbmuxd proxy protocol */

#ifndef __USBMUXD_PROTO_H
#define __USBMUXD_PROTO_H

#include <stdint.h>

#define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"

struct usbmuxd_header {
	uint32_t length;    // length of message, including header
	uint32_t reserved;  // always zero
	uint32_t type;      // message type
	uint32_t tag;       // responses to this query will echo back this tag
} __attribute__((__packed__));

struct usbmuxd_result {
	struct usbmuxd_header header;
	uint32_t result;
} __attribute__((__packed__));

struct	usbmuxd_connect_request {
	struct usbmuxd_header header;
	uint32_t device_id;
	uint16_t tcp_dport;   // TCP port number
	uint16_t reserved;   // set to zero
} __attribute__((__packed__));

struct usbmuxd_device {
	uint32_t device_id;
	uint16_t product_id;
	char serial_number[40];
} __attribute__((__packed__));

struct usbmuxd_device_info_record {
	struct usbmuxd_header header;
	struct usbmuxd_device device;
	char padding[222];
} __attribute__((__packed__));

struct usbmuxd_scan_request {
	struct usbmuxd_header header;
} __attribute__((__packed__));

enum {
	USBMUXD_RESULT  = 1,
	USBMUXD_CONNECT = 2,
	USBMUXD_SCAN = 3,
	USBMUXD_DEVICE_INFO = 4,
};

#endif /* __USBMUXD_PROTO_H */