SYNOPSIS

#include <ixp_srvutil.h>

void ixp_srv_readbuf(Ixp9Req *req, char *buf, uint len);

void ixp_srv_writebuf(Ixp9Req *req, char **buf, uint *len, uint max);

DESCRIPTION

Utility functions for handling TRead and TWrite requests for files backed by in-memory buffers. For both functions, buf points to a buffer and len specifies the length of the buffer. In the case of ixp_srv_writebuf, these values add a level of pointer indirection, and updates the values if they change.

If max has a value other than 0, ixp_srv_writebuf will truncate any writes to that point in the buffer. Otherwise, *buf is assumed to be malloc(3) allocated, and is reallocated to fit the new data as necessary. The buffer is is always left nul-terminated.

BUGS

ixp_srv_writebuf always truncates its buffer to the end of the most recent write.