diff options
| author | 2008-07-29 01:11:02 -0700 | |
|---|---|---|
| committer | 2008-07-29 01:11:02 -0700 | |
| commit | e2ff1128351d75eafd5426af7f96f9719c1af3e6 (patch) | |
| tree | c1c460b4de78cd5645d6d12e83d2646f56f30363 /AFC.h | |
| download | libimobiledevice-e2ff1128351d75eafd5426af7f96f9719c1af3e6.tar.gz libimobiledevice-e2ff1128351d75eafd5426af7f96f9719c1af3e6.tar.bz2 | |
First released version, 0.089.
Diffstat (limited to 'AFC.h')
| -rw-r--r-- | AFC.h | 74 |
1 files changed, 74 insertions, 0 deletions
| @@ -0,0 +1,74 @@ | |||
| 1 | /* | ||
| 2 | * AFC.h | ||
| 3 | * Defines and structs and the like for the built-in AFC client | ||
| 4 | * Written by FxChiP | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include "usbmux.h" | ||
| 8 | #include "iphone.h" | ||
| 9 | |||
| 10 | #include <string.h> | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <stdlib.h> | ||
| 13 | |||
| 14 | typedef struct { | ||
| 15 | //const uint32 header1 = 0x36414643; // '6AFC' or 'CFA6' when sent ;) | ||
| 16 | uint32 header1, header2; | ||
| 17 | //const uint32 header2 = 0x4141504C; // 'AAPL' or 'LPAA' when sent ;) | ||
| 18 | uint32 entire_length, unknown1, this_length, unknown2, packet_num, unknown3, operation, unknown4; | ||
| 19 | } AFCPacket; | ||
| 20 | |||
| 21 | typedef struct { | ||
| 22 | usbmux_tcp_header *connection; | ||
| 23 | iPhone *phone; | ||
| 24 | AFCPacket *afc_packet; | ||
| 25 | int file_handle; | ||
| 26 | } AFClient; | ||
| 27 | |||
| 28 | typedef struct { | ||
| 29 | uint32 filehandle, unknown1, size, unknown2; | ||
| 30 | } AFCFilePacket; | ||
| 31 | |||
| 32 | typedef struct { | ||
| 33 | uint32 filehandle, blocks, size, type; | ||
| 34 | } AFCFile; | ||
| 35 | |||
| 36 | typedef struct __AFCToken { | ||
| 37 | struct __AFCToken *last, *next; | ||
| 38 | char *token; | ||
| 39 | } AFCToken; | ||
| 40 | |||
| 41 | enum { | ||
| 42 | S_IFREG = 0, | ||
| 43 | S_IFDIR = 1 | ||
| 44 | }; | ||
| 45 | |||
| 46 | enum { | ||
| 47 | AFC_FILE_READ = 0x00000002, | ||
| 48 | AFC_FILE_WRITE = 0x00000003 | ||
| 49 | }; | ||
| 50 | |||
| 51 | enum { | ||
| 52 | AFC_ERROR = 0x00000001, | ||
| 53 | AFC_GET_INFO = 0x0000000a, | ||
| 54 | AFC_GET_DEVINFO = 0x0000000b, | ||
| 55 | AFC_LIST_DIR = 0x00000003, | ||
| 56 | AFC_SUCCESS_RESPONSE = 0x00000002, | ||
| 57 | AFC_FILE_OPEN = 0x0000000d, | ||
| 58 | AFC_FILE_CLOSE = 0x00000014, | ||
| 59 | AFC_FILE_HANDLE = 0x0000000e, | ||
| 60 | AFC_READ = 0x0000000f | ||
| 61 | }; | ||
| 62 | |||
| 63 | AFClient *afc_connect(iPhone *phone, int s_port, int d_port); | ||
| 64 | void afc_disconnect(AFClient *client); | ||
| 65 | int count_nullspaces(char *string, int number); | ||
| 66 | char **make_strings_list(char *tokens, int true_length); | ||
| 67 | int dispatch_AFC_packet(AFClient *client, char *data, int length); | ||
| 68 | int receive_AFC_data(AFClient *client, char **dump_here); | ||
| 69 | |||
| 70 | char **afc_get_dir_list(AFClient *client, char *dir); | ||
| 71 | AFCFile *afc_get_file_info(AFClient *client, char *path); | ||
| 72 | AFCFile *afc_open_file(AFClient *client, const char *filename, uint32 file_mode); | ||
| 73 | void afc_close_file(AFClient *client, AFCFile *file); | ||
| 74 | int afc_read_file(AFClient *client, AFCFile *file, char *data, int length); | ||
