Skip to content

Commit

Permalink
provide bufferevent_input and bufferevent_output without requiring kn…
Browse files Browse the repository at this point in the history
…owledge of the structure

svn:r734
  • Loading branch information
provos committed Apr 27, 2008
1 parent f6c4017 commit dd183f7
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Expand Up @@ -74,7 +74,8 @@ Changes in current version:
o expose bufferevent_setwatermark via header files and fix high watermark on read
o fix a bug in buffrevent read water marks and add a test for them
o fix a bug in which bufferevent_write_buffer would not schedule a write event

o provide bufferevent_input and bufferevent_output without requiring knowledge of the structure

Changes in 1.4.0:
o allow \r or \n individually to separate HTTP headers instead of the standard "\r\n"; from Charles Kerr.
o demote most http warnings to debug messages
Expand Down
12 changes: 12 additions & 0 deletions evbuffer.c
Expand Up @@ -273,6 +273,18 @@ bufferevent_new(evutil_socket_t fd, evbuffercb readcb, evbuffercb writecb,
return (bufev);
}

struct evbuffer *
bufferevent_input(struct bufferevent *bufev)
{
return (bufev->input);
}

struct evbuffer *
bufferevent_output(struct bufferevent *bufev)
{
return (bufev->output);
}

int
bufferevent_priority_set(struct bufferevent *bufev, int priority)
{
Expand Down
22 changes: 20 additions & 2 deletions include/event2/bufferevent.h
Expand Up @@ -191,6 +191,24 @@ size_t bufferevent_read(struct bufferevent *bufev, void *data, size_t size);
*/
int bufferevent_read_buffer(struct bufferevent *bufev, struct evbuffer *buf);

/**
Returns the input buffer.
@param bufev the buffervent from which to get the evbuffer
@return the evbuffer object for the input buffer
*/

struct evbuffer *bufferevent_input(struct bufferevent *bufev);

/**
Returns the outut buffer.
@param bufev the buffervent from which to get the evbuffer
@return the evbuffer object for the output buffer
*/

struct evbuffer *bufferevent_output(struct bufferevent *bufev);

/**
Enable a bufferevent.
Expand Down Expand Up @@ -242,8 +260,8 @@ void bufferevent_settimeout(struct bufferevent *bufev,
void bufferevent_setwatermark(struct bufferevent *bufev, short events,
size_t lowmark, size_t highmark);

#define EVBUFFER_INPUT(x) (x)->input
#define EVBUFFER_OUTPUT(x) (x)->output
#define EVBUFFER_INPUT(x) bufferevent_input(x)
#define EVBUFFER_OUTPUT(x) bufferevent_output(x)


#ifdef __cplusplus
Expand Down

0 comments on commit dd183f7

Please sign in to comment.