summaryrefslogtreecommitdiffstats
path: root/include/libimobiledevice/companion_proxy.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libimobiledevice/companion_proxy.h')
-rw-r--r--include/libimobiledevice/companion_proxy.h152
1 files changed, 76 insertions, 76 deletions
diff --git a/include/libimobiledevice/companion_proxy.h b/include/libimobiledevice/companion_proxy.h
index aaf7661..19c88eb 100644
--- a/include/libimobiledevice/companion_proxy.h
+++ b/include/libimobiledevice/companion_proxy.h
@@ -30,109 +30,109 @@ extern "C" {
30#include <libimobiledevice/libimobiledevice.h> 30#include <libimobiledevice/libimobiledevice.h>
31#include <libimobiledevice/lockdown.h> 31#include <libimobiledevice/lockdown.h>
32 32
33#define COMPPROXY_SERVICE_NAME "com.apple.companion_proxy" 33#define COMPANION_PROXY_SERVICE_NAME "com.apple.companion_proxy"
34 34
35/** Error Codes */ 35/** Error Codes */
36typedef enum { 36typedef enum {
37 COMPPROXY_E_SUCCESS = 0, 37 COMPANION_PROXY_E_SUCCESS = 0,
38 COMPPROXY_E_INVALID_ARG = -1, 38 COMPANION_PROXY_E_INVALID_ARG = -1,
39 COMPPROXY_E_PLIST_ERROR = -2, 39 COMPANION_PROXY_E_PLIST_ERROR = -2,
40 COMPPROXY_E_MUX_ERROR = -3, 40 COMPANION_PROXY_E_MUX_ERROR = -3,
41 COMPPROXY_E_SSL_ERROR = -4, 41 COMPANION_PROXY_E_SSL_ERROR = -4,
42 COMPPROXY_E_NOT_ENOUGH_DATA = -5, 42 COMPANION_PROXY_E_NOT_ENOUGH_DATA = -5,
43 COMPPROXY_E_TIMEOUT = -6, 43 COMPANION_PROXY_E_TIMEOUT = -6,
44 COMPPROXY_E_OP_IN_PROGRESS = -7, 44 COMPANION_PROXY_E_OP_IN_PROGRESS = -7,
45 COMPPROXY_E_NO_DEVICES = -100, 45 COMPANION_PROXY_E_NO_DEVICES = -100,
46 COMPPROXY_E_UNSUPPORTED_KEY = -101, 46 COMPANION_PROXY_E_UNSUPPORTED_KEY = -101,
47 COMPPROXY_E_TIMEOUT_REPLY = -102, 47 COMPANION_PROXY_E_TIMEOUT_REPLY = -102,
48 COMPPROXY_E_UNKNOWN_ERROR = -256 48 COMPANION_PROXY_E_UNKNOWN_ERROR = -256
49} compproxy_error_t; 49} companion_proxy_error_t;
50 50
51typedef struct compproxy_client_private compproxy_client_private; 51typedef struct companion_proxy_client_private companion_proxy_client_private;
52typedef compproxy_client_private *compproxy_client_t; /**< The client handle. */ 52typedef companion_proxy_client_private *companion_proxy_client_t; /**< The client handle. */
53 53
54typedef void (*compproxy_device_event_cb_t) (plist_t event, void* userdata); 54typedef void (*companion_proxy_device_event_cb_t) (plist_t event, void* userdata);
55 55
56/** 56/**
57 * Connects to the compproxy service on the specified device. 57 * Connects to the companion_proxy service on the specified device.
58 * 58 *
59 * @param device The device to connect to. 59 * @param device The device to connect to.
60 * @param service The service descriptor returned by lockdownd_start_service. 60 * @param service The service descriptor returned by lockdownd_start_service.
61 * @param client Pointer that will point to a newly allocated 61 * @param client Pointer that will point to a newly allocated
62 * compproxy_client_t upon successful return. Must be freed using 62 * companion_proxy_client_t upon successful return. Must be freed using
63 * compproxy_client_free() after use. 63 * companion_proxy_client_free() after use.
64 * 64 *
65 * @return COMPPROXY_E_SUCCESS on success, COMPPROXY_E_INVALID_ARG when 65 * @return COMPANION_PROXY_E_SUCCESS on success, COMPANION_PROXY_E_INVALID_ARG when
66 * the arguments are invalid, or an COMPPROXY_E_* error code otherwise. 66 * the arguments are invalid, or an COMPANION_PROXY_E_* error code otherwise.
67 */ 67 */
68compproxy_error_t compproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, compproxy_client_t* client); 68companion_proxy_error_t companion_proxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, companion_proxy_client_t* client);
69 69
70/** 70/**
71 * Starts a new compproxy service on the specified device and connects to it. 71 * Starts a new companion_proxy service on the specified device and connects to it.
72 * 72 *
73 * @param device The device to connect to. 73 * @param device The device to connect to.
74 * @param client Pointer that will point to a newly allocated 74 * @param client Pointer that will point to a newly allocated
75 * compproxy_client_t upon successful return. Must be freed using 75 * companion_proxy_client_t upon successful return. Must be freed using
76 * compproxy_client_free() after use. 76 * companion_proxy_client_free() after use.
77 * @param label The label to use for communication. Usually the program name. 77 * @param label The label to use for communication. Usually the program name.
78 * Pass NULL to disable sending the label in requests to lockdownd. 78 * Pass NULL to disable sending the label in requests to lockdownd.
79 * 79 *
80 * @return COMPPROXY_E_SUCCESS on success, or an COMPPROXY_E_* error 80 * @return COMPANION_PROXY_E_SUCCESS on success, or an COMPANION_PROXY_E_* error
81 * code otherwise. 81 * code otherwise.
82 */ 82 */
83compproxy_error_t compproxy_client_start_service(idevice_t device, compproxy_client_t* client, const char* label); 83companion_proxy_error_t companion_proxy_client_start_service(idevice_t device, companion_proxy_client_t* client, const char* label);
84 84
85/** 85/**
86 * Disconnects a compproxy client from the device and frees up the 86 * Disconnects a companion_proxy client from the device and frees up the
87 * compproxy client data. 87 * companion_proxy client data.
88 * 88 *
89 * @param client The compproxy client to disconnect and free. 89 * @param client The companion_proxy client to disconnect and free.
90 * 90 *
91 * @return COMPPROXY_E_SUCCESS on success, COMPPROXY_E_INVALID_ARG when 91 * @return COMPANION_PROXY_E_SUCCESS on success, COMPANION_PROXY_E_INVALID_ARG when
92 * client is NULL, or an COMPPROXY_E_* error code otherwise. 92 * client is NULL, or an COMPANION_PROXY_E_* error code otherwise.
93 */ 93 */
94compproxy_error_t compproxy_client_free(compproxy_client_t client); 94companion_proxy_error_t companion_proxy_client_free(companion_proxy_client_t client);
95 95
96/** 96/**
97 * Sends a plist to the service. 97 * Sends a plist to the service.
98 * 98 *
99 * @param client The compproxy client 99 * @param client The companion_proxy client
100 * @param plist The plist to send 100 * @param plist The plist to send
101 * 101 *
102 * @return COMPPROXY_E_SUCCESS on success, 102 * @return COMPANION_PROXY_E_SUCCESS on success,
103 * COMPPROXY_E_INVALID_ARG when client or plist is NULL 103 * COMPANION_PROXY_E_INVALID_ARG when client or plist is NULL
104 */ 104 */
105compproxy_error_t compproxy_send(compproxy_client_t client, plist_t plist); 105companion_proxy_error_t companion_proxy_send(companion_proxy_client_t client, plist_t plist);
106 106
107/** 107/**
108 * Receives a plist from the service. 108 * Receives a plist from the service.
109 * 109 *
110 * @param client The compproxy client 110 * @param client The companion_proxy client
111 * @param plist The plist to store the received data 111 * @param plist The plist to store the received data
112 * 112 *
113 * @return COMPPROXY_E_SUCCESS on success, 113 * @return COMPANION_PROXY_E_SUCCESS on success,
114 * COMPPROXY_E_INVALID_ARG when client or plist is NULL 114 * COMPANION_PROXY_E_INVALID_ARG when client or plist is NULL
115 */ 115 */
116compproxy_error_t compproxy_receive(compproxy_client_t client, plist_t * plist); 116companion_proxy_error_t companion_proxy_receive(companion_proxy_client_t client, plist_t * plist);
117 117
118/** 118/**
119 * Retrieves a list of paired devices. 119 * Retrieves a list of paired devices.
120 * 120 *
121 * @param client The compproxy client 121 * @param client The companion_proxy client
122 * @param devices Point that will receive a PLIST_ARRAY with paired device UDIDs 122 * @param devices Point that will receive a PLIST_ARRAY with paired device UDIDs
123 * 123 *
124 * @note The device closes the connection after sending the reply. 124 * @note The device closes the connection after sending the reply.
125 * 125 *
126 * @return COMPPROXY_E_SUCCESS on success, 126 * @return COMPANION_PROXY_E_SUCCESS on success,
127 * COMPPROXY_E_NO_DEVICES if no devices are paired, 127 * COMPANION_PROXY_E_NO_DEVICES if no devices are paired,
128 * or a COMPPROXY_E_* error code otherwise. 128 * or a COMPANION_PROXY_E_* error code otherwise.
129 */ 129 */
130compproxy_error_t compproxy_get_device_registry(compproxy_client_t client, plist_t* paired_devices); 130companion_proxy_error_t companion_proxy_get_device_registry(companion_proxy_client_t client, plist_t* paired_devices);
131 131
132/** 132/**
133 * Starts listening for paired devices. 133 * Starts listening for paired devices.
134 * 134 *
135 * @param client The compproxy client 135 * @param client The companion_proxy client
136 * @param callback Callback function that will be called when a new device is detected 136 * @param callback Callback function that will be called when a new device is detected
137 * @param userdata Pointer that that will be passed to the callback function 137 * @param userdata Pointer that that will be passed to the callback function
138 * 138 *
@@ -140,66 +140,66 @@ compproxy_error_t compproxy_get_device_registry(compproxy_client_t client, plist
140 * freed internally after returning from the callback. The consumer needs 140 * freed internally after returning from the callback. The consumer needs
141 * to make a copy if required. 141 * to make a copy if required.
142 * 142 *
143 * @return COMPPROXY_E_SUCCESS on success, 143 * @return COMPANION_PROXY_E_SUCCESS on success,
144 * or a COMPPROXY_E_* error code otherwise. 144 * or a COMPANION_PROXY_E_* error code otherwise.
145 */ 145 */
146compproxy_error_t compproxy_start_listening_for_devices(compproxy_client_t client, compproxy_device_event_cb_t callback, void* userdata); 146companion_proxy_error_t companion_proxy_start_listening_for_devices(companion_proxy_client_t client, companion_proxy_device_event_cb_t callback, void* userdata);
147 147
148/** 148/**
149 * Stops listening for paired devices 149 * Stops listening for paired devices
150 * 150 *
151 * @param client The compproxy client 151 * @param client The companion_proxy client
152 * 152 *
153 * @return COMPPROXY_E_SUCCESS on success, 153 * @return COMPANION_PROXY_E_SUCCESS on success,
154 * or a COMPPROXY_E_* error code otherwise. 154 * or a COMPANION_PROXY_E_* error code otherwise.
155 */ 155 */
156compproxy_error_t compproxy_stop_listening_for_devices(compproxy_client_t client); 156companion_proxy_error_t companion_proxy_stop_listening_for_devices(companion_proxy_client_t client);
157 157
158/** 158/**
159 * Returns a value for the given key. 159 * Returns a value for the given key.
160 * 160 *
161 * @param client The compproxy client 161 * @param client The companion_proxy client
162 * @param companion_udid UDID of the (paired) watch 162 * @param companion_udid UDID of the (paired) companion device
163 * @param key The key to retrieve the value for 163 * @param key The key to retrieve the value for
164 * 164 *
165 * @note The device closes the connection after sending the reply. 165 * @note The device closes the connection after sending the reply.
166 * 166 *
167 * @return COMPPROXY_E_SUCCESS on success, 167 * @return COMPANION_PROXY_E_SUCCESS on success,
168 * COMPPROXY_E_INVALID_ARG when client or paired_devices is invalid, 168 * COMPANION_PROXY_E_INVALID_ARG when client or paired_devices is invalid,
169 * COMPPROXY_E_UNSUPPORTED_KEY if the watch doesn't support the given key, 169 * COMPANION_PROXY_E_UNSUPPORTED_KEY if the companion device doesn't support the given key,
170 * or a COMPPROXY_E_* error code otherwise. 170 * or a COMPANION_PROXY_E_* error code otherwise.
171 */ 171 */
172compproxy_error_t compproxy_get_value_from_registry(compproxy_client_t client, const char* companion_udid, const char* key, plist_t* value); 172companion_proxy_error_t companion_proxy_get_value_from_registry(companion_proxy_client_t client, const char* companion_udid, const char* key, plist_t* value);
173 173
174/** 174/**
175 * Start forwarding a service port on the watch to a port on the idevice. 175 * Start forwarding a service port on the companion device to a port on the idevice.
176 * 176 *
177 * @see compproxy_stop_forwarding_service_port 177 * @see companion_proxy_stop_forwarding_service_port
178 * 178 *
179 * @param client The compproxy client 179 * @param client The companion_proxy client
180 * @param remote_port remote port 180 * @param remote_port remote port
181 * @param service_name The name of the service that shall be forwarded 181 * @param service_name The name of the service that shall be forwarded
182 * @param forward_port Pointer that will receive the newly-assigned port accessible via USB/Network on the idevice 182 * @param forward_port Pointer that will receive the newly-assigned port accessible via USB/Network on the idevice
183 * @param options PLIST_DICT with additional options. Currently known are 183 * @param options PLIST_DICT with additional options. Currently known are
184 * IsServiceLowPriority (boolean) and PreferWifi (boolean). 184 * IsServiceLowPriority (boolean) and PreferWifi (boolean).
185 * 185 *
186 * @return COMPPROXY_E_SUCCESS on success, 186 * @return COMPANION_PROXY_E_SUCCESS on success,
187 * or a COMPPROXY_E_* error code otherwise. 187 * or a COMPANION_PROXY_E_* error code otherwise.
188 */ 188 */
189compproxy_error_t compproxy_start_forwarding_service_port(compproxy_client_t client, uint16_t remote_port, const char* service_name, uint16_t* forward_port, plist_t options); 189companion_proxy_error_t companion_proxy_start_forwarding_service_port(companion_proxy_client_t client, uint16_t remote_port, const char* service_name, uint16_t* forward_port, plist_t options);
190 190
191/** 191/**
192 * Stop forwarding a service port between watch and idevice. 192 * Stop forwarding a service port between companion device and idevice.
193 * 193 *
194 * @see compproxy_start_forwarding_service_port 194 * @see companion_proxy_start_forwarding_service_port
195 * 195 *
196 * @param client The compproxy client 196 * @param client The companion_proxy client
197 * @param remote_port remote port 197 * @param remote_port remote port
198 * 198 *
199 * @return COMPPROXY_E_SUCCESS on success, 199 * @return COMPANION_PROXY_E_SUCCESS on success,
200 * or a COMPPROXY_E_* error code otherwise. 200 * or a COMPANION_PROXY_E_* error code otherwise.
201 */ 201 */
202compproxy_error_t compproxy_stop_forwarding_service_port(compproxy_client_t client, uint16_t remote_port); 202companion_proxy_error_t companion_proxy_stop_forwarding_service_port(companion_proxy_client_t client, uint16_t remote_port);
203 203
204#ifdef __cplusplus 204#ifdef __cplusplus
205} 205}