diff options
Diffstat (limited to 'cython')
| -rw-r--r-- | cython/afc.pxi | 6 | ||||
| -rw-r--r-- | cython/file_relay.pxi | 6 | ||||
| -rw-r--r-- | cython/imobiledevice.pxd | 11 | ||||
| -rw-r--r-- | cython/imobiledevice.pyx | 4 | ||||
| -rw-r--r-- | cython/installation_proxy.pxi | 6 | ||||
| -rw-r--r-- | cython/lockdown.pxi | 39 | ||||
| -rw-r--r-- | cython/mobile_image_mounter.pxi | 6 | ||||
| -rw-r--r-- | cython/mobilebackup.pxi | 65 | ||||
| -rw-r--r-- | cython/mobilesync.pxi | 13 | ||||
| -rw-r--r-- | cython/notification_proxy.pxi | 6 | ||||
| -rw-r--r-- | cython/sbservices.pxi | 16 | ||||
| -rw-r--r-- | cython/screenshotr.pxi | 6 |
12 files changed, 137 insertions, 47 deletions
diff --git a/cython/afc.pxi b/cython/afc.pxi index 0383471..2608ee6 100644 --- a/cython/afc.pxi +++ b/cython/afc.pxi | |||
| @@ -46,7 +46,7 @@ cdef extern from "libimobiledevice/afc.h": | |||
| 46 | AFC_LOCK_EX = 2 | 4 | 46 | AFC_LOCK_EX = 2 | 4 |
| 47 | AFC_LOCK_UN = 8 | 4 | 47 | AFC_LOCK_UN = 8 | 4 |
| 48 | 48 | ||
| 49 | afc_error_t afc_client_new(idevice_t device, uint16_t port, afc_client_t *client) | 49 | afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, afc_client_t *client) |
| 50 | afc_error_t afc_client_free(afc_client_t client) | 50 | afc_error_t afc_client_free(afc_client_t client) |
| 51 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos) | 51 | afc_error_t afc_get_device_info(afc_client_t client, char ***infos) |
| 52 | afc_error_t afc_read_directory(afc_client_t client, char *dir, char ***list) | 52 | afc_error_t afc_read_directory(afc_client_t client, char *dir, char ***list) |
| @@ -153,8 +153,8 @@ cdef class AfcClient(BaseService): | |||
| 153 | __service_name__ = "com.apple.afc" | 153 | __service_name__ = "com.apple.afc" |
| 154 | cdef afc_client_t _c_client | 154 | cdef afc_client_t _c_client |
| 155 | 155 | ||
| 156 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 156 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 157 | self.handle_error(afc_client_new(device._c_dev, port, &(self._c_client))) | 157 | self.handle_error(afc_client_new(device._c_dev, descriptor._c_service_descriptor, &(self._c_client))) |
| 158 | 158 | ||
| 159 | def __dealloc__(self): | 159 | def __dealloc__(self): |
| 160 | cdef afc_error_t err | 160 | cdef afc_error_t err |
diff --git a/cython/file_relay.pxi b/cython/file_relay.pxi index 450b030..ec4942e 100644 --- a/cython/file_relay.pxi +++ b/cython/file_relay.pxi | |||
| @@ -13,7 +13,7 @@ cdef extern from "libimobiledevice/file_relay.h": | |||
| 13 | FILE_RELAY_E_STAGING_EMPTY = -5 | 13 | FILE_RELAY_E_STAGING_EMPTY = -5 |
| 14 | FILE_RELAY_E_UNKNOWN_ERROR = -256 | 14 | FILE_RELAY_E_UNKNOWN_ERROR = -256 |
| 15 | 15 | ||
| 16 | file_relay_error_t file_relay_client_new(idevice_t device, uint16_t port, file_relay_client_t *client) | 16 | file_relay_error_t file_relay_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, file_relay_client_t *client) |
| 17 | file_relay_error_t file_relay_client_free(file_relay_client_t client) | 17 | file_relay_error_t file_relay_client_free(file_relay_client_t client) |
| 18 | 18 | ||
| 19 | file_relay_error_t file_relay_request_sources(file_relay_client_t client, const_sources_t sources, idevice_connection_t *connection) | 19 | file_relay_error_t file_relay_request_sources(file_relay_client_t client, const_sources_t sources, idevice_connection_t *connection) |
| @@ -37,8 +37,8 @@ cdef class FileRelayClient(PropertyListService): | |||
| 37 | __service_name__ = "com.apple.mobile.file_relay" | 37 | __service_name__ = "com.apple.mobile.file_relay" |
| 38 | cdef file_relay_client_t _c_client | 38 | cdef file_relay_client_t _c_client |
| 39 | 39 | ||
| 40 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 40 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 41 | self.handle_error(file_relay_client_new(device._c_dev, port, &self._c_client)) | 41 | self.handle_error(file_relay_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client)) |
| 42 | 42 | ||
| 43 | def __dealloc__(self): | 43 | def __dealloc__(self): |
| 44 | cdef file_relay_error_t err | 44 | cdef file_relay_error_t err |
diff --git a/cython/imobiledevice.pxd b/cython/imobiledevice.pxd index a614124..94c3f01 100644 --- a/cython/imobiledevice.pxd +++ b/cython/imobiledevice.pxd | |||
| @@ -12,7 +12,7 @@ cdef class BaseError(Exception): | |||
| 12 | 12 | ||
| 13 | cdef class Base: | 13 | cdef class Base: |
| 14 | cdef inline int handle_error(self, int16_t ret) except -1 | 14 | cdef inline int handle_error(self, int16_t ret) except -1 |
| 15 | cdef inline BaseError _error(self, int16_t ret) | 15 | cdef BaseError _error(self, int16_t ret) |
| 16 | 16 | ||
| 17 | cdef class iDeviceError(BaseError): pass | 17 | cdef class iDeviceError(BaseError): pass |
| 18 | 18 | ||
| @@ -66,12 +66,19 @@ cdef extern from "libimobiledevice/lockdown.h": | |||
| 66 | char *host_id | 66 | char *host_id |
| 67 | char *root_certificate | 67 | char *root_certificate |
| 68 | ctypedef lockdownd_pair_record *lockdownd_pair_record_t | 68 | ctypedef lockdownd_pair_record *lockdownd_pair_record_t |
| 69 | cdef struct lockdownd_service_descriptor: | ||
| 70 | uint16_t port | ||
| 71 | uint8_t ssl_enabled | ||
| 72 | ctypedef lockdownd_service_descriptor *lockdownd_service_descriptor_t | ||
| 69 | 73 | ||
| 70 | cdef class LockdownError(BaseError): pass | 74 | cdef class LockdownError(BaseError): pass |
| 71 | 75 | ||
| 72 | cdef class LockdownPairRecord: | 76 | cdef class LockdownPairRecord: |
| 73 | cdef lockdownd_pair_record_t _c_record | 77 | cdef lockdownd_pair_record_t _c_record |
| 74 | 78 | ||
| 79 | cdef class LockdownServiceDescriptor: | ||
| 80 | cdef lockdownd_service_descriptor_t _c_service_descriptor | ||
| 81 | |||
| 75 | cdef class LockdownClient(PropertyListService): | 82 | cdef class LockdownClient(PropertyListService): |
| 76 | cdef lockdownd_client_t _c_client | 83 | cdef lockdownd_client_t _c_client |
| 77 | cdef readonly iDevice device | 84 | cdef readonly iDevice device |
| @@ -80,7 +87,7 @@ cdef class LockdownClient(PropertyListService): | |||
| 80 | cpdef plist.Node get_value(self, bytes domain=*, bytes key=*) | 87 | cpdef plist.Node get_value(self, bytes domain=*, bytes key=*) |
| 81 | cpdef set_value(self, bytes domain, bytes key, object value) | 88 | cpdef set_value(self, bytes domain, bytes key, object value) |
| 82 | cpdef remove_value(self, bytes domain, bytes key) | 89 | cpdef remove_value(self, bytes domain, bytes key) |
| 83 | cpdef uint16_t start_service(self, object service) | 90 | cpdef object start_service(self, object service) |
| 84 | cpdef object get_service_client(self, object service_class) | 91 | cpdef object get_service_client(self, object service_class) |
| 85 | cpdef tuple start_session(self, bytes host_id) | 92 | cpdef tuple start_session(self, bytes host_id) |
| 86 | cpdef stop_session(self, bytes session_id) | 93 | cpdef stop_session(self, bytes session_id) |
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx index cdb9978..de59456 100644 --- a/cython/imobiledevice.pyx +++ b/cython/imobiledevice.pyx | |||
| @@ -130,7 +130,7 @@ cdef class iDeviceConnection(Base): | |||
| 130 | err = idevice_disconnect(self._c_connection) | 130 | err = idevice_disconnect(self._c_connection) |
| 131 | self.handle_error(err) | 131 | self.handle_error(err) |
| 132 | 132 | ||
| 133 | cdef inline BaseError _error(self, int16_t ret): | 133 | cdef BaseError _error(self, int16_t ret): |
| 134 | return iDeviceError(ret) | 134 | return iDeviceError(ret) |
| 135 | 135 | ||
| 136 | from libc.stdlib cimport * | 136 | from libc.stdlib cimport * |
| @@ -148,7 +148,7 @@ cdef class iDevice(Base): | |||
| 148 | if self._c_dev is not NULL: | 148 | if self._c_dev is not NULL: |
| 149 | self.handle_error(idevice_free(self._c_dev)) | 149 | self.handle_error(idevice_free(self._c_dev)) |
| 150 | 150 | ||
| 151 | cdef inline BaseError _error(self, int16_t ret): | 151 | cdef BaseError _error(self, int16_t ret): |
| 152 | return iDeviceError(ret) | 152 | return iDeviceError(ret) |
| 153 | 153 | ||
| 154 | cpdef iDeviceConnection connect(self, uint16_t port): | 154 | cpdef iDeviceConnection connect(self, uint16_t port): |
diff --git a/cython/installation_proxy.pxi b/cython/installation_proxy.pxi index 3dfb0b1..ff541df 100644 --- a/cython/installation_proxy.pxi +++ b/cython/installation_proxy.pxi | |||
| @@ -13,7 +13,7 @@ cdef extern from "libimobiledevice/installation_proxy.h": | |||
| 13 | INSTPROXY_E_OP_FAILED = -5 | 13 | INSTPROXY_E_OP_FAILED = -5 |
| 14 | INSTPROXY_E_UNKNOWN_ERROR = -256 | 14 | INSTPROXY_E_UNKNOWN_ERROR = -256 |
| 15 | 15 | ||
| 16 | instproxy_error_t instproxy_client_new(idevice_t device, uint16_t port, instproxy_client_t *client) | 16 | instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, instproxy_client_t *client) |
| 17 | instproxy_error_t instproxy_client_free(instproxy_client_t client) | 17 | instproxy_error_t instproxy_client_free(instproxy_client_t client) |
| 18 | 18 | ||
| 19 | instproxy_error_t instproxy_browse(instproxy_client_t client, plist.plist_t client_options, plist.plist_t *result) | 19 | instproxy_error_t instproxy_browse(instproxy_client_t client, plist.plist_t client_options, plist.plist_t *result) |
| @@ -46,11 +46,11 @@ cdef class InstallationProxyClient(PropertyListService): | |||
| 46 | __service_name__ = "com.apple.mobile.installation_proxy" | 46 | __service_name__ = "com.apple.mobile.installation_proxy" |
| 47 | cdef instproxy_client_t _c_client | 47 | cdef instproxy_client_t _c_client |
| 48 | 48 | ||
| 49 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 49 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 50 | cdef: | 50 | cdef: |
| 51 | iDevice dev = device | 51 | iDevice dev = device |
| 52 | instproxy_error_t err | 52 | instproxy_error_t err |
| 53 | err = instproxy_client_new(dev._c_dev, port, &self._c_client) | 53 | err = instproxy_client_new(dev._c_dev, descriptor._c_service_descriptor, &self._c_client) |
| 54 | self.handle_error(err) | 54 | self.handle_error(err) |
| 55 | 55 | ||
| 56 | def __dealloc__(self): | 56 | def __dealloc__(self): |
diff --git a/cython/lockdown.pxi b/cython/lockdown.pxi index b5207e8..6fbe0e6 100644 --- a/cython/lockdown.pxi +++ b/cython/lockdown.pxi | |||
| @@ -29,7 +29,7 @@ cdef extern from "libimobiledevice/lockdown.h": | |||
| 29 | lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t *value) | 29 | lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t *value) |
| 30 | lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t value) | 30 | lockdownd_error_t lockdownd_set_value(lockdownd_client_t client, char *domain, char *key, plist.plist_t value) |
| 31 | lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, char *domain, char *key) | 31 | lockdownd_error_t lockdownd_remove_value(lockdownd_client_t client, char *domain, char *key) |
| 32 | lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, char *service, uint16_t *port) | 32 | lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, char *identifier, lockdownd_service_descriptor_t *service) |
| 33 | lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, char *host_id, char **session_id, int *ssl_enabled) | 33 | lockdownd_error_t lockdownd_start_session(lockdownd_client_t client, char *host_id, char **session_id, int *ssl_enabled) |
| 34 | lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, char *session_id) | 34 | lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, char *session_id) |
| 35 | lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist.plist_t plist) | 35 | lockdownd_error_t lockdownd_send(lockdownd_client_t client, plist.plist_t plist) |
| @@ -43,6 +43,7 @@ cdef extern from "libimobiledevice/lockdown.h": | |||
| 43 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) | 43 | lockdownd_error_t lockdownd_goodbye(lockdownd_client_t client) |
| 44 | lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count) | 44 | lockdownd_error_t lockdownd_get_sync_data_classes(lockdownd_client_t client, char ***classes, int *count) |
| 45 | lockdownd_error_t lockdownd_data_classes_free(char **classes) | 45 | lockdownd_error_t lockdownd_data_classes_free(char **classes) |
| 46 | lockdownd_error_t lockdownd_service_descriptor_free(lockdownd_service_descriptor_t service) | ||
| 46 | 47 | ||
| 47 | cdef class LockdownError(BaseError): | 48 | cdef class LockdownError(BaseError): |
| 48 | def __init__(self, *args, **kwargs): | 49 | def __init__(self, *args, **kwargs): |
| @@ -89,6 +90,21 @@ cdef class LockdownPairRecord: | |||
| 89 | cdef bytes result = self._c_record.root_certificate | 90 | cdef bytes result = self._c_record.root_certificate |
| 90 | return result | 91 | return result |
| 91 | 92 | ||
| 93 | cdef class LockdownServiceDescriptor: | ||
| 94 | #def __cinit__(self, uint16_t port, uint8_t ssl_enabled, *args, **kwargs): | ||
| 95 | def __dealloc__(self): | ||
| 96 | cdef lockdownd_error_t err | ||
| 97 | if self._c_service_descriptor is not NULL: | ||
| 98 | err = lockdownd_service_descriptor_free(self._c_service_descriptor) | ||
| 99 | self._c_service_descriptor = NULL | ||
| 100 | self.handle_error(err) | ||
| 101 | property port: | ||
| 102 | def __get__(self): | ||
| 103 | return self._c_service_descriptor.port | ||
| 104 | property ssl_enabled: | ||
| 105 | def __get__(self): | ||
| 106 | return self._c_service_descriptor.ssl_enabled | ||
| 107 | |||
| 92 | cdef class LockdownClient(PropertyListService): | 108 | cdef class LockdownClient(PropertyListService): |
| 93 | def __cinit__(self, iDevice device not None, bytes label=b'', bint handshake=True, *args, **kwargs): | 109 | def __cinit__(self, iDevice device not None, bytes label=b'', bint handshake=True, *args, **kwargs): |
| 94 | cdef: | 110 | cdef: |
| @@ -162,10 +178,11 @@ cdef class LockdownClient(PropertyListService): | |||
| 162 | cpdef remove_value(self, bytes domain, bytes key): | 178 | cpdef remove_value(self, bytes domain, bytes key): |
| 163 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) | 179 | self.handle_error(lockdownd_remove_value(self._c_client, domain, key)) |
| 164 | 180 | ||
| 165 | cpdef uint16_t start_service(self, object service): | 181 | cpdef object start_service(self, object service): |
| 166 | cdef: | 182 | cdef: |
| 167 | char* c_service_name = NULL | 183 | char* c_service_name = NULL |
| 168 | uint16_t port = 0 | 184 | lockdownd_service_descriptor_t c_descriptor = NULL |
| 185 | LockdownServiceDescriptor result | ||
| 169 | 186 | ||
| 170 | if issubclass(service, BaseService) and \ | 187 | if issubclass(service, BaseService) and \ |
| 171 | service.__service_name__ is not None \ | 188 | service.__service_name__ is not None \ |
| @@ -177,24 +194,26 @@ cdef class LockdownClient(PropertyListService): | |||
| 177 | raise TypeError("LockdownClient.start_service() takes a BaseService or string as its first argument") | 194 | raise TypeError("LockdownClient.start_service() takes a BaseService or string as its first argument") |
| 178 | 195 | ||
| 179 | try: | 196 | try: |
| 180 | self.handle_error(lockdownd_start_service(self._c_client, c_service_name, &port)) | 197 | self.handle_error(lockdownd_start_service(self._c_client, c_service_name, &c_descriptor)) |
| 181 | 198 | ||
| 182 | return port | 199 | result = LockdownServiceDescriptor.__new__(LockdownServiceDescriptor) |
| 200 | result._c_service_descriptor = c_descriptor | ||
| 201 | |||
| 202 | return result | ||
| 183 | except BaseError, e: | 203 | except BaseError, e: |
| 184 | raise | 204 | raise |
| 185 | 205 | ||
| 186 | cpdef object get_service_client(self, object service_class): | 206 | cpdef object get_service_client(self, object service_class): |
| 187 | cdef: | 207 | cdef: |
| 188 | uint16_t port = 0 | 208 | LockdownServiceDescriptor descriptor |
| 189 | object result | ||
| 190 | 209 | ||
| 191 | if not hasattr(service_class, '__service_name__') and \ | 210 | if not hasattr(service_class, '__service_name__') and \ |
| 192 | not service_class.__service_name__ is not None \ | 211 | not service_class.__service_name__ is not None \ |
| 193 | and not isinstance(service_class.__service_name__, basestring): | 212 | and not isinstance(service_class.__service_name__, basestring): |
| 194 | raise TypeError("LockdownClient.get_service_client() takes a BaseService as its first argument") | 213 | raise TypeError("LockdownClient.get_service_client() takes a BaseService as its first argument") |
| 195 | 214 | ||
| 196 | port = self.start_service(service_class) | 215 | descriptor = self.start_service(service_class) |
| 197 | return service_class(self.device, port) | 216 | return service_class(self.device, descriptor) |
| 198 | 217 | ||
| 199 | cpdef tuple start_session(self, bytes host_id): | 218 | cpdef tuple start_session(self, bytes host_id): |
| 200 | cdef: | 219 | cdef: |
diff --git a/cython/mobile_image_mounter.pxi b/cython/mobile_image_mounter.pxi index bf304d4..a23a59b 100644 --- a/cython/mobile_image_mounter.pxi +++ b/cython/mobile_image_mounter.pxi | |||
| @@ -10,7 +10,7 @@ cdef extern from "libimobiledevice/mobile_image_mounter.h": | |||
| 10 | MOBILE_IMAGE_MOUNTER_E_CONN_FAILED = -3 | 10 | MOBILE_IMAGE_MOUNTER_E_CONN_FAILED = -3 |
| 11 | MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR = -256 | 11 | MOBILE_IMAGE_MOUNTER_E_UNKNOWN_ERROR = -256 |
| 12 | 12 | ||
| 13 | mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, uint16_t port, mobile_image_mounter_client_t *client) | 13 | mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t descriptor, mobile_image_mounter_client_t *client) |
| 14 | mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client) | 14 | mobile_image_mounter_error_t mobile_image_mounter_free(mobile_image_mounter_client_t client) |
| 15 | mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, char *image_type, plist.plist_t *result) | 15 | mobile_image_mounter_error_t mobile_image_mounter_lookup_image(mobile_image_mounter_client_t client, char *image_type, plist.plist_t *result) |
| 16 | mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, char *image_path, char *image_signature, uint16_t signature_length, char *image_type, plist.plist_t *result) | 16 | mobile_image_mounter_error_t mobile_image_mounter_mount_image(mobile_image_mounter_client_t client, char *image_path, char *image_signature, uint16_t signature_length, char *image_type, plist.plist_t *result) |
| @@ -31,8 +31,8 @@ cdef class MobileImageMounterClient(PropertyListService): | |||
| 31 | __service_name__ = "com.apple.mobile.mobile_image_mounter" | 31 | __service_name__ = "com.apple.mobile.mobile_image_mounter" |
| 32 | cdef mobile_image_mounter_client_t _c_client | 32 | cdef mobile_image_mounter_client_t _c_client |
| 33 | 33 | ||
| 34 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 34 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 35 | self.handle_error(mobile_image_mounter_new(device._c_dev, port, &self._c_client)) | 35 | self.handle_error(mobile_image_mounter_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client)) |
| 36 | 36 | ||
| 37 | def __dealloc__(self): | 37 | def __dealloc__(self): |
| 38 | cdef mobile_image_mounter_error_t err | 38 | cdef mobile_image_mounter_error_t err |
diff --git a/cython/mobilebackup.pxi b/cython/mobilebackup.pxi index 4f07683..5a6fea6 100644 --- a/cython/mobilebackup.pxi +++ b/cython/mobilebackup.pxi | |||
| @@ -9,12 +9,25 @@ cdef extern from "libimobiledevice/mobilebackup.h": | |||
| 9 | MOBILEBACKUP_E_PLIST_ERROR = -2 | 9 | MOBILEBACKUP_E_PLIST_ERROR = -2 |
| 10 | MOBILEBACKUP_E_MUX_ERROR = -3 | 10 | MOBILEBACKUP_E_MUX_ERROR = -3 |
| 11 | MOBILEBACKUP_E_BAD_VERSION = -4 | 11 | MOBILEBACKUP_E_BAD_VERSION = -4 |
| 12 | MOBILEBACKUP_E_REPLY_NOT_OK = -5 | ||
| 12 | MOBILEBACKUP_E_UNKNOWN_ERROR = -256 | 13 | MOBILEBACKUP_E_UNKNOWN_ERROR = -256 |
| 13 | 14 | ||
| 14 | mobilebackup_error_t mobilebackup_client_new(idevice_t device, uint16_t port, mobilebackup_client_t * client) | 15 | ctypedef enum mobilebackup_flags_t: |
| 16 | MB_RESTORE_NOTIFY_SPRINGBOARD = (1 << 0) | ||
| 17 | MB_RESTORE_PRESERVE_SETTINGS = (1 << 1) | ||
| 18 | MB_RESTORE_PRESERVE_CAMERA_ROLL = (1 << 2) | ||
| 19 | |||
| 20 | mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, mobilebackup_client_t * client) | ||
| 15 | mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client) | 21 | mobilebackup_error_t mobilebackup_client_free(mobilebackup_client_t client) |
| 16 | mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist.plist_t *plist) | 22 | mobilebackup_error_t mobilebackup_receive(mobilebackup_client_t client, plist.plist_t *plist) |
| 17 | mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist.plist_t plist) | 23 | mobilebackup_error_t mobilebackup_send(mobilebackup_client_t client, plist.plist_t plist) |
| 24 | mobilebackup_error_t mobilebackup_request_backup(mobilebackup_client_t client, plist.plist_t backup_manifest, char *base_path, char *proto_version) | ||
| 25 | mobilebackup_error_t mobilebackup_send_backup_file_received(mobilebackup_client_t client) | ||
| 26 | mobilebackup_error_t mobilebackup_request_restore(mobilebackup_client_t client, plist.plist_t backup_manifest, mobilebackup_flags_t flags, char *proto_version) | ||
| 27 | mobilebackup_error_t mobilebackup_receive_restore_file_received(mobilebackup_client_t client, plist.plist_t *result) | ||
| 28 | mobilebackup_error_t mobilebackup_receive_restore_application_received(mobilebackup_client_t client, plist.plist_t *result) | ||
| 29 | mobilebackup_error_t mobilebackup_send_restore_complete(mobilebackup_client_t client) | ||
| 30 | mobilebackup_error_t mobilebackup_send_error(mobilebackup_client_t client, char *reason) | ||
| 18 | 31 | ||
| 19 | cdef class MobileBackupError(BaseError): | 32 | cdef class MobileBackupError(BaseError): |
| 20 | def __init__(self, *args, **kwargs): | 33 | def __init__(self, *args, **kwargs): |
| @@ -24,6 +37,7 @@ cdef class MobileBackupError(BaseError): | |||
| 24 | MOBILEBACKUP_E_PLIST_ERROR: "Property list error", | 37 | MOBILEBACKUP_E_PLIST_ERROR: "Property list error", |
| 25 | MOBILEBACKUP_E_MUX_ERROR: "MUX error", | 38 | MOBILEBACKUP_E_MUX_ERROR: "MUX error", |
| 26 | MOBILEBACKUP_E_BAD_VERSION: "Bad version", | 39 | MOBILEBACKUP_E_BAD_VERSION: "Bad version", |
| 40 | MOBILEBACKUP_E_REPLY_NOT_OK: "Reply not OK", | ||
| 27 | MOBILEBACKUP_E_UNKNOWN_ERROR: "Unknown error" | 41 | MOBILEBACKUP_E_UNKNOWN_ERROR: "Unknown error" |
| 28 | } | 42 | } |
| 29 | BaseError.__init__(self, *args, **kwargs) | 43 | BaseError.__init__(self, *args, **kwargs) |
| @@ -32,8 +46,8 @@ cdef class MobileBackupClient(PropertyListService): | |||
| 32 | __service_name__ = "com.apple.mobilebackup" | 46 | __service_name__ = "com.apple.mobilebackup" |
| 33 | cdef mobilebackup_client_t _c_client | 47 | cdef mobilebackup_client_t _c_client |
| 34 | 48 | ||
| 35 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 49 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 36 | self.handle_error(mobilebackup_client_new(device._c_dev, port, &self._c_client)) | 50 | self.handle_error(mobilebackup_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client)) |
| 37 | 51 | ||
| 38 | def __dealloc__(self): | 52 | def __dealloc__(self): |
| 39 | cdef mobilebackup_error_t err | 53 | cdef mobilebackup_error_t err |
| @@ -41,11 +55,52 @@ cdef class MobileBackupClient(PropertyListService): | |||
| 41 | err = mobilebackup_client_free(self._c_client) | 55 | err = mobilebackup_client_free(self._c_client) |
| 42 | self.handle_error(err) | 56 | self.handle_error(err) |
| 43 | 57 | ||
| 58 | cdef inline BaseError _error(self, int16_t ret): | ||
| 59 | return MobileBackupError(ret) | ||
| 60 | |||
| 44 | cdef inline int16_t _send(self, plist.plist_t node): | 61 | cdef inline int16_t _send(self, plist.plist_t node): |
| 45 | return mobilebackup_send(self._c_client, node) | 62 | return mobilebackup_send(self._c_client, node) |
| 46 | 63 | ||
| 47 | cdef inline int16_t _receive(self, plist.plist_t* node): | 64 | cdef inline int16_t _receive(self, plist.plist_t* node): |
| 48 | return mobilebackup_receive(self._c_client, node) | 65 | return mobilebackup_receive(self._c_client, node) |
| 49 | 66 | ||
| 50 | cdef inline BaseError _error(self, int16_t ret): | 67 | cdef request_backup(self, plist.Node backup_manifest, bytes base_path, bytes proto_version): |
| 51 | return MobileBackupError(ret) | 68 | self.handle_error(mobilebackup_request_backup(self._c_client, backup_manifest._c_node, base_path, proto_version)) |
| 69 | |||
| 70 | cdef send_backup_file_received(self): | ||
| 71 | self.handle_error(mobilebackup_send_backup_file_received(self._c_client)) | ||
| 72 | |||
| 73 | cdef request_restore(self, plist.Node backup_manifest, int flags, proto_version): | ||
| 74 | self.handle_error(mobilebackup_request_restore(self._c_client, backup_manifest._c_node, <mobilebackup_flags_t>flags, proto_version)) | ||
| 75 | |||
| 76 | cpdef plist.Node receive_restore_file_received(self): | ||
| 77 | cdef: | ||
| 78 | plist.plist_t c_node = NULL | ||
| 79 | mobilebackup_error_t err | ||
| 80 | err = mobilebackup_receive_restore_file_received(self._c_client, &c_node) | ||
| 81 | try: | ||
| 82 | self.handle_error(err) | ||
| 83 | return plist.plist_t_to_node(c_node) | ||
| 84 | except BaseError, e: | ||
| 85 | if c_node != NULL: | ||
| 86 | plist.plist_free(c_node) | ||
| 87 | raise | ||
| 88 | |||
| 89 | cpdef plist.Node receive_restore_application_received(self): | ||
| 90 | cdef: | ||
| 91 | plist.plist_t c_node = NULL | ||
| 92 | mobilebackup_error_t err | ||
| 93 | err = mobilebackup_receive_restore_application_received(self._c_client, &c_node) | ||
| 94 | try: | ||
| 95 | self.handle_error(err) | ||
| 96 | return plist.plist_t_to_node(c_node) | ||
| 97 | except BaseError, e: | ||
| 98 | if c_node != NULL: | ||
| 99 | plist.plist_free(c_node) | ||
| 100 | raise | ||
| 101 | |||
| 102 | cdef send_restore_complete(self): | ||
| 103 | self.handle_error(mobilebackup_send_restore_complete(self._c_client)) | ||
| 104 | |||
| 105 | cdef send_error(self, bytes reason): | ||
| 106 | self.handle_error(mobilebackup_send_error(self._c_client, reason)) | ||
diff --git a/cython/mobilesync.pxi b/cython/mobilesync.pxi index e610191..ba9d585 100644 --- a/cython/mobilesync.pxi +++ b/cython/mobilesync.pxi | |||
| @@ -24,12 +24,12 @@ cdef extern from "libimobiledevice/mobilesync.h": | |||
| 24 | char *host_anchor | 24 | char *host_anchor |
| 25 | ctypedef mobilesync_anchors *mobilesync_anchors_t | 25 | ctypedef mobilesync_anchors *mobilesync_anchors_t |
| 26 | 26 | ||
| 27 | mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client) | 27 | mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilesync_client_t * client) |
| 28 | mobilesync_error_t mobilesync_client_free(mobilesync_client_t client) | 28 | mobilesync_error_t mobilesync_client_free(mobilesync_client_t client) |
| 29 | mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist.plist_t *plist) | 29 | mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist.plist_t *plist) |
| 30 | mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist.plist_t plist) | 30 | mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist.plist_t plist) |
| 31 | 31 | ||
| 32 | mobilesync_error_t mobilesync_start(mobilesync_client_t client, char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version) | 32 | mobilesync_error_t mobilesync_start(mobilesync_client_t client, char *data_class, mobilesync_anchors_t anchors, uint64_t computer_data_class_version, mobilesync_sync_type_t *sync_type, uint64_t *device_data_class_version, char** error_description) |
| 33 | mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, char* reason) | 33 | mobilesync_error_t mobilesync_cancel(mobilesync_client_t client, char* reason) |
| 34 | mobilesync_error_t mobilesync_finish(mobilesync_client_t client) | 34 | mobilesync_error_t mobilesync_finish(mobilesync_client_t client) |
| 35 | 35 | ||
| @@ -73,8 +73,8 @@ cdef class MobileSyncClient(DeviceLinkService): | |||
| 73 | __service_name__ = "com.apple.mobilesync" | 73 | __service_name__ = "com.apple.mobilesync" |
| 74 | cdef mobilesync_client_t _c_client | 74 | cdef mobilesync_client_t _c_client |
| 75 | 75 | ||
| 76 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 76 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 77 | self.handle_error(mobilesync_client_new(device._c_dev, port, &(self._c_client))) | 77 | self.handle_error(mobilesync_client_new(device._c_dev, descriptor._c_service_descriptor, &(self._c_client))) |
| 78 | 78 | ||
| 79 | def __dealloc__(self): | 79 | def __dealloc__(self): |
| 80 | cdef mobilesync_error_t err | 80 | cdef mobilesync_error_t err |
| @@ -88,6 +88,7 @@ cdef class MobileSyncClient(DeviceLinkService): | |||
| 88 | mobilesync_sync_type_t sync_type | 88 | mobilesync_sync_type_t sync_type |
| 89 | uint64_t computer_data_class_version = 1 | 89 | uint64_t computer_data_class_version = 1 |
| 90 | uint64_t device_data_class_version | 90 | uint64_t device_data_class_version |
| 91 | char* error_description = NULL | ||
| 91 | 92 | ||
| 92 | if device_anchor is None: | 93 | if device_anchor is None: |
| 93 | anchors = mobilesync_anchors_new(NULL, host_anchor) | 94 | anchors = mobilesync_anchors_new(NULL, host_anchor) |
| @@ -95,8 +96,8 @@ cdef class MobileSyncClient(DeviceLinkService): | |||
| 95 | anchors = mobilesync_anchors_new(device_anchor, host_anchor) | 96 | anchors = mobilesync_anchors_new(device_anchor, host_anchor) |
| 96 | 97 | ||
| 97 | try: | 98 | try: |
| 98 | self.handle_error(mobilesync_start(self._c_client, data_class, anchors, computer_data_class_version, &sync_type, &device_data_class_version)) | 99 | self.handle_error(mobilesync_start(self._c_client, data_class, anchors, computer_data_class_version, &sync_type, &device_data_class_version, &error_description)) |
| 99 | return (sync_type, <bint>computer_data_class_version, <bint>device_data_class_version) | 100 | return (sync_type, <bint>computer_data_class_version, <bint>device_data_class_version, <bytes>error_description) |
| 100 | except Exception, e: | 101 | except Exception, e: |
| 101 | raise | 102 | raise |
| 102 | finally: | 103 | finally: |
diff --git a/cython/notification_proxy.pxi b/cython/notification_proxy.pxi index 07a72d9..4ffbf07 100644 --- a/cython/notification_proxy.pxi +++ b/cython/notification_proxy.pxi | |||
| @@ -9,7 +9,7 @@ cdef extern from "libimobiledevice/notification_proxy.h": | |||
| 9 | NP_E_CONN_FAILED = -3 | 9 | NP_E_CONN_FAILED = -3 |
| 10 | NP_E_UNKNOWN_ERROR = -256 | 10 | NP_E_UNKNOWN_ERROR = -256 |
| 11 | ctypedef void (*np_notify_cb_t) (const_char_ptr notification, void *userdata) | 11 | ctypedef void (*np_notify_cb_t) (const_char_ptr notification, void *userdata) |
| 12 | np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client) | 12 | np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, np_client_t *client) |
| 13 | np_error_t np_client_free(np_client_t client) | 13 | np_error_t np_client_free(np_client_t client) |
| 14 | np_error_t np_post_notification(np_client_t client, char *notification) | 14 | np_error_t np_post_notification(np_client_t client, char *notification) |
| 15 | np_error_t np_observe_notification(np_client_t client, char *notification) | 15 | np_error_t np_observe_notification(np_client_t client, char *notification) |
| @@ -88,8 +88,8 @@ cdef class NotificationProxyClient(PropertyListService): | |||
| 88 | __service_name__ = "com.apple.mobile.notification_proxy" | 88 | __service_name__ = "com.apple.mobile.notification_proxy" |
| 89 | cdef np_client_t _c_client | 89 | cdef np_client_t _c_client |
| 90 | 90 | ||
| 91 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 91 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 92 | self.handle_error(np_client_new(device._c_dev, port, &self._c_client)) | 92 | self.handle_error(np_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client)) |
| 93 | 93 | ||
| 94 | def __dealloc__(self): | 94 | def __dealloc__(self): |
| 95 | cdef np_error_t err | 95 | cdef np_error_t err |
diff --git a/cython/sbservices.pxi b/cython/sbservices.pxi index e826b2a..8ff2595 100644 --- a/cython/sbservices.pxi +++ b/cython/sbservices.pxi | |||
| @@ -8,7 +8,7 @@ cdef extern from "libimobiledevice/sbservices.h": | |||
| 8 | SBSERVICES_E_PLIST_ERROR = -2 | 8 | SBSERVICES_E_PLIST_ERROR = -2 |
| 9 | SBSERVICES_E_CONN_FAILED = -3 | 9 | SBSERVICES_E_CONN_FAILED = -3 |
| 10 | SBSERVICES_E_UNKNOWN_ERROR = -256 | 10 | SBSERVICES_E_UNKNOWN_ERROR = -256 |
| 11 | sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client) | 11 | sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, sbservices_client_t *client) |
| 12 | sbservices_error_t sbservices_client_free(sbservices_client_t client) | 12 | sbservices_error_t sbservices_client_free(sbservices_client_t client) |
| 13 | sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist.plist_t *state, char *format_version) | 13 | sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist.plist_t *state, char *format_version) |
| 14 | sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist.plist_t newstate) | 14 | sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist.plist_t newstate) |
| @@ -28,9 +28,11 @@ cdef class SpringboardServicesError(BaseError): | |||
| 28 | cdef class SpringboardServicesClient(PropertyListService): | 28 | cdef class SpringboardServicesClient(PropertyListService): |
| 29 | __service_name__ = "com.apple.springboardservices" | 29 | __service_name__ = "com.apple.springboardservices" |
| 30 | cdef sbservices_client_t _c_client | 30 | cdef sbservices_client_t _c_client |
| 31 | cdef char* format_version | ||
| 31 | 32 | ||
| 32 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 33 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 33 | self.handle_error(sbservices_client_new(device._c_dev, port, &self._c_client)) | 34 | self.handle_error(sbservices_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client)) |
| 35 | self.format_version = "2" | ||
| 34 | 36 | ||
| 35 | def __dealloc__(self): | 37 | def __dealloc__(self): |
| 36 | if self._c_client is not NULL: | 38 | if self._c_client is not NULL: |
| @@ -40,12 +42,18 @@ cdef class SpringboardServicesClient(PropertyListService): | |||
| 40 | cdef inline BaseError _error(self, int16_t ret): | 42 | cdef inline BaseError _error(self, int16_t ret): |
| 41 | return SpringboardServicesError(ret) | 43 | return SpringboardServicesError(ret) |
| 42 | 44 | ||
| 45 | property format_version: | ||
| 46 | def __get__(self): | ||
| 47 | return <bytes>self.format_version | ||
| 48 | def __set__(self, char* newversion): | ||
| 49 | self.format_version = newversion | ||
| 50 | |||
| 43 | property icon_state: | 51 | property icon_state: |
| 44 | def __get__(self): | 52 | def __get__(self): |
| 45 | cdef: | 53 | cdef: |
| 46 | plist.plist_t c_node = NULL | 54 | plist.plist_t c_node = NULL |
| 47 | sbservices_error_t err | 55 | sbservices_error_t err |
| 48 | err = sbservices_get_icon_state(self._c_client, &c_node, NULL) | 56 | err = sbservices_get_icon_state(self._c_client, &c_node, self.format_version) |
| 49 | try: | 57 | try: |
| 50 | self.handle_error(err) | 58 | self.handle_error(err) |
| 51 | 59 | ||
diff --git a/cython/screenshotr.pxi b/cython/screenshotr.pxi index a53fab2..2b2d53d 100644 --- a/cython/screenshotr.pxi +++ b/cython/screenshotr.pxi | |||
| @@ -11,7 +11,7 @@ cdef extern from "libimobiledevice/screenshotr.h": | |||
| 11 | SCREENSHOTR_E_BAD_VERSION = -4 | 11 | SCREENSHOTR_E_BAD_VERSION = -4 |
| 12 | SCREENSHOTR_E_UNKNOWN_ERROR = -256 | 12 | SCREENSHOTR_E_UNKNOWN_ERROR = -256 |
| 13 | 13 | ||
| 14 | screenshotr_error_t screenshotr_client_new(idevice_t device, uint16_t port, screenshotr_client_t * client) | 14 | screenshotr_error_t screenshotr_client_new(idevice_t device, lockdownd_service_descriptor_t descriptor, screenshotr_client_t * client) |
| 15 | screenshotr_error_t screenshotr_client_free(screenshotr_client_t client) | 15 | screenshotr_error_t screenshotr_client_free(screenshotr_client_t client) |
| 16 | screenshotr_error_t screenshotr_take_screenshot(screenshotr_client_t client, char **imgdata, uint64_t *imgsize) | 16 | screenshotr_error_t screenshotr_take_screenshot(screenshotr_client_t client, char **imgdata, uint64_t *imgsize) |
| 17 | 17 | ||
| @@ -31,8 +31,8 @@ cdef class ScreenshotrClient(DeviceLinkService): | |||
| 31 | __service_name__ = "com.apple.mobile.screenshotr" | 31 | __service_name__ = "com.apple.mobile.screenshotr" |
| 32 | cdef screenshotr_client_t _c_client | 32 | cdef screenshotr_client_t _c_client |
| 33 | 33 | ||
| 34 | def __cinit__(self, iDevice device not None, int port, *args, **kwargs): | 34 | def __cinit__(self, iDevice device not None, LockdownServiceDescriptor descriptor, *args, **kwargs): |
| 35 | self.handle_error(screenshotr_client_new(device._c_dev, port, &self._c_client)) | 35 | self.handle_error(screenshotr_client_new(device._c_dev, descriptor._c_service_descriptor, &self._c_client)) |
| 36 | 36 | ||
| 37 | def __dealloc__(self): | 37 | def __dealloc__(self): |
| 38 | cdef screenshotr_error_t err | 38 | cdef screenshotr_error_t err |
