Libmagicxx v5.1.1
A C++ wrapper library over the Magic Number Recognition Library.
Loading...
Searching...
No Matches
Macros | Typedefs | Functions
magic.h File Reference
#include <sys/types.h>
Include dependency graph for magic.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MAGIC_NONE   0x0000000 /* No flags */
 
#define MAGIC_DEBUG   0x0000001 /* Turn on debugging */
 
#define MAGIC_SYMLINK   0x0000002 /* Follow symlinks */
 
#define MAGIC_COMPRESS   0x0000004 /* Check inside compressed files */
 
#define MAGIC_DEVICES   0x0000008 /* Look at the contents of devices */
 
#define MAGIC_MIME_TYPE   0x0000010 /* Return the MIME type */
 
#define MAGIC_CONTINUE   0x0000020 /* Return all matches */
 
#define MAGIC_CHECK   0x0000040 /* Print warnings to stderr */
 
#define MAGIC_PRESERVE_ATIME   0x0000080 /* Restore access time on exit */
 
#define MAGIC_RAW   0x0000100 /* Don't convert unprintable chars */
 
#define MAGIC_ERROR   0x0000200 /* Handle ENOENT etc as real errors */
 
#define MAGIC_MIME_ENCODING   0x0000400 /* Return the MIME encoding */
 
#define MAGIC_MIME   (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)
 
#define MAGIC_APPLE   0x0000800 /* Return the Apple creator/type */
 
#define MAGIC_EXTENSION
 
#define MAGIC_COMPRESS_TRANSP
 
#define MAGIC_NO_COMPRESS_FORK
 
#define MAGIC_NODESC   (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)
 
#define MAGIC_NO_CHECK_COMPRESS   0x0001000 /* Don't check for compressed files */
 
#define MAGIC_NO_CHECK_TAR   0x0002000 /* Don't check for tar files */
 
#define MAGIC_NO_CHECK_SOFT   0x0004000 /* Don't check magic entries */
 
#define MAGIC_NO_CHECK_APPTYPE   0x0008000 /* Don't check application type */
 
#define MAGIC_NO_CHECK_ELF   0x0010000 /* Don't check for elf details */
 
#define MAGIC_NO_CHECK_TEXT   0x0020000 /* Don't check for text files */
 
#define MAGIC_NO_CHECK_CDF   0x0040000 /* Don't check for cdf files */
 
#define MAGIC_NO_CHECK_CSV   0x0080000 /* Don't check for CSV files */
 
#define MAGIC_NO_CHECK_TOKENS   0x0100000 /* Don't check tokens */
 
#define MAGIC_NO_CHECK_ENCODING   0x0200000 /* Don't check text encodings */
 
#define MAGIC_NO_CHECK_JSON   0x0400000 /* Don't check for JSON files */
 
#define MAGIC_NO_CHECK_SIMH   0x0800000 /* Don't check for SIMH tape files */
 
#define MAGIC_NO_CHECK_BUILTIN
 
#define MAGIC_SNPRINTB   "\177\020\b\0debug\0\b\1symlink\0\b\2compress\0\b\3devices\0\b\4mime_type\0\b\5continue\0\b\6check\0\b\7preserve_atime\0\b\10raw\0\b\11error\0\b\12mime_encoding\0\b\13apple\0\b\14no_check_compress\0\b\15no_check_tar\0\b\16no_check_soft\0\b\17no_check_sapptype\0\b\20no_check_elf\0\b\21no_check_text\0\b\22no_check_cdf\0\b\23no_check_csv\0\b\24no_check_tokens\0\b\25no_check_encoding\0\b\26no_check_json\0\b\27no_check_simh\0\b\30extension\0\b\31transp_compression\0\"
 
#define MAGIC_NO_CHECK_ASCII   MAGIC_NO_CHECK_TEXT
 
#define MAGIC_NO_CHECK_FORTRAN   0x000000 /* Don't check ascii/fortran */
 
#define MAGIC_NO_CHECK_TROFF   0x000000 /* Don't check ascii/troff */
 
#define MAGIC_VERSION   545 /* This implementation */
 
#define MAGIC_PARAM_INDIR_MAX   0
 
#define MAGIC_PARAM_NAME_MAX   1
 
#define MAGIC_PARAM_ELF_PHNUM_MAX   2
 
#define MAGIC_PARAM_ELF_SHNUM_MAX   3
 
#define MAGIC_PARAM_ELF_NOTES_MAX   4
 
#define MAGIC_PARAM_REGEX_MAX   5
 
#define MAGIC_PARAM_BYTES_MAX   6
 
#define MAGIC_PARAM_ENCODING_MAX   7
 
#define MAGIC_PARAM_ELF_SHSIZE_MAX   8
 

Typedefs

typedef struct magic_set * magic_t
 

Functions

magic_t magic_open (int)
 
void magic_close (magic_t)
 
const char * magic_getpath (const char *, int)
 
const char * magic_file (magic_t, const char *)
 
const char * magic_descriptor (magic_t, int)
 
const char * magic_buffer (magic_t, const void *, size_t)
 
const char * magic_error (magic_t)
 
int magic_getflags (magic_t)
 
int magic_setflags (magic_t, int)
 
int magic_version (void)
 
int magic_load (magic_t, const char *)
 
int magic_load_buffers (magic_t, void **, size_t *, size_t)
 
int magic_compile (magic_t, const char *)
 
int magic_check (magic_t, const char *)
 
int magic_list (magic_t, const char *)
 
int magic_errno (magic_t)
 
int magic_setparam (magic_t, int, const void *)
 
int magic_getparam (magic_t, int, void *)
 

Macro Definition Documentation

◆ MAGIC_APPLE

#define MAGIC_APPLE   0x0000800 /* Return the Apple creator/type */

◆ MAGIC_CHECK

#define MAGIC_CHECK   0x0000040 /* Print warnings to stderr */

◆ MAGIC_COMPRESS

#define MAGIC_COMPRESS   0x0000004 /* Check inside compressed files */

◆ MAGIC_COMPRESS_TRANSP

#define MAGIC_COMPRESS_TRANSP
Value:
0x2000000 /* Check inside compressed files
* but not report compression */

◆ MAGIC_CONTINUE

#define MAGIC_CONTINUE   0x0000020 /* Return all matches */

◆ MAGIC_DEBUG

#define MAGIC_DEBUG   0x0000001 /* Turn on debugging */

◆ MAGIC_DEVICES

#define MAGIC_DEVICES   0x0000008 /* Look at the contents of devices */

◆ MAGIC_ERROR

#define MAGIC_ERROR   0x0000200 /* Handle ENOENT etc as real errors */

◆ MAGIC_EXTENSION

#define MAGIC_EXTENSION
Value:
0x1000000 /* Return a /-separated list of
* extensions */

◆ MAGIC_MIME

#define MAGIC_MIME   (MAGIC_MIME_TYPE|MAGIC_MIME_ENCODING)

◆ MAGIC_MIME_ENCODING

#define MAGIC_MIME_ENCODING   0x0000400 /* Return the MIME encoding */

◆ MAGIC_MIME_TYPE

#define MAGIC_MIME_TYPE   0x0000010 /* Return the MIME type */

◆ MAGIC_NO_CHECK_APPTYPE

#define MAGIC_NO_CHECK_APPTYPE   0x0008000 /* Don't check application type */

◆ MAGIC_NO_CHECK_ASCII

#define MAGIC_NO_CHECK_ASCII   MAGIC_NO_CHECK_TEXT

◆ MAGIC_NO_CHECK_BUILTIN

#define MAGIC_NO_CHECK_BUILTIN
Value:
( \
/* MAGIC_NO_CHECK_SOFT | */ \
0 \
)
#define MAGIC_NO_CHECK_CDF
Definition magic.h:57
#define MAGIC_NO_CHECK_TAR
Definition magic.h:52
#define MAGIC_NO_CHECK_TOKENS
Definition magic.h:59
#define MAGIC_NO_CHECK_COMPRESS
Definition magic.h:51
#define MAGIC_NO_CHECK_TEXT
Definition magic.h:56
#define MAGIC_NO_CHECK_ELF
Definition magic.h:55
#define MAGIC_NO_CHECK_ENCODING
Definition magic.h:60
#define MAGIC_NO_CHECK_SIMH
Definition magic.h:62
#define MAGIC_NO_CHECK_JSON
Definition magic.h:61
#define MAGIC_NO_CHECK_CSV
Definition magic.h:58
#define MAGIC_NO_CHECK_APPTYPE
Definition magic.h:54

◆ MAGIC_NO_CHECK_CDF

#define MAGIC_NO_CHECK_CDF   0x0040000 /* Don't check for cdf files */

◆ MAGIC_NO_CHECK_COMPRESS

#define MAGIC_NO_CHECK_COMPRESS   0x0001000 /* Don't check for compressed files */

◆ MAGIC_NO_CHECK_CSV

#define MAGIC_NO_CHECK_CSV   0x0080000 /* Don't check for CSV files */

◆ MAGIC_NO_CHECK_ELF

#define MAGIC_NO_CHECK_ELF   0x0010000 /* Don't check for elf details */

◆ MAGIC_NO_CHECK_ENCODING

#define MAGIC_NO_CHECK_ENCODING   0x0200000 /* Don't check text encodings */

◆ MAGIC_NO_CHECK_FORTRAN

#define MAGIC_NO_CHECK_FORTRAN   0x000000 /* Don't check ascii/fortran */

◆ MAGIC_NO_CHECK_JSON

#define MAGIC_NO_CHECK_JSON   0x0400000 /* Don't check for JSON files */

◆ MAGIC_NO_CHECK_SIMH

#define MAGIC_NO_CHECK_SIMH   0x0800000 /* Don't check for SIMH tape files */

◆ MAGIC_NO_CHECK_SOFT

#define MAGIC_NO_CHECK_SOFT   0x0004000 /* Don't check magic entries */

◆ MAGIC_NO_CHECK_TAR

#define MAGIC_NO_CHECK_TAR   0x0002000 /* Don't check for tar files */

◆ MAGIC_NO_CHECK_TEXT

#define MAGIC_NO_CHECK_TEXT   0x0020000 /* Don't check for text files */

◆ MAGIC_NO_CHECK_TOKENS

#define MAGIC_NO_CHECK_TOKENS   0x0100000 /* Don't check tokens */

◆ MAGIC_NO_CHECK_TROFF

#define MAGIC_NO_CHECK_TROFF   0x000000 /* Don't check ascii/troff */

◆ MAGIC_NO_COMPRESS_FORK

#define MAGIC_NO_COMPRESS_FORK
Value:
0x4000000 /* Don't allow decompression that
* needs to fork */

◆ MAGIC_NODESC

#define MAGIC_NODESC   (MAGIC_EXTENSION|MAGIC_MIME|MAGIC_APPLE)

◆ MAGIC_NONE

#define MAGIC_NONE   0x0000000 /* No flags */

◆ MAGIC_PARAM_BYTES_MAX

#define MAGIC_PARAM_BYTES_MAX   6

◆ MAGIC_PARAM_ELF_NOTES_MAX

#define MAGIC_PARAM_ELF_NOTES_MAX   4

◆ MAGIC_PARAM_ELF_PHNUM_MAX

#define MAGIC_PARAM_ELF_PHNUM_MAX   2

◆ MAGIC_PARAM_ELF_SHNUM_MAX

#define MAGIC_PARAM_ELF_SHNUM_MAX   3

◆ MAGIC_PARAM_ELF_SHSIZE_MAX

#define MAGIC_PARAM_ELF_SHSIZE_MAX   8

◆ MAGIC_PARAM_ENCODING_MAX

#define MAGIC_PARAM_ENCODING_MAX   7

◆ MAGIC_PARAM_INDIR_MAX

#define MAGIC_PARAM_INDIR_MAX   0

◆ MAGIC_PARAM_NAME_MAX

#define MAGIC_PARAM_NAME_MAX   1

◆ MAGIC_PARAM_REGEX_MAX

#define MAGIC_PARAM_REGEX_MAX   5

◆ MAGIC_PRESERVE_ATIME

#define MAGIC_PRESERVE_ATIME   0x0000080 /* Restore access time on exit */

◆ MAGIC_RAW

#define MAGIC_RAW   0x0000100 /* Don't convert unprintable chars */

◆ MAGIC_SNPRINTB

#define MAGIC_SNPRINTB   "\177\020\b\0debug\0\b\1symlink\0\b\2compress\0\b\3devices\0\b\4mime_type\0\b\5continue\0\b\6check\0\b\7preserve_atime\0\b\10raw\0\b\11error\0\b\12mime_encoding\0\b\13apple\0\b\14no_check_compress\0\b\15no_check_tar\0\b\16no_check_soft\0\b\17no_check_sapptype\0\b\20no_check_elf\0\b\21no_check_text\0\b\22no_check_cdf\0\b\23no_check_csv\0\b\24no_check_tokens\0\b\25no_check_encoding\0\b\26no_check_json\0\b\27no_check_simh\0\b\30extension\0\b\31transp_compression\0\"

◆ MAGIC_SYMLINK

#define MAGIC_SYMLINK   0x0000002 /* Follow symlinks */

◆ MAGIC_VERSION

#define MAGIC_VERSION   545 /* This implementation */

Typedef Documentation

◆ magic_t

typedef struct magic_set* magic_t

Function Documentation

◆ magic_buffer()

const char * magic_buffer ( magic_t ,
const void * ,
size_t  )

◆ magic_check()

int magic_check ( magic_t ,
const char *  )

◆ magic_close()

void magic_close ( magic_t )

◆ magic_compile()

int magic_compile ( magic_t ,
const char *  )

◆ magic_descriptor()

const char * magic_descriptor ( magic_t ,
int  )

◆ magic_errno()

int magic_errno ( magic_t )

◆ magic_error()

const char * magic_error ( magic_t )

◆ magic_file()

const char * magic_file ( magic_t ,
const char *  )

◆ magic_getflags()

int magic_getflags ( magic_t )

◆ magic_getparam()

int magic_getparam ( magic_t ,
int ,
void *  )

◆ magic_getpath()

const char * magic_getpath ( const char * ,
int  )

◆ magic_list()

int magic_list ( magic_t ,
const char *  )

◆ magic_load()

int magic_load ( magic_t ,
const char *  )

◆ magic_load_buffers()

int magic_load_buffers ( magic_t ,
void ** ,
size_t * ,
size_t  )

◆ magic_open()

magic_t magic_open ( int )

◆ magic_setflags()

int magic_setflags ( magic_t ,
int  )

◆ magic_setparam()

int magic_setparam ( magic_t ,
int ,
const void *  )

◆ magic_version()

int magic_version ( void )