diff options
| author | 2009-04-30 05:52:10 +0200 | |
|---|---|---|
| committer | 2009-04-30 05:52:10 +0200 | |
| commit | 49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6 (patch) | |
| tree | d42281bbc3b17af0f92daa5d35429f46bdd2130f /client.h | |
| parent | 53fb582e7729d5b7ed40ff04d912fcf5add7ce1c (diff) | |
| download | usbmuxd-49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6.tar.gz usbmuxd-49a8ef4fcbc8e76ca0f484e6b2d2d9eea70596b6.tar.bz2 | |
too much stuff and it WORKS
Diffstat (limited to 'client.h')
| -rw-r--r-- | client.h | 69 |
1 files changed, 67 insertions, 2 deletions
| @@ -21,7 +21,72 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |||
| 21 | #ifndef __CLIENT_H__ | 21 | #ifndef __CLIENT_H__ |
| 22 | #define __CLIENT_H__ | 22 | #define __CLIENT_H__ |
| 23 | 23 | ||
| 24 | #endif | 24 | #include <stdint.h> |
| 25 | |||
| 26 | struct device_info; | ||
| 27 | struct mux_client; | ||
| 28 | |||
| 29 | enum client_result { | ||
| 30 | RESULT_OK = 0, | ||
| 31 | RESULT_BADCOMMAND = 1, | ||
| 32 | RESULT_BADDEV = 2, | ||
| 33 | RESULT_CONNREFUSED = 3, | ||
| 34 | // ??? | ||
| 35 | // ??? | ||
| 36 | RESULT_BADVERSION = 6, | ||
| 37 | }; | ||
| 38 | |||
| 39 | enum client_msgtype { | ||
| 40 | MESSAGE_RESULT = 1, | ||
| 41 | MESSAGE_CONNECT = 2, | ||
| 42 | MESSAGE_LISTEN = 3, | ||
| 43 | MESSAGE_DEVICE_ADD = 4, | ||
| 44 | MESSAGE_DEVICE_REMOVE = 5, | ||
| 45 | //??? | ||
| 46 | //??? | ||
| 47 | //MESSAGE_PLIST = 8, | ||
| 48 | }; | ||
| 49 | |||
| 50 | #define CLIENT_PROTOCOL_VERSION 0 | ||
| 51 | |||
| 52 | struct client_header { | ||
| 53 | uint32_t length; | ||
| 54 | uint32_t version; | ||
| 55 | uint32_t message; | ||
| 56 | uint32_t tag; | ||
| 57 | }; | ||
| 58 | |||
| 59 | struct client_msg_result { | ||
| 60 | uint32_t result; | ||
| 61 | }; | ||
| 25 | 62 | ||
| 26 | void client_accept(int fd); | 63 | struct client_msg_connect { |
| 64 | uint32_t device_id; | ||
| 65 | uint16_t port; | ||
| 66 | }; | ||
| 67 | |||
| 68 | struct client_msg_dev { | ||
| 69 | uint32_t device_id; | ||
| 70 | uint16_t device_pid; | ||
| 71 | char device_serial[256]; | ||
| 72 | uint16_t padding; | ||
| 73 | uint32_t location; | ||
| 74 | }; | ||
| 75 | |||
| 76 | int client_read(struct mux_client *client, void *buffer, int len); | ||
| 77 | int client_write(struct mux_client *client, void *buffer, int len); | ||
| 78 | int client_set_events(struct mux_client *client, short events); | ||
| 79 | void client_close(struct mux_client *client); | ||
| 80 | int client_notify_connect(struct mux_client *client, enum client_result result); | ||
| 81 | |||
| 82 | void client_device_add(struct device_info *dev); | ||
| 83 | void client_device_remove(int device_id); | ||
| 84 | |||
| 85 | int client_accept(int fd); | ||
| 27 | void client_get_fds(struct fdlist *list); | 86 | void client_get_fds(struct fdlist *list); |
| 87 | void client_process(int fd, short events); | ||
| 88 | |||
| 89 | void client_init(void); | ||
| 90 | void client_shutdown(void); | ||
| 91 | |||
| 92 | #endif | ||
