Annotation of libwww/Robot/src/HTRobMan.html, revision 1.5
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: #if defined(__svr4__)
73: #define CATCH_SIG
74: #endif
75:
76: typedef enum _MRFlags {
77: MR_IMG = 0x1,
78: MR_LINK = 0x2,
79: MR_PREEMPTIVE = 0x4,
80: MR_TIME = 0x8,
81: MR_SAVE = 0x10,
82: MR_QUIET = 0x20,
83: MR_REAL_QUIET = 0x40,
84: MR_VALIDATE = 0x80,
85: MR_END_VALIDATE = 0x100,
86: MR_KEEP_META = 0x200,
87: MR_LOGGING = 0x400,
88: MR_DISTRIBUTIONS = 0x800,
1.3 frystyk 89: MR_NOROBOTSTXT = 0x1000,
1.4 frystyk 90: MR_NOMETATAGS = 0x2000,
91: MR_BFS = 0x4000
1.1 frystyk 92: } MRFlags;
93:
94: typedef struct _Robot {
95: int depth; /* How deep is our tree */
96: int ndoc;
97: int *cdepth; /* Number of nodes per level */
98: int cnt; /* Count of requests */
99: int cindex; /* Number assigned to each document */
100:
101: HTList * hyperdoc; /* List of our HyperDoc Objects */
102: HTList * htext; /* List of our HText Objects */
103: HTList * fingers;
104:
105: HTList * queue; /* Queue */
106: int cq;
107:
108: int timer;
109: int waits;
110:
111: char * cwd; /* Current dir URL */
112: char * rules;
113: char * prefix;
114: char * img_prefix;
115:
116: char * logfile; /* clf log */
117: HTLog * log;
118: char * reffile; /* referer log */
119: HTLog * ref;
120: char * rejectfile; /* unchecked links */
121: HTLog * reject;
122: char * notfoundfile; /* links that returned 404 */
123: HTLog * notfound;
124: char * connegfile; /* links that were conneg'ed */
125: HTLog * conneg;
126: char * noalttagfile; /* images without alt tags*/
127: HTLog * noalttag;
128:
129:
130: char * hitfile; /* links sorted after hit counts */
131: char * relfile; /* link sorted after relationships */
132: HTLinkType relation; /* Specific relation to look for */
133: char * titlefile; /* links with titles */
134: char * mtfile; /* media types encountered */
135: char * charsetfile; /* charsets encountered */
136: char * lmfile; /* sortef after last modified dates */
137:
138: char * outputfile;
139: FILE * output;
140:
141: char * furl; /* First url */
142:
143:
144: MRFlags flags;
145:
146: long get_bytes; /* Total number of bytes processed using GET*/
147: long get_docs; /* Total number of documents using GET */
148:
149: long head_bytes; /* bytes processed bytes processed using HEAD */
150: long head_docs; /* Total number of documents using HEAD*/
151:
152: long other_docs;
153:
154: ms_t time; /* Time of run */
155:
156: #ifdef HT_POSIX_REGEX
157: regex_t * include;
158: regex_t * exclude;
159: regex_t * check;
160: regex_t * exc_robot; /* Robots.txt exclusion */
161: #endif
162:
163: #ifdef HT_MYSQL
164: HTSQLLog * sqllog;
165: char * sqlserver;
166: char * sqldb;
167: char * sqluser;
168: char * sqlpw;
169: char * sqlrelative;
170: BOOL sqlexternals;
171: int sqlflags;
172: #endif
173:
174: } Robot;
175:
176: typedef struct _Finger {
177: Robot * robot;
178: HTRequest * request;
179: HTParentAnchor * dest;
180: } Finger;
181:
182: /*
183: ** The HyperDoc object is bound to the anchor and contains information about
184: ** where we are in the search for recursive searches
185: */
186: typedef struct _HyperDoc {
187: HTParentAnchor * anchor;
188: int depth;
189: int hits;
190: int code;
191: int index;
192: char * title;
193: HTMethod method;
194: } HyperDoc;
195:
196: /*
197: ** This is the HText object that is created every time we start parsing an
198: ** HTML object
199: */
200: struct _HText {
201: HTRequest * request;
202: BOOL follow;
203: };
204:
205: /*
206: ** A structure for calculating metadata distributions
207: */
208: typedef struct _MetaDist {
209: HTAtom * name;
210: int hits;
211: } MetaDist;
212:
1.2 frystyk 213: #ifdef HT_POSIX_REGEX
214: PUBLIC regex_t * get_regtype (Robot * mr, const char * regex_str, int cflags);
215: #endif
1.1 frystyk 216:
217: PUBLIC int OutputData(const char * fmt, ...);
218: PUBLIC HyperDoc * HyperDoc_new (Robot * mr,HTParentAnchor * anchor, int depth);
219: PUBLIC BOOL HyperDoc_delete (HyperDoc * hd);
220: PUBLIC Robot * Robot_new (void);
221: PUBLIC Finger * Finger_new (Robot * robot, HTParentAnchor * dest, HTMethod method);
1.5 ! frystyk 222: PUBLIC BOOL Robot_registerHTMLParser (void);
1.1 frystyk 223: PUBLIC void Cleanup (Robot * me, int status);
224: PUBLIC void SetSignal (void);
225: PUBLIC void VersionInfo (void);
226: PUBLIC int terminate_handler (HTRequest * request, HTResponse * response,
227: void * param, int status) ;
228:
229: PUBLIC int my_terminate_handler (HTRequest * request, HTResponse * response,
230: void * param, int status) ;
231:
232: PUBLIC void Serving_queue(Robot *mr);
233:
234: PUBLIC char *get_robots_txt(char *uri);
235:
236: #endif
237: </PRE>
238: <P>
239: <HR>
240: <ADDRESS>
1.5 ! frystyk 241: @(#) $Id: HTRobMan.html,v 1.4 1998/11/01 00:54:33 frystyk Exp $
1.1 frystyk 242: </ADDRESS>
243: </BODY></HTML>
Webmaster