diff options
author | Martin Szulecki | 2013-04-05 18:46:12 +0200 |
---|---|---|
committer | Martin Szulecki | 2013-04-05 18:46:12 +0200 |
commit | 78238523bc5aff1d699a202e82dea1f02e780fb8 (patch) | |
tree | 9994a24fff5d025734abce5afa005125e7b92f58 /src | |
parent | 1b26aa5876df307b051012ac56fe0bb7530e11b7 (diff) | |
download | ideviceinstaller-78238523bc5aff1d699a202e82dea1f02e780fb8.tar.gz ideviceinstaller-78238523bc5aff1d699a202e82dea1f02e780fb8.tar.bz2 |
Add compatibility for libimobiledevice API >= 1.1.5
Diffstat (limited to 'src')
-rw-r--r-- | src/ideviceinstaller.c | 54 |
1 files changed, 39 insertions, 15 deletions
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c index 7682536..51fbe7b 100644 --- a/src/ideviceinstaller.c +++ b/src/ideviceinstaller.c @@ -388,7 +388,11 @@ int main(int argc, char **argv) instproxy_client_t ipc = NULL; np_client_t np = NULL; afc_client_t afc = NULL; - uint16_t port = 0; +#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 + lockdownd_service_descriptor_t service = NULL; +#else + uint16_t service = 0; +#endif int res = 0; parse_opts(argc, argv); @@ -408,13 +412,13 @@ int main(int argc, char **argv) if ((lockdownd_start_service (client, "com.apple.mobile.notification_proxy", - &port) != LOCKDOWN_E_SUCCESS) || !port) { + &service) != LOCKDOWN_E_SUCCESS) || !service) { fprintf(stderr, "Could not start com.apple.mobile.notification_proxy!\n"); goto leave_cleanup; } - if (np_client_new(phone, port, &np) != NP_E_SUCCESS) { + if (np_client_new(phone, service, &np) != NP_E_SUCCESS) { fprintf(stderr, "Could not connect to notification_proxy!\n"); goto leave_cleanup; } @@ -430,16 +434,22 @@ int main(int argc, char **argv) np_observe_notifications(np, noties); run_again: - port = 0; - if ((lockdownd_start_service - (client, "com.apple.mobile.installation_proxy", - &port) != LOCKDOWN_E_SUCCESS) || !port) { +#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 + if (service) { + lockdownd_service_descriptor_free(service); + } + service = NULL; +#else + service = 0; +#endif + if ((lockdownd_start_service(client, "com.apple.mobile.installation_proxy", + &service) != LOCKDOWN_E_SUCCESS) || !service) { fprintf(stderr, "Could not start com.apple.mobile.installation_proxy!\n"); goto leave_cleanup; } - if (instproxy_client_new(phone, port, &ipc) != INSTPROXY_E_SUCCESS) { + if (instproxy_client_new(phone, service, &ipc) != INSTPROXY_E_SUCCESS) { fprintf(stderr, "Could not connect to installation_proxy!\n"); goto leave_cleanup; } @@ -554,9 +564,16 @@ run_again: uint64_t af = 0; char buf[8192]; - port = 0; - if ((lockdownd_start_service(client, "com.apple.afc", &port) != - LOCKDOWN_E_SUCCESS) || !port) { +#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 + if (service) { + lockdownd_service_descriptor_free(service); + } + service = NULL; +#else + service = 0; +#endif + if ((lockdownd_start_service(client, "com.apple.afc", &service) != + LOCKDOWN_E_SUCCESS) || !service) { fprintf(stderr, "Could not start com.apple.afc!\n"); goto leave_cleanup; } @@ -564,7 +581,7 @@ run_again: lockdownd_client_free(client); client = NULL; - if (afc_client_new(phone, port, &afc) != INSTPROXY_E_SUCCESS) { + if (afc_client_new(phone, service, &afc) != INSTPROXY_E_SUCCESS) { fprintf(stderr, "Could not connect to AFC!\n"); goto leave_cleanup; } @@ -1013,8 +1030,15 @@ run_again: goto leave_cleanup; } - port = 0; - if ((lockdownd_start_service(client, "com.apple.afc", &port) != LOCKDOWN_E_SUCCESS) || !port) { +#ifdef HAVE_LIBIMOBILEDEVICE_1_1_5 + if (service) { + lockdownd_service_descriptor_free(service); + } + service = NULL; +#else + service = 0; +#endif + if ((lockdownd_start_service(client, "com.apple.afc", &service) != LOCKDOWN_E_SUCCESS) || !service) { fprintf(stderr, "Could not start com.apple.afc!\n"); free(copy_path); goto leave_cleanup; @@ -1023,7 +1047,7 @@ run_again: lockdownd_client_free(client); client = NULL; - if (afc_client_new(phone, port, &afc) != INSTPROXY_E_SUCCESS) { + if (afc_client_new(phone, service, &afc) != INSTPROXY_E_SUCCESS) { fprintf(stderr, "Could not connect to AFC!\n"); goto leave_cleanup; } |