2010-03-08 04:55:21 -06:00
|
|
|
/* HTAccess: Access manager for libwww
|
|
|
|
ACCESS MANAGER
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
This module keeps a list of valid protocol (naming scheme)
|
|
|
|
specifiers with associated access code. It allows documents to be
|
|
|
|
loaded given various combinations of parameters. New access
|
|
|
|
protocols may be registered at any time.
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
Part of the libwww library .
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
#ifndef HTACCESS_H
|
|
|
|
#define HTACCESS_H
|
|
|
|
|
|
|
|
/* Definition uses:
|
|
|
|
*/
|
|
|
|
#include "HTUtils.h"
|
|
|
|
#include "tcp.h"
|
|
|
|
#include "HTAnchor.h"
|
|
|
|
#include "HTFormat.h"
|
|
|
|
|
|
|
|
#ifdef SHORT_NAMES
|
|
|
|
#define HTClientHost HTClHost
|
|
|
|
#define HTOutputStream HTOuStre
|
|
|
|
#define HTOutputFormat HTOuForm
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Return codes from load routines:
|
|
|
|
**
|
|
|
|
** These codes may be returned by the protocol modules,
|
|
|
|
** and by the HTLoad routines.
|
|
|
|
** In general, positive codes are OK and negative ones are bad.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define HT_NO_DATA -9999 /* return code: OK but no data was loaded */
|
|
|
|
/* Typically, other app started or forked */
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Flags which may be set to control this module
|
|
|
|
|
|
|
|
*/
|
|
|
|
extern int HTDiag; /* Flag: load source as plain text */
|
|
|
|
extern char * HTClientHost; /* Name or number of telnetting host */
|
|
|
|
extern FILE * logfile; /* File to output one-liners to */
|
|
|
|
extern HTStream* HTOutputStream; /* For non-interactive, set this */
|
|
|
|
extern HTFormat HTOutputFormat; /* To convert on load, set this */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Load a document from relative name
|
|
|
|
|
|
|
|
ON ENTRY,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
relative_name The relative address of the file to be accessed.
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
here The anchor of the object being searched
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
ON EXIT,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
returns YES Success in opening file
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
NO Failure
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
extern BOOL HTLoadRelative PARAMS((
|
|
|
|
WWW_CONST char * relative_name,
|
|
|
|
HTParentAnchor * here));
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Load a document from absolute name
|
|
|
|
|
|
|
|
ON ENTRY,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
addr The absolute address of the document to be accessed.
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
filter if YES, treat document as HTML
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
ON EXIT,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
returns YES Success in opening document
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
NO Failure
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
extern int HTLoadAbsolute PARAMS((WWW_CONST char * addr));
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Load a document from absolute name to a stream
|
|
|
|
|
|
|
|
ON ENTRY,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
addr The absolute address of the document to be accessed.
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
filter if YES, treat document as HTML
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
ON EXIT,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
returns YES Success in opening document
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
NO Failure
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
Note: This is equivalent to HTLoadDocument
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
extern BOOL HTLoadToStream PARAMS((WWW_CONST char * addr, BOOL filter,
|
|
|
|
HTStream * sink));
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Make a stream for Saving object back
|
|
|
|
|
|
|
|
ON ENTRY,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
anchor is valid anchor which has previously beeing loaded
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
ON EXIT,
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
returns 0 if error else a stream to save the object to.
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
extern HTStream * HTSaveStream PARAMS((HTParentAnchor * anchor));
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
Register an access method
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct _HTProtocol {
|
|
|
|
char * name;
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
int (*load)PARAMS((
|
|
|
|
WWW_CONST char * full_address,
|
|
|
|
HTParentAnchor * anchor,
|
|
|
|
HTFormat format_out,
|
|
|
|
HTStream* sink));
|
2013-03-09 18:59:42 -06:00
|
|
|
|
2010-03-08 04:55:21 -06:00
|
|
|
HTStream* (*saveStream)PARAMS((HTParentAnchor * anchor));
|
|
|
|
|
|
|
|
} HTProtocol;
|
|
|
|
|
|
|
|
extern BOOL HTRegisterProtocol PARAMS((HTProtocol * protocol));
|
|
|
|
|
|
|
|
#endif /* HTACCESS_H */
|