Annotation of libwww/Library/src/HTHost.html, revision 2.3
2.1 frystyk 1: <HTML>
2: <HEAD>
2.3 ! frystyk 3: <!-- Changed by: Henrik Frystyk Nielsen, 5-Apr-1996 -->
! 4: <TITLE>W3C Reference Library libwww Host Class</TITLE>
2.1 frystyk 5: </HEAD>
6: <BODY>
2.3 ! frystyk 7: <H1>
! 8: The Host Class
! 9: </H1>
2.1 frystyk 10: <PRE>
11: /*
12: ** (c) COPYRIGHT MIT 1995.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
2.3 ! frystyk 16: <P>
! 17: The Host class manages what we know about a remote host. This can for example
! 18: be what type of host it is, and what version it is using. Notice that a host
! 19: object can be used to describe both a server or a client - all information
! 20: in the Host object can be shared regardless of whether it is to be used in
! 21: a server application or a client application.
! 22: <P>
! 23: This module is implemented by <A HREF="HTHost.c">HTHost.c</A>, and it is
! 24: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C Reference
! 25: Library</A>.
2.1 frystyk 26: <PRE>
27: #ifndef HTHOST_H
28: #define HTHOST_H
29:
30: typedef struct _HTHost HTHost;
31:
32: #include "HTChannl.h"
33: #include "HTReq.h"
2.2 frystyk 34: #include "HTEvent.h"
2.1 frystyk 35: </PRE>
2.3 ! frystyk 36: <P>
! 37: The Host class contains information about the remote host, for example the
! 38: type (HTTP/1.0, HTTP/1.1, FTP etc.) along with information on how the connections
! 39: can be used (if it supports persistent connections, interleaved access etc.)
! 40: <H2>
! 41: Creation and Deletion Methods
! 42: </H2>
! 43: <P>
! 44: We keep a cache of information that we know about a remote host. This allows
! 45: us to be much more detailed in geneating requests. Search the host info cache
! 46: for a host object or create a new one and add it. Examples of host names
! 47: are
! 48: <P>
2.1 frystyk 49: <UL>
2.3 ! frystyk 50: <LI>
! 51: www.w3.org
! 52: <LI>
! 53: www.foo.com:8000
2.1 frystyk 54: </UL>
2.3 ! frystyk 55: <H3>
! 56: Add a Host Object
! 57: </H3>
2.1 frystyk 58: <PRE>
59: extern HTHost * HTHost_new (char * host);
60: </PRE>
2.3 ! frystyk 61: <H3>
! 62: Delete a Host Object
! 63: </H3>
! 64: <P>
! 65: The Host Class contains an automatic garbage collection of Host objects so
! 66: that we don't keep information around that is stale.
! 67: <H2>
! 68: Host Class Methods
! 69: </H2>
! 70: <P>
2.1 frystyk 71: This is what we know about the remote host
2.3 ! frystyk 72: <H3>
! 73: Remote Host Class and Version
! 74: </H3>
! 75: <P>
! 76: Define the <EM>host class</EM> of the host at the other end. A class is a
! 77: generic description of the protocol which is exactly like the access method
! 78: in a URL, for example "http" etc. The <EM>host version</EM> is a finer
! 79: distinction (sub-class) between various versions of the host class, for example
! 80: HTTP/0.9, HTTP/1.1 etc. The host version is a bit flag that the protocol
! 81: module can define on its own. That way we don't have to change this module
! 82: when registering a new protocol module. The <EM>host type</EM> is a description
! 83: of whether we can keep the connection persistent or not.
2.1 frystyk 84: <PRE>
85: extern char * HTHost_class (HTHost * host);
86: extern void HTHost_setClass (HTHost * host, char * s_class);
87:
88: extern int HTHost_version (HTHost * host);
89: extern void HTHost_setVersion (HTHost * host, int version);
90: </PRE>
2.3 ! frystyk 91: <H3>
! 92: Register a Persistent Channel
! 93: </H3>
! 94: <P>
! 95: We don't want more than MaxSockets-2 connections to be persistent in order
! 96: to avoid deadlock.
2.1 frystyk 97: <PRE>
98: extern BOOL HTHost_setChannel (HTHost * host, HTChannel * channel);
99: extern BOOL HTHost_clearChannel (HTHost * host);
100:
101: extern HTChannel * HTHost_channel (HTHost * host);
102: </PRE>
2.3 ! frystyk 103: <H3>
! 104: Is this host Persistent?
! 105: </H3>
! 106: <P>
2.1 frystyk 107: Check whether we have a persistent channel or not
108: <PRE>
109: extern BOOL HTHost_isPersistent (HTHost * host);
110: </PRE>
2.3 ! frystyk 111: <H3>
! 112: Timing Persistent Channels
! 113: </H3>
! 114: <P>
! 115: Normally we wait for the peer process to close persistent connections but
! 116: in order not to use up our own resources, we have a timeout on our own. The
! 117: default value is 1 hour, but you can modify the value using the following
! 118: methods:
2.1 frystyk 119: <PRE>
120: extern time_t HTHost_persistTimeout (time_t timeout);
121: extern void HTHost_setPersistTimeout (time_t timeout);
122: </PRE>
2.3 ! frystyk 123: <P>
! 124: Each persistent connection has an absolute value of when this connection
! 125: most likely will expire. If the peer process does not inform us, we use our
! 126: own timeout.
2.1 frystyk 127: <PRE>
128: extern void HTHost_setPersistExpires (HTHost * host, time_t expires);
129: extern time_t HTHost_persistExpires (HTHost * host);
130: </PRE>
2.3 ! frystyk 131: <H3>
! 132: Catching a Close Event
! 133: </H3>
! 134: <P>
! 135: This function is registered when the socket is idle so that we get a notification
! 136: if the socket closes at the other end. At this point we can't use the request
! 137: object as it might have been freed a long time ago.
! 138: <PRE>
! 139: extern int HTHost_catchClose (SOCKET soc, HTRequest * request, SockOps ops);
! 140: </PRE>
2.1 frystyk 141: <PRE>
142: #endif /* HTHOST_H */
143: </PRE>
2.3 ! frystyk 144: <P>
! 145: <HR>
2.1 frystyk 146: <ADDRESS>
2.3 ! frystyk 147: @(#) $Id: HTHost.html,v 2.2 1996/05/16 19:03:03 frystyk Exp $
2.1 frystyk 148: </ADDRESS>
2.3 ! frystyk 149: </BODY></HTML>
Webmaster