Annotation of libwww/Library/src/HTHstMan.html, revision 2.19
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.18 frystyk 74: HTNet * listening; /* Master for accepting connections */
2.1 frystyk 75: BOOL persistent;
76: HTTransportMode mode; /* Supported mode */
2.12 frystyk 77: HTTimer * timer; /* Timer for handling idle connection */
78: BOOL do_recover; /* If we are supposed to recover */
2.5 frystyk 79: int recovered; /* How many times had we recovered */
2.10 frystyk 80: BOOL close_notification; /* Got a hint about close */
2.16 frystyk 81: BOOL broken_pipe;
2.1 frystyk 82:
83: /* Support for transports */
84: HTChannel * channel; /* data channel */
85:
86: /* Connection dependent stuff */
87: HTdns * dns; /* Link to DNS object */
88: TCPState tcpstate; /* State in connection */
2.14 frystyk 89: SockA sock_addr; /* SockA is defined in wwwsys.h */
2.1 frystyk 90: int retry; /* Counting attempts to connect */
91: int home; /* Current home if multiple */
2.7 frystyk 92: ms_t connecttime; /* Time in ms on multihomed hosts */
2.1 frystyk 93:
94: /* Event Management */
2.3 eric 95: HTEvent * events[HTEvent_TYPES];/* reading and writing may differ */
2.1 frystyk 96: HTEventType registeredFor; /* Which actions are we blocked on */
97: size_t remainingRead; /* Tells HostEvent to call next net */
98:
99: /* User specific stuff */
2.6 frystyk 100: ms_t delay; /* Write delay in ms */
2.1 frystyk 101: void * context; /* Protocol Specific context */
102: int forceWriteFlush;
2.19 ! kahan 103: int inFlush; /* Tells if we're currently processing
! 104: a file flush */
2.1 frystyk 105: };
106:
107: #define HTHost_bytesRead(me) ((me) ? (me)->bytes_read : -1)
108: #define HTHost_bytesWritten(me) ((me) ? (me)->bytes_written : -1)
109:
110: #define HTHost_setBytesRead(me,l) ((me) ? (me->bytes_read=(l)) : -1)
111: #define HTHost_setBytesWritten(me,l) ((me) ? (me->bytes_written=(l)) :-1)
112: #define HTHost_setDNS (host, dns) ((me) ? (me->dns=(dns)) :-1)
113: </PRE>
114: <PRE>
115: #endif /* HTHSTMAN_H */
116: </PRE>
117: <P>
118: <HR>
119: <ADDRESS>
2.19 ! kahan 120: @(#) $Id: HTHstMan.html,v 2.18 1999/07/07 15:43:28 frystyk Exp $
2.1 frystyk 121: </ADDRESS>
122: </BODY></HTML>
Webmaster