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