Transport Protocols

/*
**	(c) COPYRIGHT MIT 1995.
**	Please first read the full copyright statement in the file COPYRIGH.
*/
This module keeps a list of transport methods with associated access code. New transport protocols may be registered at any time. This allows the application to easily hook in its own transport layers. The purpose of the HTTransport object is to contain transport dependent methods for opening and closing a connection to the transport and also to get an input stream and an output strean for reading and writing to the transport respectively.

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

#ifndef HTTRANS_H
#define HTTRANS_H
All the transports supported directly by the Library can be initiated using the function HTTransportInit() in HTInit module

The Transport Object

All transport interfaces are registered dynamically in libwww. This means that libwww is independent of the transport being used (for example TCP) and you can therefore use libwww in any context you like. You have to specify a set of parameters in order for libwww to be able to use it. The transport class is defined as follows:
typedef struct _HTTransport HTTransport;

#include "HTIOStream.h"
#include "HTChannl.h"

Add a Transport

A new transport can be registered at any time in the Library. You must specify a name ad the supported channel mode that the transport supports. Then you must also register two creation methods of an input and an output stream respectively. You can find the definition of the I/O streams in the HTIOStream module.
extern BOOL HTTransport_add (const char *		name,
			     HTChannelMode		mode,
			     HTInput_new *		get_input,
			     HTOutput_new *		get_output);

Delete a Transport

This functions deletes a registered protocol module so that it can not be used for accessing a resource anymore.
extern BOOL HTTransport_delete (const char * name);

Remove ALL Registered Transports

This is the garbage collection function. It is called by HTLibTerminate()
extern BOOL HTTransport_deleteAll (void);

Find a Transport Protocol Object

You can search the list of registered protocol objects as a function of the access acheme. If an access scheme is found then the protocol object is returned.
extern HTTransport * HTTransport_find (HTRequest * request, const char * name);

Supported Mode

A transport object is registered with the channel mode that it supports.
extern HTChannelMode HTTransport_mode (HTTransport * tp);

Input and Output Stream Creation Methods

struct _HTTransport {
    char *		name;
    HTChannelMode	mode;			   /* Channel mode supported */
    HTInput_new *	input_new; 	     /* Input stream creation method */
    HTOutput_new *	output_new;	    /* Output stream creation method */
};
#endif /* HTTRANS_H */

@(#) $Id: HTTrans.html,v 2.1 1996/04/12 17:49:32 frystyk Exp $