components/libevent/patches/event.3.patch
changeset 604 c25824a87b1f
parent 209 2961eca161ad
equal deleted inserted replaced
603:1b966e9a6b03 604:c25824a87b1f
     1 --- libevent-1.3e/event.3.orig	Wed Apr 27 12:03:35 2011
     1 --- libevent-1.4.14b-stable/event.3	po lis 21 06:43:10 2011
     2 +++ libevent-1.3e/event.3	Wed Apr 27 12:03:55 2011
     2 +++ libevent-1.4.14b-stable/event.3	po lis 21 09:31:12 2011
     3 @@ -26,567 +26,453 @@
     3 @@ -26,527 +26,528 @@
     4  .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     4  .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
     5  .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     5  .\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     6  .\"
     6  .\"
     7 -.Dd August 8, 2000
     7 -.Dd August 8, 2000
     8 -.Dt EVENT 3
     8 -.Dt EVENT 3
    10 -.Sh NAME
    10 -.Sh NAME
    11 -.Nm event_init ,
    11 -.Nm event_init ,
    12 -.Nm event_dispatch ,
    12 -.Nm event_dispatch ,
    13 -.Nm event_loop ,
    13 -.Nm event_loop ,
    14 -.Nm event_loopexit ,
    14 -.Nm event_loopexit ,
       
    15 -.Nm event_loopbreak ,
    15 -.Nm event_set ,
    16 -.Nm event_set ,
    16 -.Nm event_base_dispatch ,
    17 -.Nm event_base_dispatch ,
    17 -.Nm event_base_loop ,
    18 -.Nm event_base_loop ,
    18 -.Nm event_base_loopexit ,
    19 -.Nm event_base_loopexit ,
       
    20 -.Nm event_base_loopbreak ,
    19 -.Nm event_base_set ,
    21 -.Nm event_base_set ,
    20 -.Nm event_base_free ,
    22 -.Nm event_base_free ,
    21 -.Nm event_add ,
    23 -.Nm event_add ,
    22 -.Nm event_del ,
    24 -.Nm event_del ,
    23 -.Nm event_once ,
    25 -.Nm event_once ,
    54 -.Nm evbuffer_drain ,
    56 -.Nm evbuffer_drain ,
    55 -.Nm evbuffer_write ,
    57 -.Nm evbuffer_write ,
    56 -.Nm evbuffer_read ,
    58 -.Nm evbuffer_read ,
    57 -.Nm evbuffer_find ,
    59 -.Nm evbuffer_find ,
    58 -.Nm evbuffer_readline ,
    60 -.Nm evbuffer_readline ,
    59 -.Nm evhttp_start ,
    61 -.Nm evhttp_new ,
       
    62 -.Nm evhttp_bind_socket ,
    60 -.Nm evhttp_free
    63 -.Nm evhttp_free
    61 -.Nd execute a function when a specific event occurs
    64 -.Nd execute a function when a specific event occurs
    62 -.Sh SYNOPSIS
    65 -.Sh SYNOPSIS
    63 -.Fd #include <sys/time.h>
    66 -.Fd #include <sys/time.h>
    64 -.Fd #include <event.h>
    67 -.Fd #include <event.h>
    68 -.Fn "event_dispatch" "void"
    71 -.Fn "event_dispatch" "void"
    69 -.Ft int
    72 -.Ft int
    70 -.Fn "event_loop" "int flags"
    73 -.Fn "event_loop" "int flags"
    71 -.Ft int
    74 -.Ft int
    72 -.Fn "event_loopexit" "struct timeval *tv"
    75 -.Fn "event_loopexit" "struct timeval *tv"
       
    76 -.Ft int
       
    77 -.Fn "event_loopbreak" "void"
    73 -.Ft void
    78 -.Ft void
    74 -.Fn "event_set" "struct event *ev" "int fd" "short event" "void (*fn)(int, short, void *)" "void *arg"
    79 -.Fn "event_set" "struct event *ev" "int fd" "short event" "void (*fn)(int, short, void *)" "void *arg"
    75 -.Ft int
    80 -.Ft int
    76 -.Fn "event_base_dispatch" "struct event_base *base"
    81 -.Fn "event_base_dispatch" "struct event_base *base"
    77 -.Ft int
    82 -.Ft int
    78 -.Fn "event_base_loop" "struct event_base *base" "int flags"
    83 -.Fn "event_base_loop" "struct event_base *base" "int flags"
    79 -.Ft int
    84 -.Ft int
    80 -.Fn "event_base_loopexit" "struct event_base *base" "struct timeval *tv"
    85 -.Fn "event_base_loopexit" "struct event_base *base" "struct timeval *tv"
       
    86 -.Ft int
       
    87 -.Fn "event_base_loopbreak" "struct event_base *base"
    81 -.Ft int
    88 -.Ft int
    82 -.Fn "event_base_set" "struct event_base *base" "struct event *"
    89 -.Fn "event_base_set" "struct event_base *base" "struct event *"
    83 -.Ft void
    90 -.Ft void
    84 -.Fn "event_base_free" "struct event_base *base"
    91 -.Fn "event_base_free" "struct event_base *base"
    85 -.Ft int
    92 -.Ft int
   157 -.Ft "u_char *"
   164 -.Ft "u_char *"
   158 -.Fn "evbuffer_find" "struct evbuffer *buf" "const u_char *data" "size_t size"
   165 -.Fn "evbuffer_find" "struct evbuffer *buf" "const u_char *data" "size_t size"
   159 -.Ft "char *"
   166 -.Ft "char *"
   160 -.Fn "evbuffer_readline" "struct evbuffer *buf"
   167 -.Fn "evbuffer_readline" "struct evbuffer *buf"
   161 -.Ft "struct evhttp *"
   168 -.Ft "struct evhttp *"
   162 -.Fn "evhttp_start" "const char *address" "u_short port"
   169 -.Fn "evhttp_new" "struct event_base *base"
       
   170 -.Ft int
       
   171 -.Fn "evhttp_bind_socket" "struct evhttp *http" "const char *address" "u_short port"
   163 -.Ft "void"
   172 -.Ft "void"
   164 -.Fn "evhttp_free" "struct evhttp* http"
   173 -.Fn "evhttp_free" "struct evhttp *http"
   165 -.Ft int
   174 -.Ft int
   166 -.Fa (*event_sigcb)(void) ;
   175 -.Fa (*event_sigcb)(void) ;
   167 -.Ft volatile sig_atomic_t
   176 -.Ft volatile sig_atomic_t
   168 -.Fa event_gotsig ;
   177 -.Fa event_gotsig ;
   169 -.Sh DESCRIPTION
   178 -.Sh DESCRIPTION
   170 +.TH EVENT 3 "8 August 2000" "libevent 1.3e" "libevent Manual"
   179 +.TH EVENT 3 "21 November 2011" "libevent 1.4.14b" "libevent Manual"
   171 +.SH NAME
   180 +.SH NAME
   172 +event_init, event_dispatch, event_loop, event_loopexit, event_set, event_base_dispatch, event_base_loop, event_base_loopexit, event_base_set, event_base_free, event_add, event_del, event_once, event_base_once, event_pending, event_initialized, event_priority_init, event_priority_set, evtimer_set, evtimer_add, evtimer_del, evtimer_pending, evtimer_initialized, signal_set, signal_add, signal_del, signal_pending, signal_initialized, bufferevent_new, bufferevent_free, bufferevent_write, bufferevent_write_buffer, bufferevent_read, bufferevent_enable, bufferevent_disable, bufferevent_settimeout, bufferevent_base_set, evbuffer_new, evbuffer_free, evbuffer_add, evbuffer_add_buffer, evbuffer_add_printf, evbuffer_add_vprintf, evbuffer_drain, evbuffer_write, evbuffer_read, evbuffer_find, evbuffer_readline
   181 +event_init,
       
   182 +event_dispatch,
       
   183 +event_loop,
       
   184 +event_loopexit,
       
   185 +event_loopbreak,
       
   186 +event_set,
       
   187 +event_base_dispatch,
       
   188 +event_base_loop,
       
   189 +event_base_loopexit,
       
   190 +event_base_loopbreak,
       
   191 +event_base_set,
       
   192 +event_base_free,
       
   193 +event_add,
       
   194 +event_del,
       
   195 +event_once,
       
   196 +event_base_once,
       
   197 +event_pending,
       
   198 +event_initialized,
       
   199 +event_priority_init,
       
   200 +event_priority_set,
       
   201 +evtimer_set,
       
   202 +evtimer_add,
       
   203 +evtimer_del,
       
   204 +evtimer_pending,
       
   205 +evtimer_initialized,
       
   206 +signal_set,
       
   207 +signal_add,
       
   208 +signal_del,
       
   209 +signal_pending,
       
   210 +signal_initialized,
       
   211 +bufferevent_new,
       
   212 +bufferevent_free,
       
   213 +bufferevent_write,
       
   214 +bufferevent_write_buffer,
       
   215 +bufferevent_read,
       
   216 +bufferevent_enable,
       
   217 +bufferevent_disable,
       
   218 +bufferevent_settimeout,
       
   219 +bufferevent_base_set,
       
   220 +evbuffer_new,
       
   221 +evbuffer_free,
       
   222 +evbuffer_add,
       
   223 +evbuffer_add_buffer,
       
   224 +evbuffer_add_printf,
       
   225 +evbuffer_add_vprintf,
       
   226 +evbuffer_drain,
       
   227 +evbuffer_write,
       
   228 +evbuffer_read,
       
   229 +evbuffer_find,
       
   230 +evbuffer_readline,
       
   231 +evhttp_new,
       
   232 +evhttp_bind_socket,
       
   233 +evhttp_free
       
   234 +\- execute a function when a specific event occurs
   173 +.SH LIBRARY
   235 +.SH LIBRARY
   174 +The libevent library (libevent, -levent)
   236 +The libevent library (libevent, -levent)
   175 +.br
   237 +.br
   176 +.SH SYNOPSIS
   238 +.SH SYNOPSIS
       
   239 +.LP
       
   240 +.nf
   177 +\fB#include <sys/time.h>\fP
   241 +\fB#include <sys/time.h>\fP
   178 +.br
       
   179 +\fB#include <event.h>\fP
   242 +\fB#include <event.h>\fP
   180 +.sp
   243 +
   181 +\fBstruct event_base* \fBevent_init\fR\fR(\fBvoid\fP\fR);
   244 +\fBstruct event_base* \fBevent_init\fR\fR(\fBvoid\fP\fR);
   182 +.br
   245 +
   183 +\fBint \fBevent_dispatch\fR\fR(\fBvoid\fP\fR);
   246 +\fBint \fBevent_dispatch\fR\fR(\fBvoid\fP\fR);
   184 +.br
   247 +
   185 +\fBint \fBevent_loop\fR\fR(\fBint \fIflags\fP\fR);
   248 +\fBint \fBevent_loop\fR\fR(\fBint \fIflags\fP\fR);
   186 +.br
   249 +
   187 +.BI "int event_loopexit(struct timeval* " tv ");"
   250 +\fBint \fBevent_loopexit\fR\fR(\fBstruct timeval* \fItv\fP\fR);
   188 +.br
   251 +
   189 +\fBvoid \fBevent_set\fR\fR(\fBstruct event* \fIev\fP\fR, \fBint \fIfd \fP\fR, \fBshort \fIevent\fP\fR, \fBvoid \fI(*fn)(int, short, void *)\fP\fR, \fBvoid* \fIarg\fP\fR);
   252 +\fBint \fBevent_loopbreak\fR\fR(\fBvoid\fP\fR);
   190 +.br
   253 +
       
   254 +\fBvoid \fBevent_set\fR\fR(\fBstruct event* \fIev\fP\fR, \fBint \fIfd \fP\fR, \fBshort \fIevent\fP\fR, \fBvoid \fI(*fn)(\fBint, short, void *\fP\fR), \fBvoid* \fIarg\fP\fR);
       
   255 +
   191 +\fBint \fBevent_base_dispatch\fR\fR(\fBstruct event_base* \fIbase\fP\fR);
   256 +\fBint \fBevent_base_dispatch\fR\fR(\fBstruct event_base* \fIbase\fP\fR);
   192 +.br
   257 +
   193 +\fBint \fBevent_base_loop\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBint \fIflags\fP\fR);
   258 +\fBint \fBevent_base_loop\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBint \fIflags\fP\fR);
   194 +.br
   259 +
   195 +\fBint \fBevent_base_loopexit\fR\fR(struct event_base* \fIbase\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   260 +\fBint \fBevent_base_loopexit\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   196 +.br
   261 +
   197 +\fBint \fBevent_base_set\fR\fR(struct event_base* \fIbase\fP\fR, \fBstruct event* \fIev\fP\fR);
   262 +\fBint \fBevent_base_loopbreak\fR\fR(\fBstruct event_base* \fIbase\fP\fR);
   198 +.br
   263 +
   199 +\fBvoid \fBevent_base_free\fR\fR(struct event_base* \fIbase\fP\fR);
   264 +\fBint \fBevent_base_set\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBstruct event* \fIev\fP\fR);
   200 +.br
   265 +
   201 +\fBint \fBevent_add\fR\fR(struct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   266 +\fBvoid \fBevent_base_free\fR\fR(\fBstruct event_base* \fIbase\fP\fR);
   202 +.br
   267 +
       
   268 +\fBint \fBevent_add\fR\fR(\fBstruct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
       
   269 +
   203 +.\fBint \fBevent_del\fR\fR(struct event* \fIev\fP\fR);
   270 +.\fBint \fBevent_del\fR\fR(struct event* \fIev\fP\fR);
   204 +.br
   271 +
   205 +\fBint \fBevent_once\fR\fR(int \fIfd\fP\fR, \fBshort \fIevent\fP\fR, \fBvoid \fI(*fn)(int, short, void*)\fB\fR, \fBstruct timeval* \fItv\fP\fR);
   272 +\fBint \fBevent_once\fR\fR(\fBint \fIfd\fP\fR, \fBshort \fIevent\fP\fR, \fBvoid \fI(*fn)(\fBint, short, void*\fB\fR), \fBstruct timeval* \fItv\fP\fR);
   206 +.br
   273 +
   207 +\fBint \fBevent_base_once\fR\fR(struct event_base* \fIbase\fP\fR, \fBint \fIfd\fB\fR, \fBshort \fIevent\fB\fR, \fBvoid \fI(*fn)(int, short, void*)\fB\fR, \fBvoid* \fIarg\fB\fR, \fBstruct timeval* \fItv\fP\fR);
   274 +\fBint \fBevent_base_once\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBint \fIfd\fB\fR, \fBshort \fIevent\fB\fR, \fBvoid \fI(*fn)(\fBint, short, void*\fB\fR), \fBvoid* \fIarg\fB\fR, \fBstruct timeval* \fItv\fP\fR);
   208 +.br
   275 +
   209 +\fBint \fBevent_pending\fR\fR(struct event* \fIev\fP\fR, \fBshort \fIevent\fB\fR, \fBstruct timeval* \fItv\fP\fR);
   276 +\fBint \fBevent_pending\fR\fR(\fBstruct event* \fIev\fP\fR, \fBshort \fIevent\fB\fR, \fBstruct timeval* \fItv\fP\fR);
   210 +.br
   277 +
   211 +\fBint \fBevent_initialized\fR\fR(struct event* \fIev\fP\fR);
   278 +\fBint \fBevent_initialized\fR\fR(\fBstruct event* \fIev\fP\fR);
   212 +.br
   279 +
   213 +\fBint \fBevent_priority_init\fR\fR (int \fInpriorities\fP\fR);
   280 +\fBint \fBevent_priority_init\fR\fR (\fBint \fInpriorities\fP\fR);
   214 +.br
   281 +
   215 +\fBint \fBevent_priority_set\fR\fR (struct event* \fIev\fP\fR, \fBint \fIpriority\fP\fR);
   282 +\fBint \fBevent_priority_set\fR\fR (\fBstruct event* \fIev\fP\fR, \fBint \fIpriority\fP\fR);
   216 +.br
   283 +
   217 +\fBvoid \fBevtimer_set\fR\fR (struct event* \fIev\fP\fR, \fBvoid \fI(*fn)(int, short, void*)\fB\fR, \fBvoid* \fIarg\fP\fR);
   284 +\fBvoid \fBevtimer_set\fR\fR (\fBstruct event* \fIev\fP\fR, \fBvoid \fI(*fn)(\fBint, short, void*\fB\fR), \fBvoid* \fIarg\fP\fR);
   218 +.br
   285 +
   219 +\fBvoid \fBevtimer_add\fR\fR (struct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   286 +\fBvoid \fBevtimer_add\fR\fR (\fBstruct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   220 +.br
   287 +
   221 +\fBvoid \fBevtimer_del\fR\fR (struct event* \fIev\fP\fR);
   288 +\fBvoid \fBevtimer_del\fR\fR (\fBstruct event* \fIev\fP\fR);
   222 +.br
   289 +
   223 +\fBint \fBevtimer_pending\fR\fR (struct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   290 +\fBint \fBevtimer_pending\fR\fR (\fBstruct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   224 +.br
   291 +
   225 +\fBint \fBevtimer_initialized\fR\fR(struct event* \fIev\fP\fR);
   292 +\fBint \fBevtimer_initialized\fR\fR(\fBstruct event* \fIev\fP\fR);
   226 +.br
   293 +
   227 +\fBvoid \fBsignal_set\fR\fR (struct event* \fIev\fP\fR, \fBint \fIsignal\fP\fR, \fBvoid \fI(*fn)(int, short, void*)\fP\fR, \fBvoid* \fIarg\fP\fR);
   294 +\fBvoid \fBsignal_set\fR\fR (\fBstruct event* \fIev\fP\fR, \fBint \fIsignal\fP\fR, \fBvoid \fI(*fn)(\fBint, short, void*\fP\fR), \fBvoid* \fIarg\fP\fR);
   228 +.br
   295 +
   229 +\fBvoid \fBsignal_add\fR\fR (struct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   296 +\fBvoid \fBsignal_add\fR\fR (\fBstruct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   230 +.br
   297 +
   231 +\fBvoid \fBsignal_del\fR\fR (struct event* \fIev\fP\fR);
   298 +\fBvoid \fBsignal_del\fR\fR (\fBstruct event* \fIev\fP\fR);
   232 +.br
   299 +
   233 +\fBint \fBsignal_pending\fR\fR(struct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   300 +\fBint \fBsignal_pending\fR\fR(\fBstruct event* \fIev\fP\fR, \fBstruct timeval* \fItv\fP\fR);
   234 +.br
   301 +
   235 +\fBint \fBsignal_initialized\fR\fR(struct event* \fIev\fP\fR);
   302 +\fBint \fBsignal_initialized\fR\fR(\fBstruct event* \fIev\fP\fR);
   236 +.br
   303 +
   237 +\fBstruct bufferevent* \fB"bufferevent_new\fR\fR(int \fIfd\fP\fR, \fBevbuffercb \fIreadcb\fP\fR, \fBevbuffercb \fIwritecb\fP\fR, \fBeverrorcb \fIerrorcb\fP\fR, \fBvoid* \fIcbarg\fP\fR);
   304 +\fBstruct bufferevent* \fBbufferevent_new\fR\fR(\fBint \fIfd\fP\fR, \fBevbuffercb \fIreadcb\fP\fR, \fBevbuffercb \fIwritecb\fP\fR, \fBeverrorcb \fIerrorcb\fP\fR, \fBvoid* \fIcbarg\fP\fR);
   238 +.br
   305 +
   239 +\fBvoid \fBbufferevent_free\fR\fR(struct bufferevent* \fIbufev\fP\fR);
   306 +\fBvoid \fBbufferevent_free\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR);
   240 +.br
   307 +
   241 +\fBint \fBbufferevent_write\fR\fR(struct bufferevent* \fIbufev\fP\fR, \fBvoid* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   308 +\fBint \fBbufferevent_write\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBvoid* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   242 +.br
   309 +
   243 +\fBint \fBbufferevent_write_buffer\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBstruct evbuffer* \fIbuf\fP\fR);
   310 +\fBint \fBbufferevent_write_buffer\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBstruct evbuffer* \fIbuf\fP\fR);
   244 +.br
   311 +
   245 +\fBsize_t \fBbufferevent_read\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBvoid* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   312 +\fBsize_t \fBbufferevent_read\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBvoid* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   246 +.br
   313 +
   247 +\fBint \fBbufferevent_enable\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBshort \fIevent\fP\fR);
   314 +\fBint \fBbufferevent_enable\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBshort \fIevent\fP\fR);
   248 +.br
   315 +
   249 +\fBint \fBbufferevent_disable\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBshort \fIeven\fP\fR);
   316 +\fBint \fBbufferevent_disable\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBshort \fIeven\fP\fR);
   250 +.br
   317 +
   251 +\fBvoid \fBbufferevent_settimeout\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBint \fItimeout_read\fP\fR, \fBint \fItimeout_write\fP\fR);
   318 +\fBvoid \fBbufferevent_settimeout\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBint \fItimeout_read\fP\fR, \fBint \fItimeout_write\fP\fR);
   252 +.br
   319 +
   253 +\fBint \fBbufferevent_base_set\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBstruct bufferevent* \fIbufev\fP\fR);
   320 +\fBint \fBbufferevent_base_set\fR\fR(\fBstruct event_base* \fIbase\fP\fR, \fBstruct bufferevent* \fIbufev\fP\fR);
   254 +.br
   321 +
   255 +\fBstruct evbuffer* \fBevbuffer_new (\fBvoid\fP\fR);
   322 +\fBstruct evbuffer* \fBevbuffer_new (\fBvoid\fP\fR);
   256 +.br
   323 +
   257 +\fBvoid \fBvbuffer_free\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR);
   324 +\fBvoid \fBevbuffer_free\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR);
   258 +.br
   325 +
   259 +\fBint \fBevbuffer_add\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst void* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   326 +\fBint \fBevbuffer_add\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst void* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   260 +.br
   327 +
   261 +\fBint \fBevbuffer_add_buffer\fR\fR(\fBstruct evbuffer* \fIdst\fP\fR, \fBstruct evbuffer* \fIsrc\fP\fR);
   328 +\fBint \fBevbuffer_add_buffer\fR\fR(\fBstruct evbuffer* \fIdst\fP\fR, \fBstruct evbuffer* \fIsrc\fP\fR);
   262 +.br
   329 +
   263 +\fBint \fBevbuffer_add_printf\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst char* \fIfmt\fP\fR, \fB...\fP\fR);
   330 +\fBint \fBevbuffer_add_printf\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst char* \fIfmt\fP\fR, \fB...\fP\fR);
   264 +.br
   331 +
   265 +\fBint \fBevbuffer_add_vprintf\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst char* \fIfmt\fP\fR, \fBva_list \fIap\fP\fR);
   332 +\fBint \fBevbuffer_add_vprintf\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst char* \fIfmt\fP\fR, \fBva_list \fIap\fP\fR);
   266 +.br
   333 +
   267 +\fBvoid \fBevbuffer_drain\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBsize_t \fIsize\fP\fR);
   334 +\fBvoid \fBevbuffer_drain\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBsize_t \fIsize\fP\fR);
   268 +.br
   335 +
   269 +\fBint \fBevbuffer_write\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBint \fIfd\fP\fR);
   336 +\fBint \fBevbuffer_write\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBint \fIfd\fP\fR);
   270 +.br
   337 +
   271 +\fBint \fBevbuffer_read\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBint \fIfd\fP\fR, \fBint \fIsize\fP\fR);
   338 +\fBint \fBevbuffer_read\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBint \fIfd\fP\fR, \fBint \fIsize\fP\fR);
   272 +.br
   339 +
   273 +\fBu_char* \fBevbuffer_find\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst u_char* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   340 +\fBu_char* \fBevbuffer_find\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR, \fBconst u_char* \fIdata\fP\fR, \fBsize_t \fIsize\fP\fR);
   274 +.br
   341 +
   275 +\fBchar* \fBevbuffer_readline\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR);
   342 +\fBchar* \fBevbuffer_readline\fR\fR(\fBstruct evbuffer* \fIbuf\fP\fR);
   276 +.br
   343 +
   277 +\fBint \fI(*event_sigcb)\fP\fR\fI(void)\fP\fR;
   344 +\fBstruct evhttp * \fBevhttp_new\fR\fR(\fBstruct event_base* \fIbase\fP\fR);
   278 +.br
   345 +
       
   346 +\fBint \fBevhttp_bind_socket\fR\fR(\fBstruct evhttp* \fIhttp\fP\fR, \fBconst char* \fIaddress\fP\fR, \fBu_short \fIport\fP\fR);
       
   347 +
       
   348 +\fBvoid \fBevhttp_free\fR\fR(\fBstruct evhttp* \fIhttp\fP\fR);
       
   349 +
       
   350 +\fBint \fI(*event_sigcb)\fP\fR\fI(\fBvoid\fP\fR);
       
   351 +
   279 +\fBvolatile sig_atomic_t \fR\fRevent_gotsig\fP\fR;
   352 +\fBvolatile sig_atomic_t \fR\fRevent_gotsig\fP\fR;
   280 +.br
   353 +.fi
       
   354 +
   281 +.SH DESCRIPTION
   355 +.SH DESCRIPTION
   282  The
   356  The
   283 -.Nm event
   357 -.Nm event
   284 +\fIevent\fP\fR
   358 +\fIevent\fP\fR
   285  API provides a mechanism to execute a function when a specific event
   359  API provides a mechanism to execute a function when a specific event
   295  before it can be used.
   369  before it can be used.
   296 -.Pp
   370 -.Pp
   297 +.PP
   371 +.PP
   298  In order to process events, an application needs to call
   372  In order to process events, an application needs to call
   299 -.Fn event_dispatch .
   373 -.Fn event_dispatch .
   300 +\fIevent_dispatch\fP\fR .
   374 +\fBevent_dispatch\fP\fR.
   301  This function only returns on error, and should replace the event core
   375  This function only returns on error, and should replace the event core
   302  of the application program.
   376  of the application program.
   303 -.Pp
       
   304 +.PP
       
   305  In order to avoid races in signal handlers, the
       
   306 -.Nm event
       
   307 +\fIevent\fP\fR
       
   308  API provides two variables:
       
   309 -.Va event_sigcb
       
   310 +\fIevent_sigcb\fP\fR
       
   311  and
       
   312 -.Va event_gotsig .
       
   313 +\fIevent_gotsig\fP\fR.
       
   314  A signal handler
       
   315  sets
       
   316 -.Va event_gotsig
       
   317 +\fIevent_gotsig\fP\fR
       
   318  to indicate that a signal has been received.
       
   319  The application sets
       
   320 -.Va event_sigcb
       
   321 +\fIevent_sigcb\fP\fR
       
   322  to a callback function.
       
   323  After the signal handler sets
       
   324 -.Va event_gotsig ,
       
   325 -.Nm event_dispatch
       
   326 +\fIevent_gotsig\fP\fR,
       
   327 +\fBevent_dispatch()\fP\fR
       
   328  will execute the callback function to process received signals.
       
   329  The callback returns 1 when no events are registered any more.
       
   330  It can return \-1 to indicate an error to the
       
   331 -.Nm event
       
   332 +\fIevent\fP\fR
       
   333  library, causing
       
   334 -.Fn event_dispatch
       
   335 +\fBevent_dispatch\fP\fR
       
   336  to terminate with
       
   337 -.Va errno
       
   338 -set to
       
   339 -.Er EINTR .
       
   340 -.Pp
       
   341 +\fIerrno\fP\fR
       
   342 +set to EINTR.
       
   343 +.PO
       
   344  The
       
   345 -.Nm event_loop
       
   346 +\fIevent_loop\fP\fR
       
   347  function provides an interface for single pass execution of pending
       
   348  events.
       
   349  The flags
       
   350 -.Va EVLOOP_ONCE
       
   351 -and
       
   352 -.Va EVLOOP_NONBLOCK
       
   353 -are recognized.
       
   354 +EVLOOP_ONCE and EVLOOP_NONBLOCK are recognized.
       
   355  The
       
   356 -.Nm event_loopexit
       
   357 +\fIevent_loopexit\fP\fR
       
   358  function allows the loop to be terminated after some amount of time
       
   359  has passed.
       
   360  The parameter indicates the time after which the loop should terminate.
       
   361 -.Pp
       
   362 +.PP
       
   363  It is the responsibility of the caller to provide these functions with
       
   364  pre-allocated event structures.
       
   365 -.Pp
   377 -.Pp
   366 +.PP
   378 +.PP
   367  The function
   379  The function
   368 -.Fn event_set
   380 -.Fn event_set
   369 +\fBevent_set\fP\fR
   381 +\fBevent_set\fP\fR
   390 +\fIvoid*\fP\fR
   402 +\fIvoid*\fP\fR
   391  argument given in the
   403  argument given in the
   392 -.Fa arg
   404 -.Fa arg
   393 +\fIarg\fP\fR
   405 +\fIarg\fP\fR
   394  argument.
   406  argument.
   395 -The
   407  The
   396 -.Fa fd
   408 -.Fa fd
   397 +The \fIfd\fP\fR
   409 +The \fIfd\fP\fR
   398  indicates the file descriptor that should be monitored for events.
   410  indicates the file descriptor that should be monitored for events.
   399 -The events can be either
   411 -The events can be either
   400 -.Va EV_READ ,
   412 -.Va EV_READ ,
   407 +.PP
   419 +.PP
   408  The function
   420  The function
   409 -.Fa fn
   421 -.Fa fn
   410 +\fIfn\fP\fR
   422 +\fIfn\fP\fR
   411  will be called with the file descriptor that triggered the event and
   423  will be called with the file descriptor that triggered the event and
   412 -the type of event which will be either
   424  the type of event which will be either
   413 -.Va EV_TIMEOUT ,
   425 -.Va EV_TIMEOUT ,
   414 -.Va EV_SIGNAL ,
   426 -.Va EV_SIGNAL ,
   415 -.Va EV_READ ,
   427 -.Va EV_READ ,
   416 -or
   428 +EV_TIMEOUT,
       
   429 +EV_SIGNAL,
       
   430 +EV_READ,
       
   431  or
   417 -.Va EV_WRITE .
   432 -.Va EV_WRITE .
   418 -The additional flag
   433 +EV_WRITE.
       
   434  Additionally, an event which has registered interest in more than one of the
       
   435  preceeding events, via bitwise-OR to
       
   436 -.Fn event_set ,
       
   437 +\fBevent_set\fP\fR,
       
   438  can provide its callback function with a bitwise-OR of more than one triggered
       
   439  event.
       
   440  The additional flag
   419 -.Va EV_PERSIST
   441 -.Va EV_PERSIST
   420 -makes an
   442 +EV_PERSIST
       
   443  makes an
   421 -.Fn event_add
   444 -.Fn event_add
   422 -persistent until
   445 +\fBevent_add\fP\fR
       
   446  persistent until
   423 -.Fn event_del
   447 -.Fn event_del
   424 +the type of event which will be either EV_TIMEOUT, EV_SIGNAL,
   448 +\fBevent_del\fP\fR
   425 +EV_READ, or EV_WRITE.  The additional flag EV_PERSIST makes an
       
   426 +\fIevent_add\fP\fR persistent until
       
   427 +\fIevent_del\fP\fR
       
   428  has been called.
   449  has been called.
   429 -.Pp
   450 -.Pp
   430 +.PP
   451 +.PP
   431  Once initialized, the
   452  Once initialized, the
   432 -.Fa ev
   453 -.Fa ev
   433 +\fIev\fP\fR
   454 +\fIev\fP\fR
   434  structure can be used repeatedly with
   455  structure can be used repeatedly with
   435 -.Fn event_add
   456 -.Fn event_add
   436 +\fIevent_add\fP\fR
   457 +\fBevent_add\fP\fR
   437  and
   458  and
   438 -.Fn event_del
   459 -.Fn event_del
   439 +\fIevent_del\fP\fR
   460 +\fBevent_del\fP\fR
   440  and does not need to be reinitialized unless the function called and/or
   461  and does not need to be reinitialized unless the function called and/or
   441  the argument to it are to be changed.
   462  the argument to it are to be changed.
   442  However, when an
   463  However, when an
   443 -.Fa ev
   464 -.Fa ev
   444 +\fIev\fP\fR
   465 +\fIev\fP\fR
   445  structure has been added to libevent using
   466  structure has been added to libevent using
   446 -.Fn event_add
   467 -.Fn event_add
   447 +\fIevent_add\fP\fR
   468 +\fBevent_add\fP\fR
   448  the structure must persist until the event occurs (assuming
   469  the structure must persist until the event occurs (assuming
   449 -.Fa EV_PERSIST
   470 -.Fa EV_PERSIST
   450 -is not set) or is removed
   471 +EV_PERSIST
   451 -using
   472  is not set) or is removed
       
   473  using
   452 -.Fn event_del .
   474 -.Fn event_del .
   453 +EV_PERSIST is not set) or is removed using
   475 +\fBevent_del\fP\fR.
   454 +\fIevent_del\fP\fR .
       
   455  You may not reuse the same
   476  You may not reuse the same
   456 -.Fa ev
   477 -.Fa ev
   457 +\fIev\fP\fR
   478 +\fIev\fP\fR
   458  structure for multiple monitored descriptors; each descriptor
   479  structure for multiple monitored descriptors; each descriptor
   459 -needs its own
   480  needs its own
   460 -.Fa ev .
   481 -.Fa ev .
   461 -.Pp
   482 -.Pp
   462 +needs its own \fIev\fP\fR .
   483 +\fIev\fP\fR.
   463 +.PP
   484 +.PP
   464  The function
   485  The function
   465 -.Fn event_add
   486 -.Fn event_add
   466 +\fIevent_add\fP\fR
   487 +\fBevent_add\fP\fR
   467  schedules the execution of the
   488  schedules the execution of the
   468 -.Fa ev
   489 -.Fa ev
   469 +\fIev\fP\fR
   490 +\fIev\fP\fR
   470  event when the event specified in
   491  event when the event specified in
   471 -.Fn event_set
   492 -.Fn event_set
   472 +\fBevent_set\fP\fR
   493 +\fBevent_set\fP\fR
   473  occurs or in at least the time specified in the
   494  occurs or in at least the time specified in the
   474 -.Fa tv .
   495 -.Fa tv .
   475 +\fItv\fP\fR .
   496 +\fItv\fP\fR
   476  If
   497  If
   477 -.Fa tv
   498 -.Fa tv
   478 -is
   499 +\fItv\fP\fR
       
   500  is
   479 -.Dv NULL ,
   501 -.Dv NULL ,
   480 -no timeout occurs and the function will only be called
   502 +\fINULL\fP\fR,
   481 +\fItv\fP\fR
   503  no timeout occurs and the function will only be called
   482 +is NULL, no timeout occurs and the function will only be called
       
   483  if a matching event occurs on the file descriptor.
   504  if a matching event occurs on the file descriptor.
   484  The event in the
   505  The event in the
   485 -.Fa ev
   506 -.Fa ev
   486 +\fIev\fP\fR
   507 +\fIev\fP\fR
   487  argument must be already initialized by
   508  argument must be already initialized by
   488 -.Fn event_set
   509 -.Fn event_set
   489 +\fIevent_set\fP\fR
   510 +\fBevent_set\fP\fR
   490  and may not be used in calls to
   511  and may not be used in calls to
   491 -.Fn event_set
   512 -.Fn event_set
   492 +\fIevent_set\fP\fR
   513 +\fBevent_set\fP\fR
   493  until it has timed out or been removed with
   514  until it has timed out or been removed with
   494 -.Fn event_del .
   515 -.Fn event_del .
   495 +\fIevent_del\fP\fR .
   516 +\fBevent_del\fP\fR.
   496  If the event in the
   517  If the event in the
   497 -.Fa ev
   518 -.Fa ev
   498 +\fIev\fP\fR
   519 +\fIev\fP\fR
   499  argument already has a scheduled timeout, the old timeout will be
   520  argument already has a scheduled timeout, the old timeout will be
   500  replaced by the new one.
   521  replaced by the new one.
   501 -.Pp
   522 -.Pp
   502 +.PP
   523 +.PP
   503  The function
   524  The function
   504 -.Fn event_del
   525 -.Fn event_del
   505 +\fIevent_del\fP\fR
   526 +\fBevent_del\fP\fR
   506  will cancel the event in the argument
   527  will cancel the event in the argument
   507 -.Fa ev .
   528 -.Fa ev .
   508 +\fIev\fP\fR .
   529 +\fIev\fP\fR.
   509  If the event has already executed or has never been added
   530  If the event has already executed or has never been added
   510  the call will have no effect.
   531  the call will have no effect.
   511 -.Pp
   532 -.Pp
   512 +.PP
   533 +.PP
       
   534  The functions
       
   535 -.Fn evtimer_set ,
       
   536 -.Fn evtimer_add ,
       
   537 -.Fn evtimer_del ,
       
   538 -.Fn evtimer_initialized ,
       
   539 +\fBevtimer_set\fP\fR,
       
   540 +\fBevtimer_add\fP\fR,
       
   541 +\fBevtimer_del\fP\fR,
       
   542 +\fBevtimer_initialized\fP\fR,
       
   543  and
       
   544 -.Fn evtimer_pending
       
   545 +\fBevtimer_pending\fP\fR
       
   546  are abbreviations for common situations where only a timeout is required.
       
   547  The file descriptor passed will be \-1, and the event type will be
       
   548 -.Va EV_TIMEOUT .
       
   549 -.Pp
       
   550 +EV_TIMEOUT.
       
   551 +.PP
       
   552  The functions
       
   553 -.Fn signal_set ,
       
   554 -.Fn signal_add ,
       
   555 -.Fn signal_del ,
       
   556 -.Fn signal_initialized ,
       
   557 +\fBsignal_set\fP\fR,
       
   558 +\fBsignal_add\fP\fR,
       
   559 +\fBsignal_del\fP\fR,
       
   560 +\fBsignal_initialized\fP\fR,
       
   561  and
       
   562 -.Fn signal_pending
       
   563 +\fBsignal_pending\fP\fR
       
   564  are abbreviations.
       
   565  The event type will be a persistent
       
   566 -.Va EV_SIGNAL .
       
   567 +EV_SIGNAL .
       
   568  That means
       
   569 -.Fn signal_set
       
   570 +\fBsignal_set\fP\fR
       
   571  adds
       
   572 -.Va EV_PERSIST .
       
   573 -.Pp
       
   574 +EV_PERSIST.
       
   575 +.PP
       
   576  In order to avoid races in signal handlers, the
       
   577 -.Nm event
       
   578 +\fIevent\fP\fR
       
   579  API provides two variables:
       
   580 -.Va event_sigcb
       
   581 +\fBevent_sigcb\fP\fR
       
   582  and
       
   583 -.Va event_gotsig .
       
   584 +\fBevent_gotsig\fP\fR.
       
   585  A signal handler
       
   586  sets
       
   587 -.Va event_gotsig
       
   588 +\fBevent_gotsig\fP\fR
       
   589  to indicate that a signal has been received.
       
   590  The application sets
       
   591 -.Va event_sigcb
       
   592 +\fBevent_sigcb\fP\fR
       
   593  to a callback function.
       
   594  After the signal handler sets
       
   595 -.Va event_gotsig ,
       
   596 -.Nm event_dispatch
       
   597 +\fBevent_gotsig\fP\fR,
       
   598 +\fBevent_dispatch()\fP\fR
       
   599  will execute the callback function to process received signals.
       
   600  The callback returns 1 when no events are registered any more.
       
   601  It can return \-1 to indicate an error to the
       
   602 -.Nm event
       
   603 +\fIevent\fP\fR
       
   604  library, causing
       
   605 -.Fn event_dispatch
       
   606 +\fBevent_dispatch\fP\fR
       
   607  to terminate with
       
   608 -.Va errno
       
   609 +\fBerrno\fP\fR
       
   610  set to
       
   611 -.Er EINTR .
       
   612 -.Pp
       
   613 +\fBEINTR\fP\fR.
       
   614 +.PP
   513  The function
   615  The function
   514 -.Fn event_once
   616 -.Fn event_once
   515 +\fIevent_once\fP\fR
   617 +\fBevent_once\fP\fR
   516  is similar to
   618  is similar to
   517 -.Fn event_set .
   619 -.Fn event_set .
   518 +\fIevent_set\fP\fR.
   620 +\fBevent_set\fP\fR.
   519  However, it schedules a callback to be called exactly once and does not
   621  However, it schedules a callback to be called exactly once and does not
   520  require the caller to prepare an
   622  require the caller to prepare an
   521 -.Fa event
   623 -.Fa event
   522 +\fIevent\fP\fR
   624 +\fIevent\fP\fR
   523  structure.
   625  structure.
   524 -This function supports
   626  This function supports
   525 -.Fa EV_TIMEOUT ,
   627 -.Fa EV_TIMEOUT ,
   526 -.Fa EV_READ ,
   628 -.Fa EV_READ ,
   527 -and
   629 +EV_TIMEOUT,
       
   630 +EV_READ,
       
   631  and
   528 -.Fa EV_WRITE .
   632 -.Fa EV_WRITE .
   529 -.Pp
   633 -.Pp
   530 +This function supports EV_TIMEOUT, EV_READ, and EV_WRITE.
   634 +EV_WRITE.
   531 +.PP
   635 +.PP
   532  The
   636  The
   533 -.Fn event_pending
   637  .Fn event_pending
   534 +\fIevent_pending\fP\fR
   638 +\fBevent_pending\fP\fR
   535  function can be used to check if the event specified by
   639  function can be used to check if the event specified by
   536 -.Fa event
   640 -.Fa event
   537 +\fIevent\fP\fR
   641 +\fIevent\fP\fR
   538  is pending to run.
   642  is pending to run.
   539 -If
   643  If
   540 -.Va EV_TIMEOUT
   644 -.Va EV_TIMEOUT
   541 -was specified and
   645 +EV_TIMEOUT
       
   646  was specified and
   542 -.Fa tv
   647 -.Fa tv
   543 -is not
   648 +\fItv\fP\fR
       
   649  is not
   544 -.Dv NULL ,
   650 -.Dv NULL ,
   545 +If EV_TIMEOUT was specified and
   651 +\fINULL\fP\fR,
   546 +\fItv\fP\fR
       
   547 +is not NULL ,
       
   548  the expiration time of the event will be returned in
   652  the expiration time of the event will be returned in
   549 -.Fa tv .
   653 -.Fa tv .
   550 -.Pp
   654 -.Pp
   551 +\fItv\fP\fR .
   655 +\fItv\fP\fR.
   552 +.PP
   656 +.PP
   553  The
   657  The
   554 -.Fn event_initialized
   658 -.Fn event_initialized
   555 +\fIevent_initialized\fP\fR
   659 +\fBevent_initialized\fP\fR
   556  macro can be used to check if an event has been initialized.
   660  macro can be used to check if an event has been initialized.
   557 -.Pp
   661 -.Pp
   558 +.PP
   662 +.PP
   559  The functions
   663  The
   560 -.Fn evtimer_set ,
   664 -.Nm event_loop
   561 -.Fn evtimer_add ,
   665 +\fBevent_loop\fP\fR
   562 -.Fn evtimer_del ,
   666  function provides an interface for single pass execution of pending
   563 -.Fn evtimer_initialized ,
   667  events.
   564 +\fIevtimer_set()\fP\fR,
   668  The flags
   565 +\fIevtimer_add()\fP\fR,
   669 -.Va EVLOOP_ONCE
   566 +\fIevtimer_del()\fP\fR,
   670 +EVLOOP_ONCE
   567 +\fIevtimer_initialized()\fP\fR,
       
   568  and
   671  and
   569 -.Fn evtimer_pending
   672 -.Va EVLOOP_NONBLOCK
   570 +\fIevtimer_pending()\fP\fR
   673 +EVLOOP_NONBLOCK
   571  are abbreviations for common situations where only a timeout is required.
   674  are recognized.
   572  The file descriptor passed will be \-1, and the event type will be
   675  The
   573 -.Va EV_TIMEOUT .
   676 -.Nm event_loopexit
   574 -.Pp
   677 +\fBevent_loopexit\fP\fR
   575 +EV_TIMEOUT .
   678  function exits from the event loop. The next
   576 +.PP
   679 -.Fn event_loop
   577  The functions
   680 +\fBevent_loop\fP\fR
   578 -.Fn signal_set ,
   681  iteration after the
   579 -.Fn signal_add ,
   682  given timer expires will complete normally (handling all queued events) then
   580 -.Fn signal_del ,
   683  exit without blocking for events again. Subsequent invocations of
   581 -.Fn signal_initialized ,
   684 -.Fn event_loop
   582 +\fIsignal_set()\fP\fR,
   685 +\fBevent_loop\fP\fR
   583 +\fIsignal_add()\fP]\fR,
   686  will proceed normally.
   584 +\fIsignal_del()\fP\fR ,
   687  The
   585 +\fIsignal_initialized()\fP\fR,
   688 -.Nm event_loopbreak
   586  and
   689 +\fBevent_loopbreak\fP\fR
   587 -.Fn signal_pending
   690  function exits from the event loop immediately.
   588 +\fIsignal_pending()\fP\fR
   691 -.Fn event_loop
   589  are abbreviations.
   692 +\fBevent_loop\fP\fR
   590 -The event type will be a persistent
   693  will abort after the next event is completed;
   591 -.Va EV_SIGNAL .
   694 -.Fn event_loopbreak
   592 +The event type will be a persistent EV_SIGNAL .
   695 +\fBevent_loopbreak\fP\fR
   593  That means
   696  is typically invoked from this event's callback. This behavior is analogous
   594 -.Fn signal_set
   697  to the "break;" statement. Subsequent invocations of
   595 -adds
   698 -.Fn event_loop
   596 -.Va EV_PERSIST .
   699 +\fBevent_loop\fP\fR
   597 -.Pp
   700  will proceed normally.
   598 +\fIsignal_set\fP\fR adds EV_PERSIST .
   701 -.Pp
   599 +.PP
   702 +.PP
   600  It is possible to disable support for
   703  It is the responsibility of the caller to provide these functions with
   601 -.Va epoll , kqueue , devpoll , poll
   704  pre-allocated event structures.
   602 -or
   705 -.Pp
   603 -.Va select
       
   604 +epoll, kqueue, devpoll, event ports, poll or select
       
   605  by setting the environment variable
       
   606 -.Va EVENT_NOEPOLL , EVENT_NOKQUEUE , EVENT_NODEVPOLL , EVENT_NOPOLL
       
   607 -or
       
   608 -.Va EVENT_NOSELECT ,
       
   609 -respectively.
       
   610 +EVENT_NOEPOLL, EVENT_NOKQUEUE, EVENT_NODEVPOLL, EVENT_NOEVPORT,
       
   611 +EVENT_NOPOLL or EVENT_NOSELECT, respectively.
       
   612  By setting the environment variable
       
   613 -.Va EVENT_SHOW_METHOD ,
       
   614 -.Nm libevent
       
   615 +EVENT_SHOW_METHOD,
       
   616 +\fIlibevent\fP\fR
       
   617  displays the kernel notification method that it uses.
       
   618 -.Sh EVENT PRIORITIES
   706 -.Sh EVENT PRIORITIES
       
   707 +.PP
   619 +.SH EVENT PRIORITIES
   708 +.SH EVENT PRIORITIES
   620  By default
   709  By default
   621 -.Nm libevent
   710 -.Nm libevent
   622 +\fIlibevent\fP\fR
   711 +\fIlibevent\fP\fR
   623  schedules all active events with the same priority.
   712  schedules all active events with the same priority.
   631  with a higher priority.
   720  with a higher priority.
   632 -.Pp
   721 -.Pp
   633 +.PP
   722 +.PP
   634  The number of different priorities can be set initially with the
   723  The number of different priorities can be set initially with the
   635 -.Fn event_priority_init
   724 -.Fn event_priority_init
   636 +\fIevent_priority_init()\fP\fR
   725 +\fBevent_priority_init\fP\fR
   637  function.
   726  function.
   638  This function should be called before the first call to
   727  This function should be called before the first call to
   639 -.Fn event_dispatch .
   728 -.Fn event_dispatch .
   640 +\fIevent_dispatch()\fP\fR .
   729 +\fBevent_dispatch\fP\fR.
   641  The
   730  The
   642 -.Fn event_priority_set
   731 -.Fn event_priority_set
   643 +\fIevent_priority_set()\fP\fR
   732 +\fBevent_priority_set\fP\fR
   644  function can be used to assign a priority to an event.
   733  function can be used to assign a priority to an event.
   645  By default,
   734  By default,
   646 -.Nm libevent
   735 -.Nm libevent
   647 +\fIlibevent\fP\fR
   736 +\fIlibevent\fP\fR
   648  assigns the middle priority to all events unless their priority
   737  assigns the middle priority to all events unless their priority
   651 -.Nm Libevent
   740 -.Nm Libevent
   652 +.SH THREAD SAFE EVENTS
   741 +.SH THREAD SAFE EVENTS
   653 +\fIlibevent\fP\fR
   742 +\fIlibevent\fP\fR
   654  has experimental support for thread-safe events.
   743  has experimental support for thread-safe events.
   655  When initializing the library via
   744  When initializing the library via
   656 -.Fn event_init ,
   745  .Fn event_init ,
   657 +\fIevent_init()\fP\fR,
       
   658  an event base is returned.
   746  an event base is returned.
   659  This event base can be used in conjunction with calls to
   747  This event base can be used in conjunction with calls to
   660 -.Fn event_base_set ,
   748 -.Fn event_base_set ,
   661 -.Fn event_base_dispatch ,
   749 -.Fn event_base_dispatch ,
   662 -.Fn event_base_loop ,
   750 -.Fn event_base_loop ,
   663 -.Fn event_base_loopexit ,
   751 -.Fn event_base_loopexit ,
   664 -.Fn bufferevent_base_set
   752 -.Fn bufferevent_base_set
   665 +\fIevent_base_set()\fP\fR,
   753 +\fBevent_base_set()\fP\fR,
   666 +\fIevent_base_dispatch()\fP\fR,
   754 +\fBevent_base_dispatch()\fP\fR,
   667 +\fIevent_base_loop()\fP\fR,
   755 +\fBevent_base_loop()\fP\fR,
   668 +\fIevent_base_loopexit()\fP\fR,
   756 +\fBevent_base_loopexit()\fP\fR,
   669 +\fIbufferevent_base_set()\fP\fR
   757 +\fBbufferevent_base_set()\fP\fR
   670  and
   758  and
   671 -.Fn event_base_free .
   759 -.Fn event_base_free .
   672 -.Fn event_base_set
   760 -.Fn event_base_set
   673 +\fIevent_base_free()\fP\fR.
   761 +\fBevent_base_free()\fP\fR.
   674 +\fIevent_base_set()\fP\fR 
   762 +\fBevent_base_set()\fP\fR 
   675  should be called after preparing an event with
   763  should be called after preparing an event with
   676 -.Fn event_set ,
   764 -.Fn event_set ,
   677 +\fIevent_set()\fP\fR,
   765 +\fBevent_set()\fP\fR,
   678  as
   766  as
   679 -.Fn event_set
   767 -.Fn event_set
   680 +\fIevent_set()\fP\fR
   768 +\fBevent_set()\fP\fR,
   681  assigns the provided event to the most recently created event base.
   769  assigns the provided event to the most recently created event base.
   682 -.Fn bufferevent_base_set
   770 -.Fn bufferevent_base_set
   683 +\fIbufferevent_base_set()\fP\fR
   771 +\fBbufferevent_base_set()\fP\fR
   684  should be called after preparing a bufferevent with
   772  should be called after preparing a bufferevent with
   685 -.Fn bufferevent_new .
   773 -.Fn bufferevent_new .
   686 -.Fn event_base_free
   774 -.Fn event_base_free
   687 +\fIbufferevent_new()\fP\fR.
   775 +\fBbufferevent_new()\fP\fR.
   688 +\fIevent_base_free()\fP\fR
   776 +\fBevent_base_free()\fP\fR
   689  should be used to free memory associated with the event base
   777  should be used to free memory associated with the event base
   690  when it is no longer needed.
   778  when it is no longer needed.
   691 -.Sh BUFFERED EVENTS
   779 -.Sh BUFFERED EVENTS
   692 -.Nm libevent
   780 -.Nm libevent
   693 +.SH BUFFERED EVENTS
   781 +.SH BUFFERED EVENTS
   702  but instead is reading from input and writing to output buffers.
   790  but instead is reading from input and writing to output buffers.
   703 -.Pp
   791 -.Pp
   704 +.PP
   792 +.PP
   705  A new bufferevent is created by
   793  A new bufferevent is created by
   706 -.Fn bufferevent_new .
   794 -.Fn bufferevent_new .
   707 +\fIbufferevent_new()\fP\fR.
   795 +\fBbufferevent_new()\fP\fR.
   708  The parameter
   796  The parameter
   709 -.Fa fd
   797 -.Fa fd
   710 +\fIfd\fP\fR
   798 +\fIfd\fP\fR
   711  specifies the file descriptor from which data is read and written to.
   799  specifies the file descriptor from which data is read and written to.
   712  This file descriptor is not allowed to be a
   800  This file descriptor is not allowed to be a
   721 -.Ft void
   809 -.Ft void
   722 -.Fn "(*cb)" "struct bufferevent *bufev" "short what" "void *arg" .
   810 -.Fn "(*cb)" "struct bufferevent *bufev" "short what" "void *arg" .
   723 +\fBvoid \fB(*cb)\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBshort \fIwhat\fP\fR, \fBvoid* \fIarg\fP\fR).
   811 +\fBvoid \fB(*cb)\fR\fR(\fBstruct bufferevent* \fIbufev\fP\fR, \fBshort \fIwhat\fP\fR, \fBvoid* \fIarg\fP\fR).
   724  The argument is specified by the fourth parameter
   812  The argument is specified by the fourth parameter
   725 -.Fa "cbarg" .
   813 -.Fa "cbarg" .
   726 +\fIcbarg\fP\fR.
   814 +\fBcbarg\fP\fR.
   727  A
   815  A
   728 -.Fa bufferevent struct
   816 -.Fa bufferevent struct
   729 +\fIbufferevent\fP\fR struct
   817 -pointer is returned on success, NULL on error.
   730  pointer is returned on success, NULL on error.
   818 -Both the read and the write callback may be NULL.
   731  Both the read and the write callback may be NULL.
   819 +\fBstruct bufferevent\fP\fR
       
   820 +pointer is returned on success, \fINULL\fP\fR on error.
       
   821 +Both the read and the write callback may be \fINULL\fP\fR.
   732  The error callback has to be always provided.
   822  The error callback has to be always provided.
   733 -.Pp
   823 -.Pp
   734 +.PP
   824 +.PP
   735  Once initialized, the bufferevent structure can be used repeatedly with
   825  Once initialized, the bufferevent structure can be used repeatedly with
   736 -bufferevent_enable() and bufferevent_disable().
   826  bufferevent_enable() and bufferevent_disable().
   737 -The flags parameter can be a combination of
   827  The flags parameter can be a combination of
   738 -.Va EV_READ
   828 -.Va EV_READ
   739 -and
   829 +EV_READ
       
   830  and
   740 -.Va EV_WRITE .
   831 -.Va EV_WRITE .
   741 +\fIbufferevent_enable()\fP\fR and \fIbufferevent_disable()\fP\fR.
   832 +EV_WRITE .
   742 +The \fIflags\fP\fR parameter can be a combination of
       
   743 +EV_READ and EV_WRITE .
       
   744  When read enabled the bufferevent will try to read from the file
   833  When read enabled the bufferevent will try to read from the file
   745  descriptor and call the read callback.
   834  descriptor and call the read callback.
   746  The write callback is executed
   835  The write callback is executed
   747  whenever the output buffer is drained below the write low watermark,
   836  whenever the output buffer is drained below the write low watermark,
   748 -which is
   837  which is
   749 -.Va 0
   838 -.Va 0
   750 -by default.
   839 +\fI0\fP\fR
   751 -.Pp
   840  by default.
   752 +which is 0 by default.
   841 -.Pp
   753 +.PP
   842 +.PP
   754  The
   843  The
   755 -.Fn bufferevent_write
   844 -.Fn bufferevent_write
   756 +\fIbufferevent_write()\fP\fR
   845 +\fBbufferevent_write()\fP\fR
   757  function can be used to write data to the file descriptor.
   846  function can be used to write data to the file descriptor.
   758  The data is appended to the output buffer and written to the descriptor
   847  The data is appended to the output buffer and written to the descriptor
   759  automatically as it becomes available for writing.
   848  automatically as it becomes available for writing.
   760 -.Fn bufferevent_write
   849 -.Fn bufferevent_write
   761 +\fIbufferevent_write()\fP\fR
   850 +\fBbufferevent_write()\fP\fR
   762  returns 0 on success or \-1 on failure.
   851  returns 0 on success or \-1 on failure.
   763  The
   852  The
   764 -.Fn bufferevent_read
   853 -.Fn bufferevent_read
   765 +\fIbufferevent_read()\fP\fR
   854 +\fBbufferevent_read()\fP\fR
   766  function is used to read data from the input buffer,
   855  function is used to read data from the input buffer,
   767  returning the amount of data read.
   856  returning the amount of data read.
   768 -.Pp
   857 -.Pp
   769 +.PP
   858 +.PP
       
   859  If multiple bases are in use, bufferevent_base_set() must be called before
       
   860  enabling the bufferevent for the first time.
       
   861  .Sh NON-BLOCKING HTTP SUPPORT
       
   862 @@ -549,74 +550,74 @@
       
   863  .Pp
   770  If multiple bases are in use, bufferevent_base_set() must be called before
   864  If multiple bases are in use, bufferevent_base_set() must be called before
   771  enabling the bufferevent for the first time.
   865  enabling the bufferevent for the first time.
   772 -.Sh NON-BLOCKING HTTP SUPPORT
   866 -.Sh NON-BLOCKING HTTP SUPPORT
   773 -.Nm libevent
   867 -.Nm libevent
   774 -provides a very thin HTTP layer that can be used both to host an HTTP
   868 +.SH NON-BLOCKING HTTP SUPPORT
   775 -server and also to make HTTP requests.
   869 +\fIlibevent\fP\fR
   776 -An HTTP server can be created by calling
   870  provides a very thin HTTP layer that can be used both to host an HTTP
   777 -.Fn evhttp_start .
   871  server and also to make HTTP requests.
   778 -When the HTTP server is no longer used, it can be freed via
   872  An HTTP server can be created by calling
       
   873 -.Fn evhttp_new .
       
   874 +\fBevhttp_new\fP\fR.
       
   875  It can be bound to any port and address with the
       
   876 -.Fn evhttp_bind_socket
       
   877 +\fBevhttp_bind_socket\fP\fR
       
   878  function.
       
   879  When the HTTP server is no longer used, it can be freed via
   779 -.Fn evhttp_free .
   880 -.Fn evhttp_free .
   780 -.Pp
   881 -.Pp
   781 -To be notified of HTTP requests, a user needs to register callbacks with the
   882 +\fBevhttp_free\fP\fR.
   782 -HTTP server.
   883 +.PP
   783 -This can be done by calling
   884  To be notified of HTTP requests, a user needs to register callbacks with the
       
   885  HTTP server.
       
   886  This can be done by calling
   784 -.Fn evhttp_set_cb .
   887 -.Fn evhttp_set_cb .
   785 -The second argument is the URI for which a callback is being registered.
   888 +\fBevhttp_set_cb\fP\fR.
   786 -The corresponding callback will receive an
   889  The second argument is the URI for which a callback is being registered.
       
   890  The corresponding callback will receive an
   787 -.Va struct evhttp_request
   891 -.Va struct evhttp_request
   788 -object that contains all information about the request.
   892 +\fIstruct evhttp_request\fP\fR
   789 -.Pp
   893  object that contains all information about the request.
   790 -This section does not document all the possible function calls; please
   894 -.Pp
   791 -check
   895 +.PP
       
   896  This section does not document all the possible function calls; please
       
   897  check
   792 -.Va event.h
   898 -.Va event.h
   793 -for the public interfaces.
   899 +\fBevent.h\fP\fR
       
   900  for the public interfaces.
       
   901 -.Sh ADDITIONAL NOTES
       
   902 +.SH ADDITIONAL NOTES
       
   903  It is possible to disable support for
       
   904 -.Va epoll , kqueue , devpoll , poll
       
   905 +\fBepoll , kqueue , devpoll , poll\fP\fR
       
   906  or
       
   907 -.Va select
       
   908 +\fBselect\fP\fR
       
   909  by setting the environment variable
       
   910 -.Va EVENT_NOEPOLL , EVENT_NOKQUEUE , EVENT_NODEVPOLL , EVENT_NOPOLL
       
   911 +EVENT_NOEPOLL, EVENT_NOKQUEUE, EVENT_NODEVPOLL, EVENT_NOPOLL
       
   912  or
       
   913 -.Va EVENT_NOSELECT ,
       
   914 +EVENT_NOSELECT,
       
   915  respectively.
       
   916  By setting the environment variable
       
   917 -.Va EVENT_SHOW_METHOD ,
       
   918 -.Nm libevent
       
   919 +EVENT_SHOW_METHOD,
       
   920 +\fIlibevent\fP\fR
       
   921  displays the kernel notification method that it uses.
   794 -.Sh RETURN VALUES
   922 -.Sh RETURN VALUES
   795 +.SH RETURN VALUES
   923 +.SH RETURN VALUES
   796  Upon successful completion
   924  Upon successful completion
   797 -.Fn event_add
   925 -.Fn event_add
   798 +\fIevent_add()\fP\fR
   926 +\fBevent_add\fP\fR
   799  and
   927  and
   800 -.Fn event_del
   928 -.Fn event_del
   801 +\fIevent_del()\fP\fR
   929 +\fBevent_del\fP\fR
   802  return 0.
   930  return 0.
   803  Otherwise, \-1 is returned and the global variable errno is
   931  Otherwise, \-1 is returned and the global variable errno is
   804  set to indicate the error.
   932  set to indicate the error.
   805 -.Sh SEE ALSO
   933 -.Sh SEE ALSO
   806 -.Xr kqueue 2 ,
   934 -.Xr kqueue 2 ,
   811 -.Sh HISTORY
   939 -.Sh HISTORY
   812 +.SH SEE ALSO
   940 +.SH SEE ALSO
   813 +\fBpoll(2)\fR,
   941 +\fBpoll(2)\fR,
   814 +\fBselect(3C)\fR,
   942 +\fBselect(3C)\fR,
   815 +\fBport_create(3C)\fR,
   943 +\fBport_create(3C)\fR,
       
   944 +\fBevdns(3)\fR,
   816 +\fBtimeout(9f)\fR.
   945 +\fBtimeout(9f)\fR.
   817 +.SH HISTORY
   946 +.SH HISTORY
   818  The
   947  The
   819 -.Nm event
   948 -.Nm event
   820 +\fIlibevent\fR
   949 +\fIevent\fP\fR
   821  API manpage is based on the
   950  API manpage is based on the
   822 -.Xr timeout 9
   951 -.Xr timeout 9
   823 +\fBtimeout(9)\fR
   952 +\fBtimeout(9)\fR
   824  manpage by Artur Grabowski.
   953  manpage by Artur Grabowski.
   825  The port of
   954  The port of
   836 -.Sh BUGS
   965 -.Sh BUGS
   837 +.SH BUGS
   966 +.SH BUGS
   838  This documentation is neither complete nor authoritative.
   967  This documentation is neither complete nor authoritative.
   839  If you are in doubt about the usage of this API then
   968  If you are in doubt about the usage of this API then
   840  check the source code to find out how it works, write
   969  check the source code to find out how it works, write
   841  up the missing piece of documentation and send it to
       
   842  me for inclusion in this man page.
       
   843 +