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/afccheck.c | 9 ++++----- dev/iphone_id.c | 6 +++--- dev/iphoneinfo.c | 6 +++--- dev/lckdclient.c | 15 ++++++++++----- dev/main.c | 6 +++--- dev/msyncclient.c | 4 ++-- dev/syslog_relay.c | 6 +++--- 7 files changed, 28 insertions(+), 24 deletions(-) (limited to 'dev') diff --git a/dev/afccheck.c b/dev/afccheck.c index 0525417..370742b 100644 --- a/dev/afccheck.c +++ b/dev/afccheck.c @@ -104,13 +104,13 @@ int main(int argc, char *argv[]) return 1; } - if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { iphone_free_device(phone); return 1; } - if (IPHONE_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) { - lockdownd_free_client(client); + if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) { + lockdownd_client_free(client); iphone_free_device(phone); fprintf(stderr, "Something went wrong when starting AFC."); return 1; @@ -136,8 +136,7 @@ int main(int argc, char *argv[]) g_thread_join(threads[i]); } - - lockdownd_free_client(client); + lockdownd_client_free(client); iphone_free_device(phone); return 0; diff --git a/dev/iphone_id.c b/dev/iphone_id.c index dde15bc..1b8f8a1 100644 --- a/dev/iphone_id.c +++ b/dev/iphone_id.c @@ -68,18 +68,18 @@ int main(int argc, char **argv) return -2; } - if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { iphone_free_device(phone); fprintf(stderr, "ERROR: Connecting to device failed!\n"); return -2; } - if ((IPHONE_E_SUCCESS != lockdownd_get_device_name(client, &devname)) || !devname) { + if ((LOCKDOWN_E_SUCCESS != lockdownd_get_device_name(client, &devname)) || !devname) { fprintf(stderr, "ERROR: Could not get device name!\n"); ret = -2; } - lockdownd_free_client(client); + lockdownd_client_free(client); iphone_free_device(phone); if (ret == 0) { diff --git a/dev/iphoneinfo.c b/dev/iphoneinfo.c index 02b62d5..52d7c8a 100644 --- a/dev/iphoneinfo.c +++ b/dev/iphoneinfo.c @@ -136,13 +136,13 @@ int main(int argc, char *argv[]) } } - if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { iphone_free_device(phone); return -1; } /* run query and output information */ - if(lockdownd_get_value(client, domain, key, &node) == IPHONE_E_SUCCESS) + if(lockdownd_get_value(client, domain, key, &node) == LOCKDOWN_E_SUCCESS) { if (plist_get_node_type(node) == PLIST_DICT) { if (plist_get_first_child(node)) @@ -169,7 +169,7 @@ int main(int argc, char *argv[]) if (domain != NULL) free(domain); - lockdownd_free_client(client); + lockdownd_client_free(client); iphone_free_device(phone); return 0; diff --git a/dev/lckdclient.c b/dev/lckdclient.c index 9518a6e..4dcb0b4 100644 --- a/dev/lckdclient.c +++ b/dev/lckdclient.c @@ -48,7 +48,7 @@ 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); return -1; } @@ -76,7 +76,7 @@ int main(int argc, char *argv[]) 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)) + if (LOCKDOWN_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value)) { char *xml = NULL; uint32_t length; @@ -93,8 +93,13 @@ int main(int argc, char *argv[]) if (!strcmp(*args, "start") && len == 2) { int port = 0; - lockdownd_start_service(client, *(args + 1), &port); - printf("%i\n", port); + if(LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, *(args + 1), &port)) { + printf("started service %s on port %i\n", *(args + 1), port); + } + else + { + printf("failed to start service %s on device.\n", *(args + 1)); + } } } g_strfreev(args); @@ -103,7 +108,7 @@ int main(int argc, char *argv[]) cmd = NULL; } clear_history(); - lockdownd_free_client(client); + lockdownd_client_free(client); iphone_free_device(phone); return 0; 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; diff --git a/dev/msyncclient.c b/dev/msyncclient.c index 7651002..6ab7c79 100644 --- a/dev/msyncclient.c +++ b/dev/msyncclient.c @@ -141,7 +141,7 @@ int main(int argc, char *argv[]) return -1; } - if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { iphone_free_device(phone); return -1; } @@ -161,7 +161,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; diff --git a/dev/syslog_relay.c b/dev/syslog_relay.c index 09be6b8..0c41c94 100644 --- a/dev/syslog_relay.c +++ b/dev/syslog_relay.c @@ -100,15 +100,15 @@ int main(int argc, char *argv[]) } } - if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { + if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) { iphone_free_device(phone); return -1; } /* start syslog_relay service and retrieve port */ ret = lockdownd_start_service(client, "com.apple.syslog_relay", &port); - if ((ret == IPHONE_E_SUCCESS) && port) { - lockdownd_free_client(client); + if ((ret == LOCKDOWN_E_SUCCESS) && port) { + lockdownd_client_free(client); /* connect to socket relay messages */ -- cgit v1.1-32-gdbae