16 #define MAGICFILE "/etc/magic"
29 #define HOWMANY (256 * 1024)
50 #define MAGICNO 0xF11E041C
52 #define FILE_MAGICSIZE (32 * 6)
56 #define FILE_COMPILE 2
65 #define INDIROFFADD 0x04
79 #define FILE_INVALID 0
82 #define FILE_DEFAULT 3
86 #define FILE_BESHORT 7
89 #define FILE_LESHORT 10
90 #define FILE_LELONG 11
91 #define FILE_LEDATE 12
92 #define FILE_PSTRING 13
94 #define FILE_BELDATE 15
95 #define FILE_LELDATE 16
97 #define FILE_BESTRING16 18
98 #define FILE_LESTRING16 19
99 #define FILE_SEARCH 20
100 #define FILE_MEDATE 21
101 #define FILE_MELDATE 22
102 #define FILE_MELONG 23
104 #define FILE_LEQUAD 25
105 #define FILE_BEQUAD 26
106 #define FILE_QDATE 27
107 #define FILE_LEQDATE 28
108 #define FILE_BEQDATE 29
109 #define FILE_QLDATE 30
110 #define FILE_LEQLDATE 31
111 #define FILE_BEQLDATE 32
112 #define FILE_FLOAT 33
113 #define FILE_BEFLOAT 34
114 #define FILE_LEFLOAT 35
115 #define FILE_DOUBLE 36
116 #define FILE_BEDOUBLE 37
117 #define FILE_LEDOUBLE 38
118 #define FILE_NAMES_SIZE 39
120 #define MAGIC_IS_STRING(t) \
121 ((t) == FILE_STRING || \
122 (t) == FILE_PSTRING || \
123 (t) == FILE_BESTRING16 || \
124 (t) == FILE_LESTRING16 || \
125 (t) == FILE_REGEX || \
126 (t) == FILE_SEARCH || \
129 #define FILE_FMT_NONE 0
130 #define FILE_FMT_NUM 1
131 #define FILE_FMT_STR 2
132 #define FILE_FMT_QUAD 3
133 #define FILE_FMT_FLOAT 4
134 #define FILE_FMT_DOUBLE 5
142 #define FILE_OPS "&|^+-*/%"
147 #define FILE_OPMINUS 4
148 #define FILE_OPMULTIPLY 5
149 #define FILE_OPDIVIDE 6
150 #define FILE_OPMODULO 7
151 #define FILE_OPS_MASK 0x07
152 #define FILE_UNUSED_1 0x08
153 #define FILE_UNUSED_2 0x10
154 #define FILE_UNUSED_3 0x20
155 #define FILE_OPINVERSE 0x40
156 #define FILE_OPINDIRECT 0x80
178 #define num_mask _u._mask
179 #define str_range _u._s._count
180 #define str_flags _u._s._flags
183 union VALUETYPE
value;
187 char mimetype[MAXDESC];
190 #define BIT(A) (1 << (A))
191 #define STRING_COMPACT_BLANK BIT(0)
192 #define STRING_COMPACT_OPTIONAL_BLANK BIT(1)
193 #define STRING_IGNORE_LOWERCASE BIT(2)
194 #define STRING_IGNORE_UPPERCASE BIT(3)
195 #define REGEX_OFFSET_START BIT(4)
196 #define CHAR_COMPACT_BLANK 'B'
197 #define CHAR_COMPACT_OPTIONAL_BLANK 'b'
198 #define CHAR_IGNORE_LOWERCASE 'c'
199 #define CHAR_IGNORE_UPPERCASE 'C'
200 #define CHAR_REGEX_OFFSET_START 's'
201 #define STRING_IGNORE_CASE (STRING_IGNORE_LOWERCASE | STRING_IGNORE_UPPERCASE)
202 #define STRING_DEFAULT_RANGE 100
206 struct rz_magic *magic;
211 struct mlist *next, *prev;
214 #define RZ_MAGIC_NONE 0x000000
215 #define RZ_MAGIC_DEBUG 0x000001
216 #define RZ_MAGIC_SYMLINK 0x000002
217 #define RZ_MAGIC_COMPRESS 0x000004
218 #define RZ_MAGIC_DEVICES 0x000008
219 #define RZ_MAGIC_MIME_TYPE 0x000010
220 #define RZ_MAGIC_CONTINUE 0x000020
221 #define RZ_MAGIC_CHECK 0x000040
222 #define RZ_MAGIC_PRESERVE_ATIME 0x000080
223 #define RZ_MAGIC_RAW 0x000100
224 #define RZ_MAGIC_ERROR 0x000200
225 #define RZ_MAGIC_MIME_ENCODING 0x000400
226 #define RZ_MAGIC_MIME (RZ_MAGIC_MIME_TYPE | RZ_MAGIC_MIME_ENCODING)
227 #define RZ_MAGIC_NO_CHECK_COMPRESS 0x001000
228 #define RZ_MAGIC_NO_CHECK_TAR 0x002000
229 #define RZ_MAGIC_NO_CHECK_SOFT 0x004000
230 #define RZ_MAGIC_NO_CHECK_APPTYPE 0x008000
231 #define RZ_MAGIC_NO_CHECK_ELF 0x010000
232 #define RZ_MAGIC_NO_CHECK_ASCII 0x020000
233 #define RZ_MAGIC_NO_CHECK_TOKENS 0x100000
236 #define MAGIC_NO_CHECK_FORTRAN 0x000000
237 #define MAGIC_NO_CHECK_TROFF 0x000000
239 struct rz_magic_set {
271 union VALUETYPE ms_value;
275 #define RzMagic struct magic_set
277 typedef struct rz_magic_set RzMagic;
const lzma_allocator const uint8_t size_t uint8_t * out
RZ_API const char * rz_magic_descriptor(RzMagic *ms, int fd)
RZ_API int rz_magic_errno(RzMagic *ms)
RZ_API const char * rz_magic_buffer(RzMagic *ms, const void *buf, size_t nb)
RZ_API const char * rz_magic_file(RzMagic *ms, const char *inname)
RZ_API bool rz_magic_check(RzMagic *ms, const char *magicfile)
RZ_API RzMagic * rz_magic_new(int flags)
RZ_API bool rz_magic_compile(RzMagic *ms, const char *magicfile)
RZ_API bool rz_magic_load_buffer(RzMagic *ms, const char *magicdata)
RZ_API bool rz_magic_load(RzMagic *ms, const char *magicfile)
RZ_API void rz_magic_setflags(RzMagic *ms, int flags)
RZ_API const char * rz_magic_error(RzMagic *ms)
RZ_API void rz_magic_free(RzMagic *ms)
RZ_LIB_VERSION_HEADER(rz_magic)
static struct sockaddr static addrlen static backlog const void static flags void flags
#define cond(bop, top, mask, flags)
void error(const char *msg)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()