Blame WWW/Library/Implementation/HTAccess.h

Packit f574b8
/*
Packit f574b8
 * $LynxId: HTAccess.h,v 1.20 2008/01/03 00:24:16 tom Exp $
Packit f574b8
 *					HTAccess:  Access manager for libwww
Packit f574b8
 *			ACCESS MANAGER
Packit f574b8
 *
Packit f574b8
 * This module keeps a list of valid protocol (naming scheme) specifiers with
Packit f574b8
 * associated access code.  It allows documents to be loaded given various
Packit f574b8
 * combinations of parameters.  New access protocols may be registered at any
Packit f574b8
 * time.
Packit f574b8
 *
Packit f574b8
 * Part of the libwww library .
Packit f574b8
 *
Packit f574b8
 */
Packit f574b8
#ifndef HTACCESS_H
Packit f574b8
#define HTACCESS_H
Packit f574b8
Packit f574b8
/*      Definition uses:
Packit f574b8
*/
Packit f574b8
#include <HTAnchor.h>
Packit f574b8
#include <HTFormat.h>
Packit f574b8
Packit f574b8
#ifdef __cplusplus
Packit f574b8
extern "C" {
Packit f574b8
#endif
Packit f574b8
    extern char *use_this_url_instead;
Packit f574b8
Packit f574b8
    extern int redirection_attempts;
Packit f574b8
Packit f574b8
/*      Return codes from load routines:
Packit f574b8
 *
Packit f574b8
 *      These codes may be returned by the protocol modules,
Packit f574b8
 *      and by the HTLoad routines.
Packit f574b8
 *      In general, positive codes are OK and negative ones are bad.
Packit f574b8
 */
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Default Addresses
Packit f574b8
Packit f574b8
   These control the home page selection.  To mess with these for normal browses is asking
Packit f574b8
   for user confusion.
Packit f574b8
Packit f574b8
 */
Packit f574b8
#define LOGICAL_DEFAULT "WWW_HOME"	/* Defined to be the home page */
Packit f574b8
Packit f574b8
#ifndef PERSONAL_DEFAULT
Packit f574b8
#define PERSONAL_DEFAULT "WWW/default.html"	/* in home directory */
Packit f574b8
#endif
Packit f574b8
#ifndef LOCAL_DEFAULT_FILE
Packit f574b8
#define LOCAL_DEFAULT_FILE "/usr/local/lib/WWW/default.html"
Packit f574b8
#endif
Packit f574b8
/*  If one telnets to a www access point,
Packit f574b8
    it will look in this file for home page */
Packit f574b8
#ifndef REMOTE_POINTER
Packit f574b8
#define REMOTE_POINTER  "/etc/www-remote.url"	/* can't be file */
Packit f574b8
#endif
Packit f574b8
/* and if that fails it will use this. */
Packit f574b8
#ifndef REMOTE_ADDRESS
Packit f574b8
#define REMOTE_ADDRESS  "http://www.w3.org/remote.html"		/* can't be file */
Packit f574b8
#endif
Packit f574b8
Packit f574b8
/* If run from telnet daemon and no -l specified, use this file:
Packit f574b8
*/
Packit f574b8
#ifndef DEFAULT_LOGFILE
Packit f574b8
#define DEFAULT_LOGFILE "/usr/adm/www-log/www-log"
Packit f574b8
#endif
Packit f574b8
Packit f574b8
/*      If the home page isn't found, use this file:
Packit f574b8
*/
Packit f574b8
#ifndef LAST_RESORT
Packit f574b8
#define LAST_RESORT     "http://www.w3.org/default.html"
Packit f574b8
#endif
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Flags which may be set to control this module
Packit f574b8
Packit f574b8
 */
Packit f574b8
#ifdef NOT
Packit f574b8
    extern int HTDiag;		/* Flag: load source as plain text */
Packit f574b8
#endif				/* NOT */
Packit f574b8
    extern char *HTClientHost;	/* Name or number of telnetting host */
Packit f574b8
    extern FILE *HTlogfile;	/* File to output one-liners to */
Packit f574b8
    extern BOOL HTSecure;	/* Disable security holes? */
Packit f574b8
    extern BOOL HTPermitRedir;	/* Special flag for getfile() */
Packit f574b8
    extern HTStream *HTOutputStream;	/* For non-interactive, set this */
Packit f574b8
    extern HTFormat HTOutputFormat;	/* To convert on load, set this */
Packit f574b8
Packit f574b8
/*	Check for proxy override.			override_proxy()
Packit f574b8
 *
Packit f574b8
 *	Check the no_proxy environment variable to get the list
Packit f574b8
 *	of hosts for which proxy server is not consulted.
Packit f574b8
 *
Packit f574b8
 *	no_proxy is a comma- or space-separated list of machine
Packit f574b8
 *	or domain names, with optional :port part.  If no :port
Packit f574b8
 *	part is present, it applies to all ports on that domain.
Packit f574b8
 *
Packit f574b8
 *  Example:
Packit f574b8
 *          no_proxy="cern.ch,some.domain:8001"
Packit f574b8
 *
Packit f574b8
 *  Use "*" to override all proxy service:
Packit f574b8
 *	     no_proxy="*"
Packit f574b8
 */
Packit f574b8
    extern BOOL override_proxy(const char *addr);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Load a document from relative name
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  relative_name           The relative address of the file to be accessed.
Packit f574b8
  here                    The anchor of the object being searched
Packit f574b8
Packit f574b8
  ON EXIT,
Packit f574b8
  returns    YES          Success in opening file
Packit f574b8
  NO                      Failure
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern BOOL HTLoadRelative(const char *relative_name,
Packit f574b8
			       HTParentAnchor *here);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Load a document from absolute name
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  addr                    The absolute address of the document to be accessed.
Packit f574b8
  filter_it               if YES, treat document as HTML
Packit f574b8
Packit f574b8
  ON EXIT,
Packit f574b8
  returns YES             Success in opening document
Packit f574b8
  NO                      Failure
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern BOOL HTLoadAbsolute(const DocAddress *addr);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Load a document from absolute name to a stream
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  addr                    The absolute address of the document to be accessed.
Packit f574b8
  filter_it               if YES, treat document as HTML
Packit f574b8
Packit f574b8
  ON EXIT,
Packit f574b8
  returns YES             Success in opening document
Packit f574b8
  NO                      Failure
Packit f574b8
Packit f574b8
   Note: This is equivalent to HTLoadDocument
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern BOOL HTLoadToStream(const char *addr, BOOL filter_it,
Packit f574b8
			       HTStream *sink);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Load if necessary, and select an anchor
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  destination                The child or parent anchor to be loaded.
Packit f574b8
Packit f574b8
  ON EXIT,
Packit f574b8
  returns YES             Success
Packit f574b8
  returns NO              Failure
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern BOOL HTLoadAnchor(HTAnchor * destination);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Make a stream for Saving object back
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  anchor                  is valid anchor which has previously been loaded
Packit f574b8
Packit f574b8
  ON EXIT,
Packit f574b8
  returns                 0 if error else a stream to save the object to.
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern HTStream *HTSaveStream(HTParentAnchor *anchor);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Search
Packit f574b8
Packit f574b8
   Performs a search on word given by the user.  Adds the search words to the end of the
Packit f574b8
   current address and attempts to open the new address.
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  *keywords               space-separated keyword list or similar search list
Packit f574b8
  here                    The anchor of the object being searched
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern BOOL HTSearch(const char *keywords, HTParentAnchor *here);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Search Given Indexname
Packit f574b8
Packit f574b8
   Performs a keyword search on word given by the user.  Adds the keyword to  the end of
Packit f574b8
   the current address and attempts to open the new address.
Packit f574b8
Packit f574b8
  ON ENTRY,
Packit f574b8
  *keywords               space-separated keyword list or similar search list
Packit f574b8
  *indexname              is name of object search is to be done on.
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern BOOL HTSearchAbsolute(const char *keywords,
Packit f574b8
				 char *indexname);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Register an access method
Packit f574b8
Packit f574b8
 */
Packit f574b8
Packit f574b8
    typedef struct _HTProtocol {
Packit f574b8
	const char *name;
Packit f574b8
Packit f574b8
	int (*load) (const char *full_address,
Packit f574b8
		     HTParentAnchor *anchor,
Packit f574b8
		     HTFormat format_out,
Packit f574b8
		     HTStream *sink);
Packit f574b8
Packit f574b8
	HTStream *(*saveStream) (HTParentAnchor *anchor);
Packit f574b8
Packit f574b8
    } HTProtocol;
Packit f574b8
Packit f574b8
    extern BOOL HTRegisterProtocol(HTProtocol * protocol);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Generate the anchor for the home page
Packit f574b8
Packit f574b8
 */
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
   As it involves file access, this should only be done once when the program first runs.
Packit f574b8
   This is a default algorithm -- browser don't HAVE to use this.
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern HTParentAnchor *HTHomeAnchor(void);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
Return Host Name
Packit f574b8
Packit f574b8
 */
Packit f574b8
    extern const char *HTHostName(void);
Packit f574b8
Packit f574b8
/*
Packit f574b8
Packit f574b8
For registering protocols supported by Lynx
Packit f574b8
Packit f574b8
*/
Packit f574b8
    extern void LYRegisterLynxProtocols(void);
Packit f574b8
Packit f574b8
    extern void LYUCPushAssumed(HTParentAnchor *anchor);
Packit f574b8
    extern int LYUCPopAssumed(void);
Packit f574b8
Packit f574b8
    extern BOOL using_proxy;	/* Are we using an NNTP proxy? */
Packit f574b8
Packit f574b8
#ifdef __cplusplus
Packit f574b8
}
Packit f574b8
#endif
Packit f574b8
#endif				/* HTACCESS_H */