diff options
| author | 2009-08-20 01:19:09 +0200 | |
|---|---|---|
| committer | 2009-08-21 03:08:18 +0200 | |
| commit | c46062aca98f2f077b3bab5c5f72ff2cb57b9dc2 (patch) | |
| tree | 0934caaa277436a42c515c9ccc86acb004620c7a /libusbmuxd/usbmuxd-proto.h | |
| parent | 886d4014509d64023ecf99b57d0fd39818e85bd4 (diff) | |
| download | usbmuxd-c46062aca98f2f077b3bab5c5f72ff2cb57b9dc2.tar.gz usbmuxd-c46062aca98f2f077b3bab5c5f72ff2cb57b9dc2.tar.bz2 | |
Updated usbmuxd protocol definition and public header.
[Hector] Merged by putting utils.c into a common dir,
avoiding log.c dependency for libusbmuxd, adding CMake
magic to tie things up.
Diffstat (limited to 'libusbmuxd/usbmuxd-proto.h')
| -rw-r--r-- | libusbmuxd/usbmuxd-proto.h | 58 |
1 files changed, 34 insertions, 24 deletions
diff --git a/libusbmuxd/usbmuxd-proto.h b/libusbmuxd/usbmuxd-proto.h index 7f8c2d6..1ecb7bc 100644 --- a/libusbmuxd/usbmuxd-proto.h +++ b/libusbmuxd/usbmuxd-proto.h | |||
| @@ -1,52 +1,62 @@ | |||
| 1 | /* Protocol defintion for usbmuxd proxy protocol */ | 1 | /* Protocol defintion for usbmuxd proxy protocol */ |
| 2 | |||
| 3 | #ifndef __USBMUXD_PROTO_H | 2 | #ifndef __USBMUXD_PROTO_H |
| 4 | #define __USBMUXD_PROTO_H | 3 | #define __USBMUXD_PROTO_H |
| 5 | 4 | ||
| 6 | #include <stdint.h> | 5 | #include <stdint.h> |
| 6 | #define USBMUXD_PROTOCOL_VERSION 0 | ||
| 7 | 7 | ||
| 8 | #define USBMUXD_SOCKET_FILE "/var/run/usbmuxd" | 8 | #define USBMUXD_SOCKET_FILE "/var/run/usbmuxd" |
| 9 | 9 | ||
| 10 | enum usbmuxd_result { | ||
| 11 | RESULT_OK = 0, | ||
| 12 | RESULT_BADCOMMAND = 1, | ||
| 13 | RESULT_BADDEV = 2, | ||
| 14 | RESULT_CONNREFUSED = 3, | ||
| 15 | // ??? | ||
| 16 | // ??? | ||
| 17 | RESULT_BADVERSION = 6, | ||
| 18 | }; | ||
| 19 | |||
| 20 | enum usbmuxd_msgtype { | ||
| 21 | MESSAGE_RESULT = 1, | ||
| 22 | MESSAGE_CONNECT = 2, | ||
| 23 | MESSAGE_LISTEN = 3, | ||
| 24 | MESSAGE_DEVICE_ADD = 4, | ||
| 25 | MESSAGE_DEVICE_REMOVE = 5, | ||
| 26 | //??? | ||
| 27 | //??? | ||
| 28 | //MESSAGE_PLIST = 8, | ||
| 29 | }; | ||
| 30 | |||
| 10 | struct usbmuxd_header { | 31 | struct usbmuxd_header { |
| 11 | uint32_t length; // length of message, including header | 32 | uint32_t length; // length of message, including header |
| 12 | uint32_t reserved; // always zero | 33 | uint32_t version; // protocol version |
| 13 | uint32_t type; // message type | 34 | uint32_t message; // message type |
| 14 | uint32_t tag; // responses to this query will echo back this tag | 35 | uint32_t tag; // responses to this query will echo back this tag |
| 15 | } __attribute__((__packed__)); | 36 | } __attribute__((__packed__)); |
| 16 | 37 | ||
| 17 | struct usbmuxd_result { | 38 | struct usbmuxd_result_msg { |
| 18 | struct usbmuxd_header header; | 39 | struct usbmuxd_header header; |
| 19 | uint32_t result; | 40 | uint32_t result; |
| 20 | } __attribute__((__packed__)); | 41 | } __attribute__((__packed__)); |
| 21 | 42 | ||
| 22 | struct usbmuxd_connect_request { | 43 | struct usbmuxd_connect_request { |
| 23 | struct usbmuxd_header header; | 44 | struct usbmuxd_header header; |
| 24 | uint32_t device_id; | 45 | uint32_t device_id; |
| 25 | uint16_t tcp_dport; // TCP port number | 46 | uint16_t port; // TCP port number |
| 26 | uint16_t reserved; // set to zero | 47 | uint16_t reserved; // set to zero |
| 27 | } __attribute__((__packed__)); | 48 | } __attribute__((__packed__)); |
| 28 | 49 | ||
| 29 | struct usbmuxd_device { | 50 | struct usbmuxd_listen_request { |
| 30 | uint32_t device_id; | ||
| 31 | uint16_t product_id; | ||
| 32 | char serial_number[40]; | ||
| 33 | } __attribute__((__packed__)); | ||
| 34 | |||
| 35 | struct usbmuxd_device_info_record { | ||
| 36 | struct usbmuxd_header header; | 51 | struct usbmuxd_header header; |
| 37 | struct usbmuxd_device device; | ||
| 38 | char padding[222]; | ||
| 39 | } __attribute__((__packed__)); | 52 | } __attribute__((__packed__)); |
| 40 | 53 | ||
| 41 | struct usbmuxd_scan_request { | 54 | struct usbmuxd_device_record { |
| 42 | struct usbmuxd_header header; | 55 | uint32_t device_id; |
| 56 | uint16_t product_id; | ||
| 57 | char serial_number[256]; | ||
| 58 | uint16_t padding; | ||
| 59 | uint32_t location; | ||
| 43 | } __attribute__((__packed__)); | 60 | } __attribute__((__packed__)); |
| 44 | 61 | ||
| 45 | enum { | ||
| 46 | USBMUXD_RESULT = 1, | ||
| 47 | USBMUXD_CONNECT = 2, | ||
| 48 | USBMUXD_SCAN = 3, | ||
| 49 | USBMUXD_DEVICE_INFO = 4, | ||
| 50 | }; | ||
| 51 | |||
| 52 | #endif /* __USBMUXD_PROTO_H */ | 62 | #endif /* __USBMUXD_PROTO_H */ |
