Imported Upstream version 0.4b37
[debian/dump] / compat / include / darwin.h
1 /*
2  *
3  */
4
5 #if defined(DUMP_MACOSX)
6
7 #ifndef DARWIN_H
8 #define DARWIN_H
9
10 #define INFOLEN 32
11 #define CORRECT 2
12
13
14 #define DARWIN_RSRC_NAME "/..namedfork/rsrc"
15 #define DARWIN_FINFO_NAME "/..namedfork/finfo"
16 /*
17  * some structs from the HFS+ info for OS X
18  * - including the header file causes messy clashes
19  */
20
21 struct FndrFileInfo {
22     u_int32_t     fdType;        /* file type */
23     u_int32_t     fdCreator;    /* file creator */
24     u_int16_t     fdFlags;    /* Finder flags */
25     struct {
26         int16_t    v;        /* file's location */
27         int16_t    h;
28     } fdLocation;
29     int16_t     opaque;
30 };
31 typedef struct FndrFileInfo FndrFileInfo;
32
33 struct FndrDirInfo {
34         struct {                        /* folder's window rectangle */
35             int16_t     top;
36             int16_t     left;
37             int16_t     bottom;
38             int16_t     right;
39         } frRect;
40         unsigned short  frFlags;        /* Finder flags */
41         struct {
42             u_int16_t   v;              /* folder's location */
43             u_int16_t   h;
44         } frLocation;
45         int16_t         opaque;
46 };
47 typedef struct FndrDirInfo FndrDirInfo;
48
49
50 struct FndrOpaqueInfo {
51     int8_t opaque[16];
52 };
53 typedef struct FndrOpaqueInfo FndrOpaqueInfo;
54
55 struct fndrinfo_block_t {
56         FndrFileInfo    finderInfo;
57         FndrOpaqueInfo  extendedFinderInfo;
58 };
59 typedef struct fndrinfo_block_t fndrinfo_block_t;
60
61 struct attrinfo_block_t {
62         unsigned long info_length;
63         u_int32_t       objid_low;
64         u_int32_t       objid_high;
65         struct timespec created;
66         struct timespec backup;
67         union {
68                 fndrinfo_block_t        finfo;
69                 FndrDirInfo             dinfo;
70         } o;
71         off_t   rsrc_length;
72 };
73 typedef struct attrinfo_block_t attrinfo_block_t;
74
75
76 #define ASINGLE_MAGIC   0x00051600      /* all in one file */
77 #define ADOUBLE_MAGIC   0x00051607      /* resource + info, data separated */
78
79 #define ASD_VERSION1    0x00010000      /* the original version */
80 #define ASD_VERSION2    0x00020000      /* the second version */
81
82 typedef struct ASDHeader {
83         u_long  magic;                  /* either single or double */
84         u_long  version;                /* ASD_VERSION2 */
85         u_char  filler[16];             /* reserved, zero */
86         u_short entries;                /* the number of entries */
87         /* the entries follow */
88 } ASDHeader, *ASDHeaderPtr, **ASDHeaderHandle;
89
90 typedef enum {
91         EntryDataFork = 1,
92         EntryRSRCFork,
93         EntryRealName,
94         EntryComment,
95         EntryBWIcon,
96         EntryColorIcon,
97         EntryOldFileInfo,
98         EntryFileDates,
99         EntryFinderInfo,
100         EntryMacFileInfo,
101         EntryProDOSInfo,
102         EntryMSDOSInfo,
103         EntryShortName,
104         EntryAFPFileInfo,
105         EntryDirID
106 } ASDEntryType;
107
108 typedef struct {
109         u_long  entryID;                /* the entry type (forced to long) */
110         u_long  offset;                 /* offset in file of entry */
111         u_long  len;                    /* length of entry */
112 } ASDEntry, *ASDEntryPtr, **ASDEntryHandle;
113
114 typedef struct {
115         u_long  creationDate;
116         u_long  modificationDate;
117         u_long  backupDate;
118         u_long  accessDate;
119 } FileDates, *FileDatesPtr;
120
121 typedef struct dumpfinderinfo {
122  FndrFileInfo fndrinfo; /* 0: size = 16 bytes, same for FndrDirInfo */
123  u_int32_t createDate;  /* 16: date and time of creation */
124  u_int32_t contentModDate;/* 20: date/time of last content modification */
125  u_int32_t attributeModDate;/* 24: date/time of last attribute modification */
126  u_int32_t accessDate; /* 30: date/time of last access (MacOS X only) */
127  u_int32_t backupDate; /* 34: date/time of last backup */
128  u_int32_t textEncoding;        /* 36: hint for name conversions */
129  char filler[980]; /* 40: for later expansion, 40 + 980 - 4 = TP_BSIZE - 4 */
130 } DumpFinderInfo, *DumpFinderInfoPtr;
131
132 #endif /* DARWIN_H */
133 #endif