diff options
| author | 2010-03-16 03:40:55 -0500 | |
|---|---|---|
| committer | 2012-03-20 23:25:54 +0100 | |
| commit | fd3f9219f4e7178435f312300f933abe25608cf3 (patch) | |
| tree | d41f4e184fca3da70a4bb44a0eee39dab32b5350 /cython | |
| parent | 69f518d3a4b249daab850b08a376adbbf6636a8e (diff) | |
| download | libimobiledevice-fd3f9219f4e7178435f312300f933abe25608cf3.tar.gz libimobiledevice-fd3f9219f4e7178435f312300f933abe25608cf3.tar.bz2 | |
Added cython bindings.
Diffstat (limited to 'cython')
| -rw-r--r-- | cython/Makefile.am | 32 | ||||
| -rw-r--r-- | cython/imobiledevice.pyx | 336 | ||||
| -rw-r--r-- | cython/stdint.pxi | 10 |
3 files changed, 378 insertions, 0 deletions
diff --git a/cython/Makefile.am b/cython/Makefile.am new file mode 100644 index 0000000..3cada6c --- /dev/null +++ b/cython/Makefile.am | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | AM_CPPFLAGS = -I$(top_srcdir)/include | ||
| 2 | |||
| 3 | AM_CFLAGS = $(GLOBAL_CFLAGS) $(libusbmuxd_CFLAGS) $(libglib2_CFLAGS) $(libgnutls_CFLAGS) $(libtasn1_CFLAGS) $(libgthread2_CFLAGS) $(libplist_CFLAGS) $(LFS_CFLAGS) | ||
| 4 | AM_LDFLAGS = $(libglib2_LIBS) $(libgnutls_LIBS) $(libtasn1_LIBS) $(libgthread2_LIBS) $(libplist_LIBS) $(libusbmuxd_LIBS) $(libgcrypt_LIBS) | ||
| 5 | |||
| 6 | if HAVE_CYTHON | ||
| 7 | |||
| 8 | BUILT_SOURCES = imobiledevice.c | ||
| 9 | |||
| 10 | CLEANFILES = \ | ||
| 11 | *.pyc \ | ||
| 12 | *.pyo \ | ||
| 13 | imobiledevice.so \ | ||
| 14 | imobiledevice.c | ||
| 15 | |||
| 16 | EXTRA_DIST = \ | ||
| 17 | imobiledevice.pyx | ||
| 18 | |||
| 19 | imobiledevicedir = $(pyexecdir) | ||
| 20 | imobiledevice_LTLIBRARIES = imobiledevice.la | ||
| 21 | nodist_imobiledevice_la_SOURCES = imobiledevice.c #imobiledevice_private.c | ||
| 22 | imobiledevice_la_CFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/src $(PYTHON_CPPFLAGS) | ||
| 23 | imobiledevice_la_LDFLAGS = -module -avoid-version $(PYTHON_LDFLAGS) | ||
| 24 | imobiledevice_la_LIBADD = $(top_builddir)/src/libimobiledevice.la | ||
| 25 | |||
| 26 | imobiledevice.c: imobiledevice.pyx $(CYTHON_PLIST_INCLUDE_DIR)/plist.pxd | ||
| 27 | $(CYTHON) --line-directives -I$(CYTHON_PLIST_INCLUDE_DIR) -I$(top_srcdir)/src -o $@ $< | ||
| 28 | |||
| 29 | # imobiledevice_private.c: $(IMOBILEDEVICE_PRIVATE_SOURCES) $(IMOBILEDEVICE_INCLUDES) $(PLIST_INCLUDES) | ||
| 30 | # $(CYTHON) $(IMOBILEDEVICE_CPPFLAGS) -I$(top_srcdir)/src -o $@ $< | ||
| 31 | |||
| 32 | endif | ||
diff --git a/cython/imobiledevice.pyx b/cython/imobiledevice.pyx new file mode 100644 index 0000000..7190def --- /dev/null +++ b/cython/imobiledevice.pyx | |||
| @@ -0,0 +1,336 @@ | |||
| 1 | cdef extern from *: | ||
| 2 | ctypedef unsigned char uint8_t | ||
| 3 | ctypedef short int int16_t | ||
| 4 | ctypedef unsigned short int uint16_t | ||
| 5 | ctypedef unsigned int uint32_t | ||
| 6 | ctypedef int int32_t | ||
| 7 | IF UNAME_MACHINE == 'x86_64': | ||
| 8 | ctypedef unsigned long int uint64_t | ||
| 9 | ELSE: | ||
| 10 | ctypedef unsigned long long int uint64_t | ||
| 11 | |||
| 12 | cimport plist | ||
| 13 | |||
| 14 | cdef extern from "pyerrors.h": | ||
| 15 | ctypedef class __builtin__.Exception [object PyBaseExceptionObject]: | ||
| 16 | pass | ||
| 17 | |||
| 18 | cdef class BaseError(Exception): | ||
| 19 | cdef dict _lookup_table | ||
| 20 | cdef int16_t _c_errcode | ||
| 21 | cpdef get_message(self) | ||
| 22 | |||
| 23 | def __cinit__(self, int16_t errcode): | ||
| 24 | self._c_errcode = errcode | ||
| 25 | Exception.__init__(self, errcode) | ||
| 26 | |||
| 27 | def __nonzero__(self): | ||
| 28 | return self._c_errcode != 0 | ||
| 29 | |||
| 30 | cpdef get_message(self): | ||
| 31 | return '%s (%s)' % (self._lookup_table[self._c_errcode], self._c_errcode) | ||
| 32 | |||
| 33 | def __str__(self): | ||
| 34 | return self.get_message() | ||
| 35 | |||
| 36 | def __repr__(self): | ||
| 37 | return self.__str__() | ||
| 38 | |||
| 39 | cdef extern from "libimobiledevice/libimobiledevice.h": | ||
| 40 | cdef struct idevice_int: | ||
| 41 | pass | ||
| 42 | ctypedef idevice_int* idevice_t | ||
| 43 | ctypedef int16_t idevice_error_t | ||
| 44 | int16_t IDEVICE_E_SUCCESS | ||
| 45 | int16_t IDEVICE_E_INVALID_ARG | ||
| 46 | int16_t IDEVICE_E_UNKNOWN_ERROR | ||
| 47 | int16_t IDEVICE_E_NO_DEVICE | ||
| 48 | int16_t IDEVICE_E_NOT_ENOUGH_DATA | ||
| 49 | int16_t IDEVICE_E_BAD_HEADER | ||
| 50 | int16_t IDEVICE_E_SSL_ERROR | ||
| 51 | cdef enum idevice_event_type: | ||
| 52 | IDEVICE_DEVICE_ADD = 1, | ||
| 53 | IDEVICE_DEVICE_REMOVE | ||
| 54 | ctypedef struct idevice_event_t: | ||
| 55 | idevice_event_type event | ||
| 56 | char *uuid | ||
| 57 | int conn_type | ||
| 58 | ctypedef void (*idevice_event_cb_t) (idevice_event_t *event, void *user_data) | ||
| 59 | cdef extern idevice_error_t c_idevice_event_subscribe "idevice_event_subscribe" (idevice_event_cb_t callback, void *user_data) | ||
| 60 | cdef extern idevice_error_t c_idevice_event_unsubscribe "idevice_event_unsubscribe" () | ||
| 61 | void idevice_set_debug_level(int level) | ||
| 62 | idevice_error_t idevice_new(idevice_t *device, char *uuid) | ||
| 63 | idevice_error_t idevice_free(idevice_t device) | ||
| 64 | idevice_error_t idevice_get_uuid(idevice_t device, char** uuid) | ||
| 65 | idevice_error_t idevice_get_handle(idevice_t device, uint32_t *handle) | ||
| 66 | |||
| 67 | def set_debug_level(level): | ||
| 68 | idevice_set_debug_level(level) | ||
| 69 | |||
| 70 | #cdef void idevice_event_cb(idevice_event_t *c_event, void *user_data): | ||
| 71 | #event = iDeviceEvent() | ||
| 72 | #event._c_event = c_event | ||
| 73 | #(<object>user_data)(event) | ||
| 74 | |||
| 75 | #def idevice_event_subscribe(callback): | ||
| 76 | #c_idevice_event_subscribe(idevice_event_cb, <void*>callback) | ||
| 77 | |||
| 78 | cdef class iDeviceError(BaseError): | ||
| 79 | def __cinit__(self, *args, **kwargs): | ||
| 80 | self._lookup_table = { | ||
| 81 | IDEVICE_E_SUCCESS: 'Success', | ||
| 82 | IDEVICE_E_INVALID_ARG: 'Invalid argument', | ||
| 83 | IDEVICE_E_UNKNOWN_ERROR: 'Unknown error', | ||
| 84 | IDEVICE_E_NO_DEVICE: 'No device', | ||
| 85 | IDEVICE_E_NOT_ENOUGH_DATA: 'Not enough data', | ||
| 86 | IDEVICE_E_BAD_HEADER: 'Bad header', | ||
| 87 | IDEVICE_E_SSL_ERROR: 'SSL Error' | ||
| 88 | } | ||
| 89 | BaseError.__init__(self, *args, **kwargs) | ||
| 90 | |||
| 91 | cdef class iDeviceEvent: | ||
| 92 | cdef idevice_event_t* _c_event | ||
| 93 | |||
| 94 | cdef class iDevice: | ||
| 95 | cdef idevice_t _c_dev | ||
| 96 | |||
| 97 | def __cinit__(self, uuid=None, *args, **kwargs): | ||
| 98 | cdef char* c_uuid = NULL | ||
| 99 | if uuid is not None: | ||
| 100 | c_uuid = uuid | ||
| 101 | err = iDeviceError(idevice_new(&(self._c_dev), c_uuid)) | ||
| 102 | if err: raise err | ||
| 103 | |||
| 104 | def __dealloc__(self): | ||
| 105 | if self._c_dev is not NULL: | ||
| 106 | err = iDeviceError(idevice_free(self._c_dev)) | ||
| 107 | if err: raise err | ||
| 108 | |||
| 109 | property uuid: | ||
| 110 | def __get__(self): | ||
| 111 | cdef char* uuid | ||
| 112 | err = iDeviceError(idevice_get_uuid(self._c_dev, &uuid)) | ||
| 113 | if err: raise err | ||
| 114 | return uuid | ||
| 115 | property handle: | ||
| 116 | def __get__(self): | ||
| 117 | cdef uint32_t handle | ||
| 118 | err = iDeviceError(idevice_get_handle(self._c_dev, &handle)) | ||
| 119 | if err: raise err | ||
| 120 | return handle | ||
| 121 | |||
| 122 | cdef extern from "libimobiledevice/lockdown.h": | ||
| 123 | cdef struct lockdownd_client_int: | ||
| 124 | pass | ||
| 125 | ctypedef lockdownd_client_int *lockdownd_client_t | ||
| 126 | ctypedef int16_t lockdownd_error_t | ||
| 127 | int16_t LOCKDOWN_E_SUCCESS | ||
| 128 | int16_t LOCKDOWN_E_INVALID_ARG | ||
| 129 | int16_t LOCKDOWN_E_INVALID_CONF | ||
| 130 | int16_t LOCKDOWN_E_PLIST_ERROR | ||
| 131 | int16_t LOCKDOWN_E_PAIRING_FAILED | ||
| 132 | int16_t LOCKDOWN_E_SSL_ERROR | ||
| 133 | int16_t LOCKDOWN_E_DICT_ERROR | ||
| 134 | int16_t LOCKDOWN_E_START_SERVICE_FAILED | ||
| 135 | int16_t LOCKDOWN_E_NOT_ENOUGH_DATA | ||
| 136 | int16_t LOCKDOWN_E_SET_VALUE_PROHIBITED | ||
| 137 | int16_t LOCKDOWN_E_GET_VALUE_PROHIBITED | ||
| 138 | int16_t LOCKDOWN_E_REMOVE_VALUE_PROHIBITED | ||
| 139 | int16_t LOCKDOWN_E_MUX_ERROR | ||
| 140 | int16_t LOCKDOWN_E_ACTIVATION_FAILED | ||
| 141 | int16_t LOCKDOWN_E_PASSWORD_PROTECTED | ||
| 142 | int16_t LOCKDOWN_E_NO_RUNNING_SESSION | ||
| 143 | int16_t LOCKDOWN_E_INVALID_HOST_ID | ||
| 144 | int16_t LOCKDOWN_E_INVALID_SERVICE | ||
| 145 | int16_t LOCKDOWN_E_INVALID_ACTIVATION_RECORD | ||
| 146 | int16_t LOCKDOWN_E_UNKNOWN_ERROR | ||
| 147 | |||
| 148 | lockdownd_error_t lockdownd_client_new_with_handshake(idevice_t device, lockdownd_client_t *client, char *label) | ||
| 149 | lockdownd_error_t lockdownd_client_free(lockdownd_client_t client) | ||
| 150 | lockdownd_error_t lockdownd_start_service(lockdownd_client_t client, char *service, uint16_t *port) | ||
| 151 | |||
| 152 | cdef class LockdownError(BaseError): | ||
| 153 | def __init__(self, *args, **kwargs): | ||
| 154 | self._lookup_table = { | ||
| 155 | LOCKDOWN_E_SUCCESS: "Success", | ||
| 156 | LOCKDOWN_E_INVALID_ARG: "Invalid argument", | ||
| 157 | LOCKDOWN_E_INVALID_CONF: "Invalid configuration", | ||
| 158 | LOCKDOWN_E_PLIST_ERROR: "PList error", | ||
| 159 | LOCKDOWN_E_PAIRING_FAILED: "Pairing failed", | ||
| 160 | LOCKDOWN_E_SSL_ERROR: "SSL error", | ||
| 161 | LOCKDOWN_E_DICT_ERROR: "Dict error", | ||
| 162 | LOCKDOWN_E_START_SERVICE_FAILED: "Start service failed", | ||
| 163 | LOCKDOWN_E_NOT_ENOUGH_DATA: "Not enough data", | ||
| 164 | LOCKDOWN_E_SET_VALUE_PROHIBITED: "Set value prohibited", | ||
| 165 | LOCKDOWN_E_GET_VALUE_PROHIBITED: "Get value prohibited", | ||
| 166 | LOCKDOWN_E_REMOVE_VALUE_PROHIBITED: "Remove value prohibited", | ||
| 167 | LOCKDOWN_E_MUX_ERROR: "MUX Error", | ||
| 168 | LOCKDOWN_E_ACTIVATION_FAILED: "Activation failed", | ||
| 169 | LOCKDOWN_E_PASSWORD_PROTECTED: "Password protected", | ||
| 170 | LOCKDOWN_E_NO_RUNNING_SESSION: "No running session", | ||
| 171 | LOCKDOWN_E_INVALID_HOST_ID: "Invalid host ID", | ||
| 172 | LOCKDOWN_E_INVALID_SERVICE: "Invalid service", | ||
| 173 | LOCKDOWN_E_INVALID_ACTIVATION_RECORD: "Invalid activation record", | ||
| 174 | LOCKDOWN_E_UNKNOWN_ERROR: "Unknown error" | ||
| 175 | } | ||
| 176 | BaseError.__init__(self, *args, **kwargs) | ||
| 177 | |||
| 178 | cdef class LockdownClient: | ||
| 179 | cdef lockdownd_client_t _c_client | ||
| 180 | |||
| 181 | def __cinit__(self, iDevice device not None, char *label=NULL, *args, **kwargs): | ||
| 182 | cdef iDevice dev = device | ||
| 183 | err = LockdownError(lockdownd_client_new_with_handshake(dev._c_dev, &(self._c_client), label)) | ||
| 184 | if err: raise err | ||
| 185 | |||
| 186 | def __dealloc__(self): | ||
| 187 | if self._c_client is not NULL: | ||
| 188 | err = LockdownError(lockdownd_client_free(self._c_client)) | ||
| 189 | if err: raise err | ||
| 190 | |||
| 191 | cpdef start_service(self, service): | ||
| 192 | cdef uint16_t port | ||
| 193 | err = LockdownError(lockdownd_start_service(self._c_client, service, &port)) | ||
| 194 | if err: raise err | ||
| 195 | return port | ||
| 196 | |||
| 197 | def goodbye(self): | ||
| 198 | pass | ||
| 199 | |||
| 200 | |||
| 201 | cdef extern from "libimobiledevice/mobilesync.h": | ||
| 202 | cdef struct mobilesync_client_int: | ||
| 203 | pass | ||
| 204 | ctypedef mobilesync_client_int *mobilesync_client_t | ||
| 205 | |||
| 206 | ctypedef int16_t mobilesync_error_t | ||
| 207 | int16_t MOBILESYNC_E_SUCCESS | ||
| 208 | int16_t MOBILESYNC_E_INVALID_ARG | ||
| 209 | int16_t MOBILESYNC_E_PLIST_ERROR | ||
| 210 | int16_t MOBILESYNC_E_MUX_ERROR | ||
| 211 | int16_t MOBILESYNC_E_BAD_VERSION | ||
| 212 | int16_t MOBILESYNC_E_UNKNOWN_ERROR | ||
| 213 | |||
| 214 | mobilesync_error_t mobilesync_client_new(idevice_t device, uint16_t port, mobilesync_client_t * client) | ||
| 215 | mobilesync_error_t mobilesync_client_free(mobilesync_client_t client) | ||
| 216 | mobilesync_error_t mobilesync_receive(mobilesync_client_t client, plist.plist_t *plist) | ||
| 217 | mobilesync_error_t mobilesync_send(mobilesync_client_t client, plist.plist_t plist) | ||
| 218 | |||
| 219 | cdef class MobileSyncError(BaseError): | ||
| 220 | def __init__(self, *args, **kwargs): | ||
| 221 | self._lookup_table = { | ||
| 222 | MOBILESYNC_E_SUCCESS: "Success", | ||
| 223 | MOBILESYNC_E_INVALID_ARG: "Invalid argument", | ||
| 224 | MOBILESYNC_E_PLIST_ERROR: "PList Error", | ||
| 225 | MOBILESYNC_E_MUX_ERROR: "MUX Error", | ||
| 226 | MOBILESYNC_E_BAD_VERSION: "Bad Version", | ||
| 227 | MOBILESYNC_E_UNKNOWN_ERROR: "Unknown error" | ||
| 228 | } | ||
| 229 | BaseError.__init__(self, *args, **kwargs) | ||
| 230 | |||
| 231 | cdef class MobileSyncClient: | ||
| 232 | cdef mobilesync_client_t _c_client | ||
| 233 | |||
| 234 | def __cinit__(self, iDevice device not None, LockdownClient lockdown not None, *args, **kwargs): | ||
| 235 | cdef iDevice dev = device | ||
| 236 | cdef LockdownClient lckd = lockdown | ||
| 237 | port = lckd.start_service("com.apple.mobilesync") | ||
| 238 | err = MobileSyncError(mobilesync_client_new(dev._c_dev, port, &(self._c_client))) | ||
| 239 | if err: raise err | ||
| 240 | |||
| 241 | def __dealloc__(self): | ||
| 242 | if self._c_client is not NULL: | ||
| 243 | err = MobileSyncError(mobilesync_client_free(self._c_client)) | ||
| 244 | if err: raise err | ||
| 245 | |||
| 246 | cpdef send(self, object obj): | ||
| 247 | cdef plist.Node node | ||
| 248 | cdef plist.plist_t c_node | ||
| 249 | if isinstance(obj, plist.Node): | ||
| 250 | node = obj | ||
| 251 | c_node = node._c_node | ||
| 252 | else: | ||
| 253 | c_node = plist.native_to_plist_t(obj) | ||
| 254 | err = MobileSyncError(mobilesync_send(self._c_client, c_node)) | ||
| 255 | if err: raise err | ||
| 256 | |||
| 257 | cpdef receive(self): | ||
| 258 | cdef plist.plist_t c_node = NULL | ||
| 259 | err = MobileSyncError(mobilesync_receive(self._c_client, &(c_node))) | ||
| 260 | if err: raise err | ||
| 261 | |||
| 262 | return plist.plist_t_to_node(c_node) | ||
| 263 | |||
| 264 | cdef extern from *: | ||
| 265 | ctypedef char* const_char_ptr "const char*" | ||
| 266 | |||
| 267 | cdef extern from "libimobiledevice/notification_proxy.h": | ||
| 268 | cdef struct np_client_int: | ||
| 269 | pass | ||
| 270 | ctypedef np_client_int *np_client_t | ||
| 271 | ctypedef int16_t np_error_t | ||
| 272 | ctypedef void (*np_notify_cb_t) (const_char_ptr notification, void *userdata) | ||
| 273 | np_error_t np_client_new(idevice_t device, uint16_t port, np_client_t *client) | ||
| 274 | np_error_t np_client_free(np_client_t client) | ||
| 275 | np_error_t np_post_notification(np_client_t client, char *notification) | ||
| 276 | np_error_t np_observe_notification(np_client_t client, char *notification) | ||
| 277 | np_error_t np_observe_notifications(np_client_t client, char **notification_spec) | ||
| 278 | np_error_t np_set_notify_callback(np_client_t client, np_notify_cb_t notify_cb, void *userdata) | ||
| 279 | |||
| 280 | cdef void np_notify_cb(const_char_ptr notification, void *py_callback): | ||
| 281 | (<object>py_callback)(notification) | ||
| 282 | |||
| 283 | cdef class NotificationProxyError(BaseError): | ||
| 284 | pass | ||
| 285 | |||
| 286 | cdef class NotificationProxy: | ||
| 287 | cdef np_client_t _c_client | ||
| 288 | |||
| 289 | def __cinit__(self, iDevice device not None, LockdownClient lockdown not None, *args, **kwargs): | ||
| 290 | cdef iDevice dev = device | ||
| 291 | cdef LockdownClient lckd = lockdown | ||
| 292 | port = lckd.start_service("com.apple.mobile.notification_proxy") | ||
| 293 | err = NotificationProxyError(np_client_new(dev._c_dev, port, &(self._c_client))) | ||
| 294 | if err: raise err | ||
| 295 | |||
| 296 | def __dealloc__(self): | ||
| 297 | if self._c_client is not NULL: | ||
| 298 | err = NotificationProxyError(np_client_free(self._c_client)) | ||
| 299 | if err: raise err | ||
| 300 | |||
| 301 | def set_notify_callback(self, callback): | ||
| 302 | err = NotificationProxyError(np_set_notify_callback(self._c_client, np_notify_cb, <void*>callback)) | ||
| 303 | if err: raise err | ||
| 304 | |||
| 305 | def observe_notification(self, notification): | ||
| 306 | err = NotificationProxyError(np_observe_notification(self._c_client, notification)) | ||
| 307 | if err: raise err | ||
| 308 | |||
| 309 | cdef extern from "libimobiledevice/sbservices.h": | ||
| 310 | cdef struct sbservices_client_int: | ||
| 311 | pass | ||
| 312 | ctypedef sbservices_client_int *sbservices_client_t | ||
| 313 | ctypedef int16_t sbservices_error_t | ||
| 314 | sbservices_error_t sbservices_client_new(idevice_t device, uint16_t port, sbservices_client_t *client) | ||
| 315 | sbservices_error_t sbservices_client_free(sbservices_client_t client) | ||
| 316 | sbservices_error_t sbservices_get_icon_state(sbservices_client_t client, plist.plist_t *state) | ||
| 317 | sbservices_error_t sbservices_set_icon_state(sbservices_client_t client, plist.plist_t newstate) | ||
| 318 | sbservices_error_t sbservices_get_icon_pngdata(sbservices_client_t client, char *bundleId, char **pngdata, uint64_t *pngsize) | ||
| 319 | |||
| 320 | cdef class SpringboardServicesError(BaseError): | ||
| 321 | pass | ||
| 322 | |||
| 323 | cdef class SpringboardServices: | ||
| 324 | cdef sbservices_client_t _c_client | ||
| 325 | |||
| 326 | def __cinit__(self, iDevice device not None, LockdownClient lockdown not None, *args, **kwargs): | ||
| 327 | cdef iDevice dev = device | ||
| 328 | cdef LockdownClient lckd = lockdown | ||
| 329 | port = lockdown.start_service("com.apple.springboardservices") | ||
| 330 | err = SpringboardServicesError(sbservices_client_new(dev._c_dev, port, &(self._c_client))) | ||
| 331 | if err: raise err | ||
| 332 | |||
| 333 | def __dealloc__(self): | ||
| 334 | if self._c_client is not NULL: | ||
| 335 | err = SpringboardServicesError(sbservices_client_free(self._c_client)) | ||
| 336 | if err: raise err | ||
diff --git a/cython/stdint.pxi b/cython/stdint.pxi new file mode 100644 index 0000000..518c3d1 --- /dev/null +++ b/cython/stdint.pxi | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | cdef extern from "stdint.h": | ||
| 2 | ctypedef unsigned char uint8_t | ||
| 3 | ctypedef short int int16_t | ||
| 4 | ctypedef unsigned short int uint16_t | ||
| 5 | ctypedef unsigned int uint32_t | ||
| 6 | ctypedef int int32_t | ||
| 7 | IF UNAME_MACHINE == 'x86_64': | ||
| 8 | ctypedef unsigned long int uint64_t | ||
| 9 | ELSE: | ||
| 10 | ctypedef unsigned long long int uint64_t | ||
