Annotation of libwww/Library/src/HTRules.html, revision 2.27

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

Webmaster