summaryrefslogtreecommitdiffstats
path: root/include/libirecovery.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/libirecovery.h')
-rw-r--r--include/libirecovery.h23
1 files changed, 19 insertions, 4 deletions
diff --git a/include/libirecovery.h b/include/libirecovery.h
index 73fe6f0..201be0d 100644
--- a/include/libirecovery.h
+++ b/include/libirecovery.h
@@ -2,8 +2,8 @@
2 * libirecovery.h 2 * libirecovery.h
3 * Communication to iBoot/iBSS on Apple iOS devices via USB 3 * Communication to iBoot/iBSS on Apple iOS devices via USB
4 * 4 *
5 * Copyright (c) 2012-2019 Nikias Bassen <nikias@gmx.li>
5 * Copyright (c) 2012-2013 Martin Szulecki <m.szulecki@libimobiledevice.org> 6 * Copyright (c) 2012-2013 Martin Szulecki <m.szulecki@libimobiledevice.org>
6 * Copyright (c) 2012-2013 Nikias Bassen
7 * Copyright (c) 2010 Chronic-Dev Team 7 * Copyright (c) 2010 Chronic-Dev Team
8 * Copyright (c) 2010 Joshua Hill 8 * Copyright (c) 2010 Joshua Hill
9 * 9 *
@@ -27,7 +27,7 @@ extern "C" {
27 27
28#include <stdint.h> 28#include <stdint.h>
29 29
30enum { 30enum irecv_mode {
31 IRECV_K_RECOVERY_MODE_1 = 0x1280, 31 IRECV_K_RECOVERY_MODE_1 = 0x1280,
32 IRECV_K_RECOVERY_MODE_2 = 0x1281, 32 IRECV_K_RECOVERY_MODE_2 = 0x1281,
33 IRECV_K_RECOVERY_MODE_3 = 0x1282, 33 IRECV_K_RECOVERY_MODE_3 = 0x1282,
@@ -93,14 +93,25 @@ struct irecv_device_info {
93 unsigned int sep_nonce_size; 93 unsigned int sep_nonce_size;
94}; 94};
95 95
96typedef enum {
97 IRECV_DEVICE_ADD = 1,
98 IRECV_DEVICE_REMOVE = 2
99} irecv_device_event_type;
100
101typedef struct {
102 irecv_device_event_type type;
103 enum irecv_mode mode;
104 struct irecv_device_info *device_info;
105} irecv_device_event_t;
106
96typedef struct irecv_client_private irecv_client_private; 107typedef struct irecv_client_private irecv_client_private;
97typedef irecv_client_private* irecv_client_t; 108typedef irecv_client_private* irecv_client_t;
98 109
99/* library */ 110/* library */
100void irecv_set_debug_level(int level); 111void irecv_set_debug_level(int level);
101const char* irecv_strerror(irecv_error_t error); 112const char* irecv_strerror(irecv_error_t error);
102void irecv_init(void); 113void irecv_init(void); /* deprecated: libirecovery has constructor now */
103void irecv_exit(void); 114void irecv_exit(void); /* deprecated: libirecovery has destructor now */
104 115
105/* device connectivity */ 116/* device connectivity */
106irecv_error_t irecv_open_with_ecid(irecv_client_t* client, unsigned long long ecid); 117irecv_error_t irecv_open_with_ecid(irecv_client_t* client, unsigned long long ecid);
@@ -123,6 +134,10 @@ int irecv_usb_control_transfer(irecv_client_t client, uint8_t bm_request_type, u
123int irecv_usb_bulk_transfer(irecv_client_t client, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout); 134int irecv_usb_bulk_transfer(irecv_client_t client, unsigned char endpoint, unsigned char *data, int length, int *transferred, unsigned int timeout);
124 135
125/* events */ 136/* events */
137typedef void(*irecv_device_event_cb_t)(const irecv_device_event_t* event, void *user_data);
138typedef struct irecv_device_event_context* irecv_device_event_context_t;
139irecv_error_t irecv_device_event_subscribe(irecv_device_event_context_t *context, irecv_device_event_cb_t callback, void *user_data);
140irecv_error_t irecv_device_event_unsubscribe(irecv_device_event_context_t context);
126typedef int(*irecv_event_cb_t)(irecv_client_t client, const irecv_event_t* event); 141typedef int(*irecv_event_cb_t)(irecv_client_t client, const irecv_event_t* event);
127irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void *user_data); 142irecv_error_t irecv_event_subscribe(irecv_client_t client, irecv_event_type type, irecv_event_cb_t callback, void *user_data);
128irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type); 143irecv_error_t irecv_event_unsubscribe(irecv_client_t client, irecv_event_type type);