1 /* readbinaryplist.h -- header to read preference files
3 Roger B. Dannenberg, Jun 2008
6 #include <stdint.h> /* for uint8_t ... */
13 #define MAX_KEY_SIZE 256
17 // Object tags (high nybble)
18 kTAG_SIMPLE = 0x00, // Null, true, false, filler, or invalid
23 kTAG_ASCIISTRING = 0x50,
24 kTAG_UNICODESTRING = 0x60,
27 kTAG_DICTIONARY = 0xD0,
29 // "simple" object values
35 kVALUE_FULLDATETAG = 0x33 // Dates are tagged with a whole byte.
39 typedef struct pldata_struct {
42 } pldata_node, *pldata_ptr;
45 typedef struct array_struct {
46 struct value_struct **array;
48 } array_node, *array_ptr;
51 // a dict_node is a list of <key, value> pairs
52 typedef struct dict_struct {
53 struct value_struct *key;
54 struct value_struct *value;
55 struct dict_struct *next;
56 } dict_node, *dict_ptr;
59 // an value_node is a value with a tag telling the type
60 typedef struct value_struct {
69 struct dict_struct *dict;
71 } value_node, *value_ptr;
74 value_ptr bplist_read_file(char *filename);
75 value_ptr bplist_read_user_pref(char *filename);
76 value_ptr bplist_read_system_pref(char *filename);
77 void bplist_free_data();
79 /*************** functions for accessing values ****************/
81 char *value_get_asciistring(value_ptr v);
82 value_ptr value_dict_lookup_using_string(value_ptr v, char *key);
83 value_ptr value_dict_lookup_using_path(value_ptr v, char *path);
85 /*************** functions for debugging ***************/
87 void plist_print(value_ptr v);