template_extractor.c (1963B)
1 /* 2 This file is part of libextractor. 3 Copyright (C) 2002, 2003, 2004, 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 plugins/template_extractor.c 22 * @brief example code for writing your own plugin 23 * @author add your own name here 24 */ 25 #include "platform.h" 26 #include "extractor.h" 27 28 29 /** 30 * This will be the main method of your plugin. 31 * Describe a bit what it does here. 32 * 33 * @param ec extraction context, here you get the API 34 * for accessing the file data and for returning 35 * meta data 36 */ 37 void 38 EXTRACTOR_template_extract_method (struct EXTRACTOR_ExtractContext *ec) 39 { 40 int64_t offset; 41 void *data; 42 43 /* temporary variables are declared here */ 44 45 if (plugin == NULL) 46 return 1; 47 48 /* initialize state here */ 49 50 /* Call seek (plugin, POSITION, WHENCE) to seek (if you know where 51 * data starts): 52 */ 53 // ec->seek (ec->cls, POSITION, SEEK_SET); 54 55 /* Call read (plugin, &data, COUNT) to read COUNT bytes 56 */ 57 58 59 /* Once you find something, call proc(). If it returns non-0 - you're done. 60 */ 61 // if (0 != ec->proc (ec->cls, ...)) return; 62 63 /* Don't forget to free anything you've allocated before returning! */ 64 return; 65 } 66 67 68 /* end of template_extractor.c */