1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/***************************************************************************
* C++ Implementation: *
* Copyright (C) 2012-2017 by Eduard Kalinowski *
* Germany, Lower Saxony, Hanover *
* eduard_kalinowski@yahoo.de *
* *
* HTTraQt is free software; may be distributed and/or modified under the *
* terms of the GNU General Public License version 3 as published by the *
* Free Software Foundation and appearing in the file LICENSE_GPLv3 *
* included in the packaging of this file. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with HTTraQt. If not, see http://www.gnu.org/licenses *
***************************************************************************/
#ifndef HTINTERFACE_H
#define HTINTERFACE_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <httrack-library.h>
#include <htsopt.h>
#include <htsnet.h>
#include <htswrap.h>
#include <htsdefines.h>
// #ifdef __cplusplus
// }
// #endif
// #ifndef DEBUG
// #define ASSERT(x)
// #else
#define ASSERT(x) \
if (! (x) && !(x-1)) { \
qDebug() << "ERROR!! Assert " << #x << " failed\n"; \
qDebug() << " on line " << __LINE__ << "\n"; \
qDebug() << " in file " << __FILE__ << "\n"; \
return 1; \
}
#ifdef _DEBUG
#define VERIFY_ISWRITEPOINTER(a) \
{ if(::IsBadWritePtr(a, sizeof(LPDWORD))) \
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid write pointer\r\n"));}}
#define VERIFY_ISREADPOINTER(a) \
{ if(::IsBadReadPtr(a, sizeof(LPDWORD)))\
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid read pointer\r\n"));}}
#define VERIFY_ISWRITEDATA(a, l)\
{ if(::IsBadWritePtr(a, l)) \
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid write area\r\n"));}}
#define VERIFY_ISREADDATA(a, l)\
{ if(::IsBadReadPtr(a, l)) \
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid read area\r\n"));}}
#define ASSERT_ISWRITEPOINTER(a)\
{ if(::IsBadWritePtr(a, sizeof(LPDWORD))) \
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid write pointer\r\n")); ASSERT(false);}}
#define ASSERT_ISREADPOINTER(a)\
{ if(::IsBadReadPtr(a, sizeof(LPDWORD))) \
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid read pointer\r\n")); ASSERT(false);}}
#define ASSERT_ISWRITEDATA(a, l)\
{ if(::IsBadWritePtr(a, l)) \
{ ::OutputDebugString(_T("Parameter ") _T(#a) \
_T(" is not a valid write area\r\n")); ASSERT(false);}}
#define ASSERT_ISREADDATA(a, l) { if(::IsBadReadPtr(a, l)) \
{ ::OutputDebugString(_T("Parameter ") _T(#a)\
_T(" is not a valid read area\r\n")); ASSERT(false);}}
#else
#define VERIFY_ISWRITEPOINTER(a)
#define VERIFY_ISREADPOINTER(a)
#define VERIFY_ISWRITEDATA(a, l)
#define VERIFY_ISREADDATA(a, l)
#define ASSERT_ISWRITEPOINTER(a)
#define ASSERT_ISREADPOINTER(a)
#define ASSERT_ISWRITEDATA(a, l)
#define ASSERT_ISREADDATA(a, l)
#endif
// hotfix for the htsglobal macros
// to disable
#ifdef maximum
#undef maximum
#endif
#ifdef minimum
#undef minimum
#endif
// #ifdef __cplusplus
// extern "C" {
// #endif
#if __WIN32
#else
#define __cdecl
#endif
void httraq_main();
void htinfo_state_url(char* c);
void htinfo_mirror_info(char* c);
// int scan_end(void);
void __cdecl wrapper_init(t_hts_callbackarg* carg);
void __cdecl wrapper_uninit(t_hts_callbackarg* carg);
int __cdecl wrapper_start(t_hts_callbackarg* carg, httrackp *opt);
int __cdecl wrapper_chopt(t_hts_callbackarg* carg, httrackp *opt);
int __cdecl wrapper_end(t_hts_callbackarg* carg, httrackp *opt);
int __cdecl wrapper_checkhtml(t_hts_callbackarg* carg, httrackp *opt, char* html, int len, char* url_adresse, char* url_fichier);
int __cdecl wrapper_preprocesshtml(t_hts_callbackarg* carg, httrackp *opt, char** html, int* len, const char* url_address, const char* url_file);
int __cdecl wrapper_postprocesshtml(t_hts_callbackarg* carg, httrackp *opt, char** html, int* len, const char* url_address, const char* url_file);
int __cdecl wrapper_loop(t_hts_callbackarg* carg, httrackp *opt, lien_back* back, int back_max, int back_index, int lien_tot, int lien_ntot, int stat_time, hts_stat_struct* stats); // appel� � chaque boucle de HTTrack
// int __cdecl wrapper_loop ( void* _back, int back_max, int back_index, int lien_n, int lien_tot, int stat_time, hts_stat_struct* stats );
const char* __cdecl wrapper_query(t_hts_callbackarg* carg, httrackp *opt, const char* question);
const char* __cdecl wrapper_query2(t_hts_callbackarg* carg, httrackp *opt, const char* question);
const char* __cdecl wrapper_query3(t_hts_callbackarg* carg, httrackp *opt, const char* question);
int __cdecl wrapper_check(t_hts_callbackarg* carg, httrackp *opt, const char* adr, const char* fil, int status);
int __cdecl wrapper_check_mime(t_hts_callbackarg* carg, httrackp *opt, const char* adr, const char* fil, const char* mime, int status);
void __cdecl wrapper_pause(t_hts_callbackarg* carg, httrackp *opt, const char* lockfile);
void __cdecl wrapper_filesave(t_hts_callbackarg* carg, httrackp *opt, const char* file);
void __cdecl wrapper_filesave2(t_hts_callbackarg* carg, httrackp *opt, const char* adr, const char* fil, const char* save, int is_new, int is_modified, int not_updated);
int __cdecl wrapper_linkdetected(t_hts_callbackarg* carg, httrackp *opt, char* link);
int __cdecl wrapper_linkdetected2(t_hts_callbackarg* carg, httrackp *opt, char* link, const char* start_tag);
int __cdecl wrapper_xfrstatus(t_hts_callbackarg* carg, httrackp *opt, void* back);
int __cdecl wrapper_savename(t_hts_callbackarg* carg, httrackp *opt, char* adr_complete, char* fil_complete, char* referer_adr, char* referer_fil, char* save);
int __cdecl wrapper_sendheader(t_hts_callbackarg* carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* outgoing);
int __cdecl wrapper_receiveheader(t_hts_callbackarg* carg, httrackp *opt, char* buff, const char* adr, const char* fil, const char* referer_adr, const char* referer_fil, htsblk* incoming);
// void htinfo_errors ( char* chaine );
// void htinfo_active_connections ( char* chaine );
// void htinfo_files_updated ( char* chaine );
// void htinfo_transfer_rate ( char* chaine );
// void htinfo_files_written ( char* chaine );
// void htinfo_bytes_saved ( char* chaine );
// void htinfo_time ( char* chaine );
// void htinfo_link_detected(char* chaine);
// void htcommandend(void);
#ifdef __cplusplus
}
#endif
typedef struct {
// int ask_refresh;
int refresh;
LLint stat_bytes;
int stat_time;
int lien_n;
int lien_tot;
int stat_nsocket;
int rate;
int irate;
int ft;
LLint stat_written;
int stat_updated;
int stat_errors;
int stat_warnings;
int stat_infos;
TStamp stat_timestart;
int stat_back;
} t_InpInfo;
#endif
|