summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
authorGravatar Matt Colyer2009-07-26 19:34:22 -0700
committerGravatar Matt Colyer2009-07-26 19:34:22 -0700
commiteea538c94f01f8054f69f059614f19400187a472 (patch)
tree209a12dc8c8eaece15b8153d15e689c8c2147ab6 /dev
parent8ebfd7d8eea89bb27e4e6dbb1f37fd90d98b439c (diff)
parent19c9750d670435ce430f0fc85a55faf127bdfbf9 (diff)
downloadlibimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.gz
libimobiledevice-eea538c94f01f8054f69f059614f19400187a472.tar.bz2
Merge commit 'martin-s/martin'
[#46 state:resolved]
Diffstat (limited to 'dev')
-rw-r--r--dev/afccheck.c46
-rw-r--r--dev/iphone_id.c12
-rw-r--r--dev/iphoneinfo.c105
-rw-r--r--dev/lckdclient.c32
-rw-r--r--dev/main.c89
-rw-r--r--dev/msyncclient.c20
-rw-r--r--dev/syslog_relay.c17
7 files changed, 150 insertions, 171 deletions
diff --git a/dev/afccheck.c b/dev/afccheck.c
index cf75e71..b3fa102 100644
--- a/dev/afccheck.c
+++ b/dev/afccheck.c
@@ -45,6 +45,8 @@ static void check_afc(gpointer data)
int *buf = (int *) malloc(buffersize);
int *buf2 = (int *) malloc(buffersize);
unsigned int bytes = 0;
+ uint64_t position = 0;
+
//fill buffer
int i = 0;
for (i = 0; i < BUFFER_SIZE; i++) {
@@ -55,19 +57,22 @@ static void check_afc(gpointer data)
uint64_t file = 0;
char path[50];
sprintf(path, "/Buf%i", ((param *) data)->id);
- afc_open_file(((param *) data)->afc, path, AFC_FOPEN_RW, &file);
- afc_write_file(((param *) data)->afc, file, (char *) buf, buffersize, &bytes);
- afc_close_file(((param *) data)->afc, file);
+ afc_file_open(((param *) data)->afc, path, AFC_FOPEN_RW, &file);
+ afc_file_write(((param *) data)->afc, file, (char *) buf, buffersize, &bytes);
+ afc_file_close(((param *) data)->afc, file);
file = 0;
if (bytes != buffersize)
printf("Write operation failed\n");
//now read it
bytes = 0;
- afc_open_file(((param *) data)->afc, path, AFC_FOPEN_RDONLY, &file);
- afc_read_file(((param *) data)->afc, file, (char *) buf2, buffersize, &bytes);
- afc_close_file(((param *) data)->afc, file);
- if (bytes != buffersize)
+ afc_file_open(((param *) data)->afc, path, AFC_FOPEN_RDONLY, &file);
+ afc_file_read(((param *) data)->afc, file, (char *) buf2, buffersize/2, &bytes);
+ afc_file_read(((param *) data)->afc, file, (char *) buf2 + (buffersize/2), buffersize/2, &bytes);
+ if(AFC_E_SUCCESS != afc_file_tell(((param *) data)->afc, file, &position))
+ printf("Tell operation failed\n");
+ afc_file_close(((param *) data)->afc, file);
+ if (position != buffersize)
printf("Read operation failed\n");
//compare buffers
@@ -79,7 +84,7 @@ static void check_afc(gpointer data)
}
//cleanup
- afc_delete_file(((param *) data)->afc, path);
+ afc_remove_path(((param *) data)->afc, path);
g_thread_exit(0);
}
@@ -91,24 +96,32 @@ int main(int argc, char *argv[])
int port = 0;
afc_client_t afc = NULL;
+ if (argc > 1 && !strcasecmp(argv[1], "--debug")) {
+ iphone_set_debug_level(1);
+ iphone_set_debug_mask(DBGMASK_ALL);
+ } else {
+ iphone_set_debug_level(0);
+ iphone_set_debug_mask(DBGMASK_NONE);
+ }
+
if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) {
printf("No iPhone found, is it plugged in?\n");
return 1;
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(phone);
return 1;
}
- if (IPHONE_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) {
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) {
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
fprintf(stderr, "Something went wrong when starting AFC.");
return 1;
}
- afc_new_client(phone, port, &afc);
+ afc_client_new(phone, port, &afc);
//makes sure thread environment is available
if (!g_thread_supported())
@@ -128,9 +141,8 @@ int main(int argc, char *argv[])
g_thread_join(threads[i]);
}
-
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
return 0;
}
diff --git a/dev/iphone_id.c b/dev/iphone_id.c
index 15081f0..f68fc8b 100644
--- a/dev/iphone_id.c
+++ b/dev/iphone_id.c
@@ -60,7 +60,7 @@ int main(int argc, char **argv)
return 0;
}
- iphone_set_debug(0);
+ iphone_set_debug_level(0);
iphone_get_device_by_uuid(&phone, argv[0]);
if (!phone) {
@@ -68,19 +68,19 @@ int main(int argc, char **argv)
return -2;
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(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);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
if (ret == 0) {
printf("%s\n", devname);
diff --git a/dev/iphoneinfo.c b/dev/iphoneinfo.c
index 9d690f9..7e275b2 100644
--- a/dev/iphoneinfo.c
+++ b/dev/iphoneinfo.c
@@ -51,7 +51,6 @@ static const char *domains[] = {
int is_domain_known(char *domain);
void print_usage(int argc, char **argv);
-void print_lckd_request_result(lockdownd_client_t client, const char *domain, const char *request, const char *key, int format);
void plist_node_to_string(plist_t *node);
void plist_children_to_string(plist_t *node);
@@ -65,13 +64,16 @@ int main(int argc, char *argv[])
char uuid[41];
char *domain = NULL;
char *key = NULL;
+ char *xml_doc = NULL;
+ uint32_t xml_length;
+ plist_t node = NULL;
uuid[0] = 0;
/* parse cmdline args */
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
iphone_set_debug_mask(DBGMASK_ALL);
- iphone_set_debug(1);
+ iphone_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -134,18 +136,41 @@ int main(int argc, char *argv[])
}
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(phone);
return -1;
}
/* run query and output information */
- print_lckd_request_result(client, domain, "GetValue", key, format);
+ 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))
+ {
+ switch (format) {
+ case FORMAT_XML:
+ plist_to_xml(node, &xml_doc, &xml_length);
+ printf(xml_doc);
+ free(xml_doc);
+ break;
+ case FORMAT_KEY_VALUE:
+ default:
+ plist_children_to_string(node);
+ break;
+ }
+ }
+ }
+ else if(node && (key != NULL))
+ plist_node_to_string(node);
+ if (node)
+ plist_free(node);
+ node = NULL;
+ }
if (domain != NULL)
free(domain);
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
return 0;
}
@@ -254,69 +279,3 @@ void plist_children_to_string(plist_t *node)
}
}
-void print_lckd_request_result(lockdownd_client_t client, const char *domain, const char *request, const char *key, int format) {
- char *xml_doc = NULL;
- char *s = NULL;
- uint32_t xml_length = 0;
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
-
- plist_t node = plist_new_dict();
- if (domain) {
- plist_add_sub_key_el(node, "Domain");
- plist_add_sub_string_el(node, domain);
- }
- if (key) {
- plist_add_sub_key_el(node, "Key");
- plist_add_sub_string_el(node, key);
- }
- plist_add_sub_key_el(node, "Request");
- plist_add_sub_string_el(node, request);
-
- ret = lockdownd_send(client, node);
- if (ret == IPHONE_E_SUCCESS) {
- plist_free(node);
- node = NULL;
- ret = lockdownd_recv(client, &node);
- if (ret == IPHONE_E_SUCCESS) {
- /* seek to value node */
- for (
- node = plist_get_first_child(node);
- node != NULL;
- node = plist_get_next_sibling(node)
- ) {
- if(plist_get_node_type(node) == PLIST_KEY)
- {
- plist_get_key_val(node, &s);
-
- if (strcmp("Value", s))
- continue;
-
- node = plist_get_next_sibling(node);
-
- if (plist_get_node_type(node) == PLIST_DICT) {
- if (plist_get_first_child(node))
- {
- switch (format) {
- case FORMAT_XML:
- plist_to_xml(node, &xml_doc, &xml_length);
- printf(xml_doc);
- free(xml_doc);
- break;
- case FORMAT_KEY_VALUE:
- default:
- plist_children_to_string(node);
- break;
- }
- }
- }
- else if(node && (key != NULL))
- plist_node_to_string(node);
- }
- }
- }
- }
- if (node)
- plist_free(node);
- node = NULL;
-}
-
diff --git a/dev/lckdclient.c b/dev/lckdclient.c
index e7ad962..b880253 100644
--- a/dev/lckdclient.c
+++ b/dev/lckdclient.c
@@ -34,22 +34,23 @@ int main(int argc, char *argv[])
lockdownd_client_t client = NULL;
iphone_device_t phone = NULL;
- iphone_set_debug(1);
+ iphone_set_debug_level(1);
if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) {
printf("No iPhone found, is it plugged in?\n");
return -1;
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
- return -1;
+ char *uuid = NULL;
+ if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) {
+ printf("DeviceUniqueID : %s\n", uuid);
}
+ if (uuid)
+ free(uuid);
- char *uid = NULL;
- if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(client, &uid)) {
- printf("DeviceUniqueID : %s\n", uid);
- free(uid);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(phone);
+ return -1;
}
using_history();
@@ -75,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;
@@ -92,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);
@@ -102,8 +108,8 @@ int main(int argc, char *argv[])
cmd = NULL;
}
clear_history();
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
return 0;
}
diff --git a/dev/main.c b/dev/main.c
index f2d72b1..eb74c89 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");
@@ -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);
}
@@ -80,21 +80,21 @@ int main(int argc, char *argv[])
return -1;
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
- printf("Exiting.\n");
- return -1;
+ char *uuid = NULL;
+ if (IPHONE_E_SUCCESS == iphone_device_get_uuid(phone, &uuid)) {
+ printf("DeviceUniqueID : %s\n", uuid);
}
+ if (uuid)
+ free(uuid);
- char *uid = NULL;
- if (IPHONE_E_SUCCESS == lockdownd_get_device_uid(client, &uid)) {
- printf("DeviceUniqueID : %s\n", uid);
- free(uid);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(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);
}
@@ -103,20 +103,21 @@ 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) {
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");
}
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);
@@ -125,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, 2 | 4);
+ 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]);
@@ -145,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]);
@@ -156,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")) {
@@ -165,88 +166,90 @@ int main(int argc, char *argv[])
}
}
- if (IPHONE_E_SUCCESS ==
+ if (AFC_E_SUCCESS ==
afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) {
printf("A file size: %llu\n", (long long)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) {
printf("XXX sleeping\n");
sleep(5);
- //perform_notification(phone, control, NP_SYNC_DID_FINISH);
-
printf("XXX unlocking file\n");
- afc_lock_file(afc, lockfile, 8 | 4);
+ 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);
+ //perform_notification(phone, client, NP_SYNC_DID_FINISH);
}
if (gnp) {
- np_free_client(gnp);
+ np_client_free(gnp);
gnp = NULL;
}
- afc_free_client(afc);
+ afc_client_free(afc);
} else {
printf("Start service failure.\n");
}
printf("All done.\n");
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
return 0;
}
diff --git a/dev/msyncclient.c b/dev/msyncclient.c
index 5eb105d..5fffe7a 100644
--- a/dev/msyncclient.c
+++ b/dev/msyncclient.c
@@ -28,12 +28,12 @@
#include <libiphone/lockdown.h>
#include <libiphone/mobilesync.h>
-static iphone_error_t mobilesync_get_all_contacts(mobilesync_client_t client)
+static mobilesync_error_t mobilesync_get_all_contacts(mobilesync_client_t client)
{
if (!client)
- return IPHONE_E_INVALID_ARG;
+ return MOBILESYNC_E_INVALID_ARG;
- iphone_error_t ret = IPHONE_E_UNKNOWN_ERROR;
+ mobilesync_error_t ret = MOBILESYNC_E_UNKNOWN_ERROR;
plist_t array = NULL;
array = plist_new_array();
@@ -124,7 +124,6 @@ static iphone_error_t mobilesync_get_all_contacts(mobilesync_client_t client)
plist_free(array);
array = NULL;
-
return ret;
}
@@ -137,14 +136,13 @@ int main(int argc, char *argv[])
if (argc > 1 && !strcasecmp(argv[1], "--debug"))
iphone_set_debug_mask(DBGMASK_MOBILESYNC);
-
if (IPHONE_E_SUCCESS != iphone_get_device(&phone)) {
printf("No iPhone found, is it plugged in?\n");
return -1;
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(phone);
return -1;
}
@@ -152,10 +150,10 @@ int main(int argc, char *argv[])
if (port) {
mobilesync_client_t msync = NULL;
- mobilesync_new_client(phone, port, &msync);
+ mobilesync_client_new(phone, port, &msync);
if (msync) {
mobilesync_get_all_contacts(msync);
- mobilesync_free_client(msync);
+ mobilesync_client_free(msync);
}
} else {
printf("Start service failure.\n");
@@ -163,8 +161,8 @@ int main(int argc, char *argv[])
printf("All done.\n");
- lockdownd_free_client(client);
- iphone_free_device(phone);
+ lockdownd_client_free(client);
+ iphone_device_free(phone);
return 0;
}
diff --git a/dev/syslog_relay.c b/dev/syslog_relay.c
index a93e85b..a096101 100644
--- a/dev/syslog_relay.c
+++ b/dev/syslog_relay.c
@@ -52,6 +52,7 @@ int main(int argc, char *argv[])
char uuid[41];
int port = 0;
uuid[0] = 0;
+ uint32_t handle = 0;
signal(SIGINT, clean_exit);
signal(SIGQUIT, clean_exit);
@@ -62,7 +63,7 @@ int main(int argc, char *argv[])
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-d") || !strcmp(argv[i], "--debug")) {
iphone_set_debug_mask(DBGMASK_ALL);
- iphone_set_debug(1);
+ iphone_set_debug_level(1);
continue;
}
else if (!strcmp(argv[i], "-u") || !strcmp(argv[i], "--uuid")) {
@@ -100,19 +101,19 @@ int main(int argc, char *argv[])
}
}
- if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) {
- iphone_free_device(phone);
+ if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
+ iphone_device_free(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 */
-
- int sfd = usbmuxd_connect(iphone_get_device_handle(phone), port);
+ iphone_device_get_handle(phone, &handle);
+ int sfd = usbmuxd_connect(handle, port);
if (sfd < 0) {
printf("ERROR: Could not open usbmux connection.\n");
} else {
@@ -148,7 +149,7 @@ int main(int argc, char *argv[])
printf("ERROR: Could not start service com.apple.syslog_relay.\n");
}
- iphone_free_device(phone);
+ iphone_device_free(phone);
return 0;
}