Annotation of libwww/Library/src/HTHstMan.html, revision 2.20
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:
2.20 ! vbancrof 29: #ifdef __cplusplus
! 30: extern "C" {
! 31: #endif
! 32:
2.1 frystyk 33: #define PIPE_BUFFER_SIZE 8192
34: </PRE>
35: <P>
36: The <CODE>HTHost</CODE> object is the core of the request queue management.
37: This object contains information about the socket descriptor, the input read
38: buffer etc. required to identify and service a request.
39: <PRE>
40: typedef enum _TCPState {
2.17 frystyk 41: TCP_DNS_ERROR = -3,
2.1 frystyk 42: TCP_ERROR = -2,
43: TCP_CONNECTED = -1,
44: TCP_BEGIN = 0,
45: TCP_CHANNEL,
46: TCP_DNS,
47: TCP_NEED_SOCKET,
48: TCP_NEED_BIND,
49: TCP_NEED_LISTEN,
2.4 eric 50: TCP_NEED_CONNECT,
51: TCP_IN_USE
2.1 frystyk 52: } TCPState;
53:
54: struct _HTHost {
55: int hash;
56:
57: /* Information about the otherend */
58: char * hostname; /* name of host + optional port */
2.2 eric 59: u_short u_port;
2.1 frystyk 60: time_t ntime; /* Creation time */
61: char * type; /* Peer type */
62: int version; /* Peer version */
63: HTMethod methods; /* Public methods (bit-flag) */
64: char * server; /* Server name */
65: char * user_agent; /* User Agent */
66: char * range_units; /* ??? */
67:
68: /* When does this entry expire? */
69: time_t expires; /* Persistent channel expires time */
2.4 eric 70: int reqsPerConnection; /* from Keep-Alive: header */
71: int reqsMade; /* updated as they are sent */
2.1 frystyk 72:
73: /* Queuing and connection modes */
74: HTList * pipeline; /* Pipe line of net objects */
75: HTList * pending; /* List of pending Net objects */
2.11 frystyk 76: HTNet * doit; /* Transfer from pending to pipe */
2.13 frystyk 77: HTNet * lock; /* This is a kludge! */
2.18 frystyk 78: HTNet * listening; /* Master for accepting connections */
2.1 frystyk 79: BOOL persistent;
80: HTTransportMode mode; /* Supported mode */
2.12 frystyk 81: HTTimer * timer; /* Timer for handling idle connection */
82: BOOL do_recover; /* If we are supposed to recover */
2.5 frystyk 83: int recovered; /* How many times had we recovered */
2.10 frystyk 84: BOOL close_notification; /* Got a hint about close */
2.16 frystyk 85: BOOL broken_pipe;
2.1 frystyk 86:
87: /* Support for transports */
88: HTChannel * channel; /* data channel */
89:
90: /* Connection dependent stuff */
91: HTdns * dns; /* Link to DNS object */
92: TCPState tcpstate; /* State in connection */
2.14 frystyk 93: SockA sock_addr; /* SockA is defined in wwwsys.h */
2.1 frystyk 94: int retry; /* Counting attempts to connect */
95: int home; /* Current home if multiple */
2.7 frystyk 96: ms_t connecttime; /* Time in ms on multihomed hosts */
2.1 frystyk 97:
98: /* Event Management */
2.3 eric 99: HTEvent * events[HTEvent_TYPES];/* reading and writing may differ */
2.1 frystyk 100: HTEventType registeredFor; /* Which actions are we blocked on */
101: size_t remainingRead; /* Tells HostEvent to call next net */
102:
103: /* User specific stuff */
2.6 frystyk 104: ms_t delay; /* Write delay in ms */
2.1 frystyk 105: void * context; /* Protocol Specific context */
106: int forceWriteFlush;
2.19 kahan 107: int inFlush; /* Tells if we're currently processing
108: a file flush */
2.1 frystyk 109: };
110:
111: #define HTHost_bytesRead(me) ((me) ? (me)->bytes_read : -1)
112: #define HTHost_bytesWritten(me) ((me) ? (me)->bytes_written : -1)
113:
114: #define HTHost_setBytesRead(me,l) ((me) ? (me->bytes_read=(l)) : -1)
115: #define HTHost_setBytesWritten(me,l) ((me) ? (me->bytes_written=(l)) :-1)
116: #define HTHost_setDNS (host, dns) ((me) ? (me->dns=(dns)) :-1)
117: </PRE>
118: <PRE>
2.20 ! vbancrof 119: #ifdef __cplusplus
! 120: }
! 121: #endif
! 122:
2.1 frystyk 123: #endif /* HTHSTMAN_H */
124: </PRE>
125: <P>
126: <HR>
127: <ADDRESS>
2.20 ! vbancrof 128: @(#) $Id: HTHstMan.html,v 2.19 2000/07/28 13:52:23 kahan Exp $
2.1 frystyk 129: </ADDRESS>
130: </BODY></HTML>
Webmaster