Annotation of libwww/Library/src/HTRules.html, revision 2.15
2.6 timbl 1: <HEADER>
2: <TITLE>Configuration Manager for libwww</TITLE>
3: <NEXTID N="6">
4: </HEADER>
5: <BODY>
6: <H1>Configuration manager</H1>Author Tim Berners-Lee/CERN. Public
7: domain. Please mail changes to timbl@info.cern.ch.<P>
8: The configuration information loaded
9: includes tables (file suffixes, presentation
10: methods) in other modules. The most
11: likely routines needed by developers
12: will be:
13: <DL>
14: <DT><A
15: NAME=z3 HREF="#z2">HTSetConfiguration</A>
16: <DD> to load configuration
17: information.
18: <DT><A
19: NAME=z1 HREF="#z0">HTLoadRules</A>
20: <DD> to load a whole file
21: of configuration information
22: <DT><A
23: NAME=z5 HREF="#z4">HTTranslate</A>
24: <DD> to translate a URL using
25: the rule table.
26: </DL>
2.1 timbl 27:
2.6 timbl 28: <PRE>#ifndef HTRULE_H
2.1 timbl 29: #define HTRULE_H
30:
31: #include "HTUtils.h"
2.10 luotonen 32: #include "HTAccess.h" /* HTRequest */
2.1 timbl 33:
2.7 luotonen 34: typedef enum _HTRuleOp {
35: HT_Invalid,
36: HT_Map,
37: HT_Pass,
38: HT_Fail,
39: HT_DefProt,
2.10 luotonen 40: HT_Protect,
2.12 luotonen 41: HT_Exec,
2.15 ! luotonen 42: HT_Redirect,
! 43: HT_UseProxy
2.7 luotonen 44: } HTRuleOp;
2.1 timbl 45:
2.9 luotonen 46: #ifdef SHORT_NAMES
47: #define HTSearSc HTSearchScript
2.11 luotonen 48: #define HTPutScr HTPutScript
49: #define HTPostSc HTPostScript
2.9 luotonen 50: #endif /*SHORT_NAMES*/
51:
52: </PRE>
53:
54: <H2>Server Side Script Execution</H2>
55:
56: If a URL starts with <CODE>/htbin/</CODE> it is understood
57: to mean a script execution request on server.
58: This feature needs to
59: be turned on by setting <CODE>HTBinDir</CODE> by the
60: <CODE>htbin</CODE> rule. Index searching is enabled by
61: setting <CODE>HTSearchScript</CODE> into the name of script
62: in BinDir doing the actual search by <CODE>search</CODE> rule
63: (BinDir must also be set in this case, of course).
64: <PRE>
65: extern char * HTSearchScript; /* Search script name */
2.11 luotonen 66: extern char * HTPutScript; /* Script handling PUT */
67: extern char * HTPostScript; /* Script handling POST */
2.8 luotonen 68:
2.6 timbl 69: </PRE>
70: <H2>HTAddRule: Add rule to the list</H2>
71: <H3>On entry,</H3>
72: <DL>
73: <DT>pattern
74: <DD>points to 0-terminated string
75: containing a single "*"
76: <DT>equiv
77: <DD>points to the equivalent string
78: with * for the place where the text
79: matched by * goes.
80: </DL>
81:
82: <H3>On exit,</H3>
83: <DL>
84: <DT>returns
85: <DD>0 if success, -1 if error.
86: </DL>
87: Note that if BYTE_ADDRESSING is set,
88: the three blocks required are allocated
89: and deallocated as one. This will
90: save time and storage, when malloc's
91: allocation units are large.
92: <PRE>extern int HTAddRule PARAMS((HTRuleOp op, const char * pattern, const char * equiv));
93:
94:
95: </PRE>
96: <H2>HTClearRules: Clear all rules</H2>
97: <H3>On exit,</H3>
98: <DL>
99: <DT>Rule file
100: <DD> There are no rules
101: <DT>returns
102: <DD>
103: <DD> 0 if success, -1 if error.
104: </DL>
105:
106: <PRE>
2.1 timbl 107: #ifdef __STDC__
108: extern int HTClearRules(void);
109: #else
110: extern int HTClearRules();
111: #endif
112:
113:
2.6 timbl 114: </PRE>
115: <H2><A
116: NAME=z4>HTTranslate: Translate by rules</A></H2>
117: <PRE>
118: </PRE>
119: <H3>On entry,</H3>
120: <DL>
121: <DT>required
122: <DD> points to a string whose
123: equivalent value is neeed
124: </DL>
125:
126: <H3>On exit,</H3>
127: <DL>
128: <DT>returns
129: <DD> the address of the equivalent
130: string allocated from the heap which
131: the CALLER MUST FREE. If no translation
132: occured, then it is a copy of the
133: original.
134: </DL>
135:
2.10 luotonen 136: <PRE>
137: PUBLIC char * HTTranslate PARAMS((CONST char * required));
138:
139: </PRE>
2.6 timbl 140: <H2><A
141: NAME=z2>HTSetConfiguration: Load one line
142: of configuration information</A></H2>
143: <H3>On entry,</H3>
144: <DL>
145: <DT>config
146: <DD> is a string in the syntax
147: of a rule file line.
148: </DL>
149: This routine may be used for loading
150: configuration information from sources
151: other than the rule file, for example
152: INI files for X resources.
153: <PRE>extern int HTSetConfiguration PARAMS((CONST char * config));
154:
155:
156: </PRE>
157: <H2><A
158: NAME=z0>HtLoadRules: Load the rules from
159: a file</A></H2>
160: <H3>On entry,</H3>
161: <DL>
162: <DT>Rule table
163: <DD> Rules can be in any state
164: </DL>
165:
166: <H3>On exit,</H3>
167: <DL>
168: <DT>Rule table
169: <DD> Any existing rules will
170: have been kept. Any new rules will
171: have been loaded on top, so as to
172: be tried first.
173: <DT>Returns
174: <DD> 0 if no error.
175: </DL>
2.1 timbl 176:
2.6 timbl 177: <PRE>
2.1 timbl 178: #ifdef __STDC__
179: extern int HTLoadRules(const char * filename);
180: #else
181: extern int HTLoadRules();
182: #endif
2.7 luotonen 183: </PRE>
2.1 timbl 184:
2.7 luotonen 185: <PRE>
2.1 timbl 186:
187: #endif /* HTUtils.h */
2.6 timbl 188: </PRE>end</A></BODY>
Webmaster