summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libiphone/libiphone.h44
1 files changed, 40 insertions, 4 deletions
diff --git a/include/libiphone/libiphone.h b/include/libiphone/libiphone.h
index 1451f15..77860f8 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;
46struct iphone_device_int; 45struct iphone_device_int;
47typedef struct iphone_device_int *iphone_device_t; 46typedef struct iphone_device_int *iphone_device_t;
48 47
48struct iphone_connection_int;
49typedef 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 */
55void iphone_set_debug_mask(uint16_t mask); 58void iphone_set_debug_mask(uint16_t mask);
56void iphone_set_debug_level(int level); 59void iphone_set_debug_level(int level);
57 60
58/* Interface */ 61/* discovery (events/asynchronous) */
59iphone_error_t iphone_get_device(iphone_device_t *device); 62// event type
60iphone_error_t iphone_get_device_by_uuid(iphone_device_t *device, const char *uuid); 63enum iphone_event_type {
64 IPHONE_DEVICE_ADD = 1,
65 IPHONE_DEVICE_REMOVE
66};
67
68// event data structure
69typedef 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
76typedef void (*iphone_event_cb_t) (const iphone_event_t *event, void *user_data);
77
78// functions
79iphone_error_t iphone_event_subscribe(iphone_event_cb_t callback, void *user_data);
80iphone_error_t iphone_event_unsubscribe();
81
82/* discovery (synchronous) */
83iphone_error_t iphone_get_device_list(char ***devices, int *count);
84iphone_error_t iphone_free_device_list(char **devices);
85
86/* device structure creation and destruction */
87iphone_error_t iphone_device_new(iphone_device_t *device, const char *uuid);
61iphone_error_t iphone_device_free(iphone_device_t device); 88iphone_error_t iphone_device_free(iphone_device_t device);
89
90/* connection/disconnection and communication */
91iphone_error_t iphone_device_connect(iphone_device_t device, uint16_t dst_port, iphone_connection_t *connection);
92iphone_error_t iphone_device_disconnect(iphone_connection_t connection);
93iphone_error_t iphone_device_send(iphone_connection_t connection, const char *data, uint32_t len, uint32_t *sent_bytes);
94iphone_error_t iphone_device_recv_timeout(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes, unsigned int timeout);
95iphone_error_t iphone_device_recv(iphone_connection_t connection, char *data, uint32_t len, uint32_t *recv_bytes);
96
97/* misc */
62iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle); 98iphone_error_t iphone_device_get_handle(iphone_device_t device, uint32_t *handle);
63iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid); 99iphone_error_t iphone_device_get_uuid(iphone_device_t device, char **uuid);
64 100