1 /* 2 3 4 W3C Sample Code Library libwww Private Net Definition 5 6 7 ! 8 Private Net Definition 9 ! 10 */ 11 12 /* 13 ** (c) COPYRIGHT MIT 1995. 14 ** Please first read the full copyright statement in the file COPYRIGH. 15 */ 16 17 /* 18 19 This is the private definition of the Net Class. Please look in the public 20 Net Class for more documentation 21 22 This module is implemented by HTNet.c, and it is a 23 part of the W3C Sample Code Library. 24 */ 25 26 #ifndef HTNETMAN_H 27 #define HTNETMAN_H 28 #include "HTNet.h" 29 #include "HTDNS.h" 30 #include "HTEvent.h" 31 #include "HTProt.h" 32 33 #ifdef __cplusplus 34 extern "C" { 35 #endif 36 37 /* 38 39 The HTNet object is the core of the request queue management. 40 This object contains information about the socket descriptor, the input read 41 buffer etc. required to identify and service a request. 42 */ 43 44 struct _HTNet { 45 int hash; /* Hash value */ 46 47 /* Link to other objects */ 48 HTRequest * request; /* Link to request object */ 49 HTHost * host; /* What we know about the remote host */ 50 HTProtocol * protocol; /* Protocol to this request */ 51 HTTransport * transport; /* Transport for this request */ 52 int session; 53 54 /* For progress notifications */ 55 BOOL countRawBytes; /* If we should count raw bytes */ 56 long bytesRead; /* Bytes in body */ 57 long headerBytesRead; /* Bytes read in header */ 58 long bytesWritten; /* Bytes written to network */ 59 long headerBytesWritten; /* Bytes written in header */ 60 61 #if 0 62 int retry; /* Counting attempts to connect */ 63 int home; /* Current home if multiple */ 64 #endif 65 66 time_t connecttime; /* Used on multihomed hosts */ 67 BOOL preemptive; /* Eff result from Request and Protocol */ 68 69 HTEvent event; 70 HTStream * readStream; /* host's input stream puts data here */ 71 72 /* User specific stuff */ 73 void * context; /* Protocol Specific context */ 74 75 /* Eric's sleezoid cheat - should go to extra pipeline object */ 76 HTEventType registeredFor; 77 }; 78 79 extern SOCKET HTNet_socket(HTNet * me); 80 81 82 /* 83 . 84 Bytes Read Stats 85 . 86 ( 87 Total Bytes Read 88 ) 89 */ 90 91 #define HTNet_setBytesRead(me,l) ((me) ? (me->bytesRead=(l)) : -1) 92 #define HTNet_bytesRead(me) ((me) ? (me)->bytesRead : -1) 93 #define HTNet_addBytesRead(me,l) ((me) ? (me->bytesRead+=(l)) : -1) 94 95 /* 96 ( 97 Header Bytes Read 98 ) 99 */ 100 101 #define HTNet_setHeaderBytesRead(me,l) ((me) ? (me->headerBytesRead=(l)) :-1) 102 #define HTNet_headerBytesRead(me) ((me) ? (me)->headerBytesRead : -1) 103 #define HTNet_addHeaderBytesRead(me,l) ((me) ? (me->headerBytesRead+=(l)) : -1) 104 105 /* 106 . 107 Bytes Written Stats 108 . 109 ( 110 Total Bytes Written 111 ) 112 */ 113 114 #define HTNet_setBytesWritten(me,l) ((me) ? (me->bytesWritten=(l)) :-1) 115 #define HTNet_bytesWritten(me) ((me) ? (me)->bytesWritten : -1) 116 #define HTNet_addBytesWritten(me,l) ((me) ? (me->bytesWritten+=(l)) : -1) 117 118 /* 119 ( 120 Header Bytes Written 121 ) 122 */ 123 124 #define HTNet_setHeaderBytesWritten(me,l) ((me) ? (me->headerBytesWritten=(l)) :-1) 125 #define HTNet_headerBytesWritten(me) ((me) ? \ 126 ((me)->headerBytesWritten==0 ? \ 127 HTNet_bytesWritten(me) : \ 128 (me)->headerBytesWritten) : -1) 129 #define HTNet_addHeaderBytesWritten(me,l) ((me) ? (me->headerBytesWritten+=(l)) : -1) 130 131 /* 132 . 133 Event Callbacks 134 . 135 */ 136 137 extern BOOL HTNet_setEventParam(HTNet * net, void * eventParam); 138 extern void* HTNet_eventParam(HTNet * net); 139 extern BOOL HTNet_setEventCallback(HTNet * net, HTEventCallback * cbf); 140 extern HTEventCallback * HTNet_eventCallback(HTNet * net); 141 extern BOOL HTNet_setEventPriority(HTNet * net, HTPriority priority); 142 extern HTPriority HTNet_eventPriority(HTNet * net); 143 144 /* 145 */ 146 147 #ifdef __cplusplus 148 } 149 #endif 150 151 #endif /* HTNETMAN_H */ 152 153 /* 154 155 156 157 @(#) $Id$ 158 159 */ 160