summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c44
1 files changed, 17 insertions, 27 deletions
diff --git a/src/main.c b/src/main.c
index 31c2a76..0267dee 100644
--- a/src/main.c
+++ b/src/main.c
@@ -37,37 +37,29 @@
37int debug = 1; 37int debug = 1;
38 38
39int main(int argc, char *argv[]) { 39int main(int argc, char *argv[]) {
40 /* char* host_id = NULL; */
41 iPhone *phone = get_iPhone();
42 if (argc > 1 && !strcasecmp(argv[1], "--debug")) debug = 1;
43 else debug = 0;
44 int bytes = 0, port = 0, i = 0; 40 int bytes = 0, port = 0, i = 0;
45 if (phone) printf("I got a phone.\n");
46 else { printf("oops\n"); return -1; }
47
48 lockdownd_client *control = NULL; 41 lockdownd_client *control = NULL;
49 lockdownd_init(phone, &control); 42 iPhone *phone = get_iPhone();
50 /* 43
51 lockdownd_client *control = new_lockdownd_client(phone); 44 if (argc > 1 && !strcasecmp(argv[1], "--debug")){
52 if (!lockdownd_hello(control)) { 45 debug = 1;
53 printf("Something went wrong in the lockdownd client, go take a look.\n");
54 } else { 46 } else {
55 printf("We said hello. :)\n"); 47 debug = 0;
56 } 48 }
57 49
58 printf("Now starting SSL.\n"); 50 if (!phone) {
51 printf("No iPhone found, is it plugged in?\n");
52 return -1;
53 }
59 54
60 host_id = get_host_id(); 55 if (!lockdownd_init(phone, &control)){
61 if (host_id && !lockdownd_start_SSL_session(control, host_id)) { 56 free_iPhone(phone);
62 printf("Error happened in GnuTLS...\n"); 57 return -1;
63 } else { 58 }
64 free(host_id); 59
65 host_id = NULL;*/ 60 port = lockdownd_start_service(control, "com.apple.afc");
66 printf("... we're in SSL with the phone... !?\n"); 61
67 port = lockdownd_start_service(control, "com.apple.afc");
68 //}
69 if (port) { 62 if (port) {
70 printf("Start Service successful -- connect on port %i\n", port);
71 AFClient *afc = afc_connect(phone, 3432, port); 63 AFClient *afc = afc_connect(phone, 3432, port);
72 if (afc) { 64 if (afc) {
73 char **dirs; 65 char **dirs;
@@ -139,8 +131,6 @@ int main(int argc, char *argv[]) {
139 printf("Start service failure.\n"); 131 printf("Start service failure.\n");
140 } 132 }
141 133
142 printf("All done.\n");
143
144 free_iPhone(phone); 134 free_iPhone(phone);
145 135
146 return 0; 136 return 0;