1c43e99fdSEd Maste /* 2c43e99fdSEd Maste * Copyright (c) 2000-2007 Niels Provos <provos@citi.umich.edu> 3c43e99fdSEd Maste * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson 4c43e99fdSEd Maste * 5c43e99fdSEd Maste * Redistribution and use in source and binary forms, with or without 6c43e99fdSEd Maste * modification, are permitted provided that the following conditions 7c43e99fdSEd Maste * are met: 8c43e99fdSEd Maste * 1. Redistributions of source code must retain the above copyright 9c43e99fdSEd Maste * notice, this list of conditions and the following disclaimer. 10c43e99fdSEd Maste * 2. Redistributions in binary form must reproduce the above copyright 11c43e99fdSEd Maste * notice, this list of conditions and the following disclaimer in the 12c43e99fdSEd Maste * documentation and/or other materials provided with the distribution. 13c43e99fdSEd Maste * 3. The name of the author may not be used to endorse or promote products 14c43e99fdSEd Maste * derived from this software without specific prior written permission. 15c43e99fdSEd Maste * 16c43e99fdSEd Maste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 17c43e99fdSEd Maste * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 18c43e99fdSEd Maste * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 19c43e99fdSEd Maste * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 20c43e99fdSEd Maste * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 21c43e99fdSEd Maste * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22c43e99fdSEd Maste * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23c43e99fdSEd Maste * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24c43e99fdSEd Maste * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 25c43e99fdSEd Maste * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26c43e99fdSEd Maste */ 27c43e99fdSEd Maste #ifndef EVBUFFER_INTERNAL_H_INCLUDED_ 28c43e99fdSEd Maste #define EVBUFFER_INTERNAL_H_INCLUDED_ 29c43e99fdSEd Maste 30c43e99fdSEd Maste #ifdef __cplusplus 31c43e99fdSEd Maste extern "C" { 32c43e99fdSEd Maste #endif 33c43e99fdSEd Maste 34c43e99fdSEd Maste #include "event2/event-config.h" 35c43e99fdSEd Maste #include "evconfig-private.h" 36c43e99fdSEd Maste #include "event2/util.h" 37c43e99fdSEd Maste #include "event2/event_struct.h" 38c43e99fdSEd Maste #include "util-internal.h" 39c43e99fdSEd Maste #include "defer-internal.h" 40c43e99fdSEd Maste 41c43e99fdSEd Maste /* Experimental cb flag: "never deferred." Implementation note: 42c43e99fdSEd Maste * these callbacks may get an inaccurate view of n_del/n_added in their 43c43e99fdSEd Maste * arguments. */ 44c43e99fdSEd Maste #define EVBUFFER_CB_NODEFER 2 45c43e99fdSEd Maste 46c43e99fdSEd Maste #ifdef _WIN32 47c43e99fdSEd Maste #include <winsock2.h> 48c43e99fdSEd Maste #endif 49c43e99fdSEd Maste #include <sys/queue.h> 50c43e99fdSEd Maste 51c43e99fdSEd Maste /* Minimum allocation for a chain. We define this so that we're burning no 52c43e99fdSEd Maste * more than 5% of each allocation on overhead. It would be nice to lose even 53c43e99fdSEd Maste * less space, though. */ 54c43e99fdSEd Maste #if EVENT__SIZEOF_VOID_P < 8 55c43e99fdSEd Maste #define MIN_BUFFER_SIZE 512 56c43e99fdSEd Maste #else 57c43e99fdSEd Maste #define MIN_BUFFER_SIZE 1024 58c43e99fdSEd Maste #endif 59c43e99fdSEd Maste 60c43e99fdSEd Maste /** A single evbuffer callback for an evbuffer. This function will be invoked 61c43e99fdSEd Maste * when bytes are added to or removed from the evbuffer. */ 62c43e99fdSEd Maste struct evbuffer_cb_entry { 63c43e99fdSEd Maste /** Structures to implement a doubly-linked queue of callbacks */ 64c43e99fdSEd Maste LIST_ENTRY(evbuffer_cb_entry) next; 65c43e99fdSEd Maste /** The callback function to invoke when this callback is called. 66c43e99fdSEd Maste If EVBUFFER_CB_OBSOLETE is set in flags, the cb_obsolete field is 67c43e99fdSEd Maste valid; otherwise, cb_func is valid. */ 68c43e99fdSEd Maste union { 69c43e99fdSEd Maste evbuffer_cb_func cb_func; 70c43e99fdSEd Maste evbuffer_cb cb_obsolete; 71c43e99fdSEd Maste } cb; 72c43e99fdSEd Maste /** Argument to pass to cb. */ 73c43e99fdSEd Maste void *cbarg; 74c43e99fdSEd Maste /** Currently set flags on this callback. */ 75c43e99fdSEd Maste ev_uint32_t flags; 76c43e99fdSEd Maste }; 77c43e99fdSEd Maste 78c43e99fdSEd Maste struct bufferevent; 79c43e99fdSEd Maste struct evbuffer_chain; 80c43e99fdSEd Maste struct evbuffer { 81c43e99fdSEd Maste /** The first chain in this buffer's linked list of chains. */ 82c43e99fdSEd Maste struct evbuffer_chain *first; 83c43e99fdSEd Maste /** The last chain in this buffer's linked list of chains. */ 84c43e99fdSEd Maste struct evbuffer_chain *last; 85c43e99fdSEd Maste 86c43e99fdSEd Maste /** Pointer to the next pointer pointing at the 'last_with_data' chain. 87c43e99fdSEd Maste * 88c43e99fdSEd Maste * To unpack: 89c43e99fdSEd Maste * 90c43e99fdSEd Maste * The last_with_data chain is the last chain that has any data in it. 91c43e99fdSEd Maste * If all chains in the buffer are empty, it is the first chain. 92c43e99fdSEd Maste * If the buffer has no chains, it is NULL. 93c43e99fdSEd Maste * 94c43e99fdSEd Maste * The last_with_datap pointer points at _whatever 'next' pointer_ 95*b50261e2SCy Schubert * pointing at the last_with_data chain. If the last_with_data chain 96c43e99fdSEd Maste * is the first chain, or it is NULL, then the last_with_datap pointer 97c43e99fdSEd Maste * is &buf->first. 98c43e99fdSEd Maste */ 99c43e99fdSEd Maste struct evbuffer_chain **last_with_datap; 100c43e99fdSEd Maste 101c43e99fdSEd Maste /** Total amount of bytes stored in all chains.*/ 102c43e99fdSEd Maste size_t total_len; 103c43e99fdSEd Maste 104c43e99fdSEd Maste /** Number of bytes we have added to the buffer since we last tried to 105c43e99fdSEd Maste * invoke callbacks. */ 106c43e99fdSEd Maste size_t n_add_for_cb; 107c43e99fdSEd Maste /** Number of bytes we have removed from the buffer since we last 108c43e99fdSEd Maste * tried to invoke callbacks. */ 109c43e99fdSEd Maste size_t n_del_for_cb; 110c43e99fdSEd Maste 111c43e99fdSEd Maste #ifndef EVENT__DISABLE_THREAD_SUPPORT 112c43e99fdSEd Maste /** A lock used to mediate access to this buffer. */ 113c43e99fdSEd Maste void *lock; 114c43e99fdSEd Maste #endif 115c43e99fdSEd Maste /** True iff we should free the lock field when we free this 116c43e99fdSEd Maste * evbuffer. */ 117c43e99fdSEd Maste unsigned own_lock : 1; 118c43e99fdSEd Maste /** True iff we should not allow changes to the front of the buffer 119c43e99fdSEd Maste * (drains or prepends). */ 120c43e99fdSEd Maste unsigned freeze_start : 1; 121c43e99fdSEd Maste /** True iff we should not allow changes to the end of the buffer 122c43e99fdSEd Maste * (appends) */ 123c43e99fdSEd Maste unsigned freeze_end : 1; 124c43e99fdSEd Maste /** True iff this evbuffer's callbacks are not invoked immediately 125c43e99fdSEd Maste * upon a change in the buffer, but instead are deferred to be invoked 126c43e99fdSEd Maste * from the event_base's loop. Useful for preventing enormous stack 127c43e99fdSEd Maste * overflows when we have mutually recursive callbacks, and for 128c43e99fdSEd Maste * serializing callbacks in a single thread. */ 129c43e99fdSEd Maste unsigned deferred_cbs : 1; 130c43e99fdSEd Maste #ifdef _WIN32 131c43e99fdSEd Maste /** True iff this buffer is set up for overlapped IO. */ 132c43e99fdSEd Maste unsigned is_overlapped : 1; 133c43e99fdSEd Maste #endif 134c43e99fdSEd Maste /** Zero or more EVBUFFER_FLAG_* bits */ 135c43e99fdSEd Maste ev_uint32_t flags; 136c43e99fdSEd Maste 137c43e99fdSEd Maste /** Used to implement deferred callbacks. */ 138c43e99fdSEd Maste struct event_base *cb_queue; 139c43e99fdSEd Maste 140c43e99fdSEd Maste /** A reference count on this evbuffer. When the reference count 141c43e99fdSEd Maste * reaches 0, the buffer is destroyed. Manipulated with 142c43e99fdSEd Maste * evbuffer_incref and evbuffer_decref_and_unlock and 143c43e99fdSEd Maste * evbuffer_free. */ 144c43e99fdSEd Maste int refcnt; 145c43e99fdSEd Maste 146c43e99fdSEd Maste /** A struct event_callback handle to make all of this buffer's callbacks 147c43e99fdSEd Maste * invoked from the event loop. */ 148c43e99fdSEd Maste struct event_callback deferred; 149c43e99fdSEd Maste 150c43e99fdSEd Maste /** A doubly-linked-list of callback functions */ 151c43e99fdSEd Maste LIST_HEAD(evbuffer_cb_queue, evbuffer_cb_entry) callbacks; 152c43e99fdSEd Maste 153c43e99fdSEd Maste /** The parent bufferevent object this evbuffer belongs to. 154c43e99fdSEd Maste * NULL if the evbuffer stands alone. */ 155c43e99fdSEd Maste struct bufferevent *parent; 156c43e99fdSEd Maste }; 157c43e99fdSEd Maste 158c43e99fdSEd Maste #if EVENT__SIZEOF_OFF_T < EVENT__SIZEOF_SIZE_T 159c43e99fdSEd Maste typedef ev_ssize_t ev_misalign_t; 160c43e99fdSEd Maste #define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX) 161c43e99fdSEd Maste #else 162c43e99fdSEd Maste typedef ev_off_t ev_misalign_t; 163c43e99fdSEd Maste #if EVENT__SIZEOF_OFF_T > EVENT__SIZEOF_SIZE_T 164c43e99fdSEd Maste #define EVBUFFER_CHAIN_MAX EV_SIZE_MAX 165c43e99fdSEd Maste #else 166c43e99fdSEd Maste #define EVBUFFER_CHAIN_MAX ((size_t)EV_SSIZE_MAX) 167c43e99fdSEd Maste #endif 168c43e99fdSEd Maste #endif 169c43e99fdSEd Maste 170c43e99fdSEd Maste /** A single item in an evbuffer. */ 171c43e99fdSEd Maste struct evbuffer_chain { 172c43e99fdSEd Maste /** points to next buffer in the chain */ 173c43e99fdSEd Maste struct evbuffer_chain *next; 174c43e99fdSEd Maste 175c43e99fdSEd Maste /** total allocation available in the buffer field. */ 176c43e99fdSEd Maste size_t buffer_len; 177c43e99fdSEd Maste 178c43e99fdSEd Maste /** unused space at the beginning of buffer or an offset into a 179c43e99fdSEd Maste * file for sendfile buffers. */ 180c43e99fdSEd Maste ev_misalign_t misalign; 181c43e99fdSEd Maste 182c43e99fdSEd Maste /** Offset into buffer + misalign at which to start writing. 183c43e99fdSEd Maste * In other words, the total number of bytes actually stored 184c43e99fdSEd Maste * in buffer. */ 185c43e99fdSEd Maste size_t off; 186c43e99fdSEd Maste 187c43e99fdSEd Maste /** Set if special handling is required for this chain */ 188c43e99fdSEd Maste unsigned flags; 189c43e99fdSEd Maste #define EVBUFFER_FILESEGMENT 0x0001 /**< A chain used for a file segment */ 190c43e99fdSEd Maste #define EVBUFFER_SENDFILE 0x0002 /**< a chain used with sendfile */ 191c43e99fdSEd Maste #define EVBUFFER_REFERENCE 0x0004 /**< a chain with a mem reference */ 192c43e99fdSEd Maste #define EVBUFFER_IMMUTABLE 0x0008 /**< read-only chain */ 193c43e99fdSEd Maste /** a chain that mustn't be reallocated or freed, or have its contents 194c43e99fdSEd Maste * memmoved, until the chain is un-pinned. */ 195c43e99fdSEd Maste #define EVBUFFER_MEM_PINNED_R 0x0010 196c43e99fdSEd Maste #define EVBUFFER_MEM_PINNED_W 0x0020 197c43e99fdSEd Maste #define EVBUFFER_MEM_PINNED_ANY (EVBUFFER_MEM_PINNED_R|EVBUFFER_MEM_PINNED_W) 198c43e99fdSEd Maste /** a chain that should be freed, but can't be freed until it is 199c43e99fdSEd Maste * un-pinned. */ 200c43e99fdSEd Maste #define EVBUFFER_DANGLING 0x0040 201c43e99fdSEd Maste /** a chain that is a referenced copy of another chain */ 202c43e99fdSEd Maste #define EVBUFFER_MULTICAST 0x0080 203c43e99fdSEd Maste 204c43e99fdSEd Maste /** number of references to this chain */ 205c43e99fdSEd Maste int refcnt; 206c43e99fdSEd Maste 207c43e99fdSEd Maste /** Usually points to the read-write memory belonging to this 208c43e99fdSEd Maste * buffer allocated as part of the evbuffer_chain allocation. 209c43e99fdSEd Maste * For mmap, this can be a read-only buffer and 210c43e99fdSEd Maste * EVBUFFER_IMMUTABLE will be set in flags. For sendfile, it 211c43e99fdSEd Maste * may point to NULL. 212c43e99fdSEd Maste */ 213c43e99fdSEd Maste unsigned char *buffer; 214c43e99fdSEd Maste }; 215c43e99fdSEd Maste 216c43e99fdSEd Maste /** callback for a reference chain; lets us know what to do with it when 217c43e99fdSEd Maste * we're done with it. Lives at the end of an evbuffer_chain with the 218c43e99fdSEd Maste * EVBUFFER_REFERENCE flag set */ 219c43e99fdSEd Maste struct evbuffer_chain_reference { 220c43e99fdSEd Maste evbuffer_ref_cleanup_cb cleanupfn; 221c43e99fdSEd Maste void *extra; 222c43e99fdSEd Maste }; 223c43e99fdSEd Maste 224c43e99fdSEd Maste /** File segment for a file-segment chain. Lives at the end of an 225c43e99fdSEd Maste * evbuffer_chain with the EVBUFFER_FILESEGMENT flag set. */ 226c43e99fdSEd Maste struct evbuffer_chain_file_segment { 227c43e99fdSEd Maste struct evbuffer_file_segment *segment; 228c43e99fdSEd Maste #ifdef _WIN32 229c43e99fdSEd Maste /** If we're using CreateFileMapping, this is the handle to the view. */ 230c43e99fdSEd Maste HANDLE view_handle; 231c43e99fdSEd Maste #endif 232c43e99fdSEd Maste }; 233c43e99fdSEd Maste 234c43e99fdSEd Maste /* Declared in event2/buffer.h; defined here. */ 235c43e99fdSEd Maste struct evbuffer_file_segment { 236c43e99fdSEd Maste void *lock; /**< lock prevent concurrent access to refcnt */ 237c43e99fdSEd Maste int refcnt; /**< Reference count for this file segment */ 238c43e99fdSEd Maste unsigned flags; /**< combination of EVBUF_FS_* flags */ 239c43e99fdSEd Maste 240c43e99fdSEd Maste /** What kind of file segment is this? */ 241c43e99fdSEd Maste unsigned can_sendfile : 1; 242c43e99fdSEd Maste unsigned is_mapping : 1; 243c43e99fdSEd Maste 244c43e99fdSEd Maste /** The fd that we read the data from. */ 245c43e99fdSEd Maste int fd; 246c43e99fdSEd Maste /** If we're using mmap, this is the raw mapped memory. */ 247c43e99fdSEd Maste void *mapping; 248c43e99fdSEd Maste #ifdef _WIN32 249c43e99fdSEd Maste /** If we're using CreateFileMapping, this is the mapping */ 250c43e99fdSEd Maste HANDLE mapping_handle; 251c43e99fdSEd Maste #endif 252c43e99fdSEd Maste /** If we're using mmap or IO, this is the content of the file 253c43e99fdSEd Maste * segment. */ 254c43e99fdSEd Maste char *contents; 255c43e99fdSEd Maste /** Position of this segment within the file. */ 256c43e99fdSEd Maste ev_off_t file_offset; 257c43e99fdSEd Maste /** If we're using mmap, this is the offset within 'mapping' where 258c43e99fdSEd Maste * this data segment begins. */ 259c43e99fdSEd Maste ev_off_t mmap_offset; 260c43e99fdSEd Maste /** The length of this segment. */ 261c43e99fdSEd Maste ev_off_t length; 262c43e99fdSEd Maste /** Cleanup callback function */ 263c43e99fdSEd Maste evbuffer_file_segment_cleanup_cb cleanup_cb; 264c43e99fdSEd Maste /** Argument to be pass to cleanup callback function */ 265c43e99fdSEd Maste void *cleanup_cb_arg; 266c43e99fdSEd Maste }; 267c43e99fdSEd Maste 268c43e99fdSEd Maste /** Information about the multicast parent of a chain. Lives at the 269c43e99fdSEd Maste * end of an evbuffer_chain with the EVBUFFER_MULTICAST flag set. */ 270c43e99fdSEd Maste struct evbuffer_multicast_parent { 271c43e99fdSEd Maste /** source buffer the multicast parent belongs to */ 272c43e99fdSEd Maste struct evbuffer *source; 273c43e99fdSEd Maste /** multicast parent for this chain */ 274c43e99fdSEd Maste struct evbuffer_chain *parent; 275c43e99fdSEd Maste }; 276c43e99fdSEd Maste 277c43e99fdSEd Maste #define EVBUFFER_CHAIN_SIZE sizeof(struct evbuffer_chain) 278c43e99fdSEd Maste /** Return a pointer to extra data allocated along with an evbuffer. */ 279c43e99fdSEd Maste #define EVBUFFER_CHAIN_EXTRA(t, c) (t *)((struct evbuffer_chain *)(c) + 1) 280c43e99fdSEd Maste 281c43e99fdSEd Maste /** Assert that we are holding the lock on an evbuffer */ 282c43e99fdSEd Maste #define ASSERT_EVBUFFER_LOCKED(buffer) \ 283c43e99fdSEd Maste EVLOCK_ASSERT_LOCKED((buffer)->lock) 284c43e99fdSEd Maste 285c43e99fdSEd Maste #define EVBUFFER_LOCK(buffer) \ 286c43e99fdSEd Maste do { \ 287c43e99fdSEd Maste EVLOCK_LOCK((buffer)->lock, 0); \ 288c43e99fdSEd Maste } while (0) 289c43e99fdSEd Maste #define EVBUFFER_UNLOCK(buffer) \ 290c43e99fdSEd Maste do { \ 291c43e99fdSEd Maste EVLOCK_UNLOCK((buffer)->lock, 0); \ 292c43e99fdSEd Maste } while (0) 293c43e99fdSEd Maste #define EVBUFFER_LOCK2(buffer1, buffer2) \ 294c43e99fdSEd Maste do { \ 295c43e99fdSEd Maste EVLOCK_LOCK2((buffer1)->lock, (buffer2)->lock, 0, 0); \ 296c43e99fdSEd Maste } while (0) 297c43e99fdSEd Maste #define EVBUFFER_UNLOCK2(buffer1, buffer2) \ 298c43e99fdSEd Maste do { \ 299c43e99fdSEd Maste EVLOCK_UNLOCK2((buffer1)->lock, (buffer2)->lock, 0, 0); \ 300c43e99fdSEd Maste } while (0) 301c43e99fdSEd Maste 302c43e99fdSEd Maste /** Increase the reference count of buf by one. */ 303c43e99fdSEd Maste void evbuffer_incref_(struct evbuffer *buf); 304c43e99fdSEd Maste /** Increase the reference count of buf by one and acquire the lock. */ 305c43e99fdSEd Maste void evbuffer_incref_and_lock_(struct evbuffer *buf); 306c43e99fdSEd Maste /** Pin a single buffer chain using a given flag. A pinned chunk may not be 307c43e99fdSEd Maste * moved or freed until it is unpinned. */ 308c43e99fdSEd Maste void evbuffer_chain_pin_(struct evbuffer_chain *chain, unsigned flag); 309c43e99fdSEd Maste /** Unpin a single buffer chain using a given flag. */ 310c43e99fdSEd Maste void evbuffer_chain_unpin_(struct evbuffer_chain *chain, unsigned flag); 311c43e99fdSEd Maste /** As evbuffer_free, but requires that we hold a lock on the buffer, and 312c43e99fdSEd Maste * releases the lock before freeing it and the buffer. */ 313c43e99fdSEd Maste void evbuffer_decref_and_unlock_(struct evbuffer *buffer); 314c43e99fdSEd Maste 315c43e99fdSEd Maste /** As evbuffer_expand, but does not guarantee that the newly allocated memory 316c43e99fdSEd Maste * is contiguous. Instead, it may be split across two or more chunks. */ 317c43e99fdSEd Maste int evbuffer_expand_fast_(struct evbuffer *, size_t, int); 318c43e99fdSEd Maste 319c43e99fdSEd Maste /** Helper: prepares for a readv/WSARecv call by expanding the buffer to 320c43e99fdSEd Maste * hold enough memory to read 'howmuch' bytes in possibly noncontiguous memory. 321c43e99fdSEd Maste * Sets up the one or two iovecs in 'vecs' to point to the free memory and its 322c43e99fdSEd Maste * extent, and *chainp to point to the first chain that we'll try to read into. 323c43e99fdSEd Maste * Returns the number of vecs used. 324c43e99fdSEd Maste */ 325c43e99fdSEd Maste int evbuffer_read_setup_vecs_(struct evbuffer *buf, ev_ssize_t howmuch, 326c43e99fdSEd Maste struct evbuffer_iovec *vecs, int n_vecs, struct evbuffer_chain ***chainp, 327c43e99fdSEd Maste int exact); 328c43e99fdSEd Maste 329c43e99fdSEd Maste /* Helper macro: copies an evbuffer_iovec in ei to a win32 WSABUF in i. */ 330c43e99fdSEd Maste #define WSABUF_FROM_EVBUFFER_IOV(i,ei) do { \ 331c43e99fdSEd Maste (i)->buf = (ei)->iov_base; \ 332c43e99fdSEd Maste (i)->len = (unsigned long)(ei)->iov_len; \ 333c43e99fdSEd Maste } while (0) 334c43e99fdSEd Maste /* XXXX the cast above is safe for now, but not if we allow mmaps on win64. 335c43e99fdSEd Maste * See note in buffer_iocp's launch_write function */ 336c43e99fdSEd Maste 337c43e99fdSEd Maste /** Set the parent bufferevent object for buf to bev */ 338c43e99fdSEd Maste void evbuffer_set_parent_(struct evbuffer *buf, struct bufferevent *bev); 339c43e99fdSEd Maste 340c43e99fdSEd Maste void evbuffer_invoke_callbacks_(struct evbuffer *buf); 341c43e99fdSEd Maste 342c43e99fdSEd Maste 343c43e99fdSEd Maste int evbuffer_get_callbacks_(struct evbuffer *buffer, 344c43e99fdSEd Maste struct event_callback **cbs, 345c43e99fdSEd Maste int max_cbs); 346c43e99fdSEd Maste 347c43e99fdSEd Maste #ifdef __cplusplus 348c43e99fdSEd Maste } 349c43e99fdSEd Maste #endif 350c43e99fdSEd Maste 351c43e99fdSEd Maste #endif /* EVBUFFER_INTERNAL_H_INCLUDED_ */ 352