Annotation of libwww/Library/src/HTAccess.html, revision 2.7

2.5       timbl       1: <HEADER>
2.6       timbl       2: <TITLE>HTAccess:  Access manager  for libwww</TITLE>
2.5       timbl       3: <NEXTID N="1">
                      4: </HEADER>
                      5: <BODY>
                      6: <H1>Access Manager</H1>This module keeps a list of valid
                      7: protocol (naming scheme) specifiers
                      8: with associated access code.  It
                      9: allows documents to be loaded given
                     10: various combinations of parameters.
                     11: New access protocols may be registered
                     12: at any time.<P>
                     13: Part of the <A
2.6       timbl      14: NAME=z0 HREF="Overview.html">libwww library</A> .
2.5       timbl      15: <PRE>#ifndef HTACCESS_H
1.1       timbl      16: #define HTACCESS_H
                     17: 
                     18: /*     Definition uses:
                     19: */
                     20: #include "HTUtils.h"
                     21: #include "tcp.h"
                     22: #include "HTAnchor.h"
                     23: #include "HTFormat.h"
                     24: 
                     25: #ifdef SHORT_NAMES
                     26: #define HTClientHost HTClHost
                     27: #endif
                     28: 
                     29: /*     Return codes from load routines:
                     30: **
                     31: **     These codes may be returned by the protocol modules,
                     32: **     and by the HTLoad routines.
                     33: **     In general, positive codes are OK and negative ones are bad.
                     34: */
                     35: 
                     36: #define HT_NO_DATA -9999       /* return code: OK but no data was loaded */
                     37:                                /* Typically, other app started or forked */
                     38: 
2.5       timbl      39: </PRE>
2.6       timbl      40: <H2>Default Addresses</H2>These control the home page selection.
                     41:  To mess with these for normal browses
                     42: is asking for user confusion.
                     43: <PRE>#define LOGICAL_DEFAULT "WWW_HOME"  /* Defined to be the home page */
1.1       timbl      44: 
2.6       timbl      45: #ifndef PERSONAL_DEFAULT
                     46: #define PERSONAL_DEFAULT "WWW/default.html"    /* in home directory */
                     47: #endif
                     48: #ifndef LOCAL_DEFAULT_FILE
1.1       timbl      49: #define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
2.6       timbl      50: #endif
2.7     ! timbl      51: /*  If one telnets to a www access point,
        !            52:     it will look in this file for home page */
        !            53: #ifndef REMOTE_POINTER
        !            54: #define REMOTE_POINTER  "/etc/www-remote.url"  /* can't be file */
        !            55: #endif
        !            56: /* and if that fails it will use this. */
2.6       timbl      57: #ifndef REMOTE_ADDRESS
1.1       timbl      58: #define REMOTE_ADDRESS  "http://info.cern.ch/remote.html"  /* can't be file */
                     59: #endif
                     60: 
                     61: /* If run from telnet daemon and no -l specified, use this file:
                     62: */
                     63: #ifndef DEFAULT_LOGFILE
                     64: #define DEFAULT_LOGFILE        "/usr/adm/www-log/www-log"
                     65: #endif
                     66: 
                     67: /*     If the home page isn't found, use this file:
                     68: */
                     69: #ifndef LAST_RESORT
2.6       timbl      70: #define LAST_RESORT    "http://info.cern.ch/default.html"
1.1       timbl      71: #endif
                     72: 
                     73: 
2.5       timbl      74: </PRE>
                     75: <H2>Flags which may be set to control
                     76: this module</H2>
                     77: <PRE>extern int HTDiag;                        /* Flag: load source as plain text */
1.1       timbl      78: extern char * HTClientHost;            /* Name or number of telnetting host */
                     79: extern FILE * logfile;                 /* File to output one-liners to */
2.7     ! timbl      80: extern BOOL HTSecure;                  /* Disable security holes? */
1.1       timbl      81: extern HTStream* HTOutputStream;       /* For non-interactive, set this */ 
                     82: extern HTFormat HTOutputFormat;                /* To convert on load, set this */
                     83: 
                     84: 
                     85: 
2.5       timbl      86: </PRE>
                     87: <H2>Load a document from relative name</H2>
                     88: <H3>On Entry,</H3>
                     89: <DL>
                     90: <DT>relative_name
2.6       timbl      91: <DD> The relative address
2.5       timbl      92: of the file to be accessed.
                     93: <DT>here
2.6       timbl      94: <DD> The anchor of the object being
2.5       timbl      95: searched
                     96: </DL>
                     97: 
                     98: <H3>On Exit,</H3>
                     99: <DL>
                    100: <DT>returns    YES
2.6       timbl     101: <DD> Success in opening
2.5       timbl     102: file
                    103: <DT>NO
2.6       timbl     104: <DD> Failure 
2.5       timbl     105: </DL>
1.1       timbl     106: 
2.5       timbl     107: <PRE>extern  BOOL HTLoadRelative PARAMS((
1.1       timbl     108:                CONST char *            relative_name,
                    109:                HTParentAnchor *        here));
                    110: 
                    111: 
2.5       timbl     112: </PRE>
                    113: <H2>Load a document from absolute name</H2>
                    114: <H3>On Entry,</H3>
                    115: <DL>
                    116: <DT>addr
2.6       timbl     117: <DD> The absolute address of the
                    118: document to be accessed.
2.5       timbl     119: <DT>filter
2.6       timbl     120: <DD> if YES, treat document as
                    121: HTML
2.5       timbl     122: </DL>
1.1       timbl     123: 
2.5       timbl     124: <PRE>
                    125: </PRE>
                    126: <H3>On Exit,</H3>
                    127: <PRE>
                    128: </PRE>
                    129: <DL>
                    130: <DT>returns YES
2.6       timbl     131: <DD> Success in opening document
2.5       timbl     132: <DT>NO
2.6       timbl     133: <DD> Failure 
2.5       timbl     134: </DL>
1.1       timbl     135: 
2.5       timbl     136: <PRE>extern BOOL HTLoadAbsolute PARAMS((CONST char * addr));
1.1       timbl     137: 
                    138: 
2.5       timbl     139: </PRE>
                    140: <H2>Load a document from absolute name
                    141: to a stream</H2>
                    142: <H3>On Entry,</H3>
                    143: <DL>
                    144: <DT>addr
2.6       timbl     145: <DD> The absolute address of the
                    146: document to be accessed.
2.5       timbl     147: <DT>filter
2.6       timbl     148: <DD> if YES, treat document as
                    149: HTML
2.5       timbl     150: </DL>
                    151: 
                    152: <H3>On Exit,</H3>
                    153: <DL>
                    154: <DT>returns YES
2.6       timbl     155: <DD> Success in opening document
2.5       timbl     156: <DT>NO
2.6       timbl     157: <DD> Failure 
2.5       timbl     158: </DL>
                    159: Note: This is equivalent to HTLoadDocument
                    160: <PRE>extern BOOL HTLoadToStream PARAMS((CONST char * addr, BOOL filter,
1.1       timbl     161:                                HTStream * sink));
                    162: 
                    163: 
2.5       timbl     164: </PRE>
                    165: <H2>Load if necessary, and select an
                    166: anchor</H2>
                    167: <H3>On Entry,</H3>
                    168: <DL>
                    169: <DT>destination      
                    170: <DD>    The child or
                    171: parenet anchor to be loaded.
                    172: </DL>
                    173: 
                    174: <PRE>
                    175: </PRE>
                    176: <H3>On Exit,</H3>
                    177: <PRE>
                    178: </PRE>
                    179: <DL>
                    180: <DT>returns YES
2.6       timbl     181: <DD> Success
2.5       timbl     182: <DT>returns NO
2.6       timbl     183: <DD> Failure 
2.5       timbl     184: </DL>
                    185: 
                    186: <PRE>
                    187: 
1.1       timbl     188: 
                    189: extern BOOL HTLoadAnchor PARAMS((HTAnchor * destination));
                    190: 
                    191: 
2.5       timbl     192: </PRE>
                    193: <H2>Make a stream for Saving object back</H2>
                    194: <H3>On Entry,</H3>
                    195: <DL>
                    196: <DT>anchor
2.6       timbl     197: <DD> is valid anchor which has
                    198: previously beeing loaded
2.5       timbl     199: </DL>
                    200: 
                    201: <H3>On exit,</H3>
                    202: <DL>
                    203: <DT>returns
2.6       timbl     204: <DD> 0 if error else a stream
                    205: to save the object to.
2.5       timbl     206: </DL>
                    207: 
                    208: <PRE>
                    209: 
1.1       timbl     210: extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
                    211: 
                    212: 
2.5       timbl     213: </PRE>
                    214: <H2>Search</H2>Performs a search on word given by
                    215: the user. Adds the search words to
                    216: the end of the current address and
                    217: attempts to open the new address.
                    218: <H3>On Entry,</H3>
                    219: <DL>
                    220: <DT>*keywords
2.6       timbl     221: <DD> space-separated keyword
2.5       timbl     222: list or similar search list
                    223: <DT>here
2.6       timbl     224: <DD> The anchor of the object being
2.5       timbl     225: searched
                    226: </DL>
1.1       timbl     227: 
2.5       timbl     228: <PRE>extern BOOL HTSearch PARAMS((CONST char * keywords, HTParentAnchor* here));
1.1       timbl     229: 
                    230: 
2.5       timbl     231: </PRE>
                    232: <H2>Search Given Indexname</H2>Performs a keyword search on word
                    233: given by the user. Adds the keyword
                    234: to  the end of the current address
                    235: and attempts to open the new address.
                    236: <H3>On Entry,</H3>
                    237: <DL>
                    238: <DT>*keywords
2.6       timbl     239: <DD> space-separated keyword
2.5       timbl     240: list or similar search list
                    241: <DT>*indexname
2.6       timbl     242: <DD> is name of object search
2.5       timbl     243: is to be done on.
                    244: </DL>
1.1       timbl     245: 
2.5       timbl     246: <PRE>extern BOOL HTSearchAbsolute PARAMS((
1.1       timbl     247:        CONST char *    keywords,
                    248:        CONST char *    indexname));
                    249: 
                    250: 
2.5       timbl     251: </PRE>
                    252: <H2>Register an access method</H2>
                    253: <PRE>
1.1       timbl     254: typedef struct _HTProtocol {
                    255:        char * name;
                    256:        
                    257:        int (*load)PARAMS((
                    258:                CONST char *    full_address,
                    259:                HTParentAnchor * anchor,
                    260:                HTFormat        format_out,
                    261:                HTStream*       sink));
                    262:                
                    263:        HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
                    264: 
                    265: } HTProtocol;
                    266: 
                    267: extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
                    268: 
                    269: 
2.5       timbl     270: </PRE>
                    271: <H2>Generate the anchor for the home
                    272: page</H2>
                    273: <PRE>
                    274: </PRE>As it involves file access, this
                    275: should only be done once when the
                    276: program first runs. This is a default
                    277: algorithm -- browser don't HAVE to
                    278: use this.
                    279: <PRE>extern HTParentAnchor * HTHomeAnchor NOPARAMS;
1.1       timbl     280: 
                    281: #endif /* HTACCESS_H */
2.6       timbl     282: </PRE>end of HTAccess</A></BODY>

Webmaster