libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

extractor.h (30836B)


      1 /*
      2      This file is part of libextractor.
      3      Copyright (C) 2002-2017 Vidyut Samanta and Christian Grothoff
      4 
      5      libextractor is free software; you can redistribute it and/or modify
      6      it under the terms of the GNU General Public License as published
      7      by the Free Software Foundation; either version 3, or (at your
      8      option) any later version.
      9 
     10      libextractor is distributed in the hope that it will be useful, but
     11      WITHOUT ANY WARRANTY; without even the implied warranty of
     12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13      General Public License for more details.
     14 
     15      You should have received a copy of the GNU General Public License
     16      along with libextractor; see the file COPYING.  If not, write to the
     17      Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18      Boston, MA 02110-1301, USA.
     19  */
     20 
     21 #ifndef EXTRACTOR_H
     22 #define EXTRACTOR_H
     23 
     24 #ifdef __cplusplus
     25 extern "C" {
     26 #if 0 /* keep Emacsens' auto-indent happy */
     27 }
     28 #endif
     29 #endif
     30 
     31 
     32 #include <stdint.h>
     33 
     34 /**
     35  * 0.2.6-1 => 0x00020601
     36  * 4.5.2-0 => 0x04050200
     37  */
     38 #define EXTRACTOR_VERSION 0x01120000
     39 
     40 #include <stdio.h>
     41 
     42 #ifndef _EXTRACTOR_EXTERN
     43 #if defined(_WIN32) && defined(MHD_W32LIB)
     44 #define _EXTRACTOR_EXTERN extern
     45 #elif defined (_WIN32) && defined(MHD_W32DLL)
     46 /* Define MHD_W32DLL when using MHD as W32 .DLL to speed up linker a little */
     47 #define _EXTRACTOR_EXTERN __declspec(dllimport)
     48 #else
     49 #define _EXTRACTOR_EXTERN extern
     50 #endif
     51 #endif
     52 
     53 /**
     54  * Options for how plugin execution should be done.
     55  */
     56 enum EXTRACTOR_Options
     57 {
     58 
     59   /**
     60    * Run plugin out-of-process, starting the process once the plugin
     61    * is to be run.  If a plugin crashes, automatically restart the
     62    * respective process for the same file and try once more
     63    * (since the crash may be caused by the previous file).  If
     64    * the process crashes immediately again, it is not restarted
     65    * until the next file.
     66    */
     67   EXTRACTOR_OPTION_DEFAULT_POLICY = 0,
     68 
     69   /**
     70    * Deprecated option.  Ignored.
     71    */
     72   EXTRACTOR_OPTION_OUT_OF_PROCESS_NO_RESTART = 1,
     73 
     74   /**
     75    * Run plugins in-process.  Unsafe, not recommended,
     76    * can be nice for debugging.
     77    */
     78   EXTRACTOR_OPTION_IN_PROCESS = 2,
     79 
     80   /**
     81    * Internal value for plugins that have been disabled.
     82    */
     83   EXTRACTOR_OPTION_DISABLED = 3
     84 
     85 };
     86 
     87 
     88 /**
     89  * Format in which the extracted meta data is presented.
     90  */
     91 enum EXTRACTOR_MetaFormat
     92 {
     93   /**
     94    * Format is unknown.
     95    */
     96   EXTRACTOR_METAFORMAT_UNKNOWN = 0,
     97 
     98   /**
     99    * 0-terminated, UTF-8 encoded string.  "data_len"
    100    * is strlen(data)+1.
    101    */
    102   EXTRACTOR_METAFORMAT_UTF8 = 1,
    103 
    104   /**
    105    * Some kind of binary format, see given Mime type.
    106    */
    107   EXTRACTOR_METAFORMAT_BINARY = 2,
    108 
    109   /**
    110    * 0-terminated string.  The specific encoding is unknown.
    111    * "data_len" is strlen (data)+1.
    112    */
    113   EXTRACTOR_METAFORMAT_C_STRING = 3
    114 
    115 };
    116 
    117 
    118 /**
    119  * Enumeration defining various sources of keywords.  See also
    120  * http://dublincore.org/documents/1998/09/dces/
    121  *
    122  * @defgroup types meta data types
    123  * @{
    124  */
    125 enum EXTRACTOR_MetaType
    126 {
    127   /* available to application for marking an `enum EXTRACTOR_MetaType` as not
    128      carrying any meaningful value - never used by libextractor */
    129   EXTRACTOR_METATYPE_NONE = -1,
    130 
    131   /* reserved should be used as a terminator (like the '\0'-terminator for strings)
    132      and is never used directly by libextractor */
    133   EXTRACTOR_METATYPE_RESERVED = 0,
    134 
    135   EXTRACTOR_METATYPE_MIMETYPE = 1,
    136   EXTRACTOR_METATYPE_FILENAME = 2,
    137   EXTRACTOR_METATYPE_COMMENT = 3,
    138 
    139   /* Standard types from bibtex */
    140   EXTRACTOR_METATYPE_TITLE = 4,
    141   EXTRACTOR_METATYPE_BOOK_TITLE = 5,
    142   EXTRACTOR_METATYPE_BOOK_EDITION = 6,
    143   EXTRACTOR_METATYPE_BOOK_CHAPTER_NUMBER = 7,
    144   EXTRACTOR_METATYPE_JOURNAL_NAME = 8,
    145   EXTRACTOR_METATYPE_JOURNAL_VOLUME = 9,
    146   EXTRACTOR_METATYPE_JOURNAL_NUMBER = 10,
    147   EXTRACTOR_METATYPE_PAGE_COUNT = 11,
    148   EXTRACTOR_METATYPE_PAGE_RANGE = 12,
    149   EXTRACTOR_METATYPE_AUTHOR_NAME = 13,
    150   EXTRACTOR_METATYPE_AUTHOR_EMAIL = 14,
    151   EXTRACTOR_METATYPE_AUTHOR_INSTITUTION = 15,
    152   EXTRACTOR_METATYPE_PUBLISHER = 16,
    153   EXTRACTOR_METATYPE_PUBLISHER_ADDRESS = 17,
    154   EXTRACTOR_METATYPE_PUBLISHER_INSTITUTION = 18,
    155   EXTRACTOR_METATYPE_PUBLISHER_SERIES = 19,
    156   EXTRACTOR_METATYPE_PUBLICATION_TYPE = 20,
    157   EXTRACTOR_METATYPE_PUBLICATION_YEAR = 21,
    158   EXTRACTOR_METATYPE_PUBLICATION_MONTH = 22,
    159   EXTRACTOR_METATYPE_PUBLICATION_DAY = 23,
    160   EXTRACTOR_METATYPE_PUBLICATION_DATE = 24,
    161   EXTRACTOR_METATYPE_BIBTEX_EPRINT = 25,
    162   EXTRACTOR_METATYPE_BIBTEX_ENTRY_TYPE = 26,
    163   EXTRACTOR_METATYPE_LANGUAGE = 27,
    164   EXTRACTOR_METATYPE_CREATION_TIME = 28,
    165   EXTRACTOR_METATYPE_URL = 29,
    166 
    167   /* "unique" document identifiers */
    168   EXTRACTOR_METATYPE_URI = 30,
    169   EXTRACTOR_METATYPE_ISRC = 31,
    170   EXTRACTOR_METATYPE_HASH_MD4 = 32,
    171   EXTRACTOR_METATYPE_HASH_MD5 = 33,
    172   EXTRACTOR_METATYPE_HASH_SHA0 = 34,
    173   EXTRACTOR_METATYPE_HASH_SHA1 = 35,
    174   EXTRACTOR_METATYPE_HASH_RMD160 = 36,
    175 
    176   /* identifiers of a location */
    177   EXTRACTOR_METATYPE_GPS_LATITUDE_REF = 37,
    178   EXTRACTOR_METATYPE_GPS_LATITUDE = 38,
    179   EXTRACTOR_METATYPE_GPS_LONGITUDE_REF = 39,
    180   EXTRACTOR_METATYPE_GPS_LONGITUDE = 40,
    181   EXTRACTOR_METATYPE_LOCATION_CITY = 41,
    182   EXTRACTOR_METATYPE_LOCATION_SUBLOCATION = 42,
    183   EXTRACTOR_METATYPE_LOCATION_COUNTRY = 43,
    184   EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE = 44,
    185 
    186   /* generic attributes */
    187   EXTRACTOR_METATYPE_UNKNOWN = 45,
    188   EXTRACTOR_METATYPE_DESCRIPTION = 46,
    189   EXTRACTOR_METATYPE_COPYRIGHT = 47,
    190   EXTRACTOR_METATYPE_RIGHTS = 48,
    191   EXTRACTOR_METATYPE_KEYWORDS = 49,
    192   EXTRACTOR_METATYPE_ABSTRACT = 50,
    193   EXTRACTOR_METATYPE_SUMMARY = 51,
    194   EXTRACTOR_METATYPE_SUBJECT = 52,
    195   EXTRACTOR_METATYPE_CREATOR = 53,
    196   EXTRACTOR_METATYPE_FORMAT = 54,
    197   EXTRACTOR_METATYPE_FORMAT_VERSION = 55,
    198 
    199   /* processing history */
    200   EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE = 56,
    201   EXTRACTOR_METATYPE_UNKNOWN_DATE = 57,
    202   EXTRACTOR_METATYPE_CREATION_DATE = 58,
    203   EXTRACTOR_METATYPE_MODIFICATION_DATE = 59,
    204   EXTRACTOR_METATYPE_LAST_PRINTED = 60,
    205   EXTRACTOR_METATYPE_LAST_SAVED_BY = 61,
    206   EXTRACTOR_METATYPE_TOTAL_EDITING_TIME = 62,
    207   EXTRACTOR_METATYPE_EDITING_CYCLES = 63,
    208   EXTRACTOR_METATYPE_MODIFIED_BY_SOFTWARE = 64,
    209   EXTRACTOR_METATYPE_REVISION_HISTORY = 65,
    210 
    211   EXTRACTOR_METATYPE_EMBEDDED_FILE_SIZE = 66,
    212   EXTRACTOR_METATYPE_FINDER_FILE_TYPE = 67,
    213   EXTRACTOR_METATYPE_FINDER_FILE_CREATOR = 68,
    214 
    215   /* software package specifics (deb, rpm, tgz, elf) */
    216   EXTRACTOR_METATYPE_PACKAGE_NAME = 69,
    217   EXTRACTOR_METATYPE_PACKAGE_VERSION = 70,
    218   EXTRACTOR_METATYPE_SECTION = 71,
    219   EXTRACTOR_METATYPE_UPLOAD_PRIORITY = 72,
    220   EXTRACTOR_METATYPE_PACKAGE_DEPENDENCY = 73,
    221   EXTRACTOR_METATYPE_PACKAGE_CONFLICTS = 74,
    222   EXTRACTOR_METATYPE_PACKAGE_REPLACES = 75,
    223   EXTRACTOR_METATYPE_PACKAGE_PROVIDES = 76,
    224   EXTRACTOR_METATYPE_PACKAGE_RECOMMENDS = 77,
    225   EXTRACTOR_METATYPE_PACKAGE_SUGGESTS = 78,
    226   EXTRACTOR_METATYPE_PACKAGE_MAINTAINER = 79,
    227   EXTRACTOR_METATYPE_PACKAGE_INSTALLED_SIZE = 80,
    228   EXTRACTOR_METATYPE_PACKAGE_SOURCE = 81,
    229   EXTRACTOR_METATYPE_PACKAGE_ESSENTIAL = 82,
    230   EXTRACTOR_METATYPE_TARGET_ARCHITECTURE = 83,
    231   EXTRACTOR_METATYPE_PACKAGE_PRE_DEPENDENCY = 84,
    232   EXTRACTOR_METATYPE_LICENSE = 85,
    233   EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION = 86,
    234   EXTRACTOR_METATYPE_BUILDHOST = 87,
    235   EXTRACTOR_METATYPE_VENDOR = 88,
    236   EXTRACTOR_METATYPE_TARGET_OS = 89,
    237   EXTRACTOR_METATYPE_SOFTWARE_VERSION = 90,
    238   EXTRACTOR_METATYPE_TARGET_PLATFORM = 91,
    239   EXTRACTOR_METATYPE_RESOURCE_TYPE = 92,
    240   EXTRACTOR_METATYPE_LIBRARY_SEARCH_PATH = 93,
    241   EXTRACTOR_METATYPE_LIBRARY_DEPENDENCY = 94,
    242 
    243   /* photography specifics */
    244   EXTRACTOR_METATYPE_CAMERA_MAKE = 95,
    245   EXTRACTOR_METATYPE_CAMERA_MODEL = 96,
    246   EXTRACTOR_METATYPE_EXPOSURE = 97,
    247   EXTRACTOR_METATYPE_APERTURE = 98,
    248   EXTRACTOR_METATYPE_EXPOSURE_BIAS = 99,
    249   EXTRACTOR_METATYPE_FLASH = 100,
    250   EXTRACTOR_METATYPE_FLASH_BIAS = 101,
    251   EXTRACTOR_METATYPE_FOCAL_LENGTH = 102,
    252   EXTRACTOR_METATYPE_FOCAL_LENGTH_35MM = 103,
    253   EXTRACTOR_METATYPE_ISO_SPEED = 104,
    254   EXTRACTOR_METATYPE_EXPOSURE_MODE = 105,
    255   EXTRACTOR_METATYPE_METERING_MODE = 106,
    256   EXTRACTOR_METATYPE_MACRO_MODE = 107,
    257   EXTRACTOR_METATYPE_IMAGE_QUALITY = 108,
    258   EXTRACTOR_METATYPE_WHITE_BALANCE = 109,
    259   EXTRACTOR_METATYPE_ORIENTATION = 110,
    260   EXTRACTOR_METATYPE_MAGNIFICATION = 111,
    261 
    262   /* image specifics */
    263   EXTRACTOR_METATYPE_IMAGE_DIMENSIONS = 112,
    264   EXTRACTOR_METATYPE_PRODUCED_BY_SOFTWARE = 113,
    265   EXTRACTOR_METATYPE_THUMBNAIL = 114,
    266   EXTRACTOR_METATYPE_IMAGE_RESOLUTION = 115,
    267   EXTRACTOR_METATYPE_SOURCE = 116,
    268 
    269   /* (text) document processing specifics */
    270   EXTRACTOR_METATYPE_CHARACTER_SET = 117,
    271   EXTRACTOR_METATYPE_LINE_COUNT = 118,
    272   EXTRACTOR_METATYPE_PARAGRAPH_COUNT = 119,
    273   EXTRACTOR_METATYPE_WORD_COUNT = 120,
    274   EXTRACTOR_METATYPE_CHARACTER_COUNT = 121,
    275   EXTRACTOR_METATYPE_PAGE_ORIENTATION = 122,
    276   EXTRACTOR_METATYPE_PAPER_SIZE = 123,
    277   EXTRACTOR_METATYPE_TEMPLATE = 124,
    278   EXTRACTOR_METATYPE_COMPANY = 125,
    279   EXTRACTOR_METATYPE_MANAGER = 126,
    280   EXTRACTOR_METATYPE_REVISION_NUMBER = 127,
    281 
    282   /* music / video specifics */
    283   EXTRACTOR_METATYPE_DURATION = 128,
    284   EXTRACTOR_METATYPE_ALBUM = 129,
    285   EXTRACTOR_METATYPE_ARTIST = 130,
    286   EXTRACTOR_METATYPE_GENRE = 131,
    287   EXTRACTOR_METATYPE_TRACK_NUMBER = 132,
    288   EXTRACTOR_METATYPE_DISC_NUMBER = 133,
    289   EXTRACTOR_METATYPE_PERFORMER = 134,
    290   EXTRACTOR_METATYPE_CONTACT_INFORMATION = 135,
    291   EXTRACTOR_METATYPE_SONG_VERSION = 136,
    292   EXTRACTOR_METATYPE_PICTURE = 137,
    293   EXTRACTOR_METATYPE_COVER_PICTURE = 138,
    294   EXTRACTOR_METATYPE_CONTRIBUTOR_PICTURE = 139,
    295   EXTRACTOR_METATYPE_EVENT_PICTURE = 140,
    296   EXTRACTOR_METATYPE_LOGO = 141,
    297   EXTRACTOR_METATYPE_BROADCAST_TELEVISION_SYSTEM = 142,
    298   EXTRACTOR_METATYPE_SOURCE_DEVICE = 143,
    299   EXTRACTOR_METATYPE_DISCLAIMER = 144,
    300   EXTRACTOR_METATYPE_WARNING = 145,
    301   EXTRACTOR_METATYPE_PAGE_ORDER = 146,
    302   EXTRACTOR_METATYPE_WRITER = 147,
    303   EXTRACTOR_METATYPE_PRODUCT_VERSION = 148,
    304   EXTRACTOR_METATYPE_CONTRIBUTOR_NAME = 149,
    305   EXTRACTOR_METATYPE_MOVIE_DIRECTOR = 150,
    306   EXTRACTOR_METATYPE_NETWORK_NAME = 151,
    307   EXTRACTOR_METATYPE_SHOW_NAME = 152,
    308   EXTRACTOR_METATYPE_CHAPTER_NAME = 153,
    309   EXTRACTOR_METATYPE_SONG_COUNT = 154,
    310   EXTRACTOR_METATYPE_STARTING_SONG = 155,
    311   EXTRACTOR_METATYPE_PLAY_COUNTER = 156,
    312   EXTRACTOR_METATYPE_CONDUCTOR = 157,
    313   EXTRACTOR_METATYPE_INTERPRETATION = 158,
    314   EXTRACTOR_METATYPE_COMPOSER = 159,
    315   EXTRACTOR_METATYPE_BEATS_PER_MINUTE = 160,
    316   EXTRACTOR_METATYPE_ENCODED_BY = 161,
    317   EXTRACTOR_METATYPE_ORIGINAL_TITLE = 162,
    318   EXTRACTOR_METATYPE_ORIGINAL_ARTIST = 163,
    319   EXTRACTOR_METATYPE_ORIGINAL_WRITER = 164,
    320   EXTRACTOR_METATYPE_ORIGINAL_RELEASE_YEAR = 165,
    321   EXTRACTOR_METATYPE_ORIGINAL_PERFORMER = 166,
    322   EXTRACTOR_METATYPE_LYRICS = 167,
    323   EXTRACTOR_METATYPE_POPULARITY_METER = 168,
    324   EXTRACTOR_METATYPE_LICENSEE = 169,
    325   EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST = 170,
    326   EXTRACTOR_METATYPE_MOOD = 171,
    327   EXTRACTOR_METATYPE_SUBTITLE = 172,
    328 
    329   /* GNUnet specific values (never extracted) */
    330   EXTRACTOR_METATYPE_GNUNET_DISPLAY_TYPE = 173,
    331   EXTRACTOR_METATYPE_GNUNET_FULL_DATA = 174,
    332   EXTRACTOR_METATYPE_RATING = 175,
    333   EXTRACTOR_METATYPE_ORGANIZATION = 176,
    334   EXTRACTOR_METATYPE_RIPPER = 177,
    335   EXTRACTOR_METATYPE_PRODUCER = 178,
    336   EXTRACTOR_METATYPE_GROUP = 179,
    337   EXTRACTOR_METATYPE_GNUNET_ORIGINAL_FILENAME = 180,
    338 
    339   EXTRACTOR_METATYPE_DISC_COUNT = 181,
    340 
    341   EXTRACTOR_METATYPE_CODEC = 182,
    342   EXTRACTOR_METATYPE_VIDEO_CODEC = 183,
    343   EXTRACTOR_METATYPE_AUDIO_CODEC = 184,
    344   EXTRACTOR_METATYPE_SUBTITLE_CODEC = 185,
    345 
    346   EXTRACTOR_METATYPE_CONTAINER_FORMAT = 186,
    347 
    348   EXTRACTOR_METATYPE_BITRATE = 187,
    349   EXTRACTOR_METATYPE_NOMINAL_BITRATE = 188,
    350   EXTRACTOR_METATYPE_MINIMUM_BITRATE = 189,
    351   EXTRACTOR_METATYPE_MAXIMUM_BITRATE = 190,
    352 
    353   EXTRACTOR_METATYPE_SERIAL = 191,
    354 
    355   EXTRACTOR_METATYPE_ENCODER = 192,
    356   EXTRACTOR_METATYPE_ENCODER_VERSION = 193,
    357 
    358   EXTRACTOR_METATYPE_TRACK_GAIN = 194,
    359   EXTRACTOR_METATYPE_TRACK_PEAK = 195,
    360   EXTRACTOR_METATYPE_ALBUM_GAIN = 196,
    361   EXTRACTOR_METATYPE_ALBUM_PEAK = 197,
    362   EXTRACTOR_METATYPE_REFERENCE_LEVEL = 198,
    363 
    364   EXTRACTOR_METATYPE_LOCATION_NAME = 199,
    365   EXTRACTOR_METATYPE_LOCATION_ELEVATION = 200,
    366   EXTRACTOR_METATYPE_LOCATION_HORIZONTAL_ERROR = 201,
    367   EXTRACTOR_METATYPE_LOCATION_MOVEMENT_SPEED = 202,
    368   EXTRACTOR_METATYPE_LOCATION_MOVEMENT_DIRECTION = 203,
    369   EXTRACTOR_METATYPE_LOCATION_CAPTURE_DIRECTION = 204,
    370 
    371   EXTRACTOR_METATYPE_SHOW_EPISODE_NUMBER = 205,
    372   EXTRACTOR_METATYPE_SHOW_SEASON_NUMBER = 206,
    373 
    374   EXTRACTOR_METATYPE_GROUPING = 207,
    375 
    376   EXTRACTOR_METATYPE_DEVICE_MANUFACTURER = 208,
    377   EXTRACTOR_METATYPE_DEVICE_MODEL = 209,
    378 
    379   EXTRACTOR_METATYPE_AUDIO_LANGUAGE = 210,
    380   EXTRACTOR_METATYPE_CHANNELS = 211,
    381   EXTRACTOR_METATYPE_SAMPLE_RATE = 212,
    382   EXTRACTOR_METATYPE_AUDIO_DEPTH = 213,
    383   EXTRACTOR_METATYPE_AUDIO_BITRATE = 214,
    384   EXTRACTOR_METATYPE_MAXIMUM_AUDIO_BITRATE = 215,
    385 
    386   EXTRACTOR_METATYPE_VIDEO_DIMENSIONS = 216,
    387   EXTRACTOR_METATYPE_VIDEO_DEPTH = 217,
    388   EXTRACTOR_METATYPE_FRAME_RATE = 218,
    389   EXTRACTOR_METATYPE_PIXEL_ASPECT_RATIO = 219,
    390   EXTRACTOR_METATYPE_VIDEO_BITRATE = 220,
    391   EXTRACTOR_METATYPE_MAXIMUM_VIDEO_BITRATE = 221,
    392 
    393   EXTRACTOR_METATYPE_SUBTITLE_LANGUAGE = 222,
    394   EXTRACTOR_METATYPE_VIDEO_LANGUAGE = 223,
    395 
    396   EXTRACTOR_METATYPE_TOC = 224,
    397 
    398   EXTRACTOR_METATYPE_VIDEO_DURATION = 225,
    399   EXTRACTOR_METATYPE_AUDIO_DURATION = 226,
    400   EXTRACTOR_METATYPE_SUBTITLE_DURATION = 227,
    401 
    402   EXTRACTOR_METATYPE_AUDIO_PREVIEW = 228,
    403 
    404   EXTRACTOR_METATYPE_NARINFO = 229,
    405   EXTRACTOR_METATYPE_NAR = 230,
    406 
    407   /**
    408    * Operating system the document was last written on, as recorded in
    409    * the PropertySetSystemIdentifier of an OLE2 property set.
    410    */
    411   EXTRACTOR_METATYPE_AUTHORING_OS = 231,
    412 
    413   /* The types below were introduced for formats whose interesting
    414      content is provenance rather than authorship: executables, disk
    415      images, databases, mail and geodata.  They are meant to survive a
    416      single fast pass over a file, so each of them is something that can
    417      be read out of a header without decoding the payload. */
    418 
    419   /**
    420    * Timestamp recorded by the linker or archiver when the file was
    421    * built, as opposed to when the file was created on this filesystem.
    422    */
    423   EXTRACTOR_METATYPE_BUILD_DATE = 232,
    424 
    425   /**
    426    * Identifier tying a binary to the debug information built with it
    427    * (PE debug directory GUID, Mach-O LC_UUID, ELF build-id).
    428    */
    429   EXTRACTOR_METATYPE_BUILD_ID = 233,
    430 
    431   /**
    432    * Compiler and linker that produced the file, where the format
    433    * records it separately from the authoring application (the PE
    434    * "Rich" header, for example).
    435    */
    436   EXTRACTOR_METATYPE_TOOLCHAIN = 234,
    437 
    438   /**
    439    * Path to the debug symbols recorded at build time.  Frequently
    440    * discloses the user name and directory layout of the build machine.
    441    */
    442   EXTRACTOR_METATYPE_DEBUG_PATH = 235,
    443 
    444   /**
    445    * Hash over the imported symbols of an executable ("imphash").
    446    */
    447   EXTRACTOR_METATYPE_IMPORT_HASH = 236,
    448 
    449   /**
    450    * Entry point of an executable or archive: a virtual address, or a
    451    * class name for a Java archive.
    452    */
    453   EXTRACTOR_METATYPE_ENTRY_POINT = 237,
    454 
    455   /**
    456    * Execution environment an executable asks the loader for, such as
    457    * "Windows GUI", "Windows console" or "native".
    458    */
    459   EXTRACTOR_METATYPE_SUBSYSTEM = 238,
    460 
    461   /**
    462    * Exploit mitigations the binary opts into (ASLR, DEP, control flow
    463    * guard, ...).
    464    */
    465   EXTRACTOR_METATYPE_SECURITY_MITIGATIONS = 239,
    466 
    467   /**
    468    * Entity that signed the file: a code signing subject, a certificate
    469    * common name, or the signing domain of a mail signature.
    470    */
    471   EXTRACTOR_METATYPE_SIGNER = 240,
    472 
    473   /**
    474    * Fingerprint of the certificate the file was signed with.
    475    */
    476   EXTRACTOR_METATYPE_CERTIFICATE_FINGERPRINT = 241,
    477 
    478   /**
    479    * Shannon entropy of the file or of one of its sections; high values
    480    * suggest compressed, encrypted or packed content.
    481    */
    482   EXTRACTOR_METATYPE_ENTROPY = 242,
    483 
    484   /**
    485    * Name of the product the file belongs to, where that is recorded
    486    * separately from the title.
    487    */
    488   EXTRACTOR_METATYPE_PRODUCT_NAME = 243,
    489 
    490   /**
    491    * Path this file points at: the target of a shortcut or a symlink.
    492    */
    493   EXTRACTOR_METATYPE_TARGET_PATH = 244,
    494 
    495   /**
    496    * Directory a shortcut or launcher starts its target in.
    497    */
    498   EXTRACTOR_METATYPE_WORKING_DIRECTORY = 245,
    499 
    500   /**
    501    * Arguments a shortcut or launcher passes to its target.
    502    */
    503   EXTRACTOR_METATYPE_COMMAND_LINE = 246,
    504 
    505   /**
    506    * Name of the user owning the file, as recorded inside the format.
    507    */
    508   EXTRACTOR_METATYPE_OWNER_USER = 247,
    509 
    510   /**
    511    * Name of the group owning the file, as recorded inside the format.
    512    */
    513   EXTRACTOR_METATYPE_OWNER_GROUP = 248,
    514 
    515   /**
    516    * Numeric user id of the owner, as recorded inside the format.
    517    */
    518   EXTRACTOR_METATYPE_OWNER_UID = 249,
    519 
    520   /**
    521    * Numeric group id of the owner, as recorded inside the format.
    522    */
    523   EXTRACTOR_METATYPE_OWNER_GID = 250,
    524 
    525   /**
    526    * Access permissions recorded inside the format, such as a Unix mode.
    527    */
    528   EXTRACTOR_METATYPE_PERMISSIONS = 251,
    529 
    530   /**
    531    * Time the file was last read, as recorded inside the format.
    532    */
    533   EXTRACTOR_METATYPE_ACCESS_DATE = 252,
    534 
    535   /**
    536    * Filesystem attribute flags recorded inside the format, such as
    537    * hidden, system, read-only or archive.
    538    */
    539   EXTRACTOR_METATYPE_ATTRIBUTES = 253,
    540 
    541   /**
    542    * Label of the volume the file describes or was taken from.
    543    */
    544   EXTRACTOR_METATYPE_VOLUME_NAME = 254,
    545 
    546   /**
    547    * Serial number or UUID identifying a volume or disk image.
    548    */
    549   EXTRACTOR_METATYPE_VOLUME_SERIAL = 255,
    550 
    551   /**
    552    * Capacity of the volume or virtual disk.
    553    */
    554   EXTRACTOR_METATYPE_VOLUME_SIZE = 256,
    555 
    556   /**
    557    * Size of the format's allocation unit: a sector, a database page or
    558    * a disk image cluster.
    559    */
    560   EXTRACTOR_METATYPE_BLOCK_SIZE = 257,
    561 
    562   /**
    563    * File system contained in or described by the file.
    564    */
    565   EXTRACTOR_METATYPE_FILESYSTEM_TYPE = 258,
    566 
    567   /**
    568    * Image this one is a delta against: a backing file or a
    569    * differencing parent.
    570    */
    571   EXTRACTOR_METATYPE_PARENT_IMAGE = 259,
    572 
    573   /**
    574    * Unused capacity reported by the format.
    575    */
    576   EXTRACTOR_METATYPE_FREE_SPACE = 260,
    577 
    578   /**
    579    * System the volume was intended for, as recorded in its descriptor.
    580    */
    581   EXTRACTOR_METATYPE_SYSTEM_IDENTIFIER = 261,
    582 
    583   /**
    584    * Party that assembled the data on a volume, as distinct from the
    585    * party that published it.
    586    */
    587   EXTRACTOR_METATYPE_DATA_PREPARER = 262,
    588 
    589   /**
    590    * Date after which the content is no longer considered valid.
    591    */
    592   EXTRACTOR_METATYPE_EXPIRATION_DATE = 263,
    593 
    594   /**
    595    * Encryption or digital restrictions protecting the content.
    596    */
    597   EXTRACTOR_METATYPE_ENCRYPTION = 264,
    598 
    599   /**
    600    * Identifier of the application that owns the file, such as a bundle
    601    * identifier or a database application id.
    602    */
    603   EXTRACTOR_METATYPE_APPLICATION_ID = 265,
    604 
    605   /**
    606    * Version of the schema the content is laid out according to.
    607    */
    608   EXTRACTOR_METATYPE_SCHEMA_VERSION = 266,
    609 
    610   /**
    611    * Counter the format increments on every modification.
    612    */
    613   EXTRACTOR_METATYPE_CHANGE_COUNTER = 267,
    614 
    615   /**
    616    * Crash recovery strategy a database is configured for.
    617    */
    618   EXTRACTOR_METATYPE_JOURNAL_MODE = 268,
    619 
    620   /**
    621    * Number of items the file holds: archive members, database records,
    622    * mail messages, placemarks.
    623    */
    624   EXTRACTOR_METATYPE_ENTRY_COUNT = 269,
    625 
    626   /**
    627    * Total size of the content once decompressed.
    628    */
    629   EXTRACTOR_METATYPE_UNCOMPRESSED_SIZE = 270,
    630 
    631   /**
    632    * Coordinate reference system geographic data is expressed in.
    633    */
    634   EXTRACTOR_METATYPE_COORDINATE_SYSTEM = 271,
    635 
    636   /**
    637    * Geographic extent covered by the file, as west, south, east, north.
    638    */
    639   EXTRACTOR_METATYPE_BOUNDING_BOX = 272,
    640 
    641   /**
    642    * Length of a recorded path.
    643    */
    644   EXTRACTOR_METATYPE_DISTANCE = 273,
    645 
    646   /**
    647    * Identifier assigned to a message by the system that created it.
    648    */
    649   EXTRACTOR_METATYPE_MESSAGE_ID = 274,
    650 
    651   /**
    652    * Identifier of the message this one answers.
    653    */
    654   EXTRACTOR_METATYPE_IN_REPLY_TO = 275,
    655 
    656   /**
    657    * Addressee of a message.
    658    */
    659   EXTRACTOR_METATYPE_RECIPIENT = 276,
    660 
    661   /**
    662    * One hop of the path a message travelled, as recorded by a relay.
    663    */
    664   EXTRACTOR_METATYPE_RECEIVED_FROM = 277,
    665 
    666   /**
    667    * Network address recorded in the file.
    668    */
    669   EXTRACTOR_METATYPE_IP_ADDRESS = 278,
    670 
    671   /**
    672    * Parameters the encoder was invoked with.
    673    */
    674   EXTRACTOR_METATYPE_ENCODER_SETTINGS = 279,
    675 
    676   /**
    677    * Whether the bitrate is constant, variable or average.
    678    */
    679   EXTRACTOR_METATYPE_BITRATE_MODE = 280,
    680 
    681   /**
    682    * Bits per colour component.
    683    */
    684   EXTRACTOR_METATYPE_COLOR_DEPTH = 281,
    685 
    686   /**
    687    * Colour space or ICC profile the content is expressed in.
    688    */
    689   EXTRACTOR_METATYPE_COLOR_PROFILE = 282,
    690 
    691   /**
    692    * Specifications a container declares itself compatible with.
    693    */
    694   EXTRACTOR_METATYPE_COMPATIBLE_BRANDS = 283,
    695 
    696   /**
    697    * Account the content was bought with, as embedded by the store.
    698    */
    699   EXTRACTOR_METATYPE_PURCHASE_ACCOUNT = 284,
    700 
    701   /**
    702    * Marking identifying the recipient of an individual copy.
    703    */
    704   EXTRACTOR_METATYPE_WATERMARK = 285,
    705 
    706   /**
    707    * International standard book number.
    708    */
    709   EXTRACTOR_METATYPE_ISBN = 286,
    710 
    711   /**
    712    * Capability an application asks the platform for.
    713    */
    714   EXTRACTOR_METATYPE_PERMISSION = 287,
    715 
    716   /**
    717    * Hardware address recorded in the file.
    718    */
    719   EXTRACTOR_METATYPE_MAC_ADDRESS = 288,
    720 
    721   /**
    722    * Name of the machine the file originated on.
    723    */
    724   EXTRACTOR_METATYPE_SOURCE_HOST = 289,
    725 
    726   /**
    727    * Oldest platform release the content will run on.
    728    */
    729   EXTRACTOR_METATYPE_MINIMUM_OS_VERSION = 290,
    730 
    731   EXTRACTOR_METATYPE_LAST = 291
    732 };
    733 
    734 /** @} */ /* end of meta data types */
    735 
    736 /**
    737  * Get the textual name of the keyword.
    738  *
    739  * @param type meta type to get a UTF-8 string for
    740  * @return NULL if the type is not known, otherwise
    741  *         an English (locale: C) string describing the type;
    742  *         translate using `dgettext ("libextractor", rval)`
    743  * @ingroup types
    744  */
    745 _EXTRACTOR_EXTERN const char *
    746 EXTRACTOR_metatype_to_string (enum EXTRACTOR_MetaType type);
    747 
    748 
    749 /**
    750  * Get a long description for the meta type.
    751  *
    752  * @param type meta type to get a UTF-8 description for
    753  * @return NULL if the type is not known, otherwise
    754  *         an English (locale: C) string describing the type;
    755  *         translate using `dgettext ("libextractor", rval)`
    756  * @ingroup types
    757  */
    758 _EXTRACTOR_EXTERN const char *
    759 EXTRACTOR_metatype_to_description (enum EXTRACTOR_MetaType type);
    760 
    761 
    762 /**
    763  * Return the highest type number, exclusive as in [0,max).
    764  *
    765  * @return highest legal metatype number for this version of libextractor
    766  * @ingroup types
    767  */
    768 _EXTRACTOR_EXTERN enum EXTRACTOR_MetaType
    769 EXTRACTOR_metatype_get_max (void);
    770 
    771 
    772 /**
    773  * Type of a function that libextractor calls for each
    774  * meta data item found.
    775  *
    776  * @param cls closure (user-defined)
    777  * @param plugin_name name of the plugin that produced this value;
    778  *        special values can be used (i.e. '&lt;zlib&gt;' for zlib being
    779  *        used in the main libextractor library and yielding
    780  *        meta data).
    781  * @param type libextractor-type describing the meta data
    782  * @param format basic format information about @a data
    783  * @param data_mime_type mime-type of @a data (not of the original file);
    784  *        can be NULL (if mime-type is not known)
    785  * @param data actual meta-data found
    786  * @param data_len number of bytes in @a data
    787  * @return 0 to continue extracting, 1 to abort
    788  */
    789 typedef int
    790 (*EXTRACTOR_MetaDataProcessor) (void *cls,
    791                                 const char *plugin_name,
    792                                 enum EXTRACTOR_MetaType type,
    793                                 enum EXTRACTOR_MetaFormat format,
    794                                 const char *data_mime_type,
    795                                 const char *data,
    796                                 size_t data_len);
    797 
    798 
    799 /**
    800  * Context provided for plugins that perform meta data extraction.
    801  */
    802 struct EXTRACTOR_ExtractContext
    803 {
    804 
    805   /**
    806    * Closure argument to pass to all callbacks.
    807    */
    808   void *cls;
    809 
    810   /**
    811    * Configuration string for the plugin.
    812    */
    813   const char *config;
    814 
    815   /**
    816    * Obtain a pointer to up to @a size bytes of data from the file to process.
    817    *
    818    * @param cls the @e cls member of this struct
    819    * @param data pointer to set to the file data, set to NULL on error
    820    * @param size maximum number of bytes requested
    821    * @return number of bytes now available in @a data (can be smaller than @a size),
    822    *         -1 on error
    823    */
    824   ssize_t (*read) (void *cls,
    825                    void **data,
    826                    size_t size);
    827 
    828 
    829   /**
    830    * Seek in the file.  Use `SEEK_CUR` for @a whence and @a pos of 0 to
    831    * obtain the current position in the file.
    832    *
    833    * @param cls the @e cls member of this struct
    834    * @param pos position to seek (see 'man lseek')
    835    * @param whence how to see (absolute to start, relative, absolute to end)
    836    * @return new absolute position, -1 on error (i.e. desired position
    837    *         does not exist)
    838    */
    839   int64_t (*seek) (void *cls,
    840                    int64_t pos,
    841                    int whence);
    842 
    843 
    844   /**
    845    * Determine the overall size of the file.
    846    *
    847    * @param cls the @a cls member of this struct
    848    * @return overall file size, `UINT64_MAX` on error (i.e. IPC failure)
    849    */
    850   uint64_t (*get_size) (void *cls);
    851 
    852   /**
    853    * Function to call on extracted data.
    854    */
    855   EXTRACTOR_MetaDataProcessor proc;
    856 
    857 };
    858 
    859 
    860 /**
    861  * Signature of the extract method that each plugin
    862  * must provide.
    863  *
    864  * @param ec extraction context provided to the plugin
    865  */
    866 typedef void
    867 (*EXTRACTOR_extract_method) (struct EXTRACTOR_ExtractContext *ec);
    868 
    869 
    870 /**
    871  * Linked list of extractor plugins.  An application builds this list
    872  * by telling libextractor to load various keyword-extraction
    873  * plugins. Libraries can also be unloaded (removed from this list,
    874  * see #EXTRACTOR_plugin_remove).
    875  */
    876 struct EXTRACTOR_PluginList;
    877 
    878 
    879 /**
    880  * Load the default set of plugins.  The default can be changed
    881  * by setting the LIBEXTRACTOR_LIBRARIES environment variable;
    882  * If it is set to "env", then this function will return
    883  * #EXTRACTOR_plugin_add_config (NULL, env, flags).
    884  *
    885  * If LIBEXTRACTOR_LIBRARIES is not set, the function will attempt
    886  * to locate the installed plugins and load all of them.
    887  * The directory where the code will search for plugins is typically
    888  * automatically determined; it can be specified explicitly using the
    889  * "LIBEXTRACTOR_PREFIX" environment variable.
    890  *
    891  * This environment variable must be set to the precise directory with
    892  * the plugins (i.e. "/usr/lib/libextractor", not "/usr").  Note that
    893  * setting the environment variable will disable all of the methods
    894  * that are typically used to determine the location of plugins.
    895  * Multiple paths can be specified using ':' to separate them.
    896  *
    897  * @param flags options for all of the plugins loaded
    898  * @return the default set of plugins, NULL if no plugins were found
    899  */
    900 _EXTRACTOR_EXTERN struct EXTRACTOR_PluginList *
    901 EXTRACTOR_plugin_add_defaults (enum EXTRACTOR_Options flags);
    902 
    903 
    904 /**
    905  * Add a library for keyword extraction.
    906  *
    907  * @param prev the previous list of libraries, may be NULL
    908  * @param library the name of the library (short handle, i.e. "mime")
    909  * @param options options to give to the library
    910  * @param flags options to use
    911  * @return the new list of libraries, equal to prev iff an error occured
    912  */
    913 _EXTRACTOR_EXTERN struct EXTRACTOR_PluginList *
    914 EXTRACTOR_plugin_add (struct EXTRACTOR_PluginList *prev,
    915                       const char *library,
    916                       const char *options,
    917                       enum EXTRACTOR_Options flags);
    918 
    919 
    920 /**
    921  * Load multiple libraries as specified by the user.
    922  *
    923  * @param config a string given by the user that defines which
    924  *        libraries should be loaded. Has the format
    925  *        "[[-]LIBRARYNAME[(options)][:[-]LIBRARYNAME[(options)]]]*".
    926  *        For example, 'mp3:ogg' loads the
    927  *        mp3 and the ogg plugins. The '-' before the LIBRARYNAME
    928  *        indicates that the library should be removed from
    929  *        the library list.
    930  * @param prev the  previous list of libraries, may be NULL
    931  * @param flags options to use
    932  * @return the new list of libraries, equal to prev iff an error occured
    933  *         or if config was empty (or NULL).
    934  */
    935 _EXTRACTOR_EXTERN struct EXTRACTOR_PluginList *
    936 EXTRACTOR_plugin_add_config (struct EXTRACTOR_PluginList *prev,
    937                              const char *config,
    938                              enum EXTRACTOR_Options flags);
    939 
    940 
    941 /**
    942  * Remove a plugin from a list.
    943  *
    944  * @param prev the current list of plugins
    945  * @param library the name of the plugin to remove (short handle)
    946  * @return the reduced list, unchanged if the plugin was not loaded
    947  */
    948 _EXTRACTOR_EXTERN struct EXTRACTOR_PluginList *
    949 EXTRACTOR_plugin_remove (struct EXTRACTOR_PluginList *prev,
    950                          const char *library);
    951 
    952 
    953 /**
    954  * Remove all plugins from the given list (destroys the list).
    955  *
    956  * @param plugin the list of plugins
    957  */
    958 _EXTRACTOR_EXTERN void
    959 EXTRACTOR_plugin_remove_all (struct EXTRACTOR_PluginList *plugins);
    960 
    961 
    962 /**
    963  * Extract keywords from a file using the given set of plugins.
    964  *
    965  * @param plugins the list of plugins to use
    966  * @param filename the name of the file, can be NULL if @a data is not NULL
    967  * @param data data of the file in memory, can be NULL (in which
    968  *        case libextractor will open file) if filename is not NULL
    969  * @param size number of bytes in @a data, ignored if @a data is NULL
    970  * @param proc function to call for each meta data item found
    971  * @param proc_cls cls argument to @a proc
    972  */
    973 _EXTRACTOR_EXTERN void
    974 EXTRACTOR_extract (struct EXTRACTOR_PluginList *plugins,
    975                    const char *filename,
    976                    const void *data,
    977                    size_t size,
    978                    EXTRACTOR_MetaDataProcessor proc,
    979                    void *proc_cls);
    980 
    981 
    982 /**
    983  * Simple #EXTRACTOR_MetaDataProcessor implementation that simply
    984  * prints the extracted meta data to the given file.  Only prints
    985  * those keywords that are in UTF-8 format.
    986  *
    987  * @param handle the file to write to (`stdout`, `stderr`), must NOT be NULL,
    988  *               must be of type `FILE *`.
    989  * @param plugin_name name of the plugin that produced this value
    990  * @param type libextractor-type describing the meta data
    991  * @param format basic format information about data
    992  * @param data_mime_type mime-type of @a data (not of the original file);
    993  *        can be NULL (if mime-type is not known)
    994  * @param data actual meta-data found
    995  * @param data_len number of bytes in @a data
    996  * @return non-zero if printing failed, otherwise 0.
    997  */
    998 _EXTRACTOR_EXTERN int
    999 EXTRACTOR_meta_data_print (void *handle,
   1000                            const char *plugin_name,
   1001                            enum EXTRACTOR_MetaType type,
   1002                            enum EXTRACTOR_MetaFormat format,
   1003                            const char *data_mime_type,
   1004                            const char *data,
   1005                            size_t data_len);
   1006 
   1007 
   1008 #if 0 /* keep Emacsens' auto-indent happy */
   1009 {
   1010 #endif
   1011 #ifdef __cplusplus
   1012 }
   1013 #endif
   1014 
   1015 #endif