Annotation of libwww/Library/src/HTHstMan.html, revision 2.16

2.1       frystyk     1: <HTML>
                      2: <HEAD>
                      3: <!-- Changed by: Henrik Frystyk Nielsen, 19-May-1996 -->
2.9       frystyk     4:   <TITLE>W3C Sample Code Library libwww Private Hst Definition</TITLE>
2.1       frystyk     5: </HEAD>
                      6: <BODY>
                      7: <H1>
                      8:   Private Host Definition
                      9: </H1>
                     10: <PRE>
                     11: /*
                     12: **     (c) COPYRIGHT MIT 1995.
                     13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: <P>
                     17: This is the private definition of the Host Class. Please look in the public
                     18: <A HREF="HTHost.html">Host Class</A> for more documentation 
                     19: <P>
                     20: This module is implemented by <A HREF="HTHost.c">HTHost.c</A>, and it is a
2.15      frystyk    21: part of the <A HREF="http://www.w3.org/Library/">W3C Sample Code
2.1       frystyk    22: Library</A>.
                     23: <PRE>
                     24: #ifndef HTHSTMAN_H
                     25: #define HTHSTMAN_H
                     26: #include "HTHost.h"
                     27: #include "HTDNS.h"
                     28: #include "HTEvent.h"
                     29: #include "HTProt.h"
                     30: 
                     31: #define PIPE_BUFFER_SIZE       8192
                     32: </PRE>
                     33: <P>
                     34: The <CODE>HTHost</CODE> object is the core of the request queue management.
                     35: This object contains information about the socket descriptor, the input read
                     36: buffer etc. required to identify and service a request.
                     37: <PRE>
                     38: typedef enum _TCPState {
                     39:     TCP_ERROR          = -2,
                     40:     TCP_CONNECTED      = -1,
                     41:     TCP_BEGIN          = 0,
                     42:     TCP_CHANNEL,
                     43:     TCP_DNS,
                     44:     TCP_NEED_SOCKET,
                     45:     TCP_NEED_BIND,
                     46:     TCP_NEED_LISTEN,
2.4       eric       47:     TCP_NEED_CONNECT,
                     48:     TCP_IN_USE
2.1       frystyk    49: } TCPState;
                     50: 
                     51: struct _HTHost {
                     52:     int                 hash;
                     53: 
                     54:     /* Information about the otherend */
                     55:     char *             hostname;            /* name of host + optional port */
2.2       eric       56:     u_short            u_port;
2.1       frystyk    57:     time_t             ntime;                              /* Creation time */
                     58:     char *             type;                                   /* Peer type */
                     59:     int                version;                             /* Peer version */
                     60:     HTMethod           methods;                /* Public methods (bit-flag) */
                     61:     char *             server;                               /* Server name */
                     62:     char *             user_agent;                            /* User Agent */
                     63:     char *             range_units;                                  /* ??? */
                     64: 
                     65:     /* When does this entry expire? */
                     66:     time_t             expires;          /* Persistent channel expires time */
2.4       eric       67:     int                        reqsPerConnection;        /* from Keep-Alive: header */
                     68:     int                        reqsMade;                /* updated as they are sent */
2.1       frystyk    69: 
                     70:     /* Queuing and connection modes */
                     71:     HTList *           pipeline;                /* Pipe line of net objects */
                     72:     HTList *           pending;              /* List of pending Net objects */
2.11      frystyk    73:     HTNet *             doit;               /* Transfer from pending to pipe */ 
2.13      frystyk    74:     HTNet *             lock;             /* This is a kludge! */
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;
                    103: };
                    104: 
                    105: #define HTHost_bytesRead(me)           ((me) ? (me)-&gt;bytes_read : -1)
                    106: #define HTHost_bytesWritten(me)                ((me) ? (me)-&gt;bytes_written : -1)
                    107: 
                    108: #define HTHost_setBytesRead(me,l)      ((me) ? (me-&gt;bytes_read=(l)) : -1)
                    109: #define HTHost_setBytesWritten(me,l)   ((me) ? (me-&gt;bytes_written=(l)) :-1)
                    110: #define HTHost_setDNS (host, dns)      ((me) ? (me-&gt;dns=(dns)) :-1)
                    111: </PRE>
                    112: 
                    113: <PRE>
                    114: #endif /* HTHSTMAN_H */
                    115: </PRE>
                    116: <P>
                    117:   <HR>
                    118: <ADDRESS>
2.16    ! frystyk   119:   @(#) $Id: HTHstMan.html,v 2.15 1998/05/14 02:10:34 frystyk Exp $
2.1       frystyk   120: </ADDRESS>
                    121: </BODY></HTML>

Webmaster