Annotation of libwww/Robot/src/HTRobMan.html, revision 1.8
1.1 frystyk 1: <HTML>
2: <HEAD>
3: <TITLE>Webbot - the W3C Mini Robot</TITLE>
4: </HEAD>
5: <BODY>
6: <H1>
7: Webbot - the W3C Mini Robot
8: </H1>
9: <PRE>
10: /*
11: ** (c) COPRIGHT MIT 1995.
12: ** Please first read the full copyright statement in the file COPYRIGH.
13: */
14: </PRE>
15: <P>
16: This program illustrates how to travers links using the Anchor object
17: <PRE>
18: #ifndef HTROBMAN_H
19: #define HTROBMAN_H
20:
21: #include "WWWLib.h" /* Global Library Include file */
22: #include "WWWApp.h" /* Application stuff */
23: #include "WWWTrans.h"
24: #include "WWWInit.h"
25: #include "WWWSQL.h"
26:
27: #include "HText.h"
28:
29: #include "HTRobot.h" /* Implemented here */
30:
31: #ifndef W3C_VERSION
32: #define W3C_VERSION "Unspecified"
33: #endif
34:
35: #define APP_NAME "W3CRobot"
36: #define APP_VERSION W3C_VERSION
37: #define COMMAND_LINE "http://www.w3.org/Robot/User/CommandLine"
38: #define ROBOTS_TXT "/robots.txt"
39:
40: #define DEFAULT_OUTPUT_FILE "robot.out"
41: #define DEFAULT_RULE_FILE "robot.conf"
42: #define DEFAULT_LOG_FILE "log-clf.txt"
43: #define DEFAULT_HIT_FILE "log-hit.txt"
44: #define DEFAULT_REL_FILE "log-rel.txt"
45: #define DEFAULT_LM_FILE "log-lastmodified.txt"
46: #define DEFAULT_TITLE_FILE "log-title.txt"
47: #define DEFAULT_REFERER_FILE "log-referer.txt"
48: #define DEFAULT_REJECT_FILE "log-reject.txt"
49: #define DEFAULT_NOTFOUND_FILE "log-notfound.txt"
50: #define DEFAULT_CONNEG_FILE "log-conneg.txt"
51: #define DEFAULT_NOALTTAG_FILE "log-alt.txt"
52: #define DEFAULT_FORMAT_FILE "log-format.txt"
53: #define DEFAULT_CHARSET_FILE "log-charset.txt"
54: #define DEFAULT_MEMLOG "robot.mem"
55: #define DEFAULT_PREFIX ""
56: #define DEFAULT_IMG_PREFIX ""
57: #define DEFAULT_DEPTH 0
58: #define DEFAULT_DELAY 50 /* Write delay in ms */
59:
60: #define DEFAULT_SQL_SERVER "localhost"
61: #define DEFAULT_SQL_DB "webbot"
62: #define DEFAULT_SQL_USER "webbot"
63: #define DEFAULT_SQL_PW ""
64:
65: #if 0
66: #define HT_MEMLOG /* Is expensive in performance! */
67: #endif
68:
69: #define MILLIES 1000
70: #define DEFAULT_TIMEOUT 20 /* timeout in secs */
71:
72: typedef enum _MRFlags {
73: MR_IMG = 0x1,
74: MR_LINK = 0x2,
75: MR_PREEMPTIVE = 0x4,
76: MR_TIME = 0x8,
77: MR_SAVE = 0x10,
78: MR_QUIET = 0x20,
79: MR_REAL_QUIET = 0x40,
80: MR_VALIDATE = 0x80,
81: MR_END_VALIDATE = 0x100,
82: MR_KEEP_META = 0x200,
83: MR_LOGGING = 0x400,
84: MR_DISTRIBUTIONS = 0x800,
1.3 frystyk 85: MR_NOROBOTSTXT = 0x1000,
1.4 frystyk 86: MR_NOMETATAGS = 0x2000,
1.7 frystyk 87: MR_BFS = 0x4000,
88: MR_REDIR = 0x8000
1.1 frystyk 89: } MRFlags;
90:
91: typedef struct _Robot {
92: int depth; /* How deep is our tree */
93: int ndoc;
94: int *cdepth; /* Number of nodes per level */
95: int cnt; /* Count of requests */
96: int cindex; /* Number assigned to each document */
97:
98: HTList * hyperdoc; /* List of our HyperDoc Objects */
99: HTList * htext; /* List of our HText Objects */
100: HTList * fingers;
101:
102: HTList * queue; /* Queue */
103: int cq;
104:
105: int timer;
106: int waits;
107:
108: char * cwd; /* Current dir URL */
109: char * rules;
110: char * prefix;
111: char * img_prefix;
112:
113: char * logfile; /* clf log */
114: HTLog * log;
115: char * reffile; /* referer log */
116: HTLog * ref;
117: char * rejectfile; /* unchecked links */
118: HTLog * reject;
119: char * notfoundfile; /* links that returned 404 */
120: HTLog * notfound;
121: char * connegfile; /* links that were conneg'ed */
122: HTLog * conneg;
123: char * noalttagfile; /* images without alt tags*/
124: HTLog * noalttag;
125:
126:
127: char * hitfile; /* links sorted after hit counts */
128: char * relfile; /* link sorted after relationships */
129: HTLinkType relation; /* Specific relation to look for */
130: char * titlefile; /* links with titles */
131: char * mtfile; /* media types encountered */
132: char * charsetfile; /* charsets encountered */
133: char * lmfile; /* sortef after last modified dates */
134:
135: char * outputfile;
136: FILE * output;
137:
138: char * furl; /* First url */
139:
1.8 ! frystyk 140: MRFlags flags;
1.1 frystyk 141:
1.8 ! frystyk 142: int redir_code; /* 0 means all, otherwise 301, 302, 305... */
1.1 frystyk 143:
144: long get_bytes; /* Total number of bytes processed using GET*/
145: long get_docs; /* Total number of documents using GET */
146:
147: long head_bytes; /* bytes processed bytes processed using HEAD */
148: long head_docs; /* Total number of documents using HEAD*/
149:
150: long other_docs;
151:
152: ms_t time; /* Time of run */
153:
154: #ifdef HT_POSIX_REGEX
155: regex_t * include;
156: regex_t * exclude;
157: regex_t * check;
158: regex_t * exc_robot; /* Robots.txt exclusion */
159: #endif
160:
161: #ifdef HT_MYSQL
162: HTSQLLog * sqllog;
163: char * sqlserver;
164: char * sqldb;
165: char * sqluser;
166: char * sqlpw;
167: char * sqlrelative;
168: BOOL sqlexternals;
169: int sqlflags;
170: #endif
171:
172: } Robot;
173:
174: typedef struct _Finger {
175: Robot * robot;
176: HTRequest * request;
177: HTParentAnchor * dest;
178: } Finger;
179:
180: /*
181: ** The HyperDoc object is bound to the anchor and contains information about
182: ** where we are in the search for recursive searches
183: */
1.7 frystyk 184:
185: #define NO_CODE -1
186: #define REDIR_CODE -2
187:
1.1 frystyk 188: typedef struct _HyperDoc {
189: HTParentAnchor * anchor;
190: int depth;
191: int hits;
192: int code;
193: int index;
194: char * title;
195: HTMethod method;
196: } HyperDoc;
197:
198: /*
199: ** This is the HText object that is created every time we start parsing an
200: ** HTML object
201: */
202: struct _HText {
203: HTRequest * request;
204: BOOL follow;
205: };
206:
207: /*
208: ** A structure for calculating metadata distributions
209: */
210: typedef struct _MetaDist {
211: HTAtom * name;
212: int hits;
213: } MetaDist;
214:
1.2 frystyk 215: #ifdef HT_POSIX_REGEX
216: PUBLIC regex_t * get_regtype (Robot * mr, const char * regex_str, int cflags);
217: #endif
1.1 frystyk 218:
219: PUBLIC int OutputData(const char * fmt, ...);
220: PUBLIC HyperDoc * HyperDoc_new (Robot * mr,HTParentAnchor * anchor, int depth);
221: PUBLIC BOOL HyperDoc_delete (HyperDoc * hd);
222: PUBLIC Robot * Robot_new (void);
223: PUBLIC Finger * Finger_new (Robot * robot, HTParentAnchor * dest, HTMethod method);
1.5 frystyk 224: PUBLIC BOOL Robot_registerHTMLParser (void);
1.1 frystyk 225: PUBLIC void Cleanup (Robot * me, int status);
226: PUBLIC void VersionInfo (void);
1.8 ! frystyk 227:
1.1 frystyk 228: PUBLIC int terminate_handler (HTRequest * request, HTResponse * response,
229: void * param, int status) ;
230:
1.8 ! frystyk 231: PUBLIC int bfs_terminate_handler (HTRequest * request, HTResponse * response,
! 232: void * param, int status) ;
! 233:
! 234: PUBLIC int redirection_handler (HTRequest * request, HTResponse * response,
! 235: void * param, int status) ;
1.1 frystyk 236:
237: PUBLIC void Serving_queue(Robot *mr);
238:
239: PUBLIC char *get_robots_txt(char *uri);
240:
241: #endif
242: </PRE>
243: <P>
244: <HR>
245: <ADDRESS>
1.8 ! frystyk 246: @(#) $Id: HTRobMan.html,v 1.7 1999/03/05 20:03:03 frystyk Exp $
1.1 frystyk 247: </ADDRESS>
248: </BODY></HTML>
Webmaster