![]() It is up to the callback function to reallocate the given pointer (using the hts_realloc()/hts_free() library functions), which will be free()'ed by the engine. Both pointer values (address and size) can be modified to change the document. The html address points to the document data address (char**), and the length address points to the lenth of this document. Int mycallback(t_hts_callbackarg *carg, httrackp* opt, char** html, int* len, const char* url_address, const char* url_file) Ĭalled when a document (which is an html document) is parsed and transformed (links rewritten). Return value: 1 if the new pointers can be applied (default value) The url_address and url_file are the address and URI of the file being processed Hence, return of static buffers is strictly forbidden, and the use of hts_strdup() in such cases is advised. The opt structure passed lists all options, updated to take account of recent changesĬalled when a document (which is an html document) is to be parsed (original, not yet modified document). Return value: 1 upon success, 0 upon error (the mirror will then be considered aborted)Ĭalled when options are to be changed. Int mycallback(t_hts_callbackarg *carg, httrackp* opt) You may modify the opt structure to fit your needs. The opt structure passed lists all options defined for this mirror. Note: the use os the "end" callback is advised.Ĭalled when the mirror starts. Void mycallback(t_hts_callbackarg *carg) Note: the use the "start" callback is advised. This structure, holding all current httrack options and mirror state, can be read or mofidiedīelow the list of callbacks, and associated external wrappers. This structure holds the callback chain (parent callbacks defined before the current callback) pointers, and the user-defined pointer see CALLBACKARG_USERDEF(carg)) Note that all callbacks (except init and uninit) take as first two argument: To free allocated resources without using global variables, use the uninit callback (see below) Wrappers can be plugged inside hts_plug() using:ĬHAIN_FUNCTION(opt, check_html, process, userdef) Įxtern int hts_plug(httrackp *opt, const char* argv) Return value: 1 upon success, 0 upon error (the mirror will then be aborted) The argv optional argument is the one passed in the commandline as -wrapper parameter. The opt structure can be used to plug callbacks, using the CHAIN_FUNCTION() macro helper. the example given at the end of this documentīelow the list of functions to be defined in the module (plugin).the htsjava.c source file (the java class plugin overrides 'detect' and 'parse'). ![]() the callbacks-example*.c files given in the httrack archive.the htsopt.h prototype file, which describes the full httrackp* structure.the htsdefines.h prototype file, which describes callback function prototypes.Note: the Initialization, Main functions, Options handling and Wrapper functions sections are generally the only ones to be considered. The callback plug is made through the CHAIN_FUNCTION() helper, allowing to chain multiple callbacks of the same type (the callbacks MUST preserve the chain by calling ancestors).The httrackp* option structure can be directly accessed to plug callbacks (no need to give the callback name and function name in the commandline!).Cleaned up function prototypes, with two arguments always passed (the caller carg structure, and the httrackp* object), convenient to pass an user-defined pointer (see CALLBACKARG_USERDEF(carg)).The 3.41 release introduces a cleaned up verion of callbacks, with two major changes: The httrack commandline tool allows (since the 3.30 release) to plug external functions to various callbacks defined in httrack. You can write external functions to be plugged in the httrack library very easily. HTTrack Programming page - plugging functions
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |