extractor_plugins.h (3323B)
1 /* 2 This file is part of libextractor. 3 Copyright (C) 2002, 2003, 2004, 2005, 2006, 2009, 2012 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 * @file main/extractor_plugins.h 22 * @brief code to load plugins 23 * @author Christian Grothoff 24 */ 25 #ifndef EXTRACTOR_PLUGINS_H 26 #define EXTRACTOR_PLUGINS_H 27 28 #include "platform.h" 29 #include "extractor.h" 30 #include <signal.h> 31 #include <ltdl.h> 32 33 34 /** 35 * Linked list of extractor plugins. An application builds this list 36 * by telling libextractor to load various meta data extraction 37 * plugins. Plugins can also be unloaded (removed from this list, 38 * see EXTRACTOR_plugin_remove). 39 */ 40 struct EXTRACTOR_PluginList 41 { 42 /** 43 * This is a linked list. 44 */ 45 struct EXTRACTOR_PluginList *next; 46 47 /** 48 * Pointer to the plugin (as returned by lt_dlopen). 49 */ 50 void *libraryHandle; 51 52 /** 53 * Name of the library (i.e., 'libextractor_foo.so') 54 */ 55 char *libname; 56 57 /** 58 * Short name of the plugin (i.e., 'foo') 59 */ 60 char *short_libname; 61 62 /** 63 * Pointer to the function used for meta data extraction. 64 */ 65 EXTRACTOR_extract_method extract_method; 66 67 /** 68 * Options for the plugin. 69 */ 70 char *plugin_options; 71 72 /** 73 * Special options for the plugin 74 * (as returned by the plugin's "options" method; 75 * typically NULL). 76 */ 77 const char *specials; 78 79 /** 80 * Channel to communicate with out-of-process plugin, NULL if not setup. 81 */ 82 struct EXTRACTOR_Channel *channel; 83 84 /** 85 * Memory segment shared with the channel of this plugin, NULL for none. 86 */ 87 struct EXTRACTOR_SharedMemory *shm; 88 89 /** 90 * A position this plugin wants us to seek to. -1 if it's finished. 91 * A positive value from the end of the file is used of 'whence' is 92 * SEEK_END; a postive value from the start is used of 'whence' is 93 * SEEK_SET. 'SEEK_CUR' is never used. 94 */ 95 int64_t seek_request; 96 97 /** 98 * Flags to control how the plugin is executed. 99 */ 100 enum EXTRACTOR_Options flags; 101 102 /** 103 * Is this plugin finished extracting for this round? 104 * 0: no, 1: yes 105 */ 106 int round_finished; 107 108 /** 109 * 'whence' value for the seek operation; 110 * 0 = SEEK_SET, 1 = SEEK_CUR, 2 = SEEK_END. 111 * Note that 'SEEK_CUR' is never used here. 112 */ 113 uint16_t seek_whence; 114 115 }; 116 117 118 /** 119 * Load a plugin. 120 * 121 * @param plugin plugin to load 122 * @return 0 on success, -1 on error 123 */ 124 int 125 EXTRACTOR_plugin_load_ (struct EXTRACTOR_PluginList *plugin); 126 127 #endif /* EXTRACTOR_PLUGINS_H */