diff options
| author | 2009-07-07 21:02:00 +0200 | |
|---|---|---|
| committer | 2009-07-18 10:39:42 -0700 | |
| commit | b8ce722ffaeab22e141e18907c46bbed4659d857 (patch) | |
| tree | b30563dacd1ef2699fe79af9695bf237e1e688aa /dev/lckdclient.c | |
| parent | ab8e29dafc0577203e6867329b1d3ff9095a4fb2 (diff) | |
| download | libimobiledevice-b8ce722ffaeab22e141e18907c46bbed4659d857.tar.gz libimobiledevice-b8ce722ffaeab22e141e18907c46bbed4659d857.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 @@ | |||
| 27 | #include <readline/history.h> | 27 | #include <readline/history.h> |
| 28 | 28 | ||
| 29 | #include <libiphone/libiphone.h> | 29 | #include <libiphone/libiphone.h> |
| 30 | 30 | #include <libiphone/lockdown.h> | |
| 31 | 31 | ||
| 32 | int main(int argc, char *argv[]) | 32 | int main(int argc, char *argv[]) |
| 33 | { | 33 | { |
| 34 | int bytes = 0, port = 0, i = 0; | 34 | lockdownd_client_t client = NULL; |
| 35 | iphone_lckd_client_t control = NULL; | ||
| 36 | iphone_device_t phone = NULL; | 35 | iphone_device_t phone = NULL; |
| 37 | 36 | ||
| 38 | iphone_set_debug(1); | 37 | iphone_set_debug(1); |
| @@ -42,13 +41,13 @@ int main(int argc, char *argv[]) | |||
| 42 | return -1; | 41 | return -1; |
| 43 | } | 42 | } |
| 44 | 43 | ||
| 45 | if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) { | 44 | if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { |
| 46 | iphone_free_device(phone); | 45 | iphone_free_device(phone); |
| 47 | return -1; | 46 | return -1; |
| 48 | } | 47 | } |
| 49 | 48 | ||
| 50 | char *uid = NULL; | 49 | char *uid = NULL; |
| 51 | if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(control, &uid)) { | 50 | if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(client, &uid)) { |
| 52 | printf("DeviceUniqueID : %s\n", uid); | 51 | printf("DeviceUniqueID : %s\n", uid); |
| 53 | free(uid); | 52 | free(uid); |
| 54 | } | 53 | } |
| @@ -74,17 +73,25 @@ int main(int argc, char *argv[]) | |||
| 74 | if (!strcmp(*args, "quit")) | 73 | if (!strcmp(*args, "quit")) |
| 75 | loop = FALSE; | 74 | loop = FALSE; |
| 76 | 75 | ||
| 77 | if (!strcmp(*args, "get") && len == 3) { | 76 | if (!strcmp(*args, "get") && len >= 2) { |
| 78 | char *value = NULL; | 77 | plist_t *value = NULL; |
| 79 | if (IPHONE_E_SUCCESS == lockdownd_generic_get_value(control, *(args + 1), *(args + 2), &value)) | 78 | if (IPHONE_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value)) |
| 80 | printf("Success : value = %s\n", value); | 79 | { |
| 80 | char *xml = NULL; | ||
| 81 | uint32_t length; | ||
| 82 | plist_to_xml(value, &xml, &length); | ||
| 83 | printf("Success : value = %s\n", xml); | ||
| 84 | |||
| 85 | free(xml); | ||
| 86 | free(value); | ||
| 87 | } | ||
| 81 | else | 88 | else |
| 82 | printf("Error\n"); | 89 | printf("Error\n"); |
| 83 | } | 90 | } |
| 84 | 91 | ||
| 85 | if (!strcmp(*args, "start") && len == 2) { | 92 | if (!strcmp(*args, "start") && len == 2) { |
| 86 | int port = 0; | 93 | int port = 0; |
| 87 | iphone_lckd_start_service(control, *(args + 1), &port); | 94 | lockdownd_start_service(client, *(args + 1), &port); |
| 88 | printf("%i\n", port); | 95 | printf("%i\n", port); |
| 89 | } | 96 | } |
| 90 | } | 97 | } |
| @@ -94,7 +101,7 @@ int main(int argc, char *argv[]) | |||
| 94 | cmd = NULL; | 101 | cmd = NULL; |
| 95 | } | 102 | } |
| 96 | clear_history(); | 103 | clear_history(); |
| 97 | iphone_lckd_free_client(control); | 104 | lockdownd_free_client(client); |
| 98 | iphone_free_device(phone); | 105 | iphone_free_device(phone); |
| 99 | 106 | ||
| 100 | return 0; | 107 | return 0; |
