summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/libimobiledevice.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/libimobiledevice.h')
-rw-r--r--include/libimobiledevice/libimobiledevice.h56
1 files changed, 51 insertions, 5 deletions
diff --git a/include/libimobiledevice/libimobiledevice.h b/include/libimobiledevice/libimobiledevice.h
index 8f8589d..c1d5460 100644
--- a/include/libimobiledevice/libimobiledevice.h
+++ b/include/libimobiledevice/libimobiledevice.h
@@ -3,6 +3,7 @@
3 * @brief Device/Connection handling and communication 3 * @brief Device/Connection handling and communication
4 * \internal 4 * \internal
5 * 5 *
6 * Copyright (c) 2010-2019 Nikias Bassen All Rights Reserved.
6 * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved. 7 * Copyright (c) 2010-2014 Martin Szulecki All Rights Reserved.
7 * Copyright (c) 2014 Christophe Fergeau All Rights Reserved. 8 * Copyright (c) 2014 Christophe Fergeau All Rights Reserved.
8 * Copyright (c) 2008 Jonathan Beck All Rights Reserved. 9 * Copyright (c) 2008 Jonathan Beck All Rights Reserved.
@@ -51,6 +52,26 @@ typedef idevice_private *idevice_t; /**< The device handle. */
51typedef struct idevice_connection_private idevice_connection_private; 52typedef struct idevice_connection_private idevice_connection_private;
52typedef idevice_connection_private *idevice_connection_t; /**< The connection handle. */ 53typedef idevice_connection_private *idevice_connection_t; /**< The connection handle. */
53 54
55/** Options for idevice_new_with_options() */
56enum idevice_options {
57 IDEVICE_LOOKUP_USBMUX = 1 << 1, /**< include USBMUX devices during lookup */
58 IDEVICE_LOOKUP_NETWORK = 1 << 2, /**< include network devices during lookup */
59 IDEVICE_LOOKUP_PREFER_NETWORK = 1 << 3 /**< prefer network connection if device is available via USBMUX *and* network */
60};
61
62/** Type of connection a device is available on */
63enum idevice_connection_type {
64 CONNECTION_USBMUXD = 1,
65 CONNECTION_NETWORK
66};
67
68struct idevice_info {
69 char *udid;
70 enum idevice_connection_type conn_type;
71 void* conn_data;
72};
73typedef struct idevice_info* idevice_info_t;
74
54/* discovery (events/asynchronous) */ 75/* discovery (events/asynchronous) */
55/** The event type for device add or removal */ 76/** The event type for device add or removal */
56enum idevice_event_type { 77enum idevice_event_type {
@@ -64,7 +85,7 @@ enum idevice_event_type {
64typedef struct { 85typedef struct {
65 enum idevice_event_type event; /**< The event type. */ 86 enum idevice_event_type event; /**< The event type. */
66 const char *udid; /**< The device unique id. */ 87 const char *udid; /**< The device unique id. */
67 int conn_type; /**< The connection type. Currently only 1 for usbmuxd. */ 88 enum idevice_connection_type conn_type; /**< The connection type. */
68} idevice_event_t; 89} idevice_event_t;
69 90
70/* event callback function prototype */ 91/* event callback function prototype */
@@ -125,11 +146,15 @@ idevice_error_t idevice_device_list_free(char **devices);
125/* device structure creation and destruction */ 146/* device structure creation and destruction */
126 147
127/** 148/**
128 * Creates an idevice_t structure for the device specified by udid, 149 * Creates an idevice_t structure for the device specified by UDID,
129 * if the device is available. 150 * if the device is available (USBMUX devices only).
130 * 151 *
131 * @note The resulting idevice_t structure has to be freed with 152 * @note The resulting idevice_t structure has to be freed with
132 * idevice_free() if it is no longer used. 153 * idevice_free() if it is no longer used.
154 * If you need to connect to a device available via network, use
155 * idevice_new_with_options() and include IDEVICE_LOOKUP_NETWORK in options.
156 *
157 * @see idevice_new_with_options
133 * 158 *
134 * @param device Upon calling this function, a pointer to a location of type 159 * @param device Upon calling this function, a pointer to a location of type
135 * idevice_t. On successful return, this location will be populated. 160 * idevice_t. On successful return, this location will be populated.
@@ -140,9 +165,30 @@ idevice_error_t idevice_device_list_free(char **devices);
140idevice_error_t idevice_new(idevice_t *device, const char *udid); 165idevice_error_t idevice_new(idevice_t *device, const char *udid);
141 166
142/** 167/**
168 * Creates an idevice_t structure for the device specified by UDID,
169 * if the device is available, with the given lookup options.
170 *
171 * @note The resulting idevice_t structure has to be freed with
172 * idevice_free() if it is no longer used.
173 *
174 * @param device Upon calling this function, a pointer to a location of type
175 * idevice_t. On successful return, this location will be populated.
176 * @param udid The UDID to match.
177 * @param options Specifies what connection types should be considered
178 * when looking up devices. Accepts bitwise or'ed values of idevice_options.
179 * If 0 (no option) is specified it will default to IDEVICE_LOOKUP_USBMUX.
180 * To lookup both USB and network-connected devices, pass
181 * IDEVICE_LOOKUP_USBMUX | IDEVICE_LOOKUP_NETWORK. If a device is available
182 * both via USBMUX *and* network, it will select the USB connection.
183 * This behavior can be changed by adding IDEVICE_LOOKUP_PREFER_NETWORK
184 * to the options in which case it will select the network connection.
185 *
186 * @return IDEVICE_E_SUCCESS if ok, otherwise an error code.
187 */
188idevice_error_t idevice_new_with_options(idevice_t *device, const char *udid, enum idevice_options options);
189
190/**
143 * Cleans up an idevice structure, then frees the structure itself. 191 * Cleans up an idevice structure, then frees the structure itself.
144 * This is a library-level function; deals directly with the device to tear
145 * down relations, but otherwise is mostly internal.
146 * 192 *
147 * @param device idevice_t to free. 193 * @param device idevice_t to free.
148 */ 194 */