diff options
| author | 2008-11-30 16:36:18 +0100 | |
|---|---|---|
| committer | 2008-11-30 16:36:18 +0100 | |
| commit | 889cb32a1231c41762d7e2bbe6c891bd3a6c9a7d (patch) | |
| tree | e60a593d5806b1fc5398bfa17f6d2feec9c82358 /src/plist.h | |
| parent | 831ee461bd03ad809f73b34dc5205d296158a969 (diff) | |
| download | libimobiledevice-889cb32a1231c41762d7e2bbe6c891bd3a6c9a7d.tar.gz libimobiledevice-889cb32a1231c41762d7e2bbe6c891bd3a6c9a7d.tar.bz2 | |
Continue abstraction of xml and binary plist.
Diffstat (limited to 'src/plist.h')
| -rw-r--r-- | src/plist.h | 48 |
1 files changed, 9 insertions, 39 deletions
diff --git a/src/plist.h b/src/plist.h index 4586d6f..1ca55f9 100644 --- a/src/plist.h +++ b/src/plist.h | |||
| @@ -46,38 +46,8 @@ void free_dictionary(char **dictionary); | |||
| 46 | 46 | ||
| 47 | /* Binary plist stuff */ | 47 | /* Binary plist stuff */ |
| 48 | 48 | ||
| 49 | enum { | ||
| 50 | BPLIST_TRUE = 0x08, | ||
| 51 | BPLIST_FALSE = 0x09, | ||
| 52 | BPLIST_FILL = 0x0F, /* will be used for length grabbing */ | ||
| 53 | BPLIST_INT = 0x10, | ||
| 54 | BPLIST_REAL = 0x20, | ||
| 55 | BPLIST_DATE = 0x33, | ||
| 56 | BPLIST_DATA = 0x40, | ||
| 57 | BPLIST_STRING = 0x50, | ||
| 58 | BPLIST_UNICODE = 0x60, | ||
| 59 | BPLIST_UID = 0x70, | ||
| 60 | BPLIST_ARRAY = 0xA0, | ||
| 61 | BPLIST_SET = 0xC0, | ||
| 62 | BPLIST_DICT = 0xD0, | ||
| 63 | BPLIST_MASK = 0xF0 | ||
| 64 | }; | ||
| 65 | 49 | ||
| 66 | typedef struct _bplist_node { | 50 | typedef enum { |
| 67 | struct _bplist_node *next, **subnodes; // subnodes is for arrays, dicts and (potentially) sets. | ||
| 68 | uint64_t length, intval64; | ||
| 69 | uint32_t intval32; // length = subnodes | ||
| 70 | uint16_t intval16; | ||
| 71 | uint8_t intval8; | ||
| 72 | uint8_t type, *indexes; // indexes for array-types; essentially specify the order in which to access for key => value pairs | ||
| 73 | char *strval; | ||
| 74 | double realval; | ||
| 75 | wchar_t *unicodeval; | ||
| 76 | } bplist_node; | ||
| 77 | |||
| 78 | bplist_node *parse_nodes(const char *bpbuffer, uint32_t bplength, uint32_t * position); | ||
| 79 | |||
| 80 | typedef enum { | ||
| 81 | PLIST_BOOLEAN, | 51 | PLIST_BOOLEAN, |
| 82 | PLIST_UINT8, | 52 | PLIST_UINT8, |
| 83 | PLIST_UINT16, | 53 | PLIST_UINT16, |
| @@ -100,15 +70,15 @@ typedef GNode *plist_t; | |||
| 100 | typedef GNode *dict_t; | 70 | typedef GNode *dict_t; |
| 101 | typedef GNode *array_t; | 71 | typedef GNode *array_t; |
| 102 | 72 | ||
| 103 | void plist_new_plist(plist_t* plist); | 73 | void plist_new_plist(plist_t * plist); |
| 104 | void plist_new_dict_in_plist(plist_t plist, dict_t* dict); | 74 | void plist_new_dict_in_plist(plist_t plist, dict_t * dict); |
| 105 | void plist_new_array_in_plist(plist_t plist, int length, plist_type type, void** values, array_t* array); | 75 | void plist_new_array_in_plist(plist_t plist, int length, plist_type type, void **values, array_t * array); |
| 106 | void plist_add_dict_element(dict_t dict, char* key, plist_type type, void* value); | 76 | void plist_add_dict_element(dict_t dict, char *key, plist_type type, void *value); |
| 107 | void plist_free(plist_t plist); | 77 | void plist_free(plist_t plist); |
| 108 | 78 | ||
| 109 | void plist_to_xml(plist_t plist, char** plist_xml); | 79 | void plist_to_xml(plist_t plist, char **plist_xml); |
| 110 | void plist_to_bin(plist_t plist, char** plist_bin); | 80 | void plist_to_bin(plist_t plist, char **plist_bin, int *length); |
| 111 | 81 | ||
| 112 | void xml_to_plist(const char* plist_xml, plist_t* plist); | 82 | void xml_to_plist(const char *plist_xml, plist_t * plist); |
| 113 | void bin_to_plist(const char* plist_bin, plist_t* plist); | 83 | void bin_to_plist(const char *plist_bin, int length, plist_t * plist); |
| 114 | #endif | 84 | #endif |
