ipc/chromium/src/third_party/libevent/evmap-internal.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/ipc/chromium/src/third_party/libevent/evmap-internal.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,92 @@
     1.4 +/*
     1.5 + * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
     1.6 + *
     1.7 + * Redistribution and use in source and binary forms, with or without
     1.8 + * modification, are permitted provided that the following conditions
     1.9 + * are met:
    1.10 + * 1. Redistributions of source code must retain the above copyright
    1.11 + *    notice, this list of conditions and the following disclaimer.
    1.12 + * 2. Redistributions in binary form must reproduce the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer in the
    1.14 + *    documentation and/or other materials provided with the distribution.
    1.15 + * 3. The name of the author may not be used to endorse or promote products
    1.16 + *    derived from this software without specific prior written permission.
    1.17 + *
    1.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    1.19 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    1.20 + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    1.21 + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    1.22 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    1.23 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.24 + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.25 + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.26 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
    1.27 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.28 + */
    1.29 +#ifndef _EVMAP_H_
    1.30 +#define _EVMAP_H_
    1.31 +
    1.32 +/** @file evmap-internal.h
    1.33 + *
    1.34 + * An event_map is a utility structure to map each fd or signal to zero or
    1.35 + * more events.  Functions to manipulate event_maps should only be used from
    1.36 + * inside libevent.  They generally need to hold the lock on the corresponding
    1.37 + * event_base.
    1.38 + **/
    1.39 +
    1.40 +struct event_base;
    1.41 +struct event;
    1.42 +
    1.43 +/** Initialize an event_map for use.
    1.44 + */
    1.45 +void evmap_io_initmap(struct event_io_map* ctx);
    1.46 +void evmap_signal_initmap(struct event_signal_map* ctx);
    1.47 +
    1.48 +/** Remove all entries from an event_map.
    1.49 +
    1.50 +	@param ctx the map to clear.
    1.51 + */
    1.52 +void evmap_io_clear(struct event_io_map* ctx);
    1.53 +void evmap_signal_clear(struct event_signal_map* ctx);
    1.54 +
    1.55 +/** Add an IO event (some combination of EV_READ or EV_WRITE) to an
    1.56 +    event_base's list of events on a given file descriptor, and tell the
    1.57 +    underlying eventops about the fd if its state has changed.
    1.58 +
    1.59 +    Requires that ev is not already added.
    1.60 +
    1.61 +    @param base the event_base to operate on.
    1.62 +    @param fd the file descriptor corresponding to ev.
    1.63 +    @param ev the event to add.
    1.64 +*/
    1.65 +int evmap_io_add(struct event_base *base, evutil_socket_t fd, struct event *ev);
    1.66 +/** Remove an IO event (some combination of EV_READ or EV_WRITE) to an
    1.67 +    event_base's list of events on a given file descriptor, and tell the
    1.68 +    underlying eventops about the fd if its state has changed.
    1.69 +
    1.70 +    @param base the event_base to operate on.
    1.71 +    @param fd the file descriptor corresponding to ev.
    1.72 +    @param ev the event to remove.
    1.73 + */
    1.74 +int evmap_io_del(struct event_base *base, evutil_socket_t fd, struct event *ev);
    1.75 +/** Active the set of events waiting on an event_base for a given fd.
    1.76 +
    1.77 +    @param base the event_base to operate on.
    1.78 +    @param fd the file descriptor that has become active.
    1.79 +    @param events a bitmask of EV_READ|EV_WRITE|EV_ET.
    1.80 +*/
    1.81 +void evmap_io_active(struct event_base *base, evutil_socket_t fd, short events);
    1.82 +
    1.83 +
    1.84 +/* These functions behave in the same way as evmap_io_*, except they work on
    1.85 + * signals rather than fds.  signals use a linear map everywhere; fds use
    1.86 + * either a linear map or a hashtable. */
    1.87 +int evmap_signal_add(struct event_base *base, int signum, struct event *ev);
    1.88 +int evmap_signal_del(struct event_base *base, int signum, struct event *ev);
    1.89 +void evmap_signal_active(struct event_base *base, evutil_socket_t signum, int ncalls);
    1.90 +
    1.91 +void *evmap_io_get_fdinfo(struct event_io_map *ctx, evutil_socket_t fd);
    1.92 +
    1.93 +void evmap_check_integrity(struct event_base *base);
    1.94 +
    1.95 +#endif /* _EVMAP_H_ */

mercurial