From abb74bcae219c25cffb7e30db6a34c69dcd92f0a Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 6 Jul 2009 19:38:00 +0200 Subject: API cleanup for AFC Signed-off-by: Martin Szulecki --- dev/main.c | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index c8c9dfa..fe340ff 100644 --- a/dev/main.c +++ b/dev/main.c @@ -25,6 +25,7 @@ #include #include +#include #include "../src/utils.h" void notifier(const char *notification) @@ -97,8 +98,8 @@ int main(int argc, char *argv[]) iphone_lckd_start_service(control, "com.apple.afc", &port); if (port) { - iphone_afc_client_t afc = NULL; - iphone_afc_new_client(phone, port, &afc); + afc_client_t afc = NULL; + afc_new_client(phone, port, &afc); if (afc) { iphone_lckd_start_service(control, "com.apple.mobile.notification_proxy", &npp); if (npp) { @@ -120,18 +121,18 @@ int main(int argc, char *argv[]) perform_notification(phone, control, NP_SYNC_WILL_START); - iphone_afc_open_file(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); + afc_open_file(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); if (lockfile) { printf("locking file\n"); - iphone_afc_lock_file(afc, lockfile, 2 | 4); + afc_lock_file(afc, lockfile, 2 | 4); perform_notification(phone, control, NP_SYNC_DID_START); } char **dirs = NULL; - iphone_afc_get_dir_list(afc, "/eafaedf", &dirs); + afc_get_dir_list(afc, "/eafaedf", &dirs); if (!dirs) - iphone_afc_get_dir_list(afc, "/", &dirs); + afc_get_dir_list(afc, "/", &dirs); printf("Directory time.\n"); for (i = 0; dirs[i]; i++) { printf("/%s\n", dirs[i]); @@ -140,7 +141,7 @@ int main(int argc, char *argv[]) g_strfreev(dirs); dirs = NULL; - iphone_afc_get_devinfo(afc, &dirs); + afc_get_devinfo(afc, &dirs); if (dirs) { for (i = 0; dirs[i]; i += 2) { printf("%s: %s\n", dirs[i], dirs[i + 1]); @@ -151,7 +152,7 @@ int main(int argc, char *argv[]) uint64_t my_file = 0; char **info = NULL; uint64_t fsize = 0; - if (IPHONE_E_SUCCESS == iphone_afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { + if (IPHONE_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { for (i = 0; info[i]; i += 2) { printf("%s: %s\n", info[i], info[i+1]); if (!strcmp(info[i], "st_size")) { @@ -161,58 +162,58 @@ int main(int argc, char *argv[]) } if (IPHONE_E_SUCCESS == - iphone_afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { + afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { printf("A file size: %i\n", fsize); char *file_data = (char *) malloc(sizeof(char) * fsize); - iphone_afc_read_file(afc, my_file, file_data, fsize, &bytes); + afc_read_file(afc, my_file, file_data, fsize, &bytes); if (bytes >= 0) { printf("The file's data:\n"); fwrite(file_data, 1, bytes, stdout); } printf("\nClosing my file.\n"); - iphone_afc_close_file(afc, my_file); + afc_close_file(afc, my_file); free(file_data); } else printf("couldn't open a file\n"); - iphone_afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); + afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); if (my_file) { char *outdatafile = strdup("this is a bitchin text file\n"); - iphone_afc_write_file(afc, my_file, outdatafile, strlen(outdatafile), &bytes); + afc_write_file(afc, my_file, outdatafile, strlen(outdatafile), &bytes); free(outdatafile); if (bytes > 0) printf("Wrote a surprise. ;)\n"); else printf("I wanted to write a surprise, but... :(\n"); - iphone_afc_close_file(afc, my_file); + afc_close_file(afc, my_file); } printf("Deleting a file...\n"); - bytes = iphone_afc_delete_file(afc, "/delme"); + bytes = afc_delete_file(afc, "/delme"); if (bytes) printf("Success.\n"); else printf("Failure. (expected unless you have a /delme file on your phone)\n"); printf("Renaming a file...\n"); - bytes = iphone_afc_rename_file(afc, "/renme", "/renme2"); + bytes = afc_rename_file(afc, "/renme", "/renme2"); if (bytes > 0) printf("Success.\n"); else printf("Failure. (expected unless you have a /renme file on your phone)\n"); printf("Seek & read\n"); - iphone_afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); - if (IPHONE_E_SUCCESS != iphone_afc_seek_file(afc, my_file, 5, SEEK_CUR)) + afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); + if (IPHONE_E_SUCCESS != afc_seek_file(afc, my_file, 5, SEEK_CUR)) printf("WARN: SEEK DID NOT WORK\n"); char *threeletterword = (char *) malloc(sizeof(char) * 5); - iphone_afc_read_file(afc, my_file, threeletterword, 3, &bytes); + afc_read_file(afc, my_file, threeletterword, 3, &bytes); threeletterword[3] = '\0'; if (bytes > 0) printf("Result: %s\n", threeletterword); else printf("Couldn't read!\n"); free(threeletterword); - iphone_afc_close_file(afc, my_file); + afc_close_file(afc, my_file); } if (gnp && lockfile) { @@ -245,10 +246,10 @@ int main(int argc, char *argv[]) //perform_notification(phone, control, NP_SYNC_DID_FINISH); printf("XXX unlocking file\n"); - iphone_afc_lock_file(afc, lockfile, 8 | 4); + afc_lock_file(afc, lockfile, 8 | 4); printf("XXX closing file\n"); - iphone_afc_close_file(afc, lockfile); + afc_close_file(afc, lockfile); } if (gnp) { @@ -256,7 +257,7 @@ int main(int argc, char *argv[]) gnp = NULL; } - iphone_afc_free_client(afc); + afc_free_client(afc); } else { printf("Start service failure.\n"); } -- cgit v1.1-32-gdbae From a1e2fec59eb7d0d2a3adbd4691b3ea2ee1302921 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Mon, 6 Jul 2009 19:46:35 +0200 Subject: API cleanup for NotificationProxy Signed-off-by: Martin Szulecki --- dev/main.c | 40 ++++++++++------------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index fe340ff..d39baa7 100644 --- a/dev/main.c +++ b/dev/main.c @@ -26,6 +26,7 @@ #include #include +#include #include "../src/utils.h" void notifier(const char *notification) @@ -38,16 +39,16 @@ void notifier(const char *notification) void perform_notification(iphone_device_t phone, iphone_lckd_client_t control, const char *notification) { int nport = 0; - iphone_np_client_t np; + np_client_t np; iphone_lckd_start_service(control, "com.apple.mobile.notification_proxy", &nport); if (nport) { printf("::::::::::::::: np was started ::::::::::::\n"); - iphone_np_new_client(phone, nport, &np); + np_new_client(phone, nport, &np); if (np) { printf("::::::::: PostNotification %s\n", notification); - iphone_np_post_notification(np, notification); - iphone_np_free_client(np); + np_post_notification(np, notification); + np_free_client(np); } } else { printf("::::::::::::::: np was NOT started ::::::::::::\n"); @@ -61,7 +62,7 @@ int main(int argc, char *argv[]) iphone_lckd_client_t control = NULL; iphone_device_t phone = NULL; uint64_t lockfile = 0; - iphone_np_client_t gnp = NULL; + np_client_t gnp = NULL; if (argc > 1 && !strcasecmp(argv[1], "--debug")) { iphone_set_debug(1); @@ -104,7 +105,7 @@ int main(int argc, char *argv[]) iphone_lckd_start_service(control, "com.apple.mobile.notification_proxy", &npp); if (npp) { printf("Notification Proxy started.\n"); - iphone_np_new_client(phone, npp, &gnp); + np_new_client(phone, npp, &gnp); } else { printf("ERROR: Notification proxy could not be started.\n"); } @@ -115,8 +116,8 @@ int main(int argc, char *argv[]) NP_SYNC_RESUME_REQUEST, NULL }; - iphone_np_observe_notifications(gnp, nspec); - iphone_np_set_notify_callback(gnp, notifier); + np_observe_notifications(gnp, nspec); + np_set_notify_callback(gnp, notifier); } perform_notification(phone, control, NP_SYNC_WILL_START); @@ -219,28 +220,7 @@ int main(int argc, char *argv[]) if (gnp && lockfile) { char *noti; - /* - noti = NULL; - iphone_np_get_notification(gnp, ¬i); - if (noti) { - printf("------> received notification '%s'\n", noti); - free(noti); - }*/ - printf("XXX sleeping\n"); - /*for (i = 0; i < 5; i++) { - noti = NULL; - printf("--- getting notification\n"); - iphone_np_get_notification(gnp, ¬i); - if (noti) { - printf("------> received notification '%s'\n", noti); - free(noti); - } else { - printf("---- no notification\n"); - } - sleep(1); - } - */ sleep(5); //perform_notification(phone, control, NP_SYNC_DID_FINISH); @@ -253,7 +233,7 @@ int main(int argc, char *argv[]) } if (gnp) { - iphone_np_free_client(gnp); + np_free_client(gnp); gnp = NULL; } -- cgit v1.1-32-gdbae From 62a6f558ac7ca7a9b83c2ed810929732c02bbc9d Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Tue, 7 Jul 2009 21:02:00 +0200 Subject: Cleanup lockdown request API and fix docs, tools, bindings and exports --- dev/main.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index d39baa7..cf7dbaa 100644 --- a/dev/main.c +++ b/dev/main.c @@ -23,25 +23,27 @@ #include #include #include +#include #include +#include #include #include #include "../src/utils.h" -void notifier(const char *notification) +static void notifier(const char *notification) { printf("---------------------------------------------------------\n"); printf("------> Notification received: %s\n", notification); printf("---------------------------------------------------------\n"); } -void perform_notification(iphone_device_t phone, iphone_lckd_client_t control, const char *notification) +static void perform_notification(iphone_device_t phone, lockdownd_client_t client, const char *notification) { int nport = 0; np_client_t np; - iphone_lckd_start_service(control, "com.apple.mobile.notification_proxy", &nport); + lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &nport); if (nport) { printf("::::::::::::::: np was started ::::::::::::\n"); np_new_client(phone, nport, &np); @@ -57,9 +59,10 @@ void perform_notification(iphone_device_t phone, iphone_lckd_client_t control, c int main(int argc, char *argv[]) { - int bytes = 0, port = 0, i = 0; + unsigned int bytes = 0; + int port = 0, i = 0; int npp; - iphone_lckd_client_t control = NULL; + lockdownd_client_t client = NULL; iphone_device_t phone = NULL; uint64_t lockfile = 0; np_client_t gnp = NULL; @@ -77,32 +80,32 @@ 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); printf("Exiting.\n"); 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); } char *nnn = NULL; - if (IPHONE_E_SUCCESS == lockdownd_get_device_name(control, &nnn)) { + if (IPHONE_E_SUCCESS == lockdownd_get_device_name(client, &nnn)) { printf("DeviceName : %s\n", nnn); free(nnn); } - iphone_lckd_start_service(control, "com.apple.afc", &port); + lockdownd_start_service(client, "com.apple.afc", &port); if (port) { afc_client_t afc = NULL; afc_new_client(phone, port, &afc); if (afc) { - iphone_lckd_start_service(control, "com.apple.mobile.notification_proxy", &npp); + lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); if (npp) { printf("Notification Proxy started.\n"); np_new_client(phone, npp, &gnp); @@ -120,14 +123,14 @@ int main(int argc, char *argv[]) np_set_notify_callback(gnp, notifier); } - perform_notification(phone, control, NP_SYNC_WILL_START); + perform_notification(phone, client, NP_SYNC_WILL_START); afc_open_file(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); if (lockfile) { printf("locking file\n"); afc_lock_file(afc, lockfile, 2 | 4); - perform_notification(phone, control, NP_SYNC_DID_START); + perform_notification(phone, client, NP_SYNC_DID_START); } char **dirs = NULL; @@ -164,10 +167,10 @@ int main(int argc, char *argv[]) if (IPHONE_E_SUCCESS == afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { - printf("A file size: %i\n", fsize); + printf("A file size: %llu\n", fsize); char *file_data = (char *) malloc(sizeof(char) * fsize); afc_read_file(afc, my_file, file_data, fsize, &bytes); - if (bytes >= 0) { + if (bytes > 0) { printf("The file's data:\n"); fwrite(file_data, 1, bytes, stdout); } @@ -218,8 +221,6 @@ int main(int argc, char *argv[]) } if (gnp && lockfile) { - char *noti; - printf("XXX sleeping\n"); sleep(5); @@ -244,7 +245,7 @@ int main(int argc, char *argv[]) printf("All done.\n"); - iphone_lckd_free_client(control); + lockdownd_free_client(client); iphone_free_device(phone); return 0; -- cgit v1.1-32-gdbae From 37f8ad0f3e64c23cd32c8c58636510f7964f1891 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Sun, 19 Jul 2009 20:07:21 +0200 Subject: New type afc_lock_op_t with allowed lock operations for afc_lock_file. Only non-blocking locks are supported via AFC. Signed-off-by: Martin Szulecki --- dev/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index cf7dbaa..33ebc2d 100644 --- a/dev/main.c +++ b/dev/main.c @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) afc_open_file(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); if (lockfile) { printf("locking file\n"); - afc_lock_file(afc, lockfile, 2 | 4); + afc_lock_file(afc, lockfile, AFC_LOCK_EX); perform_notification(phone, client, NP_SYNC_DID_START); } @@ -227,7 +227,7 @@ int main(int argc, char *argv[]) //perform_notification(phone, control, NP_SYNC_DID_FINISH); printf("XXX unlocking file\n"); - afc_lock_file(afc, lockfile, 8 | 4); + afc_lock_file(afc, lockfile, AFC_LOCK_UN); printf("XXX closing file\n"); afc_close_file(afc, lockfile); -- cgit v1.1-32-gdbae From f995c63e1bc56dd2d098a06f130d55334979f38f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 16:35:28 +0200 Subject: Add new NP_ITDBPREP_DID_END notification signaling music db refresh --- dev/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index 33ebc2d..b4e5c34 100644 --- a/dev/main.c +++ b/dev/main.c @@ -113,10 +113,11 @@ int main(int argc, char *argv[]) printf("ERROR: Notification proxy could not be started.\n"); } if (gnp) { - const char *nspec[4] = { + const char *nspec[5] = { NP_SYNC_CANCEL_REQUEST, NP_SYNC_SUSPEND_REQUEST, NP_SYNC_RESUME_REQUEST, + NP_ITDBPREP_DID_END, NULL }; np_observe_notifications(gnp, nspec); -- cgit v1.1-32-gdbae From 601e70e8ee757b769bdc10b16e108e846a1a0b93 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 17:46:30 +0200 Subject: Rename iphone_set_debug() to iphone_set_debug_level() and code using it --- dev/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index b4e5c34..9c8b155 100644 --- a/dev/main.c +++ b/dev/main.c @@ -68,10 +68,10 @@ int main(int argc, char *argv[]) np_client_t gnp = NULL; if (argc > 1 && !strcasecmp(argv[1], "--debug")) { - iphone_set_debug(1); + iphone_set_debug_level(1); iphone_set_debug_mask(DBGMASK_ALL); } else { - iphone_set_debug(0); + iphone_set_debug_level(0); iphone_set_debug_mask(DBGMASK_NONE); } -- cgit v1.1-32-gdbae From 19a28b0ed18c8ca2f855e7d129ddcdb8c939a707 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Fri, 24 Jul 2009 23:51:53 +0200 Subject: Use iphone_device_get_uuid() not lockdown, for less overhead where possible --- dev/main.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index 9c8b155..46c5557 100644 --- a/dev/main.c +++ b/dev/main.c @@ -80,19 +80,19 @@ int main(int argc, char *argv[]) return -1; } + char *uuid = NULL; + if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) { + printf("DeviceUniqueID : %s\n", uuid); + } + if (uuid) + free(uuid); + if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { iphone_free_device(phone); printf("Exiting.\n"); return -1; } - char *uid = NULL; - if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(client, &uid)) { - printf("DeviceUniqueID : %s\n", uid); - free(uid); - } - - char *nnn = NULL; if (IPHONE_E_SUCCESS == lockdownd_get_device_name(client, &nnn)) { printf("DeviceName : %s\n", nnn); -- cgit v1.1-32-gdbae From d11abfb48218a37d9c66831ebec8b0a736d5385f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:20:03 +0200 Subject: Update NotificationProxy API and introduce new error codes --- dev/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index 46c5557..33c60f9 100644 --- a/dev/main.c +++ b/dev/main.c @@ -46,11 +46,11 @@ static void perform_notification(iphone_device_t phone, lockdownd_client_t clien lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &nport); if (nport) { printf("::::::::::::::: np was started ::::::::::::\n"); - np_new_client(phone, nport, &np); + np_client_new(phone, nport, &np); if (np) { printf("::::::::: PostNotification %s\n", notification); np_post_notification(np, notification); - np_free_client(np); + np_client_free(np); } } else { printf("::::::::::::::: np was NOT started ::::::::::::\n"); @@ -108,7 +108,7 @@ int main(int argc, char *argv[]) lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); if (npp) { printf("Notification Proxy started.\n"); - np_new_client(phone, npp, &gnp); + np_client_new(phone, npp, &gnp); } else { printf("ERROR: Notification proxy could not be started.\n"); } @@ -225,17 +225,19 @@ int main(int argc, char *argv[]) printf("XXX sleeping\n"); sleep(5); - //perform_notification(phone, control, NP_SYNC_DID_FINISH); - printf("XXX unlocking file\n"); afc_lock_file(afc, lockfile, AFC_LOCK_UN); printf("XXX closing file\n"); afc_close_file(afc, lockfile); + + printf("XXX sleeping\n"); + sleep(5); + //perform_notification(phone, client, NP_SYNC_DID_FINISH); } if (gnp) { - np_free_client(gnp); + np_client_free(gnp); gnp = NULL; } -- cgit v1.1-32-gdbae From f5e9d76ebd74999512ab73f44fabba86879b1c1f Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:40:25 +0200 Subject: Update lockdown API and introduce new error codes --- dev/main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index 33c60f9..69b0b80 100644 --- a/dev/main.c +++ b/dev/main.c @@ -87,14 +87,14 @@ int main(int argc, char *argv[]) if (uuid) free(uuid); - if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { iphone_free_device(phone); printf("Exiting.\n"); return -1; } char *nnn = NULL; - if (IPHONE_E_SUCCESS == lockdownd_get_device_name(client, &nnn)) { + if (LOCKDOWN_E_SUCCESS == lockdownd_get_device_name(client, &nnn)) { printf("DeviceName : %s\n", nnn); free(nnn); } @@ -248,7 +248,7 @@ int main(int argc, char *argv[]) printf("All done.\n"); - lockdownd_free_client(client); + lockdownd_client_free(client); iphone_free_device(phone); return 0; -- cgit v1.1-32-gdbae From 5cb9ecc85240102402082c442d561d7350732027 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 02:54:40 +0200 Subject: Follow glib style and rename iphone_free_device to iphone_device_free --- dev/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index 69b0b80..5551ed9 100644 --- a/dev/main.c +++ b/dev/main.c @@ -88,7 +88,7 @@ int main(int argc, char *argv[]) free(uuid); if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { - iphone_free_device(phone); + iphone_device_free(phone); printf("Exiting.\n"); return -1; } @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) printf("All done.\n"); lockdownd_client_free(client); - iphone_free_device(phone); + iphone_device_free(phone); return 0; } -- cgit v1.1-32-gdbae From 50be30047dbb0d38fd8d61763c13ec75d2b52543 Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Sat, 25 Jul 2009 03:26:39 +0200 Subject: Update AFC API and use error codes from the STATUS operation response --- dev/main.c | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'dev/main.c') diff --git a/dev/main.c b/dev/main.c index 5551ed9..3e5860e 100644 --- a/dev/main.c +++ b/dev/main.c @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) if (port) { afc_client_t afc = NULL; - afc_new_client(phone, port, &afc); + afc_client_new(phone, port, &afc); if (afc) { lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); if (npp) { @@ -126,18 +126,18 @@ int main(int argc, char *argv[]) perform_notification(phone, client, NP_SYNC_WILL_START); - afc_open_file(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); + afc_file_open(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); if (lockfile) { printf("locking file\n"); - afc_lock_file(afc, lockfile, AFC_LOCK_EX); + afc_file_lock(afc, lockfile, AFC_LOCK_EX); perform_notification(phone, client, NP_SYNC_DID_START); } char **dirs = NULL; - afc_get_dir_list(afc, "/eafaedf", &dirs); + afc_read_directory(afc, "/eafaedf", &dirs); if (!dirs) - afc_get_dir_list(afc, "/", &dirs); + afc_read_directory(afc, "/", &dirs); printf("Directory time.\n"); for (i = 0; dirs[i]; i++) { printf("/%s\n", dirs[i]); @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) g_strfreev(dirs); dirs = NULL; - afc_get_devinfo(afc, &dirs); + afc_get_device_info(afc, &dirs); if (dirs) { for (i = 0; dirs[i]; i += 2) { printf("%s: %s\n", dirs[i], dirs[i + 1]); @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) uint64_t my_file = 0; char **info = NULL; uint64_t fsize = 0; - if (IPHONE_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { + if (AFC_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { for (i = 0; info[i]; i += 2) { printf("%s: %s\n", info[i], info[i+1]); if (!strcmp(info[i], "st_size")) { @@ -166,59 +166,59 @@ int main(int argc, char *argv[]) } } - if (IPHONE_E_SUCCESS == - afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { + if (AFC_E_SUCCESS == + afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { printf("A file size: %llu\n", fsize); char *file_data = (char *) malloc(sizeof(char) * fsize); - afc_read_file(afc, my_file, file_data, fsize, &bytes); + afc_file_read(afc, my_file, file_data, fsize, &bytes); if (bytes > 0) { printf("The file's data:\n"); fwrite(file_data, 1, bytes, stdout); } printf("\nClosing my file.\n"); - afc_close_file(afc, my_file); + afc_file_close(afc, my_file); free(file_data); } else printf("couldn't open a file\n"); - afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); + afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); if (my_file) { char *outdatafile = strdup("this is a bitchin text file\n"); - afc_write_file(afc, my_file, outdatafile, strlen(outdatafile), &bytes); + afc_file_write(afc, my_file, outdatafile, strlen(outdatafile), &bytes); free(outdatafile); if (bytes > 0) printf("Wrote a surprise. ;)\n"); else printf("I wanted to write a surprise, but... :(\n"); - afc_close_file(afc, my_file); + afc_file_close(afc, my_file); } printf("Deleting a file...\n"); - bytes = afc_delete_file(afc, "/delme"); + bytes = afc_remove_path(afc, "/delme"); if (bytes) printf("Success.\n"); else printf("Failure. (expected unless you have a /delme file on your phone)\n"); printf("Renaming a file...\n"); - bytes = afc_rename_file(afc, "/renme", "/renme2"); + bytes = afc_rename_path(afc, "/renme", "/renme2"); if (bytes > 0) printf("Success.\n"); else printf("Failure. (expected unless you have a /renme file on your phone)\n"); printf("Seek & read\n"); - afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); - if (IPHONE_E_SUCCESS != afc_seek_file(afc, my_file, 5, SEEK_CUR)) + afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); + if (AFC_E_SUCCESS != afc_file_seek(afc, my_file, 5, SEEK_CUR)) printf("WARN: SEEK DID NOT WORK\n"); char *threeletterword = (char *) malloc(sizeof(char) * 5); - afc_read_file(afc, my_file, threeletterword, 3, &bytes); + afc_file_read(afc, my_file, threeletterword, 3, &bytes); threeletterword[3] = '\0'; if (bytes > 0) printf("Result: %s\n", threeletterword); else printf("Couldn't read!\n"); free(threeletterword); - afc_close_file(afc, my_file); + afc_file_close(afc, my_file); } if (gnp && lockfile) { @@ -226,10 +226,10 @@ int main(int argc, char *argv[]) sleep(5); printf("XXX unlocking file\n"); - afc_lock_file(afc, lockfile, AFC_LOCK_UN); + afc_file_lock(afc, lockfile, AFC_LOCK_UN); printf("XXX closing file\n"); - afc_close_file(afc, lockfile); + afc_file_close(afc, lockfile); printf("XXX sleeping\n"); sleep(5); @@ -241,7 +241,7 @@ int main(int argc, char *argv[]) gnp = NULL; } - afc_free_client(afc); + afc_client_free(afc); } else { printf("Start service failure.\n"); } -- cgit v1.1-32-gdbae