-
-/**
- * Structure to hold information and state for a Libevent dispatch loop.
- *
- * The event_base lies at the center of Libevent; every application will
- * have one. It keeps track of all pending and active events, and
- * notifies your application of the active ones.
- *
- * This is an opaque structure; you can allocate one using
- * event_base_new() or event_base_new_with_config().
- *
- * @see event_base_new(), event_base_free(), event_base_loop(),
- * event_base_new_with_config()
- */
-struct event_base
-#ifdef EVENT_IN_DOXYGEN_
-{/*Empty body so that doxygen will generate documentation here.*/}
-#endif
-;
-
-/**
- * @struct event
- *
- * Structure to represent a single event.
- *
- * An event can have some underlying condition it represents: a socket
- * becoming readable or writeable (or both), or a signal becoming raised.
- * (An event that represents no underlying condition is still useful: you
- * can use one to implement a timer, or to communicate between threads.)
- *
- * Generally, you can create events with event_new(), then make them
- * pending with event_add(). As your event_base runs, it will run the
- * callbacks of an events whose conditions are triggered. When you
- * longer want the event, free it with event_free().
- *
- * In more depth:
- *
- * An event may be "pending" (one whose condition we are watching),
- * "active" (one whose condition has triggered and whose callback is about
- * to run), neither, or both. Events come into existence via
- * event_assign() or event_new(), and are then neither active nor pending.
- *
- * To make an event pending, pass it to event_add(). When doing so, you
- * can also set a timeout for the event.
- *
- * Events become active during an event_base_loop() call when either their
- * condition has triggered, or when their timeout has elapsed. You can
- * also activate an event manually using event_active(). The even_base
- * loop will run the callbacks of active events; after it has done so, it
- * marks them as no longer active.
- *
- * You can make an event non-pending by passing it to event_del(). This
- * also makes the event non-active.
- *
- * Events can be "persistent" or "non-persistent". A non-persistent event
- * becomes non-pending as soon as it is triggered: thus, it only runs at
- * most once per call to event_add(). A persistent event remains pending
- * even when it becomes active: you'll need to event_del() it manually in
- * order to make it non-pending. When a persistent event with a timeout
- * becomes active, its timeout is reset: this means you can use persistent
- * events to implement periodic timeouts.
- *
- * This should be treated as an opaque structure; you should never read or
- * write any of its fields directly. For backward compatibility with old
- * code, it is defined in the event2/event_struct.h header; including this
- * header may make your code incompatible with other versions of Libevent.
- *
- * @see event_new(), event_free(), event_assign(), event_get_assignment(),
- * event_add(), event_del(), event_active(), event_pending(),
- * event_get_fd(), event_get_base(), event_get_events(),
- * event_get_callback(), event_get_callback_arg(),
- * event_priority_set()
- */
-struct event
-#ifdef EVENT_IN_DOXYGEN_
-{/*Empty body so that doxygen will generate documentation here.*/}
-#endif
-;
-
-/**
- * Configuration for an event_base.
- *
- * There are many options that can be used to alter the behavior and
- * implementation of an event_base. To avoid having to pass them all in a
- * complex many-argument constructor, we provide an abstract data type
- * wrhere you set up configation information before passing it to
- * event_base_new_with_config().
- *
- * @see event_config_new(), event_config_free(), event_base_new_with_config(),
- * event_config_avoid_method(), event_config_require_features(),
- * event_config_set_flag(), event_config_set_num_cpus_hint()
- */
-struct event_config
-#ifdef EVENT_IN_DOXYGEN_
-{/*Empty body so that doxygen will generate documentation here.*/}
-#endif
-;
-
-/**
- * Enable some relatively expensive debugging checks in Libevent that
- * would normally be turned off. Generally, these checks cause code that
- * would otherwise crash mysteriously to fail earlier with an assertion
- * failure. Note that this method MUST be called before any events or
- * event_bases have been created.
- *
- * Debug mode can currently catch the following errors:
- * An event is re-assigned while it is added
- * Any function is called on a non-assigned event
- *
- * Note that debugging mode uses memory to track every event that has been
- * initialized (via event_assign, event_set, or event_new) but not yet
- * released (via event_free or event_debug_unassign). If you want to use
- * debug mode, and you find yourself running out of memory, you will need
- * to use event_debug_unassign to explicitly stop tracking events that
- * are no longer considered set-up.
- *
- * @see event_debug_unassign()
- */
-EVENT2_EXPORT_SYMBOL
-void event_enable_debug_mode(void);
-
-/**
- * When debugging mode is enabled, informs Libevent that an event should no
- * longer be considered as assigned. When debugging mode is not enabled, does
- * nothing.
- *
- * This function must only be called on a non-added event.
- *
- * @see event_enable_debug_mode()
- */
-EVENT2_EXPORT_SYMBOL
-void event_debug_unassign(struct event *);
-
-/**
- * Create and return a new event_base to use with the rest of Libevent.
- *
- * @return a new event_base on success, or NULL on failure.
- *
- * @see event_base_free(), event_base_new_with_config()
- */
-EVENT2_EXPORT_SYMBOL
-struct event_base *event_base_new(void);
-
-/**
- Reinitialize the event base after a fork
-
- Some event mechanisms do not survive across fork. The event base needs
- to be reinitialized with the event_reinit() function.
-
- @param base the event base that needs to be re-initialized
- @return 0 if successful, or -1 if some events could not be re-added.
- @see event_base_new()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_reinit(struct event_base *base);
-
-/**
- Event dispatching loop
-
- This loop will run the event base until either there are no more pending or
- active, or until something calls event_base_loopbreak() or
- event_base_loopexit().
-
- @param base the event_base structure returned by event_base_new() or
- event_base_new_with_config()
- @return 0 if successful, -1 if an error occurred, or 1 if we exited because
- no events were pending or active.
- @see event_base_loop()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_dispatch(struct event_base *);
-
-/**
- Get the kernel event notification mechanism used by Libevent.
-
- @param eb the event_base structure returned by event_base_new()
- @return a string identifying the kernel event mechanism (kqueue, epoll, etc.)
- */
-EVENT2_EXPORT_SYMBOL
-const char *event_base_get_method(const struct event_base *);
-
-/**
- Gets all event notification mechanisms supported by Libevent.
-
- This functions returns the event mechanism in order preferred by
- Libevent. Note that this list will include all backends that
- Libevent has compiled-in support for, and will not necessarily check
- your OS to see whether it has the required resources.
-
- @return an array with pointers to the names of support methods.
- The end of the array is indicated by a NULL pointer. If an
- error is encountered NULL is returned.
-*/
-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
-
- Flags to pass to event_base_get_num_events() to specify the kinds of events
- we want to aggregate counts for
-*/
-/**@{*/
-/** count the number of active events, which have been triggered.*/
-#define EVENT_BASE_COUNT_ACTIVE 1U
-/** count the number of virtual events, which is used to represent an internal
- * condition, other than a pending event, that keeps the loop from exiting. */
-#define EVENT_BASE_COUNT_VIRTUAL 2U
-/** count the number of events which have been added to event base, including
- * internal events. */
-#define EVENT_BASE_COUNT_ADDED 4U
-/**@}*/
-
-/**
- Gets the number of events in event_base, as specified in the flags.
-
- Since event base has some internal events added to make some of its
- functionalities work, EVENT_BASE_COUNT_ADDED may return more than the
- number of events you added using event_add().
-
- If you pass EVENT_BASE_COUNT_ACTIVE and EVENT_BASE_COUNT_ADDED together, an
- active event will be counted twice. However, this might not be the case in
- future libevent versions. The return value is an indication of the work
- load, but the user shouldn't rely on the exact value as this may change in
- the future.
-
- @param eb the event_base structure returned by event_base_new()
- @param flags a bitwise combination of the kinds of events to aggregate
- counts for
- @return the number of events specified in the flags
-*/
-EVENT2_EXPORT_SYMBOL
-int event_base_get_num_events(struct event_base *, unsigned int);
-
-/**
- Get the maximum number of events in a given event_base as specified in the
- flags.
-
- @param eb the event_base structure returned by event_base_new()
- @param flags a bitwise combination of the kinds of events to aggregate
- counts for
- @param clear option used to reset the maximum count.
- @return the number of events specified in the flags
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_get_max_events(struct event_base *, unsigned int, int);
-
-/**
- Allocates a new event configuration object.
-
- The event configuration object can be used to change the behavior of
- an event base.
-
- @return an event_config object that can be used to store configuration, or
- NULL if an error is encountered.
- @see event_base_new_with_config(), event_config_free(), event_config
-*/
-EVENT2_EXPORT_SYMBOL
-struct event_config *event_config_new(void);
-
-/**
- Deallocates all memory associated with an event configuration object
-
- @param cfg the event configuration object to be freed.
-*/
-EVENT2_EXPORT_SYMBOL
-void event_config_free(struct event_config *cfg);
-
-/**
- Enters an event method that should be avoided into the configuration.
-
- This can be used to avoid event mechanisms that do not support certain
- file descriptor types, or for debugging to avoid certain event
- mechanisms. An application can make use of multiple event bases to
- accommodate incompatible file descriptor types.
-
- @param cfg the event configuration object
- @param method the name of the event method to avoid
- @return 0 on success, -1 on failure.
-*/
-EVENT2_EXPORT_SYMBOL
-int event_config_avoid_method(struct event_config *cfg, const char *method);
-
-/**
- A flag used to describe which features an event_base (must) provide.
-
- Because of OS limitations, not every Libevent backend supports every
- possible feature. You can use this type with
- event_config_require_features() to tell Libevent to only proceed if your
- event_base implements a given feature, and you can receive this type from
- event_base_get_features() to see which features are available.
-*/
-enum event_method_feature {
- /** Require an event method that allows edge-triggered events with EV_ET. */
- EV_FEATURE_ET = 0x01,
- /** Require an event method where having one event triggered among
- * many is [approximately] an O(1) operation. This excludes (for
- * example) select and poll, which are approximately O(N) for N
- * equal to the total number of possible events. */
- EV_FEATURE_O1 = 0x02,
- /** Require an event method that allows file descriptors as well as
- * sockets. */
- EV_FEATURE_FDS = 0x04,
- /** Require an event method that allows you to use EV_CLOSED to detect
- * connection close without the necessity of reading all the pending data.
- *
- * Methods that do support EV_CLOSED may not be able to provide support on
- * all kernel versions.
- **/
- EV_FEATURE_EARLY_CLOSE = 0x08
-};
-
-/**
- A flag passed to event_config_set_flag().
-
- These flags change the behavior of an allocated event_base.
-
- @see event_config_set_flag(), event_base_new_with_config(),
- event_method_feature
- */
-enum event_base_config_flag {
- /** Do not allocate a lock for the event base, even if we have
- locking set up.
-
- Setting this option will make it unsafe and nonfunctional to call
- functions on the base concurrently from multiple threads.
- */
- EVENT_BASE_FLAG_NOLOCK = 0x01,
- /** Do not check the EVENT_* environment variables when configuring
- an event_base */
- EVENT_BASE_FLAG_IGNORE_ENV = 0x02,
- /** Windows only: enable the IOCP dispatcher at startup
-
- If this flag is set then bufferevent_socket_new() and
- evconn_listener_new() will use IOCP-backed implementations
- instead of the usual select-based one on Windows.
- */
- EVENT_BASE_FLAG_STARTUP_IOCP = 0x04,
- /** Instead of checking the current time every time the event loop is
- ready to run timeout callbacks, check after each timeout callback.
- */
- EVENT_BASE_FLAG_NO_CACHE_TIME = 0x08,
-
- /** If we are using the epoll backend, this flag says that it is
- safe to use Libevent's internal change-list code to batch up
- adds and deletes in order to try to do as few syscalls as
- possible. Setting this flag can make your code run faster, but
- it may trigger a Linux bug: it is not safe to use this flag
- if you have any fds cloned by dup() or its variants. Doing so
- will produce strange and hard-to-diagnose bugs.
-
- This flag can also be activated by setting the
- EVENT_EPOLL_USE_CHANGELIST environment variable.
-
- This flag has no effect if you wind up using a backend other than
- epoll.
- */
- EVENT_BASE_FLAG_EPOLL_USE_CHANGELIST = 0x10,
-
- /** Ordinarily, Libevent implements its time and timeout code using
- the fastest monotonic timer that we have. If this flag is set,
- however, we use less efficient more precise timer, assuming one is
- present.
- */
- EVENT_BASE_FLAG_PRECISE_TIMER = 0x20
-};
-
-/**
- Return a bitmask of the features implemented by an event base. This
- will be a bitwise OR of one or more of the values of
- event_method_feature
-
- @see event_method_feature
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_get_features(const struct event_base *base);
-
-/**
- Enters a required event method feature that the application demands.
-
- Note that not every feature or combination of features is supported
- on every platform. Code that requests features should be prepared
- to handle the case where event_base_new_with_config() returns NULL, as in:
-
- event_config_require_features(cfg, EV_FEATURE_ET);
- base = event_base_new_with_config(cfg);
- if (base == NULL) {
- // We can't get edge-triggered behavior here.
- event_config_require_features(cfg, 0);
- base = event_base_new_with_config(cfg);
- }
-
-
- @param cfg the event configuration object
- @param feature a bitfield of one or more event_method_feature values.
- Replaces values from previous calls to this function.
- @return 0 on success, -1 on failure.
- @see event_method_feature, event_base_new_with_config()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_config_require_features(struct event_config *cfg, int feature);
-
-/**
- * Sets one or more flags to configure what parts of the eventual event_base
- * will be initialized, and how they'll work.
- *
- * @see event_base_config_flags, event_base_new_with_config()
- **/
-EVENT2_EXPORT_SYMBOL
-int event_config_set_flag(struct event_config *cfg, int flag);
-
-/**
- * Records a hint for the number of CPUs in the system. This is used for
- * tuning thread pools, etc, for optimal performance. In Libevent 2.0,
- * it is only on Windows, and only when IOCP is in use.
- *
- * @param cfg the event configuration object
- * @param cpus the number of cpus
- * @return 0 on success, -1 on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int event_config_set_num_cpus_hint(struct event_config *cfg, int cpus);
-
-/**
- * Record an interval and/or a number of callbacks after which the event base
- * should check for new events. By default, the event base will run as many
- * events are as activated at the higest activated priority before checking
- * for new events. If you configure it by setting max_interval, it will check
- * the time after each callback, and not allow more than max_interval to
- * elapse before checking for new events. If you configure it by setting
- * max_callbacks to a value >= 0, it will run no more than max_callbacks
- * callbacks before checking for new events.
- *
- * This option can decrease the latency of high-priority events, and
- * avoid priority inversions where multiple low-priority events keep us from
- * polling for high-priority events, but at the expense of slightly decreasing
- * the throughput. Use it with caution!
- *
- * @param cfg The event_base configuration object.
- * @param max_interval An interval after which Libevent should stop running
- * callbacks and check for more events, or NULL if there should be
- * no such interval.
- * @param max_callbacks A number of callbacks after which Libevent should
- * stop running callbacks and check for more events, or -1 if there
- * should be no such limit.
- * @param min_priority A priority below which max_interval and max_callbacks
- * should not be enforced. If this is set to 0, they are enforced
- * for events of every priority; if it's set to 1, they're enforced
- * for events of priority 1 and above, and so on.
- * @return 0 on success, -1 on failure.
- **/
-EVENT2_EXPORT_SYMBOL
-int event_config_set_max_dispatch_interval(struct event_config *cfg,
- const struct timeval *max_interval, int max_callbacks,
- int min_priority);
-
-/**
- Initialize the event API.
-
- Use event_base_new_with_config() to initialize a new event base, taking
- the specified configuration under consideration. The configuration object
- can currently be used to avoid certain event notification mechanisms.
-
- @param cfg the event configuration object
- @return an initialized event_base that can be used to registering events,
- or NULL if no event base can be created with the requested event_config.
- @see event_base_new(), event_base_free(), event_init(), event_assign()
-*/
-EVENT2_EXPORT_SYMBOL
-struct event_base *event_base_new_with_config(const struct event_config *);
-
-/**
- Deallocate all memory associated with an event_base, and free the base.
-
- Note that this function will not close any fds or free any memory passed
- to event_new as the argument to callback.
-
- If there are any pending finalizer callbacks, this function will invoke
- them.
-
- @param eb an event_base to be freed
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_free(struct event_base *);
-
-/**
- As event_free, but do not run finalizers.
-
- THIS IS AN EXPERIMENTAL API. IT MIGHT CHANGE BEFORE THE LIBEVENT 2.1 SERIES
- BECOMES STABLE.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_free_nofinalize(struct event_base *);
-
-/** @name Log severities
- */
-/**@{*/
-#define EVENT_LOG_DEBUG 0
-#define EVENT_LOG_MSG 1
-#define EVENT_LOG_WARN 2
-#define EVENT_LOG_ERR 3
-/**@}*/
-
-/* Obsolete names: these are deprecated, but older programs might use them.
- * They violate the reserved-identifier namespace. */
-#define _EVENT_LOG_DEBUG EVENT_LOG_DEBUG
-#define _EVENT_LOG_MSG EVENT_LOG_MSG
-#define _EVENT_LOG_WARN EVENT_LOG_WARN
-#define _EVENT_LOG_ERR EVENT_LOG_ERR
-
-/**
- A callback function used to intercept Libevent's log messages.
-
- @see event_set_log_callback
- */
-typedef void (*event_log_cb)(int severity, const char *msg);
-/**
- Redirect Libevent's log messages.
-
- @param cb a function taking two arguments: an integer severity between
- EVENT_LOG_DEBUG and EVENT_LOG_ERR, and a string. If cb is NULL,
- then the default log is used.
-
- NOTE: The function you provide *must not* call any other libevent
- functionality. Doing so can produce undefined behavior.
- */
-EVENT2_EXPORT_SYMBOL
-void event_set_log_callback(event_log_cb cb);
-
-/**
- A function to be called if Libevent encounters a fatal internal error.
-
- @see event_set_fatal_callback
- */
-typedef void (*event_fatal_cb)(int err);
-
-/**
- Override Libevent's behavior in the event of a fatal internal error.
-
- By default, Libevent will call exit(1) if a programming error makes it
- impossible to continue correct operation. This function allows you to supply
- another callback instead. Note that if the function is ever invoked,
- something is wrong with your program, or with Libevent: any subsequent calls
- to Libevent may result in undefined behavior.
-
- Libevent will (almost) always log an EVENT_LOG_ERR message before calling
- this function; look at the last log message to see why Libevent has died.
- */
-EVENT2_EXPORT_SYMBOL
-void event_set_fatal_callback(event_fatal_cb cb);
-
-#define EVENT_DBG_ALL 0xffffffffu
-#define EVENT_DBG_NONE 0
-
-/**
- Turn on debugging logs and have them sent to the default log handler.
-
- This is a global setting; if you are going to call it, you must call this
- before any calls that create an event-base. You must call it before any
- multithreaded use of Libevent.
-
- Debug logs are verbose.
-
- @param which Controls which debug messages are turned on. This option is
- unused for now; for forward compatibility, you must pass in the constant
- "EVENT_DBG_ALL" to turn debugging logs on, or "EVENT_DBG_NONE" to turn
- debugging logs off.
- */
-EVENT2_EXPORT_SYMBOL
-void event_enable_debug_logging(ev_uint32_t which);
-
-/**
- Associate a different event base with an event.
-
- The event to be associated must not be currently active or pending.
-
- @param eb the event base
- @param ev the event
- @return 0 on success, -1 on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_set(struct event_base *, struct event *);
-
-/** @name Loop flags
-
- These flags control the behavior of event_base_loop().
- */
-/**@{*/
-/** Block until we have an active event, then exit once all active events
- * have had their callbacks run. */
-#define EVLOOP_ONCE 0x01
-/** Do not block: see which events are ready now, run the callbacks
- * of the highest-priority ones, then exit. */
-#define EVLOOP_NONBLOCK 0x02
-/** Do not exit the loop because we have no pending events. Instead, keep
- * running until event_base_loopexit() or event_base_loopbreak() makes us
- * stop.
- */
-#define EVLOOP_NO_EXIT_ON_EMPTY 0x04
-/**@}*/
-
-/**
- Wait for events to become active, and run their callbacks.
-
- This is a more flexible version of event_base_dispatch().
-
- By default, this loop will run the event base until either there are no more
- pending or active events, or until something calls event_base_loopbreak() or
- event_base_loopexit(). You can override this behavior with the 'flags'
- argument.
-
- @param eb the event_base structure returned by event_base_new() or
- event_base_new_with_config()
- @param flags any combination of EVLOOP_ONCE | EVLOOP_NONBLOCK
- @return 0 if successful, -1 if an error occurred, or 1 if we exited because
- no events were pending or active.
- @see event_base_loopexit(), event_base_dispatch(), EVLOOP_ONCE,
- EVLOOP_NONBLOCK
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_loop(struct event_base *, int);
-
-/**
- Exit the event loop after the specified time
-
- The next event_base_loop() iteration after the given timer expires will
- complete normally (handling all queued events) then exit without
- blocking for events again.
-
- Subsequent invocations of event_base_loop() will proceed normally.
-
- @param eb the event_base structure returned by event_init()
- @param tv the amount of time after which the loop should terminate,
- or NULL to exit after running all currently active events.
- @return 0 if successful, or -1 if an error occurred
- @see event_base_loopbreak()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_loopexit(struct event_base *, const struct timeval *);
-
-/**
- Abort the active event_base_loop() immediately.
-
- event_base_loop() will abort the loop after the next event is completed;
- event_base_loopbreak() is typically invoked from this event's callback.
- This behavior is analogous to the "break;" statement.
-
- Subsequent invocations of event_base_loop() will proceed normally.
-
- @param eb the event_base structure returned by event_init()
- @return 0 if successful, or -1 if an error occurred
- @see event_base_loopexit()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_loopbreak(struct event_base *);
-
-/**
- Tell the active event_base_loop() to scan for new events immediately.
-
- Calling this function makes the currently active event_base_loop()
- start the loop over again (scanning for new events) after the current
- event callback finishes. If the event loop is not running, this
- function has no effect.
-
- event_base_loopbreak() is typically invoked from this event's callback.
- This behavior is analogous to the "continue;" statement.
-
- Subsequent invocations of event loop will proceed normally.
-
- @param eb the event_base structure returned by event_init()
- @return 0 if successful, or -1 if an error occurred
- @see event_base_loopbreak()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_loopcontinue(struct event_base *);
-
-/**
- Checks if the event loop was told to exit by event_base_loopexit().
-
- This function will return true for an event_base at every point after
- event_loopexit() is called, until the event loop is next entered.
-
- @param eb the event_base structure returned by event_init()
- @return true if event_base_loopexit() was called on this event base,
- or 0 otherwise
- @see event_base_loopexit()
- @see event_base_got_break()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_got_exit(struct event_base *);
-
-/**
- Checks if the event loop was told to abort immediately by event_base_loopbreak().
-
- This function will return true for an event_base at every point after
- event_base_loopbreak() is called, until the event loop is next entered.
-
- @param eb the event_base structure returned by event_init()
- @return true if event_base_loopbreak() was called on this event base,
- or 0 otherwise
- @see event_base_loopbreak()
- @see event_base_got_exit()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_got_break(struct event_base *);
-
-/**
- * @name event flags
- *
- * Flags to pass to event_new(), event_assign(), event_pending(), and
- * anything else with an argument of the form "short events"
- */
-/**@{*/
-/** Indicates that a timeout has occurred. It's not necessary to pass
- * this flag to event_for new()/event_assign() to get a timeout. */
-#define EV_TIMEOUT 0x01
-/** Wait for a socket or FD to become readable */
-#define EV_READ 0x02
-/** Wait for a socket or FD to become writeable */
-#define EV_WRITE 0x04
-/** Wait for a POSIX signal to be raised*/
-#define EV_SIGNAL 0x08
-/**
- * Persistent event: won't get removed automatically when activated.
- *
- * When a persistent event with a timeout becomes activated, its timeout
- * is reset to 0.
- */
-#define EV_PERSIST 0x10
-/** Select edge-triggered behavior, if supported by the backend. */
-#define EV_ET 0x20
-/**
- * If this option is provided, then event_del() will not block in one thread
- * while waiting for the event callback to complete in another thread.
- *
- * To use this option safely, you may need to use event_finalize() or
- * event_free_finalize() in order to safely tear down an event in a
- * multithreaded application. See those functions for more information.
- *
- * THIS IS AN EXPERIMENTAL API. IT MIGHT CHANGE BEFORE THE LIBEVENT 2.1 SERIES
- * BECOMES STABLE.
- **/
-#define EV_FINALIZE 0x40
-/**
- * Detects connection close events. You can use this to detect when a
- * connection has been closed, without having to read all the pending data
- * from a connection.
- *
- * Not all backends support EV_CLOSED. To detect or require it, use the
- * feature flag EV_FEATURE_EARLY_CLOSE.
- **/
-#define EV_CLOSED 0x80
-/**@}*/
-
-/**
- @name evtimer_* macros
-
- Aliases for working with one-shot timer events */
-/**@{*/
-#define evtimer_assign(ev, b, cb, arg) \
- event_assign((ev), (b), -1, 0, (cb), (arg))
-#define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
-#define evtimer_add(ev, tv) event_add((ev), (tv))
-#define evtimer_del(ev) event_del(ev)
-#define evtimer_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
-#define evtimer_initialized(ev) event_initialized(ev)
-/**@}*/
-
-/**
- @name evsignal_* macros
-
- Aliases for working with signal events
- */
-/**@{*/
-#define evsignal_add(ev, tv) event_add((ev), (tv))
-#define evsignal_assign(ev, b, x, cb, arg) \
- event_assign((ev), (b), (x), EV_SIGNAL|EV_PERSIST, cb, (arg))
-#define evsignal_new(b, x, cb, arg) \
- event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
-#define evsignal_del(ev) event_del(ev)
-#define evsignal_pending(ev, tv) event_pending((ev), EV_SIGNAL, (tv))
-#define evsignal_initialized(ev) event_initialized(ev)
-/**@}*/
-
-/**
- A callback function for an event.
-
- It receives three arguments:
-
- @param fd An fd or signal
- @param events One or more EV_* flags
- @param arg A user-supplied argument.
-
- @see event_new()
- */
-typedef void (*event_callback_fn)(evutil_socket_t, short, void *);
-
-/**
- Return a value used to specify that the event itself must be used as the callback argument.
-
- The function event_new() takes a callback argument which is passed
- to the event's callback function. To specify that the argument to be
- passed to the callback function is the event that event_new() returns,
- pass in the return value of event_self_cbarg() as the callback argument
- for event_new().
-
- For example:
-
- struct event *ev = event_new(base, sock, events, callback, %event_self_cbarg());
-
-
- For consistency with event_new(), it is possible to pass the return value
- of this function as the callback argument for event_assign() – this
- achieves the same result as passing the event in directly.
-
- @return a value to be passed as the callback argument to event_new() or
- event_assign().
- @see event_new(), event_assign()
- */
-EVENT2_EXPORT_SYMBOL
-void *event_self_cbarg(void);
-
-/**
- Allocate and asssign a new event structure, ready to be added.
-
- The function event_new() returns a new event that can be used in
- future calls to event_add() and event_del(). The fd and events
- arguments determine which conditions will trigger the event; the
- callback and callback_arg arguments tell Libevent what to do when the
- event becomes active.
-
- If events contains one of EV_READ, EV_WRITE, or EV_READ|EV_WRITE, then
- fd is a file descriptor or socket that should get monitored for
- readiness to read, readiness to write, or readiness for either operation
- (respectively). If events contains EV_SIGNAL, then fd is a signal
- number to wait for. If events contains none of those flags, then the
- event can be triggered only by a timeout or by manual activation with
- event_active(): In this case, fd must be -1.
-
- The EV_PERSIST flag can also be passed in the events argument: it makes
- event_add() persistent until event_del() is called.
-
- The EV_ET flag is compatible with EV_READ and EV_WRITE, and supported
- only by certain backends. It tells Libevent to use edge-triggered
- events.
-
- The EV_TIMEOUT flag has no effect here.
-
- It is okay to have multiple events all listening on the same fds; but
- they must either all be edge-triggered, or all not be edge triggerd.
-
- When the event becomes active, the event loop will run the provided
- callbuck function, with three arguments. The first will be the provided
- fd value. The second will be a bitfield of the events that triggered:
- EV_READ, EV_WRITE, or EV_SIGNAL. Here the EV_TIMEOUT flag indicates
- that a timeout occurred, and EV_ET indicates that an edge-triggered
- event occurred. The third event will be the callback_arg pointer that
- you provide.
-
- @param base the event base to which the event should be attached.
- @param fd the file descriptor or signal to be monitored, or -1.
- @param events desired events to monitor: bitfield of EV_READ, EV_WRITE,
- EV_SIGNAL, EV_PERSIST, EV_ET.
- @param callback callback function to be invoked when the event occurs
- @param callback_arg an argument to be passed to the callback function
-
- @return a newly allocated struct event that must later be freed with
- event_free().
- @see event_free(), event_add(), event_del(), event_assign()
- */
-EVENT2_EXPORT_SYMBOL
-struct event *event_new(struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
-
-
-/**
- Prepare a new, already-allocated event structure to be added.
-
- The function event_assign() prepares the event structure ev to be used
- in future calls to event_add() and event_del(). Unlike event_new(), it
- doesn't allocate memory itself: it requires that you have already
- allocated a struct event, probably on the heap. Doing this will
- typically make your code depend on the size of the event structure, and
- thereby create incompatibility with future versions of Libevent.
-
- The easiest way to avoid this problem is just to use event_new() and
- event_free() instead.
-
- A slightly harder way to future-proof your code is to use
- event_get_struct_event_size() to determine the required size of an event
- at runtime.
-
- Note that it is NOT safe to call this function on an event that is
- active or pending. Doing so WILL corrupt internal data structures in
- Libevent, and lead to strange, hard-to-diagnose bugs. You _can_ use
- event_assign to change an existing event, but only if it is not active
- or pending!
-
- The arguments for this function, and the behavior of the events that it
- makes, are as for event_new().
-
- @param ev an event struct to be modified
- @param base the event base to which ev should be attached.
- @param fd the file descriptor to be monitored
- @param events desired events to monitor; can be EV_READ and/or EV_WRITE
- @param callback callback function to be invoked when the event occurs
- @param callback_arg an argument to be passed to the callback function
-
- @return 0 if success, or -1 on invalid arguments.
-
- @see event_new(), event_add(), event_del(), event_base_once(),
- event_get_struct_event_size()
- */
-EVENT2_EXPORT_SYMBOL
-int event_assign(struct event *, struct event_base *, evutil_socket_t, short, event_callback_fn, void *);
-
-/**
- Deallocate a struct event * returned by event_new().
-
- If the event is pending or active, first make it non-pending and
- non-active.
- */
-EVENT2_EXPORT_SYMBOL
-void event_free(struct event *);
-
-/**
- * Callback type for event_finalize and event_free_finalize().
- *
- * THIS IS AN EXPERIMENTAL API. IT MIGHT CHANGE BEFORE THE LIBEVENT 2.1 SERIES
- * BECOMES STABLE.
- *
- **/
-typedef void (*event_finalize_callback_fn)(struct event *, void *);
-/**
- @name Finalization functions
-
- These functions are used to safely tear down an event in a multithreaded
- application. If you construct your events with EV_FINALIZE to avoid
- deadlocks, you will need a way to remove an event in the certainty that
- it will definitely not be running its callback when you deallocate it
- and its callback argument.
-
- To do this, call one of event_finalize() or event_free_finalize with
- 0 for its first argument, the event to tear down as its second argument,
- and a callback function as its third argument. The callback will be
- invoked as part of the event loop, with the event's priority.
-
- After you call a finalizer function, event_add() and event_active() will
- no longer work on the event, and event_del() will produce a no-op. You
- must not try to change the event's fields with event_assign() or
- event_set() while the finalize callback is in progress. Once the
- callback has been invoked, you should treat the event structure as
- containing uninitialized memory.
-
- The event_free_finalize() function frees the event after it's finalized;
- event_finalize() does not.
-
- A finalizer callback must not make events pending or active. It must not
- add events, activate events, or attempt to "resucitate" the event being
- finalized in any way.
-
- THIS IS AN EXPERIMENTAL API. IT MIGHT CHANGE BEFORE THE LIBEVENT 2.1 SERIES
- BECOMES STABLE.
-
- @return 0 on succes, -1 on failure.
- */
-/**@{*/
-EVENT2_EXPORT_SYMBOL
-int event_finalize(unsigned, struct event *, event_finalize_callback_fn);
-EVENT2_EXPORT_SYMBOL
-int event_free_finalize(unsigned, struct event *, event_finalize_callback_fn);
-/**@}*/
-
-/**
- Schedule a one-time event
-
- The function event_base_once() is similar to event_new(). However, it
- schedules a callback to be called exactly once, and does not require the
- caller to prepare an event structure.
-
- Note that in Libevent 2.0 and earlier, if the event is never triggered, the
- internal memory used to hold it will never be freed. In Libevent 2.1,
- the internal memory will get freed by event_base_free() if the event
- is never triggered. The 'arg' value, however, will not get freed in either
- case--you'll need to free that on your own if you want it to go away.
-
- @param base an event_base
- @param fd a file descriptor to monitor, or -1 for no fd.
- @param events event(s) to monitor; can be any of EV_READ |
- EV_WRITE, or EV_TIMEOUT
- @param callback callback function to be invoked when the event occurs
- @param arg an argument to be passed to the callback function
- @param timeout the maximum amount of time to wait for the event. NULL
- makes an EV_READ/EV_WRITE event make forever; NULL makes an
- EV_TIMEOUT event succees immediately.
- @return 0 if successful, or -1 if an error occurred
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_once(struct event_base *, evutil_socket_t, short, event_callback_fn, void *, const struct timeval *);
-
-/**
- Add an event to the set of pending events.
-
- The function event_add() schedules the execution of the event 'ev' when the
- condition specified by event_assign() or event_new() occurs, or when the time
- specified in timeout has elapesed. If atimeout is NULL, no timeout
- occurs and the function will only be
- called if a matching event occurs. The event in the
- ev argument must be already initialized by event_assign() or event_new()
- and may not be used
- in calls to event_assign() until it is no longer pending.
-
- If the event in the ev argument already has a scheduled timeout, calling
- event_add() replaces the old timeout with the new one if tv is non-NULL.
-
- @param ev an event struct initialized via event_assign() or event_new()
- @param timeout the maximum amount of time to wait for the event, or NULL
- to wait forever
- @return 0 if successful, or -1 if an error occurred
- @see event_del(), event_assign(), event_new()
- */
-EVENT2_EXPORT_SYMBOL
-int event_add(struct event *ev, const struct timeval *timeout);
-
-/**
- Remove a timer from a pending event without removing the event itself.
-
- If the event has a scheduled timeout, this function unschedules it but
- leaves the event otherwise pending.
-
- @param ev an event struct initialized via event_assign() or event_new()
- @return 0 on success, or -1 if an error occurrect.
-*/
-EVENT2_EXPORT_SYMBOL
-int event_remove_timer(struct event *ev);
-
-/**
- Remove an event from the set of monitored events.
-
- The function event_del() will cancel the event in the argument ev. If the
- event has already executed or has never been added the call will have no
- effect.
-
- @param ev an event struct to be removed from the working set
- @return 0 if successful, or -1 if an error occurred
- @see event_add()
- */
-EVENT2_EXPORT_SYMBOL
-int event_del(struct event *);
-
-/**
- As event_del(), but never blocks while the event's callback is running
- in another thread, even if the event was constructed without the
- EV_FINALIZE flag.
-
- THIS IS AN EXPERIMENTAL API. IT MIGHT CHANGE BEFORE THE LIBEVENT 2.1 SERIES
- BECOMES STABLE.
- */
-EVENT2_EXPORT_SYMBOL
-int event_del_noblock(struct event *ev);
-/**
- As event_del(), but always blocks while the event's callback is running
- in another thread, even if the event was constructed with the
- EV_FINALIZE flag.
-
- THIS IS AN EXPERIMENTAL API. IT MIGHT CHANGE BEFORE THE LIBEVENT 2.1 SERIES
- BECOMES STABLE.
- */
-EVENT2_EXPORT_SYMBOL
-int event_del_block(struct event *ev);
-
-/**
- Make an event active.
-
- You can use this function on a pending or a non-pending event to make it
- active, so that its callback will be run by event_base_dispatch() or
- event_base_loop().
-
- One common use in multithreaded programs is to wake the thread running
- event_base_loop() from another thread.
-
- @param ev an event to make active.
- @param res a set of flags to pass to the event's callback.
- @param ncalls an obsolete argument: this is ignored.
- **/
-EVENT2_EXPORT_SYMBOL
-void event_active(struct event *ev, int res, short ncalls);
-
-/**
- Checks if a specific event is pending or scheduled.
-
- @param ev an event struct previously passed to event_add()
- @param events the requested event type; any of EV_TIMEOUT|EV_READ|
- EV_WRITE|EV_SIGNAL
- @param tv if this field is not NULL, and the event has a timeout,
- this field is set to hold the time at which the timeout will
- expire.
-
- @return true if the event is pending on any of the events in 'what', (that
- is to say, it has been added), or 0 if the event is not added.
- */
-EVENT2_EXPORT_SYMBOL
-int event_pending(const struct event *ev, short events, struct timeval *tv);
-
-/**
- If called from within the callback for an event, returns that event.
-
- The behavior of this function is not defined when called from outside the
- callback function for an event.
- */
-EVENT2_EXPORT_SYMBOL
-struct event *event_base_get_running_event(struct event_base *base);
-
-/**
- Test if an event structure might be initialized.
-
- The event_initialized() function can be used to check if an event has been
- initialized.
-
- Warning: This function is only useful for distinguishing a a zeroed-out
- piece of memory from an initialized event, it can easily be confused by
- uninitialized memory. Thus, it should ONLY be used to distinguish an
- initialized event from zero.
-
- @param ev an event structure to be tested
- @return 1 if the structure might be initialized, or 0 if it has not been
- initialized
- */
-EVENT2_EXPORT_SYMBOL
-int event_initialized(const struct event *ev);
-
-/**
- Get the signal number assigned to a signal event
-*/
-#define event_get_signal(ev) ((int)event_get_fd(ev))
-
-/**
- Get the socket or signal assigned to an event, or -1 if the event has
- no socket.
-*/
-EVENT2_EXPORT_SYMBOL
-evutil_socket_t event_get_fd(const struct event *ev);
-
-/**
- Get the event_base associated with an event.
-*/
-EVENT2_EXPORT_SYMBOL
-struct event_base *event_get_base(const struct event *ev);
-
-/**
- Return the events (EV_READ, EV_WRITE, etc) assigned to an event.
-*/
-EVENT2_EXPORT_SYMBOL
-short event_get_events(const struct event *ev);
-
-/**
- Return the callback assigned to an event.
-*/
-EVENT2_EXPORT_SYMBOL
-event_callback_fn event_get_callback(const struct event *ev);
-
-/**
- Return the callback argument assigned to an event.
-*/
-EVENT2_EXPORT_SYMBOL
-void *event_get_callback_arg(const struct event *ev);
-
-/**
- Return the priority of an event.
- @see event_priority_init(), event_get_priority()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_get_priority(const struct event *ev);
-
-/**
- Extract _all_ of arguments given to construct a given event. The
- event_base is copied into *base_out, the fd is copied into *fd_out, and so
- on.
-
- If any of the "_out" arguments is NULL, it will be ignored.
- */
-EVENT2_EXPORT_SYMBOL
-void event_get_assignment(const struct event *event,
- struct event_base **base_out, evutil_socket_t *fd_out, short *events_out,
- event_callback_fn *callback_out, void **arg_out);
-
-/**
- Return the size of struct event that the Libevent library was compiled
- with.
-
- This will be NO GREATER than sizeof(struct event) if you're running with
- the same version of Libevent that your application was built with, but
- otherwise might not.
-
- Note that it might be SMALLER than sizeof(struct event) if some future
- version of Libevent adds extra padding to the end of struct event.
- We might do this to help ensure ABI-compatibility between different
- versions of Libevent.
- */
-EVENT2_EXPORT_SYMBOL
-size_t event_get_struct_event_size(void);
-
-/**
- Get the Libevent version.
-
- Note that this will give you the version of the library that you're
- currently linked against, not the version of the headers that you've
- compiled against.
-
- @return a string containing the version number of Libevent
-*/
-EVENT2_EXPORT_SYMBOL
-const char *event_get_version(void);
-
-/**
- Return a numeric representation of Libevent's version.
-
- Note that this will give you the version of the library that you're
- currently linked against, not the version of the headers you've used to
- compile.
-
- The format uses one byte each for the major, minor, and patchlevel parts of
- the version number. The low-order byte is unused. For example, version
- 2.0.1-alpha has a numeric representation of 0x02000100
-*/
-EVENT2_EXPORT_SYMBOL
-ev_uint32_t event_get_version_number(void);
-
-/** As event_get_version, but gives the version of Libevent's headers. */
-#define LIBEVENT_VERSION EVENT__VERSION
-/** As event_get_version_number, but gives the version number of Libevent's
- * headers. */
-#define LIBEVENT_VERSION_NUMBER EVENT__NUMERIC_VERSION
-
-/** Largest number of priorities that Libevent can support. */
-#define EVENT_MAX_PRIORITIES 256
-/**
- Set the number of different event priorities
-
- By default Libevent schedules all active events with the same priority.
- However, some time it is desirable to process some events with a higher
- priority than others. For that reason, Libevent supports strict priority
- queues. Active events with a lower priority are always processed before
- events with a higher priority.
-
- The number of different priorities can be set initially with the
- event_base_priority_init() function. This function should be called
- before the first call to event_base_dispatch(). The
- event_priority_set() function can be used to assign a priority to an
- event. By default, Libevent assigns the middle priority to all events
- unless their priority is explicitly set.
-
- Note that urgent-priority events can starve less-urgent events: after
- running all urgent-priority callbacks, Libevent checks for more urgent
- events again, before running less-urgent events. Less-urgent events
- will not have their callbacks run until there are no events more urgent
- than them that want to be active.
-
- @param eb the event_base structure returned by event_base_new()
- @param npriorities the maximum number of priorities
- @return 0 if successful, or -1 if an error occurred
- @see event_priority_set()
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_priority_init(struct event_base *, int);
-
-/**
- Get the number of different event priorities.
-
- @param eb the event_base structure returned by event_base_new()
- @return Number of different event priorities
- @see event_base_priority_init()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_base_get_npriorities(struct event_base *eb);
-
-/**
- Assign a priority to an event.
-
- @param ev an event struct
- @param priority the new priority to be assigned
- @return 0 if successful, or -1 if an error occurred
- @see event_priority_init(), event_get_priority()
- */
-EVENT2_EXPORT_SYMBOL
-int event_priority_set(struct event *, int);
-
-/**
- Prepare an event_base to use a large number of timeouts with the same
- duration.
-
- Libevent's default scheduling algorithm is optimized for having a large
- number of timeouts with their durations more or less randomly
- distributed. But if you have a large number of timeouts that all have
- the same duration (for example, if you have a large number of
- connections that all have a 10-second timeout), then you can improve
- Libevent's performance by telling Libevent about it.
-
- To do this, call this function with the common duration. It will return a
- pointer to a different, opaque timeout value. (Don't depend on its actual
- contents!) When you use this timeout value in event_add(), Libevent will
- schedule the event more efficiently.
-
- (This optimization probably will not be worthwhile until you have thousands
- or tens of thousands of events with the same timeout.)
- */
-EVENT2_EXPORT_SYMBOL
-const struct timeval *event_base_init_common_timeout(struct event_base *base,
- const struct timeval *duration);
-
-#if !defined(EVENT__DISABLE_MM_REPLACEMENT) || defined(EVENT_IN_DOXYGEN_)
-/**
- Override the functions that Libevent uses for memory management.
-
- Usually, Libevent uses the standard libc functions malloc, realloc, and
- free to allocate memory. Passing replacements for those functions to
- event_set_mem_functions() overrides this behavior.
-
- Note that all memory returned from Libevent will be allocated by the
- replacement functions rather than by malloc() and realloc(). Thus, if you
- have replaced those functions, it will not be appropriate to free() memory
- that you get from Libevent. Instead, you must use the free_fn replacement
- that you provided.
-
- Note also that if you are going to call this function, you should do so
- before any call to any Libevent function that does allocation.
- Otherwise, those funtions will allocate their memory using malloc(), but
- then later free it using your provided free_fn.
-
- @param malloc_fn A replacement for malloc.
- @param realloc_fn A replacement for realloc
- @param free_fn A replacement for free.
- **/
-EVENT2_EXPORT_SYMBOL
-void event_set_mem_functions(
- void *(*malloc_fn)(size_t sz),
- void *(*realloc_fn)(void *ptr, size_t sz),
- void (*free_fn)(void *ptr));
-/** This definition is present if Libevent was built with support for
- event_set_mem_functions() */
-#define EVENT_SET_MEM_FUNCTIONS_IMPLEMENTED
-#endif
-
-/**
- Writes a human-readable description of all inserted and/or active
- events to a provided stdio stream.
-
- This is intended for debugging; its format is not guaranteed to be the same
- between libevent versions.
-
- @param base An event_base on which to scan the events.
- @param output A stdio file to write on.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_dump_events(struct event_base *, FILE *);
-
-
-/**
- Activates all pending events for the given fd and event mask.
-
- This function activates pending events only. Events which have not been
- added will not become active.
-
- @param base the event_base on which to activate the events.
- @param fd An fd to active events on.
- @param events One or more of EV_{READ,WRITE}.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_active_by_fd(struct event_base *base, evutil_socket_t fd, short events);
-
-/**
- Activates all pending signals with a given signal number
-
- This function activates pending events only. Events which have not been
- added will not become active.
-
- @param base the event_base on which to activate the events.
- @param fd The signal to active events on.
- */
-EVENT2_EXPORT_SYMBOL
-void event_base_active_by_signal(struct event_base *base, int sig);
-
-/**
- * Callback for iterating events in an event base via event_base_foreach_event
- */
-typedef int (*event_base_foreach_event_cb)(const struct event_base *, const struct event *, void *);
-
-/**
- Iterate over all added or active events events in an event loop, and invoke
- a given callback on each one.
-
- The callback must not call any function that modifies the event base, that
- modifies any event in the event base, or that adds or removes any event to
- the event base. Doing so is unsupported and will lead to undefined
- behavior -- likely, to crashes.
-
- event_base_foreach_event() holds a lock on the event_base() for the whole
- time it's running: slow callbacks are not advisable.
-
- Note that Libevent adds some events of its own to make pieces of its
- functionality work. You must not assume that the only events you'll
- encounter will be the ones you added yourself.
-
- The callback function must return 0 to continue iteration, or some other
- integer to stop iterating.
-
- @param base An event_base on which to scan the events.
- @param fn A callback function to receive the events.
- @param arg An argument passed to the callback function.
- @return 0 if we iterated over every event, or the value returned by the
- callback function if the loop exited early.
-*/
-EVENT2_EXPORT_SYMBOL
-int event_base_foreach_event(struct event_base *base, event_base_foreach_event_cb fn, void *arg);
-
-
-/** Sets 'tv' to the current time (as returned by gettimeofday()),
- looking at the cached value in 'base' if possible, and calling
- gettimeofday() or clock_gettime() as appropriate if there is no
- cached time.
-
- Generally, this value will only be cached while actually
- processing event callbacks, and may be very inaccuate if your
- callbacks take a long time to execute.
-
- Returns 0 on success, negative on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_gettimeofday_cached(struct event_base *base,
- struct timeval *tv);
-
-/** Update cached_tv in the 'base' to the current time
- *
- * You can use this function is useful for selectively increasing
- * the accuracy of the cached time value in 'base' during callbacks
- * that take a long time to execute.
- *
- * This function has no effect if the base is currently not in its
- * event loop, or if timeval caching is disabled via
- * EVENT_BASE_FLAG_NO_CACHE_TIME.
- *
- * @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int event_base_update_cache_time(struct event_base *base);
-
-/** Release up all globally-allocated resources allocated by Libevent.
-
- This function does not free developer-controlled resources like
- event_bases, events, bufferevents, listeners, and so on. It only releases
- resources like global locks that there is no other way to free.
-
- It is not actually necessary to call this function before exit: every
- resource that it frees would be released anyway on exit. It mainly exists
- so that resource-leak debugging tools don't see Libevent as holding
- resources at exit.
-
- You should only call this function when no other Libevent functions will
- be invoked -- e.g., when cleanly exiting a program.
- */
-EVENT2_EXPORT_SYMBOL
-void libevent_global_shutdown(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_EVENT_H_INCLUDED_ */
diff --git a/src/components/libevent/event_compat.h b/src/components/libevent/event_compat.h
deleted file mode 100644
index 7aa36be..0000000
--- a/src/components/libevent/event_compat.h
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_EVENT_COMPAT_H_INCLUDED_
-#define EVENT2_EVENT_COMPAT_H_INCLUDED_
-
-/** @file event2/event_compat.h
-
- Potentially non-threadsafe versions of the functions in event.h: provided
- only for backwards compatibility.
-
- In the oldest versions of Libevent, event_base was not a first-class
- structure. Instead, there was a single event base that every function
- manipulated. Later, when separate event bases were added, the old functions
- that didn't take an event_base argument needed to work by manipulating the
- "current" event base. This could lead to thread-safety issues, and obscure,
- hard-to-diagnose bugs.
-
- @deprecated All functions in this file are by definition deprecated.
- */
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include
-#endif
-
-/* For int types. */
-#include
-
-/**
- Initialize the event API.
-
- The event API needs to be initialized with event_init() before it can be
- used. Sets the global current base that gets used for events that have no
- base associated with them.
-
- @deprecated This function is deprecated because it replaces the "current"
- event_base, and is totally unsafe for multithreaded use. The replacement
- is event_base_new().
-
- @see event_base_set(), event_base_new()
- */
-EVENT2_EXPORT_SYMBOL
-struct event_base *event_init(void);
-
-/**
- Loop to process events.
-
- Like event_base_dispatch(), but uses the "current" base.
-
- @deprecated This function is deprecated because it is easily confused by
- multiple calls to event_init(), and because it is not safe for
- multithreaded use. The replacement is event_base_dispatch().
-
- @see event_base_dispatch(), event_init()
- */
-EVENT2_EXPORT_SYMBOL
-int event_dispatch(void);
-
-/**
- Handle events.
-
- This function behaves like event_base_loop(), but uses the "current" base
-
- @deprecated This function is deprecated because it uses the event base from
- the last call to event_init, and is therefore not safe for multithreaded
- use. The replacement is event_base_loop().
-
- @see event_base_loop(), event_init()
-*/
-EVENT2_EXPORT_SYMBOL
-int event_loop(int);
-
-
-/**
- Exit the event loop after the specified time.
-
- This function behaves like event_base_loopexit(), except that it uses the
- "current" base.
-
- @deprecated This function is deprecated because it uses the event base from
- the last call to event_init, and is therefore not safe for multithreaded
- use. The replacement is event_base_loopexit().
-
- @see event_init, event_base_loopexit()
- */
-EVENT2_EXPORT_SYMBOL
-int event_loopexit(const struct timeval *);
-
-
-/**
- Abort the active event_loop() immediately.
-
- This function behaves like event_base_loopbreakt(), except that it uses the
- "current" base.
-
- @deprecated This function is deprecated because it uses the event base from
- the last call to event_init, and is therefore not safe for multithreaded
- use. The replacement is event_base_loopbreak().
-
- @see event_base_loopbreak(), event_init()
- */
-EVENT2_EXPORT_SYMBOL
-int event_loopbreak(void);
-
-/**
- Schedule a one-time event to occur.
-
- @deprecated This function is obsolete, and has been replaced by
- event_base_once(). Its use is deprecated because it relies on the
- "current" base configured by event_init().
-
- @see event_base_once()
- */
-EVENT2_EXPORT_SYMBOL
-int event_once(evutil_socket_t , short,
- void (*)(evutil_socket_t, short, void *), void *, const struct timeval *);
-
-
-/**
- Get the kernel event notification mechanism used by Libevent.
-
- @deprecated This function is obsolete, and has been replaced by
- event_base_get_method(). Its use is deprecated because it relies on the
- "current" base configured by event_init().
-
- @see event_base_get_method()
- */
-EVENT2_EXPORT_SYMBOL
-const char *event_get_method(void);
-
-
-/**
- Set the number of different event priorities.
-
- @deprecated This function is deprecated because it is easily confused by
- multiple calls to event_init(), and because it is not safe for
- multithreaded use. The replacement is event_base_priority_init().
-
- @see event_base_priority_init()
- */
-EVENT2_EXPORT_SYMBOL
-int event_priority_init(int);
-
-/**
- Prepare an event structure to be added.
-
- @deprecated event_set() is not recommended for new code, because it requires
- a subsequent call to event_base_set() to be safe under most circumstances.
- Use event_assign() or event_new() instead.
- */
-EVENT2_EXPORT_SYMBOL
-void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *);
-
-#define evtimer_set(ev, cb, arg) event_set((ev), -1, 0, (cb), (arg))
-#define evsignal_set(ev, x, cb, arg) \
- event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
-
-
-/**
- @name timeout_* macros
-
- @deprecated These macros are deprecated because their naming is inconsistent
- with the rest of Libevent. Use the evtimer_* macros instead.
- @{
- */
-#define timeout_add(ev, tv) event_add((ev), (tv))
-#define timeout_set(ev, cb, arg) event_set((ev), -1, 0, (cb), (arg))
-#define timeout_del(ev) event_del(ev)
-#define timeout_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
-#define timeout_initialized(ev) event_initialized(ev)
-/**@}*/
-
-/**
- @name signal_* macros
-
- @deprecated These macros are deprecated because their naming is inconsistent
- with the rest of Libevent. Use the evsignal_* macros instead.
- @{
- */
-#define signal_add(ev, tv) event_add((ev), (tv))
-#define signal_set(ev, x, cb, arg) \
- event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
-#define signal_del(ev) event_del(ev)
-#define signal_pending(ev, tv) event_pending((ev), EV_SIGNAL, (tv))
-#define signal_initialized(ev) event_initialized(ev)
-/**@}*/
-
-#ifndef EVENT_FD
-/* These macros are obsolete; use event_get_fd and event_get_signal instead. */
-#define EVENT_FD(ev) ((int)event_get_fd(ev))
-#define EVENT_SIGNAL(ev) event_get_signal(ev)
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/src/components/libevent/event_struct.h b/src/components/libevent/event_struct.h
deleted file mode 100644
index 3097cc7..0000000
--- a/src/components/libevent/event_struct.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_EVENT_STRUCT_H_INCLUDED_
-#define EVENT2_EVENT_STRUCT_H_INCLUDED_
-
-/** @file event2/event_struct.h
-
- Structures used by event.h. Using these structures directly WILL harm
- forward compatibility: be careful.
-
- No field declared in this file should be used directly in user code. Except
- for historical reasons, these fields would not be exposed at all.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include
-#endif
-
-/* For int types. */
-#include
-
-/* For evkeyvalq */
-#include
-
-#define EVLIST_TIMEOUT 0x01
-#define EVLIST_INSERTED 0x02
-#define EVLIST_SIGNAL 0x04
-#define EVLIST_ACTIVE 0x08
-#define EVLIST_INTERNAL 0x10
-#define EVLIST_ACTIVE_LATER 0x20
-#define EVLIST_FINALIZING 0x40
-#define EVLIST_INIT 0x80
-
-#define EVLIST_ALL 0xff
-
-/* Fix so that people don't have to run with */
-#ifndef TAILQ_ENTRY
-#define EVENT_DEFINED_TQENTRY_
-#define TAILQ_ENTRY(type) \
-struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
-}
-#endif /* !TAILQ_ENTRY */
-
-#ifndef TAILQ_HEAD
-#define EVENT_DEFINED_TQHEAD_
-#define TAILQ_HEAD(name, type) \
-struct name { \
- struct type *tqh_first; \
- struct type **tqh_last; \
-}
-#endif
-
-/* Fix so that people don't have to run with */
-#ifndef LIST_ENTRY
-#define EVENT_DEFINED_LISTENTRY_
-#define LIST_ENTRY(type) \
-struct { \
- struct type *le_next; /* next element */ \
- struct type **le_prev; /* address of previous next element */ \
-}
-#endif /* !LIST_ENTRY */
-
-#ifndef LIST_HEAD
-#define EVENT_DEFINED_LISTHEAD_
-#define LIST_HEAD(name, type) \
-struct name { \
- struct type *lh_first; /* first element */ \
- }
-#endif /* !LIST_HEAD */
-
-struct event;
-
-struct event_callback {
- TAILQ_ENTRY(event_callback) evcb_active_next;
- short evcb_flags;
- ev_uint8_t evcb_pri; /* smaller numbers are higher priority */
- ev_uint8_t evcb_closure;
- /* allows us to adopt for different types of events */
- union {
- void (*evcb_callback)(evutil_socket_t, short, void *);
- void (*evcb_selfcb)(struct event_callback *, void *);
- void (*evcb_evfinalize)(struct event *, void *);
- void (*evcb_cbfinalize)(struct event_callback *, void *);
- } evcb_cb_union;
- void *evcb_arg;
-};
-
-struct event_base;
-struct event {
- struct event_callback ev_evcallback;
-
- /* for managing timeouts */
- union {
- TAILQ_ENTRY(event) ev_next_with_common_timeout;
- int min_heap_idx;
- } ev_timeout_pos;
- evutil_socket_t ev_fd;
-
- struct event_base *ev_base;
-
- union {
- /* used for io events */
- struct {
- LIST_ENTRY (event) ev_io_next;
- struct timeval ev_timeout;
- } ev_io;
-
- /* used by signal events */
- struct {
- LIST_ENTRY (event) ev_signal_next;
- short ev_ncalls;
- /* Allows deletes in callback */
- short *ev_pncalls;
- } ev_signal;
- } ev_;
-
- short ev_events;
- short ev_res; /* result passed to event callback */
- struct timeval ev_timeout;
-};
-
-TAILQ_HEAD (event_list, event);
-
-#ifdef EVENT_DEFINED_TQENTRY_
-#undef TAILQ_ENTRY
-#endif
-
-#ifdef EVENT_DEFINED_TQHEAD_
-#undef TAILQ_HEAD
-#endif
-
-LIST_HEAD (event_dlist, event);
-
-#ifdef EVENT_DEFINED_LISTENTRY_
-#undef LIST_ENTRY
-#endif
-
-#ifdef EVENT_DEFINED_LISTHEAD_
-#undef LIST_HEAD
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_EVENT_STRUCT_H_INCLUDED_ */
diff --git a/src/components/libevent/http.h b/src/components/libevent/http.h
deleted file mode 100644
index f38a2b5..0000000
--- a/src/components/libevent/http.h
+++ /dev/null
@@ -1,1192 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_HTTP_H_INCLUDED_
-#define EVENT2_HTTP_H_INCLUDED_
-
-/* For int types. */
-#include
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* In case we haven't included the right headers yet. */
-struct evbuffer;
-struct event_base;
-struct bufferevent;
-struct evhttp_connection;
-
-/** @file event2/http.h
- *
- * Basic support for HTTP serving.
- *
- * As Libevent is a library for dealing with event notification and most
- * interesting applications are networked today, I have often found the
- * need to write HTTP code. The following prototypes and definitions provide
- * an application with a minimal interface for making HTTP requests and for
- * creating a very simple HTTP server.
- */
-
-/* Response codes */
-#define HTTP_OK 200 /**< request completed ok */
-#define HTTP_NOCONTENT 204 /**< request does not have content */
-#define HTTP_MOVEPERM 301 /**< the uri moved permanently */
-#define HTTP_MOVETEMP 302 /**< the uri moved temporarily */
-#define HTTP_NOTMODIFIED 304 /**< page was not modified from last */
-#define HTTP_BADREQUEST 400 /**< invalid http request was made */
-#define HTTP_NOTFOUND 404 /**< could not find content for uri */
-#define HTTP_BADMETHOD 405 /**< method not allowed for this uri */
-#define HTTP_ENTITYTOOLARGE 413 /**< */
-#define HTTP_EXPECTATIONFAILED 417 /**< we can't handle this expectation */
-#define HTTP_INTERNAL 500 /**< internal error */
-#define HTTP_NOTIMPLEMENTED 501 /**< not implemented */
-#define HTTP_SERVUNAVAIL 503 /**< the server is not available */
-
-struct evhttp;
-struct evhttp_request;
-struct evkeyvalq;
-struct evhttp_bound_socket;
-struct evconnlistener;
-struct evdns_base;
-
-/**
- * Create a new HTTP server.
- *
- * @param base (optional) the event base to receive the HTTP events
- * @return a pointer to a newly initialized evhttp server structure
- * @see evhttp_free()
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp *evhttp_new(struct event_base *base);
-
-/**
- * Binds an HTTP server on the specified address and port.
- *
- * Can be called multiple times to bind the same http server
- * to multiple different ports.
- *
- * @param http a pointer to an evhttp object
- * @param address a string containing the IP address to listen(2) on
- * @param port the port number to listen on
- * @return 0 on success, -1 on failure.
- * @see evhttp_accept_socket()
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_bind_socket(struct evhttp *http, const char *address, ev_uint16_t port);
-
-/**
- * Like evhttp_bind_socket(), but returns a handle for referencing the socket.
- *
- * The returned pointer is not valid after \a http is freed.
- *
- * @param http a pointer to an evhttp object
- * @param address a string containing the IP address to listen(2) on
- * @param port the port number to listen on
- * @return Handle for the socket on success, NULL on failure.
- * @see evhttp_bind_socket(), evhttp_del_accept_socket()
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_bound_socket *evhttp_bind_socket_with_handle(struct evhttp *http, const char *address, ev_uint16_t port);
-
-/**
- * Makes an HTTP server accept connections on the specified socket.
- *
- * This may be useful to create a socket and then fork multiple instances
- * of an http server, or when a socket has been communicated via file
- * descriptor passing in situations where an http servers does not have
- * permissions to bind to a low-numbered port.
- *
- * Can be called multiple times to have the http server listen to
- * multiple different sockets.
- *
- * @param http a pointer to an evhttp object
- * @param fd a socket fd that is ready for accepting connections
- * @return 0 on success, -1 on failure.
- * @see evhttp_bind_socket()
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_accept_socket(struct evhttp *http, evutil_socket_t fd);
-
-/**
- * Like evhttp_accept_socket(), but returns a handle for referencing the socket.
- *
- * The returned pointer is not valid after \a http is freed.
- *
- * @param http a pointer to an evhttp object
- * @param fd a socket fd that is ready for accepting connections
- * @return Handle for the socket on success, NULL on failure.
- * @see evhttp_accept_socket(), evhttp_del_accept_socket()
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_bound_socket *evhttp_accept_socket_with_handle(struct evhttp *http, evutil_socket_t fd);
-
-/**
- * The most low-level evhttp_bind/accept method: takes an evconnlistener, and
- * returns an evhttp_bound_socket. The listener will be freed when the bound
- * socket is freed.
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_bound_socket *evhttp_bind_listener(struct evhttp *http, struct evconnlistener *listener);
-
-EVENT2_EXPORT_SYMBOL
-void accept_socket_cb(struct evconnlistener *listener, evutil_socket_t nfd,
- struct sockaddr *peer_sa, int peer_socklen, void *arg);
-/**
- * Return the listener used to implement a bound socket.
- */
-EVENT2_EXPORT_SYMBOL
-struct evconnlistener *evhttp_bound_socket_get_listener(struct evhttp_bound_socket *bound);
-
-typedef void evhttp_bound_socket_foreach_fn(struct evhttp_bound_socket *, void *);
-/**
- * Applies the function specified in the first argument to all
- * evhttp_bound_sockets associated with "http". The user must not
- * attempt to free or remove any connections, sockets or listeners
- * in the callback "function".
- *
- * @param http pointer to an evhttp object
- * @param function function to apply to every bound socket
- * @param argument pointer value passed to function for every socket iterated
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_foreach_bound_socket(struct evhttp *http, evhttp_bound_socket_foreach_fn *function, void *argument);
-
-/**
- * Makes an HTTP server stop accepting connections on the specified socket
- *
- * This may be useful when a socket has been sent via file descriptor passing
- * and is no longer needed by the current process.
- *
- * If you created this bound socket with evhttp_bind_socket_with_handle or
- * evhttp_accept_socket_with_handle, this function closes the fd you provided.
- * If you created this bound socket with evhttp_bind_listener, this function
- * frees the listener you provided.
- *
- * \a bound_socket is an invalid pointer after this call returns.
- *
- * @param http a pointer to an evhttp object
- * @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
- * @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_del_accept_socket(struct evhttp *http, struct evhttp_bound_socket *bound_socket);
-
-/**
- * Get the raw file descriptor referenced by an evhttp_bound_socket.
- *
- * @param bound_socket a handle returned by evhttp_{bind,accept}_socket_with_handle
- * @return the file descriptor used by the bound socket
- * @see evhttp_bind_socket_with_handle(), evhttp_accept_socket_with_handle()
- */
-EVENT2_EXPORT_SYMBOL
-evutil_socket_t evhttp_bound_socket_get_fd(struct evhttp_bound_socket *bound_socket);
-
-/**
- * Free the previously created HTTP server.
- *
- * Works only if no requests are currently being served.
- *
- * @param http the evhttp server object to be freed
- * @see evhttp_start()
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_free(struct evhttp* http);
-
-/** XXX Document. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_max_headers_size(struct evhttp* http, ev_ssize_t max_headers_size);
-/** XXX Document. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_max_body_size(struct evhttp* http, ev_ssize_t max_body_size);
-
-/**
- Set the value to use for the Content-Type header when none was provided. If
- the content type string is NULL, the Content-Type header will not be
- automatically added.
-
- @param http the http server on which to set the default content type
- @param content_type the value for the Content-Type header
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_default_content_type(struct evhttp *http,
- const char *content_type);
-
-/**
- Sets the what HTTP methods are supported in requests accepted by this
- server, and passed to user callbacks.
-
- If not supported they will generate a "405 Method not allowed" response.
-
- By default this includes the following methods: GET, POST, HEAD, PUT, DELETE
-
- @param http the http server on which to set the methods
- @param methods bit mask constructed from evhttp_cmd_type values
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_allowed_methods(struct evhttp* http, ev_uint16_t methods);
-
-/**
- Set a callback for a specified URI
-
- @param http the http sever on which to set the callback
- @param path the path for which to invoke the callback
- @param cb the callback function that gets invoked on requesting path
- @param cb_arg an additional context argument for the callback
- @return 0 on success, -1 if the callback existed already, -2 on failure
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_set_cb(struct evhttp *http, const char *path,
- void (*cb)(struct evhttp_request *, void *), void *cb_arg);
-
-/** Removes the callback for a specified URI */
-EVENT2_EXPORT_SYMBOL
-int evhttp_del_cb(struct evhttp *, const char *);
-
-/**
- Set a callback for all requests that are not caught by specific callbacks
-
- Invokes the specified callback for all requests that do not match any of
- the previously specified request paths. This is catchall for requests not
- specifically configured with evhttp_set_cb().
-
- @param http the evhttp server object for which to set the callback
- @param cb the callback to invoke for any unmatched requests
- @param arg an context argument for the callback
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_gencb(struct evhttp *http,
- void (*cb)(struct evhttp_request *, void *), void *arg);
-
-/**
- Set a callback used to create new bufferevents for connections
- to a given evhttp object.
-
- You can use this to override the default bufferevent type -- for example,
- to make this evhttp object use SSL bufferevents rather than unencrypted
- ones.
-
- New bufferevents must be allocated with no fd set on them.
-
- @param http the evhttp server object for which to set the callback
- @param cb the callback to invoke for incoming connections
- @param arg an context argument for the callback
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_bevcb(struct evhttp *http,
- struct bufferevent *(*cb)(struct event_base *, void *), void *arg);
-
-/**
- Adds a virtual host to the http server.
-
- A virtual host is a newly initialized evhttp object that has request
- callbacks set on it via evhttp_set_cb() or evhttp_set_gencb(). It
- most not have any listing sockets associated with it.
-
- If the virtual host has not been removed by the time that evhttp_free()
- is called on the main http server, it will be automatically freed, too.
-
- It is possible to have hierarchical vhosts. For example: A vhost
- with the pattern *.example.com may have other vhosts with patterns
- foo.example.com and bar.example.com associated with it.
-
- @param http the evhttp object to which to add a virtual host
- @param pattern the glob pattern against which the hostname is matched.
- The match is case insensitive and follows otherwise regular shell
- matching.
- @param vhost the virtual host to add the regular http server.
- @return 0 on success, -1 on failure
- @see evhttp_remove_virtual_host()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_add_virtual_host(struct evhttp* http, const char *pattern,
- struct evhttp* vhost);
-
-/**
- Removes a virtual host from the http server.
-
- @param http the evhttp object from which to remove the virtual host
- @param vhost the virtual host to remove from the regular http server.
- @return 0 on success, -1 on failure
- @see evhttp_add_virtual_host()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_remove_virtual_host(struct evhttp* http, struct evhttp* vhost);
-
-/**
- Add a server alias to an http object. The http object can be a virtual
- host or the main server.
-
- @param http the evhttp object
- @param alias the alias to add
- @see evhttp_add_remove_alias()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_add_server_alias(struct evhttp *http, const char *alias);
-
-/**
- Remove a server alias from an http object.
-
- @param http the evhttp object
- @param alias the alias to remove
- @see evhttp_add_server_alias()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_remove_server_alias(struct evhttp *http, const char *alias);
-
-/**
- * Set the timeout for an HTTP request.
- *
- * @param http an evhttp object
- * @param timeout_in_secs the timeout, in seconds
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_timeout(struct evhttp *http, int timeout_in_secs);
-
-/**
- * Set the timeout for an HTTP request.
- *
- * @param http an evhttp object
- * @param tv the timeout, or NULL
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_set_timeout_tv(struct evhttp *http, const struct timeval* tv);
-
-/* Read all the clients body, and only after this respond with an error if the
- * clients body exceed max_body_size */
-#define EVHTTP_SERVER_LINGERING_CLOSE 0x0001
-/**
- * Set connection flags for HTTP server.
- *
- * @see EVHTTP_SERVER_*
- * @return 0 on success, otherwise non zero (for example if flag doesn't
- * supported).
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_set_flags(struct evhttp *http, int flags);
-
-/* Request/Response functionality */
-
-/**
- * Send an HTML error message to the client.
- *
- * @param req a request object
- * @param error the HTTP error code
- * @param reason a brief explanation of the error. If this is NULL, we'll
- * just use the standard meaning of the error code.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_error(struct evhttp_request *req, int error,
- const char *reason);
-
-/**
- * Send an HTML reply to the client.
- *
- * The body of the reply consists of the data in databuf. After calling
- * evhttp_send_reply() databuf will be empty, but the buffer is still
- * owned by the caller and needs to be deallocated by the caller if
- * necessary.
- *
- * @param req a request object
- * @param code the HTTP response code to send
- * @param reason a brief message to send with the response code
- * @param databuf the body of the response
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_reply(struct evhttp_request *req, int code,
- const char *reason, struct evbuffer *databuf);
-
-/* Low-level response interface, for streaming/chunked replies */
-
-/**
- Initiate a reply that uses Transfer-Encoding chunked.
-
- This allows the caller to stream the reply back to the client and is
- useful when either not all of the reply data is immediately available
- or when sending very large replies.
-
- The caller needs to supply data chunks with evhttp_send_reply_chunk()
- and complete the reply by calling evhttp_send_reply_end().
-
- @param req a request object
- @param code the HTTP response code to send
- @param reason a brief message to send with the response code
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_reply_start(struct evhttp_request *req, int code,
- const char *reason);
-
-/**
- Send another data chunk as part of an ongoing chunked reply.
-
- The reply chunk consists of the data in databuf. After calling
- evhttp_send_reply_chunk() databuf will be empty, but the buffer is
- still owned by the caller and needs to be deallocated by the caller
- if necessary.
-
- @param req a request object
- @param databuf the data chunk to send as part of the reply.
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_reply_chunk(struct evhttp_request *req,
- struct evbuffer *databuf);
-
-/**
- Send another data chunk as part of an ongoing chunked reply.
-
- The reply chunk consists of the data in databuf. After calling
- evhttp_send_reply_chunk() databuf will be empty, but the buffer is
- still owned by the caller and needs to be deallocated by the caller
- if necessary.
-
- @param req a request object
- @param databuf the data chunk to send as part of the reply.
- @param cb callback funcion
- @param call back's argument.
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_reply_chunk_with_cb(struct evhttp_request *, struct evbuffer *,
- void (*cb)(struct evhttp_connection *, void *), void *arg);
-
-/**
- Complete a chunked reply, freeing the request as appropriate.
-
- @param req a request object
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_send_reply_end(struct evhttp_request *req);
-
-/*
- * Interfaces for making requests
- */
-
-/** The different request types supported by evhttp. These are as specified
- * in RFC2616, except for PATCH which is specified by RFC5789.
- *
- * By default, only some of these methods are accepted and passed to user
- * callbacks; use evhttp_set_allowed_methods() to change which methods
- * are allowed.
- */
-enum evhttp_cmd_type {
- EVHTTP_REQ_GET = 1 << 0,
- EVHTTP_REQ_POST = 1 << 1,
- EVHTTP_REQ_HEAD = 1 << 2,
- EVHTTP_REQ_PUT = 1 << 3,
- EVHTTP_REQ_DELETE = 1 << 4,
- EVHTTP_REQ_OPTIONS = 1 << 5,
- EVHTTP_REQ_TRACE = 1 << 6,
- EVHTTP_REQ_CONNECT = 1 << 7,
- EVHTTP_REQ_PATCH = 1 << 8
-};
-
-/** a request object can represent either a request or a reply */
-enum evhttp_request_kind { EVHTTP_REQUEST, EVHTTP_RESPONSE };
-
-/**
- * Create and return a connection object that can be used to for making HTTP
- * requests. The connection object tries to resolve address and establish the
- * connection when it is given an http request object.
- *
- * @param base the event_base to use for handling the connection
- * @param dnsbase the dns_base to use for resolving host names; if not
- * specified host name resolution will block.
- * @param bev a bufferevent to use for connecting to the server; if NULL, a
- * socket-based bufferevent will be created. This buffrevent will be freed
- * when the connection closes. It must have no fd set on it.
- * @param address the address to which to connect
- * @param port the port to connect to
- * @return an evhttp_connection object that can be used for making requests
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_connection *evhttp_connection_base_bufferevent_new(
- struct event_base *base, struct evdns_base *dnsbase, struct bufferevent* bev, const char *address, ev_uint16_t port);
-
-/**
- * Return the bufferevent that an evhttp_connection is using.
- */
-EVENT2_EXPORT_SYMBOL
-struct bufferevent* evhttp_connection_get_bufferevent(struct evhttp_connection *evcon);
-
-/**
- * Return the HTTP server associated with this connection, or NULL.
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp *evhttp_connection_get_server(struct evhttp_connection *evcon);
-
-/**
- * Creates a new request object that needs to be filled in with the request
- * parameters. The callback is executed when the request completed or an
- * error occurred.
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_request *evhttp_request_new(
- void (*cb)(struct evhttp_request *, void *), void *arg);
-
-/**
- * Enable delivery of chunks to requestor.
- * @param cb will be called after every read of data with the same argument
- * as the completion callback. Will never be called on an empty
- * response. May drain the input buffer; it will be drained
- * automatically on return.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_chunked_cb(struct evhttp_request *,
- void (*cb)(struct evhttp_request *, void *));
-
-/**
- * Register callback for additional parsing of request headers.
- * @param cb will be called after receiving and parsing the full header.
- * It allows analyzing the header and possibly closing the connection
- * by returning a value < 0.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_header_cb(struct evhttp_request *,
- int (*cb)(struct evhttp_request *, void *));
-
-/**
- * The different error types supported by evhttp
- *
- * @see evhttp_request_set_error_cb()
- */
-enum evhttp_request_error {
- /**
- * Timeout reached, also @see evhttp_connection_set_timeout()
- */
- EVREQ_HTTP_TIMEOUT,
- /**
- * EOF reached
- */
- EVREQ_HTTP_EOF,
- /**
- * Error while reading header, or invalid header
- */
- EVREQ_HTTP_INVALID_HEADER,
- /**
- * Error encountered while reading or writing
- */
- EVREQ_HTTP_BUFFER_ERROR,
- /**
- * The evhttp_cancel_request() called on this request.
- */
- EVREQ_HTTP_REQUEST_CANCEL,
- /**
- * Body is greater then evhttp_connection_set_max_body_size()
- */
- EVREQ_HTTP_DATA_TOO_LONG
-};
-/**
- * Set a callback for errors
- * @see evhttp_request_error for error types.
- *
- * On error, both the error callback and the regular callback will be called,
- * error callback is called before the regular callback.
- **/
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_error_cb(struct evhttp_request *,
- void (*)(enum evhttp_request_error, void *));
-
-/**
- * Set a callback to be called on request completion of evhttp_send_* function.
- *
- * The callback function will be called on the completion of the request after
- * the output data has been written and before the evhttp_request object
- * is destroyed. This can be useful for tracking resources associated with a
- * request (ex: timing metrics).
- *
- * @param req a request object
- * @param cb callback function that will be called on request completion
- * @param cb_arg an additional context argument for the callback
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_set_on_complete_cb(struct evhttp_request *req,
- void (*cb)(struct evhttp_request *, void *), void *cb_arg);
-
-/** Frees the request object and removes associated events. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_free(struct evhttp_request *req);
-
-/**
- * Create and return a connection object that can be used to for making HTTP
- * requests. The connection object tries to resolve address and establish the
- * connection when it is given an http request object.
- *
- * @param base the event_base to use for handling the connection
- * @param dnsbase the dns_base to use for resolving host names; if not
- * specified host name resolution will block.
- * @param address the address to which to connect
- * @param port the port to connect to
- * @return an evhttp_connection object that can be used for making requests
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_connection *evhttp_connection_base_new(
- struct event_base *base, struct evdns_base *dnsbase,
- const char *address, ev_uint16_t port);
-
-/**
- * Set family hint for DNS requests.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_family(struct evhttp_connection *evcon,
- int family);
-
-/* reuse connection address on retry */
-#define EVHTTP_CON_REUSE_CONNECTED_ADDR 0x0008
-/* Try to read error, since server may already send and close
- * connection, but if at that time we have some data to send then we
- * can send get EPIPE and fail, while we can read that HTTP error. */
-#define EVHTTP_CON_READ_ON_WRITE_ERROR 0x0010
-/* @see EVHTTP_SERVER_LINGERING_CLOSE */
-#define EVHTTP_CON_LINGERING_CLOSE 0x0020
-/* Padding for public flags, @see EVHTTP_CON_* in http-internal.h */
-#define EVHTTP_CON_PUBLIC_FLAGS_END 0x100000
-/**
- * Set connection flags.
- *
- * @see EVHTTP_CON_*
- * @return 0 on success, otherwise non zero (for example if flag doesn't
- * supported).
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_connection_set_flags(struct evhttp_connection *evcon,
- int flags);
-
-/** Takes ownership of the request object
- *
- * Can be used in a request callback to keep onto the request until
- * evhttp_request_free() is explicitly called by the user.
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_request_own(struct evhttp_request *req);
-
-/** Returns 1 if the request is owned by the user */
-EVENT2_EXPORT_SYMBOL
-int evhttp_request_is_owned(struct evhttp_request *req);
-
-/**
- * Returns the connection object associated with the request or NULL
- *
- * The user needs to either free the request explicitly or call
- * evhttp_send_reply_end().
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_connection *evhttp_request_get_connection(struct evhttp_request *req);
-
-/**
- * Returns the underlying event_base for this connection
- */
-EVENT2_EXPORT_SYMBOL
-struct event_base *evhttp_connection_get_base(struct evhttp_connection *req);
-
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_max_headers_size(struct evhttp_connection *evcon,
- ev_ssize_t new_max_headers_size);
-
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_max_body_size(struct evhttp_connection* evcon,
- ev_ssize_t new_max_body_size);
-
-/** Frees an http connection */
-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,
- const char *address);
-
-/** sets the local port from which http connections are made */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_local_port(struct evhttp_connection *evcon,
- ev_uint16_t port);
-
-/** Sets the timeout in seconds for events related to this connection */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_timeout(struct evhttp_connection *evcon,
- int timeout_in_secs);
-
-/** Sets the timeout for events related to this connection. Takes a struct
- * timeval. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_timeout_tv(struct evhttp_connection *evcon,
- const struct timeval *tv);
-
-/** Sets the delay before retrying requests on this connection. This is only
- * used if evhttp_connection_set_retries is used to make the number of retries
- * at least one. Each retry after the first is twice as long as the one before
- * it. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_initial_retry_tv(struct evhttp_connection *evcon,
- const struct timeval *tv);
-
-/** Sets the retry limit for this connection - -1 repeats indefinitely */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_retries(struct evhttp_connection *evcon,
- int retry_max);
-
-/** Set a callback for connection close. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_set_closecb(struct evhttp_connection *evcon,
- void (*)(struct evhttp_connection *, void *), void *);
-
-/** Get the remote address and port associated with this connection. */
-EVENT2_EXPORT_SYMBOL
-void evhttp_connection_get_peer(struct evhttp_connection *evcon,
- char **address, ev_uint16_t *port);
-
-/** Get the remote address associated with this connection.
- * extracted from getpeername() OR from nameserver.
- *
- * @return NULL if getpeername() return non success,
- * or connection is not connected,
- * otherwise it return pointer to struct sockaddr_storage */
-EVENT2_EXPORT_SYMBOL
-const struct sockaddr*
-evhttp_connection_get_addr(struct evhttp_connection *evcon);
-
-/**
- Make an HTTP request over the specified connection.
-
- The connection gets ownership of the request. On failure, the
- request object is no longer valid as it has been freed.
-
- @param evcon the evhttp_connection object over which to send the request
- @param req the previously created and configured request object
- @param type the request type EVHTTP_REQ_GET, EVHTTP_REQ_POST, etc.
- @param uri the URI associated with the request
- @return 0 on success, -1 on failure
- @see evhttp_cancel_request()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_make_request(struct evhttp_connection *evcon,
- struct evhttp_request *req,
- enum evhttp_cmd_type type, const char *uri);
-
-/**
- Cancels a pending HTTP request.
-
- Cancels an ongoing HTTP request. The callback associated with this request
- is not executed and the request object is freed. If the request is
- currently being processed, e.g. it is ongoing, the corresponding
- evhttp_connection object is going to get reset.
-
- A request cannot be canceled if its callback has executed already. A request
- may be canceled reentrantly from its chunked callback.
-
- @param req the evhttp_request to cancel; req becomes invalid after this call.
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_cancel_request(struct evhttp_request *req);
-
-/**
- * A structure to hold a parsed URI or Relative-Ref conforming to RFC3986.
- */
-struct evhttp_uri;
-
-/** Returns the request URI */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_request_get_uri(const struct evhttp_request *req);
-/** Returns the request URI (parsed) */
-EVENT2_EXPORT_SYMBOL
-const struct evhttp_uri *evhttp_request_get_evhttp_uri(const struct evhttp_request *req);
-/** Returns the request command */
-EVENT2_EXPORT_SYMBOL
-enum evhttp_cmd_type evhttp_request_get_command(const struct evhttp_request *req);
-
-EVENT2_EXPORT_SYMBOL
-int evhttp_request_get_response_code(const struct evhttp_request *req);
-EVENT2_EXPORT_SYMBOL
-const char * evhttp_request_get_response_code_line(const struct evhttp_request *req);
-
-/** Returns the input headers */
-EVENT2_EXPORT_SYMBOL
-struct evkeyvalq *evhttp_request_get_input_headers(struct evhttp_request *req);
-/** Returns the output headers */
-EVENT2_EXPORT_SYMBOL
-struct evkeyvalq *evhttp_request_get_output_headers(struct evhttp_request *req);
-/** Returns the input buffer */
-EVENT2_EXPORT_SYMBOL
-struct evbuffer *evhttp_request_get_input_buffer(struct evhttp_request *req);
-/** Returns the output buffer */
-EVENT2_EXPORT_SYMBOL
-struct evbuffer *evhttp_request_get_output_buffer(struct evhttp_request *req);
-/** Returns the host associated with the request. If a client sends an absolute
- URI, the host part of that is preferred. Otherwise, the input headers are
- searched for a Host: header. NULL is returned if no absolute URI or Host:
- header is provided. */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_request_get_host(struct evhttp_request *req);
-
-/* Interfaces for dealing with HTTP headers */
-
-/**
- Finds the value belonging to a header.
-
- @param headers the evkeyvalq object in which to find the header
- @param key the name of the header to find
- @returns a pointer to the value for the header or NULL if the header
- could not be found.
- @see evhttp_add_header(), evhttp_remove_header()
-*/
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_find_header(const struct evkeyvalq *headers,
- const char *key);
-
-/**
- Removes a header from a list of existing headers.
-
- @param headers the evkeyvalq object from which to remove a header
- @param key the name of the header to remove
- @returns 0 if the header was removed, -1 otherwise.
- @see evhttp_find_header(), evhttp_add_header()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_remove_header(struct evkeyvalq *headers, const char *key);
-
-/**
- Adds a header to a list of existing headers.
-
- @param headers the evkeyvalq object to which to add a header
- @param key the name of the header
- @param value the value belonging to the header
- @returns 0 on success, -1 otherwise.
- @see evhttp_find_header(), evhttp_clear_headers()
-*/
-EVENT2_EXPORT_SYMBOL
-int evhttp_add_header(struct evkeyvalq *headers, const char *key, const char *value);
-
-/**
- Removes all headers from the header list.
-
- @param headers the evkeyvalq object from which to remove all headers
-*/
-EVENT2_EXPORT_SYMBOL
-void evhttp_clear_headers(struct evkeyvalq *headers);
-
-/* Miscellaneous utility functions */
-
-
-/**
- Helper function to encode a string for inclusion in a URI. All
- characters are replaced by their hex-escaped (%22) equivalents,
- except for characters explicitly unreserved by RFC3986 -- that is,
- ASCII alphanumeric characters, hyphen, dot, underscore, and tilde.
-
- The returned string must be freed by the caller.
-
- @param str an unencoded string
- @return a newly allocated URI-encoded string or NULL on failure
- */
-EVENT2_EXPORT_SYMBOL
-char *evhttp_encode_uri(const char *str);
-
-/**
- As evhttp_encode_uri, but if 'size' is nonnegative, treat the string
- as being 'size' bytes long. This allows you to encode strings that
- may contain 0-valued bytes.
-
- The returned string must be freed by the caller.
-
- @param str an unencoded string
- @param size the length of the string to encode, or -1 if the string
- is NUL-terminated
- @param space_to_plus if true, space characters in 'str' are encoded
- as +, not %20.
- @return a newly allocate URI-encoded string, or NULL on failure.
- */
-EVENT2_EXPORT_SYMBOL
-char *evhttp_uriencode(const char *str, ev_ssize_t size, int space_to_plus);
-
-/**
- Helper function to sort of decode a URI-encoded string. Unlike
- evhttp_get_decoded_uri, it decodes all plus characters that appear
- _after_ the first question mark character, but no plusses that occur
- before. This is not a good way to decode URIs in whole or in part.
-
- The returned string must be freed by the caller
-
- @deprecated This function is deprecated; you probably want to use
- evhttp_get_decoded_uri instead.
-
- @param uri an encoded URI
- @return a newly allocated unencoded URI or NULL on failure
- */
-EVENT2_EXPORT_SYMBOL
-char *evhttp_decode_uri(const char *uri);
-
-/**
- Helper function to decode a URI-escaped string or HTTP parameter.
-
- If 'decode_plus' is 1, then we decode the string as an HTTP parameter
- value, and convert all plus ('+') characters to spaces. If
- 'decode_plus' is 0, we leave all plus characters unchanged.
-
- The returned string must be freed by the caller.
-
- @param uri a URI-encode encoded URI
- @param decode_plus determines whether we convert '+' to space.
- @param size_out if size_out is not NULL, *size_out is set to the size of the
- returned string
- @return a newly allocated unencoded URI or NULL on failure
- */
-EVENT2_EXPORT_SYMBOL
-char *evhttp_uridecode(const char *uri, int decode_plus,
- size_t *size_out);
-
-/**
- Helper function to parse out arguments in a query.
-
- Parsing a URI like
-
- http://foo.com/?q=test&s=some+thing
-
- will result in two entries in the key value queue.
-
- The first entry is: key="q", value="test"
- The second entry is: key="s", value="some thing"
-
- @deprecated This function is deprecated as of Libevent 2.0.9. Use
- evhttp_uri_parse and evhttp_parse_query_str instead.
-
- @param uri the request URI
- @param headers the head of the evkeyval queue
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_parse_query(const char *uri, struct evkeyvalq *headers);
-
-/**
- Helper function to parse out arguments from the query portion of an
- HTTP URI.
-
- Parsing a query string like
-
- q=test&s=some+thing
-
- will result in two entries in the key value queue.
-
- The first entry is: key="q", value="test"
- The second entry is: key="s", value="some thing"
-
- @param query_parse the query portion of the URI
- @param headers the head of the evkeyval queue
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evhttp_parse_query_str(const char *uri, struct evkeyvalq *headers);
-
-/**
- * Escape HTML character entities in a string.
- *
- * Replaces <, >, ", ' and & with <, >, ",
- * ' and & correspondingly.
- *
- * The returned string needs to be freed by the caller.
- *
- * @param html an unescaped HTML string
- * @return an escaped HTML string or NULL on error
- */
-EVENT2_EXPORT_SYMBOL
-char *evhttp_htmlescape(const char *html);
-
-/**
- * Return a new empty evhttp_uri with no fields set.
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_uri *evhttp_uri_new(void);
-
-/**
- * Changes the flags set on a given URI. See EVHTTP_URI_* for
- * a list of flags.
- **/
-EVENT2_EXPORT_SYMBOL
-void evhttp_uri_set_flags(struct evhttp_uri *uri, unsigned flags);
-
-/** Return the scheme of an evhttp_uri, or NULL if there is no scheme has
- * been set and the evhttp_uri contains a Relative-Ref. */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_uri_get_scheme(const struct evhttp_uri *uri);
-/**
- * Return the userinfo part of an evhttp_uri, or NULL if it has no userinfo
- * set.
- */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_uri_get_userinfo(const struct evhttp_uri *uri);
-/**
- * Return the host part of an evhttp_uri, or NULL if it has no host set.
- * The host may either be a regular hostname (conforming to the RFC 3986
- * "regname" production), or an IPv4 address, or the empty string, or a
- * bracketed IPv6 address, or a bracketed 'IP-Future' address.
- *
- * Note that having a NULL host means that the URI has no authority
- * section, but having an empty-string host means that the URI has an
- * authority section with no host part. For example,
- * "mailto:user@example.com" has a host of NULL, but "file:///etc/motd"
- * has a host of "".
- */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_uri_get_host(const struct evhttp_uri *uri);
-/** Return the port part of an evhttp_uri, or -1 if there is no port set. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_get_port(const struct evhttp_uri *uri);
-/** Return the path part of an evhttp_uri, or NULL if it has no path set */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_uri_get_path(const struct evhttp_uri *uri);
-/** Return the query part of an evhttp_uri (excluding the leading "?"), or
- * NULL if it has no query set */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_uri_get_query(const struct evhttp_uri *uri);
-/** Return the fragment part of an evhttp_uri (excluding the leading "#"),
- * or NULL if it has no fragment set */
-EVENT2_EXPORT_SYMBOL
-const char *evhttp_uri_get_fragment(const struct evhttp_uri *uri);
-
-/** Set the scheme of an evhttp_uri, or clear the scheme if scheme==NULL.
- * Returns 0 on success, -1 if scheme is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_scheme(struct evhttp_uri *uri, const char *scheme);
-/** Set the userinfo of an evhttp_uri, or clear the userinfo if userinfo==NULL.
- * Returns 0 on success, -1 if userinfo is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_userinfo(struct evhttp_uri *uri, const char *userinfo);
-/** Set the host of an evhttp_uri, or clear the host if host==NULL.
- * Returns 0 on success, -1 if host is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_host(struct evhttp_uri *uri, const char *host);
-/** Set the port of an evhttp_uri, or clear the port if port==-1.
- * Returns 0 on success, -1 if port is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_port(struct evhttp_uri *uri, int port);
-/** Set the path of an evhttp_uri, or clear the path if path==NULL.
- * Returns 0 on success, -1 if path is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_path(struct evhttp_uri *uri, const char *path);
-/** Set the query of an evhttp_uri, or clear the query if query==NULL.
- * The query should not include a leading "?".
- * Returns 0 on success, -1 if query is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_query(struct evhttp_uri *uri, const char *query);
-/** Set the fragment of an evhttp_uri, or clear the fragment if fragment==NULL.
- * The fragment should not include a leading "#".
- * Returns 0 on success, -1 if fragment is not well-formed. */
-EVENT2_EXPORT_SYMBOL
-int evhttp_uri_set_fragment(struct evhttp_uri *uri, const char *fragment);
-
-/**
- * Helper function to parse a URI-Reference as specified by RFC3986.
- *
- * This function matches the URI-Reference production from RFC3986,
- * which includes both URIs like
- *
- * scheme://[[userinfo]@]foo.com[:port]]/[path][?query][#fragment]
- *
- * and relative-refs like
- *
- * [path][?query][#fragment]
- *
- * Any optional elements portions not present in the original URI are
- * left set to NULL in the resulting evhttp_uri. If no port is
- * specified, the port is set to -1.
- *
- * Note that no decoding is performed on percent-escaped characters in
- * the string; if you want to parse them, use evhttp_uridecode or
- * evhttp_parse_query_str as appropriate.
- *
- * Note also that most URI schemes will have additional constraints that
- * this function does not know about, and cannot check. For example,
- * mailto://www.example.com/cgi-bin/fortune.pl is not a reasonable
- * mailto url, http://www.example.com:99999/ is not a reasonable HTTP
- * URL, and ftp:username@example.com is not a reasonable FTP URL.
- * Nevertheless, all of these URLs conform to RFC3986, and this function
- * accepts all of them as valid.
- *
- * @param source_uri the request URI
- * @param flags Zero or more EVHTTP_URI_* flags to affect the behavior
- * of the parser.
- * @return uri container to hold parsed data, or NULL if there is error
- * @see evhttp_uri_free()
- */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_uri *evhttp_uri_parse_with_flags(const char *source_uri,
- unsigned flags);
-
-/** Tolerate URIs that do not conform to RFC3986.
- *
- * Unfortunately, some HTTP clients generate URIs that, according to RFC3986,
- * are not conformant URIs. If you need to support these URIs, you can
- * do so by passing this flag to evhttp_uri_parse_with_flags.
- *
- * Currently, these changes are:
- *
- * - Nonconformant URIs are allowed to contain otherwise unreasonable
- * characters in their path, query, and fragment components.
- *
- */
-#define EVHTTP_URI_NONCONFORMANT 0x01
-
-/** Alias for evhttp_uri_parse_with_flags(source_uri, 0) */
-EVENT2_EXPORT_SYMBOL
-struct evhttp_uri *evhttp_uri_parse(const char *source_uri);
-
-/**
- * Free all memory allocated for a parsed uri. Only use this for URIs
- * generated by evhttp_uri_parse.
- *
- * @param uri container with parsed data
- * @see evhttp_uri_parse()
- */
-EVENT2_EXPORT_SYMBOL
-void evhttp_uri_free(struct evhttp_uri *uri);
-
-/**
- * Join together the uri parts from parsed data to form a URI-Reference.
- *
- * Note that no escaping of reserved characters is done on the members
- * of the evhttp_uri, so the generated string might not be a valid URI
- * unless the members of evhttp_uri are themselves valid.
- *
- * @param uri container with parsed data
- * @param buf destination buffer
- * @param limit destination buffer size
- * @return an joined uri as string or NULL on error
- * @see evhttp_uri_parse()
- */
-EVENT2_EXPORT_SYMBOL
-char *evhttp_uri_join(struct evhttp_uri *uri, char *buf, size_t limit);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_HTTP_H_INCLUDED_ */
diff --git a/src/components/libevent/http_compat.h b/src/components/libevent/http_compat.h
deleted file mode 100644
index ca9e708..0000000
--- a/src/components/libevent/http_compat.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_HTTP_COMPAT_H_INCLUDED_
-#define EVENT2_HTTP_COMPAT_H_INCLUDED_
-
-/** @file event2/http_compat.h
-
- Potentially non-threadsafe versions of the functions in http.h: provided
- only for backwards compatibility.
-
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include
-#endif
-
-/* For int types. */
-#include
-
-/**
- * Start an HTTP server on the specified address and port
- *
- * @deprecated It does not allow an event base to be specified
- *
- * @param address the address to which the HTTP server should be bound
- * @param port the port number on which the HTTP server should listen
- * @return an struct evhttp object
- */
-struct evhttp *evhttp_start(const char *address, ev_uint16_t port);
-
-/**
- * A connection object that can be used to for making HTTP requests. The
- * connection object tries to establish the connection when it is given an
- * http request object.
- *
- * @deprecated It does not allow an event base to be specified
- */
-struct evhttp_connection *evhttp_connection_new(
- const char *address, ev_uint16_t port);
-
-/**
- * Associates an event base with the connection - can only be called
- * on a freshly created connection object that has not been used yet.
- *
- * @deprecated XXXX Why?
- */
-void evhttp_connection_set_base(struct evhttp_connection *evcon,
- struct event_base *base);
-
-
-/** Returns the request URI */
-#define evhttp_request_uri evhttp_request_get_uri
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/src/components/libevent/http_struct.h b/src/components/libevent/http_struct.h
deleted file mode 100644
index 24b2fb9..0000000
--- a/src/components/libevent/http_struct.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_HTTP_STRUCT_H_INCLUDED_
-#define EVENT2_HTTP_STRUCT_H_INCLUDED_
-
-/** @file event2/http_struct.h
-
- Data structures for http. Using these structures may hurt forward
- compatibility with later versions of Libevent: be careful!
-
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include
-#endif
-
-/* For int types. */
-#include
-
-/**
- * the request structure that a server receives.
- * WARNING: expect this structure to change. I will try to provide
- * reasonable accessors.
- */
-struct evhttp_request {
-#if defined(TAILQ_ENTRY)
- TAILQ_ENTRY(evhttp_request) next;
-#else
-struct {
- struct evhttp_request *tqe_next;
- struct evhttp_request **tqe_prev;
-} next;
-#endif
-
- /* the connection object that this request belongs to */
- struct evhttp_connection *evcon;
- int flags;
-/** The request obj owns the evhttp connection and needs to free it */
-#define EVHTTP_REQ_OWN_CONNECTION 0x0001
-/** Request was made via a proxy */
-#define EVHTTP_PROXY_REQUEST 0x0002
-/** The request object is owned by the user; the user must free it */
-#define EVHTTP_USER_OWNED 0x0004
-/** The request will be used again upstack; freeing must be deferred */
-#define EVHTTP_REQ_DEFER_FREE 0x0008
-/** The request should be freed upstack */
-#define EVHTTP_REQ_NEEDS_FREE 0x0010
-
- struct evkeyvalq *input_headers;
- struct evkeyvalq *output_headers;
-
- /* address of the remote host and the port connection came from */
- char *remote_host;
- ev_uint16_t remote_port;
-
- /* cache of the hostname for evhttp_request_get_host */
- char *host_cache;
-
- enum evhttp_request_kind kind;
- enum evhttp_cmd_type type;
-
- size_t headers_size;
- size_t body_size;
-
- char *uri; /* uri after HTTP request was parsed */
- struct evhttp_uri *uri_elems; /* uri elements */
-
- char major; /* HTTP Major number */
- char minor; /* HTTP Minor number */
-
- int response_code; /* HTTP Response code */
- char *response_code_line; /* Readable response */
-
- struct evbuffer *input_buffer; /* read data */
- ev_int64_t ntoread;
- unsigned chunked:1, /* a chunked request */
- userdone:1; /* the user has sent all data */
-
- struct evbuffer *output_buffer; /* outgoing post or data */
-
- /* Callback */
- void (*cb)(struct evhttp_request *, void *);
- void *cb_arg;
-
- /*
- * Chunked data callback - call for each completed chunk if
- * specified. If not specified, all the data is delivered via
- * the regular callback.
- */
- void (*chunk_cb)(struct evhttp_request *, void *);
-
- /*
- * Callback added for forked-daapd so they can collect ICY
- * (shoutcast) metadata from the http header. If return
- * int is negative the connection will be closed.
- */
- int (*header_cb)(struct evhttp_request *, void *);
-
- /*
- * Error callback - called when error is occured.
- * @see evhttp_request_error for error types.
- *
- * @see evhttp_request_set_error_cb()
- */
- void (*error_cb)(enum evhttp_request_error, void *);
-
- /*
- * Send complete callback - called when the request is actually
- * sent and completed.
- */
- void (*on_complete_cb)(struct evhttp_request *, void *);
- void *on_complete_cb_arg;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_HTTP_STRUCT_H_INCLUDED_ */
-
diff --git a/src/components/libevent/ipv6-internal.h b/src/components/libevent/ipv6-internal.h
deleted file mode 100644
index 53df6a9..0000000
--- a/src/components/libevent/ipv6-internal.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/* Internal use only: Fake IPv6 structures and values on platforms that
- * do not have them */
-
-#ifndef IPV6_INTERNAL_H_INCLUDED_
-#define IPV6_INTERNAL_H_INCLUDED_
-
-#include "event-config.h"
-#include "evconfig-private.h"
-
-#include
-#ifdef EVENT__HAVE_SYS_SOCKET_H
-#include
-#endif
-#include "util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @file ipv6-internal.h
- *
- * Replacement types and functions for platforms that don't support ipv6
- * properly.
- */
-
-#ifndef EVENT__HAVE_STRUCT_IN6_ADDR
-struct in6_addr {
- ev_uint8_t s6_addr[16];
-};
-#endif
-
-#ifndef EVENT__HAVE_SA_FAMILY_T
-typedef int sa_family_t;
-#endif
-
-#ifndef EVENT__HAVE_STRUCT_SOCKADDR_IN6
-struct sockaddr_in6 {
- /* This will fail if we find a struct sockaddr that doesn't have
- * sa_family as the first element. */
- sa_family_t sin6_family;
- ev_uint16_t sin6_port;
- struct in6_addr sin6_addr;
-};
-#endif
-
-#ifndef AF_INET6
-#define AF_INET6 3333
-#endif
-#ifndef PF_INET6
-#define PF_INET6 AF_INET6
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/components/libevent/keyvalq_struct.h b/src/components/libevent/keyvalq_struct.h
deleted file mode 100644
index bffa54b..0000000
--- a/src/components/libevent/keyvalq_struct.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
-#define EVENT2_KEYVALQ_STRUCT_H_INCLUDED_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Fix so that people don't have to run with */
-/* XXXX This code is duplicated with event_struct.h */
-#ifndef TAILQ_ENTRY
-#define EVENT_DEFINED_TQENTRY_
-#define TAILQ_ENTRY(type) \
-struct { \
- struct type *tqe_next; /* next element */ \
- struct type **tqe_prev; /* address of previous next element */ \
-}
-#endif /* !TAILQ_ENTRY */
-
-#ifndef TAILQ_HEAD
-#define EVENT_DEFINED_TQHEAD_
-#define TAILQ_HEAD(name, type) \
-struct name { \
- struct type *tqh_first; \
- struct type **tqh_last; \
-}
-#endif
-
-/*
- * Key-Value pairs. Can be used for HTTP headers but also for
- * query argument parsing.
- */
-struct evkeyval {
- TAILQ_ENTRY(evkeyval) next;
-
- char *key;
- char *value;
-};
-
-TAILQ_HEAD (evkeyvalq, evkeyval);
-
-/* XXXX This code is duplicated with event_struct.h */
-#ifdef EVENT_DEFINED_TQENTRY_
-#undef TAILQ_ENTRY
-#endif
-
-#ifdef EVENT_DEFINED_TQHEAD_
-#undef TAILQ_HEAD
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/components/libevent/listener.h b/src/components/libevent/listener.h
deleted file mode 100644
index ea0c1fa..0000000
--- a/src/components/libevent/listener.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_LISTENER_H_INCLUDED_
-#define EVENT2_LISTENER_H_INCLUDED_
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-struct sockaddr;
-struct evconnlistener;
-
-/**
- A callback that we invoke when a listener has a new connection.
-
- @param listener The evconnlistener
- @param fd The new file descriptor
- @param addr The source address of the connection
- @param socklen The length of addr
- @param user_arg the pointer passed to evconnlistener_new()
- */
-typedef void (*evconnlistener_cb)(struct evconnlistener *, evutil_socket_t, struct sockaddr *, int socklen, void *);
-
-/**
- A callback that we invoke when a listener encounters a non-retriable error.
-
- @param listener The evconnlistener
- @param user_arg the pointer passed to evconnlistener_new()
- */
-typedef void (*evconnlistener_errorcb)(struct evconnlistener *, void *);
-
-/** Flag: Indicates that we should not make incoming sockets nonblocking
- * before passing them to the callback. */
-#define LEV_OPT_LEAVE_SOCKETS_BLOCKING (1u<<0)
-/** Flag: Indicates that freeing the listener should close the underlying
- * socket. */
-#define LEV_OPT_CLOSE_ON_FREE (1u<<1)
-/** Flag: Indicates that we should set the close-on-exec flag, if possible */
-#define LEV_OPT_CLOSE_ON_EXEC (1u<<2)
-/** Flag: Indicates that we should disable the timeout (if any) between when
- * this socket is closed and when we can listen again on the same port. */
-#define LEV_OPT_REUSEABLE (1u<<3)
-/** Flag: Indicates that the listener should be locked so it's safe to use
- * from multiple threadcs at once. */
-#define LEV_OPT_THREADSAFE (1u<<4)
-/** Flag: Indicates that the listener should be created in disabled
- * state. Use evconnlistener_enable() to enable it later. */
-#define LEV_OPT_DISABLED (1u<<5)
-/** Flag: Indicates that the listener should defer accept() until data is
- * available, if possible. Ignored on platforms that do not support this.
- *
- * This option can help performance for protocols where the client transmits
- * immediately after connecting. Do not use this option if your protocol
- * _doesn't_ start out with the client transmitting data, since in that case
- * this option will sometimes cause the kernel to never tell you about the
- * connection.
- *
- * This option is only supported by evconnlistener_new_bind(): it can't
- * work with evconnlistener_new_fd(), since the listener needs to be told
- * 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
- on a given file descriptor.
-
- @param base The event base to associate the listener with.
- @param cb A callback to be invoked when a new connection arrives. If the
- callback is NULL, the listener will be treated as disabled until the
- callback is set.
- @param ptr A user-supplied pointer to give to the callback.
- @param flags Any number of LEV_OPT_* flags
- @param backlog Passed to the listen() call to determine the length of the
- acceptable connection backlog. Set to -1 for a reasonable default.
- Set to 0 if the socket is already listening.
- @param fd The file descriptor to listen on. It must be a nonblocking
- file descriptor, and it should already be bound to an appropriate
- port and address.
-*/
-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 address.
-
- @param base The event base to associate the listener with.
- @param cb A callback to be invoked when a new connection arrives. If the
- callback is NULL, the listener will be treated as disabled until the
- callback is set.
- @param ptr A user-supplied pointer to give to the callback.
- @param flags Any number of LEV_OPT_* flags
- @param backlog Passed to the listen() call to determine the length of the
- acceptable connection backlog. Set to -1 for a reasonable default.
- @param addr The address to listen for connections on.
- @param socklen The length of the address.
- */
-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);
-/**
- Disable and deallocate an evconnlistener.
- */
-EVENT2_EXPORT_SYMBOL
-void evconnlistener_free(struct evconnlistener *lev);
-/**
- Re-enable an evconnlistener that has been disabled.
- */
-EVENT2_EXPORT_SYMBOL
-int evconnlistener_enable(struct evconnlistener *lev);
-/**
- Stop listening for connections on an evconnlistener.
- */
-EVENT2_EXPORT_SYMBOL
-int evconnlistener_disable(struct evconnlistener *lev);
-
-/** Return an evconnlistener's associated event_base. */
-EVENT2_EXPORT_SYMBOL
-struct event_base *evconnlistener_get_base(struct evconnlistener *lev);
-
-/** Return the socket that an evconnlistner is listening on. */
-EVENT2_EXPORT_SYMBOL
-evutil_socket_t evconnlistener_get_fd(struct evconnlistener *lev);
-
-/** Change the callback on the listener to cb and its user_data to arg.
- */
-EVENT2_EXPORT_SYMBOL
-void evconnlistener_set_cb(struct evconnlistener *lev,
- evconnlistener_cb cb, void *arg);
-
-/** Set an evconnlistener's error callback. */
-EVENT2_EXPORT_SYMBOL
-void evconnlistener_set_error_cb(struct evconnlistener *lev,
- evconnlistener_errorcb errorcb);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/components/libevent/log-internal.h b/src/components/libevent/log-internal.h
deleted file mode 100644
index f43ea3f..0000000
--- a/src/components/libevent/log-internal.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef LOG_INTERNAL_H_INCLUDED_
-#define LOG_INTERNAL_H_INCLUDED_
-
-#include "util.h"
-
-#ifdef __GNUC__
-#define EV_CHECK_FMT(a,b) __attribute__((format(printf, a, b)))
-#define EV_NORETURN __attribute__((noreturn))
-#else
-#define EV_CHECK_FMT(a,b)
-#define EV_NORETURN
-#endif
-
-#define EVENT_ERR_ABORT_ ((int)0xdeaddead)
-
-#define USE_GLOBAL_FOR_DEBUG_LOGGING
-
-#if !defined(EVENT__DISABLE_DEBUG_MODE) || defined(USE_DEBUG)
-#define EVENT_DEBUG_LOGGING_ENABLED
-#endif
-
-#ifdef EVENT_DEBUG_LOGGING_ENABLED
-#ifdef USE_GLOBAL_FOR_DEBUG_LOGGING
-extern ev_uint32_t event_debug_logging_mask_;
-#define event_debug_get_logging_mask_() (event_debug_logging_mask_)
-#else
-ev_uint32_t event_debug_get_logging_mask_(void);
-#endif
-#else
-#define event_debug_get_logging_mask_() (0)
-#endif
-
-void event_err(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
-void event_warn(const char *fmt, ...) EV_CHECK_FMT(1,2);
-void event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(3,4) EV_NORETURN;
-void event_sock_warn(evutil_socket_t sock, const char *fmt, ...) EV_CHECK_FMT(2,3);
-void event_errx(int eval, const char *fmt, ...) EV_CHECK_FMT(2,3) EV_NORETURN;
-void event_warnx(const char *fmt, ...) EV_CHECK_FMT(1,2);
-void event_msgx(const char *fmt, ...) EV_CHECK_FMT(1,2);
-void event_debugx_(const char *fmt, ...) EV_CHECK_FMT(1,2);
-
-void event_logv_(int severity, const char *errstr, const char *fmt, va_list ap)
- EV_CHECK_FMT(3,0);
-
-#ifdef EVENT_DEBUG_LOGGING_ENABLED
-#define event_debug(x) do { \
- if (event_debug_get_logging_mask_()) { \
- event_debugx_ x; \
- } \
- } while (0)
-#else
-#define event_debug(x) ((void)0)
-#endif
-
-#undef EV_CHECK_FMT
-
-#endif
diff --git a/src/components/libevent/rpc.h b/src/components/libevent/rpc.h
deleted file mode 100644
index dd43df2..0000000
--- a/src/components/libevent/rpc.h
+++ /dev/null
@@ -1,596 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_RPC_H_INCLUDED_
-#define EVENT2_RPC_H_INCLUDED_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @file rpc.h
- *
- * This header files provides basic support for an RPC server and client.
- *
- * To support RPCs in a server, every supported RPC command needs to be
- * defined and registered.
- *
- * EVRPC_HEADER(SendCommand, Request, Reply);
- *
- * SendCommand is the name of the RPC command.
- * Request is the name of a structure generated by event_rpcgen.py.
- * It contains all parameters relating to the SendCommand RPC. The
- * server needs to fill in the Reply structure.
- * Reply is the name of a structure generated by event_rpcgen.py. It
- * contains the answer to the RPC.
- *
- * To register an RPC with an HTTP server, you need to first create an RPC
- * base with:
- *
- * struct evrpc_base *base = evrpc_init(http);
- *
- * A specific RPC can then be registered with
- *
- * EVRPC_REGISTER(base, SendCommand, Request, Reply, FunctionCB, arg);
- *
- * when the server receives an appropriately formatted RPC, the user callback
- * is invoked. The callback needs to fill in the reply structure.
- *
- * void FunctionCB(EVRPC_STRUCT(SendCommand)* rpc, void *arg);
- *
- * To send the reply, call EVRPC_REQUEST_DONE(rpc);
- *
- * See the regression test for an example.
- */
-
-/**
- Determines if the member has been set in the message
-
- @param msg the message to inspect
- @param member the member variable to test for presences
- @return 1 if it's present or 0 otherwise.
-*/
-#define EVTAG_HAS(msg, member) \
- ((msg)->member##_set == 1)
-
-#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
-
-/**
- Assigns a value to the member in the message.
-
- @param msg the message to which to assign a value
- @param member the name of the member variable
- @param value the value to assign
-*/
-#define EVTAG_ASSIGN(msg, member, value) \
- (*(msg)->base->member##_assign)((msg), (value))
-/**
- Assigns a value to the member in the message.
-
- @param msg the message to which to assign a value
- @param member the name of the member variable
- @param value the value to assign
- @param len the length of the value
-*/
-#define EVTAG_ASSIGN_WITH_LEN(msg, member, value, len) \
- (*(msg)->base->member##_assign)((msg), (value), (len))
-/**
- Returns the value for a member.
-
- @param msg the message from which to get the value
- @param member the name of the member variable
- @param pvalue a pointer to the variable to hold the value
- @return 0 on success, -1 otherwise.
-*/
-#define EVTAG_GET(msg, member, pvalue) \
- (*(msg)->base->member##_get)((msg), (pvalue))
-/**
- Returns the value for a member.
-
- @param msg the message from which to get the value
- @param member the name of the member variable
- @param pvalue a pointer to the variable to hold the value
- @param plen a pointer to the length of the value
- @return 0 on success, -1 otherwise.
-*/
-#define EVTAG_GET_WITH_LEN(msg, member, pvalue, plen) \
- (*(msg)->base->member##_get)((msg), (pvalue), (plen))
-
-#endif /* EVENT2_RPC_COMPAT_H_INCLUDED_ */
-
-/**
- Adds a value to an array.
-*/
-#define EVTAG_ARRAY_ADD_VALUE(msg, member, value) \
- (*(msg)->base->member##_add)((msg), (value))
-/**
- Allocates a new entry in the array and returns it.
-*/
-#define EVTAG_ARRAY_ADD(msg, member) \
- (*(msg)->base->member##_add)(msg)
-/**
- Gets a variable at the specified offset from the array.
-*/
-#define EVTAG_ARRAY_GET(msg, member, offset, pvalue) \
- (*(msg)->base->member##_get)((msg), (offset), (pvalue))
-/**
- Returns the number of entries in the array.
-*/
-#define EVTAG_ARRAY_LEN(msg, member) ((msg)->member##_length)
-
-
-struct evbuffer;
-struct event_base;
-struct evrpc_req_generic;
-struct evrpc_request_wrapper;
-struct evrpc;
-
-/** The type of a specific RPC Message
- *
- * @param rpcname the name of the RPC message
- */
-#define EVRPC_STRUCT(rpcname) struct evrpc_req__##rpcname
-
-struct evhttp_request;
-struct evrpc_status;
-struct evrpc_hook_meta;
-
-/** Creates the definitions and prototypes for an RPC
- *
- * You need to use EVRPC_HEADER to create structures and function prototypes
- * needed by the server and client implementation. The structures have to be
- * defined in an .rpc file and converted to source code via event_rpcgen.py
- *
- * @param rpcname the name of the RPC
- * @param reqstruct the name of the RPC request structure
- * @param replystruct the name of the RPC reply structure
- * @see EVRPC_GENERATE()
- */
-#define EVRPC_HEADER(rpcname, reqstruct, rplystruct) \
-EVRPC_STRUCT(rpcname) { \
- struct evrpc_hook_meta *hook_meta; \
- struct reqstruct* request; \
- struct rplystruct* reply; \
- struct evrpc* rpc; \
- struct evhttp_request* http_req; \
- struct evbuffer* rpc_data; \
-}; \
-int evrpc_send_request_##rpcname(struct evrpc_pool *, \
- struct reqstruct *, struct rplystruct *, \
- void (*)(struct evrpc_status *, \
- struct reqstruct *, struct rplystruct *, void *cbarg), \
- void *);
-
-struct evrpc_pool;
-
-/** use EVRPC_GENERATE instead */
-struct evrpc_request_wrapper *evrpc_make_request_ctx(
- struct evrpc_pool *pool, void *request, void *reply,
- const char *rpcname,
- void (*req_marshal)(struct evbuffer*, void *),
- void (*rpl_clear)(void *),
- int (*rpl_unmarshal)(void *, struct evbuffer *),
- void (*cb)(struct evrpc_status *, void *, void *, void *),
- void *cbarg);
-
-/** Creates a context structure that contains rpc specific information.
- *
- * EVRPC_MAKE_CTX is used to populate a RPC specific context that
- * contains information about marshaling the RPC data types.
- *
- * @param rpcname the name of the RPC
- * @param reqstruct the name of the RPC request structure
- * @param replystruct the name of the RPC reply structure
- * @param pool the evrpc_pool over which to make the request
- * @param request a pointer to the RPC request structure object
- * @param reply a pointer to the RPC reply structure object
- * @param cb the callback function to call when the RPC has completed
- * @param cbarg the argument to supply to the callback
- */
-#define EVRPC_MAKE_CTX(rpcname, reqstruct, rplystruct, \
- pool, request, reply, cb, cbarg) \
- evrpc_make_request_ctx(pool, request, reply, \
- #rpcname, \
- (void (*)(struct evbuffer *, void *))reqstruct##_marshal, \
- (void (*)(void *))rplystruct##_clear, \
- (int (*)(void *, struct evbuffer *))rplystruct##_unmarshal, \
- (void (*)(struct evrpc_status *, void *, void *, void *))cb, \
- cbarg)
-
-/** Generates the code for receiving and sending an RPC message
- *
- * EVRPC_GENERATE is used to create the code corresponding to sending
- * and receiving a particular RPC message
- *
- * @param rpcname the name of the RPC
- * @param reqstruct the name of the RPC request structure
- * @param replystruct the name of the RPC reply structure
- * @see EVRPC_HEADER()
- */
-#define EVRPC_GENERATE(rpcname, reqstruct, rplystruct) \
- int evrpc_send_request_##rpcname(struct evrpc_pool *pool, \
- struct reqstruct *request, struct rplystruct *reply, \
- void (*cb)(struct evrpc_status *, \
- struct reqstruct *, struct rplystruct *, void *cbarg), \
- void *cbarg) { \
- return evrpc_send_request_generic(pool, request, reply, \
- (void (*)(struct evrpc_status *, void *, void *, void *))cb, \
- cbarg, \
- #rpcname, \
- (void (*)(struct evbuffer *, void *))reqstruct##_marshal, \
- (void (*)(void *))rplystruct##_clear, \
- (int (*)(void *, struct evbuffer *))rplystruct##_unmarshal); \
-}
-
-/** Provides access to the HTTP request object underlying an RPC
- *
- * Access to the underlying http object; can be used to look at headers or
- * for getting the remote ip address
- *
- * @param rpc_req the rpc request structure provided to the server callback
- * @return an struct evhttp_request object that can be inspected for
- * HTTP headers or sender information.
- */
-#define EVRPC_REQUEST_HTTP(rpc_req) (rpc_req)->http_req
-
-/** completes the server response to an rpc request */
-void evrpc_request_done(struct evrpc_req_generic *req);
-
-/** accessors for request and reply */
-void *evrpc_get_request(struct evrpc_req_generic *req);
-void *evrpc_get_reply(struct evrpc_req_generic *req);
-
-/** Creates the reply to an RPC request
- *
- * EVRPC_REQUEST_DONE is used to answer a request; the reply is expected
- * to have been filled in. The request and reply pointers become invalid
- * after this call has finished.
- *
- * @param rpc_req the rpc request structure provided to the server callback
- */
-#define EVRPC_REQUEST_DONE(rpc_req) do { \
- struct evrpc_req_generic *req_ = (struct evrpc_req_generic *)(rpc_req); \
- evrpc_request_done(req_); \
-} while (0)
-
-
-struct evrpc_base;
-struct evhttp;
-
-/* functions to start up the rpc system */
-
-/** Creates a new rpc base from which RPC requests can be received
- *
- * @param server a pointer to an existing HTTP server
- * @return a newly allocated evrpc_base struct
- * @see evrpc_free()
- */
-struct evrpc_base *evrpc_init(struct evhttp *server);
-
-/**
- * Frees the evrpc base
- *
- * For now, you are responsible for making sure that no rpcs are ongoing.
- *
- * @param base the evrpc_base object to be freed
- * @see evrpc_init
- */
-void evrpc_free(struct evrpc_base *base);
-
-/** register RPCs with the HTTP Server
- *
- * registers a new RPC with the HTTP server, each RPC needs to have
- * a unique name under which it can be identified.
- *
- * @param base the evrpc_base structure in which the RPC should be
- * registered.
- * @param name the name of the RPC
- * @param request the name of the RPC request structure
- * @param reply the name of the RPC reply structure
- * @param callback the callback that should be invoked when the RPC
- * is received. The callback has the following prototype
- * void (*callback)(EVRPC_STRUCT(Message)* rpc, void *arg)
- * @param cbarg an additional parameter that can be passed to the callback.
- * The parameter can be used to carry around state.
- */
-#define EVRPC_REGISTER(base, name, request, reply, callback, cbarg) \
- evrpc_register_generic(base, #name, \
- (void (*)(struct evrpc_req_generic *, void *))callback, cbarg, \
- (void *(*)(void *))request##_new, NULL, \
- (void (*)(void *))request##_free, \
- (int (*)(void *, struct evbuffer *))request##_unmarshal, \
- (void *(*)(void *))reply##_new, NULL, \
- (void (*)(void *))reply##_free, \
- (int (*)(void *))reply##_complete, \
- (void (*)(struct evbuffer *, void *))reply##_marshal)
-
-/**
- Low level function for registering an RPC with a server.
-
- Use EVRPC_REGISTER() instead.
-
- @see EVRPC_REGISTER()
-*/
-int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
- void (*)(struct evrpc_req_generic*, void *), void *);
-
-/**
- * Unregisters an already registered RPC
- *
- * @param base the evrpc_base object from which to unregister an RPC
- * @param name the name of the rpc to unregister
- * @return -1 on error or 0 when successful.
- * @see EVRPC_REGISTER()
- */
-#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc((base), #name)
-
-int evrpc_unregister_rpc(struct evrpc_base *base, const char *name);
-
-/*
- * Client-side RPC support
- */
-
-struct evhttp_connection;
-struct evrpc_status;
-
-/** launches an RPC and sends it to the server
- *
- * EVRPC_MAKE_REQUEST() is used by the client to send an RPC to the server.
- *
- * @param name the name of the RPC
- * @param pool the evrpc_pool that contains the connection objects over which
- * the request should be sent.
- * @param request a pointer to the RPC request structure - it contains the
- * data to be sent to the server.
- * @param reply a pointer to the RPC reply structure. It is going to be filled
- * if the request was answered successfully
- * @param cb the callback to invoke when the RPC request has been answered
- * @param cbarg an additional argument to be passed to the client
- * @return 0 on success, -1 on failure
- */
-#define EVRPC_MAKE_REQUEST(name, pool, request, reply, cb, cbarg) \
- evrpc_send_request_##name((pool), (request), (reply), (cb), (cbarg))
-
-/**
- Makes an RPC request based on the provided context.
-
- This is a low-level function and should not be used directly
- unless a custom context object is provided. Use EVRPC_MAKE_REQUEST()
- instead.
-
- @param ctx a context from EVRPC_MAKE_CTX()
- @returns 0 on success, -1 otherwise.
- @see EVRPC_MAKE_REQUEST(), EVRPC_MAKE_CTX()
-*/
-int evrpc_make_request(struct evrpc_request_wrapper *ctx);
-
-/** creates an rpc connection pool
- *
- * a pool has a number of connections associated with it.
- * rpc requests are always made via a pool.
- *
- * @param base a pointer to an struct event_based object; can be left NULL
- * in singled-threaded applications
- * @return a newly allocated struct evrpc_pool object
- * @see evrpc_pool_free()
- */
-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()
- */
-void evrpc_pool_free(struct evrpc_pool *pool);
-
-/**
- * Adds a connection over which rpc can be dispatched to the pool.
- *
- * The connection object must have been newly created.
- *
- * @param pool the pool to which to add the connection
- * @param evcon the connection to add to the pool.
- */
-void evrpc_pool_add_connection(struct evrpc_pool *pool,
- struct evhttp_connection *evcon);
-
-/**
- * Removes a connection from the pool.
- *
- * The connection object must have been newly created.
- *
- * @param pool the pool from which to remove the connection
- * @param evcon the connection to remove from the pool.
- */
-void evrpc_pool_remove_connection(struct evrpc_pool *pool,
- struct evhttp_connection *evcon);
-
-/**
- * Sets the timeout in secs after which a request has to complete. The
- * RPC is completely aborted if it does not complete by then. Setting
- * the timeout to 0 means that it never timeouts and can be used to
- * implement callback type RPCs.
- *
- * Any connection already in the pool will be updated with the new
- * timeout. Connections added to the pool after set_timeout has be
- * called receive the pool timeout only if no timeout has been set
- * for the connection itself.
- *
- * @param pool a pointer to a struct evrpc_pool object
- * @param timeout_in_secs the number of seconds after which a request should
- * timeout and a failure be returned to the callback.
- */
-void evrpc_pool_set_timeout(struct evrpc_pool *pool, int timeout_in_secs);
-
-/**
- * Hooks for changing the input and output of RPCs; this can be used to
- * implement compression, authentication, encryption, ...
- */
-
-enum EVRPC_HOOK_TYPE {
- EVRPC_INPUT, /**< apply the function to an input hook */
- EVRPC_OUTPUT /**< apply the function to an output hook */
-};
-
-#ifndef _WIN32
-/** Deprecated alias for EVRPC_INPUT. Not available on windows, where it
- * conflicts with platform headers. */
-#define INPUT EVRPC_INPUT
-/** Deprecated alias for EVRPC_OUTPUT. Not available on windows, where it
- * conflicts with platform headers. */
-#define OUTPUT EVRPC_OUTPUT
-#endif
-
-/**
- * Return value from hook processing functions
- */
-
-enum EVRPC_HOOK_RESULT {
- EVRPC_TERMINATE = -1, /**< indicates the rpc should be terminated */
- EVRPC_CONTINUE = 0, /**< continue processing the rpc */
- EVRPC_PAUSE = 1 /**< pause processing request until resumed */
-};
-
-/** adds a processing hook to either an rpc base or rpc pool
- *
- * If a hook returns TERMINATE, the processing is aborted. On CONTINUE,
- * the request is immediately processed after the hook returns. If the
- * hook returns PAUSE, request processing stops until evrpc_resume_request()
- * has been called.
- *
- * The add functions return handles that can be used for removing hooks.
- *
- * @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
- * @param hook_type either INPUT or OUTPUT
- * @param cb the callback to call when the hook is activated
- * @param cb_arg an additional argument for the callback
- * @return a handle to the hook so it can be removed later
- * @see evrpc_remove_hook()
- */
-void *evrpc_add_hook(void *vbase,
- enum EVRPC_HOOK_TYPE hook_type,
- int (*cb)(void *, struct evhttp_request *, struct evbuffer *, void *),
- void *cb_arg);
-
-/** removes a previously added hook
- *
- * @param vbase a pointer to either struct evrpc_base or struct evrpc_pool
- * @param hook_type either INPUT or OUTPUT
- * @param handle a handle returned by evrpc_add_hook()
- * @return 1 on success or 0 on failure
- * @see evrpc_add_hook()
- */
-int evrpc_remove_hook(void *vbase,
- enum EVRPC_HOOK_TYPE hook_type,
- void *handle);
-
-/** resume a paused request
- *
- * @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);
-
-/** adds meta data to request
- *
- * evrpc_hook_add_meta() allows hooks to add meta data to a request. for
- * a client request, the meta data can be inserted by an outgoing request hook
- * and retrieved by the incoming request hook.
- *
- * @param ctx the context provided to the hook call
- * @param key a NUL-terminated c-string
- * @param data the data to be associated with the key
- * @param data_size the size of the data
- */
-void evrpc_hook_add_meta(void *ctx, const char *key,
- const void *data, size_t data_size);
-
-/** retrieves meta data previously associated
- *
- * evrpc_hook_find_meta() can be used to retrieve meta data associated to a
- * request by a previous hook.
- * @param ctx the context provided to the hook call
- * @param key a NUL-terminated c-string
- * @param data pointer to a data pointer that will contain the retrieved data
- * @param data_size pointer to the size of the data
- * @return 0 on success or -1 on failure
- */
-int evrpc_hook_find_meta(void *ctx, const char *key,
- void **data, size_t *data_size);
-
-/**
- * returns the connection object associated with the request
- *
- * @param ctx the context provided to the hook call
- * @return a pointer to the evhttp_connection object
- */
-struct evhttp_connection *evrpc_hook_get_connection(void *ctx);
-
-/**
- Function for sending a generic RPC request.
-
- Do not call this function directly, use EVRPC_MAKE_REQUEST() instead.
-
- @see EVRPC_MAKE_REQUEST()
- */
-int evrpc_send_request_generic(struct evrpc_pool *pool,
- void *request, void *reply,
- void (*cb)(struct evrpc_status *, void *, void *, void *),
- void *cb_arg,
- const char *rpcname,
- void (*req_marshal)(struct evbuffer *, void *),
- void (*rpl_clear)(void *),
- int (*rpl_unmarshal)(void *, struct evbuffer *));
-
-/**
- Function for registering a generic RPC with the RPC base.
-
- Do not call this function directly, use EVRPC_REGISTER() instead.
-
- @see EVRPC_REGISTER()
- */
-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 *),
- void *(*rpl_new)(void *), void *rpl_new_arg, void (*rpl_free)(void *),
- int (*rpl_complete)(void *),
- void (*rpl_marshal)(struct evbuffer *, void *));
-
-/** accessors for obscure and undocumented functionality */
-struct evrpc_pool* evrpc_request_get_pool(struct evrpc_request_wrapper *ctx);
-void evrpc_request_set_pool(struct evrpc_request_wrapper *ctx,
- struct evrpc_pool *pool);
-void evrpc_request_set_cb(struct evrpc_request_wrapper *ctx,
- void (*cb)(struct evrpc_status*, void *request, void *reply, void *arg),
- void *cb_arg);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_RPC_H_INCLUDED_ */
diff --git a/src/components/libevent/rpc_compat.h b/src/components/libevent/rpc_compat.h
deleted file mode 100644
index 8d8334d..0000000
--- a/src/components/libevent/rpc_compat.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_RPC_COMPAT_H_INCLUDED_
-#define EVENT2_RPC_COMPAT_H_INCLUDED_
-
-/** @file event2/rpc_compat.h
-
- Deprecated versions of the functions in rpc.h: provided only for
- backwards compatibility.
-
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** backwards compatible accessors that work only with gcc */
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-
-#undef EVTAG_ASSIGN
-#undef EVTAG_GET
-#undef EVTAG_ADD
-
-#define EVTAG_ASSIGN(msg, member, args...) \
- (*(msg)->base->member##_assign)(msg, ## args)
-#define EVTAG_GET(msg, member, args...) \
- (*(msg)->base->member##_get)(msg, ## args)
-#define EVTAG_ADD(msg, member, args...) \
- (*(msg)->base->member##_add)(msg, ## args)
-#endif
-#define EVTAG_LEN(msg, member) ((msg)->member##_length)
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_EVENT_COMPAT_H_INCLUDED_ */
diff --git a/src/components/libevent/rpc_struct.h b/src/components/libevent/rpc_struct.h
deleted file mode 100644
index 8f691f4..0000000
--- a/src/components/libevent/rpc_struct.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2006-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_RPC_STRUCT_H_INCLUDED_
-#define EVENT2_RPC_STRUCT_H_INCLUDED_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/** @file event2/rpc_struct.h
-
- Structures used by rpc.h. Using these structures directly may harm
- forward compatibility: be careful!
-
- */
-
-/**
- * provides information about the completed RPC request.
- */
-struct evrpc_status {
-#define EVRPC_STATUS_ERR_NONE 0
-#define EVRPC_STATUS_ERR_TIMEOUT 1
-#define EVRPC_STATUS_ERR_BADPAYLOAD 2
-#define EVRPC_STATUS_ERR_UNSTARTED 3
-#define EVRPC_STATUS_ERR_HOOKABORTED 4
- int error;
-
- /* for looking at headers or other information */
- struct evhttp_request *http_req;
-};
-
-/* the structure below needs to be synchronized with evrpc_req_generic */
-
-/* Encapsulates a request */
-struct evrpc {
- TAILQ_ENTRY(evrpc) next;
-
- /* the URI at which the request handler lives */
- const char* uri;
-
- /* creates a new request structure */
- void *(*request_new)(void *);
- void *request_new_arg;
-
- /* frees the request structure */
- void (*request_free)(void *);
-
- /* unmarshals the buffer into the proper request structure */
- int (*request_unmarshal)(void *, struct evbuffer *);
-
- /* creates a new reply structure */
- void *(*reply_new)(void *);
- void *reply_new_arg;
-
- /* frees the reply structure */
- void (*reply_free)(void *);
-
- /* verifies that the reply is valid */
- int (*reply_complete)(void *);
-
- /* marshals the reply into a buffer */
- void (*reply_marshal)(struct evbuffer*, void *);
-
- /* the callback invoked for each received rpc */
- void (*cb)(struct evrpc_req_generic *, void *);
- void *cb_arg;
-
- /* reference for further configuration */
- struct evrpc_base *base;
-};
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_RPC_STRUCT_H_INCLUDED_ */
diff --git a/src/components/libevent/tag.h b/src/components/libevent/tag.h
deleted file mode 100644
index 48e5e91..0000000
--- a/src/components/libevent/tag.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_TAG_H_INCLUDED_
-#define EVENT2_TAG_H_INCLUDED_
-
-/** @file event2/tag.h
-
- Helper functions for reading and writing tagged data onto buffers.
-
- */
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include
-#endif
-
-/* For int types. */
-#include
-
-struct evbuffer;
-
-/*
- * Marshaling tagged data - We assume that all tags are inserted in their
- * numeric order - so that unknown tags will always be higher than the
- * known ones - and we can just ignore the end of an event buffer.
- */
-
-EVENT2_EXPORT_SYMBOL
-void evtag_init(void);
-
-/**
- Unmarshals the header and returns the length of the payload
-
- @param evbuf the buffer from which to unmarshal data
- @param ptag a pointer in which the tag id is being stored
- @returns -1 on failure or the number of bytes in the remaining payload.
-*/
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal_header(struct evbuffer *evbuf, ev_uint32_t *ptag);
-
-EVENT2_EXPORT_SYMBOL
-void evtag_marshal(struct evbuffer *evbuf, ev_uint32_t tag, const void *data,
- ev_uint32_t len);
-EVENT2_EXPORT_SYMBOL
-void evtag_marshal_buffer(struct evbuffer *evbuf, ev_uint32_t tag,
- struct evbuffer *data);
-
-/**
- Encode an integer and store it in an evbuffer.
-
- We encode integers by nybbles; the first nibble contains the number
- of significant nibbles - 1; this allows us to encode up to 64-bit
- integers. This function is byte-order independent.
-
- @param evbuf evbuffer to store the encoded number
- @param number a 32-bit integer
- */
-EVENT2_EXPORT_SYMBOL
-void evtag_encode_int(struct evbuffer *evbuf, ev_uint32_t number);
-EVENT2_EXPORT_SYMBOL
-void evtag_encode_int64(struct evbuffer *evbuf, ev_uint64_t number);
-
-EVENT2_EXPORT_SYMBOL
-void evtag_marshal_int(struct evbuffer *evbuf, ev_uint32_t tag,
- ev_uint32_t integer);
-EVENT2_EXPORT_SYMBOL
-void evtag_marshal_int64(struct evbuffer *evbuf, ev_uint32_t tag,
- ev_uint64_t integer);
-
-EVENT2_EXPORT_SYMBOL
-void evtag_marshal_string(struct evbuffer *buf, ev_uint32_t tag,
- const char *string);
-
-EVENT2_EXPORT_SYMBOL
-void evtag_marshal_timeval(struct evbuffer *evbuf, ev_uint32_t tag,
- struct timeval *tv);
-
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal(struct evbuffer *src, ev_uint32_t *ptag,
- struct evbuffer *dst);
-EVENT2_EXPORT_SYMBOL
-int evtag_peek(struct evbuffer *evbuf, ev_uint32_t *ptag);
-EVENT2_EXPORT_SYMBOL
-int evtag_peek_length(struct evbuffer *evbuf, ev_uint32_t *plength);
-EVENT2_EXPORT_SYMBOL
-int evtag_payload_length(struct evbuffer *evbuf, ev_uint32_t *plength);
-EVENT2_EXPORT_SYMBOL
-int evtag_consume(struct evbuffer *evbuf);
-
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal_int(struct evbuffer *evbuf, ev_uint32_t need_tag,
- ev_uint32_t *pinteger);
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal_int64(struct evbuffer *evbuf, ev_uint32_t need_tag,
- ev_uint64_t *pinteger);
-
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal_fixed(struct evbuffer *src, ev_uint32_t need_tag,
- void *data, size_t len);
-
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal_string(struct evbuffer *evbuf, ev_uint32_t need_tag,
- char **pstring);
-
-EVENT2_EXPORT_SYMBOL
-int evtag_unmarshal_timeval(struct evbuffer *evbuf, ev_uint32_t need_tag,
- struct timeval *ptv);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_TAG_H_INCLUDED_ */
diff --git a/src/components/libevent/tag_compat.h b/src/components/libevent/tag_compat.h
deleted file mode 100644
index a276c0d..0000000
--- a/src/components/libevent/tag_compat.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_TAG_COMPAT_H_INCLUDED_
-#define EVENT2_TAG_COMPAT_H_INCLUDED_
-
-/** @file event2/tag_compat.h
-
- Obsolete/deprecated functions from tag.h; provided only for backwards
- compatibility.
- */
-
-/**
- @name Misnamed functions
-
- @deprecated These macros are deprecated because their names don't follow
- Libevent's naming conventions. Use evtag_encode_int and
- evtag_encode_int64 instead.
-
- @{
-*/
-#define encode_int(evbuf, number) evtag_encode_int((evbuf), (number))
-#define encode_int64(evbuf, number) evtag_encode_int64((evbuf), (number))
-/**@}*/
-
-#endif /* EVENT2_TAG_H_INCLUDED_ */
diff --git a/src/components/libevent/thread.h b/src/components/libevent/thread.h
deleted file mode 100644
index 9b2ba62..0000000
--- a/src/components/libevent/thread.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2008-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_THREAD_H_INCLUDED_
-#define EVENT2_THREAD_H_INCLUDED_
-
-/** @file event2/thread.h
-
- Functions for multi-threaded applications using Libevent.
-
- When using a multi-threaded application in which multiple threads
- add and delete events from a single event base, Libevent needs to
- lock its data structures.
-
- Like the memory-management function hooks, all of the threading functions
- _must_ be set up before an event_base is created if you want the base to
- use them.
-
- Most programs will either be using Windows threads or Posix threads. You
- can configure Libevent to use one of these event_use_windows_threads() or
- event_use_pthreads() respectively. If you're using another threading
- library, you'll need to configure threading functions manually using
- evthread_set_lock_callbacks() and evthread_set_condition_callbacks().
-
- */
-
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-
-/**
- @name Flags passed to lock functions
-
- @{
-*/
-/** A flag passed to a locking callback when the lock was allocated as a
- * read-write lock, and we want to acquire or release the lock for writing. */
-#define EVTHREAD_WRITE 0x04
-/** A flag passed to a locking callback when the lock was allocated as a
- * read-write lock, and we want to acquire or release the lock for reading. */
-#define EVTHREAD_READ 0x08
-/** A flag passed to a locking callback when we don't want to block waiting
- * for the lock; if we can't get the lock immediately, we will instead
- * return nonzero from the locking callback. */
-#define EVTHREAD_TRY 0x10
-/**@}*/
-
-#if !defined(EVENT__DISABLE_THREAD_SUPPORT) || defined(EVENT_IN_DOXYGEN_)
-
-#define EVTHREAD_LOCK_API_VERSION 1
-
-/**
- @name Types of locks
-
- @{*/
-/** A recursive lock is one that can be acquired multiple times at once by the
- * same thread. No other process can allocate the lock until the thread that
- * has been holding it has unlocked it as many times as it locked it. */
-#define EVTHREAD_LOCKTYPE_RECURSIVE 1
-/* A read-write lock is one that allows multiple simultaneous readers, but
- * where any one writer excludes all other writers and readers. */
-#define EVTHREAD_LOCKTYPE_READWRITE 2
-/**@}*/
-
-/** This structure describes the interface a threading library uses for
- * locking. It's used to tell evthread_set_lock_callbacks() how to use
- * locking on this platform.
- */
-struct evthread_lock_callbacks {
- /** The current version of the locking API. Set this to
- * EVTHREAD_LOCK_API_VERSION */
- int lock_api_version;
- /** Which kinds of locks does this version of the locking API
- * support? A bitfield of EVTHREAD_LOCKTYPE_RECURSIVE and
- * EVTHREAD_LOCKTYPE_READWRITE.
- *
- * (Note that RECURSIVE locks are currently mandatory, and
- * READWRITE locks are not currently used.)
- **/
- unsigned supported_locktypes;
- /** Function to allocate and initialize new lock of type 'locktype'.
- * Returns NULL on failure. */
- void *(*alloc)(unsigned locktype);
- /** Funtion to release all storage held in 'lock', which was created
- * with type 'locktype'. */
- void (*free)(void *lock, unsigned locktype);
- /** Acquire an already-allocated lock at 'lock' with mode 'mode'.
- * Returns 0 on success, and nonzero on failure. */
- int (*lock)(unsigned mode, void *lock);
- /** Release a lock at 'lock' using mode 'mode'. Returns 0 on success,
- * and nonzero on failure. */
- int (*unlock)(unsigned mode, void *lock);
-};
-
-/** Sets a group of functions that Libevent should use for locking.
- * For full information on the required callback API, see the
- * documentation for the individual members of evthread_lock_callbacks.
- *
- * Note that if you're using Windows or the Pthreads threading library, you
- * probably shouldn't call this function; instead, use
- * evthread_use_windows_threads() or evthread_use_posix_threads() if you can.
- */
-EVENT2_EXPORT_SYMBOL
-int evthread_set_lock_callbacks(const struct evthread_lock_callbacks *);
-
-#define EVTHREAD_CONDITION_API_VERSION 1
-
-struct timeval;
-
-/** This structure describes the interface a threading library uses for
- * condition variables. It's used to tell evthread_set_condition_callbacks
- * how to use locking on this platform.
- */
-struct evthread_condition_callbacks {
- /** The current version of the conditions API. Set this to
- * EVTHREAD_CONDITION_API_VERSION */
- int condition_api_version;
- /** Function to allocate and initialize a new condition variable.
- * Returns the condition variable on success, and NULL on failure.
- * The 'condtype' argument will be 0 with this API version.
- */
- void *(*alloc_condition)(unsigned condtype);
- /** Function to free a condition variable. */
- void (*free_condition)(void *cond);
- /** Function to signal a condition variable. If 'broadcast' is 1, all
- * threads waiting on 'cond' should be woken; otherwise, only on one
- * thread is worken. Should return 0 on success, -1 on failure.
- * This function will only be called while holding the associated
- * lock for the condition.
- */
- int (*signal_condition)(void *cond, int broadcast);
- /** Function to wait for a condition variable. The lock 'lock'
- * will be held when this function is called; should be released
- * while waiting for the condition to be come signalled, and
- * should be held again when this function returns.
- * If timeout is provided, it is interval of seconds to wait for
- * the event to become signalled; if it is NULL, the function
- * should wait indefinitely.
- *
- * The function should return -1 on error; 0 if the condition
- * was signalled, or 1 on a timeout. */
- int (*wait_condition)(void *cond, void *lock,
- const struct timeval *timeout);
-};
-
-/** Sets a group of functions that Libevent should use for condition variables.
- * For full information on the required callback API, see the
- * documentation for the individual members of evthread_condition_callbacks.
- *
- * Note that if you're using Windows or the Pthreads threading library, you
- * probably shouldn't call this function; instead, use
- * evthread_use_windows_threads() or evthread_use_pthreads() if you can.
- */
-EVENT2_EXPORT_SYMBOL
-int evthread_set_condition_callbacks(
- const struct evthread_condition_callbacks *);
-
-/**
- Sets the function for determining the thread id.
-
- @param base the event base for which to set the id function
- @param id_fn the identify function Libevent should invoke to
- determine the identity of a thread.
-*/
-EVENT2_EXPORT_SYMBOL
-void evthread_set_id_callback(
- unsigned long (*id_fn)(void));
-
-#if (defined(_WIN32) && !defined(EVENT__DISABLE_THREAD_SUPPORT)) || defined(EVENT_IN_DOXYGEN_)
-/** Sets up Libevent for use with Windows builtin locking and thread ID
- functions. Unavailable if Libevent is not built for Windows.
-
- @return 0 on success, -1 on failure. */
-EVENT2_EXPORT_SYMBOL
-int evthread_use_windows_threads(void);
-/**
- Defined if Libevent was built with support for evthread_use_windows_threads()
-*/
-#define EVTHREAD_USE_WINDOWS_THREADS_IMPLEMENTED 1
-#endif
-
-#if defined(EVENT__HAVE_PTHREADS) || defined(EVENT_IN_DOXYGEN_)
-/** Sets up Libevent for use with Pthreads locking and thread ID functions.
- Unavailable if Libevent is not build for use with pthreads. Requires
- libraries to link against Libevent_pthreads as well as Libevent.
-
- @return 0 on success, -1 on failure. */
-EVENT2_EXPORT_SYMBOL
-int evthread_use_pthreads(void);
-/** Defined if Libevent was built with support for evthread_use_pthreads() */
-#define EVTHREAD_USE_PTHREADS_IMPLEMENTED 1
-
-#endif
-
-/** Enable debugging wrappers around the current lock callbacks. If Libevent
- * makes one of several common locking errors, exit with an assertion failure.
- *
- * If you're going to call this function, you must do so before any locks are
- * allocated.
- **/
-EVENT2_EXPORT_SYMBOL
-void evthread_enable_lock_debugging(void);
-
-/* Old (misspelled) version: This is deprecated; use
- * evthread_enable_log_debugging instead. */
-EVENT2_EXPORT_SYMBOL
-void evthread_enable_lock_debuging(void);
-
-#endif /* EVENT__DISABLE_THREAD_SUPPORT */
-
-struct event_base;
-/** Make sure it's safe to tell an event base to wake up from another thread
- or a signal handler.
-
- You shouldn't need to call this by hand; configuring the base with thread
- support should be necessary and sufficient.
-
- @return 0 on success, -1 on failure.
- */
-EVENT2_EXPORT_SYMBOL
-int evthread_make_base_notifiable(struct event_base *base);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT2_THREAD_H_INCLUDED_ */
diff --git a/src/components/libevent/time-internal.h b/src/components/libevent/time-internal.h
deleted file mode 100644
index 9b0ce9f..0000000
--- a/src/components/libevent/time-internal.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2000-2007 Niels Provos
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef TIME_INTERNAL_H_INCLUDED_
-#define TIME_INTERNAL_H_INCLUDED_
-
-#include "event-config.h"
-#include "evconfig-private.h"
-
-#ifdef EVENT__HAVE_MACH_MACH_TIME_H
-/* For mach_timebase_info */
-#include
-#endif
-
-#include
-
-#include "util.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#if defined(EVENT__HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC)
-#define HAVE_POSIX_MONOTONIC
-#elif defined(EVENT__HAVE_MACH_ABSOLUTE_TIME)
-#define HAVE_MACH_MONOTONIC
-#elif defined(_WIN32)
-#define HAVE_WIN32_MONOTONIC
-#else
-#define HAVE_FALLBACK_MONOTONIC
-#endif
-
-long evutil_tv_to_msec_(const struct timeval *tv);
-void evutil_usleep_(const struct timeval *tv);
-
-#ifdef _WIN32
-typedef ULONGLONG (WINAPI *ev_GetTickCount_func)(void);
-#endif
-
-struct evutil_monotonic_timer {
-
-#ifdef HAVE_MACH_MONOTONIC
- struct mach_timebase_info mach_timebase_units;
-#endif
-
-#ifdef HAVE_POSIX_MONOTONIC
- int monotonic_clock;
-#endif
-
-#ifdef HAVE_WIN32_MONOTONIC
- ev_GetTickCount_func GetTickCount64_fn;
- ev_GetTickCount_func GetTickCount_fn;
- ev_uint64_t last_tick_count;
- ev_uint64_t adjust_tick_count;
-
- ev_uint64_t first_tick;
- ev_uint64_t first_counter;
- double usec_per_count;
- int use_performance_counter;
-#endif
-
- struct timeval adjust_monotonic_clock;
- struct timeval last_time;
-};
-
-int evutil_configure_monotonic_time_(struct evutil_monotonic_timer *mt,
- int flags);
-int evutil_gettime_monotonic_(struct evutil_monotonic_timer *mt, struct timeval *tv);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT_INTERNAL_H_INCLUDED_ */
diff --git a/src/components/libevent/util-internal.h b/src/components/libevent/util-internal.h
deleted file mode 100644
index d317d8c..0000000
--- a/src/components/libevent/util-internal.h
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef UTIL_INTERNAL_H_INCLUDED_
-#define UTIL_INTERNAL_H_INCLUDED_
-
-#include "event-config.h"
-#include "evconfig-private.h"
-
-#include
-
-/* For EVUTIL_ASSERT */
-#include "log-internal.h"
-#include
-#include
-#ifdef EVENT__HAVE_SYS_SOCKET_H
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_EVENTFD_H
-#include
-#endif
-#include "util.h"
-
-#include "time-internal.h"
-#include "ipv6-internal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* If we need magic to say "inline", get it for free internally. */
-#ifdef EVENT__inline
-#define inline EVENT__inline
-#endif
-#if defined(EVENT____func__) && !defined(__func__)
-#define __func__ EVENT____func__
-#endif
-
-/* A good no-op to use in macro definitions. */
-#define EVUTIL_NIL_STMT_ ((void)0)
-/* A no-op that tricks the compiler into thinking a condition is used while
- * definitely not making any code for it. Used to compile out asserts while
- * avoiding "unused variable" warnings. The "!" forces the compiler to
- * do the sizeof() on an int, in case "condition" is a bitfield value.
- */
-#define EVUTIL_NIL_CONDITION_(condition) do { \
- (void)sizeof(!(condition)); \
-} while(0)
-
-/* Internal use only: macros to match patterns of error codes in a
- cross-platform way. We need these macros because of two historical
- reasons: first, nonblocking IO functions are generally written to give an
- error on the "blocked now, try later" case, so sometimes an error from a
- read, write, connect, or accept means "no error; just wait for more
- data," and we need to look at the error code. Second, Windows defines
- a different set of error codes for sockets. */
-
-#ifndef _WIN32
-
-#if EAGAIN == EWOULDBLOCK
-#define EVUTIL_ERR_IS_EAGAIN(e) \
- ((e) == EAGAIN)
-#else
-#define EVUTIL_ERR_IS_EAGAIN(e) \
- ((e) == EAGAIN || (e) == EWOULDBLOCK)
-#endif
-
-/* True iff e is an error that means a read/write operation can be retried. */
-#define EVUTIL_ERR_RW_RETRIABLE(e) \
- ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e))
-/* True iff e is an error that means an connect can be retried. */
-#define EVUTIL_ERR_CONNECT_RETRIABLE(e) \
- ((e) == EINTR || (e) == EINPROGRESS)
-/* True iff e is an error that means a accept can be retried. */
-#define EVUTIL_ERR_ACCEPT_RETRIABLE(e) \
- ((e) == EINTR || EVUTIL_ERR_IS_EAGAIN(e) || (e) == ECONNABORTED)
-
-/* True iff e is an error that means the connection was refused */
-#define EVUTIL_ERR_CONNECT_REFUSED(e) \
- ((e) == ECONNREFUSED)
-
-#else
-/* Win32 */
-
-#define EVUTIL_ERR_IS_EAGAIN(e) \
- ((e) == WSAEWOULDBLOCK || (e) == EAGAIN)
-
-#define EVUTIL_ERR_RW_RETRIABLE(e) \
- ((e) == WSAEWOULDBLOCK || \
- (e) == WSAEINTR)
-
-#define EVUTIL_ERR_CONNECT_RETRIABLE(e) \
- ((e) == WSAEWOULDBLOCK || \
- (e) == WSAEINTR || \
- (e) == WSAEINPROGRESS || \
- (e) == WSAEINVAL)
-
-#define EVUTIL_ERR_ACCEPT_RETRIABLE(e) \
- EVUTIL_ERR_RW_RETRIABLE(e)
-
-#define EVUTIL_ERR_CONNECT_REFUSED(e) \
- ((e) == WSAECONNREFUSED)
-
-#endif
-
-/* Arguments for shutdown() */
-#ifdef SHUT_RD
-#define EVUTIL_SHUT_RD SHUT_RD
-#else
-#define EVUTIL_SHUT_RD 0
-#endif
-#ifdef SHUT_WR
-#define EVUTIL_SHUT_WR SHUT_WR
-#else
-#define EVUTIL_SHUT_WR 1 /* SD_SEND */
-#endif
-#ifdef SHUT_BOTH
-#define EVUTIL_SHUT_BOTH SHUT_BOTH
-#else
-#define EVUTIL_SHUT_BOTH 2
-#endif
-
-/* Helper: Verify that all the elements in 'dlist' are internally consistent.
- * Checks for circular lists and bad prev/next pointers.
- *
- * Example usage:
- * EVUTIL_ASSERT_LIST_OK(eventlist, event, ev_next);
- */
-#define EVUTIL_ASSERT_LIST_OK(dlist, type, field) do { \
- struct type *elm1, *elm2, **nextp; \
- if (LIST_EMPTY((dlist))) \
- break; \
- \
- /* Check list for circularity using Floyd's */ \
- /* 'Tortoise and Hare' algorithm */ \
- elm1 = LIST_FIRST((dlist)); \
- elm2 = LIST_NEXT(elm1, field); \
- while (elm1 && elm2) { \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm1 = LIST_NEXT(elm1, field); \
- elm2 = LIST_NEXT(elm2, field); \
- if (!elm2) \
- break; \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm2 = LIST_NEXT(elm2, field); \
- } \
- \
- /* Now check next and prev pointers for consistency. */ \
- nextp = &LIST_FIRST((dlist)); \
- elm1 = LIST_FIRST((dlist)); \
- while (elm1) { \
- EVUTIL_ASSERT(*nextp == elm1); \
- EVUTIL_ASSERT(nextp == elm1->field.le_prev); \
- nextp = &LIST_NEXT(elm1, field); \
- elm1 = *nextp; \
- } \
- } while (0)
-
-/* Helper: Verify that all the elements in a TAILQ are internally consistent.
- * Checks for circular lists and bad prev/next pointers.
- *
- * Example usage:
- * EVUTIL_ASSERT_TAILQ_OK(activelist, event, ev_active_next);
- */
-#define EVUTIL_ASSERT_TAILQ_OK(tailq, type, field) do { \
- struct type *elm1, *elm2, **nextp; \
- if (TAILQ_EMPTY((tailq))) \
- break; \
- \
- /* Check list for circularity using Floyd's */ \
- /* 'Tortoise and Hare' algorithm */ \
- elm1 = TAILQ_FIRST((tailq)); \
- elm2 = TAILQ_NEXT(elm1, field); \
- while (elm1 && elm2) { \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm1 = TAILQ_NEXT(elm1, field); \
- elm2 = TAILQ_NEXT(elm2, field); \
- if (!elm2) \
- break; \
- EVUTIL_ASSERT(elm1 != elm2); \
- elm2 = TAILQ_NEXT(elm2, field); \
- } \
- \
- /* Now check next and prev pointers for consistency. */ \
- nextp = &TAILQ_FIRST((tailq)); \
- elm1 = TAILQ_FIRST((tailq)); \
- while (elm1) { \
- EVUTIL_ASSERT(*nextp == elm1); \
- EVUTIL_ASSERT(nextp == elm1->field.tqe_prev); \
- nextp = &TAILQ_NEXT(elm1, field); \
- elm1 = *nextp; \
- } \
- EVUTIL_ASSERT(nextp == (tailq)->tqh_last); \
- } while (0)
-
-/* Locale-independent replacements for some ctypes functions. Use these
- * when you care about ASCII's notion of character types, because you are about
- * to send those types onto the wire.
- */
-int EVUTIL_ISALPHA_(char c);
-int EVUTIL_ISALNUM_(char c);
-int EVUTIL_ISSPACE_(char c);
-int EVUTIL_ISDIGIT_(char c);
-int EVUTIL_ISXDIGIT_(char c);
-int EVUTIL_ISPRINT_(char c);
-int EVUTIL_ISLOWER_(char c);
-int EVUTIL_ISUPPER_(char c);
-char EVUTIL_TOUPPER_(char c);
-char EVUTIL_TOLOWER_(char c);
-
-/** Remove all trailing horizontal whitespace (space or tab) from the end of a
- * string */
-void evutil_rtrim_lws_(char *);
-
-
-/** Helper macro. If we know that a given pointer points to a field in a
- structure, return a pointer to the structure itself. Used to implement
- our half-baked C OO. Example:
-
- struct subtype {
- int x;
- struct supertype common;
- int y;
- };
- ...
- void fn(struct supertype *super) {
- struct subtype *sub = EVUTIL_UPCAST(super, struct subtype, common);
- ...
- }
- */
-#define EVUTIL_UPCAST(ptr, type, field) \
- ((type *)(((char*)(ptr)) - evutil_offsetof(type, field)))
-
-/* As open(pathname, flags, mode), except that the file is always opened with
- * the close-on-exec flag set. (And the mode argument is mandatory.)
- */
-int evutil_open_closeonexec_(const char *pathname, int flags, unsigned mode);
-
-int evutil_read_file_(const char *filename, char **content_out, size_t *len_out,
- int is_binary);
-
-int evutil_socket_connect_(evutil_socket_t *fd_ptr, const struct sockaddr *sa, int socklen);
-
-int evutil_socket_finished_connecting_(evutil_socket_t fd);
-
-int evutil_ersatz_socketpair_(int, int , int, evutil_socket_t[]);
-
-int evutil_resolve_(int family, const char *hostname, struct sockaddr *sa,
- ev_socklen_t *socklen, int port);
-
-const char *evutil_getenv_(const char *name);
-
-/* Structure to hold the state of our weak random number generator.
- */
-struct evutil_weakrand_state {
- ev_uint32_t seed;
-};
-
-#define EVUTIL_WEAKRAND_MAX EV_INT32_MAX
-
-/* Initialize the state of a week random number generator based on 'seed'. If
- * the seed is 0, construct a new seed based on not-very-strong platform
- * entropy, like the PID and the time of day.
- *
- * This function, and the other evutil_weakrand* functions, are meant for
- * speed, not security or statistical strength. If you need a RNG which an
- * attacker can't predict, or which passes strong statistical tests, use the
- * evutil_secure_rng* functions instead.
- */
-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.
- */
-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 */
-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
- * we expect this value to be false. */
-#if defined(__GNUC__) && __GNUC__ >= 3 /* gcc 3.0 or later */
-#define EVUTIL_UNLIKELY(p) __builtin_expect(!!(p),0)
-#else
-#define EVUTIL_UNLIKELY(p) (p)
-#endif
-
-/* Replacement for assert() that calls event_errx on failure. */
-#ifdef NDEBUG
-#define EVUTIL_ASSERT(cond) EVUTIL_NIL_CONDITION_(cond)
-#define EVUTIL_FAILURE_CHECK(cond) 0
-#else
-#define EVUTIL_ASSERT(cond) \
- do { \
- if (EVUTIL_UNLIKELY(!(cond))) { \
- event_errx(EVENT_ERR_ABORT_, \
- "%s:%d: Assertion %s failed in %s", \
- __FILE__,__LINE__,#cond,__func__); \
- /* In case a user-supplied handler tries to */ \
- /* return control to us, log and abort here. */ \
- (void)fprintf(stderr, \
- "%s:%d: Assertion %s failed in %s", \
- __FILE__,__LINE__,#cond,__func__); \
- abort(); \
- } \
- } while (0)
-#define EVUTIL_FAILURE_CHECK(cond) EVUTIL_UNLIKELY(cond)
-#endif
-
-#ifndef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE
-/* Replacement for sockaddr storage that we can use internally on platforms
- * that lack it. It is not space-efficient, but neither is sockaddr_storage.
- */
-struct sockaddr_storage {
- union {
- struct sockaddr ss_sa;
- struct sockaddr_in ss_sin;
- struct sockaddr_in6 ss_sin6;
- char ss_padding[128];
- } ss_union;
-};
-#define ss_family ss_union.ss_sa.sa_family
-#endif
-
-/* Internal addrinfo error code. This one is returned from only from
- * evutil_getaddrinfo_common_, when we are sure that we'll have to hit a DNS
- * server. */
-#define EVUTIL_EAI_NEED_RESOLVE -90002
-
-struct evdns_base;
-struct evdns_getaddrinfo_request;
-typedef struct evdns_getaddrinfo_request* (*evdns_getaddrinfo_fn)(
- struct evdns_base *base,
- const char *nodename, const char *servname,
- const struct evutil_addrinfo *hints_in,
- void (*cb)(int, struct evutil_addrinfo *, void *), void *arg);
-void evutil_set_evdns_getaddrinfo_fn_(evdns_getaddrinfo_fn fn);
-typedef void (*evdns_getaddrinfo_cancel_fn)(
- struct evdns_getaddrinfo_request *req);
-void evutil_set_evdns_getaddrinfo_cancel_fn_(evdns_getaddrinfo_cancel_fn fn);
-
-struct evutil_addrinfo *evutil_new_addrinfo_(struct sockaddr *sa,
- ev_socklen_t socklen, const struct evutil_addrinfo *hints);
-struct evutil_addrinfo *evutil_addrinfo_append_(struct evutil_addrinfo *first,
- struct evutil_addrinfo *append);
-void evutil_adjust_hints_for_addrconfig_(struct evutil_addrinfo *hints);
-int evutil_getaddrinfo_common_(const char *nodename, const char *servname,
- struct evutil_addrinfo *hints, struct evutil_addrinfo **res, int *portnum);
-
-struct evdns_getaddrinfo_request *evutil_getaddrinfo_async_(
- struct evdns_base *dns_base,
- const char *nodename, const char *servname,
- const struct evutil_addrinfo *hints_in,
- void (*cb)(int, struct evutil_addrinfo *, void *), void *arg);
-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). */
-int evutil_sockaddr_is_loopback_(const struct sockaddr *sa);
-
-
-/**
- Formats a sockaddr sa into a string buffer of size outlen stored in out.
- 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.
- */
-const char *evutil_format_sockaddr_port_(const struct sockaddr *sa, char *out, size_t outlen);
-
-int evutil_hex_char_to_int_(char c);
-
-
-void evutil_free_secure_rng_globals_(void);
-void evutil_free_globals_(void);
-
-#ifdef _WIN32
-HMODULE evutil_load_windows_system_library_(const TCHAR *library_name);
-#endif
-
-#ifndef EV_SIZE_FMT
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__MINGW64__)
-#define EV_U64_FMT "%I64u"
-#define EV_I64_FMT "%I64d"
-#define EV_I64_ARG(x) ((__int64)(x))
-#define EV_U64_ARG(x) ((unsigned __int64)(x))
-#else
-#define EV_U64_FMT "%llu"
-#define EV_I64_FMT "%lld"
-#define EV_I64_ARG(x) ((long long)(x))
-#define EV_U64_ARG(x) ((unsigned long long)(x))
-#endif
-#endif
-
-#ifdef _WIN32
-#define EV_SOCK_FMT EV_I64_FMT
-#define EV_SOCK_ARG(x) EV_I64_ARG((x))
-#else
-#define EV_SOCK_FMT "%d"
-#define EV_SOCK_ARG(x) (x)
-#endif
-
-#if defined(__STDC__) && defined(__STDC_VERSION__) && !defined(__MINGW64_VERSION_MAJOR)
-#if (__STDC_VERSION__ >= 199901L)
-#define EV_SIZE_FMT "%zu"
-#define EV_SSIZE_FMT "%zd"
-#define EV_SIZE_ARG(x) (x)
-#define EV_SSIZE_ARG(x) (x)
-#endif
-#endif
-
-#ifndef EV_SIZE_FMT
-#if (EVENT__SIZEOF_SIZE_T <= EVENT__SIZEOF_LONG)
-#define EV_SIZE_FMT "%lu"
-#define EV_SSIZE_FMT "%ld"
-#define EV_SIZE_ARG(x) ((unsigned long)(x))
-#define EV_SSIZE_ARG(x) ((long)(x))
-#else
-#define EV_SIZE_FMT EV_U64_FMT
-#define EV_SSIZE_FMT EV_I64_FMT
-#define EV_SIZE_ARG(x) EV_U64_ARG(x)
-#define EV_SSIZE_ARG(x) EV_I64_ARG(x)
-#endif
-#endif
-
-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);
-
- /* used by one of the test programs.. */
-EVENT2_EXPORT_SYMBOL
-int evutil_make_internal_pipe_(evutil_socket_t fd[2]);
-evutil_socket_t evutil_eventfd_(unsigned initval, int flags);
-
-#ifdef SOCK_NONBLOCK
-#define EVUTIL_SOCK_NONBLOCK SOCK_NONBLOCK
-#else
-#define EVUTIL_SOCK_NONBLOCK 0x4000000
-#endif
-#ifdef SOCK_CLOEXEC
-#define EVUTIL_SOCK_CLOEXEC SOCK_CLOEXEC
-#else
-#define EVUTIL_SOCK_CLOEXEC 0x80000000
-#endif
-#ifdef EFD_NONBLOCK
-#define EVUTIL_EFD_NONBLOCK EFD_NONBLOCK
-#else
-#define EVUTIL_EFD_NONBLOCK 0x4000
-#endif
-#ifdef EFD_CLOEXEC
-#define EVUTIL_EFD_CLOEXEC EFD_CLOEXEC
-#else
-#define EVUTIL_EFD_CLOEXEC 0x8000
-#endif
-
-void evutil_memclear_(void *mem, size_t len);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/src/components/libevent/util.h b/src/components/libevent/util.h
deleted file mode 100644
index e6a8e73..0000000
--- a/src/components/libevent/util.h
+++ /dev/null
@@ -1,866 +0,0 @@
-/*
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_UTIL_H_INCLUDED_
-#define EVENT2_UTIL_H_INCLUDED_
-
-/** @file event2/util.h
-
- Common convenience functions for cross-platform portability and
- related socket manipulations.
-
- */
-#include
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include
-#ifdef EVENT__HAVE_SYS_TIME_H
-#include
-#endif
-#ifdef EVENT__HAVE_STDINT_H
-#include
-#elif defined(EVENT__HAVE_INTTYPES_H)
-#include
-#endif
-#ifdef EVENT__HAVE_SYS_TYPES_H
-#include
-#endif
-#ifdef EVENT__HAVE_STDDEF_H
-#include
-#endif
-#ifdef _MSC_VER
-#include
-#endif
-#include
-#ifdef EVENT__HAVE_NETDB_H
-#if !defined(_GNU_SOURCE)
-#define _GNU_SOURCE
-#endif
-#include
-#endif
-
-#ifdef _WIN32
-#include
-#ifdef EVENT__HAVE_GETADDRINFO
-/* for EAI_* definitions. */
-#include
-#endif
-#else
-#ifdef EVENT__HAVE_ERRNO_H
-#include
-#endif
-#include
-#endif
-
-#include
-
-/* Some openbsd autoconf versions get the name of this macro wrong. */
-#if defined(EVENT__SIZEOF_VOID__) && !defined(EVENT__SIZEOF_VOID_P)
-#define EVENT__SIZEOF_VOID_P EVENT__SIZEOF_VOID__
-#endif
-
-/**
- * @name Standard integer types.
- *
- * Integer type definitions for types that are supposed to be defined in the
- * C99-specified stdint.h. Shamefully, some platforms do not include
- * stdint.h, so we need to replace it. (If you are on a platform like this,
- * your C headers are now over 10 years out of date. You should bug them to
- * do something about this.)
- *
- * We define:
- *
- *
- * - ev_uint64_t, ev_uint32_t, ev_uint16_t, ev_uint8_t
- * - unsigned integer types of exactly 64, 32, 16, and 8 bits
- * respectively.
- * - ev_int64_t, ev_int32_t, ev_int16_t, ev_int8_t
- * - signed integer types of exactly 64, 32, 16, and 8 bits
- * respectively.
- * - ev_uintptr_t, ev_intptr_t
- * - unsigned/signed integers large enough
- * to hold a pointer without loss of bits.
- * - ev_ssize_t
- * - A signed type of the same size as size_t
- * - ev_off_t
- * - A signed type typically used to represent offsets within a
- * (potentially large) file
- *
- * @{
- */
-#ifdef EVENT__HAVE_UINT64_T
-#define ev_uint64_t uint64_t
-#define ev_int64_t int64_t
-#elif defined(_WIN32)
-#define ev_uint64_t unsigned __int64
-#define ev_int64_t signed __int64
-#elif EVENT__SIZEOF_LONG_LONG == 8
-#define ev_uint64_t unsigned long long
-#define ev_int64_t long long
-#elif EVENT__SIZEOF_LONG == 8
-#define ev_uint64_t unsigned long
-#define ev_int64_t long
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_uint64_t ...
-#define ev_int64_t ...
-#else
-#error "No way to define ev_uint64_t"
-#endif
-
-#ifdef EVENT__HAVE_UINT32_T
-#define ev_uint32_t uint32_t
-#define ev_int32_t int32_t
-#elif defined(_WIN32)
-#define ev_uint32_t unsigned int
-#define ev_int32_t signed int
-#elif EVENT__SIZEOF_LONG == 4
-#define ev_uint32_t unsigned long
-#define ev_int32_t signed long
-#elif EVENT__SIZEOF_INT == 4
-#define ev_uint32_t unsigned int
-#define ev_int32_t signed int
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_uint32_t ...
-#define ev_int32_t ...
-#else
-#error "No way to define ev_uint32_t"
-#endif
-
-#ifdef EVENT__HAVE_UINT16_T
-#define ev_uint16_t uint16_t
-#define ev_int16_t int16_t
-#elif defined(_WIN32)
-#define ev_uint16_t unsigned short
-#define ev_int16_t signed short
-#elif EVENT__SIZEOF_INT == 2
-#define ev_uint16_t unsigned int
-#define ev_int16_t signed int
-#elif EVENT__SIZEOF_SHORT == 2
-#define ev_uint16_t unsigned short
-#define ev_int16_t signed short
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_uint16_t ...
-#define ev_int16_t ...
-#else
-#error "No way to define ev_uint16_t"
-#endif
-
-#ifdef EVENT__HAVE_UINT8_T
-#define ev_uint8_t uint8_t
-#define ev_int8_t int8_t
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_uint8_t ...
-#define ev_int8_t ...
-#else
-#define ev_uint8_t unsigned char
-#define ev_int8_t signed char
-#endif
-
-#ifdef EVENT__HAVE_UINTPTR_T
-#define ev_uintptr_t uintptr_t
-#define ev_intptr_t intptr_t
-#elif EVENT__SIZEOF_VOID_P <= 4
-#define ev_uintptr_t ev_uint32_t
-#define ev_intptr_t ev_int32_t
-#elif EVENT__SIZEOF_VOID_P <= 8
-#define ev_uintptr_t ev_uint64_t
-#define ev_intptr_t ev_int64_t
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_uintptr_t ...
-#define ev_intptr_t ...
-#else
-#error "No way to define ev_uintptr_t"
-#endif
-
-#ifdef EVENT__ssize_t
-#define ev_ssize_t EVENT__ssize_t
-#else
-#define ev_ssize_t ssize_t
-#endif
-
-/* Note that we define ev_off_t based on the compile-time size of off_t that
- * we used to build Libevent, and not based on the current size of off_t.
- * (For example, we don't define ev_off_t to off_t.). We do this because
- * some systems let you build your software with different off_t sizes
- * at runtime, and so putting in any dependency on off_t would risk API
- * mismatch.
- */
-#ifdef _WIN32
-#define ev_off_t ev_int64_t
-#elif EVENT__SIZEOF_OFF_T == 8
-#define ev_off_t ev_int64_t
-#elif EVENT__SIZEOF_OFF_T == 4
-#define ev_off_t ev_int32_t
-#elif defined(EVENT_IN_DOXYGEN_)
-#define ev_off_t ...
-#else
-#define ev_off_t off_t
-#endif
-/**@}*/
-
-/* Limits for integer types.
-
- We're making two assumptions here:
- - The compiler does constant folding properly.
- - The platform does signed arithmetic in two's complement.
-*/
-
-/**
- @name Limits for integer types
-
- These macros hold the largest or smallest values possible for the
- ev_[u]int*_t types.
-
- @{
-*/
-#ifndef EVENT__HAVE_STDINT_H
-#define EV_UINT64_MAX ((((ev_uint64_t)0xffffffffUL) << 32) | 0xffffffffUL)
-#define EV_INT64_MAX ((((ev_int64_t) 0x7fffffffL) << 32) | 0xffffffffL)
-#define EV_INT64_MIN ((-EV_INT64_MAX) - 1)
-#define EV_UINT32_MAX ((ev_uint32_t)0xffffffffUL)
-#define EV_INT32_MAX ((ev_int32_t) 0x7fffffffL)
-#define EV_INT32_MIN ((-EV_INT32_MAX) - 1)
-#define EV_UINT16_MAX ((ev_uint16_t)0xffffUL)
-#define EV_INT16_MAX ((ev_int16_t) 0x7fffL)
-#define EV_INT16_MIN ((-EV_INT16_MAX) - 1)
-#define EV_UINT8_MAX 255
-#define EV_INT8_MAX 127
-#define EV_INT8_MIN ((-EV_INT8_MAX) - 1)
-#else
-#define EV_UINT64_MAX UINT64_MAX
-#define EV_INT64_MAX INT64_MAX
-#define EV_INT64_MIN INT64_MIN
-#define EV_UINT32_MAX UINT32_MAX
-#define EV_INT32_MAX INT32_MAX
-#define EV_INT32_MIN INT32_MIN
-#define EV_UINT16_MAX UINT16_MAX
-#define EV_INT16_MAX INT16_MAX
-#define EV_UINT8_MAX UINT8_MAX
-#define EV_INT8_MAX INT8_MAX
-#define EV_INT8_MIN INT8_MIN
-/** @} */
-#endif
-
-
-/**
- @name Limits for SIZE_T and SSIZE_T
-
- @{
-*/
-#if EVENT__SIZEOF_SIZE_T == 8
-#define EV_SIZE_MAX EV_UINT64_MAX
-#define EV_SSIZE_MAX EV_INT64_MAX
-#elif EVENT__SIZEOF_SIZE_T == 4
-#define EV_SIZE_MAX EV_UINT32_MAX
-#define EV_SSIZE_MAX EV_INT32_MAX
-#elif defined(EVENT_IN_DOXYGEN_)
-#define EV_SIZE_MAX ...
-#define EV_SSIZE_MAX ...
-#else
-#error "No way to define SIZE_MAX"
-#endif
-
-#define EV_SSIZE_MIN ((-EV_SSIZE_MAX) - 1)
-/**@}*/
-
-#ifdef _WIN32
-#define ev_socklen_t int
-#elif defined(EVENT__socklen_t)
-#define ev_socklen_t EVENT__socklen_t
-#else
-#define ev_socklen_t socklen_t
-#endif
-
-#ifdef EVENT__HAVE_STRUCT_SOCKADDR_STORAGE___SS_FAMILY
-#if !defined(EVENT__HAVE_STRUCT_SOCKADDR_STORAGE_SS_FAMILY) \
- && !defined(ss_family)
-#define ss_family __ss_family
-#endif
-#endif
-
-/**
- * A type wide enough to hold the output of "socket()" or "accept()". On
- * Windows, this is an intptr_t; elsewhere, it is an int. */
-#ifdef _WIN32
-#define evutil_socket_t intptr_t
-#else
-#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
-
-/** Format a date string using RFC 1123 format (used in HTTP).
- * If `tm` is NULL, current system's time will be used.
- * The number of characters written will be returned.
- * One should check if the return value is smaller than `datelen` to check if
- * the result is truncated or not.
- */
-EVENT2_EXPORT_SYMBOL int
-evutil_date_rfc1123(char *date, const size_t datelen, const struct tm *tm);
-
-/** 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
- loopback network interface on 127.0.0.1, and only
- AF_INET,SOCK_STREAM are supported.
-
- (This may fail on some Windows hosts where firewall software has cleverly
- decided to keep 127.0.0.1 from talking to itself.)
-
- Parameters and return values are as for socketpair()
-*/
-EVENT2_EXPORT_SYMBOL
-int evutil_socketpair(int d, int type, int protocol, evutil_socket_t sv[2]);
-/** Do platform-specific operations as needed to make a socket nonblocking.
-
- @param sock The socket to make nonblocking
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_make_socket_nonblocking(evutil_socket_t sock);
-
-/** Do platform-specific operations to make a listener socket reusable.
-
- Specifically, we want to make sure that another program will be able
- to bind this address right after we've closed the listener.
-
- This differs from Windows's interpretation of "reusable", which
- allows multiple listeners to bind the same address at the same time.
-
- @param sock The socket to make reusable
- @return 0 on success, -1 on failure
- */
-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.
-
- @param sock The socket to be closed
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_make_socket_closeonexec(evutil_socket_t sock);
-
-/** Do the platform-specific call needed to close a socket returned from
- socket() or accept().
-
- @param sock The socket to be closed
- @return 0 on success, -1 on failure
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_closesocket(evutil_socket_t sock);
-#define EVUTIL_CLOSESOCKET(s) evutil_closesocket(s)
-
-/** Do platform-specific operations, if possible, to make a tcp listener
- * socket defer accept()s until there is data to read.
- *
- * Not all platforms support this. You don't want to do this for every
- * listener socket: only the ones that implement a protocol where the
- * client transmits before the server needs to respond.
- *
- * @param sock The listening socket to to make deferred
- * @return 0 on success (whether the operation is supported or not),
- * -1 on failure
-*/
-EVENT2_EXPORT_SYMBOL
-int evutil_make_tcp_listen_socket_deferred(evutil_socket_t sock);
-
-#ifdef _WIN32
-/** Return the most recent socket error. Not idempotent on all platforms. */
-#define EVUTIL_SOCKET_ERROR() WSAGetLastError()
-/** Replace the most recent socket error with errcode */
-#define EVUTIL_SET_SOCKET_ERROR(errcode) \
- do { WSASetLastError(errcode); } while (0)
-/** Return the most recent socket error to occur on sock. */
-EVENT2_EXPORT_SYMBOL
-int evutil_socket_geterror(evutil_socket_t sock);
-/** Convert a socket error to a string. */
-EVENT2_EXPORT_SYMBOL
-const char *evutil_socket_error_to_string(int errcode);
-#elif defined(EVENT_IN_DOXYGEN_)
-/**
- @name Socket error functions
-
- These functions are needed for making programs compatible between
- Windows and Unix-like platforms.
-
- You see, Winsock handles socket errors differently from the rest of
- the world. Elsewhere, a socket error is like any other error and is
- stored in errno. But winsock functions require you to retrieve the
- error with a special function, and don't let you use strerror for
- the error codes. And handling EWOULDBLOCK is ... different.
-
- @{
-*/
-/** Return the most recent socket error. Not idempotent on all platforms. */
-#define EVUTIL_SOCKET_ERROR() ...
-/** Replace the most recent socket error with errcode */
-#define EVUTIL_SET_SOCKET_ERROR(errcode) ...
-/** Return the most recent socket error to occur on sock. */
-#define evutil_socket_geterror(sock) ...
-/** Convert a socket error to a string. */
-#define evutil_socket_error_to_string(errcode) ...
-/**@}*/
-#else
-#define EVUTIL_SOCKET_ERROR() (errno)
-#define EVUTIL_SET_SOCKET_ERROR(errcode) \
- do { errno = (errcode); } while (0)
-#define evutil_socket_geterror(sock) (errno)
-#define evutil_socket_error_to_string(errcode) (strerror(errcode))
-#endif
-
-
-/**
- * @name Manipulation macros for struct timeval.
- *
- * We define replacements
- * for timeradd, timersub, timerclear, timercmp, and timerisset.
- *
- * @{
- */
-#ifdef EVENT__HAVE_TIMERADD
-#define evutil_timeradd(tvp, uvp, vvp) timeradd((tvp), (uvp), (vvp))
-#define evutil_timersub(tvp, uvp, vvp) timersub((tvp), (uvp), (vvp))
-#else
-#define evutil_timeradd(tvp, uvp, vvp) \
- do { \
- (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
- (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
- if ((vvp)->tv_usec >= 1000000) { \
- (vvp)->tv_sec++; \
- (vvp)->tv_usec -= 1000000; \
- } \
- } while (0)
-#define evutil_timersub(tvp, uvp, vvp) \
- do { \
- (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
- (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
- if ((vvp)->tv_usec < 0) { \
- (vvp)->tv_sec--; \
- (vvp)->tv_usec += 1000000; \
- } \
- } while (0)
-#endif /* !EVENT__HAVE_TIMERADD */
-
-#ifdef EVENT__HAVE_TIMERCLEAR
-#define evutil_timerclear(tvp) timerclear(tvp)
-#else
-#define evutil_timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0
-#endif
-/**@}*/
-
-/** Return true iff the tvp is related to uvp according to the relational
- * operator cmp. Recognized values for cmp are ==, <=, <, >=, and >. */
-#define evutil_timercmp(tvp, uvp, cmp) \
- (((tvp)->tv_sec == (uvp)->tv_sec) ? \
- ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
- ((tvp)->tv_sec cmp (uvp)->tv_sec))
-
-#ifdef EVENT__HAVE_TIMERISSET
-#define evutil_timerisset(tvp) timerisset(tvp)
-#else
-#define evutil_timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
-#endif
-
-/** Replacement for offsetof on platforms that don't define it. */
-#ifdef offsetof
-#define evutil_offsetof(type, field) offsetof(type, field)
-#else
-#define evutil_offsetof(type, field) ((off_t)(&((type *)0)->field))
-#endif
-
-/* big-int related functions */
-/** Parse a 64-bit value from a string. Arguments are as for strtol. */
-EVENT2_EXPORT_SYMBOL
-ev_int64_t evutil_strtoll(const char *s, char **endptr, int base);
-
-/** Replacement for gettimeofday on platforms that lack it. */
-#ifdef EVENT__HAVE_GETTIMEOFDAY
-#define evutil_gettimeofday(tv, tz) gettimeofday((tv), (tz))
-#else
-struct timezone;
-EVENT2_EXPORT_SYMBOL
-int evutil_gettimeofday(struct timeval *tv, struct timezone *tz);
-#endif
-
-/** Replacement for snprintf to get consistent behavior on platforms for
- which the return value of snprintf does not conform to C99.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_snprintf(char *buf, size_t buflen, const char *format, ...)
-#ifdef __GNUC__
- __attribute__((format(printf, 3, 4)))
-#endif
-;
-/** Replacement for vsnprintf to get consistent behavior on platforms for
- which the return value of snprintf does not conform to C99.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_vsnprintf(char *buf, size_t buflen, const char *format, va_list ap)
-#ifdef __GNUC__
- __attribute__((format(printf, 3, 0)))
-#endif
-;
-
-/** Replacement for inet_ntop for platforms which lack it. */
-EVENT2_EXPORT_SYMBOL
-const char *evutil_inet_ntop(int af, const void *src, char *dst, size_t len);
-/** Replacement for inet_pton for platforms which lack it. */
-EVENT2_EXPORT_SYMBOL
-int evutil_inet_pton(int af, const char *src, void *dst);
-struct sockaddr;
-
-/** Parse an IPv4 or IPv6 address, with optional port, from a string.
-
- Recognized formats are:
- - [IPv6Address]:port
- - [IPv6Address]
- - IPv6Address
- - IPv4Address:port
- - IPv4Address
-
- If no port is specified, the port in the output is set to 0.
-
- @param str The string to parse.
- @param out A struct sockaddr to hold the result. This should probably be
- a struct sockaddr_storage.
- @param outlen A pointer to the number of bytes that that 'out' can safely
- hold. Set to the number of bytes used in 'out' on success.
- @return -1 if the address is not well-formed, if the port is out of range,
- or if out is not large enough to hold the result. Otherwise returns
- 0 on success.
-*/
-EVENT2_EXPORT_SYMBOL
-int evutil_parse_sockaddr_port(const char *str, struct sockaddr *out, int *outlen);
-
-/** Compare two sockaddrs; return 0 if they are equal, or less than 0 if sa1
- * preceeds sa2, or greater than 0 if sa1 follows sa2. If include_port is
- * true, consider the port as well as the address. Only implemented for
- * AF_INET and AF_INET6 addresses. The ordering is not guaranteed to remain
- * the same between Libevent versions. */
-EVENT2_EXPORT_SYMBOL
-int evutil_sockaddr_cmp(const struct sockaddr *sa1, const struct sockaddr *sa2,
- int include_port);
-
-/** As strcasecmp, but always compares the characters in locale-independent
- ASCII. That's useful if you're handling data in ASCII-based protocols.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_ascii_strcasecmp(const char *str1, const char *str2);
-/** As strncasecmp, but always compares the characters in locale-independent
- ASCII. That's useful if you're handling data in ASCII-based protocols.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_ascii_strncasecmp(const char *str1, const char *str2, size_t n);
-
-/* Here we define evutil_addrinfo to the native addrinfo type, or redefine it
- * if this system has no getaddrinfo(). */
-#ifdef EVENT__HAVE_STRUCT_ADDRINFO
-#define evutil_addrinfo addrinfo
-#else
-/** A definition of struct addrinfo for systems that lack it.
-
- (This is just an alias for struct addrinfo if the system defines
- struct addrinfo.)
-*/
-struct evutil_addrinfo {
- int ai_flags; /* AI_PASSIVE, AI_CANONNAME, AI_NUMERICHOST */
- int ai_family; /* PF_xxx */
- int ai_socktype; /* SOCK_xxx */
- int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
- size_t ai_addrlen; /* length of ai_addr */
- char *ai_canonname; /* canonical name for nodename */
- struct sockaddr *ai_addr; /* binary address */
- struct evutil_addrinfo *ai_next; /* next structure in linked list */
-};
-#endif
-/** @name evutil_getaddrinfo() error codes
-
- These values are possible error codes for evutil_getaddrinfo() and
- related functions.
-
- @{
-*/
-#if defined(EAI_ADDRFAMILY) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_ADDRFAMILY EAI_ADDRFAMILY
-#else
-#define EVUTIL_EAI_ADDRFAMILY -901
-#endif
-#if defined(EAI_AGAIN) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_AGAIN EAI_AGAIN
-#else
-#define EVUTIL_EAI_AGAIN -902
-#endif
-#if defined(EAI_BADFLAGS) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_BADFLAGS EAI_BADFLAGS
-#else
-#define EVUTIL_EAI_BADFLAGS -903
-#endif
-#if defined(EAI_FAIL) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_FAIL EAI_FAIL
-#else
-#define EVUTIL_EAI_FAIL -904
-#endif
-#if defined(EAI_FAMILY) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_FAMILY EAI_FAMILY
-#else
-#define EVUTIL_EAI_FAMILY -905
-#endif
-#if defined(EAI_MEMORY) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_MEMORY EAI_MEMORY
-#else
-#define EVUTIL_EAI_MEMORY -906
-#endif
-/* This test is a bit complicated, since some MS SDKs decide to
- * remove NODATA or redefine it to be the same as NONAME, in a
- * fun interpretation of RFC 2553 and RFC 3493. */
-#if defined(EAI_NODATA) && defined(EVENT__HAVE_GETADDRINFO) && (!defined(EAI_NONAME) || EAI_NODATA != EAI_NONAME)
-#define EVUTIL_EAI_NODATA EAI_NODATA
-#else
-#define EVUTIL_EAI_NODATA -907
-#endif
-#if defined(EAI_NONAME) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_NONAME EAI_NONAME
-#else
-#define EVUTIL_EAI_NONAME -908
-#endif
-#if defined(EAI_SERVICE) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_SERVICE EAI_SERVICE
-#else
-#define EVUTIL_EAI_SERVICE -909
-#endif
-#if defined(EAI_SOCKTYPE) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_SOCKTYPE EAI_SOCKTYPE
-#else
-#define EVUTIL_EAI_SOCKTYPE -910
-#endif
-#if defined(EAI_SYSTEM) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_EAI_SYSTEM EAI_SYSTEM
-#else
-#define EVUTIL_EAI_SYSTEM -911
-#endif
-
-#define EVUTIL_EAI_CANCEL -90001
-
-#if defined(AI_PASSIVE) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_PASSIVE AI_PASSIVE
-#else
-#define EVUTIL_AI_PASSIVE 0x1000
-#endif
-#if defined(AI_CANONNAME) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_CANONNAME AI_CANONNAME
-#else
-#define EVUTIL_AI_CANONNAME 0x2000
-#endif
-#if defined(AI_NUMERICHOST) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_NUMERICHOST AI_NUMERICHOST
-#else
-#define EVUTIL_AI_NUMERICHOST 0x4000
-#endif
-#if defined(AI_NUMERICSERV) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_NUMERICSERV AI_NUMERICSERV
-#else
-#define EVUTIL_AI_NUMERICSERV 0x8000
-#endif
-#if defined(AI_V4MAPPED) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_V4MAPPED AI_V4MAPPED
-#else
-#define EVUTIL_AI_V4MAPPED 0x10000
-#endif
-#if defined(AI_ALL) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_ALL AI_ALL
-#else
-#define EVUTIL_AI_ALL 0x20000
-#endif
-#if defined(AI_ADDRCONFIG) && defined(EVENT__HAVE_GETADDRINFO)
-#define EVUTIL_AI_ADDRCONFIG AI_ADDRCONFIG
-#else
-#define EVUTIL_AI_ADDRCONFIG 0x40000
-#endif
-/**@}*/
-
-struct evutil_addrinfo;
-/**
- * This function clones getaddrinfo for systems that don't have it. For full
- * details, see RFC 3493, section 6.1.
- *
- * Limitations:
- * - When the system has no getaddrinfo, we fall back to gethostbyname_r or
- * gethostbyname, with their attendant issues.
- * - The AI_V4MAPPED and AI_ALL flags are not currently implemented.
- *
- * For a nonblocking variant, see evdns_getaddrinfo.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_getaddrinfo(const char *nodename, const char *servname,
- const struct evutil_addrinfo *hints_in, struct evutil_addrinfo **res);
-
-/** Release storage allocated by evutil_getaddrinfo or evdns_getaddrinfo. */
-EVENT2_EXPORT_SYMBOL
-void evutil_freeaddrinfo(struct evutil_addrinfo *ai);
-
-EVENT2_EXPORT_SYMBOL
-const char *evutil_gai_strerror(int err);
-
-/** Generate n bytes of secure pseudorandom data, and store them in buf.
- *
- * Current versions of Libevent use an ARC4-based random number generator,
- * seeded using the platform's entropy source (/dev/urandom on Unix-like
- * systems; CryptGenRandom on Windows). This is not actually as secure as it
- * should be: ARC4 is a pretty lousy cipher, and the current implementation
- * provides only rudimentary prediction- and backtracking-resistance. Don't
- * use this for serious cryptographic applications.
- */
-EVENT2_EXPORT_SYMBOL
-void evutil_secure_rng_get_bytes(void *buf, size_t n);
-
-/**
- * Seed the secure random number generator if needed, and return 0 on
- * success or -1 on failure.
- *
- * It is okay to call this function more than once; it will still return
- * 0 if the RNG has been successfully seeded and -1 if it can't be
- * seeded.
- *
- * Ordinarily you don't need to call this function from your own code;
- * Libevent will seed the RNG itself the first time it needs good random
- * numbers. You only need to call it if (a) you want to double-check
- * that one of the seeding methods did succeed, or (b) you plan to drop
- * the capability to seed (by chrooting, or dropping capabilities, or
- * whatever), and you want to make sure that seeding happens before your
- * program loses the ability to do it.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_secure_rng_init(void);
-
-/**
- * Set a filename to use in place of /dev/urandom for seeding the secure
- * PRNG. Return 0 on success, -1 on failure.
- *
- * Call this function BEFORE calling any other initialization or RNG
- * functions.
- *
- * (This string will _NOT_ be copied internally. Do not free it while any
- * user of the secure RNG might be running. Don't pass anything other than a
- * real /dev/...random device file here, or you might lose security.)
- *
- * This API is unstable, and might change in a future libevent version.
- */
-EVENT2_EXPORT_SYMBOL
-int evutil_secure_rng_set_urandom_device_file(char *fname);
-
-/** Seed the random number generator with extra random bytes.
-
- You should almost never need to call this function; it should be
- sufficient to invoke evutil_secure_rng_init(), or let Libevent take
- care of calling evutil_secure_rng_init() on its own.
-
- If you call this function as a _replacement_ for the regular
- entropy sources, then you need to be sure that your input
- contains a fairly large amount of strong entropy. Doing so is
- notoriously hard: most people who try get it wrong. Watch out!
-
- @param dat a buffer full of a strong source of random numbers
- @param datlen the number of bytes to read from datlen
- */
-EVENT2_EXPORT_SYMBOL
-void evutil_secure_rng_add_bytes(const char *dat, size_t datlen);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* EVENT1_EVUTIL_H_INCLUDED_ */
diff --git a/src/components/libevent/visibility.h b/src/components/libevent/visibility.h
deleted file mode 100644
index b8ba06a..0000000
--- a/src/components/libevent/visibility.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
-/*
- * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. The name of the author may not be used to endorse or promote products
- * derived from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef EVENT2_VISIBILITY_H_INCLUDED_
-#define EVENT2_VISIBILITY_H_INCLUDED_
-
-#include
-
-#if defined(event_EXPORTS) || defined(event_extra_EXPORTS) || defined(event_core_EXPORTS)
-# if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
-# define EVENT2_EXPORT_SYMBOL __global
-# elif defined __GNUC__
-# define EVENT2_EXPORT_SYMBOL __attribute__ ((visibility("default")))
-# elif defined(_MSC_VER)
-# define EVENT2_EXPORT_SYMBOL extern __declspec(dllexport)
-# else
-# define EVENT2_EXPORT_SYMBOL /* unknown compiler */
-# endif
-#else
-# if defined(EVENT__NEED_DLLIMPORT) && defined(_MSC_VER) && !defined(EVENT_BUILDING_REGRESS_TEST)
-# define EVENT2_EXPORT_SYMBOL extern __declspec(dllimport)
-# else
-# define EVENT2_EXPORT_SYMBOL
-# endif
-#endif
-
-#endif /* EVENT2_VISIBILITY_H_INCLUDED_ */
diff --git a/src/components/openssl/aes.h b/src/components/openssl/aes.h
deleted file mode 100644
index 36db745..0000000
--- a/src/components/openssl/aes.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* crypto/aes/aes.h */
-/* ====================================================================
- * Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- * software must display the following acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- * endorse or promote products derived from this software without
- * prior written permission. For written permission, please contact
- * openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- * nor may "OpenSSL" appear in their names without prior written
- * permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- * acknowledgment:
- * "This product includes software developed by the OpenSSL Project
- * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- */
-
-#ifndef HEADER_AES_H
-# define HEADER_AES_H
-
-# include
-
-# ifdef OPENSSL_NO_AES
-# error AES is disabled.
-# endif
-
-# include
-
-# define AES_ENCRYPT 1
-# define AES_DECRYPT 0
-
-/*
- * Because array size can't be a const in C, the following two are macros.
- * Both sizes are in bytes.
- */
-# define AES_MAXNR 14
-# define AES_BLOCK_SIZE 16
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* This should be a hidden type, but EVP requires that the size be known */
-struct aes_key_st {
-# ifdef AES_LONG
- unsigned long rd_key[4 * (AES_MAXNR + 1)];
-# else
- unsigned int rd_key[4 * (AES_MAXNR + 1)];
-# endif
- int rounds;
-};
-typedef struct aes_key_st AES_KEY;
-
-const char *AES_options(void);
-
-int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
- AES_KEY *key);
-int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
- AES_KEY *key);
-
-int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
- AES_KEY *key);
-int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
- AES_KEY *key);
-
-void AES_encrypt(const unsigned char *in, unsigned char *out,
- const AES_KEY *key);
-void AES_decrypt(const unsigned char *in, unsigned char *out,
- const AES_KEY *key);
-
-void AES_ecb_encrypt(const unsigned char *in, unsigned char *out,
- const AES_KEY *key, const int enc);
-void AES_cbc_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char *ivec, const int enc);
-void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char *ivec, int *num, const int enc);
-void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char *ivec, int *num, const int enc);
-void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char *ivec, int *num, const int enc);
-void AES_ofb128_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char *ivec, int *num);
-void AES_ctr128_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char ivec[AES_BLOCK_SIZE],
- unsigned char ecount_buf[AES_BLOCK_SIZE],
- unsigned int *num);
-/* NB: the IV is _two_ blocks long */
-void AES_ige_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- unsigned char *ivec, const int enc);
-/* NB: the IV is _four_ blocks long */
-void AES_bi_ige_encrypt(const unsigned char *in, unsigned char *out,
- size_t length, const AES_KEY *key,
- const AES_KEY *key2, const unsigned char *ivec,
- const int enc);
-
-int AES_wrap_key(AES_KEY *key, const unsigned char *iv,
- unsigned char *out,
- const unsigned char *in, unsigned int inlen);
-int AES_unwrap_key(AES_KEY *key, const unsigned char *iv,
- unsigned char *out,
- const unsigned char *in, unsigned int inlen);
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* !HEADER_AES_H */
diff --git a/src/components/openssl/asn1.h b/src/components/openssl/asn1.h
deleted file mode 100644
index da8a45b..0000000
--- a/src/components/openssl/asn1.h
+++ /dev/null
@@ -1,1419 +0,0 @@
-/* crypto/asn1/asn1.h */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#ifndef HEADER_ASN1_H
-# define HEADER_ASN1_H
-
-# include
-# include
-# ifndef OPENSSL_NO_BIO
-# include
-# endif
-# include
-# include
-
-# include
-
-# include
-# ifndef OPENSSL_NO_DEPRECATED
-# include
-# endif
-
-# ifdef OPENSSL_BUILD_SHLIBCRYPTO
-# undef OPENSSL_EXTERN
-# define OPENSSL_EXTERN OPENSSL_EXPORT
-# endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-# define V_ASN1_UNIVERSAL 0x00
-# define V_ASN1_APPLICATION 0x40
-# define V_ASN1_CONTEXT_SPECIFIC 0x80
-# define V_ASN1_PRIVATE 0xc0
-
-# define V_ASN1_CONSTRUCTED 0x20
-# define V_ASN1_PRIMITIVE_TAG 0x1f
-# define V_ASN1_PRIMATIVE_TAG 0x1f
-
-# define V_ASN1_APP_CHOOSE -2/* let the recipient choose */
-# define V_ASN1_OTHER -3/* used in ASN1_TYPE */
-# define V_ASN1_ANY -4/* used in ASN1 template code */
-
-# define V_ASN1_NEG 0x100/* negative flag */
-
-# define V_ASN1_UNDEF -1
-# define V_ASN1_EOC 0
-# define V_ASN1_BOOLEAN 1 /**/
-# define V_ASN1_INTEGER 2
-# define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
-# define V_ASN1_BIT_STRING 3
-# define V_ASN1_OCTET_STRING 4
-# define V_ASN1_NULL 5
-# define V_ASN1_OBJECT 6
-# define V_ASN1_OBJECT_DESCRIPTOR 7
-# define V_ASN1_EXTERNAL 8
-# define V_ASN1_REAL 9
-# define V_ASN1_ENUMERATED 10
-# define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
-# define V_ASN1_UTF8STRING 12
-# define V_ASN1_SEQUENCE 16
-# define V_ASN1_SET 17
-# define V_ASN1_NUMERICSTRING 18 /**/
-# define V_ASN1_PRINTABLESTRING 19
-# define V_ASN1_T61STRING 20
-# define V_ASN1_TELETEXSTRING 20/* alias */
-# define V_ASN1_VIDEOTEXSTRING 21 /**/
-# define V_ASN1_IA5STRING 22
-# define V_ASN1_UTCTIME 23
-# define V_ASN1_GENERALIZEDTIME 24 /**/
-# define V_ASN1_GRAPHICSTRING 25 /**/
-# define V_ASN1_ISO64STRING 26 /**/
-# define V_ASN1_VISIBLESTRING 26/* alias */
-# define V_ASN1_GENERALSTRING 27 /**/
-# define V_ASN1_UNIVERSALSTRING 28 /**/
-# define V_ASN1_BMPSTRING 30
-/* For use with d2i_ASN1_type_bytes() */
-# define B_ASN1_NUMERICSTRING 0x0001
-# define B_ASN1_PRINTABLESTRING 0x0002
-# define B_ASN1_T61STRING 0x0004
-# define B_ASN1_TELETEXSTRING 0x0004
-# define B_ASN1_VIDEOTEXSTRING 0x0008
-# define B_ASN1_IA5STRING 0x0010
-# define B_ASN1_GRAPHICSTRING 0x0020
-# define B_ASN1_ISO64STRING 0x0040
-# define B_ASN1_VISIBLESTRING 0x0040
-# define B_ASN1_GENERALSTRING 0x0080
-# define B_ASN1_UNIVERSALSTRING 0x0100
-# define B_ASN1_OCTET_STRING 0x0200
-# define B_ASN1_BIT_STRING 0x0400
-# define B_ASN1_BMPSTRING 0x0800
-# define B_ASN1_UNKNOWN 0x1000
-# define B_ASN1_UTF8STRING 0x2000
-# define B_ASN1_UTCTIME 0x4000
-# define B_ASN1_GENERALIZEDTIME 0x8000
-# define B_ASN1_SEQUENCE 0x10000
-/* For use with ASN1_mbstring_copy() */
-# define MBSTRING_FLAG 0x1000
-# define MBSTRING_UTF8 (MBSTRING_FLAG)
-# define MBSTRING_ASC (MBSTRING_FLAG|1)
-# define MBSTRING_BMP (MBSTRING_FLAG|2)
-# define MBSTRING_UNIV (MBSTRING_FLAG|4)
-# define SMIME_OLDMIME 0x400
-# define SMIME_CRLFEOL 0x800
-# define SMIME_STREAM 0x1000
- struct X509_algor_st;
-DECLARE_STACK_OF(X509_ALGOR)
-
-# define DECLARE_ASN1_SET_OF(type)/* filled in by mkstack.pl */
-# define IMPLEMENT_ASN1_SET_OF(type)/* nothing, no longer needed */
-
-/*
- * We MUST make sure that, except for constness, asn1_ctx_st and
- * asn1_const_ctx are exactly the same. Fortunately, as soon as the old ASN1
- * parsing macros are gone, we can throw this away as well...
- */
-typedef struct asn1_ctx_st {
- unsigned char *p; /* work char pointer */
- int eos; /* end of sequence read for indefinite
- * encoding */
- int error; /* error code to use when returning an error */
- int inf; /* constructed if 0x20, indefinite is 0x21 */
- int tag; /* tag from last 'get object' */
- int xclass; /* class from last 'get object' */
- long slen; /* length of last 'get object' */
- unsigned char *max; /* largest value of p allowed */
- unsigned char *q; /* temporary variable */
- unsigned char **pp; /* variable */
- int line; /* used in error processing */
-} ASN1_CTX;
-
-typedef struct asn1_const_ctx_st {
- const unsigned char *p; /* work char pointer */
- int eos; /* end of sequence read for indefinite
- * encoding */
- int error; /* error code to use when returning an error */
- int inf; /* constructed if 0x20, indefinite is 0x21 */
- int tag; /* tag from last 'get object' */
- int xclass; /* class from last 'get object' */
- long slen; /* length of last 'get object' */
- const unsigned char *max; /* largest value of p allowed */
- const unsigned char *q; /* temporary variable */
- const unsigned char **pp; /* variable */
- int line; /* used in error processing */
-} ASN1_const_CTX;
-
-/*
- * These are used internally in the ASN1_OBJECT to keep track of whether the
- * names and data need to be free()ed
- */
-# define ASN1_OBJECT_FLAG_DYNAMIC 0x01/* internal use */
-# define ASN1_OBJECT_FLAG_CRITICAL 0x02/* critical x509v3 object id */
-# define ASN1_OBJECT_FLAG_DYNAMIC_STRINGS 0x04/* internal use */
-# define ASN1_OBJECT_FLAG_DYNAMIC_DATA 0x08/* internal use */
-struct asn1_object_st {
- const char *sn, *ln;
- int nid;
- int length;
- const unsigned char *data; /* data remains const after init */
- int flags; /* Should we free this one */
-};
-
-# define ASN1_STRING_FLAG_BITS_LEFT 0x08/* Set if 0x07 has bits left value */
-/*
- * This indicates that the ASN1_STRING is not a real value but just a place
- * holder for the location where indefinite length constructed data should be
- * inserted in the memory buffer
- */
-# define ASN1_STRING_FLAG_NDEF 0x010
-
-/*
- * This flag is used by the CMS code to indicate that a string is not
- * complete and is a place holder for content when it had all been accessed.
- * The flag will be reset when content has been written to it.
- */
-
-# define ASN1_STRING_FLAG_CONT 0x020
-/*
- * This flag is used by ASN1 code to indicate an ASN1_STRING is an MSTRING
- * type.
- */
-# define ASN1_STRING_FLAG_MSTRING 0x040
-/* This is the base type that holds just about everything :-) */
-struct asn1_string_st {
- int length;
- int type;
- unsigned char *data;
- /*
- * The value of the following field depends on the type being held. It
- * is mostly being used for BIT_STRING so if the input data has a
- * non-zero 'unused bits' value, it will be handled correctly
- */
- long flags;
-};
-
-/*
- * ASN1_ENCODING structure: this is used to save the received encoding of an
- * ASN1 type. This is useful to get round problems with invalid encodings
- * which can break signatures.
- */
-
-typedef struct ASN1_ENCODING_st {
- unsigned char *enc; /* DER encoding */
- long len; /* Length of encoding */
- int modified; /* set to 1 if 'enc' is invalid */
-} ASN1_ENCODING;
-
-/* Used with ASN1 LONG type: if a long is set to this it is omitted */
-# define ASN1_LONG_UNDEF 0x7fffffffL
-
-# define STABLE_FLAGS_MALLOC 0x01
-# define STABLE_NO_MASK 0x02
-# define DIRSTRING_TYPE \
- (B_ASN1_PRINTABLESTRING|B_ASN1_T61STRING|B_ASN1_BMPSTRING|B_ASN1_UTF8STRING)
-# define PKCS9STRING_TYPE (DIRSTRING_TYPE|B_ASN1_IA5STRING)
-
-typedef struct asn1_string_table_st {
- int nid;
- long minsize;
- long maxsize;
- unsigned long mask;
- unsigned long flags;
-} ASN1_STRING_TABLE;
-
-DECLARE_STACK_OF(ASN1_STRING_TABLE)
-
-/* size limits: this stuff is taken straight from RFC2459 */
-
-# define ub_name 32768
-# define ub_common_name 64
-# define ub_locality_name 128
-# define ub_state_name 128
-# define ub_organization_name 64
-# define ub_organization_unit_name 64
-# define ub_title 64
-# define ub_email_address 128
-
-/*
- * Declarations for template structures: for full definitions see asn1t.h
- */
-typedef struct ASN1_TEMPLATE_st ASN1_TEMPLATE;
-typedef struct ASN1_TLC_st ASN1_TLC;
-/* This is just an opaque pointer */
-typedef struct ASN1_VALUE_st ASN1_VALUE;
-
-/* Declare ASN1 functions: the implement macro in in asn1t.h */
-
-# define DECLARE_ASN1_FUNCTIONS(type) DECLARE_ASN1_FUNCTIONS_name(type, type)
-
-# define DECLARE_ASN1_ALLOC_FUNCTIONS(type) \
- DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, type)
-
-# define DECLARE_ASN1_FUNCTIONS_name(type, name) \
- DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
- DECLARE_ASN1_ENCODE_FUNCTIONS(type, name, name)
-
-# define DECLARE_ASN1_FUNCTIONS_fname(type, itname, name) \
- DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
- DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name)
-
-# define DECLARE_ASN1_ENCODE_FUNCTIONS(type, itname, name) \
- type *d2i_##name(type **a, const unsigned char **in, long len); \
- int i2d_##name(type *a, unsigned char **out); \
- DECLARE_ASN1_ITEM(itname)
-
-# define DECLARE_ASN1_ENCODE_FUNCTIONS_const(type, name) \
- type *d2i_##name(type **a, const unsigned char **in, long len); \
- int i2d_##name(const type *a, unsigned char **out); \
- DECLARE_ASN1_ITEM(name)
-
-# define DECLARE_ASN1_NDEF_FUNCTION(name) \
- int i2d_##name##_NDEF(name *a, unsigned char **out);
-
-# define DECLARE_ASN1_FUNCTIONS_const(name) \
- DECLARE_ASN1_ALLOC_FUNCTIONS(name) \
- DECLARE_ASN1_ENCODE_FUNCTIONS_const(name, name)
-
-# define DECLARE_ASN1_ALLOC_FUNCTIONS_name(type, name) \
- type *name##_new(void); \
- void name##_free(type *a);
-
-# define DECLARE_ASN1_PRINT_FUNCTION(stname) \
- DECLARE_ASN1_PRINT_FUNCTION_fname(stname, stname)
-
-# define DECLARE_ASN1_PRINT_FUNCTION_fname(stname, fname) \
- int fname##_print_ctx(BIO *out, stname *x, int indent, \
- const ASN1_PCTX *pctx);
-
-# define D2I_OF(type) type *(*)(type **,const unsigned char **,long)
-# define I2D_OF(type) int (*)(type *,unsigned char **)
-# define I2D_OF_const(type) int (*)(const type *,unsigned char **)
-
-# define CHECKED_D2I_OF(type, d2i) \
- ((d2i_of_void*) (1 ? d2i : ((D2I_OF(type))0)))
-# define CHECKED_I2D_OF(type, i2d) \
- ((i2d_of_void*) (1 ? i2d : ((I2D_OF(type))0)))
-# define CHECKED_NEW_OF(type, xnew) \
- ((void *(*)(void)) (1 ? xnew : ((type *(*)(void))0)))
-# define CHECKED_PTR_OF(type, p) \
- ((void*) (1 ? p : (type*)0))
-# define CHECKED_PPTR_OF(type, p) \
- ((void**) (1 ? p : (type**)0))
-
-# define TYPEDEF_D2I_OF(type) typedef type *d2i_of_##type(type **,const unsigned char **,long)
-# define TYPEDEF_I2D_OF(type) typedef int i2d_of_##type(type *,unsigned char **)
-# define TYPEDEF_D2I2D_OF(type) TYPEDEF_D2I_OF(type); TYPEDEF_I2D_OF(type)
-
-TYPEDEF_D2I2D_OF(void);
-
-/*-
- * The following macros and typedefs allow an ASN1_ITEM
- * to be embedded in a structure and referenced. Since
- * the ASN1_ITEM pointers need to be globally accessible
- * (possibly from shared libraries) they may exist in
- * different forms. On platforms that support it the
- * ASN1_ITEM structure itself will be globally exported.
- * Other platforms will export a function that returns
- * an ASN1_ITEM pointer.
- *
- * To handle both cases transparently the macros below
- * should be used instead of hard coding an ASN1_ITEM
- * pointer in a structure.
- *
- * The structure will look like this:
- *
- * typedef struct SOMETHING_st {
- * ...
- * ASN1_ITEM_EXP *iptr;
- * ...
- * } SOMETHING;
- *
- * It would be initialised as e.g.:
- *
- * SOMETHING somevar = {...,ASN1_ITEM_ref(X509),...};
- *
- * and the actual pointer extracted with:
- *
- * const ASN1_ITEM *it = ASN1_ITEM_ptr(somevar.iptr);
- *
- * Finally an ASN1_ITEM pointer can be extracted from an
- * appropriate reference with: ASN1_ITEM_rptr(X509). This
- * would be used when a function takes an ASN1_ITEM * argument.
- *
- */
-
-# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION
-
-/* ASN1_ITEM pointer exported type */
-typedef const ASN1_ITEM ASN1_ITEM_EXP;
-
-/* Macro to obtain ASN1_ITEM pointer from exported type */
-# define ASN1_ITEM_ptr(iptr) (iptr)
-
-/* Macro to include ASN1_ITEM pointer from base type */
-# define ASN1_ITEM_ref(iptr) (&(iptr##_it))
-
-# define ASN1_ITEM_rptr(ref) (&(ref##_it))
-
-# define DECLARE_ASN1_ITEM(name) \
- OPENSSL_EXTERN const ASN1_ITEM name##_it;
-
-# else
-
-/*
- * Platforms that can't easily handle shared global variables are declared as
- * functions returning ASN1_ITEM pointers.
- */
-
-/* ASN1_ITEM pointer exported type */
-typedef const ASN1_ITEM *ASN1_ITEM_EXP (void);
-
-/* Macro to obtain ASN1_ITEM pointer from exported type */
-# define ASN1_ITEM_ptr(iptr) (iptr())
-
-/* Macro to include ASN1_ITEM pointer from base type */
-# define ASN1_ITEM_ref(iptr) (iptr##_it)
-
-# define ASN1_ITEM_rptr(ref) (ref##_it())
-
-# define DECLARE_ASN1_ITEM(name) \
- const ASN1_ITEM * name##_it(void);
-
-# endif
-
-/* Parameters used by ASN1_STRING_print_ex() */
-
-/*
- * These determine which characters to escape: RFC2253 special characters,
- * control characters and MSB set characters
- */
-
-# define ASN1_STRFLGS_ESC_2253 1
-# define ASN1_STRFLGS_ESC_CTRL 2
-# define ASN1_STRFLGS_ESC_MSB 4
-
-/*
- * This flag determines how we do escaping: normally RC2253 backslash only,
- * set this to use backslash and quote.
- */
-
-# define ASN1_STRFLGS_ESC_QUOTE 8
-
-/* These three flags are internal use only. */
-
-/* Character is a valid PrintableString character */
-# define CHARTYPE_PRINTABLESTRING 0x10
-/* Character needs escaping if it is the first character */
-# define CHARTYPE_FIRST_ESC_2253 0x20
-/* Character needs escaping if it is the last character */
-# define CHARTYPE_LAST_ESC_2253 0x40
-
-/*
- * NB the internal flags are safely reused below by flags handled at the top
- * level.
- */
-
-/*
- * If this is set we convert all character strings to UTF8 first
- */
-
-# define ASN1_STRFLGS_UTF8_CONVERT 0x10
-
-/*
- * If this is set we don't attempt to interpret content: just assume all
- * strings are 1 byte per character. This will produce some pretty odd
- * looking output!
- */
-
-# define ASN1_STRFLGS_IGNORE_TYPE 0x20
-
-/* If this is set we include the string type in the output */
-# define ASN1_STRFLGS_SHOW_TYPE 0x40
-
-/*
- * This determines which strings to display and which to 'dump' (hex dump of
- * content octets or DER encoding). We can only dump non character strings or
- * everything. If we don't dump 'unknown' they are interpreted as character
- * strings with 1 octet per character and are subject to the usual escaping
- * options.
- */
-
-# define ASN1_STRFLGS_DUMP_ALL 0x80
-# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
-
-/*
- * These determine what 'dumping' does, we can dump the content octets or the
- * DER encoding: both use the RFC2253 #XXXXX notation.
- */
-
-# define ASN1_STRFLGS_DUMP_DER 0x200
-
-/*
- * All the string flags consistent with RFC2253, escaping control characters
- * isn't essential in RFC2253 but it is advisable anyway.
- */
-
-# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \
- ASN1_STRFLGS_ESC_CTRL | \
- ASN1_STRFLGS_ESC_MSB | \
- ASN1_STRFLGS_UTF8_CONVERT | \
- ASN1_STRFLGS_DUMP_UNKNOWN | \
- ASN1_STRFLGS_DUMP_DER)
-
-DECLARE_STACK_OF(ASN1_INTEGER)
-DECLARE_ASN1_SET_OF(ASN1_INTEGER)
-
-DECLARE_STACK_OF(ASN1_GENERALSTRING)
-
-typedef struct asn1_type_st {
- int type;
- union {
- char *ptr;
- ASN1_BOOLEAN boolean;
- ASN1_STRING *asn1_string;
- ASN1_OBJECT *object;
- ASN1_INTEGER *integer;
- ASN1_ENUMERATED *enumerated;
- ASN1_BIT_STRING *bit_string;
- ASN1_OCTET_STRING *octet_string;
- ASN1_PRINTABLESTRING *printablestring;
- ASN1_T61STRING *t61string;
- ASN1_IA5STRING *ia5string;
- ASN1_GENERALSTRING *generalstring;
- ASN1_BMPSTRING *bmpstring;
- ASN1_UNIVERSALSTRING *universalstring;
- ASN1_UTCTIME *utctime;
- ASN1_GENERALIZEDTIME *generalizedtime;
- ASN1_VISIBLESTRING *visiblestring;
- ASN1_UTF8STRING *utf8string;
- /*
- * set and sequence are left complete and still contain the set or
- * sequence bytes
- */
- ASN1_STRING *set;
- ASN1_STRING *sequence;
- ASN1_VALUE *asn1_value;
- } value;
-} ASN1_TYPE;
-
-DECLARE_STACK_OF(ASN1_TYPE)
-DECLARE_ASN1_SET_OF(ASN1_TYPE)
-
-typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY;
-
-DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SEQUENCE_ANY)
-DECLARE_ASN1_ENCODE_FUNCTIONS_const(ASN1_SEQUENCE_ANY, ASN1_SET_ANY)
-
-typedef struct NETSCAPE_X509_st {
- ASN1_OCTET_STRING *header;
- X509 *cert;
-} NETSCAPE_X509;
-
-/* This is used to contain a list of bit names */
-typedef struct BIT_STRING_BITNAME_st {
- int bitnum;
- const char *lname;
- const char *sname;
-} BIT_STRING_BITNAME;
-
-# define M_ASN1_STRING_length(x) ((x)->length)
-# define M_ASN1_STRING_length_set(x, n) ((x)->length = (n))
-# define M_ASN1_STRING_type(x) ((x)->type)
-# define M_ASN1_STRING_data(x) ((x)->data)
-
-/* Macros for string operations */
-# define M_ASN1_BIT_STRING_new() (ASN1_BIT_STRING *)\
- ASN1_STRING_type_new(V_ASN1_BIT_STRING)
-# define M_ASN1_BIT_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_BIT_STRING_dup(a) (ASN1_BIT_STRING *)\
- ASN1_STRING_dup((const ASN1_STRING *)a)
-# define M_ASN1_BIT_STRING_cmp(a,b) ASN1_STRING_cmp(\
- (const ASN1_STRING *)a,(const ASN1_STRING *)b)
-# define M_ASN1_BIT_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
-
-# define M_ASN1_INTEGER_new() (ASN1_INTEGER *)\
- ASN1_STRING_type_new(V_ASN1_INTEGER)
-# define M_ASN1_INTEGER_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_INTEGER_dup(a) (ASN1_INTEGER *)\
- ASN1_STRING_dup((const ASN1_STRING *)a)
-# define M_ASN1_INTEGER_cmp(a,b) ASN1_STRING_cmp(\
- (const ASN1_STRING *)a,(const ASN1_STRING *)b)
-
-# define M_ASN1_ENUMERATED_new() (ASN1_ENUMERATED *)\
- ASN1_STRING_type_new(V_ASN1_ENUMERATED)
-# define M_ASN1_ENUMERATED_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_ENUMERATED_dup(a) (ASN1_ENUMERATED *)\
- ASN1_STRING_dup((const ASN1_STRING *)a)
-# define M_ASN1_ENUMERATED_cmp(a,b) ASN1_STRING_cmp(\
- (const ASN1_STRING *)a,(const ASN1_STRING *)b)
-
-# define M_ASN1_OCTET_STRING_new() (ASN1_OCTET_STRING *)\
- ASN1_STRING_type_new(V_ASN1_OCTET_STRING)
-# define M_ASN1_OCTET_STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_OCTET_STRING_dup(a) (ASN1_OCTET_STRING *)\
- ASN1_STRING_dup((const ASN1_STRING *)a)
-# define M_ASN1_OCTET_STRING_cmp(a,b) ASN1_STRING_cmp(\
- (const ASN1_STRING *)a,(const ASN1_STRING *)b)
-# define M_ASN1_OCTET_STRING_set(a,b,c) ASN1_STRING_set((ASN1_STRING *)a,b,c)
-# define M_ASN1_OCTET_STRING_print(a,b) ASN1_STRING_print(a,(ASN1_STRING *)b)
-# define M_i2d_ASN1_OCTET_STRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_OCTET_STRING,\
- V_ASN1_UNIVERSAL)
-
-# define B_ASN1_TIME \
- B_ASN1_UTCTIME | \
- B_ASN1_GENERALIZEDTIME
-
-# define B_ASN1_PRINTABLE \
- B_ASN1_NUMERICSTRING| \
- B_ASN1_PRINTABLESTRING| \
- B_ASN1_T61STRING| \
- B_ASN1_IA5STRING| \
- B_ASN1_BIT_STRING| \
- B_ASN1_UNIVERSALSTRING|\
- B_ASN1_BMPSTRING|\
- B_ASN1_UTF8STRING|\
- B_ASN1_SEQUENCE|\
- B_ASN1_UNKNOWN
-
-# define B_ASN1_DIRECTORYSTRING \
- B_ASN1_PRINTABLESTRING| \
- B_ASN1_TELETEXSTRING|\
- B_ASN1_BMPSTRING|\
- B_ASN1_UNIVERSALSTRING|\
- B_ASN1_UTF8STRING
-
-# define B_ASN1_DISPLAYTEXT \
- B_ASN1_IA5STRING| \
- B_ASN1_VISIBLESTRING| \
- B_ASN1_BMPSTRING|\
- B_ASN1_UTF8STRING
-
-# define M_ASN1_PRINTABLE_new() ASN1_STRING_type_new(V_ASN1_T61STRING)
-# define M_ASN1_PRINTABLE_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_PRINTABLE(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
- pp,a->type,V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_PRINTABLE(a,pp,l) \
- d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
- B_ASN1_PRINTABLE)
-
-# define M_DIRECTORYSTRING_new() ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
-# define M_DIRECTORYSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_DIRECTORYSTRING(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
- pp,a->type,V_ASN1_UNIVERSAL)
-# define M_d2i_DIRECTORYSTRING(a,pp,l) \
- d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
- B_ASN1_DIRECTORYSTRING)
-
-# define M_DISPLAYTEXT_new() ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
-# define M_DISPLAYTEXT_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_DISPLAYTEXT(a,pp) i2d_ASN1_bytes((ASN1_STRING *)a,\
- pp,a->type,V_ASN1_UNIVERSAL)
-# define M_d2i_DISPLAYTEXT(a,pp,l) \
- d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l, \
- B_ASN1_DISPLAYTEXT)
-
-# define M_ASN1_PRINTABLESTRING_new() (ASN1_PRINTABLESTRING *)\
- ASN1_STRING_type_new(V_ASN1_PRINTABLESTRING)
-# define M_ASN1_PRINTABLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_PRINTABLESTRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_PRINTABLESTRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_PRINTABLESTRING(a,pp,l) \
- (ASN1_PRINTABLESTRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_PRINTABLESTRING)
-
-# define M_ASN1_T61STRING_new() (ASN1_T61STRING *)\
- ASN1_STRING_type_new(V_ASN1_T61STRING)
-# define M_ASN1_T61STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_T61STRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_T61STRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_T61STRING(a,pp,l) \
- (ASN1_T61STRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_T61STRING)
-
-# define M_ASN1_IA5STRING_new() (ASN1_IA5STRING *)\
- ASN1_STRING_type_new(V_ASN1_IA5STRING)
-# define M_ASN1_IA5STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_IA5STRING_dup(a) \
- (ASN1_IA5STRING *)ASN1_STRING_dup((const ASN1_STRING *)a)
-# define M_i2d_ASN1_IA5STRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_IA5STRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_IA5STRING(a,pp,l) \
- (ASN1_IA5STRING *)d2i_ASN1_type_bytes((ASN1_STRING **)a,pp,l,\
- B_ASN1_IA5STRING)
-
-# define M_ASN1_UTCTIME_new() (ASN1_UTCTIME *)\
- ASN1_STRING_type_new(V_ASN1_UTCTIME)
-# define M_ASN1_UTCTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_UTCTIME_dup(a) (ASN1_UTCTIME *)\
- ASN1_STRING_dup((const ASN1_STRING *)a)
-
-# define M_ASN1_GENERALIZEDTIME_new() (ASN1_GENERALIZEDTIME *)\
- ASN1_STRING_type_new(V_ASN1_GENERALIZEDTIME)
-# define M_ASN1_GENERALIZEDTIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_GENERALIZEDTIME_dup(a) (ASN1_GENERALIZEDTIME *)ASN1_STRING_dup(\
- (const ASN1_STRING *)a)
-
-# define M_ASN1_TIME_new() (ASN1_TIME *)\
- ASN1_STRING_type_new(V_ASN1_UTCTIME)
-# define M_ASN1_TIME_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_ASN1_TIME_dup(a) (ASN1_TIME *)\
- ASN1_STRING_dup((const ASN1_STRING *)a)
-
-# define M_ASN1_GENERALSTRING_new() (ASN1_GENERALSTRING *)\
- ASN1_STRING_type_new(V_ASN1_GENERALSTRING)
-# define M_ASN1_GENERALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_GENERALSTRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_GENERALSTRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_GENERALSTRING(a,pp,l) \
- (ASN1_GENERALSTRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_GENERALSTRING)
-
-# define M_ASN1_UNIVERSALSTRING_new() (ASN1_UNIVERSALSTRING *)\
- ASN1_STRING_type_new(V_ASN1_UNIVERSALSTRING)
-# define M_ASN1_UNIVERSALSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_UNIVERSALSTRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UNIVERSALSTRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_UNIVERSALSTRING(a,pp,l) \
- (ASN1_UNIVERSALSTRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_UNIVERSALSTRING)
-
-# define M_ASN1_BMPSTRING_new() (ASN1_BMPSTRING *)\
- ASN1_STRING_type_new(V_ASN1_BMPSTRING)
-# define M_ASN1_BMPSTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_BMPSTRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_BMPSTRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_BMPSTRING(a,pp,l) \
- (ASN1_BMPSTRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_BMPSTRING)
-
-# define M_ASN1_VISIBLESTRING_new() (ASN1_VISIBLESTRING *)\
- ASN1_STRING_type_new(V_ASN1_VISIBLESTRING)
-# define M_ASN1_VISIBLESTRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_VISIBLESTRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_VISIBLESTRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_VISIBLESTRING(a,pp,l) \
- (ASN1_VISIBLESTRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_VISIBLESTRING)
-
-# define M_ASN1_UTF8STRING_new() (ASN1_UTF8STRING *)\
- ASN1_STRING_type_new(V_ASN1_UTF8STRING)
-# define M_ASN1_UTF8STRING_free(a) ASN1_STRING_free((ASN1_STRING *)a)
-# define M_i2d_ASN1_UTF8STRING(a,pp) \
- i2d_ASN1_bytes((ASN1_STRING *)a,pp,V_ASN1_UTF8STRING,\
- V_ASN1_UNIVERSAL)
-# define M_d2i_ASN1_UTF8STRING(a,pp,l) \
- (ASN1_UTF8STRING *)d2i_ASN1_type_bytes\
- ((ASN1_STRING **)a,pp,l,B_ASN1_UTF8STRING)
-
- /* for the is_set parameter to i2d_ASN1_SET */
-# define IS_SEQUENCE 0
-# define IS_SET 1
-
-DECLARE_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE)
-
-int ASN1_TYPE_get(ASN1_TYPE *a);
-void ASN1_TYPE_set(ASN1_TYPE *a, int type, void *value);
-int ASN1_TYPE_set1(ASN1_TYPE *a, int type, const void *value);
-int ASN1_TYPE_cmp(const ASN1_TYPE *a, const ASN1_TYPE *b);
-
-ASN1_OBJECT *ASN1_OBJECT_new(void);
-void ASN1_OBJECT_free(ASN1_OBJECT *a);
-int i2d_ASN1_OBJECT(ASN1_OBJECT *a, unsigned char **pp);
-ASN1_OBJECT *c2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
- long length);
-ASN1_OBJECT *d2i_ASN1_OBJECT(ASN1_OBJECT **a, const unsigned char **pp,
- long length);
-
-DECLARE_ASN1_ITEM(ASN1_OBJECT)
-
-DECLARE_STACK_OF(ASN1_OBJECT)
-DECLARE_ASN1_SET_OF(ASN1_OBJECT)
-
-ASN1_STRING *ASN1_STRING_new(void);
-void ASN1_STRING_free(ASN1_STRING *a);
-void ASN1_STRING_clear_free(ASN1_STRING *a);
-int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str);
-ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a);
-ASN1_STRING *ASN1_STRING_type_new(int type);
-int ASN1_STRING_cmp(const ASN1_STRING *a, const ASN1_STRING *b);
- /*
- * Since this is used to store all sorts of things, via macros, for now,
- * make its data void *
- */
-int ASN1_STRING_set(ASN1_STRING *str, const void *data, int len);
-void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
-int ASN1_STRING_length(const ASN1_STRING *x);
-void ASN1_STRING_length_set(ASN1_STRING *x, int n);
-int ASN1_STRING_type(ASN1_STRING *x);
-unsigned char *ASN1_STRING_data(ASN1_STRING *x);
-
-DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING)
-int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp);
-ASN1_BIT_STRING *c2i_ASN1_BIT_STRING(ASN1_BIT_STRING **a,
- const unsigned char **pp, long length);
-int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length);
-int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value);
-int ASN1_BIT_STRING_get_bit(ASN1_BIT_STRING *a, int n);
-int ASN1_BIT_STRING_check(ASN1_BIT_STRING *a,
- unsigned char *flags, int flags_len);
-
-# ifndef OPENSSL_NO_BIO
-int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
- BIT_STRING_BITNAME *tbl, int indent);
-# endif
-int ASN1_BIT_STRING_num_asc(char *name, BIT_STRING_BITNAME *tbl);
-int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, char *name, int value,
- BIT_STRING_BITNAME *tbl);
-
-int i2d_ASN1_BOOLEAN(int a, unsigned char **pp);
-int d2i_ASN1_BOOLEAN(int *a, const unsigned char **pp, long length);
-
-DECLARE_ASN1_FUNCTIONS(ASN1_INTEGER)
-int i2c_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp);
-ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
- long length);
-ASN1_INTEGER *d2i_ASN1_UINTEGER(ASN1_INTEGER **a, const unsigned char **pp,
- long length);
-ASN1_INTEGER *ASN1_INTEGER_dup(const ASN1_INTEGER *x);
-int ASN1_INTEGER_cmp(const ASN1_INTEGER *x, const ASN1_INTEGER *y);
-
-DECLARE_ASN1_FUNCTIONS(ASN1_ENUMERATED)
-
-int ASN1_UTCTIME_check(const ASN1_UTCTIME *a);
-ASN1_UTCTIME *ASN1_UTCTIME_set(ASN1_UTCTIME *s, time_t t);
-ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, time_t t,
- int offset_day, long offset_sec);
-int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
-int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
-# if 0
-time_t ASN1_UTCTIME_get(const ASN1_UTCTIME *s);
-# endif
-
-int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *a);
-ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
- time_t t);
-ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s,
- time_t t, int offset_day,
- long offset_sec);
-int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str);
-int ASN1_TIME_diff(int *pday, int *psec,
- const ASN1_TIME *from, const ASN1_TIME *to);
-
-DECLARE_ASN1_FUNCTIONS(ASN1_OCTET_STRING)
-ASN1_OCTET_STRING *ASN1_OCTET_STRING_dup(const ASN1_OCTET_STRING *a);
-int ASN1_OCTET_STRING_cmp(const ASN1_OCTET_STRING *a,
- const ASN1_OCTET_STRING *b);
-int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *str, const unsigned char *data,
- int len);
-
-DECLARE_ASN1_FUNCTIONS(ASN1_VISIBLESTRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_UNIVERSALSTRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_UTF8STRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_NULL)
-DECLARE_ASN1_FUNCTIONS(ASN1_BMPSTRING)
-
-int UTF8_getc(const unsigned char *str, int len, unsigned long *val);
-int UTF8_putc(unsigned char *str, int len, unsigned long value);
-
-DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, ASN1_PRINTABLE)
-
-DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DIRECTORYSTRING)
-DECLARE_ASN1_FUNCTIONS_name(ASN1_STRING, DISPLAYTEXT)
-DECLARE_ASN1_FUNCTIONS(ASN1_PRINTABLESTRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_T61STRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_IA5STRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_GENERALSTRING)
-DECLARE_ASN1_FUNCTIONS(ASN1_UTCTIME)
-DECLARE_ASN1_FUNCTIONS(ASN1_GENERALIZEDTIME)
-DECLARE_ASN1_FUNCTIONS(ASN1_TIME)
-
-DECLARE_ASN1_ITEM(ASN1_OCTET_STRING_NDEF)
-
-ASN1_TIME *ASN1_TIME_set(ASN1_TIME *s, time_t t);
-ASN1_TIME *ASN1_TIME_adj(ASN1_TIME *s, time_t t,
- int offset_day, long offset_sec);
-int ASN1_TIME_check(ASN1_TIME *t);
-ASN1_GENERALIZEDTIME *ASN1_TIME_to_generalizedtime(ASN1_TIME *t, ASN1_GENERALIZEDTIME
- **out);
-int ASN1_TIME_set_string(ASN1_TIME *s, const char *str);
-
-int i2d_ASN1_SET(STACK_OF(OPENSSL_BLOCK) *a, unsigned char **pp,
- i2d_of_void *i2d, int ex_tag, int ex_class, int is_set);
-STACK_OF(OPENSSL_BLOCK) *d2i_ASN1_SET(STACK_OF(OPENSSL_BLOCK) **a,
- const unsigned char **pp,
- long length, d2i_of_void *d2i,
- void (*free_func) (OPENSSL_BLOCK),
- int ex_tag, int ex_class);
-
-# ifndef OPENSSL_NO_BIO
-int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a);
-int a2i_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *bs, char *buf, int size);
-int i2a_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *a);
-int a2i_ASN1_ENUMERATED(BIO *bp, ASN1_ENUMERATED *bs, char *buf, int size);
-int i2a_ASN1_OBJECT(BIO *bp, ASN1_OBJECT *a);
-int a2i_ASN1_STRING(BIO *bp, ASN1_STRING *bs, char *buf, int size);
-int i2a_ASN1_STRING(BIO *bp, ASN1_STRING *a, int type);
-# endif
-int i2t_ASN1_OBJECT(char *buf, int buf_len, ASN1_OBJECT *a);
-
-int a2d_ASN1_OBJECT(unsigned char *out, int olen, const char *buf, int num);
-ASN1_OBJECT *ASN1_OBJECT_create(int nid, unsigned char *data, int len,
- const char *sn, const char *ln);
-
-int ASN1_INTEGER_set(ASN1_INTEGER *a, long v);
-long ASN1_INTEGER_get(const ASN1_INTEGER *a);
-ASN1_INTEGER *BN_to_ASN1_INTEGER(const BIGNUM *bn, ASN1_INTEGER *ai);
-BIGNUM *ASN1_INTEGER_to_BN(const ASN1_INTEGER *ai, BIGNUM *bn);
-
-int ASN1_ENUMERATED_set(ASN1_ENUMERATED *a, long v);
-long ASN1_ENUMERATED_get(ASN1_ENUMERATED *a);
-ASN1_ENUMERATED *BN_to_ASN1_ENUMERATED(BIGNUM *bn, ASN1_ENUMERATED *ai);
-BIGNUM *ASN1_ENUMERATED_to_BN(ASN1_ENUMERATED *ai, BIGNUM *bn);
-
-/* General */
-/* given a string, return the correct type, max is the maximum length */
-int ASN1_PRINTABLE_type(const unsigned char *s, int max);
-
-int i2d_ASN1_bytes(ASN1_STRING *a, unsigned char **pp, int tag, int xclass);
-ASN1_STRING *d2i_ASN1_bytes(ASN1_STRING **a, const unsigned char **pp,
- long length, int Ptag, int Pclass);
-unsigned long ASN1_tag2bit(int tag);
-/* type is one or more of the B_ASN1_ values. */
-ASN1_STRING *d2i_ASN1_type_bytes(ASN1_STRING **a, const unsigned char **pp,
- long length, int type);
-
-/* PARSING */
-int asn1_Finish(ASN1_CTX *c);
-int asn1_const_Finish(ASN1_const_CTX *c);
-
-/* SPECIALS */
-int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
- int *pclass, long omax);
-int ASN1_check_infinite_end(unsigned char **p, long len);
-int ASN1_const_check_infinite_end(const unsigned char **p, long len);
-void ASN1_put_object(unsigned char **pp, int constructed, int length,
- int tag, int xclass);
-int ASN1_put_eoc(unsigned char **pp);
-int ASN1_object_size(int constructed, int length, int tag);
-
-/* Used to implement other functions */
-void *ASN1_dup(i2d_of_void *i2d, d2i_of_void *d2i, void *x);
-
-# define ASN1_dup_of(type,i2d,d2i,x) \
- ((type*)ASN1_dup(CHECKED_I2D_OF(type, i2d), \
- CHECKED_D2I_OF(type, d2i), \
- CHECKED_PTR_OF(type, x)))
-
-# define ASN1_dup_of_const(type,i2d,d2i,x) \
- ((type*)ASN1_dup(CHECKED_I2D_OF(const type, i2d), \
- CHECKED_D2I_OF(type, d2i), \
- CHECKED_PTR_OF(const type, x)))
-
-void *ASN1_item_dup(const ASN1_ITEM *it, void *x);
-
-/* ASN1 alloc/free macros for when a type is only used internally */
-
-# define M_ASN1_new_of(type) (type *)ASN1_item_new(ASN1_ITEM_rptr(type))
-# define M_ASN1_free_of(x, type) \
- ASN1_item_free(CHECKED_PTR_OF(type, x), ASN1_ITEM_rptr(type))
-
-# ifndef OPENSSL_NO_FP_API
-void *ASN1_d2i_fp(void *(*xnew) (void), d2i_of_void *d2i, FILE *in, void **x);
-
-# define ASN1_d2i_fp_of(type,xnew,d2i,in,x) \
- ((type*)ASN1_d2i_fp(CHECKED_NEW_OF(type, xnew), \
- CHECKED_D2I_OF(type, d2i), \
- in, \
- CHECKED_PPTR_OF(type, x)))
-
-void *ASN1_item_d2i_fp(const ASN1_ITEM *it, FILE *in, void *x);
-int ASN1_i2d_fp(i2d_of_void *i2d, FILE *out, void *x);
-
-# define ASN1_i2d_fp_of(type,i2d,out,x) \
- (ASN1_i2d_fp(CHECKED_I2D_OF(type, i2d), \
- out, \
- CHECKED_PTR_OF(type, x)))
-
-# define ASN1_i2d_fp_of_const(type,i2d,out,x) \
- (ASN1_i2d_fp(CHECKED_I2D_OF(const type, i2d), \
- out, \
- CHECKED_PTR_OF(const type, x)))
-
-int ASN1_item_i2d_fp(const ASN1_ITEM *it, FILE *out, void *x);
-int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags);
-# endif
-
-int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in);
-
-# ifndef OPENSSL_NO_BIO
-void *ASN1_d2i_bio(void *(*xnew) (void), d2i_of_void *d2i, BIO *in, void **x);
-
-# define ASN1_d2i_bio_of(type,xnew,d2i,in,x) \
- ((type*)ASN1_d2i_bio( CHECKED_NEW_OF(type, xnew), \
- CHECKED_D2I_OF(type, d2i), \
- in, \
- CHECKED_PPTR_OF(type, x)))
-
-void *ASN1_item_d2i_bio(const ASN1_ITEM *it, BIO *in, void *x);
-int ASN1_i2d_bio(i2d_of_void *i2d, BIO *out, unsigned char *x);
-
-# define ASN1_i2d_bio_of(type,i2d,out,x) \
- (ASN1_i2d_bio(CHECKED_I2D_OF(type, i2d), \
- out, \
- CHECKED_PTR_OF(type, x)))
-
-# define ASN1_i2d_bio_of_const(type,i2d,out,x) \
- (ASN1_i2d_bio(CHECKED_I2D_OF(const type, i2d), \
- out, \
- CHECKED_PTR_OF(const type, x)))
-
-int ASN1_item_i2d_bio(const ASN1_ITEM *it, BIO *out, void *x);
-int ASN1_UTCTIME_print(BIO *fp, const ASN1_UTCTIME *a);
-int ASN1_GENERALIZEDTIME_print(BIO *fp, const ASN1_GENERALIZEDTIME *a);
-int ASN1_TIME_print(BIO *fp, const ASN1_TIME *a);
-int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v);
-int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags);
-int ASN1_bn_print(BIO *bp, const char *number, const BIGNUM *num,
- unsigned char *buf, int off);
-int ASN1_parse(BIO *bp, const unsigned char *pp, long len, int indent);
-int ASN1_parse_dump(BIO *bp, const unsigned char *pp, long len, int indent,
- int dump);
-# endif
-const char *ASN1_tag2str(int tag);
-
-/* Used to load and write netscape format cert */
-
-DECLARE_ASN1_FUNCTIONS(NETSCAPE_X509)
-
-int ASN1_UNIVERSALSTRING_to_string(ASN1_UNIVERSALSTRING *s);
-
-int ASN1_TYPE_set_octetstring(ASN1_TYPE *a, unsigned char *data, int len);
-int ASN1_TYPE_get_octetstring(ASN1_TYPE *a, unsigned char *data, int max_len);
-int ASN1_TYPE_set_int_octetstring(ASN1_TYPE *a, long num,
- unsigned char *data, int len);
-int ASN1_TYPE_get_int_octetstring(ASN1_TYPE *a, long *num,
- unsigned char *data, int max_len);
-
-STACK_OF(OPENSSL_BLOCK) *ASN1_seq_unpack(const unsigned char *buf, int len,
- d2i_of_void *d2i,
- void (*free_func) (OPENSSL_BLOCK));
-unsigned char *ASN1_seq_pack(STACK_OF(OPENSSL_BLOCK) *safes, i2d_of_void *i2d,
- unsigned char **buf, int *len);
-void *ASN1_unpack_string(ASN1_STRING *oct, d2i_of_void *d2i);
-void *ASN1_item_unpack(ASN1_STRING *oct, const ASN1_ITEM *it);
-ASN1_STRING *ASN1_pack_string(void *obj, i2d_of_void *i2d,
- ASN1_OCTET_STRING **oct);
-
-# define ASN1_pack_string_of(type,obj,i2d,oct) \
- (ASN1_pack_string(CHECKED_PTR_OF(type, obj), \
- CHECKED_I2D_OF(type, i2d), \
- oct))
-
-ASN1_STRING *ASN1_item_pack(void *obj, const ASN1_ITEM *it,
- ASN1_OCTET_STRING **oct);
-
-void ASN1_STRING_set_default_mask(unsigned long mask);
-int ASN1_STRING_set_default_mask_asc(const char *p);
-unsigned long ASN1_STRING_get_default_mask(void);
-int ASN1_mbstring_copy(ASN1_STRING **out, const unsigned char *in, int len,
- int inform, unsigned long mask);
-int ASN1_mbstring_ncopy(ASN1_STRING **out, const unsigned char *in, int len,
- int inform, unsigned long mask,
- long minsize, long maxsize);
-
-ASN1_STRING *ASN1_STRING_set_by_NID(ASN1_STRING **out,
- const unsigned char *in, int inlen,
- int inform, int nid);
-ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid);
-int ASN1_STRING_TABLE_add(int, long, long, unsigned long, unsigned long);
-void ASN1_STRING_TABLE_cleanup(void);
-
-/* ASN1 template functions */
-
-/* Old API compatible functions */
-ASN1_VALUE *ASN1_item_new(const ASN1_ITEM *it);
-void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it);
-ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **val, const unsigned char **in,
- long len, const ASN1_ITEM *it);
-int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it);
-int ASN1_item_ndef_i2d(ASN1_VALUE *val, unsigned char **out,
- const ASN1_ITEM *it);
-
-void ASN1_add_oid_module(void);
-
-ASN1_TYPE *ASN1_generate_nconf(char *str, CONF *nconf);
-ASN1_TYPE *ASN1_generate_v3(char *str, X509V3_CTX *cnf);
-
-/* ASN1 Print flags */
-
-/* Indicate missing OPTIONAL fields */
-# define ASN1_PCTX_FLAGS_SHOW_ABSENT 0x001
-/* Mark start and end of SEQUENCE */
-# define ASN1_PCTX_FLAGS_SHOW_SEQUENCE 0x002
-/* Mark start and end of SEQUENCE/SET OF */
-# define ASN1_PCTX_FLAGS_SHOW_SSOF 0x004
-/* Show the ASN1 type of primitives */
-# define ASN1_PCTX_FLAGS_SHOW_TYPE 0x008
-/* Don't show ASN1 type of ANY */
-# define ASN1_PCTX_FLAGS_NO_ANY_TYPE 0x010
-/* Don't show ASN1 type of MSTRINGs */
-# define ASN1_PCTX_FLAGS_NO_MSTRING_TYPE 0x020
-/* Don't show field names in SEQUENCE */
-# define ASN1_PCTX_FLAGS_NO_FIELD_NAME 0x040
-/* Show structure names of each SEQUENCE field */
-# define ASN1_PCTX_FLAGS_SHOW_FIELD_STRUCT_NAME 0x080
-/* Don't show structure name even at top level */
-# define ASN1_PCTX_FLAGS_NO_STRUCT_NAME 0x100
-
-int ASN1_item_print(BIO *out, ASN1_VALUE *ifld, int indent,
- const ASN1_ITEM *it, const ASN1_PCTX *pctx);
-ASN1_PCTX *ASN1_PCTX_new(void);
-void ASN1_PCTX_free(ASN1_PCTX *p);
-unsigned long ASN1_PCTX_get_flags(ASN1_PCTX *p);
-void ASN1_PCTX_set_flags(ASN1_PCTX *p, unsigned long flags);
-unsigned long ASN1_PCTX_get_nm_flags(ASN1_PCTX *p);
-void ASN1_PCTX_set_nm_flags(ASN1_PCTX *p, unsigned long flags);
-unsigned long ASN1_PCTX_get_cert_flags(ASN1_PCTX *p);
-void ASN1_PCTX_set_cert_flags(ASN1_PCTX *p, unsigned long flags);
-unsigned long ASN1_PCTX_get_oid_flags(ASN1_PCTX *p);
-void ASN1_PCTX_set_oid_flags(ASN1_PCTX *p, unsigned long flags);
-unsigned long ASN1_PCTX_get_str_flags(ASN1_PCTX *p);
-void ASN1_PCTX_set_str_flags(ASN1_PCTX *p, unsigned long flags);
-
-BIO_METHOD *BIO_f_asn1(void);
-
-BIO *BIO_new_NDEF(BIO *out, ASN1_VALUE *val, const ASN1_ITEM *it);
-
-int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
- const ASN1_ITEM *it);
-int PEM_write_bio_ASN1_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
- const char *hdr, const ASN1_ITEM *it);
-int SMIME_write_ASN1(BIO *bio, ASN1_VALUE *val, BIO *data, int flags,
- int ctype_nid, int econt_nid,
- STACK_OF(X509_ALGOR) *mdalgs, const ASN1_ITEM *it);
-ASN1_VALUE *SMIME_read_ASN1(BIO *bio, BIO **bcont, const ASN1_ITEM *it);
-int SMIME_crlf_copy(BIO *in, BIO *out, int flags);
-int SMIME_text(BIO *in, BIO *out);
-
-/* BEGIN ERROR CODES */
-/*
- * The following lines are auto generated by the script mkerr.pl. Any changes
- * made after this point may be overwritten when the script is next run.
- */
-void ERR_load_ASN1_strings(void);
-
-/* Error codes for the ASN1 functions. */
-
-/* Function codes. */
-# define ASN1_F_A2D_ASN1_OBJECT 100
-# define ASN1_F_A2I_ASN1_ENUMERATED 101
-# define ASN1_F_A2I_ASN1_INTEGER 102
-# define ASN1_F_A2I_ASN1_STRING 103
-# define ASN1_F_APPEND_EXP 176
-# define ASN1_F_ASN1_BIT_STRING_SET_BIT 183
-# define ASN1_F_ASN1_CB 177
-# define ASN1_F_ASN1_CHECK_TLEN 104
-# define ASN1_F_ASN1_COLLATE_PRIMITIVE 105
-# define ASN1_F_ASN1_COLLECT 106
-# define ASN1_F_ASN1_D2I_EX_PRIMITIVE 108
-# define ASN1_F_ASN1_D2I_FP 109
-# define ASN1_F_ASN1_D2I_READ_BIO 107
-# define ASN1_F_ASN1_DIGEST 184
-# define ASN1_F_ASN1_DO_ADB 110
-# define ASN1_F_ASN1_DUP 111
-# define ASN1_F_ASN1_ENUMERATED_SET 112
-# define ASN1_F_ASN1_ENUMERATED_TO_BN 113
-# define ASN1_F_ASN1_EX_C2I 204
-# define ASN1_F_ASN1_FIND_END 190
-# define ASN1_F_ASN1_GENERALIZEDTIME_ADJ 216
-# define ASN1_F_ASN1_GENERALIZEDTIME_SET 185
-# define ASN1_F_ASN1_GENERATE_V3 178
-# define ASN1_F_ASN1_GET_OBJECT 114
-# define ASN1_F_ASN1_HEADER_NEW 115
-# define ASN1_F_ASN1_I2D_BIO 116
-# define ASN1_F_ASN1_I2D_FP 117
-# define ASN1_F_ASN1_INTEGER_SET 118
-# define ASN1_F_ASN1_INTEGER_TO_BN 119
-# define ASN1_F_ASN1_ITEM_D2I_FP 206
-# define ASN1_F_ASN1_ITEM_DUP 191
-# define ASN1_F_ASN1_ITEM_EX_COMBINE_NEW 121
-# define ASN1_F_ASN1_ITEM_EX_D2I 120
-# define ASN1_F_ASN1_ITEM_I2D_BIO 192
-# define ASN1_F_ASN1_ITEM_I2D_FP 193
-# define ASN1_F_ASN1_ITEM_PACK 198
-# define ASN1_F_ASN1_ITEM_SIGN 195
-# define ASN1_F_ASN1_ITEM_SIGN_CTX 220
-# define ASN1_F_ASN1_ITEM_UNPACK 199
-# define ASN1_F_ASN1_ITEM_VERIFY 197
-# define ASN1_F_ASN1_MBSTRING_NCOPY 122
-# define ASN1_F_ASN1_OBJECT_NEW 123
-# define ASN1_F_ASN1_OUTPUT_DATA 214
-# define ASN1_F_ASN1_PACK_STRING 124
-# define ASN1_F_ASN1_PCTX_NEW 205
-# define ASN1_F_ASN1_PKCS5_PBE_SET 125
-# define ASN1_F_ASN1_SEQ_PACK 126
-# define ASN1_F_ASN1_SEQ_UNPACK 127
-# define ASN1_F_ASN1_SIGN 128
-# define ASN1_F_ASN1_STR2TYPE 179
-# define ASN1_F_ASN1_STRING_SET 186
-# define ASN1_F_ASN1_STRING_TABLE_ADD 129
-# define ASN1_F_ASN1_STRING_TYPE_NEW 130
-# define ASN1_F_ASN1_TEMPLATE_EX_D2I 132
-# define ASN1_F_ASN1_TEMPLATE_NEW 133
-# define ASN1_F_ASN1_TEMPLATE_NOEXP_D2I 131
-# define ASN1_F_ASN1_TIME_ADJ 217
-# define ASN1_F_ASN1_TIME_SET 175
-# define ASN1_F_ASN1_TYPE_GET_INT_OCTETSTRING 134
-# define ASN1_F_ASN1_TYPE_GET_OCTETSTRING 135
-# define ASN1_F_ASN1_UNPACK_STRING 136
-# define ASN1_F_ASN1_UTCTIME_ADJ 218
-# define ASN1_F_ASN1_UTCTIME_SET 187
-# define ASN1_F_ASN1_VERIFY 137
-# define ASN1_F_B64_READ_ASN1 209
-# define ASN1_F_B64_WRITE_ASN1 210
-# define ASN1_F_BIO_NEW_NDEF 208
-# define ASN1_F_BITSTR_CB 180
-# define ASN1_F_BN_TO_ASN1_ENUMERATED 138
-# define ASN1_F_BN_TO_ASN1_INTEGER 139
-# define ASN1_F_C2I_ASN1_BIT_STRING 189
-# define ASN1_F_C2I_ASN1_INTEGER 194
-# define ASN1_F_C2I_ASN1_OBJECT 196
-# define ASN1_F_COLLECT_DATA 140
-# define ASN1_F_D2I_ASN1_BIT_STRING 141
-# define ASN1_F_D2I_ASN1_BOOLEAN 142
-# define ASN1_F_D2I_ASN1_BYTES 143
-# define ASN1_F_D2I_ASN1_GENERALIZEDTIME 144
-# define ASN1_F_D2I_ASN1_HEADER 145
-# define ASN1_F_D2I_ASN1_INTEGER 146
-# define ASN1_F_D2I_ASN1_OBJECT 147
-# define ASN1_F_D2I_ASN1_SET 148
-# define ASN1_F_D2I_ASN1_TYPE_BYTES 149
-# define ASN1_F_D2I_ASN1_UINTEGER 150
-# define ASN1_F_D2I_ASN1_UTCTIME 151
-# define ASN1_F_D2I_AUTOPRIVATEKEY 207
-# define ASN1_F_D2I_NETSCAPE_RSA 152
-# define ASN1_F_D2I_NETSCAPE_RSA_2 153
-# define ASN1_F_D2I_PRIVATEKEY 154
-# define ASN1_F_D2I_PUBLICKEY 155
-# define ASN1_F_D2I_RSA_NET 200
-# define ASN1_F_D2I_RSA_NET_2 201
-# define ASN1_F_D2I_X509 156
-# define ASN1_F_D2I_X509_CINF 157
-# define ASN1_F_D2I_X509_PKEY 159
-# define ASN1_F_I2D_ASN1_BIO_STREAM 211
-# define ASN1_F_I2D_ASN1_SET 188
-# define ASN1_F_I2D_ASN1_TIME 160
-# define ASN1_F_I2D_DSA_PUBKEY 161
-# define ASN1_F_I2D_EC_PUBKEY 181
-# define ASN1_F_I2D_PRIVATEKEY 163
-# define ASN1_F_I2D_PUBLICKEY 164
-# define ASN1_F_I2D_RSA_NET 162
-# define ASN1_F_I2D_RSA_PUBKEY 165
-# define ASN1_F_LONG_C2I 166
-# define ASN1_F_OID_MODULE_INIT 174
-# define ASN1_F_PARSE_TAGGING 182
-# define ASN1_F_PKCS5_PBE2_SET_IV 167
-# define ASN1_F_PKCS5_PBE_SET 202
-# define ASN1_F_PKCS5_PBE_SET0_ALGOR 215
-# define ASN1_F_PKCS5_PBKDF2_SET 219
-# define ASN1_F_SMIME_READ_ASN1 212
-# define ASN1_F_SMIME_TEXT 213
-# define ASN1_F_X509_CINF_NEW 168
-# define ASN1_F_X509_CRL_ADD0_REVOKED 169
-# define ASN1_F_X509_INFO_NEW 170
-# define ASN1_F_X509_NAME_ENCODE 203
-# define ASN1_F_X509_NAME_EX_D2I 158
-# define ASN1_F_X509_NAME_EX_NEW 171
-# define ASN1_F_X509_NEW 172
-# define ASN1_F_X509_PKEY_NEW 173
-
-/* Reason codes. */
-# define ASN1_R_ADDING_OBJECT 171
-# define ASN1_R_ASN1_PARSE_ERROR 203
-# define ASN1_R_ASN1_SIG_PARSE_ERROR 204
-# define ASN1_R_AUX_ERROR 100
-# define ASN1_R_BAD_CLASS 101
-# define ASN1_R_BAD_OBJECT_HEADER 102
-# define ASN1_R_BAD_PASSWORD_READ 103
-# define ASN1_R_BAD_TAG 104
-# define ASN1_R_BMPSTRING_IS_WRONG_LENGTH 214
-# define ASN1_R_BN_LIB 105
-# define ASN1_R_BOOLEAN_IS_WRONG_LENGTH 106
-# define ASN1_R_BUFFER_TOO_SMALL 107
-# define ASN1_R_CIPHER_HAS_NO_OBJECT_IDENTIFIER 108
-# define ASN1_R_CONTEXT_NOT_INITIALISED 217
-# define ASN1_R_DATA_IS_WRONG 109
-# define ASN1_R_DECODE_ERROR 110
-# define ASN1_R_DECODING_ERROR 111
-# define ASN1_R_DEPTH_EXCEEDED 174
-# define ASN1_R_DIGEST_AND_KEY_TYPE_NOT_SUPPORTED 198
-# define ASN1_R_ENCODE_ERROR 112
-# define ASN1_R_ERROR_GETTING_TIME 173
-# define ASN1_R_ERROR_LOADING_SECTION 172
-# define ASN1_R_ERROR_PARSING_SET_ELEMENT 113
-# define ASN1_R_ERROR_SETTING_CIPHER_PARAMS 114
-# define ASN1_R_EXPECTING_AN_INTEGER 115
-# define ASN1_R_EXPECTING_AN_OBJECT 116
-# define ASN1_R_EXPECTING_A_BOOLEAN 117
-# define ASN1_R_EXPECTING_A_TIME 118
-# define ASN1_R_EXPLICIT_LENGTH_MISMATCH 119
-# define ASN1_R_EXPLICIT_TAG_NOT_CONSTRUCTED 120
-# define ASN1_R_FIELD_MISSING 121
-# define ASN1_R_FIRST_NUM_TOO_LARGE 122
-# define ASN1_R_HEADER_TOO_LONG 123
-# define ASN1_R_ILLEGAL_BITSTRING_FORMAT 175
-# define ASN1_R_ILLEGAL_BOOLEAN 176
-# define ASN1_R_ILLEGAL_CHARACTERS 124
-# define ASN1_R_ILLEGAL_FORMAT 177
-# define ASN1_R_ILLEGAL_HEX 178
-# define ASN1_R_ILLEGAL_IMPLICIT_TAG 179
-# define ASN1_R_ILLEGAL_INTEGER 180
-# define ASN1_R_ILLEGAL_NESTED_TAGGING 181
-# define ASN1_R_ILLEGAL_NULL 125
-# define ASN1_R_ILLEGAL_NULL_VALUE 182
-# define ASN1_R_ILLEGAL_OBJECT 183
-# define ASN1_R_ILLEGAL_OPTIONAL_ANY 126
-# define ASN1_R_ILLEGAL_OPTIONS_ON_ITEM_TEMPLATE 170
-# define ASN1_R_ILLEGAL_TAGGED_ANY 127
-# define ASN1_R_ILLEGAL_TIME_VALUE 184
-# define ASN1_R_INTEGER_NOT_ASCII_FORMAT 185
-# define ASN1_R_INTEGER_TOO_LARGE_FOR_LONG 128
-# define ASN1_R_INVALID_BIT_STRING_BITS_LEFT 220
-# define ASN1_R_INVALID_BMPSTRING_LENGTH 129
-# define ASN1_R_INVALID_DIGIT 130
-# define ASN1_R_INVALID_MIME_TYPE 205
-# define ASN1_R_INVALID_MODIFIER 186
-# define ASN1_R_INVALID_NUMBER 187
-# define ASN1_R_INVALID_OBJECT_ENCODING 216
-# define ASN1_R_INVALID_SEPARATOR 131
-# define ASN1_R_INVALID_TIME_FORMAT 132
-# define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
-# define ASN1_R_INVALID_UTF8STRING 134
-# define ASN1_R_IV_TOO_LARGE 135
-# define ASN1_R_LENGTH_ERROR 136
-# define ASN1_R_LIST_ERROR 188
-# define ASN1_R_MIME_NO_CONTENT_TYPE 206
-# define ASN1_R_MIME_PARSE_ERROR 207
-# define ASN1_R_MIME_SIG_PARSE_ERROR 208
-# define ASN1_R_MISSING_EOC 137
-# define ASN1_R_MISSING_SECOND_NUMBER 138
-# define ASN1_R_MISSING_VALUE 189
-# define ASN1_R_MSTRING_NOT_UNIVERSAL 139
-# define ASN1_R_MSTRING_WRONG_TAG 140
-# define ASN1_R_NESTED_ASN1_STRING 197
-# define ASN1_R_NON_HEX_CHARACTERS 141
-# define ASN1_R_NOT_ASCII_FORMAT 190
-# define ASN1_R_NOT_ENOUGH_DATA 142
-# define ASN1_R_NO_CONTENT_TYPE 209
-# define ASN1_R_NO_DEFAULT_DIGEST 201
-# define ASN1_R_NO_MATCHING_CHOICE_TYPE 143
-# define ASN1_R_NO_MULTIPART_BODY_FAILURE 210
-# define ASN1_R_NO_MULTIPART_BOUNDARY 211
-# define ASN1_R_NO_SIG_CONTENT_TYPE 212
-# define ASN1_R_NULL_IS_WRONG_LENGTH 144
-# define ASN1_R_OBJECT_NOT_ASCII_FORMAT 191
-# define ASN1_R_ODD_NUMBER_OF_CHARS 145
-# define ASN1_R_PRIVATE_KEY_HEADER_MISSING 146
-# define ASN1_R_SECOND_NUMBER_TOO_LARGE 147
-# define ASN1_R_SEQUENCE_LENGTH_MISMATCH 148
-# define ASN1_R_SEQUENCE_NOT_CONSTRUCTED 149
-# define ASN1_R_SEQUENCE_OR_SET_NEEDS_CONFIG 192
-# define ASN1_R_SHORT_LINE 150
-# define ASN1_R_SIG_INVALID_MIME_TYPE 213
-# define ASN1_R_STREAMING_NOT_SUPPORTED 202
-# define ASN1_R_STRING_TOO_LONG 151
-# define ASN1_R_STRING_TOO_SHORT 152
-# define ASN1_R_TAG_VALUE_TOO_HIGH 153
-# define ASN1_R_THE_ASN1_OBJECT_IDENTIFIER_IS_NOT_KNOWN_FOR_THIS_MD 154
-# define ASN1_R_TIME_NOT_ASCII_FORMAT 193
-# define ASN1_R_TOO_LONG 155
-# define ASN1_R_TYPE_NOT_CONSTRUCTED 156
-# define ASN1_R_TYPE_NOT_PRIMITIVE 218
-# define ASN1_R_UNABLE_TO_DECODE_RSA_KEY 157
-# define ASN1_R_UNABLE_TO_DECODE_RSA_PRIVATE_KEY 158
-# define ASN1_R_UNEXPECTED_EOC 159
-# define ASN1_R_UNIVERSALSTRING_IS_WRONG_LENGTH 215
-# define ASN1_R_UNKNOWN_FORMAT 160
-# define ASN1_R_UNKNOWN_MESSAGE_DIGEST_ALGORITHM 161
-# define ASN1_R_UNKNOWN_OBJECT_TYPE 162
-# define ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE 163
-# define ASN1_R_UNKNOWN_SIGNATURE_ALGORITHM 199
-# define ASN1_R_UNKNOWN_TAG 194
-# define ASN1_R_UNKOWN_FORMAT 195
-# define ASN1_R_UNSUPPORTED_ANY_DEFINED_BY_TYPE 164
-# define ASN1_R_UNSUPPORTED_CIPHER 165
-# define ASN1_R_UNSUPPORTED_ENCRYPTION_ALGORITHM 166
-# define ASN1_R_UNSUPPORTED_PUBLIC_KEY_TYPE 167
-# define ASN1_R_UNSUPPORTED_TYPE 196
-# define ASN1_R_WRONG_PUBLIC_KEY_TYPE 200
-# define ASN1_R_WRONG_TAG 168
-# define ASN1_R_WRONG_TYPE 169
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/components/openssl/asn1_mac.h b/src/components/openssl/asn1_mac.h
deleted file mode 100644
index ab9ec85..0000000
--- a/src/components/openssl/asn1_mac.h
+++ /dev/null
@@ -1,579 +0,0 @@
-/* crypto/asn1/asn1_mac.h */
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- *
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to. The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code. The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- *
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * "This product includes cryptographic software written by
- * Eric Young (eay@cryptsoft.com)"
- * The word 'cryptographic' can be left out if the rouines from the library
- * being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from
- * the apps directory (application code) you must include an acknowledgement:
- * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- *
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed. i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-#ifndef HEADER_ASN1_MAC_H
-# define HEADER_ASN1_MAC_H
-
-# include