imobiledevice.pxd 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. cimport plist
  2. from libc.stdint cimport *
  3. cdef extern from "pyerrors.h":
  4. ctypedef class __builtin__.Exception [object PyBaseExceptionObject]:
  5. pass
  6. cdef class BaseError(Exception):
  7. cdef dict _lookup_table
  8. cdef int16_t _c_errcode
  9. cdef class Base:
  10. cdef inline int handle_error(self, int16_t ret) except -1
  11. cdef BaseError _error(self, int16_t ret)
  12. cdef class iDeviceError(BaseError): pass
  13. cdef extern from "libimobiledevice/libimobiledevice.h":
  14. cdef struct idevice_private:
  15. pass
  16. ctypedef idevice_private* idevice_t
  17. cdef struct idevice_connection_private:
  18. pass
  19. ctypedef idevice_connection_private* idevice_connection_t
  20. cdef enum idevice_event_type:
  21. IDEVICE_DEVICE_ADD = 1,
  22. IDEVICE_DEVICE_REMOVE
  23. ctypedef struct idevice_event_t:
  24. idevice_event_type event
  25. char *udid
  26. int conn_type
  27. ctypedef idevice_event_t* const_idevice_event_t "const idevice_event_t*"
  28. cdef class iDeviceEvent:
  29. cdef const_idevice_event_t _c_event
  30. cdef class iDeviceConnection(Base):
  31. cdef idevice_connection_t _c_connection
  32. cpdef bytes receive_timeout(self, uint32_t max_len, unsigned int timeout)
  33. cpdef bytes receive(self, max_len)
  34. cpdef disconnect(self)
  35. cdef class iDevice(Base):
  36. cdef idevice_t _c_dev
  37. cpdef iDeviceConnection connect(self, uint16_t port)
  38. cdef class BaseService(Base):
  39. pass
  40. cdef class PropertyListService(BaseService):
  41. cpdef send(self, plist.Node node)
  42. cpdef object receive(self)
  43. cpdef object receive_with_timeout(self, int timeout_ms)
  44. cdef int16_t _send(self, plist.plist_t node)
  45. cdef int16_t _receive(self, plist.plist_t* c_node)
  46. cdef int16_t _receive_with_timeout(self, plist.plist_t* c_node, int timeout_ms)
  47. cdef extern from "libimobiledevice/lockdown.h":
  48. cdef struct lockdownd_client_private:
  49. pass
  50. ctypedef lockdownd_client_private *lockdownd_client_t
  51. cdef struct lockdownd_pair_record:
  52. char *device_certificate
  53. char *host_certificate
  54. char *host_id
  55. char *root_certificate
  56. ctypedef lockdownd_pair_record *lockdownd_pair_record_t
  57. cdef struct lockdownd_service_descriptor:
  58. uint16_t port
  59. uint8_t ssl_enabled
  60. ctypedef lockdownd_service_descriptor *lockdownd_service_descriptor_t
  61. cdef class LockdownError(BaseError): pass
  62. cdef class LockdownPairRecord:
  63. cdef lockdownd_pair_record_t _c_record
  64. cdef class LockdownServiceDescriptor(Base):
  65. cdef lockdownd_service_descriptor_t _c_service_descriptor
  66. cdef class LockdownClient(PropertyListService):
  67. cdef lockdownd_client_t _c_client
  68. cdef readonly iDevice device
  69. cpdef bytes query_type(self)
  70. cpdef plist.Node get_value(self, bytes domain=*, bytes key=*)
  71. cpdef set_value(self, bytes domain, bytes key, object value)
  72. cpdef remove_value(self, bytes domain, bytes key)
  73. cpdef object start_service(self, object service)
  74. cpdef object get_service_client(self, object service_class)
  75. cpdef tuple start_session(self, bytes host_id)
  76. cpdef stop_session(self, bytes session_id)
  77. cpdef pair(self, object pair_record=*)
  78. cpdef validate_pair(self, object pair_record=*)
  79. cpdef unpair(self, object pair_record=*)
  80. cpdef activate(self, plist.Node activation_record)
  81. cpdef deactivate(self)
  82. cpdef enter_recovery(self)
  83. cpdef goodbye(self)
  84. cpdef list get_sync_data_classes(self)