diff options
Diffstat (limited to 'contrib/ntp/sntp/libevent/include/event2')
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/buffer.h | 11 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/bufferevent.h | 9 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/dns.h | 18 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/event.h | 10 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/http.h | 14 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/listener.h | 9 | ||||
-rw-r--r-- | contrib/ntp/sntp/libevent/include/event2/util.h | 69 |
7 files changed, 127 insertions, 13 deletions
diff --git a/contrib/ntp/sntp/libevent/include/event2/buffer.h b/contrib/ntp/sntp/libevent/include/event2/buffer.h index 839d6e7..468588b 100644 --- a/contrib/ntp/sntp/libevent/include/event2/buffer.h +++ b/contrib/ntp/sntp/libevent/include/event2/buffer.h @@ -105,13 +105,8 @@ struct evbuffer Used when repeatedly searching through a buffer. Calling any function that modifies or re-packs the buffer contents may invalidate all - evbuffer_ptrs for that buffer. Do not modify these values except with - evbuffer_ptr_set. - - Used when repeatedly searching through a buffer. Calls to any function - that modifies or re-packs the buffer contents may invalidate all - evbuffer_ptrs for that buffer. Do not modify these values except with - evbuffer_ptr_set. + evbuffer_ptrs for that buffer. Do not modify or contruct these values + except with evbuffer_ptr_set. An evbuffer_ptr can represent any position from the start of a buffer up to a position immediately after the end of a buffer. @@ -787,7 +782,7 @@ enum evbuffer_ptr_how { There are two ways to use this function: you can call evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_SET) to move 'pos' to a position 'N' bytes after the start of the buffer, or - evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_SET) + evbuffer_ptr_set(buf, &pos, N, EVBUFFER_PTR_ADD) to move 'pos' forward by 'N' bytes. If evbuffer_ptr is not initialized, this function can only be called diff --git a/contrib/ntp/sntp/libevent/include/event2/bufferevent.h b/contrib/ntp/sntp/libevent/include/event2/bufferevent.h index 46203b0..fe8a74d 100644 --- a/contrib/ntp/sntp/libevent/include/event2/bufferevent.h +++ b/contrib/ntp/sntp/libevent/include/event2/bufferevent.h @@ -535,8 +535,9 @@ void bufferevent_setwatermark(struct bufferevent *bufev, short events, size_t lowmark, size_t highmark); /** - Retrieves the watermarks for read or write events. Result is undefined if - events contains both EV_READ and EV_WRITE. + Retrieves the watermarks for read or write events. + Returns non-zero if events contains not only EV_READ or EV_WRITE. + Returns zero if events equal EV_READ or EV_WRITE @param bufev the bufferevent to be examined @param events EV_READ or EV_WRITE @@ -544,7 +545,7 @@ void bufferevent_setwatermark(struct bufferevent *bufev, short events, @param highmark receives the high watermark if not NULL */ EVENT2_EXPORT_SYMBOL -void bufferevent_getwatermark(struct bufferevent *bufev, short events, +int bufferevent_getwatermark(struct bufferevent *bufev, short events, size_t *lowmark, size_t *highmark); /** @@ -598,7 +599,7 @@ enum bufferevent_trigger_options { BEV_TRIG_IGNORE_WATERMARKS = (1<<16), /** defer even if the callbacks are not */ - BEV_TRIG_DEFER_CALLBACKS = BEV_OPT_DEFER_CALLBACKS, + BEV_TRIG_DEFER_CALLBACKS = BEV_OPT_DEFER_CALLBACKS /* (Note: for internal reasons, these need to be disjoint from * bufferevent_options, except when they mean the same thing. */ diff --git a/contrib/ntp/sntp/libevent/include/event2/dns.h b/contrib/ntp/sntp/libevent/include/event2/dns.h index a00c83e..17cd86a 100644 --- a/contrib/ntp/sntp/libevent/include/event2/dns.h +++ b/contrib/ntp/sntp/libevent/include/event2/dns.h @@ -453,7 +453,7 @@ int evdns_base_set_option(struct evdns_base *base, const char *option, const cha @param base the evdns_base to which to apply this operation @param flags any of DNS_OPTION_NAMESERVERS|DNS_OPTION_SEARCH|DNS_OPTION_MISC| - DNS_OPTIONS_HOSTSFILE|DNS_OPTIONS_ALL + DNS_OPTION_HOSTSFILE|DNS_OPTIONS_ALL @param filename the path to the resolv.conf file @return 0 if successful, or various positive error codes if an error occurred (see above) @@ -694,6 +694,22 @@ struct evdns_getaddrinfo_request *evdns_getaddrinfo( EVENT2_EXPORT_SYMBOL void evdns_getaddrinfo_cancel(struct evdns_getaddrinfo_request *req); +/** + Retrieve the address of the 'idx'th configured nameserver. + + @param base The evdns_base to examine. + @param idx The index of the nameserver to get the address of. + @param sa A location to receive the server's address. + @param len The number of bytes available at sa. + + @return the number of bytes written into sa on success. On failure, returns + -1 if idx is greater than the number of configured nameservers, or a + value greater than 'len' if len was not high enough. + */ +EVENT2_EXPORT_SYMBOL +int evdns_base_get_nameserver_addr(struct evdns_base *base, int idx, + struct sockaddr *sa, ev_socklen_t len); + #ifdef __cplusplus } #endif diff --git a/contrib/ntp/sntp/libevent/include/event2/event.h b/contrib/ntp/sntp/libevent/include/event2/event.h index 6e2b884..570031f 100644 --- a/contrib/ntp/sntp/libevent/include/event2/event.h +++ b/contrib/ntp/sntp/libevent/include/event2/event.h @@ -396,6 +396,12 @@ const char *event_base_get_method(const struct event_base *); EVENT2_EXPORT_SYMBOL const char **event_get_supported_methods(void); +/** Query the current monotonic time from a the timer for a struct + * event_base. + */ +EVENT2_EXPORT_SYMBOL +int event_gettime_monotonic(struct event_base *base, struct timeval *tp); + /** @name event type flag @@ -771,6 +777,10 @@ void event_set_fatal_callback(event_fatal_cb cb); EVENT2_EXPORT_SYMBOL void event_enable_debug_logging(ev_uint32_t which); +EVENT2_EXPORT_SYMBOL +void +event_disable_debug_mode(void); + /** Associate a different event base with an event. diff --git a/contrib/ntp/sntp/libevent/include/event2/http.h b/contrib/ntp/sntp/libevent/include/event2/http.h index 81f44b8..4284d5f 100644 --- a/contrib/ntp/sntp/libevent/include/event2/http.h +++ b/contrib/ntp/sntp/libevent/include/event2/http.h @@ -630,6 +630,12 @@ struct evhttp_connection *evhttp_connection_base_new( struct event_base *base, struct evdns_base *dnsbase, const char *address, unsigned short port); +/** + * Set family hint for DNS requests. + */ +void evhttp_connection_set_family(struct evhttp_connection *evcon, + int family); + /** Takes ownership of the request object * * Can be used in a request callback to keep onto the request until @@ -669,6 +675,14 @@ void evhttp_connection_set_max_body_size(struct evhttp_connection* evcon, EVENT2_EXPORT_SYMBOL void evhttp_connection_free(struct evhttp_connection *evcon); +/** Disowns a given connection object + * + * Can be used to tell libevent to free the connection object after + * the last request has completed or failed. + */ +EVENT2_EXPORT_SYMBOL +void evhttp_connection_free_on_completion(struct evhttp_connection *evcon); + /** sets the ip address from which http connections are made */ EVENT2_EXPORT_SYMBOL void evhttp_connection_set_local_address(struct evhttp_connection *evcon, diff --git a/contrib/ntp/sntp/libevent/include/event2/listener.h b/contrib/ntp/sntp/libevent/include/event2/listener.h index 8c77803..84b4da0 100644 --- a/contrib/ntp/sntp/libevent/include/event2/listener.h +++ b/contrib/ntp/sntp/libevent/include/event2/listener.h @@ -88,6 +88,15 @@ typedef void (*evconnlistener_errorcb)(struct evconnlistener *, void *); * to use the option before it is actually bound. */ #define LEV_OPT_DEFERRED_ACCEPT (1u<<6) +/** Flag: Indicates that we ask to allow multiple servers (processes or + * threads) to bind to the same port if they each set the option. + * + * SO_REUSEPORT is what most people would expect SO_REUSEADDR to be, however + * SO_REUSEPORT does not imply SO_REUSEADDR. + * + * This is only available on Linux and kernel 3.9+ + */ +#define LEV_OPT_REUSEABLE_PORT (1u<<7) /** Allocate a new evconnlistener object to listen for incoming TCP connections diff --git a/contrib/ntp/sntp/libevent/include/event2/util.h b/contrib/ntp/sntp/libevent/include/event2/util.h index 14c6a25..b152a4b 100644 --- a/contrib/ntp/sntp/libevent/include/event2/util.h +++ b/contrib/ntp/sntp/libevent/include/event2/util.h @@ -292,6 +292,62 @@ extern "C" { #define evutil_socket_t int #endif +/** + * Structure to hold information about a monotonic timer + * + * Use this with evutil_configure_monotonic_time() and + * evutil_gettime_monotonic(). + * + * This is an opaque structure; you can allocate one using + * evutil_monotonic_timer_new(). + * + * @see evutil_monotonic_timer_new(), evutil_monotonic_timer_free(), + * evutil_configure_monotonic_time(), evutil_gettime_monotonic() + */ +struct evutil_monotonic_timer +#ifdef EVENT_IN_DOXYGEN_ +{/*Empty body so that doxygen will generate documentation here.*/} +#endif +; + +#define EV_MONOT_PRECISE 1 +#define EV_MONOT_FALLBACK 2 + +/** Allocate a new struct evutil_monotonic_timer for use with the + * evutil_configure_monotonic_time() and evutil_gettime_monotonic() + * functions. You must configure the timer with + * evutil_configure_monotonic_time() before using it. + */ +EVENT2_EXPORT_SYMBOL +struct evutil_monotonic_timer * evutil_monotonic_timer_new(void); + +/** Free a struct evutil_monotonic_timer that was allocated using + * evutil_monotonic_timer_new(). + */ +EVENT2_EXPORT_SYMBOL +void evutil_monotonic_timer_free(struct evutil_monotonic_timer *timer); + +/** Set up a struct evutil_monotonic_timer; flags can include + * EV_MONOT_PRECISE and EV_MONOT_FALLBACK. + */ +EVENT2_EXPORT_SYMBOL +int evutil_configure_monotonic_time(struct evutil_monotonic_timer *timer, + int flags); + +/** Query the current monotonic time from a struct evutil_monotonic_timer + * previously configured with evutil_configure_monotonic_time(). Monotonic + * time is guaranteed never to run in reverse, but is not necessarily epoch- + * based, or relative to any other definite point. Use it to make reliable + * measurements of elapsed time between events even when the system time + * may be changed. + * + * It is not safe to use this funtion on the same timer from multiple + * threads. + */ +EVENT2_EXPORT_SYMBOL +int evutil_gettime_monotonic(struct evutil_monotonic_timer *timer, + struct timeval *tp); + /** Create two new sockets that are connected to each other. On Unix, this simply calls socketpair(). On Windows, it uses the @@ -327,6 +383,19 @@ int evutil_make_socket_nonblocking(evutil_socket_t sock); EVENT2_EXPORT_SYMBOL int evutil_make_listen_socket_reuseable(evutil_socket_t sock); +/** Do platform-specific operations to make a listener port reusable. + + Specifically, we want to make sure that multiple programs which also + set the same socket option will be able to bind, listen at the same time. + + This is a feature available only to Linux 3.9+ + + @param sock The socket to make reusable + @return 0 on success, -1 on failure + */ +EVENT2_EXPORT_SYMBOL +int evutil_make_listen_socket_reuseable_port(evutil_socket_t sock); + /** Do platform-specific operations as needed to close a socket upon a successful execution of one of the exec*() functions. |