summaryrefslogtreecommitdiffstats
path: root/libusbmuxd/usbmuxd-proto.h
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2009-08-20 01:19:09 +0200
committerGravatar Hector Martin2009-08-21 03:08:18 +0200
commitc46062aca98f2f077b3bab5c5f72ff2cb57b9dc2 (patch)
tree0934caaa277436a42c515c9ccc86acb004620c7a /libusbmuxd/usbmuxd-proto.h
parent886d4014509d64023ecf99b57d0fd39818e85bd4 (diff)
downloadusbmuxd-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.h58
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 @@
/* Protocol defintion for usbmuxd proxy protocol */
-
#ifndef __USBMUXD_PROTO_H
#define __USBMUXD_PROTO_H
#include <stdint.h>
+#define USBMUXD_PROTOCOL_VERSION 0
#define USBMUXD_SOCKET_FILE "/var/run/usbmuxd"
+enum usbmuxd_result {
+ RESULT_OK = 0,
+ RESULT_BADCOMMAND = 1,
+ RESULT_BADDEV = 2,
+ RESULT_CONNREFUSED = 3,
+ // ???
+ // ???
+ RESULT_BADVERSION = 6,
+};
+
+enum usbmuxd_msgtype {
+ MESSAGE_RESULT = 1,
+ MESSAGE_CONNECT = 2,
+ MESSAGE_LISTEN = 3,
+ MESSAGE_DEVICE_ADD = 4,
+ MESSAGE_DEVICE_REMOVE = 5,
+ //???
+ //???
+ //MESSAGE_PLIST = 8,
+};
+
struct usbmuxd_header {
uint32_t length; // length of message, including header
- uint32_t reserved; // always zero
- uint32_t type; // message type
+ uint32_t version; // protocol version
+ uint32_t message; // message type
uint32_t tag; // responses to this query will echo back this tag
} __attribute__((__packed__));
-struct usbmuxd_result {
+struct usbmuxd_result_msg {
struct usbmuxd_header header;
uint32_t result;
} __attribute__((__packed__));
-struct usbmuxd_connect_request {
+struct usbmuxd_connect_request {
struct usbmuxd_header header;
uint32_t device_id;
- uint16_t tcp_dport; // TCP port number
+ uint16_t port; // 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_listen_request {
struct usbmuxd_header header;
- struct usbmuxd_device device;
- char padding[222];
} __attribute__((__packed__));
-struct usbmuxd_scan_request {
- struct usbmuxd_header header;
+struct usbmuxd_device_record {
+ uint32_t device_id;
+ uint16_t product_id;
+ char serial_number[256];
+ uint16_t padding;
+ uint32_t location;
} __attribute__((__packed__));
-enum {
- USBMUXD_RESULT = 1,
- USBMUXD_CONNECT = 2,
- USBMUXD_SCAN = 3,
- USBMUXD_DEVICE_INFO = 4,
-};
-
#endif /* __USBMUXD_PROTO_H */