• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/netatalk-2.2.0/bin/megatron/
1/*
2 * $Id: megatron.h,v 1.5 2009-10-14 01:38:28 didg Exp $
3 */
4
5#ifndef _MEGATRON_H
6#define _MEGATRON_H 1
7
8#include <atalk/adouble.h>
9
10#ifndef	STDIN
11#	define	STDIN	"-"
12#endif /* ! STDIN */
13
14/*
15    Where it matters, data stored in either of these two structs is in
16    network byte order.  Any routines that need to interpret this data
17    locally would need to do the conversion.  Mostly this affects the
18    fork length variables.  Time values are affected as well, if any
19    routines actually need to look at them.
20 */
21
22#define DATA		0
23#define RESOURCE	1
24#define NUMFORKS	2
25
26#define HEX2NAD		0	/* unhex */
27#define BIN2NAD		1	/* unbin */
28#define SINGLE2NAD	2	/* unsingle */
29#define NAD2BIN		3	/* macbinary */
30#define HEX2BIN		4	/* hqx2bin */
31#define SINGLE2BIN	5	/* single2bin */
32#define NADHEADER       6       /* header */
33#define BINHEADER       7       /* mac binary header */
34#define MEGATRON	8	/* megatron, default, usually HEX2NAD */
35#define CONVERTS	9	/* # conversions defined */
36
37#define OPTION_NONE       (0)
38#define OPTION_HEADERONLY (1 << 0)
39#define OPTION_STDOUT     (1 << 2)
40#define OPTION_EUCJP      (1 << 3)
41#define OPTION_SJIS       (1 << 4)
42
43struct FInfo {
44    u_int32_t		fdType;
45    u_int32_t		fdCreator;
46    u_int16_t		fdFlags;
47    u_int32_t		fdLocation;
48    u_int16_t		fdFldr;
49};
50
51struct FXInfo {
52    u_int16_t           fdIconID;
53    u_int16_t           fdUnused[3];
54    u_int8_t            fdScript;
55    u_int8_t            fdXFlags;
56    u_int16_t           fdComment;
57    u_int32_t           fdPutAway;
58};
59
60struct FHeader {
61    char		name[ ADEDLEN_NAME ];
62    char		comment[ ADEDLEN_COMMENT ];
63    u_int32_t		forklen[ NUMFORKS ];
64    u_int32_t		create_date;
65    u_int32_t		mod_date;
66    u_int32_t		backup_date;
67    struct FInfo	finder_info;
68    struct FXInfo       finder_xinfo;
69};
70
71#define MAC_DATE_TO_UNIX(a)   (ntohl(a) - 2082844800U)
72#define MAC_DATE_FROM_UNIX(a) (htonl((a) + 2082844800U))
73#define AD_DATE_FROM_MAC(a)   (htonl(ntohl(a) - 3029529600U))
74#define AD_DATE_TO_MAC(a)     (htonl(ntohl(a) + 3029529600U))
75
76#define FILEIOFF_CREATE	0
77#define FILEIOFF_MODIFY	4
78#define FILEIOFF_BACKUP	8
79#define FILEIOFF_ATTR	14
80#define FINDERIOFF_TYPE		0
81#define FINDERIOFF_CREATOR	4
82#define FINDERIOFF_FLAGS	8
83#define FINDERIOFF_LOC		10
84#define FINDERIOFF_FLDR		14
85#define FINDERIOFF_SCRIPT       24
86#define FINDERIOFF_XFLAGS       25
87
88#define	TRASH		0
89#define	KEEP		1
90
91#ifndef S_ISDIR
92#	define S_ISDIR(s)	(( s & S_IFMT ) == S_IFDIR )
93#endif /* ! S_ISDIR */
94
95extern char	*forkname[];
96extern char     *(*_mtoupath) ( char *);
97extern char     *(*_utompath) ( char *);
98#define mtoupath(s) (*_mtoupath)(s)
99#define utompath(s) (*_utompath)(s)
100
101#endif /* _MEGATRON_H */
102