taskrambler  0.1.9
Web server and task management solution.
cbuf/read.c File Reference
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include "cbuf.h"
#include "stream.h"
+ Include dependency graph for cbuf/read.c:

Go to the source code of this file.

Functions

ssize_t cbufRead (Cbuf this, Stream st)
 

Detailed Description

Author
Georg Hopp

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file cbuf/read.c.

Function Documentation

ssize_t cbufRead ( Cbuf  this,
Stream  st 
)

Definition at line 32 of file cbuf/read.c.

References cbufGetFree(), cbufGetWrite(), cbufIncWrite(), ECBUFOVFL, and streamRead().

Referenced by httpParserParse().

33 {
34  size_t rsize = cbufGetFree(this);
35  ssize_t rrsize;
36 
37  if (0 == rsize) {
38  errno = ECBUFOVFL;
39  return -1;
40  }
41 
42  rrsize = streamRead(st, cbufGetWrite(this), rsize);
43 
44  if (0 < rrsize) {
45  cbufIncWrite(this, rrsize);
46  }
47 
48  return rrsize;
49 }
size_t cbufGetFree(Cbuf this)
Definition: get_free.c:28
#define ECBUFOVFL
Definition: cbuf.h:43
ssize_t streamRead(Stream, void *, size_t)
Definition: stream/read.c:35
char * cbufGetWrite(Cbuf this)
Definition: get_write.c:26
void cbufIncWrite(Cbuf this, size_t n)
Definition: inc_write.c:28

+ Here is the call graph for this function:

+ Here is the caller graph for this function: