mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
parent
83b1584700
commit
9081b66c9c
@ -314,13 +314,16 @@ extern const struct bufferevent_ops bufferevent_ops_async;
|
||||
#endif
|
||||
|
||||
/** Initialize the shared parts of a bufferevent. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_init_common_(struct bufferevent_private *, struct event_base *, const struct bufferevent_ops *, enum bufferevent_options options);
|
||||
|
||||
/** For internal use: temporarily stop all reads on bufev, until the conditions
|
||||
* in 'what' are over. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_suspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
|
||||
/** For internal use: clear the conditions 'what' on bufev, and re-enable
|
||||
* reading if there are no conditions left. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_unsuspend_read_(struct bufferevent *bufev, bufferevent_suspend_flags what);
|
||||
|
||||
/** For internal use: temporarily stop all writes on bufev, until the conditions
|
||||
@ -347,16 +350,19 @@ void bufferevent_unsuspend_write_(struct bufferevent *bufev, bufferevent_suspend
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see bufferevent_disable()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_disable_hard_(struct bufferevent *bufev, short event);
|
||||
|
||||
/** Internal: Set up locking on a bufferevent. If lock is set, use it.
|
||||
* Otherwise, use a new lock. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_enable_locking_(struct bufferevent *bufev, void *lock);
|
||||
/** Internal: backwards compat macro for the now public function
|
||||
* Increment the reference count on bufev. */
|
||||
#define bufferevent_incref_(bufev) bufferevent_incref(bufev)
|
||||
/** Internal: Lock bufev and increase its reference count.
|
||||
* unlocking it otherwise. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_incref_and_lock_(struct bufferevent *bufev);
|
||||
/** Internal: backwards compat macro for the now public function
|
||||
* Decrement the reference count on bufev. Returns 1 if it freed
|
||||
@ -365,17 +371,21 @@ void bufferevent_incref_and_lock_(struct bufferevent *bufev);
|
||||
|
||||
/** Internal: Drop the reference count on bufev, freeing as necessary, and
|
||||
* unlocking it otherwise. Returns 1 if it freed the bufferevent. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_decref_and_unlock_(struct bufferevent *bufev);
|
||||
|
||||
/** Internal: If callbacks are deferred and we have a read callback, schedule
|
||||
* a readcb. Otherwise just run the readcb. Ignores watermarks. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_run_readcb_(struct bufferevent *bufev, int options);
|
||||
/** Internal: If callbacks are deferred and we have a write callback, schedule
|
||||
* a writecb. Otherwise just run the writecb. Ignores watermarks. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_run_writecb_(struct bufferevent *bufev, int options);
|
||||
/** Internal: If callbacks are deferred and we have an eventcb, schedule
|
||||
* it to run with events "what". Otherwise just run the eventcb.
|
||||
* See bufferevent_trigger_event for meaning of "options". */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_run_eventcb_(struct bufferevent *bufev, short what, int options);
|
||||
|
||||
/** Internal: Run or schedule (if deferred or options contain
|
||||
@ -399,6 +409,7 @@ bufferevent_trigger_nolock_(struct bufferevent *bufev, short iotype, int options
|
||||
|
||||
/** Internal: Add the event 'ev' with timeout tv, unless tv is set to 0, in
|
||||
* which case add ev with no timeout. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
|
||||
|
||||
/* =========
|
||||
@ -408,16 +419,21 @@ int bufferevent_add_event_(struct event *ev, const struct timeval *tv);
|
||||
/** Internal use: Set up the ev_read and ev_write callbacks so that
|
||||
* the other "generic_timeout" functions will work on it. Call this from
|
||||
* the constructor function. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_init_generic_timeout_cbs_(struct bufferevent *bev);
|
||||
/** Internal use: Add or delete the generic timeout events as appropriate.
|
||||
* (If an event is enabled and a timeout is set, we add the event. Otherwise
|
||||
* we delete it.) Call this from anything that changes the timeout values,
|
||||
* that enabled EV_READ or EV_WRITE, or that disables EV_READ or EV_WRITE. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_generic_adj_timeouts_(struct bufferevent *bev);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_generic_adj_existing_timeouts_(struct bufferevent *bev);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
enum bufferevent_options bufferevent_get_options_(struct bufferevent *bev);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
const struct sockaddr*
|
||||
bufferevent_socket_get_conn_address_(struct bufferevent *bev);
|
||||
|
||||
@ -465,11 +481,15 @@ bufferevent_socket_get_conn_address_(struct bufferevent *bev);
|
||||
|
||||
/* ==== For rate-limiting. */
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_decrement_write_buckets_(struct bufferevent_private *bev,
|
||||
ev_ssize_t bytes);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int bufferevent_decrement_read_buckets_(struct bufferevent_private *bev,
|
||||
ev_ssize_t bytes);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
ev_ssize_t bufferevent_get_read_max_(struct bufferevent_private *bev);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
ev_ssize_t bufferevent_get_write_max_(struct bufferevent_private *bev);
|
||||
|
||||
int bufferevent_ratelim_init_(struct bufferevent_private *bev);
|
||||
|
@ -46,6 +46,7 @@ typedef void (*deferred_cb_fn)(struct event_callback *, void *);
|
||||
@param cb The function to run when the struct event_callback executes.
|
||||
@param arg The function's second argument.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_deferred_cb_init_(struct event_callback *, ev_uint8_t, deferred_cb_fn, void *);
|
||||
/**
|
||||
Change the priority of a non-pending event_callback.
|
||||
@ -54,12 +55,14 @@ void event_deferred_cb_set_priority_(struct event_callback *, ev_uint8_t);
|
||||
/**
|
||||
Cancel a struct event_callback if it is currently scheduled in an event_base.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_deferred_cb_cancel_(struct event_base *, struct event_callback *);
|
||||
/**
|
||||
Activate a struct event_callback if it is not currently scheduled in an event_base.
|
||||
|
||||
Return true if it was not previously scheduled.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int event_deferred_cb_schedule_(struct event_base *, struct event_callback *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -421,16 +421,19 @@ int event_del_nolock_(struct event *ev, int blocking);
|
||||
int event_remove_timer_nolock_(struct event *ev);
|
||||
|
||||
void event_active_nolock_(struct event *ev, int res, short count);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int event_callback_activate_(struct event_base *, struct event_callback *);
|
||||
int event_callback_activate_nolock_(struct event_base *, struct event_callback *);
|
||||
int event_callback_cancel_(struct event_base *base,
|
||||
struct event_callback *evcb);
|
||||
|
||||
void event_callback_finalize_nolock_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_callback_finalize_(struct event_base *base, unsigned flags, struct event_callback *evcb, void (*cb)(struct event_callback *, void *));
|
||||
int event_callback_finalize_many_(struct event_base *base, int n_cbs, struct event_callback **evcb, void (*cb)(struct event_callback *, void *));
|
||||
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_active_later_(struct event *ev, int res);
|
||||
void event_active_later_nolock_(struct event *ev, int res);
|
||||
int event_callback_activate_later_nolock_(struct event_base *base,
|
||||
@ -441,6 +444,7 @@ void event_callback_init_(struct event_base *base,
|
||||
struct event_callback *cb);
|
||||
|
||||
/* FIXME document. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_base_add_virtual_(struct event_base *base);
|
||||
void event_base_del_virtual_(struct event_base *base);
|
||||
|
||||
@ -450,6 +454,7 @@ void event_base_del_virtual_(struct event_base *base);
|
||||
|
||||
Returns on success; aborts on failure.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_base_assert_ok_(struct event_base *base);
|
||||
void event_base_assert_ok_nolock_(struct event_base *base);
|
||||
|
||||
|
1
event.c
1
event.c
@ -123,6 +123,7 @@ static const struct eventop *eventops[] = {
|
||||
};
|
||||
|
||||
/* Global state; deprecated */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct event_base *event_global_current_base_ = NULL;
|
||||
#define current_base event_global_current_base_
|
||||
|
||||
|
@ -93,9 +93,13 @@
|
||||
a final padding nibble with value 0 is appended.
|
||||
*/
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evtag_decode_int(ev_uint32_t *pnumber, struct evbuffer *evbuf);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evtag_decode_int64(ev_uint64_t *pnumber, struct evbuffer *evbuf);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evtag_encode_tag(struct evbuffer *evbuf, ev_uint32_t tag);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evtag_decode_tag(ev_uint32_t *ptag, struct evbuffer *evbuf);
|
||||
|
||||
void
|
||||
|
@ -49,9 +49,12 @@ struct event_base;
|
||||
#if ! defined(EVENT__DISABLE_THREAD_SUPPORT) && defined(EVTHREAD_EXPOSE_STRUCTS)
|
||||
/* Global function pointers to lock-related functions. NULL if locking isn't
|
||||
enabled. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
extern struct evthread_lock_callbacks evthread_lock_fns_;
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
extern struct evthread_condition_callbacks evthread_cond_fns_;
|
||||
extern unsigned long (*evthread_id_fn_)(void);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
extern int evthread_lock_debugging_enabled_;
|
||||
|
||||
/** Return the ID of the current thread, or 1 if threading isn't enabled. */
|
||||
@ -355,6 +358,7 @@ EVLOCK_TRY_LOCK_(void *lock)
|
||||
EVLOCK_UNLOCK(lock1_tmplock_,mode1); \
|
||||
} while (0)
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evthread_is_debug_lock_held_(void *lock);
|
||||
void *evthread_debug_get_real_lock_(void *lock);
|
||||
|
||||
@ -377,6 +381,7 @@ int evutil_global_setup_locks_(const int enable_locks);
|
||||
int evutil_secure_rng_global_setup_locks_(const int enable_locks);
|
||||
|
||||
/** Return current evthread_lock_callbacks */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evthread_lock_callbacks *evthread_get_lock_callbacks(void);
|
||||
/** Return current evthread_condition_callbacks */
|
||||
struct evthread_condition_callbacks *evthread_get_condition_callbacks(void);
|
||||
|
@ -46,7 +46,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef EVENT__DISABLE_DEBUG_MODE
|
||||
extern int event_debug_created_threadable_ctx_;
|
||||
extern int event_debug_created_threadable_ctx_;
|
||||
extern int event_debug_mode_on_;
|
||||
#endif
|
||||
|
||||
|
@ -184,12 +184,15 @@ int evhttp_connection_connect_(struct evhttp_connection *);
|
||||
|
||||
enum evhttp_request_error;
|
||||
/* notifies the current request that it failed; resets connection */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evhttp_connection_fail_(struct evhttp_connection *,
|
||||
enum evhttp_request_error error);
|
||||
|
||||
enum message_read_status;
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
enum message_read_status evhttp_parse_firstline_(struct evhttp_request *, struct evbuffer*);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
enum message_read_status evhttp_parse_headers_(struct evhttp_request *, struct evbuffer*);
|
||||
|
||||
void evhttp_start_read_(struct evhttp_connection *);
|
||||
@ -199,6 +202,7 @@ void evhttp_start_write_(struct evhttp_connection *);
|
||||
void evhttp_response_code_(struct evhttp_request *, int, const char *);
|
||||
void evhttp_send_page_(struct evhttp_request *, struct evbuffer *);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evhttp_decode_uri_internal(const char *uri, size_t length,
|
||||
char *ret, int decode_plus);
|
||||
|
||||
|
@ -28,6 +28,8 @@
|
||||
#ifndef EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
|
||||
#define EVENT2_BUFFEREVENT_COMPAT_H_INCLUDED_
|
||||
|
||||
#include <event2/visibility.h>
|
||||
|
||||
#define evbuffercb bufferevent_data_cb
|
||||
#define everrorcb bufferevent_event_cb
|
||||
|
||||
@ -72,6 +74,7 @@
|
||||
error occurred
|
||||
@see bufferevent_base_set(), bufferevent_free()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct bufferevent *bufferevent_new(evutil_socket_t fd,
|
||||
evbuffercb readcb, evbuffercb writecb, everrorcb errorcb, void *cbarg);
|
||||
|
||||
@ -83,6 +86,7 @@ struct bufferevent *bufferevent_new(evutil_socket_t fd,
|
||||
@param timeout_read the read timeout
|
||||
@param timeout_write the write timeout
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void bufferevent_settimeout(struct bufferevent *bufev,
|
||||
int timeout_read, int timeout_write);
|
||||
|
||||
|
@ -49,6 +49,7 @@ extern "C" {
|
||||
|
||||
/* For int types. */
|
||||
#include <event2/util.h>
|
||||
#include <event2/visibility.h>
|
||||
|
||||
/**
|
||||
Initialize the asynchronous DNS library.
|
||||
@ -66,6 +67,7 @@ extern "C" {
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_shutdown()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_init(void);
|
||||
|
||||
struct evdns_base;
|
||||
@ -76,6 +78,7 @@ struct evdns_base;
|
||||
@deprecated This function is deprecated because use of the global
|
||||
evdns_base is error-prone.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evdns_base *evdns_get_global_base(void);
|
||||
|
||||
/**
|
||||
@ -93,6 +96,7 @@ struct evdns_base *evdns_get_global_base(void);
|
||||
active requests will return DNS_ERR_SHUTDOWN.
|
||||
@see evdns_init()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evdns_shutdown(int fail_requests);
|
||||
|
||||
/**
|
||||
@ -109,6 +113,7 @@ void evdns_shutdown(int fail_requests);
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_nameserver_ip_add()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_nameserver_add(unsigned long int address);
|
||||
|
||||
/**
|
||||
@ -126,6 +131,7 @@ int evdns_nameserver_add(unsigned long int address);
|
||||
@return the number of configured nameservers
|
||||
@see evdns_nameserver_add()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_count_nameservers(void);
|
||||
|
||||
/**
|
||||
@ -140,6 +146,7 @@ int evdns_count_nameservers(void);
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_resume()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_clear_nameservers_and_suspend(void);
|
||||
|
||||
/**
|
||||
@ -155,6 +162,7 @@ int evdns_clear_nameservers_and_suspend(void);
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_clear_nameservers_and_suspend()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_resume(void);
|
||||
|
||||
/**
|
||||
@ -170,6 +178,7 @@ int evdns_resume(void);
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_nameserver_add()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_nameserver_ip_add(const char *ip_as_string);
|
||||
|
||||
/**
|
||||
@ -186,6 +195,7 @@ int evdns_nameserver_ip_add(const char *ip_as_string);
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_resolve_ipv6(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback, void *ptr);
|
||||
|
||||
/**
|
||||
@ -198,6 +208,7 @@ int evdns_resolve_ipv4(const char *name, int flags, evdns_callback_type callback
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_resolve_ipv4(), evdns_resolve_reverse(), evdns_resolve_reverse_ipv6()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_resolve_ipv6(const char *name, int flags, evdns_callback_type callback, void *ptr);
|
||||
|
||||
struct in_addr;
|
||||
@ -217,6 +228,7 @@ struct in6_addr;
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_resolve_reverse_ipv6()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_type callback, void *ptr);
|
||||
|
||||
/**
|
||||
@ -233,6 +245,7 @@ int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_ty
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
@see evdns_resolve_reverse_ipv6()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callback_type callback, void *ptr);
|
||||
|
||||
/**
|
||||
@ -251,6 +264,7 @@ int evdns_resolve_reverse_ipv6(const struct in6_addr *in, int flags, evdns_callb
|
||||
@param flags Ignored.
|
||||
@return 0 if successful, or -1 if an error occurred
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_set_option(const char *option, const char *val, int flags);
|
||||
|
||||
/**
|
||||
@ -278,6 +292,7 @@ int evdns_set_option(const char *option, const char *val, int flags);
|
||||
occurred (see above)
|
||||
@see resolv.conf(3), evdns_config_windows_nameservers()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_resolv_conf_parse(int flags, const char *const filename);
|
||||
|
||||
/**
|
||||
@ -287,6 +302,7 @@ int evdns_resolv_conf_parse(int flags, const char *const filename);
|
||||
caller to specify which evdns_base it applies to. The recommended
|
||||
function is evdns_base_search_clear().
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evdns_search_clear(void);
|
||||
|
||||
/**
|
||||
@ -298,6 +314,7 @@ void evdns_search_clear(void);
|
||||
|
||||
@param domain the domain to be added to the search list
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evdns_search_add(const char *domain);
|
||||
|
||||
/**
|
||||
@ -312,6 +329,7 @@ void evdns_search_add(const char *domain);
|
||||
|
||||
@param ndots the new ndots parameter
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evdns_search_ndots_set(const int ndots);
|
||||
|
||||
/**
|
||||
@ -322,9 +340,13 @@ void evdns_search_ndots_set(const int ndots);
|
||||
function is evdns_add_server_port_with_base().
|
||||
|
||||
*/
|
||||
struct evdns_server_port *evdns_add_server_port(evutil_socket_t socket, int flags, evdns_request_callback_fn_type callback, void *user_data);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evdns_server_port *
|
||||
evdns_add_server_port(evutil_socket_t socket, int flags,
|
||||
evdns_request_callback_fn_type callback, void *user_data);
|
||||
|
||||
#ifdef _WIN32
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evdns_config_windows_nameservers(void);
|
||||
#define EVDNS_CONFIG_WINDOWS_NAMESERVERS_IMPLEMENTED
|
||||
#endif
|
||||
|
@ -58,6 +58,7 @@ extern "C" {
|
||||
* @param port the port number on which the HTTP server should listen
|
||||
* @return an struct evhttp object
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
|
||||
|
||||
/**
|
||||
@ -67,6 +68,7 @@ struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
|
||||
*
|
||||
* @deprecated It does not allow an event base to be specified
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evhttp_connection *evhttp_connection_new(
|
||||
const char *address, ev_uint16_t port);
|
||||
|
||||
@ -76,6 +78,7 @@ struct evhttp_connection *evhttp_connection_new(
|
||||
*
|
||||
* @deprecated XXXX Why?
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evhttp_connection_set_base(struct evhttp_connection *evcon,
|
||||
struct event_base *base);
|
||||
|
||||
|
@ -27,6 +27,8 @@
|
||||
#ifndef EVENT2_RPC_H_INCLUDED_
|
||||
#define EVENT2_RPC_H_INCLUDED_
|
||||
|
||||
#include <event2/visibility.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -178,6 +180,7 @@ EVRPC_STRUCT(rpcname) { \
|
||||
struct evhttp_request* http_req; \
|
||||
struct evbuffer* rpc_data; \
|
||||
}; \
|
||||
EVENT2_EXPORT_SYMBOL \
|
||||
int evrpc_send_request_##rpcname(struct evrpc_pool *, \
|
||||
struct reqstruct *, struct rplystruct *, \
|
||||
void (*)(struct evrpc_status *, \
|
||||
@ -187,6 +190,7 @@ int evrpc_send_request_##rpcname(struct evrpc_pool *, \
|
||||
struct evrpc_pool;
|
||||
|
||||
/** use EVRPC_GENERATE instead */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evrpc_request_wrapper *evrpc_make_request_ctx(
|
||||
struct evrpc_pool *pool, void *request, void *reply,
|
||||
const char *rpcname,
|
||||
@ -257,10 +261,13 @@ struct evrpc_request_wrapper *evrpc_make_request_ctx(
|
||||
#define EVRPC_REQUEST_HTTP(rpc_req) (rpc_req)->http_req
|
||||
|
||||
/** completes the server response to an rpc request */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_request_done(struct evrpc_req_generic *req);
|
||||
|
||||
/** accessors for request and reply */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void *evrpc_get_request(struct evrpc_req_generic *req);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void *evrpc_get_reply(struct evrpc_req_generic *req);
|
||||
|
||||
/** Creates the reply to an RPC request
|
||||
@ -288,6 +295,7 @@ struct evhttp;
|
||||
* @return a newly allocated evrpc_base struct
|
||||
* @see evrpc_free()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evrpc_base *evrpc_init(struct evhttp *server);
|
||||
|
||||
/**
|
||||
@ -298,6 +306,7 @@ struct evrpc_base *evrpc_init(struct evhttp *server);
|
||||
* @param base the evrpc_base object to be freed
|
||||
* @see evrpc_init
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_free(struct evrpc_base *base);
|
||||
|
||||
/** register RPCs with the HTTP Server
|
||||
@ -334,6 +343,7 @@ void evrpc_free(struct evrpc_base *base);
|
||||
|
||||
@see EVRPC_REGISTER()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
|
||||
void (*)(struct evrpc_req_generic*, void *), void *);
|
||||
|
||||
@ -347,6 +357,7 @@ int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
|
||||
*/
|
||||
#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc((base), #name)
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_unregister_rpc(struct evrpc_base *base, const char *name);
|
||||
|
||||
/*
|
||||
@ -385,6 +396,7 @@ struct evrpc_status;
|
||||
@returns 0 on success, -1 otherwise.
|
||||
@see EVRPC_MAKE_REQUEST(), EVRPC_MAKE_CTX()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_make_request(struct evrpc_request_wrapper *ctx);
|
||||
|
||||
/** creates an rpc connection pool
|
||||
@ -397,12 +409,14 @@ int evrpc_make_request(struct evrpc_request_wrapper *ctx);
|
||||
* @return a newly allocated struct evrpc_pool object
|
||||
* @see evrpc_pool_free()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evrpc_pool *evrpc_pool_new(struct event_base *base);
|
||||
/** frees an rpc connection pool
|
||||
*
|
||||
* @param pool a pointer to an evrpc_pool allocated via evrpc_pool_new()
|
||||
* @see evrpc_pool_new()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_pool_free(struct evrpc_pool *pool);
|
||||
|
||||
/**
|
||||
@ -413,6 +427,7 @@ void evrpc_pool_free(struct evrpc_pool *pool);
|
||||
* @param pool the pool to which to add the connection
|
||||
* @param evcon the connection to add to the pool.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_pool_add_connection(struct evrpc_pool *pool,
|
||||
struct evhttp_connection *evcon);
|
||||
|
||||
@ -424,6 +439,7 @@ void evrpc_pool_add_connection(struct evrpc_pool *pool,
|
||||
* @param pool the pool from which to remove the connection
|
||||
* @param evcon the connection to remove from the pool.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_pool_remove_connection(struct evrpc_pool *pool,
|
||||
struct evhttp_connection *evcon);
|
||||
|
||||
@ -442,6 +458,7 @@ void evrpc_pool_remove_connection(struct evrpc_pool *pool,
|
||||
* @param timeout_in_secs the number of seconds after which a request should
|
||||
* timeout and a failure be returned to the callback.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs);
|
||||
|
||||
/**
|
||||
@ -489,6 +506,7 @@ enum EVRPC_HOOK_RESULT {
|
||||
* @return a handle to the hook so it can be removed later
|
||||
* @see evrpc_remove_hook()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void *evrpc_add_hook(void *vbase,
|
||||
enum EVRPC_HOOK_TYPE hook_type,
|
||||
int (*cb)(void *, struct evhttp_request *, struct evbuffer *, void *),
|
||||
@ -502,6 +520,7 @@ void *evrpc_add_hook(void *vbase,
|
||||
* @return 1 on success or 0 on failure
|
||||
* @see evrpc_add_hook()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_remove_hook(void *vbase,
|
||||
enum EVRPC_HOOK_TYPE hook_type,
|
||||
void *handle);
|
||||
@ -511,8 +530,8 @@ int evrpc_remove_hook(void *vbase,
|
||||
* @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
|
||||
* @param ctx the context pointer provided to the original hook call
|
||||
*/
|
||||
int
|
||||
evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
|
||||
|
||||
/** adds meta data to request
|
||||
*
|
||||
@ -525,6 +544,7 @@ evrpc_resume_request(void *vbase, void *ctx, enum EVRPC_HOOK_RESULT res);
|
||||
* @param data the data to be associated with the key
|
||||
* @param data_size the size of the data
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_hook_add_meta(void *ctx, const char *key,
|
||||
const void *data, size_t data_size);
|
||||
|
||||
@ -538,6 +558,7 @@ void evrpc_hook_add_meta(void *ctx, const char *key,
|
||||
* @param data_size pointer to the size of the data
|
||||
* @return 0 on success or -1 on failure
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_hook_find_meta(void *ctx, const char *key,
|
||||
void **data, size_t *data_size);
|
||||
|
||||
@ -547,6 +568,7 @@ int evrpc_hook_find_meta(void *ctx, const char *key,
|
||||
* @param ctx the context provided to the hook call
|
||||
* @return a pointer to the evhttp_connection object
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
|
||||
|
||||
/**
|
||||
@ -556,6 +578,7 @@ struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
|
||||
|
||||
@see EVRPC_MAKE_REQUEST()
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_send_request_generic(struct evrpc_pool *pool,
|
||||
void *request, void *reply,
|
||||
void (*cb)(struct evrpc_status *, void *, void *, void *),
|
||||
@ -572,8 +595,8 @@ int evrpc_send_request_generic(struct evrpc_pool *pool,
|
||||
|
||||
@see EVRPC_REGISTER()
|
||||
*/
|
||||
int
|
||||
evrpc_register_generic(struct evrpc_base *base, const char *name,
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evrpc_register_generic(struct evrpc_base *base, const char *name,
|
||||
void (*callback)(struct evrpc_req_generic *, void *), void *cbarg,
|
||||
void *(*req_new)(void *), void *req_new_arg, void (*req_free)(void *),
|
||||
int (*req_unmarshal)(void *, struct evbuffer *),
|
||||
@ -582,9 +605,12 @@ evrpc_register_generic(struct evrpc_base *base, const char *name,
|
||||
void (*rpl_marshal)(struct evbuffer *, void *));
|
||||
|
||||
/** accessors for obscure and undocumented functionality */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evrpc_pool* evrpc_request_get_pool(struct evrpc_request_wrapper *ctx);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_request_set_pool(struct evrpc_request_wrapper *ctx,
|
||||
struct evrpc_pool *pool);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evrpc_request_set_cb(struct evrpc_request_wrapper *ctx,
|
||||
void (*cb)(struct evrpc_status*, void *request, void *reply, void *arg),
|
||||
void *cb_arg);
|
||||
|
@ -181,6 +181,7 @@ struct event_base;
|
||||
struct event_iocp_port *event_base_get_iocp_(struct event_base *base);
|
||||
|
||||
/* FIXME document. */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int event_base_start_iocp_(struct event_base *base, int n_cpus);
|
||||
void event_base_stop_iocp_(struct event_base *base);
|
||||
|
||||
|
@ -47,6 +47,7 @@
|
||||
|
||||
#ifdef EVENT_DEBUG_LOGGING_ENABLED
|
||||
#ifdef USE_GLOBAL_FOR_DEBUG_LOGGING
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
extern ev_uint32_t event_debug_logging_mask_;
|
||||
#define event_debug_get_logging_mask_() (event_debug_logging_mask_)
|
||||
#else
|
||||
@ -56,15 +57,24 @@ ev_uint32_t event_debug_get_logging_mask_(void);
|
||||
#define event_debug_get_logging_mask_() (0)
|
||||
#endif
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN;
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_debugx_(const char *fmt, ...) EV_CHECK_FMT(1,2);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
|
||||
EV_CHECK_FMT(3,0);
|
||||
|
||||
|
@ -43,6 +43,7 @@ extern "C" {
|
||||
* On failure, set errno to ENOMEM and return NULL.
|
||||
* If the argument sz is 0, simply return NULL.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void *event_mm_malloc_(size_t sz);
|
||||
|
||||
/** Allocate memory initialized to zero.
|
||||
@ -53,6 +54,7 @@ void *event_mm_malloc_(size_t sz);
|
||||
* set errno to ENOMEM and return NULL.
|
||||
* If either arguments are 0, simply return NULL.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void *event_mm_calloc_(size_t count, size_t size);
|
||||
|
||||
/** Duplicate a string.
|
||||
@ -63,9 +65,12 @@ void *event_mm_calloc_(size_t count, size_t size);
|
||||
* occurs (or would occur) in the process.
|
||||
* If the argument str is NULL, set errno to EINVAL and return NULL.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
char *event_mm_strdup_(const char *str);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void *event_mm_realloc_(void *p, size_t sz);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void event_mm_free_(void *p);
|
||||
#define mm_malloc(sz) event_mm_malloc_(sz)
|
||||
#define mm_calloc(count, size) event_mm_calloc_((count), (size))
|
||||
|
@ -6,10 +6,12 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
#include "event2/event-config.h"
|
||||
#include "event2/visibility.h"
|
||||
#include "evconfig-private.h"
|
||||
|
||||
#ifndef EVENT__HAVE_STRLCPY
|
||||
#include <string.h>
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
size_t event_strlcpy_(char *dst, const char *src, size_t siz);
|
||||
#define strlcpy event_strlcpy_
|
||||
#endif
|
||||
|
@ -54,6 +54,7 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
long evutil_tv_to_msec_(const struct timeval *tv);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evutil_usleep_(const struct timeval *tv);
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -86,8 +87,10 @@ struct evutil_monotonic_timer {
|
||||
struct timeval last_time;
|
||||
};
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_configure_monotonic_time_(struct evutil_monotonic_timer *mt,
|
||||
int flags);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_gettime_monotonic_(struct evutil_monotonic_timer *mt, struct timeval *tv);
|
||||
|
||||
|
||||
|
@ -233,19 +233,26 @@ extern "C" {
|
||||
* when you care about ASCII's notion of character types, because you are about
|
||||
* to send those types onto the wire.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int EVUTIL_ISALPHA_(char c);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int EVUTIL_ISALNUM_(char c);
|
||||
int EVUTIL_ISSPACE_(char c);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int EVUTIL_ISDIGIT_(char c);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int EVUTIL_ISXDIGIT_(char c);
|
||||
int EVUTIL_ISPRINT_(char c);
|
||||
int EVUTIL_ISLOWER_(char c);
|
||||
int EVUTIL_ISUPPER_(char c);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
char EVUTIL_TOUPPER_(char c);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
char EVUTIL_TOLOWER_(char c);
|
||||
|
||||
/** Remove all trailing horizontal whitespace (space or tab) from the end of a
|
||||
* string */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evutil_rtrim_lws_(char *);
|
||||
|
||||
|
||||
@ -272,13 +279,16 @@ void evutil_rtrim_lws_(char *);
|
||||
*/
|
||||
int evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
|
||||
int is_binary);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen);
|
||||
|
||||
int evutil_socket_finished_connecting_(evutil_socket_t fd);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_ersatz_socketpair_(int, int , int, evutil_socket_t[]);
|
||||
|
||||
int evutil_resolve_(int family, const char *hostname, struct sockaddr *sa,
|
||||
@ -303,15 +313,18 @@ struct evutil_weakrand_state {
|
||||
* attacker can't predict, or which passes strong statistical tests, use the
|
||||
* evutil_secure_rng* functions instead.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
ev_uint32_t evutil_weakrand_seed_(struct evutil_weakrand_state *state, ev_uint32_t seed);
|
||||
/* Return a pseudorandom value between 0 and EVUTIL_WEAKRAND_MAX inclusive.
|
||||
* Updates the state in 'seed' as needed -- this value must be protected by a
|
||||
* lock.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
ev_int32_t evutil_weakrand_(struct evutil_weakrand_state *seed);
|
||||
/* Return a pseudorandom value x such that 0 <= x < top. top must be no more
|
||||
* than EVUTIL_WEAKRAND_MAX. Updates the state in 'seed' as needed -- this
|
||||
* value must be proteced by a lock */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
ev_int32_t evutil_weakrand_range_(struct evutil_weakrand_state *seed, ev_int32_t top);
|
||||
|
||||
/* Evaluates to the same boolean value as 'p', and hints to the compiler that
|
||||
@ -377,16 +390,22 @@ typedef struct evdns_getaddrinfo_request* (*evdns_getaddrinfo_fn)(
|
||||
const char *nodename, const char *servname,
|
||||
const struct evutil_addrinfo *hints_in,
|
||||
void (*cb)(int, struct evutil_addrinfo *, void *), void *arg);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn);
|
||||
typedef void (*evdns_getaddrinfo_cancel_fn)(
|
||||
struct evdns_getaddrinfo_request *req);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn);
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evutil_addrinfo *evutil_new_addrinfo_(struct sockaddr *sa,
|
||||
ev_socklen_t socklen, const struct evutil_addrinfo *hints);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
struct evutil_addrinfo *evutil_addrinfo_append_(struct evutil_addrinfo *first,
|
||||
struct evutil_addrinfo *append);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
void evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints);
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_getaddrinfo_common_(const char *nodename, const char *servname,
|
||||
struct evutil_addrinfo *hints, struct evutil_addrinfo **res, int *portnum);
|
||||
|
||||
@ -399,6 +418,7 @@ void evutil_getaddrinfo_cancel_async_(struct evdns_getaddrinfo_request *data);
|
||||
|
||||
/** Return true iff sa is a looback address. (That is, it is 127.0.0.1/8, or
|
||||
* ::1). */
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
|
||||
|
||||
|
||||
@ -407,6 +427,7 @@ int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
|
||||
Returns a pointer to out. Always writes something into out, so it's safe
|
||||
to use the output of this function without checking it for NULL.
|
||||
*/
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
const char *evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen);
|
||||
|
||||
int evutil_hex_char_to_int_(char c);
|
||||
@ -464,6 +485,7 @@ HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
EVENT2_EXPORT_SYMBOL
|
||||
evutil_socket_t evutil_socket_(int domain, int type, int protocol);
|
||||
evutil_socket_t evutil_accept4_(evutil_socket_t sockfd, struct sockaddr *addr,
|
||||
ev_socklen_t *addrlen, int flags);
|
||||
|
Loading…
x
Reference in New Issue
Block a user