Annotation of libwww/Library/src/HTHstMan.html, revision 2.17
2.1 frystyk 1: <HTML>
2: <HEAD>
2.9 frystyk 3: <TITLE>W3C Sample Code Library libwww Private Hst Definition</TITLE>
2.1 frystyk 4: </HEAD>
5: <BODY>
6: <H1>
7: Private Host Definition
8: </H1>
9: <PRE>
10: /*
11: ** (c) COPYRIGHT MIT 1995.
12: ** Please first read the full copyright statement in the file COPYRIGH.
13: */
14: </PRE>
15: <P>
16: This is the private definition of the Host Class. Please look in the public
2.17 ! frystyk 17: <A HREF="HTHost.html">Host Class</A> for more documentation
2.1 frystyk 18: <P>
2.17 ! frystyk 19: This module is implemented by <A HREF="HTHost.c">HTHost.c</A>, and it is
! 20: a part of the <A HREF="http://www.w3.org/Library/">W3C Sample Code Library</A>.
2.1 frystyk 21: <PRE>
22: #ifndef HTHSTMAN_H
23: #define HTHSTMAN_H
24: #include "HTHost.h"
25: #include "HTDNS.h"
26: #include "HTEvent.h"
27: #include "HTProt.h"
28:
29: #define PIPE_BUFFER_SIZE 8192
30: </PRE>
31: <P>
32: The <CODE>HTHost</CODE> object is the core of the request queue management.
33: This object contains information about the socket descriptor, the input read
34: buffer etc. required to identify and service a request.
35: <PRE>
36: typedef enum _TCPState {
2.17 ! frystyk 37: TCP_DNS_ERROR = -3,
2.1 frystyk 38: TCP_ERROR = -2,
39: TCP_CONNECTED = -1,
40: TCP_BEGIN = 0,
41: TCP_CHANNEL,
42: TCP_DNS,
43: TCP_NEED_SOCKET,
44: TCP_NEED_BIND,
45: TCP_NEED_LISTEN,
2.4 eric 46: TCP_NEED_CONNECT,
47: TCP_IN_USE
2.1 frystyk 48: } TCPState;
49:
50: struct _HTHost {
51: int hash;
52:
53: /* Information about the otherend */
54: char * hostname; /* name of host + optional port */
2.2 eric 55: u_short u_port;
2.1 frystyk 56: time_t ntime; /* Creation time */
57: char * type; /* Peer type */
58: int version; /* Peer version */
59: HTMethod methods; /* Public methods (bit-flag) */
60: char * server; /* Server name */
61: char * user_agent; /* User Agent */
62: char * range_units; /* ??? */
63:
64: /* When does this entry expire? */
65: time_t expires; /* Persistent channel expires time */
2.4 eric 66: int reqsPerConnection; /* from Keep-Alive: header */
67: int reqsMade; /* updated as they are sent */
2.1 frystyk 68:
69: /* Queuing and connection modes */
70: HTList * pipeline; /* Pipe line of net objects */
71: HTList * pending; /* List of pending Net objects */
2.11 frystyk 72: HTNet * doit; /* Transfer from pending to pipe */
2.13 frystyk 73: HTNet * lock; /* This is a kludge! */
2.1 frystyk 74: BOOL persistent;
75: HTTransportMode mode; /* Supported mode */
2.12 frystyk 76: HTTimer * timer; /* Timer for handling idle connection */
77: BOOL do_recover; /* If we are supposed to recover */
2.5 frystyk 78: int recovered; /* How many times had we recovered */
2.10 frystyk 79: BOOL close_notification; /* Got a hint about close */
2.16 frystyk 80: BOOL broken_pipe;
2.1 frystyk 81:
82: /* Support for transports */
83: HTChannel * channel; /* data channel */
84:
85: /* Connection dependent stuff */
86: HTdns * dns; /* Link to DNS object */
87: TCPState tcpstate; /* State in connection */
2.14 frystyk 88: SockA sock_addr; /* SockA is defined in wwwsys.h */
2.1 frystyk 89: int retry; /* Counting attempts to connect */
90: int home; /* Current home if multiple */
2.7 frystyk 91: ms_t connecttime; /* Time in ms on multihomed hosts */
2.1 frystyk 92:
93: /* Event Management */
2.3 eric 94: HTEvent * events[HTEvent_TYPES];/* reading and writing may differ */
2.1 frystyk 95: HTEventType registeredFor; /* Which actions are we blocked on */
96: size_t remainingRead; /* Tells HostEvent to call next net */
97:
98: /* User specific stuff */
2.6 frystyk 99: ms_t delay; /* Write delay in ms */
2.1 frystyk 100: void * context; /* Protocol Specific context */
101: int forceWriteFlush;
102: };
103:
104: #define HTHost_bytesRead(me) ((me) ? (me)->bytes_read : -1)
105: #define HTHost_bytesWritten(me) ((me) ? (me)->bytes_written : -1)
106:
107: #define HTHost_setBytesRead(me,l) ((me) ? (me->bytes_read=(l)) : -1)
108: #define HTHost_setBytesWritten(me,l) ((me) ? (me->bytes_written=(l)) :-1)
109: #define HTHost_setDNS (host, dns) ((me) ? (me->dns=(dns)) :-1)
110: </PRE>
111: <PRE>
112: #endif /* HTHSTMAN_H */
113: </PRE>
114: <P>
115: <HR>
116: <ADDRESS>
2.17 ! frystyk 117: @(#) $Id: HTHstMan.html,v 2.16 1998/05/19 16:49:33 frystyk Exp $
2.1 frystyk 118: </ADDRESS>
119: </BODY></HTML>
Webmaster