From e03dedf0a4c40ceeb063f95777bc99628a980ec9 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Mon, 12 Mar 2018 17:27:10 +0100 Subject: lib: Allow partial read This implements partial read of packets if the buffer supplied to flow_read() is smaller than the packet in the buffer. If the number of bytes returned by flow_read equals the size of the buffer, the next read() will deliver the next bytes of the packet (or 0 if the packet was exactly the size of the buffer on the previous read). Implements #7. Signed-off-by: Dimitri Staessens Signed-off-by: Sander Vrijders --- doc/man/flow_read.3 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/man/flow_read.3 b/doc/man/flow_read.3 index 96f76766..0110d0a2 100644 --- a/doc/man/flow_read.3 +++ b/doc/man/flow_read.3 @@ -30,7 +30,11 @@ from the supplied buffer \fIbuf\fR to the flow specified by \fIfd\fR. .SH RETURN VALUE On success, \fBflow_read\fR() returns the number of bytes read. On -failure, a negative value indicating the error will be returned. +failure, a negative value indicating the error will be returned. If +the number of bytes read equals count, a subsequent call to +\fBflow_read\fR() should be performed to check if there were more +bytes to read. This call to \fBflow_read\fR will return 0 if there +was no more data and mark the end of the datagram. On success, \fBflow_write\fR() returns 0. On failure, a negative value indicating the error will be returned. Passing a NULL pointer for -- cgit v1.2.3