Annotation of libwww/Library/src/HTNetMan.html, revision 2.8
2.1 frystyk 1: <HTML>
2: <HEAD>
3: <TITLE>Asyncronous Socket Management</TITLE>
2.8 ! frystyk 4: <!-- Changed by: Henrik Frystyk Nielsen, 25-Jan-1996 -->
2.1 frystyk 5: </HEAD>
6: <BODY>
7:
8: <H1>Asyncronous Socket Management</H1>
9:
10: <PRE>
11: /*
12: ** (c) COPYRIGHT MIT 1995.
13: ** Please first read the full copyright statement in the file COPYRIGH.
14: */
15: </PRE>
16:
17: This module contains the routines for handling the set of active
18: sockets currently in use by the multithreaded clients. It is an
19: internal module to the Library, the application interface is
20: implemented in the <A HREF="HTEvntrg.html">Event Module</A>. Look for
21: more information in the <A
22: HREF="http://www.w3.org/pub/WWW/Library/User/Architecture/">
23: Multithread Specifications</A>. <P>
24:
25: This module is implemented by <A HREF="HTNet.c">HTNet.c</A>, and it is
26: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/">W3C
27: Reference Library</A>.
28:
29: <PRE>
30: #ifndef HTNETMAN_H
31: #define HTNETMAN_H
32: #include "HTNet.h"
33: #include "HTDNS.h"
34: #include "HTEvntrg.h"
35: #include "HTSocket.h"
36: </PRE>
37:
38: <H2>The HTNet Object</H2>
39:
40: The <CODE>HTNet</CODE> object is the core of the request queue
41: management. This object contains information about the socket
42: descriptor, the input read buffer etc. required to identify and
43: service a request. <P>
44:
45: <PRE>
2.2 frystyk 46: typedef enum _TCPState {
47: TCP_ERROR = -2,
48: TCP_CONNECTED = -1,
49: TCP_BEGIN = 0,
50: TCP_DNS,
51: TCP_NEED_SOCKET,
2.3 frystyk 52: TCP_NEED_BIND,
53: TCP_NEED_LISTEN,
54: TCP_NEED_CONNECT
2.2 frystyk 55: } TCPState;
56:
2.1 frystyk 57: struct _HTNet {
2.5 frystyk 58: SOCKET sockfd; /* Socket descripter */
2.1 frystyk 59: SockA sock_addr; /* SockA is defined in tcp.h */
2.2 frystyk 60: TCPState tcpstate; /* State in connection */
2.1 frystyk 61: HTInputSocket * isoc; /* Input buffer */
62: HTdns * dns; /* Entry in DNS table */
63: HTStream * target; /* Target stream */
64: int retry; /* Counting attempts to connect */
65: int home; /* Current home if multiple */
66: time_t connecttime; /* Used on multihomed hosts */
67: long bytes_read; /* Bytes read from network */
2.7 frystyk 68: long bytes_written; /* Bytes written to network */
69: BOOL preemptive; /* Eff result from Request and Protocol */
2.1 frystyk 70: HTPriority priority; /* Priority of this request (event) */
2.4 frystyk 71: HTEventCallback * cbf; /* Library load routine */
2.1 frystyk 72: HTRequest * request; /* Link back to request structure */
73: void * context; /* Protocol Specific context */
74: };
75:
2.7 frystyk 76: #define HTNet_bytesRead(me) ((me) ? (me)->bytes_read : -1)
77: #define HTNet_bytesWritten(me) ((me) ? (me)->bytes_written : -1)
78:
79: #define HTNet_setBytesRead(me,l) ((me) ? (me->bytes_read=(l)) : -1)
80: #define HTNet_setBytesWritten(me,l) ((me) ? (me->bytes_written=(l)) :-1)
81:
82: #define HTNet_dns(me) ((me) ? (me)->dns : NULL)
2.1 frystyk 83: </PRE>
84:
85: <PRE>
86: #endif /* HTNETMAN_H */
87: </PRE>
88:
89: End of declaration module
90: </BODY>
91: </HTML>
92:
93:
Webmaster