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