diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/libiphone/afc.h | 2 | ||||
| -rw-r--r-- | include/libiphone/libiphone.h | 44 |
2 files changed, 41 insertions, 5 deletions
diff --git a/include/libiphone/afc.h b/include/libiphone/afc.h index 77b6f0e..e913f91 100644 --- a/include/libiphone/afc.h +++ b/include/libiphone/afc.h | |||
| @@ -107,7 +107,7 @@ afc_error_t afc_truncate(afc_client_t client, const char *path, off_t newsize); | |||
| 107 | afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); | 107 | afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname); |
| 108 | 108 | ||
| 109 | /* Helper functions */ | 109 | /* Helper functions */ |
| 110 | char * afc_get_device_info_field(afc_client_t client, const char *field); | 110 | afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value); |
| 111 | 111 | ||
| 112 | #ifdef __cplusplus | 112 | #ifdef __cplusplus |
| 113 | } | 113 | } |
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h index 1451f15..6b95edc 100644 --- a/include/libiphone/libiphone.h +++ b/include/libiphone/libiphone.h | |||
| @@ -31,7 +31,6 @@ extern "C" { | |||
| 31 | #include <sys/types.h> | 31 | #include <sys/types.h> |
| 32 | #include <sys/stat.h> | 32 | #include <sys/stat.h> |
| 33 | #include <plist/plist.h> | 33 | #include <plist/plist.h> |
| 34 | #include <usbmuxd.h> | ||
| 35 | 34 | ||
| 36 | /* Error Codes */ | 35 | /* Error Codes */ |
| 37 | #define IPHONE_E_SUCCESS 0 | 36 | #define IPHONE_E_SUCCESS 0 |
| @@ -46,19 +45,56 @@ typedef int16_t iphone_error_t; | |||
| 46 | struct iphone_device_int; | 45 | struct iphone_device_int; |
| 47 | typedef struct iphone_device_int *iphone_device_t; | 46 | typedef struct iphone_device_int *iphone_device_t; |
| 48 | 47 | ||
| 48 | struct iphone_connection_int; | ||
| 49 | typedef struct iphone_connection_int *iphone_connection_t; | ||
| 50 | |||
| 49 | /* Debugging */ | 51 | /* Debugging */ |
| 50 | #define DBGMASK_ALL 0xFFFF | 52 | #define DBGMASK_ALL 0xFFFF |
| 51 | #define DBGMASK_NONE 0x0000 | 53 | #define DBGMASK_NONE 0x0000 |
| 52 | #define DBGMASK_LOCKDOWND (1 << 1) | 54 | #define DBGMASK_LOCKDOWND (1 << 1) |
| 53 | #define DBGMASK_MOBILESYNC (1 << 2) | 55 | #define DBGMASK_MOBILESYNC (1 << 2) |
| 54 | 56 | ||
| 57 | /* generic */ | ||
| 55 | void iphone_set_debug_mask(uint16_t mask); | 58 | void iphone_set_debug_mask(uint16_t mask); |
| 56 | void iphone_set_debug_level(int level); | 59 | void iphone_set_debug_level(int level); |
| 57 | 60 | ||
| 58 | /* Interface */ | 61 | /* discovery (events/asynchronous) */ |
| 59 | iphone_error_t iphone_get_device(iphone_device_t *device); | 62 | // event type |
| 60 | iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); | 63 | enum iphone_event_type { |
| 64 | IPHONE_DEVICE_ADD = 1, | ||
| 65 | IPHONE_DEVICE_REMOVE | ||
| 66 | }; | ||
| 67 | |||
| 68 | // event data structure | ||
| 69 | typedef struct { | ||
| 70 | enum iphone_event_type event; | ||
| 71 | const char *uuid; | ||
| 72 | int conn_type; | ||
| 73 | } iphone_event_t; | ||
| 74 | |||
| 75 | // event callback function prototype | ||
| 76 | typedef void (*iphone_event_cb_t) (const iphone_event_t *event, void *user_data); | ||
| 77 | |||
| 78 | // functions | ||
| 79 | iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data); | ||
| 80 | iphone_error_t iphone_event_unsubscribe(); | ||
| 81 | |||
| 82 | /* discovery (synchronous) */ | ||
| 83 | iphone_error_t iphone_get_device_list(char ***devices, int *count); | ||
| 84 | iphone_error_t iphone_device_list_free(char **devices); | ||
| 85 | |||
| 86 | /* device structure creation and destruction */ | ||
| 87 | iphone_error_t iphone_device_new(iphone_device_t *device, const char *uuid); | ||
| 61 | iphone_error_t iphone_device_free(iphone_device_t device); | 88 | iphone_error_t iphone_device_free(iphone_device_t device); |
| 89 | |||
| 90 | /* connection/disconnection and communication */ | ||
| 91 | iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t dst_port, iphone_connection_t *connection); | ||
| 92 | iphone_error_t iphone_device_disconnect(iphone_connection_t connection); | ||
| 93 | iphone_error_t iphone_device_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes); | ||
| 94 | iphone_error_t iphone_device_recv_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout); | ||
| 95 | iphone_error_t iphone_device_recv(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes); | ||
| 96 | |||
| 97 | /* misc */ | ||
| 62 | iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle); | 98 | iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle); |
| 63 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); | 99 | iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); |
| 64 | 100 | ||
