1 /****************************************************************************
2 *																			*
3 *						Internal STREAM Header File							*
4 *					  Copyright Peter Gutmann 1993-2011						*
5 *																			*
6 ****************************************************************************/
7 
8 #ifndef _STREAM_INT_DEFINED
9 
10 #define _STREAM_INT_DEFINED
11 
12 #if defined( INC_ALL )
13   #include "stream.h"
14 #else
15   #include "io/stream.h"
16 #endif /* Compiler-specific includes */
17 
18 /****************************************************************************
19 *																			*
20 *								Stream Constants							*
21 *																			*
22 ****************************************************************************/
23 
24 /* The stream types */
25 
26 typedef enum {
27 	STREAM_TYPE_NONE,					/* No stream type */
28 	STREAM_TYPE_NULL,					/* Null stream (/dev/nul) */
29 	STREAM_TYPE_MEMORY,					/* Memory stream */
30 	STREAM_TYPE_FILE,					/* File stream */
31 	STREAM_TYPE_NETWORK,				/* Network stream */
32 	STREAM_TYPE_LAST					/* Last possible stream type */
33 	} STREAM_TYPE;
34 
35 /* General-purpose stream flags.  These are:
36 
37 	FLAG_DIRTY: Stream buffer contains data that needs to be committed to
38 		backing store.
39 
40 	FLAG_PARTIALREAD: Used for network reads to handle timeouts and for file
41 		streams when we don't know the full extent of a file stream.  When
42 		this is set and we ask for a read of n bytes and there isn't
43 		sufficient data present in the file to satisfy the request the
44 		stream code returns 0...n bytes rather than an underflow error.
45 
46 	FLAG_PARTIALWRITE: Used for network streams when performing bulk data
47 		transfers, in this case the write may time out and can be restarted
48 		later rather than returning a timeout error.
49 
50 	FLAG_READONLY: Stream is read-only */
51 
52 #define STREAM_FLAG_NONE		0x0000	/* No stream flag */
53 #define STREAM_FLAG_READONLY	0x0001	/* Read-only stream */
54 #define STREAM_FLAG_PARTIALREAD 0x0002	/* Allow read of less than req.amount */
55 #define STREAM_FLAG_PARTIALWRITE 0x0004	/* Allow write of less than req.amount */
56 #define STREAM_FLAG_DIRTY		0x0008	/* Stream contains un-committed data */
57 #define STREAM_FLAG_MASK		0x000F	/* Mask for general-purpose flags */
58 
59 /* Memory stream flags.  These are:
60 
61 	MFLAG_PSEUDO/PSEUDO_HTTP/PSEUDO_DIRECT: Used for memory streams
62 		emulating some other stream type, writes are discarded and reads
63 		come from the stream buffer.  The HTTP flag is an additional
64 		modifier to the standard pseudo-stream indicating that it's an
65 		HTTP-style read, and the RAW flag is an indicator that the HTTP
66 		stream should read the normally out-of-band header (i.e. the HTTP
67 		wrapper for an encapsulated data type) as well as the actualy data.
68 		These are only available in debug builds since they're used for
69 		testing purposes.
70 
71 	MFLAG_VFILE: The underlying OS doesn't support conventional file I/O (it
72 		may only support, for example, access to fixed blocks of flash
73 		memory) so this is a memory stream emulating a file stream */
74 
75 #define STREAM_MFLAG_VFILE		0x0020	/* File stream emulated via mem.stream */
76 #ifndef NDEBUG
77   #define STREAM_MFLAG_PSEUDO	0x0040	/* Stream is pseudo-stream */
78   #define STREAM_MFLAG_PSEUDO_HTTP 0x0080	/* Stream is HTTP pseudo-stream */
79   #define STREAM_MFLAG_PSEUDO_RAW 0x0100	/* Stream reads raw data */
80   #define STREAM_MFLAG_MASK		( 0x01E0 | STREAM_FLAG_MASK )
81 										/* Mask for memory-only flags */
82 #else
83   #define STREAM_MFLAG_MASK		( 0x0020 | STREAM_FLAG_MASK )
84 										/* Mask for memory-only flags */
85 #endif /* !NDEBUG */
86 
87 /* File stream flags.  These are:
88 
89 	FFLAG_BUFFERSET: Used to indicate that the stream has an I/O buffer
90 		associated with it.  A stream can be opened without a buffer, but to
91 		read/write data it needs to have a buffer associated with it.  Since
92 		this can be of variable size and sometimes isn't required at all,
93 		it's created on-demand rather than always being present, and its
94 		presence is indicated by this flag.
95 
96 	FFLAG_EOF: The underlying file has reached EOF, no further data can be
97 		read once the current buffer is emptied.
98 
99 	FFLAG_MMAPPED: This is a memory-mapped file stream, used in conjunction
100 		with MFLAG_VFILE virtual file streams.
101 
102 	FFLAG_POSCHANGED: The position in the underlying file has changed,
103 		requiring the file buffer to be refilled from the new position
104 		before data can be read from it */
105 
106 #define STREAM_FFLAG_BUFFERSET	0x0080	/* Stream has associated buffer */
107 #define STREAM_FFLAG_EOF		0x0100	/* EOF reached on stream */
108 #define STREAM_FFLAG_POSCHANGED	0x0200	/* File stream position has changed */
109 #define STREAM_FFLAG_POSCHANGED_NOSKIP 0x0400	/* New stream pos.is in following block */
110 #define STREAM_FFLAG_MMAPPED	0x0800	/* File stream is memory-mapped */
111 #define STREAM_FFLAG_MASK		( 0x0F80 | STREAM_FLAG_MASK )
112 										/* Mask for file-only flags */
113 
114 /* Network stream flags.  Since there are quite a number of these and they're
115    only required for the network-specific stream functionality, we give them
116    their own flags variable instead of using the overall stream flags.  These
117    are:
118 
119 	NFLAG_DGRAM: The stream is run over UDP rather than the default TCP.
120 
121 	NFLAG_ENCAPS: The protocol is running over a lower encapsulation layer
122 		that provides additional packet control information, typically
123 		packet size and flow control information.  If this flag is set then
124 		the lower-level read code overrides some error handling that
125 		normally takes place at a higher level.  For example if a read of n
126 		bytes is requested and the encapsulation layer reports that only m
127 		bytes, m < n is present, this isn't treated as a read/timeout error.
128 
129 	NFLAG_FIRSTREADOK: The first data read from the stream succeeded.  This
130 		is used to detect problems due to buggy firewall software, see the
131 		comments in io/tcp.c for details.
132 
133 	NFLAG_HTTP10: This is an HTTP 1.0 (rather than 1.1) HTTP stream.
134 
135 	NFLAG_HTTPPROXY/NFLAG_HTTPTUNNEL: HTTP proxy control flags.  When the
136 		proxy flag is set, HTTP requests are sent as
137 		"GET http://destination-url/location" (sent to the proxy) rather
138 		than "GET location" (sent directly to the target host).  When the
139 		tunnel flag is set, the initial network connection-establishment
140 		request is sent as an explicit proxy command "CONNECT fqdn:port",
141 		after which normal PDUs for the protocol being tunneled are sent.
142 
143 		Note that the HTTP tunnel flag is currently never set by anything
144 		due to the removal of the SESSION_USEHTTPTUNNEL flag at a higher
145 		level, which was only ever set implicitly by being set in the
146 		SSL/TLS altProtocolInfo, which in turn was never selected outside
147 		a USE_CMP_TRANSPORT block.  The location at which it would be
148 		selected (except for the presence of a USE_CMP_TRANSPORT ifdef) is
149 		at line 195 of session/sess_attr.c in versions up to 3.4.1.
150 
151 	NFLAG_HTTPGET/NFLAG_HTTPPOST: HTTP allowed-actions flags.
152 
153 	NFLAG_HTTPPOST_AS_GET: Modify the POST to encode it as a GET (ugh), for
154 		b0rken servers that don't do POST.
155 
156 	NFLAG_ISSERVER: The stream is a server stream (default is client).
157 
158 	NFLAG_LASTMSGR/NFLAG_LASTMSGR: This is the last message in the exchange.
159 		For a last-message read it means that the other side has indicated
160 		(for example through an HTTP "Connection: close") that this is the
161 		case.  For a last-message write it means that we should indicate to
162 		the other side (for example through an HTTP "Connection: close")
163 		that this is the case.
164 
165 	NFLAG_USERSOCKET: The network socket was supplied by the user rather
166 		than being created by cryptlib, so some actions such as socket
167 		shutdown should be skipped */
168 
169 #define STREAM_NFLAG_ISSERVER	0x0001	/* Stream is server rather than client */
170 #define STREAM_NFLAG_USERSOCKET	0x0002	/* Network socket was supplied by user */
171 #define STREAM_NFLAG_DGRAM		0x0004	/* Stream is UDP rather than TCP */
172 #define STREAM_NFLAG_HTTP10		0x0008	/* HTTP 1.0 stream */
173 #define STREAM_NFLAG_HTTPPROXY	0x0010	/* Use HTTP proxy format for requests */
174 #define STREAM_NFLAG_HTTPTUNNEL	0x0020	/* Use HTTP proxy tunnel for connect */
175 #define STREAM_NFLAG_HTTPGET	0x0040	/* Allow HTTP GET */
176 #define STREAM_NFLAG_HTTPPOST	0x0080	/* Allow HTTP POST */
177 #define STREAM_NFLAG_HTTPPOST_AS_GET 0x0100	/* Implement POST as GET */
178 #define STREAM_NFLAG_LASTMSGR	0x0200	/* Last message in exchange */
179 #define STREAM_NFLAG_LASTMSGW	0x0400	/* Last message in exchange */
180 #define STREAM_NFLAG_ENCAPS		0x0800	/* Network transport is encapsulated */
181 #define STREAM_NFLAG_FIRSTREADOK 0x1000	/* First data read succeeded */
182 #define STREAM_NFLAG_HTTPREQMASK ( STREAM_NFLAG_HTTPGET | STREAM_NFLAG_HTTPPOST | \
183 								   STREAM_NFLAG_HTTPPOST_AS_GET )
184 										/* Mask for permitted HTTP req.types */
185 
186 /* Network transport-specific flags.  These are:
187 
188 	FLAG_FLUSH: Used in writes to buffered streams to force a flush of data in
189 		the stream buffers.
190 
191 	FLAG_BLOCKING/FLAG_NONBLOCKING: Used to override the stream default
192 		behaviour on reads and writes and force blocking/nonblocking I/O */
193 
194 #define TRANSPORT_FLAG_NONE		0x00	/* No transport flag */
195 #define TRANSPORT_FLAG_FLUSH	0x01	/* Flush data on write */
196 #define TRANSPORT_FLAG_NONBLOCKING 0x02	/* Explicitly perform nonblocking read */
197 #define TRANSPORT_FLAG_BLOCKING	0x04	/* Explicitly perform blocking read */
198 #define TRANSPORT_FLAG_MAX		0x07	/* Maximum possible flag value */
199 
200 /* The size of the memory buffer used for virtual file streams, which are
201    used in CONFIG_NO_STDIO environments to store data before it's committed
202    to backing storage */
203 
204 #if defined( __MVS__ ) || defined( __VMCMS__ ) || \
205 	defined( __IBM4758__ ) || defined( __TESTIO__ )
206   #define VIRTUAL_FILE_STREAM
207 #endif /* Nonstandard I/O environments */
208 
209 #define STREAM_VFILE_BUFSIZE	16384
210 
211 /****************************************************************************
212 *																			*
213 *								Stream Structures							*
214 *																			*
215 ****************************************************************************/
216 
217 #ifdef USE_TCP
218 
219 /* The network-stream specific information stored as part of the STREAM
220    data type */
221 
222 struct NS;
223 
224 typedef CHECK_RETVAL_BOOL STDC_NONNULL_ARG( ( 1 ) ) \
225 		BOOLEAN ( *STM_SANITYCHECK_FUNCTION )( IN const struct ST *stream );
226 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
227 		int ( *STM_READ_FUNCTION )( INOUT struct ST *stream,
228 									OUT_BUFFER( maxLength, *length ) \
229 										void *buffer,
230 									IN_DATALENGTH const int maxLength,
231 									OUT_DATALENGTH_Z int *length );
232 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
233 		int ( *STM_WRITE_FUNCTION )( INOUT struct ST *stream,
234 									 IN_BUFFER( maxLength ) \
235 										const void *buffer,
236 									 IN_DATALENGTH const int maxLength,
237 									 OUT_DATALENGTH_Z int *length );
238 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2 ) ) \
239 		int ( *STM_TRANSPORTCONNECT_FUNCTION )( INOUT struct NS *netStream,
240 												IN_BUFFER_OPT( hostNameLen ) \
241 													const char *hostName,
242 												IN_LENGTH_DNS_Z \
243 													const int hostNameLen,
244 												IN_PORT const int port );
245 typedef STDC_NONNULL_ARG( ( 1 ) ) \
246 		void ( *STM_TRANSPORTDISCONNECT_FUNCTION )( INOUT struct NS *netStream,
247 													const BOOLEAN fullDisconnect );
248 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
249 		int ( *STM_TRANSPORTREAD_FUNCTION )( INOUT struct ST *stream,
250 											 OUT_BUFFER( maxLength, *length ) \
251 												BYTE *buffer,
252 											 IN_DATALENGTH const int maxLength,
253 											 OUT_DATALENGTH_Z int *length,
254 											 IN_FLAGS_Z( TRANSPORT ) \
255 												const int flags );
256 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
257 		int ( *STM_TRANSPORTWRITE_FUNCTION )( INOUT struct ST *stream,
258 											  IN_BUFFER( maxLength ) \
259 												const BYTE *buffer,
260 											  IN_DATALENGTH const int maxLength,
261 											  OUT_DATALENGTH_Z int *length,
262 											  IN_FLAGS_Z( TRANSPORT ) \
263 												const int flags );
264 typedef CHECK_RETVAL_BOOL \
265 		BOOLEAN ( *STM_TRANSPORTOK_FUNCTION )( void );
266 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1 ) ) \
267 		int ( *STM_TRANSPORTCHECK_FUNCTION )( INOUT struct NS *netStream );
268 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
269 		int ( *STM_BUFFEREDTRANSPORTREAD_FUNCTION )( INOUT struct ST *stream,
270 													 OUT_BUFFER( maxLength, *length ) \
271 														BYTE *buffer,
272 													 IN_DATALENGTH \
273 														const int maxLength,
274 													 OUT_DATALENGTH_Z int *length,
275 													 IN_FLAGS_Z( TRANSPORT ) \
276 														const int flags );
277 typedef CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
278 		int ( *STM_BUFFEREDTRANSPORTWRITE_FUNCTION )( INOUT struct ST *stream,
279 													  IN_BUFFER( maxLength ) \
280 														const BYTE *buffer,
281 													  IN_DATALENGTH \
282 														const int maxLength,
283 													  OUT_DATALENGTH_Z int *length,
284 													  IN_FLAGS_Z( TRANSPORT ) \
285 														const int flags );
286 
287 typedef struct NS {
288 	/* General information for the network stream.  For a server the
289 	   listenSocket is the (possibly shared) common socket that the server
290 	   is listening on, the netSocket is the ephemeral socket used for
291 	   communications */
292 	STREAM_PROTOCOL_TYPE protocol;/* Network protocol type */
293 	int nFlags;					/* Network-specific flags */
294 	int netSocket, listenSocket;/* Network socket */
295 	CRYPT_SESSION iTransportSession;/* cryptlib session as transport layer */
296 
297 	/* Network timeout information.  The timeout value depends on whether
298 	   the stream is in the connect/handshake phase or the data transfer
299 	   phase.  The handshake phase is logically treated as part of the
300 	   connect phase even though from the stream point of view it's part of
301 	   the data transfer phase.  Initially the stream timeout is set to the
302 	   connect timeout and the saved timeout is set to the data transfer
303 	   timeout.  Once the connect/handshake has completed, the stream
304 	   timeout is set to the saved data transfer timeout and the saved
305 	   timeout is cleared */
306 	int timeout, savedTimeout;	/* Network comms timeout */
307 
308 	/* Network streams require separate read/write buffers for packet
309 	   assembly/disassembly so we provide a write buffer alongside the
310 	   generic stream read buffer */
311 	BUFFER( writeBufSize, writeBufEnd ) \
312 	BYTE *writeBuffer;			/* Write buffer */
313 	int writeBufSize;			/* Total size of buffer */
314 	int writeBufEnd;			/* Last buffer position with valid data */
315 
316 	/* General network-related information.  The server FQDN is held in
317 	   dynamically-allocated storage, the optional path for HTTP is a pointer
318 	   into the host string at the appropriate location */
319 	BUFFER_FIXED( hostLen ) \
320 	char *host;
321 	int hostLen;
322 	BUFFER_OPT_FIXED( pathLen ) \
323 	char *path;
324 	int pathLen;
325 	int port;					/* Host name, path on host, and port */
326 	BUFFER( CRYPT_MAX_TEXTSIZE / 2, clientAddressLen ) \
327 	char clientAddress[ ( CRYPT_MAX_TEXTSIZE / 2 ) + 4 ];
328 	int clientAddressLen;		/* Client IP address (dotted-decimal) */
329 	int clientPort;				/* Client port */
330 
331 	/* Sometimes we can fingerprint the application running on the peer
332 	   system, which is useful for working around buggy implementations.
333 	   The following value stores the peer application type, if known */
334 	STREAM_PEER_TYPE systemType;
335 
336 	/* If a network error condition is fatal we set the persistentStatus
337 	   value.  This is checked by the higher-level stream code and copied
338 	   to to stream persistent status if required */
339 	int persistentStatus;
340 
341 	/* Last-error information returned from lower-level code */
342 	ERROR_INFO errorInfo;
343 
344 	/* Network stream access functions.  The general read and write
345 	   functions are for the higher-level network access routines such as
346 	   HTTP and CMP I/O, the transport I/O functions are for transport-level
347 	   I/O that sits below the general I/O.  Finally, there's an
348 	   intermediate function that adds speculative read-ahead buffering to
349 	   the transport-level read to improve performance for higher-level
350 	   protocols like HTTP that have to read a byte at a time in some
351 	   places */
352 	FNPTR_DECLARE( STM_SANITYCHECK_FUNCTION, sanityCheckFunction );
353 	FNPTR_DECLARE( STM_READ_FUNCTION, readFunction );
354 	FNPTR_DECLARE( STM_WRITE_FUNCTION, writeFunction );
355 	FNPTR_DECLARE( STM_TRANSPORTCONNECT_FUNCTION, transportConnectFunction );
356 	FNPTR_DECLARE( STM_TRANSPORTDISCONNECT_FUNCTION, transportDisconnectFunction );
357 	FNPTR_DECLARE( STM_TRANSPORTREAD_FUNCTION, transportReadFunction );
358 	FNPTR_DECLARE( STM_TRANSPORTWRITE_FUNCTION, transportWriteFunction );
359 	FNPTR_DECLARE( STM_TRANSPORTOK_FUNCTION, transportOKFunction );
360 	FNPTR_DECLARE( STM_TRANSPORTCHECK_FUNCTION, transportCheckFunction );
361 	FNPTR_DECLARE( STM_BUFFEREDTRANSPORTREAD_FUNCTION, bufferedTransportReadFunction );
362 	FNPTR_DECLARE( STM_BUFFEREDTRANSPORTWRITE_FUNCTION, bufferedTransportWriteFunction );
363 
364 	/* Variable-length storage for the stream buffers */
365 	DECLARE_VARSTRUCT_VARS;
366 	} NET_STREAM_INFO;
367 #else
368 
369 typedef void *NET_STREAM_INFO;	/* Dummy for function prototypes */
370 
371 #endif /* USE_TCP */
372 
373 /****************************************************************************
374 *																			*
375 *							Stream Function Prototypes						*
376 *																			*
377 ****************************************************************************/
378 
379 /* Stream query functions to determine whether a stream is a memory-mapped
380    file stream, a virtual file stream, or a pseudo-stream.  The memory-
381    mapped stream check is used when we can eliminate extra buffer allocation
382    if all data is available in memory.  The virtual file stream check is
383    used where the low-level access routines have converted a file on a
384    CONFIG_NO_STDIO system to a memory stream that acts like a file stream.
385    The pseudo-stream is used for testing purposes to emulate a standard
386    stream like a network stream */
387 
388 #define sIsMemMappedStream( stream ) \
389 		( ( ( stream )->type == STREAM_TYPE_FILE ) && \
390 		  ( ( stream )->flags & STREAM_FFLAG_MMAPPED ) )
391 #ifdef VIRTUAL_FILE_STREAM
392   #define sIsVirtualFileStream( stream ) \
393 		  ( ( ( stream )->type == STREAM_TYPE_MEMORY ) && \
394 			( ( stream )->flags & STREAM_MFLAG_VFILE ) )
395 #else
396   #define sIsVirtualFileStream( stream )	FALSE
397 #endif /* VIRTUAL_FILE_STREAM */
398 #ifndef NDEBUG
399   #define sIsPseudoStream( stream ) \
400 		  ( ( ( stream )->type == STREAM_TYPE_MEMORY ) && \
401 			( ( stream )->flags & STREAM_MFLAG_PSEUDO ) )
402   #define sIsPseudoHTTPStream( stream ) \
403 		  ( ( ( stream )->type == STREAM_TYPE_MEMORY ) && \
404 			( ( stream )->flags & STREAM_MFLAG_PSEUDO_HTTP ) )
405   #define sIsPseudoHTTPRawStream( stream ) \
406 		  ( ( ( stream )->type == STREAM_TYPE_MEMORY ) && \
407 			( ( ( stream )->flags & \
408 				( STREAM_MFLAG_PSEUDO_HTTP | STREAM_MFLAG_PSEUDO_RAW ) ) == \
409 				( STREAM_MFLAG_PSEUDO_HTTP | STREAM_MFLAG_PSEUDO_RAW ) ) )
410 #endif /* !NDEBUG */
411 
412 /* Prototypes for functions in file.c */
413 
414 #ifdef USE_FILES
415 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4 ) ) \
416 int fileRead( INOUT STREAM *stream,
417 			  OUT_BUFFER( length, *bytesRead ) void *buffer,
418 			  IN_DATALENGTH const int length,
419 			  OUT_DATALENGTH_Z int *bytesRead );
420 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2 ) ) \
421 int fileWrite( INOUT STREAM *stream,
422 			   IN_BUFFER( length ) const void *buffer,
423 			   IN_DATALENGTH const int length );
424 CHECK_RETVAL STDC_NONNULL_ARG( ( 1 ) ) \
425 int fileFlush( INOUT STREAM *stream );
426 CHECK_RETVAL STDC_NONNULL_ARG( ( 1 ) ) \
427 int fileSeek( INOUT STREAM *stream,
428 			  IN_DATALENGTH_Z const long position );
429 #endif /* USE_FILES */
430 
431 /* Network URL processing functions in net_url.c */
432 
433 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2 ) ) \
434 int parseURL( OUT URL_INFO *urlInfo,
435 			  IN_BUFFER( urlLen ) const BYTE *url,
436 			  IN_LENGTH_SHORT const int urlLen,
437 			  IN_PORT_OPT const int defaultPort,
438 			  IN_ENUM_OPT( URL_TYPE ) const URL_TYPE urlTypeHint,
439 			  const BOOLEAN preParseOnly );
440 
441 /* Network proxy functions in net_proxy.c */
442 
443 CHECK_RETVAL STDC_NONNULL_ARG( ( 1 ) ) \
444 int connectViaSocksProxy( INOUT STREAM *stream );
445 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2 ) ) \
446 int connectViaHttpProxy( INOUT STREAM *stream,
447 						 INOUT ERROR_INFO *errorInfo );
448 #if defined( __WIN32__ )
449 CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 3, 4 ) ) \
450   int findProxyUrl( OUT_BUFFER( proxyMaxLen, *proxyLen ) char *proxy,
451 					IN_LENGTH_DNS const int proxyMaxLen,
452 					OUT_LENGTH_BOUNDED_Z( proxyMaxLen ) int *proxyLen,
453 					IN_BUFFER( urlLen ) const char *url,
454 					IN_LENGTH_DNS const int urlLen );
455 #else
456   #define findProxyUrl( proxy, proxyMaxLen, proxyLen, url, urlLen )	CRYPT_ERROR_NOTFOUND
457 #endif /* Win32 */
458 
459 /* Network access mapping functions */
460 
461 STDC_NONNULL_ARG( ( 1 ) ) \
462 void setAccessMethodTCP( INOUT NET_STREAM_INFO *netStream );
463 STDC_NONNULL_ARG( ( 1 ) ) \
464 void setStreamLayerHTTP( INOUT NET_STREAM_INFO *netStream );
465 STDC_NONNULL_ARG( ( 1 ) ) \
466 void setStreamLayerCMP( INOUT NET_STREAM_INFO *netStream );
467 STDC_NONNULL_ARG( ( 1 ) ) \
468 void setStreamLayerDirect( INOUT NET_STREAM_INFO *netStream );
469 STDC_NONNULL_ARG( ( 1 ) ) \
470 void setStreamLayerBuffering( INOUT NET_STREAM_INFO *netStream,
471 							  const BOOLEAN useTransportBuffering );
472 #if 0	/* See comment in net_trans.c */
473 STDC_NONNULL_ARG( ( 1 ) ) \
474 void setAccessMethodTransportSession( INOUT NET_STREAM_INFO *netStream );
475 #else
476 #define setAccessMethodTransportSession( netStream )
477 #endif /* 0 */
478 
479 #endif /* _STREAM_INT_DEFINED */
480