diff options
Diffstat (limited to 'dev/main.c')
| -rw-r--r-- | dev/main.c | 46 |
1 files changed, 23 insertions, 23 deletions
| @@ -103,7 +103,7 @@ int main(int argc, char *argv[]) | |||
| 103 | 103 | ||
| 104 | if (port) { | 104 | if (port) { |
| 105 | afc_client_t afc = NULL; | 105 | afc_client_t afc = NULL; |
| 106 | afc_new_client(phone, port, &afc); | 106 | afc_client_new(phone, port, &afc); |
| 107 | if (afc) { | 107 | if (afc) { |
| 108 | lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); | 108 | lockdownd_start_service(client, "com.apple.mobile.notification_proxy", &npp); |
| 109 | if (npp) { | 109 | if (npp) { |
| @@ -126,18 +126,18 @@ int main(int argc, char *argv[]) | |||
| 126 | 126 | ||
| 127 | perform_notification(phone, client, NP_SYNC_WILL_START); | 127 | perform_notification(phone, client, NP_SYNC_WILL_START); |
| 128 | 128 | ||
| 129 | afc_open_file(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); | 129 | afc_file_open(afc, "/com.apple.itunes.lock_sync", AFC_FOPEN_RW, &lockfile); |
| 130 | if (lockfile) { | 130 | if (lockfile) { |
| 131 | printf("locking file\n"); | 131 | printf("locking file\n"); |
| 132 | afc_lock_file(afc, lockfile, AFC_LOCK_EX); | 132 | afc_file_lock(afc, lockfile, AFC_LOCK_EX); |
| 133 | 133 | ||
| 134 | perform_notification(phone, client, NP_SYNC_DID_START); | 134 | perform_notification(phone, client, NP_SYNC_DID_START); |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | char **dirs = NULL; | 137 | char **dirs = NULL; |
| 138 | afc_get_dir_list(afc, "/eafaedf", &dirs); | 138 | afc_read_directory(afc, "/eafaedf", &dirs); |
| 139 | if (!dirs) | 139 | if (!dirs) |
| 140 | afc_get_dir_list(afc, "/", &dirs); | 140 | afc_read_directory(afc, "/", &dirs); |
| 141 | printf("Directory time.\n"); | 141 | printf("Directory time.\n"); |
| 142 | for (i = 0; dirs[i]; i++) { | 142 | for (i = 0; dirs[i]; i++) { |
| 143 | printf("/%s\n", dirs[i]); | 143 | printf("/%s\n", dirs[i]); |
| @@ -146,7 +146,7 @@ int main(int argc, char *argv[]) | |||
| 146 | g_strfreev(dirs); | 146 | g_strfreev(dirs); |
| 147 | 147 | ||
| 148 | dirs = NULL; | 148 | dirs = NULL; |
| 149 | afc_get_devinfo(afc, &dirs); | 149 | afc_get_device_info(afc, &dirs); |
| 150 | if (dirs) { | 150 | if (dirs) { |
| 151 | for (i = 0; dirs[i]; i += 2) { | 151 | for (i = 0; dirs[i]; i += 2) { |
| 152 | printf("%s: %s\n", dirs[i], dirs[i + 1]); | 152 | printf("%s: %s\n", dirs[i], dirs[i + 1]); |
| @@ -157,7 +157,7 @@ int main(int argc, char *argv[]) | |||
| 157 | uint64_t my_file = 0; | 157 | uint64_t my_file = 0; |
| 158 | char **info = NULL; | 158 | char **info = NULL; |
| 159 | uint64_t fsize = 0; | 159 | uint64_t fsize = 0; |
| 160 | if (IPHONE_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { | 160 | if (AFC_E_SUCCESS == afc_get_file_info(afc, "/readme.libiphone.fx", &info) && info) { |
| 161 | for (i = 0; info[i]; i += 2) { | 161 | for (i = 0; info[i]; i += 2) { |
| 162 | printf("%s: %s\n", info[i], info[i+1]); | 162 | printf("%s: %s\n", info[i], info[i+1]); |
| 163 | if (!strcmp(info[i], "st_size")) { | 163 | if (!strcmp(info[i], "st_size")) { |
| @@ -166,59 +166,59 @@ int main(int argc, char *argv[]) | |||
| 166 | } | 166 | } |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | if (IPHONE_E_SUCCESS == | 169 | if (AFC_E_SUCCESS == |
| 170 | afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { | 170 | afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file) && my_file) { |
| 171 | printf("A file size: %llu\n", fsize); | 171 | printf("A file size: %llu\n", fsize); |
| 172 | char *file_data = (char *) malloc(sizeof(char) * fsize); | 172 | char *file_data = (char *) malloc(sizeof(char) * fsize); |
| 173 | afc_read_file(afc, my_file, file_data, fsize, &bytes); | 173 | afc_file_read(afc, my_file, file_data, fsize, &bytes); |
| 174 | if (bytes > 0) { | 174 | if (bytes > 0) { |
| 175 | printf("The file's data:\n"); | 175 | printf("The file's data:\n"); |
| 176 | fwrite(file_data, 1, bytes, stdout); | 176 | fwrite(file_data, 1, bytes, stdout); |
| 177 | } | 177 | } |
| 178 | printf("\nClosing my file.\n"); | 178 | printf("\nClosing my file.\n"); |
| 179 | afc_close_file(afc, my_file); | 179 | afc_file_close(afc, my_file); |
| 180 | free(file_data); | 180 | free(file_data); |
| 181 | } else | 181 | } else |
| 182 | printf("couldn't open a file\n"); | 182 | printf("couldn't open a file\n"); |
| 183 | 183 | ||
| 184 | afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); | 184 | afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_WR, &my_file); |
| 185 | if (my_file) { | 185 | if (my_file) { |
| 186 | char *outdatafile = strdup("this is a bitchin text file\n"); | 186 | char *outdatafile = strdup("this is a bitchin text file\n"); |
| 187 | afc_write_file(afc, my_file, outdatafile, strlen(outdatafile), &bytes); | 187 | afc_file_write(afc, my_file, outdatafile, strlen(outdatafile), &bytes); |
| 188 | free(outdatafile); | 188 | free(outdatafile); |
| 189 | if (bytes > 0) | 189 | if (bytes > 0) |
| 190 | printf("Wrote a surprise. ;)\n"); | 190 | printf("Wrote a surprise. ;)\n"); |
| 191 | else | 191 | else |
| 192 | printf("I wanted to write a surprise, but... :(\n"); | 192 | printf("I wanted to write a surprise, but... :(\n"); |
| 193 | afc_close_file(afc, my_file); | 193 | afc_file_close(afc, my_file); |
| 194 | } | 194 | } |
| 195 | printf("Deleting a file...\n"); | 195 | printf("Deleting a file...\n"); |
| 196 | bytes = afc_delete_file(afc, "/delme"); | 196 | bytes = afc_remove_path(afc, "/delme"); |
| 197 | if (bytes) | 197 | if (bytes) |
| 198 | printf("Success.\n"); | 198 | printf("Success.\n"); |
| 199 | else | 199 | else |
| 200 | printf("Failure. (expected unless you have a /delme file on your phone)\n"); | 200 | printf("Failure. (expected unless you have a /delme file on your phone)\n"); |
| 201 | 201 | ||
| 202 | printf("Renaming a file...\n"); | 202 | printf("Renaming a file...\n"); |
| 203 | bytes = afc_rename_file(afc, "/renme", "/renme2"); | 203 | bytes = afc_rename_path(afc, "/renme", "/renme2"); |
| 204 | if (bytes > 0) | 204 | if (bytes > 0) |
| 205 | printf("Success.\n"); | 205 | printf("Success.\n"); |
| 206 | else | 206 | else |
| 207 | printf("Failure. (expected unless you have a /renme file on your phone)\n"); | 207 | printf("Failure. (expected unless you have a /renme file on your phone)\n"); |
| 208 | 208 | ||
| 209 | printf("Seek & read\n"); | 209 | printf("Seek & read\n"); |
| 210 | afc_open_file(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); | 210 | afc_file_open(afc, "/readme.libiphone.fx", AFC_FOPEN_RDONLY, &my_file); |
| 211 | if (IPHONE_E_SUCCESS != afc_seek_file(afc, my_file, 5, SEEK_CUR)) | 211 | if (AFC_E_SUCCESS != afc_file_seek(afc, my_file, 5, SEEK_CUR)) |
| 212 | printf("WARN: SEEK DID NOT WORK\n"); | 212 | printf("WARN: SEEK DID NOT WORK\n"); |
| 213 | char *threeletterword = (char *) malloc(sizeof(char) * 5); | 213 | char *threeletterword = (char *) malloc(sizeof(char) * 5); |
| 214 | afc_read_file(afc, my_file, threeletterword, 3, &bytes); | 214 | afc_file_read(afc, my_file, threeletterword, 3, &bytes); |
| 215 | threeletterword[3] = '\0'; | 215 | threeletterword[3] = '\0'; |
| 216 | if (bytes > 0) | 216 | if (bytes > 0) |
| 217 | printf("Result: %s\n", threeletterword); | 217 | printf("Result: %s\n", threeletterword); |
| 218 | else | 218 | else |
| 219 | printf("Couldn't read!\n"); | 219 | printf("Couldn't read!\n"); |
| 220 | free(threeletterword); | 220 | free(threeletterword); |
| 221 | afc_close_file(afc, my_file); | 221 | afc_file_close(afc, my_file); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | if (gnp && lockfile) { | 224 | if (gnp && lockfile) { |
| @@ -226,10 +226,10 @@ int main(int argc, char *argv[]) | |||
| 226 | sleep(5); | 226 | sleep(5); |
| 227 | 227 | ||
| 228 | printf("XXX unlocking file\n"); | 228 | printf("XXX unlocking file\n"); |
| 229 | afc_lock_file(afc, lockfile, AFC_LOCK_UN); | 229 | afc_file_lock(afc, lockfile, AFC_LOCK_UN); |
| 230 | 230 | ||
| 231 | printf("XXX closing file\n"); | 231 | printf("XXX closing file\n"); |
| 232 | afc_close_file(afc, lockfile); | 232 | afc_file_close(afc, lockfile); |
| 233 | 233 | ||
| 234 | printf("XXX sleeping\n"); | 234 | printf("XXX sleeping\n"); |
| 235 | sleep(5); | 235 | sleep(5); |
| @@ -241,7 +241,7 @@ int main(int argc, char *argv[]) | |||
| 241 | gnp = NULL; | 241 | gnp = NULL; |
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | afc_free_client(afc); | 244 | afc_client_free(afc); |
| 245 | } else { | 245 | } else { |
| 246 | printf("Start service failure.\n"); | 246 | printf("Start service failure.\n"); |
| 247 | } | 247 | } |
