Use _get_ convention for new accessor functions. (These are all new ones as of 2.0, I believe).
svn:r799
}
size_t
-evbuffer_length(struct evbuffer *buffer)
+evbuffer_get_length(struct evbuffer *buffer)
{
return (buffer->total_len);
}
size_t
-evbuffer_contiguous_space(struct evbuffer *buf)
+evbuffer_get_contiguous_space(struct evbuffer *buf)
{
struct evbuffer_chain *chain = buf->first;
}
struct evbuffer *
-bufferevent_input(struct bufferevent *bufev)
+bufferevent_get_input(struct bufferevent *bufev)
{
return (bufev->input);
}
struct evbuffer *
-bufferevent_output(struct bufferevent *bufev)
+bufferevent_get_output(struct bufferevent *bufev)
{
return TAILQ_FIRST(&bufev->output_filters) != NULL ?
TAILQ_FIRST(&bufev->output_filters)->buffer :
}
const char **
-event_supported_methods()
+event_get_supported_methods(void)
{
static const char **methods;
const struct eventop **method;
/* Generate request line */
method = evhttp_method(req->type);
- evbuffer_add_printf(bufferevent_output(evcon->bufev),
+ evbuffer_add_printf(bufferevent_get_output(evcon->bufev),
"%s %s HTTP/%d.%d\r\n",
method, req->uri, req->major, req->minor);
evhttp_make_header_response(struct evhttp_connection *evcon,
struct evhttp_request *req)
{
- evbuffer_add_printf(bufferevent_output(evcon->bufev),
+ evbuffer_add_printf(bufferevent_get_output(evcon->bufev),
"HTTP/%d.%d %d %s\r\n",
req->major, req->minor, req->response_code,
req->response_code_line);
evhttp_make_header(struct evhttp_connection *evcon, struct evhttp_request *req)
{
struct evkeyval *header;
- struct evbuffer *output = bufferevent_output(evcon->bufev);
+ struct evbuffer *output = bufferevent_get_output(evcon->bufev);
/*
* Depending if this is a HTTP request or response, we might need to
static void
evhttp_read_body(struct evhttp_connection *evcon, struct evhttp_request *req)
{
- struct evbuffer *buf = bufferevent_input(evcon->bufev);
+ struct evbuffer *buf = bufferevent_get_input(evcon->bufev);
if (req->chunked) {
int res = evhttp_handle_chunked_read(req, buf);
int res;
int fd = evcon->fd;
- res = evhttp_parse_lines(req, bufferevent_input(evcon->bufev));
+ res = evhttp_parse_lines(req, bufferevent_get_input(evcon->bufev));
if (res == -1) {
/* Error while reading, terminate */
event_debug(("%s: bad header lines on %d\n", __func__, fd));
void
evhttp_send_reply_chunk(struct evhttp_request *req, struct evbuffer *databuf)
{
- struct evbuffer *output = bufferevent_output(req->evcon->bufev);
+ struct evbuffer *output = bufferevent_get_output(req->evcon->bufev);
if (req->chunked) {
evbuffer_add_printf(output, "%x\r\n",
(unsigned)EVBUFFER_LENGTH(databuf));
evhttp_send_reply_end(struct evhttp_request *req)
{
struct evhttp_connection *evcon = req->evcon;
- struct evbuffer *output = bufferevent_output(evcon->bufev);
+ struct evbuffer *output = bufferevent_get_output(evcon->bufev);
if (req->chunked) {
evbuffer_add(output, "0\r\n\r\n", 5);
@param buf pointer to the evbuffer
@return the number of bytes stored in the event buffer
*/
-size_t evbuffer_length(struct evbuffer *buf);
+size_t evbuffer_get_length(struct evbuffer *buf);
/**
Returns the contiguous number of available bytes in the first buffer chain.
@return 0 if no data is available, otherwise the number of available bytes
in the first buffer chain.
*/
-size_t evbuffer_contiguous_space(struct evbuffer *buf);
+size_t evbuffer_get_contiguous_space(struct evbuffer *buf);
/**
Expands the available space in an event buffer.
*/
/** deprecated in favor of calling the functions directly */
-#define EVBUFFER_LENGTH(x) evbuffer_length(x)
+#define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
#define EVBUFFER_DATA(x) evbuffer_pullup(x, -1)
-
#ifdef __cplusplus
}
#endif
@return the evbuffer object for the input buffer
*/
-struct evbuffer *bufferevent_input(struct bufferevent *bufev);
+struct evbuffer *bufferevent_get_input(struct bufferevent *bufev);
/**
Returns the outut buffer.
@return the evbuffer object for the output buffer
*/
-struct evbuffer *bufferevent_output(struct bufferevent *bufev);
+struct evbuffer *bufferevent_get_output(struct bufferevent *bufev);
/**
Enable a bufferevent.
size_t lowmark, size_t highmark);
/** macro for getting access to the input buffer of a bufferevent */
-#define EVBUFFER_INPUT(x) bufferevent_input(x)
+#define EVBUFFER_INPUT(x) bufferevent_get_input(x)
/** macro for getting access to the output buffer of a bufferevent */
-#define EVBUFFER_OUTPUT(x) bufferevent_output(x)
+#define EVBUFFER_OUTPUT(x) bufferevent_get_output(x)
/**
Support for filtering input and output of bufferevents.
The end of the array is indicated by a NULL pointer. If an
error is encountered NULL is returned.
*/
-const char **event_supported_methods(void);
+const char **event_get_supported_methods(void);
/**
Allocates a new event configuration object.
assert(evbuffer_commit_space(evb, 10000) == 0);
evbuffer_validate(evb);
- assert(evbuffer_length(evb) >= 10000);
+ assert(evbuffer_get_length(evb) >= 10000);
evbuffer_drain(evb, j * 5000);
evbuffer_validate(evb);
static void
test_methods(void)
{
- const char **methods = event_supported_methods();
+ const char **methods = event_get_supported_methods();
struct event_config *cfg;
struct event_base *base;
const char *backend;
do {
/* let's do some decompression */
- p->avail_in = evbuffer_contiguous_space(src);
+ p->avail_in = evbuffer_get_contiguous_space(src);
p->next_in = evbuffer_pullup(src, p->avail_in);
p->next_out = evbuffer_reserve_space(dst, 4096);
assert(res == Z_OK || res == Z_STREAM_END);
/* let's figure out how much was compressed */
- nread = evbuffer_contiguous_space(src) - p->avail_in;
+ nread = evbuffer_get_contiguous_space(src) - p->avail_in;
nwrite = 4096 - p->avail_out;
evbuffer_drain(src, nread);
do {
/* let's do some compression */
- p->avail_in = evbuffer_contiguous_space(src);
+ p->avail_in = evbuffer_get_contiguous_space(src);
p->next_in = evbuffer_pullup(src, p->avail_in);
p->next_out = evbuffer_reserve_space(dst, 4096);
assert(res == Z_OK || res == Z_STREAM_END);
/* let's figure out how much was compressed */
- nread = evbuffer_contiguous_space(src) - p->avail_in;
+ nread = evbuffer_get_contiguous_space(src) - p->avail_in;
nwrite = 4096 - p->avail_out;
evbuffer_drain(src, nread);
static void
readcb(struct bufferevent *bev, void *arg)
{
- if (EVBUFFER_LENGTH(bufferevent_input(bev)) == 8333) {
+ if (EVBUFFER_LENGTH(bufferevent_get_input(bev)) == 8333) {
struct evbuffer *evbuf = evbuffer_new();
assert(evbuf != NULL);
static void
writecb(struct bufferevent *bev, void *arg)
{
- if (EVBUFFER_LENGTH(bufferevent_output(bev)) == 0)
+ if (EVBUFFER_LENGTH(bufferevent_get_output(bev)) == 0)
test_ok++;
}