2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 /* rx_stream.h: the stream I/O layer for RX */
12 This file is now obsolete.
22 #include <sys/types.h>
27 /* Write descriptor */
29 char *freePtr; /* Pointer to bytes in first packet */
30 int nFree; /* Number of bytes free in first packet */
31 struct rx_call *call; /* The call this stream is attached to */
32 struct rx_queue wq; /* Currently allocated packets for this stream */
33 int packetSize; /* Data size used in each packet */
38 struct rx_packet *packet; /* The current packet */
39 char *nextByte; /* Pointer to bytes in current packet */
40 int nLeft; /* Number of bytes free in current packet */
41 struct rx_call *call; /* The call this stream is attached to */
42 struct rx_queue rq; /* Currently allocated packets for this stream */
43 struct rx_queue freeTheseQ; /* These packets should be freed on the next operation */
46 /* Composite stream descriptor */
49 struct rx_stream_rd rd;
50 struct rx_stream_wd wd;
55 void rx_stream_InitWrite();
56 void rx_stream_InitRead();
57 void rx_stream_FinishWrite();
58 void rx_stream_FinishRead();
60 int rx_stream_Write();
61 int rx_stream_AllocIov();
63 /* Write nbytes of data to the write stream. Returns the number of bytes written */
64 /* If it returns 0, the call status should be checked with rx_Error. */
65 #define rx_stream_Write(iod, buf, nbytes) \
66 (iod)->sd.wd.nFree > (nbytes) ? \
67 (buf) && bcopy((buf), (iod)->sd.wd.freePtr, (nbytes)), \
68 (iod)->sd.wd.nFree -= (nbytes), \
69 (iod)->sd.wd.freePtr += (nbytes), (nbytes) \
70 : rx_stream_WriteProc((iod), (buf), (nbytes))
73 /* Read nbytes of data from the read stream. Returns the number of bytes read */
74 /* If it returns less than requested, the call status should be checked with rx_Error */
75 #define rx_stream_Read(iod, buf, nbytes) \
76 (iod)->sd.rd.nLeft > (nbytes) ? \
77 bcopy((iod)->sd.rd.nextByte, (buf), (nbytes)), \
78 (iod)->sd.rd.nLeft -= (nbytes), (iod)->sd.rd.nextByte += (nbytes), (nbytes) \
79 : rx_stream_ReadProc((iod), (buf), (nbytes))
81 #endif /* _RX_STREAM_ End of rx_stream.h */