summaryrefslogtreecommitdiffstats
path: root/cython/mobilebackup2.pxi
diff options
context:
space:
mode:
authorGravatar wendyisgr33n2018-07-30 10:47:48 -0700
committerGravatar Nikias Bassen2021-01-03 23:26:52 +0100
commit12d3a070717ad734b1048b1dcacffae5b903f190 (patch)
treedf965f1fa335af3e0ee95b16c13945d464289ef1 /cython/mobilebackup2.pxi
parent652dfdb12ebcdec64dba066550d893de17839365 (diff)
downloadlibimobiledevice-12d3a070717ad734b1048b1dcacffae5b903f190.tar.gz
libimobiledevice-12d3a070717ad734b1048b1dcacffae5b903f190.tar.bz2
Fixed method visibility in mobilebackup2.pxi API
Diffstat (limited to 'cython/mobilebackup2.pxi')
-rw-r--r--cython/mobilebackup2.pxi31
1 files changed, 18 insertions, 13 deletions
diff --git a/cython/mobilebackup2.pxi b/cython/mobilebackup2.pxi
index 4eccae6..4b47e5b 100644
--- a/cython/mobilebackup2.pxi
+++ b/cython/mobilebackup2.pxi
@@ -58,10 +58,10 @@ cdef class MobileBackup2Client(PropertyListService):
58 cdef inline BaseError _error(self, int16_t ret): 58 cdef inline BaseError _error(self, int16_t ret):
59 return MobileBackup2Error(ret) 59 return MobileBackup2Error(ret)
60 60
61 cdef send_message(self, bytes message, plist.Node options): 61 cpdef send_message(self, bytes message, plist.Node options):
62 self.handle_error(mobilebackup2_send_message(self._c_client, message, options._c_node)) 62 self.handle_error(mobilebackup2_send_message(self._c_client, message, options._c_node))
63 63
64 cdef tuple receive_message(self): 64 cpdef tuple receive_message(self):
65 cdef: 65 cdef:
66 char* dlmessage = NULL 66 char* dlmessage = NULL
67 plist.plist_t c_node = NULL 67 plist.plist_t c_node = NULL
@@ -77,29 +77,34 @@ cdef class MobileBackup2Client(PropertyListService):
77 free(dlmessage) 77 free(dlmessage)
78 raise 78 raise
79 79
80 cdef int send_raw(self, bytes data, int length): 80 cpdef int send_raw(self, bytes data, int length):
81 cdef: 81 cdef:
82 uint32_t bytes = 0 82 uint32_t bytes_recvd = 0
83 mobilebackup2_error_t err 83 mobilebackup2_error_t err
84 err = mobilebackup2_send_raw(self._c_client, data, length, &bytes) 84 err = mobilebackup2_send_raw(self._c_client, data, length, &bytes_recvd)
85 try: 85 try:
86 self.handle_error(err) 86 self.handle_error(err)
87 return <bint>bytes 87 return <bint>bytes_recvd
88 except BaseError, e: 88 except BaseError, e:
89 raise 89 raise
90 90
91 cdef int receive_raw(self, bytes data, int length): 91 cpdef int receive_raw(self, bytearray data, int length):
92 cdef: 92 cdef:
93 uint32_t bytes = 0 93 uint32_t bytes_recvd = 0
94 mobilebackup2_error_t err 94 mobilebackup2_error_t err
95 err = mobilebackup2_receive_raw(self._c_client, data, length, &bytes) 95 err = mobilebackup2_receive_raw(self._c_client, data, length, &bytes_recvd)
96
97 # Throwing an exception when we test if theres more data to read is excessive
98 if err == -1 and bytes_recvd == 0:
99 return 0
100
96 try: 101 try:
97 self.handle_error(err) 102 self.handle_error(err)
98 return <bint>bytes 103 return <bint>bytes_recvd
99 except BaseError, e: 104 except BaseError, e:
100 raise 105 raise
101 106
102 cdef float version_exchange(self, double[::1] local_versions): 107 cpdef float version_exchange(self, double[::1] local_versions):
103 cdef: 108 cdef:
104 double[::1] temp = None 109 double[::1] temp = None
105 double remote_version = 0.0 110 double remote_version = 0.0
@@ -111,8 +116,8 @@ cdef class MobileBackup2Client(PropertyListService):
111 except BaseError, e: 116 except BaseError, e:
112 raise 117 raise
113 118
114 cdef send_request(self, bytes request, bytes target_identifier, bytes source_identifier, plist.Node options): 119 cpdef send_request(self, bytes request, bytes target_identifier, bytes source_identifier, plist.Node options):
115 self.handle_error(mobilebackup2_send_request(self._c_client, request, target_identifier, source_identifier, options._c_node)) 120 self.handle_error(mobilebackup2_send_request(self._c_client, request, target_identifier, source_identifier, options._c_node))
116 121
117 cdef send_status_response(self, int status_code, bytes status1, plist.Node status2): 122 cpdef send_status_response(self, int status_code, bytes status1, plist.Node status2):
118 self.handle_error(mobilebackup2_send_status_response(self._c_client, status_code, status1, status2._c_node)) 123 self.handle_error(mobilebackup2_send_status_response(self._c_client, status_code, status1, status2._c_node))