summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlarryh%netscape.com <devnull@localhost>2000-02-10 21:21:23 +0000
committerlarryh%netscape.com <devnull@localhost>2000-02-10 21:21:23 +0000
commit2e63c4ab2b0fe58b0b98ce58d768dc89a32b4246 (patch)
tree43f64e3b5acf85a14d140a9091d8b906681632f0
parent7cad3f57a1c94fe21d477d1bc8d0dce363a4fe69 (diff)
downloadnspr-hg-2e63c4ab2b0fe58b0b98ce58d768dc89a32b4246.tar.gz
BugZilla 23641. Add macro PR_ACCEPT_READ_BUF_OVERHEAD
-rw-r--r--pr/include/prio.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/pr/include/prio.h b/pr/include/prio.h
index 2a04f1f8..45baed03 100644
--- a/pr/include/prio.h
+++ b/pr/include/prio.h
@@ -1592,7 +1592,8 @@ NSPR_API(PRInt32) PR_SendFile(
** void *buf
** A pointer to a buffer to receive data sent by the client. This
** buffer must be large enough to receive <amount> bytes of data
-** and two PRNetAddr structures, plus an extra 32 bytes.
+** and two PRNetAddr structures, plus an extra 32 bytes. See:
+** PR_ACCEPT_READ_BUF_OVERHEAD.
** PRInt32 amount
** The number of bytes of client data to receive. Does not include
** the size of the PRNetAddr structures. If 0, no data will be read
@@ -1615,7 +1616,16 @@ NSPR_API(PRInt32) PR_SendFile(
** The number of bytes read from the client or -1 on failure. The reason
** for the failure is obtained by calling PR_GetError().
**************************************************************************
-**/
+**/
+/* define buffer overhead constant. Add this value to the user's
+** data length when allocating a buffer to accept data.
+** Example:
+** #define USER_DATA_SIZE 10
+** char buf[USER_DATA_SIZE + PR_ACCEPT_READ_BUF_OVERHEAD];
+** bytesRead = PR_AcceptRead( s, fd, &a, &p, USER_DATA_SIZE, ...);
+*/
+#define PR_ACCEPT_READ_BUF_OVERHEAD (32+(2*sizeof(PRNetAddr)))
+
NSPR_API(PRInt32) PR_AcceptRead(
PRFileDesc *listenSock, PRFileDesc **acceptedSock,
PRNetAddr **peerAddr, void *buf, PRInt32 amount, PRIntervalTime timeout);