libevent 2.1.13 Event notification library

Loading...
Searching...
No Matches
buffer.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. The name of the author may not be used to endorse or promote products
13 * derived from this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26#ifndef EVENT2_BUFFER_H_INCLUDED_
27#define EVENT2_BUFFER_H_INCLUDED_
28
74
75#include <event2/visibility.h>
76
77#ifdef __cplusplus
78 extern "C" {
79#endif
80
81#include <event2/event-config.h>
82#include <stdarg.h>
83#ifdef EVENT__HAVE_SYS_TYPES_H
84#include <sys/types.h>
85#endif
86#ifdef EVENT__HAVE_SYS_UIO_H
87#include <sys/uio.h>
88#endif
89#include <event2/util.h>
90
97 struct evbuffer
98#ifdef EVENT_IN_DOXYGEN_
99{}
100#endif
101;
102
116 struct evbuffer_ptr {
117 ev_ssize_t pos;
118
119 /* Do not alter or rely on the values of fields: they are for internal
120 * use */
121 struct {
122 void *chain;
123 size_t pos_in_chain;
124 } internal_;
125};
126
132#ifdef EVENT__HAVE_SYS_UIO_H
133#define evbuffer_iovec iovec
134/* Internal use -- defined only if we are using the native struct iovec */
135#define EVBUFFER_IOVEC_IS_NATIVE_
136#else
137 struct evbuffer_iovec {
139 void *iov_base;
141 size_t iov_len;
142};
143#endif
144
151EVENT2_EXPORT_SYMBOL
152 struct evbuffer *evbuffer_new(void);
158EVENT2_EXPORT_SYMBOL
159 void evbuffer_free(struct evbuffer *buf);
160
173EVENT2_EXPORT_SYMBOL
174 int evbuffer_enable_locking(struct evbuffer *buf, void *lock);
175
180EVENT2_EXPORT_SYMBOL
181 void evbuffer_lock(struct evbuffer *buf);
182
187EVENT2_EXPORT_SYMBOL
188 void evbuffer_unlock(struct evbuffer *buf);
189
190
206#define EVBUFFER_FLAG_DRAINS_TO_FD 1
207
215EVENT2_EXPORT_SYMBOL
216 int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
224EVENT2_EXPORT_SYMBOL
225 int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
226
233EVENT2_EXPORT_SYMBOL
234 size_t evbuffer_get_length(const struct evbuffer *buf);
235
248EVENT2_EXPORT_SYMBOL
249 size_t evbuffer_get_contiguous_space(const struct evbuffer *buf);
250
261EVENT2_EXPORT_SYMBOL
262 int evbuffer_expand(struct evbuffer *buf, size_t datlen);
263
297EVENT2_EXPORT_SYMBOL
298 int
299 evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
300 struct evbuffer_iovec *vec, int n_vec);
301
323EVENT2_EXPORT_SYMBOL
324 int evbuffer_commit_space(struct evbuffer *buf,
325 struct evbuffer_iovec *vec, int n_vecs);
326
335EVENT2_EXPORT_SYMBOL
336 int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen);
337
338
350EVENT2_EXPORT_SYMBOL
351 int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen);
352
364EVENT2_EXPORT_SYMBOL
365ev_ssize_t evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen);
366
379EVENT2_EXPORT_SYMBOL
380ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos, void *data_out, size_t datlen);
381
395EVENT2_EXPORT_SYMBOL
396 int evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
397 size_t datlen);
398
401 enum evbuffer_eol_style {
411 EVBUFFER_EOL_ANY,
414 EVBUFFER_EOL_CRLF,
416 EVBUFFER_EOL_CRLF_STRICT,
418 EVBUFFER_EOL_LF,
420 EVBUFFER_EOL_NUL
421};
422
437EVENT2_EXPORT_SYMBOL
438 char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
439 enum evbuffer_eol_style eol_style);
440
453EVENT2_EXPORT_SYMBOL
454 int evbuffer_add_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf);
455
469EVENT2_EXPORT_SYMBOL
470 int evbuffer_add_buffer_reference(struct evbuffer *outbuf,
471 struct evbuffer *inbuf);
472
479 typedef void (*evbuffer_ref_cleanup_cb)(const void *data,
480 size_t datalen, void *extra);
481
497EVENT2_EXPORT_SYMBOL
498 int evbuffer_add_reference(struct evbuffer *outbuf,
499 const void *data, size_t datlen,
500 evbuffer_ref_cleanup_cb cleanupfn, void *cleanupfn_arg);
501
525
526EVENT2_EXPORT_SYMBOL
527 int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset,
528 ev_off_t length);
529
538 struct evbuffer_file_segment;
539
545#define EVBUF_FS_CLOSE_ON_FREE 0x01
550#define EVBUF_FS_DISABLE_MMAP 0x02
560#define EVBUF_FS_DISABLE_SENDFILE 0x04
567#define EVBUF_FS_DISABLE_LOCKING 0x08
568
573 typedef void (*evbuffer_file_segment_cleanup_cb)(
574 struct evbuffer_file_segment const* seg, int flags, void* arg);
575
598EVENT2_EXPORT_SYMBOL
599 struct evbuffer_file_segment *evbuffer_file_segment_new(
600 int fd, ev_off_t offset, ev_off_t length, unsigned flags);
601
609EVENT2_EXPORT_SYMBOL
610 void evbuffer_file_segment_free(struct evbuffer_file_segment *seg);
611
619EVENT2_EXPORT_SYMBOL
620 void evbuffer_file_segment_add_cleanup_cb(struct evbuffer_file_segment *seg,
621 evbuffer_file_segment_cleanup_cb cb, void* arg);
622
645EVENT2_EXPORT_SYMBOL
646 int evbuffer_add_file_segment(struct evbuffer *buf,
647 struct evbuffer_file_segment *seg, ev_off_t offset, ev_off_t length);
648
661EVENT2_EXPORT_SYMBOL
662 int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
663#ifdef __GNUC__
664 __attribute__((format(printf, 2, 3)))
665#endif
666;
667
676EVENT2_EXPORT_SYMBOL
677 int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
678#ifdef __GNUC__
679 __attribute__((format(printf, 2, 0)))
680#endif
681;
682
683
691EVENT2_EXPORT_SYMBOL
692 int evbuffer_drain(struct evbuffer *buf, size_t len);
693
694
705EVENT2_EXPORT_SYMBOL
706 int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd);
707
720EVENT2_EXPORT_SYMBOL
721 int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
722 ev_ssize_t howmuch);
723
734EVENT2_EXPORT_SYMBOL
735 int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
736
748EVENT2_EXPORT_SYMBOL
749 struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start);
750
765EVENT2_EXPORT_SYMBOL
766 struct evbuffer_ptr evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start, const struct evbuffer_ptr *end);
767
772 enum evbuffer_ptr_how {
775 EVBUFFER_PTR_SET,
777 EVBUFFER_PTR_ADD
778};
779
801EVENT2_EXPORT_SYMBOL
802 int
803 evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr,
804 size_t position, enum evbuffer_ptr_how how);
805
820EVENT2_EXPORT_SYMBOL
821 struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer,
822 struct evbuffer_ptr *start, size_t *eol_len_out,
823 enum evbuffer_eol_style eol_style);
824
853EVENT2_EXPORT_SYMBOL
854 int evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
855 struct evbuffer_ptr *start_at,
856 struct evbuffer_iovec *vec_out, int n_vec);
857
858
863 struct evbuffer_cb_info {
866 size_t orig_size;
868 size_t n_added;
870 size_t n_deleted;
871};
872
892 typedef void (*evbuffer_cb_func)(struct evbuffer *buffer, const struct evbuffer_cb_info *info, void *arg);
893
894 struct evbuffer_cb_entry;
906EVENT2_EXPORT_SYMBOL
907 struct evbuffer_cb_entry *evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
908
917EVENT2_EXPORT_SYMBOL
918 int evbuffer_remove_cb_entry(struct evbuffer *buffer,
919 struct evbuffer_cb_entry *ent);
920
927EVENT2_EXPORT_SYMBOL
928 int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
929
935#define EVBUFFER_CB_ENABLED 1
936
944EVENT2_EXPORT_SYMBOL
945 int evbuffer_cb_set_flags(struct evbuffer *buffer,
946 struct evbuffer_cb_entry *cb, ev_uint32_t flags);
947
955EVENT2_EXPORT_SYMBOL
956 int evbuffer_cb_clear_flags(struct evbuffer *buffer,
957 struct evbuffer_cb_entry *cb, ev_uint32_t flags);
958
959#if 0
969EVENT2_EXPORT_SYMBOL
970 void evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
979EVENT2_EXPORT_SYMBOL
980 void evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
981#endif
982
992
993EVENT2_EXPORT_SYMBOL
994 unsigned char *evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size);
995
1004
1005EVENT2_EXPORT_SYMBOL
1006 int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size);
1007
1016EVENT2_EXPORT_SYMBOL
1017 int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
1018
1033EVENT2_EXPORT_SYMBOL
1034 int evbuffer_freeze(struct evbuffer *buf, int at_front);
1043EVENT2_EXPORT_SYMBOL
1044 int evbuffer_unfreeze(struct evbuffer *buf, int at_front);
1045
1046 struct event_base;
1054EVENT2_EXPORT_SYMBOL
1055 int evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base);
1056
1070EVENT2_EXPORT_SYMBOL
1071 size_t evbuffer_add_iovec(struct evbuffer * buffer, struct evbuffer_iovec * vec, int n_vec);
1072
1073#ifdef __cplusplus
1074}
1075#endif
1076
1077#endif /* EVENT2_BUFFER_H_INCLUDED_ */
evbuffer_search
EVENT2_EXPORT_SYMBOL struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start)
Search for a string within an evbuffer.
evbuffer_drain
EVENT2_EXPORT_SYMBOL int evbuffer_drain(struct evbuffer *buf, size_t len)
Remove a specified number of bytes data from the beginning of an evbuffer.
evbuffer_new
EVENT2_EXPORT_SYMBOL struct evbuffer * evbuffer_new(void)
Allocate storage for a new evbuffer.
evbuffer_file_segment_free
EVENT2_EXPORT_SYMBOL void evbuffer_file_segment_free(struct evbuffer_file_segment *seg)
Free an evbuffer_file_segment.
evbuffer_prepend
EVENT2_EXPORT_SYMBOL int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size)
Prepends data to the beginning of the evbuffer.
evbuffer_ptr_how
evbuffer_ptr_how
Defines how to adjust an evbuffer_ptr by evbuffer_ptr_set().
Definition buffer.h:772
EVBUFFER_PTR_ADD
@ EVBUFFER_PTR_ADD
Advances the pointer by adding to the current position.
Definition buffer.h:777
EVBUFFER_PTR_SET
@ EVBUFFER_PTR_SET
Sets the pointer to the position; can be called on with an uninitialized evbuffer_ptr.
Definition buffer.h:775
evbuffer_reserve_space
EVENT2_EXPORT_SYMBOL int evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size, struct evbuffer_iovec *vec, int n_vec)
Reserves space in the last chain or chains of an evbuffer.
evbuffer_prepend_buffer
EVENT2_EXPORT_SYMBOL int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer *src)
Prepends all data from the src evbuffer to the beginning of the dst evbuffer.
evbuffer_ptr_set
EVENT2_EXPORT_SYMBOL int evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr, size_t position, enum evbuffer_ptr_how how)
Sets the search pointer in the buffer to position.
evbuffer_clear_flags
EVENT2_EXPORT_SYMBOL int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags)
Change the flags that are set for an evbuffer by removing some.
evbuffer_unlock
EVENT2_EXPORT_SYMBOL void evbuffer_unlock(struct evbuffer *buf)
Release the lock on an evbuffer.
evbuffer_read
EVENT2_EXPORT_SYMBOL int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch)
Read from a file descriptor and store the result in an evbuffer.
evbuffer_search_eol
EVENT2_EXPORT_SYMBOL struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer, struct evbuffer_ptr *start, size_t *eol_len_out, enum evbuffer_eol_style eol_style)
Search for an end-of-line string within an evbuffer.
evbuffer_freeze
EVENT2_EXPORT_SYMBOL int evbuffer_freeze(struct evbuffer *buf, int at_front)
Prevent calls that modify an evbuffer from succeeding.
evbuffer_add_file_segment
EVENT2_EXPORT_SYMBOL int evbuffer_add_file_segment(struct evbuffer *buf, struct evbuffer_file_segment *seg, ev_off_t offset, ev_off_t length)
Insert some or all of an evbuffer_file_segment at the end of an evbuffer.
evbuffer_add_reference
EVENT2_EXPORT_SYMBOL int evbuffer_add_reference(struct evbuffer *outbuf, const void *data, size_t datlen, evbuffer_ref_cleanup_cb cleanupfn, void *cleanupfn_arg)
Reference memory into an evbuffer without copying.
evbuffer_search_range
EVENT2_EXPORT_SYMBOL struct evbuffer_ptr evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start, const struct evbuffer_ptr *end)
Search for a string within part of an evbuffer.
evbuffer_copyout_from
EVENT2_EXPORT_SYMBOL ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos, void *data_out, size_t datlen)
Read data from the middle of an evbuffer, and leave the buffer unchanged.
evbuffer_get_contiguous_space
EVENT2_EXPORT_SYMBOL size_t evbuffer_get_contiguous_space(const struct evbuffer *buf)
Returns the number of contiguous available bytes in the first buffer chain.
evbuffer_readln
EVENT2_EXPORT_SYMBOL char * evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out, enum evbuffer_eol_style eol_style)
Read a single line from an evbuffer.
evbuffer_add_file
EVENT2_EXPORT_SYMBOL int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset, ev_off_t length)
Copy data from a file into the evbuffer for writing to a socket.
evbuffer_add_buffer_reference
EVENT2_EXPORT_SYMBOL int evbuffer_add_buffer_reference(struct evbuffer *outbuf, struct evbuffer *inbuf)
Copy data from one evbuffer into another evbuffer.
evbuffer_ref_cleanup_cb
void(* evbuffer_ref_cleanup_cb)(const void *data, size_t datalen, void *extra)
A cleanup function for a piece of memory added to an evbuffer by reference.
Definition buffer.h:479
evbuffer_pullup
EVENT2_EXPORT_SYMBOL unsigned char * evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size)
Makes the data at the beginning of an evbuffer contiguous.
evbuffer_write_atmost
EVENT2_EXPORT_SYMBOL int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd, ev_ssize_t howmuch)
Write some of the contents of an evbuffer to a file descriptor.
evbuffer_add_cb
EVENT2_EXPORT_SYMBOL struct evbuffer_cb_entry * evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg)
Add a new callback to an evbuffer.
evbuffer_write
EVENT2_EXPORT_SYMBOL int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd)
Write the contents of an evbuffer to a file descriptor.
evbuffer_get_length
EVENT2_EXPORT_SYMBOL size_t evbuffer_get_length(const struct evbuffer *buf)
Returns the total number of bytes stored in the evbuffer.
evbuffer_file_segment_new
EVENT2_EXPORT_SYMBOL struct evbuffer_file_segment * evbuffer_file_segment_new(int fd, ev_off_t offset, ev_off_t length, unsigned flags)
Create and return a new evbuffer_file_segment for reading data from a file and sending it out via an ...
evbuffer_remove_buffer
EVENT2_EXPORT_SYMBOL int evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst, size_t datlen)
Read data from an evbuffer into another evbuffer, draining the bytes from the source buffer.
evbuffer_set_flags
EVENT2_EXPORT_SYMBOL int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags)
Change the flags that are set for an evbuffer by adding more.
evbuffer_add
EVENT2_EXPORT_SYMBOL int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen)
Append data to the end of an evbuffer.
evbuffer_expand
EVENT2_EXPORT_SYMBOL int evbuffer_expand(struct evbuffer *buf, size_t datlen)
Expands the available space in an evbuffer.
evbuffer_cb_func
void(* evbuffer_cb_func)(struct evbuffer *buffer, const struct evbuffer_cb_info *info, void *arg)
Type definition for a callback that is invoked whenever data is added or removed from an evbuffer.
Definition buffer.h:892
evbuffer_defer_callbacks
EVENT2_EXPORT_SYMBOL int evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base)
Force all the callbacks on an evbuffer to be run, not immediately after the evbuffer is altered,...
evbuffer_file_segment_cleanup_cb
void(* evbuffer_file_segment_cleanup_cb)(struct evbuffer_file_segment const *seg, int flags, void *arg)
A cleanup function for a evbuffer_file_segment added to an evbuffer for reference.
Definition buffer.h:573
evbuffer_remove
EVENT2_EXPORT_SYMBOL int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen)
Read data from an evbuffer and drain the bytes read.
evbuffer_peek
EVENT2_EXPORT_SYMBOL int evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len, struct evbuffer_ptr *start_at, struct evbuffer_iovec *vec_out, int n_vec)
Function to peek at data inside an evbuffer without removing it or copying it out.
evbuffer_file_segment_add_cleanup_cb
EVENT2_EXPORT_SYMBOL void evbuffer_file_segment_add_cleanup_cb(struct evbuffer_file_segment *seg, evbuffer_file_segment_cleanup_cb cb, void *arg)
Add cleanup callback and argument for the callback to an evbuffer_file_segment.
evbuffer_free
EVENT2_EXPORT_SYMBOL void evbuffer_free(struct evbuffer *buf)
Deallocate storage for an evbuffer.
evbuffer_commit_space
EVENT2_EXPORT_SYMBOL int evbuffer_commit_space(struct evbuffer *buf, struct evbuffer_iovec *vec, int n_vecs)
Commits previously reserved space.
evbuffer_add_vprintf
EVENT2_EXPORT_SYMBOL int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
Append a va_list formatted string to the end of an evbuffer.
evbuffer_remove_cb
EVENT2_EXPORT_SYMBOL int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg)
Remove a callback from an evbuffer, given the function and argument used to add it.
evbuffer_add_printf
EVENT2_EXPORT_SYMBOL int evbuffer_add_printf(struct evbuffer *buf, const char *fmt,...)
Append a formatted string to the end of an evbuffer.
evbuffer_add_iovec
EVENT2_EXPORT_SYMBOL size_t evbuffer_add_iovec(struct evbuffer *buffer, struct evbuffer_iovec *vec, int n_vec)
Append data from 1 or more iovec's to an evbuffer.
evbuffer_eol_style
evbuffer_eol_style
Used to tell evbuffer_readln what kind of line-ending to look for.
Definition buffer.h:401
EVBUFFER_EOL_CRLF
@ EVBUFFER_EOL_CRLF
An EOL is an LF, optionally preceded by a CR.
Definition buffer.h:414
EVBUFFER_EOL_NUL
@ EVBUFFER_EOL_NUL
An EOL is a NUL character (that is, a single byte with value 0).
Definition buffer.h:420
EVBUFFER_EOL_CRLF_STRICT
@ EVBUFFER_EOL_CRLF_STRICT
An EOL is a CR followed by an LF.
Definition buffer.h:416
EVBUFFER_EOL_ANY
@ EVBUFFER_EOL_ANY
Any sequence of CR and LF characters is acceptable as an EOL.
Definition buffer.h:411
EVBUFFER_EOL_LF
@ EVBUFFER_EOL_LF
An EOL is a LF.
Definition buffer.h:418
evbuffer_remove_cb_entry
EVENT2_EXPORT_SYMBOL int evbuffer_remove_cb_entry(struct evbuffer *buffer, struct evbuffer_cb_entry *ent)
Remove a callback from an evbuffer, given a handle returned from evbuffer_add_cb.
evbuffer_cb_clear_flags
EVENT2_EXPORT_SYMBOL int evbuffer_cb_clear_flags(struct evbuffer *buffer, struct evbuffer_cb_entry *cb, ev_uint32_t flags)
Change the flags that are set for a callback on a buffer by removing some.
evbuffer_unfreeze
EVENT2_EXPORT_SYMBOL int evbuffer_unfreeze(struct evbuffer *buf, int at_front)
Re-enable calls that modify an evbuffer.
evbuffer_cb_set_flags
EVENT2_EXPORT_SYMBOL int evbuffer_cb_set_flags(struct evbuffer *buffer, struct evbuffer_cb_entry *cb, ev_uint32_t flags)
Change the flags that are set for a callback on a buffer by adding more.
evbuffer_enable_locking
EVENT2_EXPORT_SYMBOL int evbuffer_enable_locking(struct evbuffer *buf, void *lock)
Enable locking on an evbuffer so that it can safely be used by multiple threads at the same time.
evbuffer_add_buffer
EVENT2_EXPORT_SYMBOL int evbuffer_add_buffer(struct evbuffer *outbuf, struct evbuffer *inbuf)
Move all data from one evbuffer into another evbuffer.
evbuffer_copyout
EVENT2_EXPORT_SYMBOL ev_ssize_t evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen)
Read data from an evbuffer, and leave the buffer unchanged.
evbuffer_lock
EVENT2_EXPORT_SYMBOL void evbuffer_lock(struct evbuffer *buf)
Acquire the lock on an evbuffer.
evbuffer_cb_info
Structure passed to an evbuffer_cb_func evbuffer callback.
Definition buffer.h:863
evbuffer_cb_info::orig_size
size_t orig_size
The number of bytes in this evbuffer when callbacks were last invoked.
Definition buffer.h:866
evbuffer_cb_info::n_deleted
size_t n_deleted
The number of bytes removed since callbacks were last invoked.
Definition buffer.h:870
evbuffer_cb_info::n_added
size_t n_added
The number of bytes added since callbacks were last invoked.
Definition buffer.h:868
evbuffer_iovec
Describes a single extent of memory inside an evbuffer.
Definition buffer.h:137
evbuffer_iovec::iov_len
size_t iov_len
The length of the extent of memory.
Definition buffer.h:141
evbuffer_iovec::iov_base
void * iov_base
The start of the extent of memory.
Definition buffer.h:139
evbuffer_ptr
Pointer to a position within an evbuffer.
Definition buffer.h:116
evbuffer
An evbuffer is an opaque data type for efficiently buffering data to be sent or received on the netwo...
Definition buffer.h:99
event_base
Structure to hold information and state for a Libevent dispatch loop.
Definition event.h:219
util.h
Common convenience functions for cross-platform portability and related socket manipulations.
evutil_socket_t
#define evutil_socket_t
A type wide enough to hold the output of "socket()" or "accept()".
Definition util.h:310