diff options
Diffstat (limited to 'src/htsopt.h')
-rw-r--r-- | src/htsopt.h | 261 |
1 files changed, 224 insertions, 37 deletions
diff --git a/src/htsopt.h b/src/htsopt.h index bf62c72..0b304f8 100644 --- a/src/htsopt.h +++ b/src/htsopt.h @@ -40,51 +40,231 @@ Please visit our Website: http://www.httrack.com #define HTTRACK_DEFOPT #include <stdio.h> -#include "htsbasenet.h" -#include "htsbauth.h" +#include "htsglobal.h" -// structure proxy -typedef struct t_proxy { +/* Forward definitions */ +#ifndef HTS_DEF_FWSTRUCT_t_hts_htmlcheck_callbacks +#define HTS_DEF_FWSTRUCT_t_hts_htmlcheck_callbacks +typedef struct t_hts_htmlcheck_callbacks t_hts_htmlcheck_callbacks; +#endif +#ifndef HTS_DEF_FWSTRUCT_t_dnscache +#define HTS_DEF_FWSTRUCT_t_dnscache +typedef struct t_dnscache t_dnscache; +#endif +#ifndef HTS_DEF_FWSTRUCT_hash_struct +#define HTS_DEF_FWSTRUCT_hash_struct +typedef struct hash_struct hash_struct; +#endif +#ifndef HTS_DEF_FWSTRUCT_robots_wizard +#define HTS_DEF_FWSTRUCT_robots_wizard +typedef struct robots_wizard robots_wizard; +#endif +#ifndef HTS_DEF_FWSTRUCT_t_cookie +#define HTS_DEF_FWSTRUCT_t_cookie +typedef struct t_cookie t_cookie; +#endif + +/** Forward definitions **/ +#ifndef HTS_DEF_FWSTRUCT_String +#define HTS_DEF_FWSTRUCT_String +typedef struct String String; +#endif +#ifndef HTS_DEF_STRUCT_String +#define HTS_DEF_STRUCT_String +struct String { + char* buffer_; + size_t length_; + size_t capacity_; +}; +#endif + +/* Defines */ +#define CATBUFF_SIZE (STRING_SIZE*2*2) +#define STRING_SIZE 2048 + +/* Proxy structure */ +#ifndef HTS_DEF_FWSTRUCT_t_proxy +#define HTS_DEF_FWSTRUCT_t_proxy +typedef struct t_proxy t_proxy; +#endif +struct t_proxy { int active; - char name[1024]; + String name; int port; - char bindhost[256]; // bind this host -} t_proxy; + String bindhost; // bind this host +}; /* Structure utile pour copier en bloc les paramètres */ -typedef struct htsfilters { +#ifndef HTS_DEF_FWSTRUCT_htsfilters +#define HTS_DEF_FWSTRUCT_htsfilters +typedef struct htsfilters htsfilters; +#endif +struct htsfilters { char*** filters; int* filptr; //int* filter_max; -} htsfilters; +}; /* User callbacks chain */ typedef int (*htscallbacksfncptr)(void); typedef struct htscallbacks htscallbacks; struct htscallbacks { - char callbackName[128]; void* moduleHandle; htscallbacksfncptr exitFnc; htscallbacks * next; }; +/* filenote() internal file structure */ +#ifndef HTS_DEF_FWSTRUCT_filenote_strc +#define HTS_DEF_FWSTRUCT_filenote_strc +typedef struct filenote_strc filenote_strc; +#endif +struct filenote_strc { + FILE* lst; + char path[STRING_SIZE*2]; +}; + +/* concat() functions */ +#ifndef HTS_DEF_FWSTRUCT_concat_strc +#define HTS_DEF_FWSTRUCT_concat_strc +typedef struct concat_strc concat_strc; +#endif +struct concat_strc { + int index; + char buff[16][STRING_SIZE*2*2]; +}; + +/* int2 functions */ +#ifndef HTS_DEF_FWSTRUCT_strc_int2bytes2 +#define HTS_DEF_FWSTRUCT_strc_int2bytes2 +typedef struct strc_int2bytes2 strc_int2bytes2; +#endif +struct strc_int2bytes2 { + char catbuff[CATBUFF_SIZE]; + char buff1[256]; + char buff2[32]; + char* buffadr[2]; +}; + +/* cmd callback */ +#ifndef HTS_DEF_FWSTRUCT_usercommand_strc +#define HTS_DEF_FWSTRUCT_usercommand_strc +typedef struct usercommand_strc usercommand_strc; +#endif +struct usercommand_strc { + int exe; + char cmd[2048]; +}; + +/* error logging */ +#ifndef HTS_DEF_FWSTRUCT_fspc_strc +#define HTS_DEF_FWSTRUCT_fspc_strc +typedef struct fspc_strc fspc_strc; +#endif +struct fspc_strc { + int error; + int warning; + int info; +}; + /* Structure état du miroir */ -typedef struct htsoptstate { +#ifndef HTS_DEF_FWSTRUCT_htsoptstatecancel +#define HTS_DEF_FWSTRUCT_htsoptstatecancel +typedef struct htsoptstatecancel htsoptstatecancel; +#endif +struct htsoptstatecancel { + char *url; + htsoptstatecancel *next; +}; + +/* Mutexes */ +#ifndef HTS_DEF_FWSTRUCT_htsmutex_s +#define HTS_DEF_FWSTRUCT_htsmutex_s +typedef struct htsmutex_s htsmutex_s, *htsmutex; +#endif + +/* Hashtables */ +#ifndef HTS_DEF_FWSTRUCT_struct_inthash +#define HTS_DEF_FWSTRUCT_struct_inthash +typedef struct struct_inthash struct_inthash, *inthash; +#endif + +/* Structure état du miroir */ +#ifndef HTS_DEF_FWSTRUCT_htsoptstate +#define HTS_DEF_FWSTRUCT_htsoptstate +typedef struct htsoptstate htsoptstate; +#endif +struct htsoptstate { + htsmutex lock; /* 3.41 */ + /* */ int stop; int exit_xh; int back_add_stats; /* */ int mimehtml_created; - char mimemid[256]; + String mimemid; FILE* mimefp; int delayedId; /* */ + filenote_strc strc; + /* Functions context (avoir thread variables!) */ htscallbacks callbacks; -} htsoptstate; + concat_strc concat; + usercommand_strc usercmd; + fspc_strc fspc; + char *userhttptype; + int verif_backblue_done; + int verif_external_status; + t_dnscache *dns_cache; + /* HTML parsing state */ + char _hts_errmsg[1024]; + int _hts_in_html_parsing; + int _hts_in_html_done; + int _hts_in_html_poll; + int _hts_setpause; + char** _hts_addurl; + int _hts_cancel; + htsoptstatecancel *cancel; /* 3.41 */ + char HTbuff[2048]; + unsigned int debug_state; + unsigned int tmpnameid; /* 3.41 */ +}; +/* Library handles */ +#ifndef HTS_DEF_FWSTRUCT_htslibhandles +#define HTS_DEF_FWSTRUCT_htslibhandles +typedef struct htslibhandles htslibhandles; +#endif +#ifndef HTS_DEF_FWSTRUCT_htslibhandle +#define HTS_DEF_FWSTRUCT_htslibhandle +typedef struct htslibhandle htslibhandle; +#endif +struct htslibhandle { + char *moduleName; + void *handle; +}; +struct htslibhandles { + int count; + htslibhandle *handles; +}; + +/* Javascript parser flags */ +typedef enum htsparsejava_flags { + HTSPARSE_NONE = 0, // don't parse + HTSPARSE_DEFAULT = 1, // parse default (all) + HTSPARSE_NO_CLASS = 2, // don't parse .java + HTSPARSE_NO_JAVASCRIPT = 4, // don't parse .js + HTSPARSE_NO_AGGRESSIVE = 8 // don't aggressively parse .js or .java +} htsparsejava_flags; // paramètres httrack (options) -typedef struct httrackp { +#ifndef HTS_DEF_FWSTRUCT_httrackp +#define HTS_DEF_FWSTRUCT_httrackp +typedef struct httrackp httrackp; +#endif +struct httrackp { + size_t size_httrackp; // size of this structure + /* */ int wizard; // wizard aucun/grand/petit int flush; // fflush sur les fichiers log int travel; // type de déplacements (same domain etc) @@ -109,9 +289,7 @@ typedef struct httrackp { int rateout; // nombre d'octets minium pour le transfert int maxtime; // temps max en secondes int maxrate; // taux de transfert max -#if HTS_USEMMS int mms_maxtime; // max duration of a mms file -#endif float maxconn; // nombre max de connexions/s int waittime; // démarrage programmé int cache; // génération d'un cache @@ -120,21 +298,21 @@ typedef struct httrackp { t_proxy proxy; // configuration du proxy int savename_83; // conversion 8-3 pour les noms de fichiers int savename_type; // type de noms: structure originale/html-images en un seul niveau - char savename_userdef[256]; // structure userdef (ex: %h%p/%n%q.%t) + String savename_userdef; // structure userdef (ex: %h%p/%n%q.%t) int savename_delayed; // delayed type check int delayed_cached; // delayed type check can be cached to speedup updates int mimehtml; // MIME-html int user_agent_send; // user agent (ex: httrack/1.0 [sun]) - char user_agent[128]; - char referer[256]; // referer - char from[256]; // from - char path_log[1024]; // chemin pour cache et log - char path_html[1024]; // chemin pour miroir - char path_bin[1024]; // chemin pour templates + String user_agent; // + String referer; // referer + String from; // from + String path_log; // chemin pour cache et log + String path_html; // chemin pour miroir + String path_bin; // chemin pour templates int retry; // nombre d'essais supplémentaires en cas d'échec int makestat; // mettre à jour un fichier log de statistiques de transfert int maketrack; // mettre à jour un fichier log de statistiques d'opérations - int parsejava; // parsing des classes java pour récupérer les class, gif & cie + int parsejava; // parsing des classes java pour récupérer les class, gif & cie ; see htsparsejava_flags int hostcontrol; // abandon d'un host trop lent etc. int errpage; // générer une page d'erreur en cas de 404 etc. int check_type; // si type inconnu (cgi,asp,/) alors tester lien (et gérer moved éventuellement) @@ -144,7 +322,7 @@ typedef struct httrackp { int passprivacy; // pas de mot de pass dans les liens externes? int includequery; // include la query-string int mirror_first_page; // miroir des liens - char sys_com[2048]; // commande système + String sys_com; // commande système int sys_com_exec; // executer commande int accept_cookie; // gestion des cookies t_cookie* cookie; @@ -158,17 +336,18 @@ typedef struct httrackp { int parsedebug; // débugger parser (debug!) int norecatch; // ne pas reprendre les fichiers effacés localement par l'utilisateur int verbosedisplay; // animation textuelle - char footer[256]; // ligne d'infos + String footer; // ligne d'infos int maxcache; // maximum en mémoire au niveau du cache (backing) //int maxcache_anticipate; // maximum de liens à anticiper (majorant) int ftp_proxy; // proxy http pour ftp - char filelist[1024]; // fichier liste URL à inclure - char urllist[1024]; // fichier liste de filtres à inclure + String filelist; // fichier liste URL à inclure + String urllist; // fichier liste de filtres à inclure htsfilters filters; // contient les pointeurs pour les filtres - void* hash; // hash structure - void* robotsptr; // robots ptr - char lang_iso[64]; // en, fr .. - char mimedefs[2048]; // ext1=mimetype1\next2=mimetype2.. + hash_struct* hash; // hash structure + robots_wizard* robotsptr; // robots ptr + String lang_iso; // en, fr .. + String mimedefs; // ext1=mimetype1\next2=mimetype2.. + String mod_blacklist; // (3.41) // int maxlink; // nombre max de liens int maxfilter; // nombre max de filtres @@ -182,11 +361,20 @@ typedef struct httrackp { int is_update; // c'est une update (afficher "File updated...") int dir_topindex; // reconstruire top index par la suite // - htsoptstate state; // état -} httrackp; + // callbacks + t_hts_htmlcheck_callbacks *callbacks_fun; + // store library handles + htslibhandles libHandles; + // + htsoptstate state; // state +}; // stats for httrack -typedef struct hts_stat_struct { +#ifndef HTS_DEF_FWSTRUCT_hts_stat_struct +#define HTS_DEF_FWSTRUCT_hts_stat_struct +typedef struct hts_stat_struct hts_stat_struct; +#endif +struct hts_stat_struct { LLint HTS_TOTAL_RECV; // flux entrant reçu LLint stat_bytes; // octets écrits sur disque // int HTS_TOTAL_RECV_STATE; // status: 0 tout va bien 1: ralentir un peu 2: ralentir 3: beaucoup @@ -219,8 +407,7 @@ typedef struct hts_stat_struct { // TStamp last_connect; // last connect() call TStamp last_request; // last request issued -} hts_stat_struct; - +}; #endif |