Access Manager

/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
This module is the application interface module to the Request Manager. You can use the Request Manager directly but this module makes it easier to use by providing a lot of small request functions using the Request Manager in different ways. It contains help functions for accessing documents and for uploading documents to a remote server.

This module is implemented by HTAccess.c, and it is a part of the W3C Reference Library.

#ifndef HTACCESS_H
#define HTACCESS_H

#include "HTReq.h"
#include "HTAnchor.h"

Generic Library Functions

These are functions that affect the overall behavior of the Library.

Initializing and Terminating the Library

These two functions initiates memory and settings for the Library and cleans up memory kept by the Library when about to exit the application. They must be used!
extern BOOL HTLibInit (CONST char * AppName, CONST char * AppVersion);
extern BOOL HTLibTerminate (void);

Library Name and Version

You can get the generic name of the Library and the version by using the following functions:
extern CONST char * HTLib_name (void);
extern CONST char * HTLib_version (void);

Application Name and Version

Returns the name of the application and the version number that was passed to the HTLibInit() function.
extern CONST char * HTLib_appName (void);
extern CONST char * HTLib_appVersion (void);

Accessing the Local File System

The Library does normally use the local file system for dumping unknown data objects, file cache etc. In some situations this is not desired and we can therefore turn it off. This mode also prevents you from being able to access other resources where you have to log in, fr example telnet.
extern BOOL HTLib_secure (void);
extern void HTLib_setSecure (BOOL mode);

LOAD Request Methods

Request a document from absolute name

Request a document referencd by an absolute URL. Returns YES if request accepted, else NO
extern BOOL HTLoadAbsolute (CONST char * url, HTRequest* request);

Request a document from absolute name to stream

Request a document referencd by an absolute URL and sending the data down a stream. This is _excactly_ the same as HTLoadAbsolute as the ourputstream is specified using the function. HTRequest_setOutputStream(). 'filter' is ignored! Returns YES if request accepted, else NO
extern BOOL HTLoadToStream (CONST char * url, BOOL filter, HTRequest *request);

Request a document from relative name

Request a document referenced by a relative URL. The relative URL is made absolute by resolving it relative to the address of the 'base' anchor. Returns YES if request accepted, else NO
extern BOOL HTLoadRelative (CONST char * 	relative,
			    HTParentAnchor *	base,
			    HTRequest *		request);

Request an anchor

Request the document referenced by the anchor Returns YES if request accepted, else NO
extern BOOL HTLoadAnchor (HTAnchor * anchor, HTRequest * request);

Request an anchor

Same as HTLoadAnchor but any information in the Error Stack in the request object is kept, so that any error messages in one This function is almost identical to HTLoadAnchor, but it doesn't clear the error stack so that the information in there is kept. Returns YES if request accepted, else NO
extern BOOL HTLoadAnchorRecursive (HTAnchor * anchor, HTRequest * request);

Search an Anchor

Performs a keyword search on word given by the user. Adds the keyword to the end of the current address and attempts to open the new address. The list of keywords must be a space-separated list and spaces will be converted to '+' before the request is issued. Search can also be performed by HTLoadAbsolute() etc. Returns YES if request accepted, else NO
extern BOOL HTSearch (CONST char *	keywords,
		      HTParentAnchor *  base,
		      HTRequest * 	request);

Search a document from absolute name

Request a document referencd by an absolute URL appended with the keywords given. The URL can NOT contain any fragment identifier! The list of keywords must be a space-separated list and spaces will be converted to '+' before the request is issued. Returns YES if request accepted, else NO
extern BOOL HTSearchAbsolute (CONST char *	keywords,
			      CONST char *	url,
			      HTRequest *	request);

POST Request Methods

Copy an anchor

Fetch the URL (possibly local file URL) and send it using either PUT or POST to the remote destination using HTTP. The caller can decide the exact method used and which HTTP header fields to transmit by setting the user fields in the request structure. Returns YES if request accepted, else NO
extern BOOL HTCopyAnchor (HTAnchor * src_anchor, HTRequest * main_req);

Upload an Anchor

Send the contents (in hyperdoc) of the source anchor using either PUT or POST to the remote destination using HTTP. The caller can decide the exact method used and which HTTP header fields to transmit by setting the user fields in the request structure. Returns YES if request accepted, else NO
extern BOOL HTUploadAnchor (HTAnchor *		src_anchor,
			    HTParentAnchor *	dest_anchor,
			    HTRequest *		dest_req);

SERVER Request Methods

Service a Request

This function sets up a request to service a document using the specified access scheme.
extern BOOL HTServDocument (HTRequest *		request,
			    SOCKET		master,
			    CONST char *	access);
#endif /* HTACCESS_H */
End of Declaration