diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-02-11 12:04:15 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-02-11 12:04:15 -0500 |
commit | a6503944ddf312c8270ac61a366502386aa1bd0c (patch) | |
tree | 984e1a01a3280746701dab7e02751c180d568332 /bufferevent.c | |
parent | bf2c5a77973262e599a7d5a6604e4f3d43718119 (diff) | |
download | libevent-a6503944ddf312c8270ac61a366502386aa1bd0c.tar.gz |
Add a bufferevent_getcb() to find a bufferevent's current callbacks
Diffstat (limited to 'bufferevent.c')
-rw-r--r-- | bufferevent.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/bufferevent.c b/bufferevent.c index 98799704..3960bcaf 100644 --- a/bufferevent.c +++ b/bufferevent.c @@ -358,6 +358,26 @@ bufferevent_setcb(struct bufferevent *bufev, BEV_UNLOCK(bufev); } +void +bufferevent_getcb(struct bufferevent *bufev, + bufferevent_data_cb *readcb_ptr, + bufferevent_data_cb *writecb_ptr, + bufferevent_event_cb *eventcb_ptr, + void **cbarg_ptr) +{ + BEV_LOCK(bufev); + if (readcb_ptr) + *readcb_ptr = bufev->readcb; + if (writecb_ptr) + *writecb_ptr = bufev->writecb; + if (eventcb_ptr) + *eventcb_ptr = bufev->errorcb; + if (cbarg_ptr) + *cbarg_ptr = bufev->cbarg; + + BEV_UNLOCK(bufev); +} + struct evbuffer * bufferevent_get_input(struct bufferevent *bufev) { |