summaryrefslogtreecommitdiffstats
path: root/src/afc.c
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2024-01-31 02:57:11 +0100
committerGravatar Nikias Bassen2024-01-31 02:57:11 +0100
commit63bbac545efc400373a7f472fdd78174149119c3 (patch)
treef95c8d58b7b0fbf33bd188c5becc0401ee7e64ef /src/afc.c
parentf723a44513eb5ba5797da24bc2b63d9f09600a6e (diff)
downloadlibimobiledevice-63bbac545efc400373a7f472fdd78174149119c3.tar.gz
libimobiledevice-63bbac545efc400373a7f472fdd78174149119c3.tar.bz2
Move LIBIMOBILEDEVICE_API to public headers
Diffstat (limited to 'src/afc.c')
-rw-r--r--src/afc.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/afc.c b/src/afc.c
index d8c3db0..28849fa 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -29,8 +29,8 @@
29#include <unistd.h> 29#include <unistd.h>
30#include <string.h> 30#include <string.h>
31 31
32#include "afc.h"
33#include "idevice.h" 32#include "idevice.h"
33#include "afc.h"
34#include "common/debug.h" 34#include "common/debug.h"
35#include "endianness.h" 35#include "endianness.h"
36 36
@@ -68,7 +68,7 @@ static void afc_unlock(afc_client_t client)
68 * invalid, or AFC_E_NO_MEM if there is a memory allocation problem. 68 * invalid, or AFC_E_NO_MEM if there is a memory allocation problem.
69 */ 69 */
70 70
71LIBIMOBILEDEVICE_API afc_error_t afc_client_new_with_service_client(service_client_t service_client, afc_client_t *client) 71afc_error_t afc_client_new_with_service_client(service_client_t service_client, afc_client_t *client)
72{ 72{
73 if (!service_client) 73 if (!service_client)
74 return AFC_E_INVALID_ARG; 74 return AFC_E_INVALID_ARG;
@@ -94,7 +94,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_client_new_with_service_client(service_clie
94 return AFC_E_SUCCESS; 94 return AFC_E_SUCCESS;
95} 95}
96 96
97LIBIMOBILEDEVICE_API afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client) 97afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client)
98{ 98{
99 if (!device || !service || service->port == 0) 99 if (!device || !service || service->port == 0)
100 return AFC_E_INVALID_ARG; 100 return AFC_E_INVALID_ARG;
@@ -113,14 +113,14 @@ LIBIMOBILEDEVICE_API afc_error_t afc_client_new(idevice_t device, lockdownd_serv
113 return err; 113 return err;
114} 114}
115 115
116LIBIMOBILEDEVICE_API afc_error_t afc_client_start_service(idevice_t device, afc_client_t * client, const char* label) 116afc_error_t afc_client_start_service(idevice_t device, afc_client_t * client, const char* label)
117{ 117{
118 afc_error_t err = AFC_E_UNKNOWN_ERROR; 118 afc_error_t err = AFC_E_UNKNOWN_ERROR;
119 service_client_factory_start_service(device, AFC_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(afc_client_new), &err); 119 service_client_factory_start_service(device, AFC_SERVICE_NAME, (void**)client, label, SERVICE_CONSTRUCTOR(afc_client_new), &err);
120 return err; 120 return err;
121} 121}
122 122
123LIBIMOBILEDEVICE_API afc_error_t afc_client_free(afc_client_t client) 123afc_error_t afc_client_free(afc_client_t client)
124{ 124{
125 if (!client || !client->afc_packet) 125 if (!client || !client->afc_packet)
126 return AFC_E_INVALID_ARG; 126 return AFC_E_INVALID_ARG;
@@ -414,7 +414,7 @@ static int _afc_check_packet_buffer(afc_client_t client, uint32_t data_len)
414 414
415#define AFC_PACKET_DATA_PTR ((char*)client->afc_packet + sizeof(AFCPacket)) 415#define AFC_PACKET_DATA_PTR ((char*)client->afc_packet + sizeof(AFCPacket))
416 416
417LIBIMOBILEDEVICE_API afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information) 417afc_error_t afc_read_directory(afc_client_t client, const char *path, char ***directory_information)
418{ 418{
419 uint32_t bytes = 0; 419 uint32_t bytes = 0;
420 char *data = NULL, **list_loc = NULL; 420 char *data = NULL, **list_loc = NULL;
@@ -458,7 +458,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_read_directory(afc_client_t client, const c
458 return ret; 458 return ret;
459} 459}
460 460
461LIBIMOBILEDEVICE_API afc_error_t afc_get_device_info(afc_client_t client, char ***device_information) 461afc_error_t afc_get_device_info(afc_client_t client, char ***device_information)
462{ 462{
463 uint32_t bytes = 0; 463 uint32_t bytes = 0;
464 char *data = NULL, **list = NULL; 464 char *data = NULL, **list = NULL;
@@ -495,7 +495,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_get_device_info(afc_client_t client, char *
495 return ret; 495 return ret;
496} 496}
497 497
498LIBIMOBILEDEVICE_API afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value) 498afc_error_t afc_get_device_info_key(afc_client_t client, const char *key, char **value)
499{ 499{
500 afc_error_t ret = AFC_E_INTERNAL_ERROR; 500 afc_error_t ret = AFC_E_INTERNAL_ERROR;
501 char **kvps, **ptr; 501 char **kvps, **ptr;
@@ -522,7 +522,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_get_device_info_key(afc_client_t client, co
522 return ret; 522 return ret;
523} 523}
524 524
525LIBIMOBILEDEVICE_API afc_error_t afc_remove_path(afc_client_t client, const char *path) 525afc_error_t afc_remove_path(afc_client_t client, const char *path)
526{ 526{
527 uint32_t bytes = 0; 527 uint32_t bytes = 0;
528 afc_error_t ret = AFC_E_UNKNOWN_ERROR; 528 afc_error_t ret = AFC_E_UNKNOWN_ERROR;
@@ -558,7 +558,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_remove_path(afc_client_t client, const char
558 return ret; 558 return ret;
559} 559}
560 560
561LIBIMOBILEDEVICE_API afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to) 561afc_error_t afc_rename_path(afc_client_t client, const char *from, const char *to)
562{ 562{
563 if (!client || !from || !to || !client->afc_packet || !client->parent) 563 if (!client || !from || !to || !client->afc_packet || !client->parent)
564 return AFC_E_INVALID_ARG; 564 return AFC_E_INVALID_ARG;
@@ -594,7 +594,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_rename_path(afc_client_t client, const char
594 return ret; 594 return ret;
595} 595}
596 596
597LIBIMOBILEDEVICE_API afc_error_t afc_make_directory(afc_client_t client, const char *path) 597afc_error_t afc_make_directory(afc_client_t client, const char *path)
598{ 598{
599 uint32_t bytes = 0; 599 uint32_t bytes = 0;
600 afc_error_t ret = AFC_E_UNKNOWN_ERROR; 600 afc_error_t ret = AFC_E_UNKNOWN_ERROR;
@@ -626,7 +626,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_make_directory(afc_client_t client, const c
626 return ret; 626 return ret;
627} 627}
628 628
629LIBIMOBILEDEVICE_API afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***file_information) 629afc_error_t afc_get_file_info(afc_client_t client, const char *path, char ***file_information)
630{ 630{
631 char *received = NULL; 631 char *received = NULL;
632 uint32_t bytes = 0; 632 uint32_t bytes = 0;
@@ -666,7 +666,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_get_file_info(afc_client_t client, const ch
666 return ret; 666 return ret;
667} 667}
668 668
669LIBIMOBILEDEVICE_API afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle) 669afc_error_t afc_file_open(afc_client_t client, const char *filename, afc_file_mode_t file_mode, uint64_t *handle)
670{ 670{
671 if (!client || !client->parent || !client->afc_packet) 671 if (!client || !client->parent || !client->afc_packet)
672 return AFC_E_INVALID_ARG; 672 return AFC_E_INVALID_ARG;
@@ -718,7 +718,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_open(afc_client_t client, const char *
718 return ret; 718 return ret;
719} 719}
720 720
721LIBIMOBILEDEVICE_API afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read) 721afc_error_t afc_file_read(afc_client_t client, uint64_t handle, char *data, uint32_t length, uint32_t *bytes_read)
722{ 722{
723 char *input = NULL; 723 char *input = NULL;
724 uint32_t current_count = 0, bytes_loc = 0; 724 uint32_t current_count = 0, bytes_loc = 0;
@@ -774,7 +774,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_read(afc_client_t client, uint64_t han
774 return ret; 774 return ret;
775} 775}
776 776
777LIBIMOBILEDEVICE_API afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written) 777afc_error_t afc_file_write(afc_client_t client, uint64_t handle, const char *data, uint32_t length, uint32_t *bytes_written)
778{ 778{
779 uint32_t current_count = 0; 779 uint32_t current_count = 0;
780 uint32_t bytes_loc = 0; 780 uint32_t bytes_loc = 0;
@@ -809,7 +809,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_write(afc_client_t client, uint64_t ha
809 return ret; 809 return ret;
810} 810}
811 811
812LIBIMOBILEDEVICE_API afc_error_t afc_file_close(afc_client_t client, uint64_t handle) 812afc_error_t afc_file_close(afc_client_t client, uint64_t handle)
813{ 813{
814 uint32_t bytes = 0; 814 uint32_t bytes = 0;
815 afc_error_t ret = AFC_E_UNKNOWN_ERROR; 815 afc_error_t ret = AFC_E_UNKNOWN_ERROR;
@@ -840,7 +840,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_close(afc_client_t client, uint64_t ha
840 return ret; 840 return ret;
841} 841}
842 842
843LIBIMOBILEDEVICE_API afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation) 843afc_error_t afc_file_lock(afc_client_t client, uint64_t handle, afc_lock_op_t operation)
844{ 844{
845 uint32_t bytes = 0; 845 uint32_t bytes = 0;
846 struct lockinfo { 846 struct lockinfo {
@@ -874,7 +874,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_lock(afc_client_t client, uint64_t han
874 return ret; 874 return ret;
875} 875}
876 876
877LIBIMOBILEDEVICE_API afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence) 877afc_error_t afc_file_seek(afc_client_t client, uint64_t handle, int64_t offset, int whence)
878{ 878{
879 uint32_t bytes = 0; 879 uint32_t bytes = 0;
880 struct seekinfo { 880 struct seekinfo {
@@ -908,7 +908,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_seek(afc_client_t client, uint64_t han
908 return ret; 908 return ret;
909} 909}
910 910
911LIBIMOBILEDEVICE_API afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position) 911afc_error_t afc_file_tell(afc_client_t client, uint64_t handle, uint64_t *position)
912{ 912{
913 char *buffer = NULL; 913 char *buffer = NULL;
914 uint32_t bytes = 0; 914 uint32_t bytes = 0;
@@ -943,7 +943,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_tell(afc_client_t client, uint64_t han
943 return ret; 943 return ret;
944} 944}
945 945
946LIBIMOBILEDEVICE_API afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize) 946afc_error_t afc_file_truncate(afc_client_t client, uint64_t handle, uint64_t newsize)
947{ 947{
948 uint32_t bytes = 0; 948 uint32_t bytes = 0;
949 struct truncinfo { 949 struct truncinfo {
@@ -975,7 +975,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_file_truncate(afc_client_t client, uint64_t
975 return ret; 975 return ret;
976} 976}
977 977
978LIBIMOBILEDEVICE_API afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize) 978afc_error_t afc_truncate(afc_client_t client, const char *path, uint64_t newsize)
979{ 979{
980 if (!client || !path || !client->afc_packet || !client->parent) 980 if (!client || !path || !client->afc_packet || !client->parent)
981 return AFC_E_INVALID_ARG; 981 return AFC_E_INVALID_ARG;
@@ -1008,7 +1008,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_truncate(afc_client_t client, const char *p
1008 return ret; 1008 return ret;
1009} 1009}
1010 1010
1011LIBIMOBILEDEVICE_API afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname) 1011afc_error_t afc_make_link(afc_client_t client, afc_link_type_t linktype, const char *target, const char *linkname)
1012{ 1012{
1013 if (!client || !target || !linkname || !client->afc_packet || !client->parent) 1013 if (!client || !target || !linkname || !client->afc_packet || !client->parent)
1014 return AFC_E_INVALID_ARG; 1014 return AFC_E_INVALID_ARG;
@@ -1049,7 +1049,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_make_link(afc_client_t client, afc_link_typ
1049 return ret; 1049 return ret;
1050} 1050}
1051 1051
1052LIBIMOBILEDEVICE_API afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime) 1052afc_error_t afc_set_file_time(afc_client_t client, const char *path, uint64_t mtime)
1053{ 1053{
1054 if (!client || !path || !client->afc_packet || !client->parent) 1054 if (!client || !path || !client->afc_packet || !client->parent)
1055 return AFC_E_INVALID_ARG; 1055 return AFC_E_INVALID_ARG;
@@ -1082,7 +1082,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_set_file_time(afc_client_t client, const ch
1082 return ret; 1082 return ret;
1083} 1083}
1084 1084
1085LIBIMOBILEDEVICE_API afc_error_t afc_remove_path_and_contents(afc_client_t client, const char *path) 1085afc_error_t afc_remove_path_and_contents(afc_client_t client, const char *path)
1086{ 1086{
1087 uint32_t bytes = 0; 1087 uint32_t bytes = 0;
1088 afc_error_t ret = AFC_E_UNKNOWN_ERROR; 1088 afc_error_t ret = AFC_E_UNKNOWN_ERROR;
@@ -1114,7 +1114,7 @@ LIBIMOBILEDEVICE_API afc_error_t afc_remove_path_and_contents(afc_client_t clien
1114 return ret; 1114 return ret;
1115} 1115}
1116 1116
1117LIBIMOBILEDEVICE_API afc_error_t afc_dictionary_free(char **dictionary) 1117afc_error_t afc_dictionary_free(char **dictionary)
1118{ 1118{
1119 int i = 0; 1119 int i = 0;
1120 1120