diff options
| author | 2008-10-30 19:58:49 +0100 | |
|---|---|---|
| committer | 2008-10-30 20:00:55 +0100 | |
| commit | e46784e5cfe7dbf760d9ab3c0a31c95305a86808 (patch) | |
| tree | 3369724dd04d741fe5751a8157b799382183f42d /src/lckdclient.c | |
| parent | 41778c3dcd0bf0ede8f526d9045a023a9188d455 (diff) | |
| download | libimobiledevice-e46784e5cfe7dbf760d9ab3c0a31c95305a86808.tar.gz libimobiledevice-e46784e5cfe7dbf760d9ab3c0a31c95305a86808.tar.bz2 | |
move dev specific tools to dev/ subdir.
update autoconf files accordingly
Diffstat (limited to 'src/lckdclient.c')
| -rw-r--r-- | src/lckdclient.c | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/src/lckdclient.c b/src/lckdclient.c deleted file mode 100644 index b3b9942..0000000 --- a/src/lckdclient.c +++ /dev/null | |||
| @@ -1,103 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * lckdclient.c | ||
| 3 | * Rudimentary command line interface to the Lockdown protocol | ||
| 4 | * | ||
| 5 | * Copyright (c) 2008 Jonathan Beck All Rights Reserved. | ||
| 6 | * | ||
| 7 | * This library is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU Lesser General Public | ||
| 9 | * License as published by the Free Software Foundation; either | ||
| 10 | * version 2.1 of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This library is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 15 | * Lesser General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU Lesser General Public | ||
| 18 | * License along with this library; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include <stdio.h> | ||
| 23 | #include <string.h> | ||
| 24 | #include <glib.h> | ||
| 25 | #include <readline/readline.h> | ||
| 26 | #include <readline/history.h> | ||
| 27 | |||
| 28 | |||
| 29 | #include "usbmux.h" | ||
| 30 | #include "iphone.h" | ||
| 31 | #include <libiphone/libiphone.h> | ||
| 32 | |||
| 33 | |||
| 34 | int main(int argc, char *argv[]) | ||
| 35 | { | ||
| 36 | int bytes = 0, port = 0, i = 0; | ||
| 37 | iphone_lckd_client_t control = NULL; | ||
| 38 | iphone_device_t phone = NULL; | ||
| 39 | |||
| 40 | iphone_set_debug(1); | ||
| 41 | |||
| 42 | if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) { | ||
| 43 | printf("No iPhone found, is it plugged in?\n"); | ||
| 44 | return -1; | ||
| 45 | } | ||
| 46 | |||
| 47 | if (IPHONE_E_SUCCESS != iphone_lckd_new_client(phone, &control)) { | ||
| 48 | iphone_free_device(phone); | ||
| 49 | return -1; | ||
| 50 | } | ||
| 51 | |||
| 52 | char *uid = NULL; | ||
| 53 | if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(control, &uid)) { | ||
| 54 | printf("DeviceUniqueID : %s\n", uid); | ||
| 55 | free(uid); | ||
| 56 | } | ||
| 57 | |||
| 58 | using_history(); | ||
| 59 | int loop = TRUE; | ||
| 60 | while (loop) { | ||
| 61 | char *cmd = readline("> "); | ||
| 62 | if (cmd) { | ||
| 63 | |||
| 64 | gchar **args = g_strsplit(cmd, " ", 0); | ||
| 65 | |||
| 66 | int len = 0; | ||
| 67 | if (args) { | ||
| 68 | while (*(args + len)) { | ||
| 69 | g_strstrip(*(args + len)); | ||
| 70 | len++; | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | if (len > 0) { | ||
| 75 | add_history(cmd); | ||
| 76 | if (!strcmp(*args, "quit")) | ||
| 77 | loop = FALSE; | ||
| 78 | |||
| 79 | if (!strcmp(*args, "get") && len == 3) { | ||
| 80 | char *value = NULL; | ||
| 81 | if (IPHONE_E_SUCCESS == lockdownd_generic_get_value(control, *(args + 1), *(args + 2), &value)) | ||
| 82 | printf("Success : value = %s\n", value); | ||
| 83 | else | ||
| 84 | printf("Error\n"); | ||
| 85 | } | ||
| 86 | |||
| 87 | if (!strcmp(*args, "start") && len == 2) { | ||
| 88 | int port = 0; | ||
| 89 | iphone_lckd_start_service(control, *(args + 1), &port); | ||
| 90 | printf("%i\n", port); | ||
| 91 | } | ||
| 92 | } | ||
| 93 | g_strfreev(args); | ||
| 94 | } | ||
| 95 | free(cmd); | ||
| 96 | cmd = NULL; | ||
| 97 | } | ||
| 98 | clear_history(); | ||
| 99 | iphone_lckd_free_client(control); | ||
| 100 | iphone_free_device(phone); | ||
| 101 | |||
| 102 | return 0; | ||
| 103 | } | ||
