1/* All rights reserved.
2 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions
5 * are met:
6 * 1. Redistributions of source code must retain the above copyright
7 *    notice, this list of conditions and the following disclaimer.
8 * 2. Redistributions in binary form must reproduce the above copyright
9 *    notice, this list of conditions and the following disclaimer in the
10 *    documentation and/or other materials provided with the distribution.
11 * 3. Neither the name of Apple nor the names of any contributors
12 *    may be used to endorse or promote products derived from this software
13 *    without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26*/
27/*
28 * Portions Copyright 2006, Apple Computer, Inc.
29 * Christopher Ryan <ryanc@apple.com>
30*/
31
32#ifndef _MACHO_H_
33#define _MACHO_H_
34
35#include "xar.h"
36#include "filetree.h"
37
38struct mach_header {
39   uint32_t magic;
40   uint32_t cputype;
41   uint32_t cpusubtype;
42   uint32_t filetype;
43   uint32_t ncmds;
44   uint32_t sizeofcmds;
45   uint32_t flags;
46};
47
48struct lc {
49	uint32_t cmd;
50	uint32_t cmdsize;
51};
52
53struct fat_header {
54	uint32_t magic;
55	uint32_t nfat_arch;
56};
57
58struct fat_arch {
59	uint32_t cputype;
60	uint32_t cpusubtype;
61	uint32_t offset;
62	uint32_t size;
63	uint32_t alighn;
64};
65
66int32_t xar_macho_in(xar_t x, xar_file_t f, xar_prop_t p, void **in, size_t *inlen, void **context);
67int32_t xar_macho_done(xar_t x, xar_file_t f, xar_prop_t p, void **context);
68
69#endif /* _MACHO_H_ */
70