summaryrefslogtreecommitdiffstats
path: root/dev
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2009-07-25 02:40:25 +0200
committerGravatar Martin Szulecki2009-07-25 02:40:25 +0200
commitf5e9d76ebd74999512ab73f44fabba86879b1c1f (patch)
tree9e01e1b8bda52c04c31c5334805a530403713e08 /dev
parentd11abfb48218a37d9c66831ebec8b0a736d5385f (diff)
downloadlibimobiledevice-f5e9d76ebd74999512ab73f44fabba86879b1c1f.tar.gz
libimobiledevice-f5e9d76ebd74999512ab73f44fabba86879b1c1f.tar.bz2
Update lockdown API and introduce new error codes
Diffstat (limited to 'dev')
-rw-r--r--dev/afccheck.c9
-rw-r--r--dev/iphone_id.c6
-rw-r--r--dev/iphoneinfo.c6
-rw-r--r--dev/lckdclient.c15
-rw-r--r--dev/main.c6
-rw-r--r--dev/msyncclient.c4
-rw-r--r--dev/syslog_relay.c6
7 files changed, 28 insertions, 24 deletions
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[])
104 return 1; 104 return 1;
105 } 105 }
106 106
107 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 107 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
108 iphone_free_device(phone); 108 iphone_free_device(phone);
109 return 1; 109 return 1;
110 } 110 }
111 111
112 if (IPHONE_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) { 112 if (LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, "com.apple.afc", &port) && !port) {
113 lockdownd_free_client(client); 113 lockdownd_client_free(client);
114 iphone_free_device(phone); 114 iphone_free_device(phone);
115 fprintf(stderr, "Something went wrong when starting AFC."); 115 fprintf(stderr, "Something went wrong when starting AFC.");
116 return 1; 116 return 1;
@@ -136,8 +136,7 @@ int main(int argc, char *argv[])
136 g_thread_join(threads[i]); 136 g_thread_join(threads[i]);
137 } 137 }
138 138
139 139 lockdownd_client_free(client);
140 lockdownd_free_client(client);
141 iphone_free_device(phone); 140 iphone_free_device(phone);
142 141
143 return 0; 142 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)
68 return -2; 68 return -2;
69 } 69 }
70 70
71 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 71 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
72 iphone_free_device(phone); 72 iphone_free_device(phone);
73 fprintf(stderr, "ERROR: Connecting to device failed!\n"); 73 fprintf(stderr, "ERROR: Connecting to device failed!\n");
74 return -2; 74 return -2;
75 } 75 }
76 76
77 if ((IPHONE_E_SUCCESS != lockdownd_get_device_name(client, &devname)) || !devname) { 77 if ((LOCKDOWN_E_SUCCESS != lockdownd_get_device_name(client, &devname)) || !devname) {
78 fprintf(stderr, "ERROR: Could not get device name!\n"); 78 fprintf(stderr, "ERROR: Could not get device name!\n");
79 ret = -2; 79 ret = -2;
80 } 80 }
81 81
82 lockdownd_free_client(client); 82 lockdownd_client_free(client);
83 iphone_free_device(phone); 83 iphone_free_device(phone);
84 84
85 if (ret == 0) { 85 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[])
136 } 136 }
137 } 137 }
138 138
139 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 139 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
140 iphone_free_device(phone); 140 iphone_free_device(phone);
141 return -1; 141 return -1;
142 } 142 }
143 143
144 /* run query and output information */ 144 /* run query and output information */
145 if(lockdownd_get_value(client, domain, key, &node) == IPHONE_E_SUCCESS) 145 if(lockdownd_get_value(client, domain, key, &node) == LOCKDOWN_E_SUCCESS)
146 { 146 {
147 if (plist_get_node_type(node) == PLIST_DICT) { 147 if (plist_get_node_type(node) == PLIST_DICT) {
148 if (plist_get_first_child(node)) 148 if (plist_get_first_child(node))
@@ -169,7 +169,7 @@ int main(int argc, char *argv[])
169 169
170 if (domain != NULL) 170 if (domain != NULL)
171 free(domain); 171 free(domain);
172 lockdownd_free_client(client); 172 lockdownd_client_free(client);
173 iphone_free_device(phone); 173 iphone_free_device(phone);
174 174
175 return 0; 175 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[])
48 if (uuid) 48 if (uuid)
49 free(uuid); 49 free(uuid);
50 50
51 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 51 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
52 iphone_free_device(phone); 52 iphone_free_device(phone);
53 return -1; 53 return -1;
54 } 54 }
@@ -76,7 +76,7 @@ int main(int argc, char *argv[])
76 76
77 if (!strcmp(*args, "get") && len >= 2) { 77 if (!strcmp(*args, "get") && len >= 2) {
78 plist_t value = NULL; 78 plist_t value = NULL;
79 if (IPHONE_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value)) 79 if (LOCKDOWN_E_SUCCESS == lockdownd_get_value(client, len == 3 ? *(args + 1):NULL, len == 3 ? *(args + 2):*(args + 1), &value))
80 { 80 {
81 char *xml = NULL; 81 char *xml = NULL;
82 uint32_t length; 82 uint32_t length;
@@ -93,8 +93,13 @@ int main(int argc, char *argv[])
93 93
94 if (!strcmp(*args, "start") && len == 2) { 94 if (!strcmp(*args, "start") && len == 2) {
95 int port = 0; 95 int port = 0;
96 lockdownd_start_service(client, *(args + 1), &port); 96 if(LOCKDOWN_E_SUCCESS == lockdownd_start_service(client, *(args + 1), &port)) {
97 printf("%i\n", port); 97 printf("started service %s on port %i\n", *(args + 1), port);
98 }
99 else
100 {
101 printf("failed to start service %s on device.\n", *(args + 1));
102 }
98 } 103 }
99 } 104 }
100 g_strfreev(args); 105 g_strfreev(args);
@@ -103,7 +108,7 @@ int main(int argc, char *argv[])
103 cmd = NULL; 108 cmd = NULL;
104 } 109 }
105 clear_history(); 110 clear_history();
106 lockdownd_free_client(client); 111 lockdownd_client_free(client);
107 iphone_free_device(phone); 112 iphone_free_device(phone);
108 113
109 return 0; 114 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[])
87 if (uuid) 87 if (uuid)
88 free(uuid); 88 free(uuid);
89 89
90 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 90 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
91 iphone_free_device(phone); 91 iphone_free_device(phone);
92 printf("Exiting.\n"); 92 printf("Exiting.\n");
93 return -1; 93 return -1;
94 } 94 }
95 95
96 char *nnn = NULL; 96 char *nnn = NULL;
97 if (IPHONE_E_SUCCESS == lockdownd_get_device_name(client, &nnn)) { 97 if (LOCKDOWN_E_SUCCESS == lockdownd_get_device_name(client, &nnn)) {
98 printf("DeviceName : %s\n", nnn); 98 printf("DeviceName : %s\n", nnn);
99 free(nnn); 99 free(nnn);
100 } 100 }
@@ -248,7 +248,7 @@ int main(int argc, char *argv[])
248 248
249 printf("All done.\n"); 249 printf("All done.\n");
250 250
251 lockdownd_free_client(client); 251 lockdownd_client_free(client);
252 iphone_free_device(phone); 252 iphone_free_device(phone);
253 253
254 return 0; 254 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[])
141 return -1; 141 return -1;
142 } 142 }
143 143
144 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 144 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
145 iphone_free_device(phone); 145 iphone_free_device(phone);
146 return -1; 146 return -1;
147 } 147 }
@@ -161,7 +161,7 @@ int main(int argc, char *argv[])
161 161
162 printf("All done.\n"); 162 printf("All done.\n");
163 163
164 lockdownd_free_client(client); 164 lockdownd_client_free(client);
165 iphone_free_device(phone); 165 iphone_free_device(phone);
166 166
167 return 0; 167 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[])
100 } 100 }
101 } 101 }
102 102
103 if (IPHONE_E_SUCCESS != lockdownd_new_client(phone, &client)) { 103 if (LOCKDOWN_E_SUCCESS != lockdownd_client_new(phone, &client)) {
104 iphone_free_device(phone); 104 iphone_free_device(phone);
105 return -1; 105 return -1;
106 } 106 }
107 107
108 /* start syslog_relay service and retrieve port */ 108 /* start syslog_relay service and retrieve port */
109 ret = lockdownd_start_service(client, "com.apple.syslog_relay", &port); 109 ret = lockdownd_start_service(client, "com.apple.syslog_relay", &port);
110 if ((ret == IPHONE_E_SUCCESS) && port) { 110 if ((ret == LOCKDOWN_E_SUCCESS) && port) {
111 lockdownd_free_client(client); 111 lockdownd_client_free(client);
112 112
113 /* connect to socket relay messages */ 113 /* connect to socket relay messages */
114 114