libevent
2.2.1
Event notification library
|
Go to the documentation of this file.
27 #ifndef EVENT2_LISTENER_H_INCLUDED_
28 #define EVENT2_LISTENER_H_INCLUDED_
30 #include <event2/visibility.h>
39 struct evconnlistener;
51 typedef void (*evconnlistener_cb)(
struct evconnlistener *,
evutil_socket_t,
struct sockaddr *,
int socklen,
void *);
63 #define LEV_OPT_LEAVE_SOCKETS_BLOCKING (1u<<0)
66 #define LEV_OPT_CLOSE_ON_FREE (1u<<1)
68 #define LEV_OPT_CLOSE_ON_EXEC (1u<<2)
71 #define LEV_OPT_REUSEABLE (1u<<3)
74 #define LEV_OPT_THREADSAFE (1u<<4)
77 #define LEV_OPT_DISABLED (1u<<5)
91 #define LEV_OPT_DEFERRED_ACCEPT (1u<<6)
104 #define LEV_OPT_REUSEABLE_PORT (1u<<7)
116 #define LEV_OPT_BIND_IPV6ONLY (1u<<8)
125 #define LEV_OPT_BIND_IPV4_AND_IPV6 (1u<<9)
146 evconnlistener_cb cb,
void *ptr,
unsigned flags,
int backlog,
165 evconnlistener_cb cb,
void *ptr,
unsigned flags,
int backlog,
166 const struct sockaddr *sa,
int socklen);
195 evconnlistener_cb cb,
void *arg);
Structure to hold information and state for a Libevent dispatch loop.
Definition: event.h:219
EVENT2_EXPORT_SYMBOL evutil_socket_t evconnlistener_get_fd(struct evconnlistener *lev)
Return the socket that an evconnlistner is listening on.
EVENT2_EXPORT_SYMBOL struct evconnlistener * evconnlistener_new(struct event_base *base, evconnlistener_cb cb, void *ptr, unsigned flags, int backlog, evutil_socket_t fd)
Allocate a new evconnlistener object to listen for incoming TCP connections on a given file descripto...
Core functions for waiting for and receiving events, and using event bases.
EVENT2_EXPORT_SYMBOL struct evconnlistener * evconnlistener_new_bind(struct event_base *base, evconnlistener_cb cb, void *ptr, unsigned flags, int backlog, const struct sockaddr *sa, int socklen)
Allocate a new evconnlistener object to listen for incoming TCP connections on a given address.
void(* evconnlistener_errorcb)(struct evconnlistener *, void *)
A callback that we invoke when a listener encounters a non-retriable error.
Definition: listener.h:59
EVENT2_EXPORT_SYMBOL int evconnlistener_disable(struct evconnlistener *lev)
Stop listening for connections on an evconnlistener.
EVENT2_EXPORT_SYMBOL void evconnlistener_free(struct evconnlistener *lev)
Disable and deallocate an evconnlistener.
EVENT2_EXPORT_SYMBOL void evconnlistener_set_cb(struct evconnlistener *lev, evconnlistener_cb cb, void *arg)
Change the callback on the listener to cb and its user_data to arg.
EVENT2_EXPORT_SYMBOL struct event_base * evconnlistener_get_base(struct evconnlistener *lev)
Return an evconnlistener's associated event_base.
EVENT2_EXPORT_SYMBOL int evconnlistener_enable(struct evconnlistener *lev)
Re-enable an evconnlistener that has been disabled.
EVENT2_EXPORT_SYMBOL void evconnlistener_set_error_cb(struct evconnlistener *lev, evconnlistener_errorcb errorcb)
Set an evconnlistener's error callback.
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition: util.h:325