diff options
author | Martin Szulecki | 2009-07-07 21:02:00 +0200 |
---|---|---|
committer | Martin Szulecki | 2009-07-07 21:02:00 +0200 |
commit | 62a6f558ac7ca7a9b83c2ed810929732c02bbc9d (patch) | |
tree | 4e78a77238af4d96e00f5b16b7a276f9a7db91f1 /dev/lckdclient.c | |
parent | a1e2fec59eb7d0d2a3adbd4691b3ea2ee1302921 (diff) | |
download | libimobiledevice-62a6f558ac7ca7a9b83c2ed810929732c02bbc9d.tar.gz libimobiledevice-62a6f558ac7ca7a9b83c2ed810929732c02bbc9d.tar.bz2 |
Cleanup lockdown request API and fix docs, tools, bindings and exports
Diffstat (limited to 'dev/lckdclient.c')
-rw-r--r-- | dev/lckdclient.c | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/dev/lckdclient.c b/dev/lckdclient.c index c96f052..e197002 100644 --- a/dev/lckdclient.c +++ b/dev/lckdclient.c @@ -27,12 +27,11 @@ #include <readline/history.h> #include <libiphone/libiphone.h> - +#include <libiphone/lockdown.h> int main(int argc, char *argv[]) { - int bytes = 0, port = 0, i = 0; - iphone_lckd_client_t control = NULL; + lockdownd_client_t client = NULL; iphone_device_t phone = NULL; iphone_set_debug(1); @@ -42,13 +41,13 @@ int main(int argc, char *argv[]) return -1; } - if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) { + if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { iphone_free_device(phone); return -1; } char *uid = NULL; - if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(control, &uid)) { + if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(client, &uid)) { printf("DeviceUniqueID : %s\n", uid); free(uid); } @@ -74,17 +73,25 @@ int main(int argc, char *argv[]) if (!strcmp(*args, "quit")) loop = FALSE; - if (!strcmp(*args, "get") && len == 3) { - char *value = NULL; - if (IPHONE_E_SUCCESS == lockdownd_generic_get_value(control, *(args + 1), *(args + 2), &value)) - printf("Success : value = %s\n", value); + if (!strcmp(*args, "get") && len >= 2) { + plist_t *value = NULL; + if (IPHONE_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value)) + { + char *xml = NULL; + uint32_t length; + plist_to_xml(value, &xml, &length); + printf("Success : value = %s\n", xml); + + free(xml); + free(value); + } else printf("Error\n"); } if (!strcmp(*args, "start") && len == 2) { int port = 0; - iphone_lckd_start_service(control, *(args + 1), &port); + lockdownd_start_service(client, *(args + 1), &port); printf("%i\n", port); } } @@ -94,7 +101,7 @@ int main(int argc, char *argv[]) cmd = NULL; } clear_history(); - iphone_lckd_free_client(control); + lockdownd_free_client(client); iphone_free_device(phone); return 0; |