\hypertarget{bufferevent_8h}{\section{opal/mca/event/libevent2013/libevent/include/event2/bufferevent.h File Reference}
\label{bufferevent_8h}\index{opal/mca/event/libevent2013/libevent/include/event2/bufferevent.\+h@{opal/mca/event/libevent2013/libevent/include/event2/bufferevent.\+h}}
}


Functions for buffering data for network sending or receiving.  


{\ttfamily \#include $<$event2/event-\/config.\+h$>$}\\*
{\ttfamily \#include $<$event2/util.\+h$>$}\\*
\subsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{bufferevent_8h_a78fc86349f408552be0fdf249db673ec}{E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X}~E\+V\+\_\+\+S\+S\+I\+Z\+E\+\_\+\+M\+A\+X
\begin{DoxyCompactList}\small\item\em Maximum configurable rate-\/ or burst-\/limit. \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{Indent}{\bf Bufferevent event codes}\par
{\em These flags are passed as arguments to a bufferevent's event callback. }\begin{DoxyCompactItemize}
\item 
\hypertarget{bufferevent_8h_a504816ca8678e4f3d0bee2700fda524d}{\#define \hyperlink{bufferevent_8h_a504816ca8678e4f3d0bee2700fda524d}{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+R\+E\+A\+D\+I\+N\+G}~0x01}\label{bufferevent_8h_a504816ca8678e4f3d0bee2700fda524d}

\begin{DoxyCompactList}\small\item\em error encountered while reading \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_a557afaa0ce75e6bbb71fdcd68c35d077}{\#define \hyperlink{bufferevent_8h_a557afaa0ce75e6bbb71fdcd68c35d077}{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+W\+R\+I\+T\+I\+N\+G}~0x02}\label{bufferevent_8h_a557afaa0ce75e6bbb71fdcd68c35d077}

\begin{DoxyCompactList}\small\item\em error encountered while writing \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_a4d7d8c93cf62e6f3d37c0cbac75aebcc}{\#define \hyperlink{bufferevent_8h_a4d7d8c93cf62e6f3d37c0cbac75aebcc}{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+E\+O\+F}~0x10}\label{bufferevent_8h_a4d7d8c93cf62e6f3d37c0cbac75aebcc}

\begin{DoxyCompactList}\small\item\em eof file reached \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_a5f112d7a064258bdabf8d5182a3bf5e4}{\#define \hyperlink{bufferevent_8h_a5f112d7a064258bdabf8d5182a3bf5e4}{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+E\+R\+R\+O\+R}~0x20}\label{bufferevent_8h_a5f112d7a064258bdabf8d5182a3bf5e4}

\begin{DoxyCompactList}\small\item\em unrecoverable error encountered \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_aa537428e3ac2c8d2dbb4ec041f09347f}{\#define \hyperlink{bufferevent_8h_aa537428e3ac2c8d2dbb4ec041f09347f}{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+T\+I\+M\+E\+O\+U\+T}~0x40}\label{bufferevent_8h_aa537428e3ac2c8d2dbb4ec041f09347f}

\begin{DoxyCompactList}\small\item\em user-\/specified timeout reached \end{DoxyCompactList}\item 
\#define \hyperlink{bufferevent_8h_affb7a7e5e21e1541ba6f43f950d92993}{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D}~0x80
\begin{DoxyCompactList}\small\item\em connect operation finished. \end{DoxyCompactList}\end{DoxyCompactItemize}
\end{Indent}
\subsection*{Typedefs}
\begin{DoxyCompactItemize}
\item 
typedef void($\ast$ \hyperlink{bufferevent_8h_a75e8fa059136e13c04c237e9c03cdbe8}{bufferevent\+\_\+data\+\_\+cb} )(struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev, void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em A read or write callback for a bufferevent. \end{DoxyCompactList}\item 
typedef void($\ast$ \hyperlink{bufferevent_8h_a79b5f4b983f8e67005416738c6494ac6}{bufferevent\+\_\+event\+\_\+cb} )(struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev, short what, void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em An event/error callback for a bufferevent. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{bufferevent_8h_aa4919449c62c6483e2d135509190dc65}{bufferevent\+\_\+options} \{ \hyperlink{bufferevent_8h_aa4919449c62c6483e2d135509190dc65a5dc89d74ef445da33295d00c8f6adc90}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+C\+L\+O\+S\+E\+\_\+\+O\+N\+\_\+\+F\+R\+E\+E} = (1$<$$<$0), 
\hyperlink{bufferevent_8h_aa4919449c62c6483e2d135509190dc65adfb637881b739eff1441ad848a5e3a2d}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E} = (1$<$$<$1), 
\hyperlink{bufferevent_8h_aa4919449c62c6483e2d135509190dc65a2fbeb24d0156aa2492c23aaace73f1d3}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S} = (1$<$$<$2), 
\hyperlink{bufferevent_8h_aa4919449c62c6483e2d135509190dc65acb8ca6f6422fb8f9a748521cf8c4caf5}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S} = (1$<$$<$3)
 \}
\begin{DoxyCompactList}\small\item\em Options that can be specified when creating a bufferevent. \end{DoxyCompactList}\item 
enum \hyperlink{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25}{bufferevent\+\_\+flush\+\_\+mode} \{ \hyperlink{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25a81903ce04ca68ac1680dd0b7a28a7fce}{B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L} = 0, 
\hyperlink{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25a77e7f15a95815dcaaef27fdabb0e6164}{B\+E\+V\+\_\+\+F\+L\+U\+S\+H} = 1, 
\hyperlink{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25acb248a91854bbebd773061df7f4bbc94}{B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D} = 2
 \}
\begin{DoxyCompactList}\small\item\em Flags that can be passed into filters to let them know how to deal with the incoming data. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
struct \hyperlink{structbufferevent}{bufferevent} $\ast$ \hyperlink{bufferevent_8h_a501557193aa56c9f4923583d9d734395}{bufferevent\+\_\+socket\+\_\+new} (struct \hyperlink{structevent__base}{event\+\_\+base} $\ast$base, \hyperlink{opal_2mca_2event_2libevent2013_2libevent_2include_2event2_2util_8h_a7ef0023565082a65020f6e56be59fd0b}{evutil\+\_\+socket\+\_\+t} fd, int options)
\begin{DoxyCompactList}\small\item\em Create a new socket bufferevent over an existing socket. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_ac2ecbb906883ea848f7bca767d479a2a}{bufferevent\+\_\+socket\+\_\+connect} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$, struct sockaddr $\ast$, int)
\begin{DoxyCompactList}\small\item\em Launch a connect() attempt with a socket-\/based bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a797686b522045aefb217c6b87ea7ae4a}{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$, struct \hyperlink{structevdns__base}{evdns\+\_\+base} $\ast$, int, const char $\ast$, int)
\begin{DoxyCompactList}\small\item\em Resolve the hostname 'hostname' and connect to it as with \hyperlink{bufferevent_8h_ac2ecbb906883ea848f7bca767d479a2a}{bufferevent\+\_\+socket\+\_\+connect()}. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a9a66b02bce652cdbcc7d26636ce26d67}{bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)
\begin{DoxyCompactList}\small\item\em Return the error code for the last failed D\+N\+S lookup attempt made by \hyperlink{bufferevent_8h_a797686b522045aefb217c6b87ea7ae4a}{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname()}. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a0697dabdb9b4057ae71b40a2f0e45fed}{bufferevent\+\_\+base\+\_\+set} (struct \hyperlink{structevent__base}{event\+\_\+base} $\ast$base, struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Assign a bufferevent to a specific \hyperlink{structevent__base}{event\+\_\+base}. \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_a5cabb56040b43ba1a92efd21c4a89890}{struct \hyperlink{structevent__base}{event\+\_\+base} $\ast$ \hyperlink{bufferevent_8h_a5cabb56040b43ba1a92efd21c4a89890}{bufferevent\+\_\+get\+\_\+base} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)}\label{bufferevent_8h_a5cabb56040b43ba1a92efd21c4a89890}

\begin{DoxyCompactList}\small\item\em Return the \hyperlink{structevent__base}{event\+\_\+base} used by a bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a73e1daaa7c4d52c95b16c9944fa62e90}{bufferevent\+\_\+priority\+\_\+set} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, int pri)
\begin{DoxyCompactList}\small\item\em Assign a priority to a bufferevent. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_a474a4cef8fd80bea09a636b5f3055bec}{bufferevent\+\_\+free} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Deallocate the storage associated with a bufferevent structure. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_a63792519cb94a38beccb5e1390cd6198}{bufferevent\+\_\+setcb} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, \hyperlink{bufferevent_8h_a75e8fa059136e13c04c237e9c03cdbe8}{bufferevent\+\_\+data\+\_\+cb} readcb, \hyperlink{bufferevent_8h_a75e8fa059136e13c04c237e9c03cdbe8}{bufferevent\+\_\+data\+\_\+cb} writecb, \hyperlink{bufferevent_8h_a79b5f4b983f8e67005416738c6494ac6}{bufferevent\+\_\+event\+\_\+cb} eventcb, void $\ast$cbarg)
\begin{DoxyCompactList}\small\item\em Changes the callbacks for a bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a0a367e404942c11265bfcd0b693aa120}{bufferevent\+\_\+setfd} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, \hyperlink{opal_2mca_2event_2libevent2013_2libevent_2include_2event2_2util_8h_a7ef0023565082a65020f6e56be59fd0b}{evutil\+\_\+socket\+\_\+t} fd)
\begin{DoxyCompactList}\small\item\em Changes the file descriptor on which the bufferevent operates. \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_aa959659c8ba1c56c3444b5c147762a91}{\hyperlink{opal_2mca_2event_2libevent2013_2libevent_2include_2event2_2util_8h_a7ef0023565082a65020f6e56be59fd0b}{evutil\+\_\+socket\+\_\+t} \hyperlink{bufferevent_8h_aa959659c8ba1c56c3444b5c147762a91}{bufferevent\+\_\+getfd} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)}\label{bufferevent_8h_aa959659c8ba1c56c3444b5c147762a91}

\begin{DoxyCompactList}\small\item\em Returns the file descriptor associated with a bufferevent, or -\/1 if no file descriptor is associated with the bufferevent. \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_a8d40fb7aea3c48e25d616bbe4b0fda65}{struct \hyperlink{structbufferevent}{bufferevent} $\ast$ \hyperlink{bufferevent_8h_a8d40fb7aea3c48e25d616bbe4b0fda65}{bufferevent\+\_\+get\+\_\+underlying} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)}\label{bufferevent_8h_a8d40fb7aea3c48e25d616bbe4b0fda65}

\begin{DoxyCompactList}\small\item\em Returns the underlying bufferevent associated with a bufferevent (if the bufferevent is a wrapper), or N\+U\+L\+L if there is no underlying bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_abc606695cd6bb2e3f25c4330d0c9e3ab}{bufferevent\+\_\+write} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, const void $\ast$data, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Write data to a bufferevent buffer. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a3b140a32a4d16c402433130dc8c3bde4}{bufferevent\+\_\+write\+\_\+buffer} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, struct \hyperlink{structevbuffer}{evbuffer} $\ast$buf)
\begin{DoxyCompactList}\small\item\em Write data from an evbuffer to a bufferevent buffer. \end{DoxyCompactList}\item 
size\+\_\+t \hyperlink{bufferevent_8h_a6bd435529e20a39b24fead9ddcd966ba}{bufferevent\+\_\+read} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, void $\ast$data, size\+\_\+t size)
\begin{DoxyCompactList}\small\item\em Read data from a bufferevent buffer. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_ab2246fd48085c1acc9e98747a83af041}{bufferevent\+\_\+read\+\_\+buffer} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, struct \hyperlink{structevbuffer}{evbuffer} $\ast$buf)
\begin{DoxyCompactList}\small\item\em Read data from a bufferevent buffer into an evbuffer. \end{DoxyCompactList}\item 
struct \hyperlink{structevbuffer}{evbuffer} $\ast$ \hyperlink{bufferevent_8h_a7bc716ede3a5fc1e9107ae522e545e0c}{bufferevent\+\_\+get\+\_\+input} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Returns the input buffer. \end{DoxyCompactList}\item 
struct \hyperlink{structevbuffer}{evbuffer} $\ast$ \hyperlink{bufferevent_8h_af3dea057c5a276461dd94a1601682be1}{bufferevent\+\_\+get\+\_\+output} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Returns the output buffer. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a1b9a3412e8c8e122c745b33d46b9643e}{bufferevent\+\_\+enable} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, short \hyperlink{structevent}{event})
\begin{DoxyCompactList}\small\item\em Enable a bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_aa15582fe250247aa98d4897527215727}{bufferevent\+\_\+disable} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, short \hyperlink{structevent}{event})
\begin{DoxyCompactList}\small\item\em Disable a bufferevent. \end{DoxyCompactList}\item 
short \hyperlink{bufferevent_8h_afbb4adabeb188cc9000bdee4ba23bdb2}{bufferevent\+\_\+get\+\_\+enabled} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Return the events that are enabled on a given bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a3686d744e67e9a530ebf8ab888ade2cf}{bufferevent\+\_\+set\+\_\+timeouts} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, const struct timeval $\ast$timeout\+\_\+read, const struct timeval $\ast$timeout\+\_\+write)
\begin{DoxyCompactList}\small\item\em Set the read and write timeout for a bufferevent. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_a74e3835e99f8eb73bb1cd7afa7427049}{bufferevent\+\_\+setwatermark} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, short events, size\+\_\+t lowmark, size\+\_\+t highmark)
\begin{DoxyCompactList}\small\item\em Sets the watermarks for read and write events. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_a56a61802037478591048b4967fa15599}{bufferevent\+\_\+lock} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Acquire the lock on a bufferevent. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_a53fd135567d95cab72b8bad473c97510}{bufferevent\+\_\+unlock} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev)
\begin{DoxyCompactList}\small\item\em Release the lock on a bufferevent. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a03376a35668ff9b6dc905cce0d89876d}{bufferevent\+\_\+flush} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bufev, short iotype, enum \hyperlink{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25}{bufferevent\+\_\+flush\+\_\+mode} mode)
\begin{DoxyCompactList}\small\item\em Triggers the bufferevent to produce more data if possible. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_af8932010b0a590ddf9848026e8a99059}{bufferevent\+\_\+pair\+\_\+new} (struct \hyperlink{structevent__base}{event\+\_\+base} $\ast$base, int options, struct \hyperlink{structbufferevent}{bufferevent} $\ast$pair\mbox{[}2\mbox{]})
\begin{DoxyCompactList}\small\item\em Allocate a pair of linked bufferevents. \end{DoxyCompactList}\item 
struct \hyperlink{structbufferevent}{bufferevent} $\ast$ \hyperlink{bufferevent_8h_a3ebd2a56a2ef87106bf76630eb0926b6}{bufferevent\+\_\+pair\+\_\+get\+\_\+partner} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)
\begin{DoxyCompactList}\small\item\em Given one bufferevent returned by \hyperlink{bufferevent_8h_af8932010b0a590ddf9848026e8a99059}{bufferevent\+\_\+pair\+\_\+new()}, returns the other one if it still exists. \end{DoxyCompactList}\item 
struct \hyperlink{structev__token__bucket__cfg}{ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$ \hyperlink{bufferevent_8h_a60dd9d6469537b9099d2f6299c114ae6}{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new} (size\+\_\+t read\+\_\+rate, size\+\_\+t read\+\_\+burst, size\+\_\+t write\+\_\+rate, size\+\_\+t write\+\_\+burst, const struct timeval $\ast$tick\+\_\+len)
\begin{DoxyCompactList}\small\item\em Initialize and return a new object to configure the rate-\/limiting behavior of bufferevents. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_ad918ea1e7f7967e5db895c7dde5b78ae}{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free} (struct \hyperlink{structev__token__bucket__cfg}{ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$cfg)
\begin{DoxyCompactList}\small\item\em Free all storage held in 'cfg'. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_aeb7bc9d8af4dd74b3de8dcd2941e6e02}{bufferevent\+\_\+set\+\_\+rate\+\_\+limit} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev, struct \hyperlink{structev__token__bucket__cfg}{ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$cfg)
\begin{DoxyCompactList}\small\item\em Set the rate-\/limit of a the bufferevent 'bev' to the one specified in 'cfg'. \end{DoxyCompactList}\item 
struct \\*
\hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$ \hyperlink{bufferevent_8h_acf75d7e04a54e7fe4543f7efd596e7f7}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new} (struct \hyperlink{structevent__base}{event\+\_\+base} $\ast$base, const struct \hyperlink{structev__token__bucket__cfg}{ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$cfg)
\begin{DoxyCompactList}\small\item\em Create a new rate-\/limit group for bufferevents. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_a9b766efb61af2cb92d24f6e4caa38a53}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$, const struct \hyperlink{structev__token__bucket__cfg}{ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$)
\begin{DoxyCompactList}\small\item\em Change the rate-\/limiting settings for a given rate-\/limiting group. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_aa2499cfb56976dcf3c6b846801043214}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$, size\+\_\+t)
\begin{DoxyCompactList}\small\item\em Change the smallest quantum we're willing to allocate to any single bufferevent in a group for reading or writing at a time. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_adf4304c0c47fedb8122700ce1f0def8b}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$)
\begin{DoxyCompactList}\small\item\em Free a rate-\/limiting group. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_aadb00f5d5c054bb705db78db327ef261}{bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev, struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$g)
\begin{DoxyCompactList}\small\item\em Add 'bev' to the list of bufferevents whose aggregate reading and writing is restricted by 'g'. \end{DoxyCompactList}\item 
int \hyperlink{bufferevent_8h_abdbf64b4203fe6b65b263661ef18c6f2}{bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)
\begin{DoxyCompactList}\small\item\em Remove 'bev' from its current rate-\/limit group (if any). \end{DoxyCompactList}\item 
\hypertarget{bufferevent_8h_ab2a8edb561655b13b013363726188f0c}{ev\+\_\+ssize\+\_\+t {\bfseries bufferevent\+\_\+get\+\_\+max\+\_\+to\+\_\+read} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)}\label{bufferevent_8h_ab2a8edb561655b13b013363726188f0c}

\item 
\hypertarget{bufferevent_8h_a97487188a8ace977c3a74e330d2f224d}{ev\+\_\+ssize\+\_\+t {\bfseries bufferevent\+\_\+get\+\_\+max\+\_\+to\+\_\+write} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)}\label{bufferevent_8h_a97487188a8ace977c3a74e330d2f224d}

\item 
void \hyperlink{bufferevent_8h_a4fec52eebbe5f925dfc2eaa60100124d}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$grp, ev\+\_\+uint64\+\_\+t $\ast$total\+\_\+read\+\_\+out, ev\+\_\+uint64\+\_\+t $\ast$total\+\_\+written\+\_\+out)
\begin{DoxyCompactList}\small\item\em Inspect the total bytes read/written on a group. \end{DoxyCompactList}\item 
void \hyperlink{bufferevent_8h_a38c81c84dc02318bd34f41d84f468a98}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$grp)
\begin{DoxyCompactList}\small\item\em Reset the total bytes read/written on a group. \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{Indent}{\bf Rate limit inspection}\par
{\em Return the current read or write bucket size for a bufferevent.

If it is not configured with a per-\/bufferevent ratelimit, return E\+V\+\_\+\+S\+S\+I\+Z\+E\+\_\+\+M\+A\+X. This function does not inspect the group limit, if any. Note that it can return a negative value if the bufferevent has been made to read or write more than its limit. }\begin{DoxyCompactItemize}
\item 
\hypertarget{bufferevent_8h_a73312a98fb1823be7936833a83b46a9d}{ev\+\_\+ssize\+\_\+t {\bfseries bufferevent\+\_\+get\+\_\+read\+\_\+limit} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)}\label{bufferevent_8h_a73312a98fb1823be7936833a83b46a9d}

\item 
\hypertarget{bufferevent_8h_a90ee89498a9bd8777267fbca7947827d}{ev\+\_\+ssize\+\_\+t {\bfseries bufferevent\+\_\+get\+\_\+write\+\_\+limit} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev)}\label{bufferevent_8h_a90ee89498a9bd8777267fbca7947827d}

\end{DoxyCompactItemize}
\end{Indent}
\begin{Indent}{\bf Groupr\+Rate limit inspection}\par
{\em Return the read or write bucket size for a bufferevent rate limit group.

Note that it can return a negative value if bufferevents in the group have been made to read or write more than their limits. }\begin{DoxyCompactItemize}
\item 
\hypertarget{bufferevent_8h_aa72d92d5179e24cd73a910fd353c927a}{ev\+\_\+ssize\+\_\+t {\bfseries bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+read\+\_\+limit} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$)}\label{bufferevent_8h_aa72d92d5179e24cd73a910fd353c927a}

\item 
\hypertarget{bufferevent_8h_ad1f35e47760c34deaf1baede3fd0425a}{ev\+\_\+ssize\+\_\+t {\bfseries bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+write\+\_\+limit} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$)}\label{bufferevent_8h_ad1f35e47760c34deaf1baede3fd0425a}

\end{DoxyCompactItemize}
\end{Indent}
\begin{Indent}{\bf Rate limit manipulation}\par
{\em Subtract a number of bytes from a bufferevent's read or write bucket.

The decrement value can be negative, if you want to manually refill the bucket. If the change puts the bucket above or below zero, the bufferevent will resume or suspend reading writing as appropriate. These functions make no change in the buckets for the bufferevent's group, if any.

Returns 0 on success, -\/1 on internal error. }\begin{DoxyCompactItemize}
\item 
\hypertarget{bufferevent_8h_ae22e5c618f1f93afcd6c2adb1b9ca165}{int {\bfseries bufferevent\+\_\+decrement\+\_\+read\+\_\+limit} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev, ev\+\_\+ssize\+\_\+t decr)}\label{bufferevent_8h_ae22e5c618f1f93afcd6c2adb1b9ca165}

\item 
\hypertarget{bufferevent_8h_afedbe4264b84e4e8c65bdeba1bd42b6a}{int {\bfseries bufferevent\+\_\+decrement\+\_\+write\+\_\+limit} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$bev, ev\+\_\+ssize\+\_\+t decr)}\label{bufferevent_8h_afedbe4264b84e4e8c65bdeba1bd42b6a}

\end{DoxyCompactItemize}
\end{Indent}
\begin{Indent}{\bf Group rate limit manipulation}\par
{\em Subtract a number of bytes from a bufferevent rate-\/limiting group's read or write bucket.

The decrement value can be negative, if you want to manually refill the bucket. If the change puts the bucket above or below zero, the bufferevents in the group will resume or suspend reading writing as appropriate.

Returns 0 on success, -\/1 on internal error. }\begin{DoxyCompactItemize}
\item 
\hypertarget{bufferevent_8h_aa5f603c05b36373b532db68aca645ed8}{int {\bfseries bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+decrement\+\_\+read} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$, ev\+\_\+ssize\+\_\+t)}\label{bufferevent_8h_aa5f603c05b36373b532db68aca645ed8}

\item 
\hypertarget{bufferevent_8h_aec8e489e3c2705105d85064340018847}{int {\bfseries bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+decrement\+\_\+write} (struct \hyperlink{structbufferevent__rate__limit__group}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$, ev\+\_\+ssize\+\_\+t)}\label{bufferevent_8h_aec8e489e3c2705105d85064340018847}

\end{DoxyCompactItemize}
\end{Indent}
\subsection*{Filtering support}
\begin{DoxyCompactItemize}
\item 
enum \hyperlink{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1}{bufferevent\+\_\+filter\+\_\+result} \{ \hyperlink{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a794bf8211eaafdbeb382991dc5874e4d}{B\+E\+V\+\_\+\+O\+K} = 0, 
\hyperlink{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a78c4f864aee50d333d74e3b46e12b8a4}{B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E} = 1, 
\hyperlink{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a4e51550811d3dad92400c27d69277032}{B\+E\+V\+\_\+\+E\+R\+R\+O\+R} = 2
 \}
\begin{DoxyCompactList}\small\item\em Values that filters can return. \end{DoxyCompactList}\item 
typedef enum \\*
\hyperlink{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1}{bufferevent\+\_\+filter\+\_\+result}($\ast$ \hyperlink{bufferevent_8h_a08a36463d040d1533ba3a06a5c776a99}{bufferevent\+\_\+filter\+\_\+cb} )(struct \hyperlink{structevbuffer}{evbuffer} $\ast$src, struct \hyperlink{structevbuffer}{evbuffer} $\ast$dst, ev\+\_\+ssize\+\_\+t dst\+\_\+limit, enum \hyperlink{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25}{bufferevent\+\_\+flush\+\_\+mode} mode, void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em A callback function to implement a filter for a bufferevent. \end{DoxyCompactList}\item 
struct \hyperlink{structbufferevent}{bufferevent} $\ast$ \hyperlink{bufferevent_8h_ab6dea1351561f1866b0526fc1207bb69}{bufferevent\+\_\+filter\+\_\+new} (struct \hyperlink{structbufferevent}{bufferevent} $\ast$underlying, \hyperlink{bufferevent_8h_a08a36463d040d1533ba3a06a5c776a99}{bufferevent\+\_\+filter\+\_\+cb} input\+\_\+filter, \hyperlink{bufferevent_8h_a08a36463d040d1533ba3a06a5c776a99}{bufferevent\+\_\+filter\+\_\+cb} output\+\_\+filter, int options, void($\ast$free\+\_\+context)(void $\ast$), void $\ast$ctx)
\begin{DoxyCompactList}\small\item\em Allocate a new filtering bufferevent on top of an existing bufferevent. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
Functions for buffering data for network sending or receiving. 

Bufferevents are higher level than evbuffers\+: each has an underlying evbuffer for reading and one for writing, and callbacks that are invoked under certain circumstances.

A bufferevent provides input and output buffers that get filled and drained automatically. The user of a bufferevent no longer deals directly with the I/\+O, but instead is reading from input and writing to output buffers.

Once initialized, the bufferevent structure can be used repeatedly with \hyperlink{bufferevent_8h_a1b9a3412e8c8e122c745b33d46b9643e}{bufferevent\+\_\+enable()} and \hyperlink{bufferevent_8h_aa15582fe250247aa98d4897527215727}{bufferevent\+\_\+disable()}.

When reading is enabled, the bufferevent will try to read from the file descriptor onto its input buffer, and and call the read callback. When writing is enabled, the bufferevent will try to write data onto its file descriptor when writing is enabled, and call the write callback when the output buffer is sufficiently drained.

Bufferevents come in several flavors, including\+:


\begin{DoxyDescription}
\item[Socket-\/based bufferevents ]A bufferevent that reads and writes data onto a network socket. Created with \hyperlink{bufferevent_8h_a501557193aa56c9f4923583d9d734395}{bufferevent\+\_\+socket\+\_\+new()}.


\item[Paired bufferevents ]A pair of bufferevents that send and receive data to one another without touching the network. Created with \hyperlink{bufferevent_8h_af8932010b0a590ddf9848026e8a99059}{bufferevent\+\_\+pair\+\_\+new()}.


\item[Filtering bufferevents ]A bufferevent that transforms data, and sends or receives it over another underlying bufferevent. Created with \hyperlink{bufferevent_8h_ab6dea1351561f1866b0526fc1207bb69}{bufferevent\+\_\+filter\+\_\+new()}.


\item[S\+S\+L-\/backed bufferevents ]A bufferevent that uses the openssl library to send and receive data over an encrypted connection. Created with bufferevent\+\_\+openssl\+\_\+socket\+\_\+new() or bufferevent\+\_\+openssl\+\_\+filter\+\_\+new(). 
\end{DoxyDescription}

\subsection{Macro Definition Documentation}
\hypertarget{bufferevent_8h_affb7a7e5e21e1541ba6f43f950d92993}{\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D@{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D}}
\index{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D@{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D}]{\setlength{\rightskip}{0pt plus 5cm}\#define B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D~0x80}}\label{bufferevent_8h_affb7a7e5e21e1541ba6f43f950d92993}


connect operation finished. 

\hypertarget{bufferevent_8h_a78fc86349f408552be0fdf249db673ec}{\index{bufferevent.\+h@{bufferevent.\+h}!E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X@{E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X}}
\index{E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X@{E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X}]{\setlength{\rightskip}{0pt plus 5cm}\#define E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X~E\+V\+\_\+\+S\+S\+I\+Z\+E\+\_\+\+M\+A\+X}}\label{bufferevent_8h_a78fc86349f408552be0fdf249db673ec}


Maximum configurable rate-\/ or burst-\/limit. 



Referenced by ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new().



\subsection{Typedef Documentation}
\hypertarget{bufferevent_8h_a75e8fa059136e13c04c237e9c03cdbe8}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+data\+\_\+cb@{bufferevent\+\_\+data\+\_\+cb}}
\index{bufferevent\+\_\+data\+\_\+cb@{bufferevent\+\_\+data\+\_\+cb}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+data\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ bufferevent\+\_\+data\+\_\+cb)(struct {\bf bufferevent} $\ast$bev, void $\ast$ctx)}}\label{bufferevent_8h_a75e8fa059136e13c04c237e9c03cdbe8}


A read or write callback for a bufferevent. 

The read callback is triggered when new data arrives in the input buffer and the amount of readable data exceed the low watermark which is 0 by default.

The write callback is triggered if the write buffer has been exhausted or fell below its low watermark.


\begin{DoxyParams}{Parameters}
{\em bev} & the bufferevent that triggered the callback \\
\hline
{\em ctx} & the user-\/specified context for this bufferevent \\
\hline
\end{DoxyParams}
\hypertarget{bufferevent_8h_a79b5f4b983f8e67005416738c6494ac6}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+event\+\_\+cb@{bufferevent\+\_\+event\+\_\+cb}}
\index{bufferevent\+\_\+event\+\_\+cb@{bufferevent\+\_\+event\+\_\+cb}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+event\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}typedef void($\ast$ bufferevent\+\_\+event\+\_\+cb)(struct {\bf bufferevent} $\ast$bev, short what, void $\ast$ctx)}}\label{bufferevent_8h_a79b5f4b983f8e67005416738c6494ac6}


An event/error callback for a bufferevent. 

The event callback is triggered if either an E\+O\+F condition or another unrecoverable error was encountered.


\begin{DoxyParams}{Parameters}
{\em bev} & the bufferevent for which the error condition was reached \\
\hline
{\em what} & a conjunction of flags\+: B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+R\+E\+A\+D\+I\+N\+G or B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+W\+R\+I\+T\+I\+N\+G to indicate if the error was encountered on the read or write path, and one of the following flags\+: B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+E\+O\+F, B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+E\+R\+R\+O\+R, B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+T\+I\+M\+E\+O\+U\+T, B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D.\\
\hline
{\em ctx} & the user-\/specified context for this bufferevent \\
\hline
\end{DoxyParams}
\hypertarget{bufferevent_8h_a08a36463d040d1533ba3a06a5c776a99}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+filter\+\_\+cb@{bufferevent\+\_\+filter\+\_\+cb}}
\index{bufferevent\+\_\+filter\+\_\+cb@{bufferevent\+\_\+filter\+\_\+cb}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+filter\+\_\+cb}]{\setlength{\rightskip}{0pt plus 5cm}typedef enum {\bf bufferevent\+\_\+filter\+\_\+result}($\ast$ bufferevent\+\_\+filter\+\_\+cb)(struct {\bf evbuffer} $\ast$src, struct {\bf evbuffer} $\ast$dst, ev\+\_\+ssize\+\_\+t dst\+\_\+limit, enum {\bf bufferevent\+\_\+flush\+\_\+mode} mode, void $\ast$ctx)}}\label{bufferevent_8h_a08a36463d040d1533ba3a06a5c776a99}


A callback function to implement a filter for a bufferevent. 


\begin{DoxyParams}{Parameters}
{\em src} & An evbuffer to drain data from. \\
\hline
{\em dst} & An evbuffer to add data to. \\
\hline
{\em limit} & A suggested upper bound of bytes to write to dst. The filter may ignore this value, but doing so means that it will overflow the high-\/water mark associated with dst. -\/1 means \char`\"{}no limit\char`\"{}. \\
\hline
{\em mode} & Whether we should write data as may be convenient (B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L), or flush as much data as we can (B\+E\+V\+\_\+\+F\+L\+U\+S\+H), or flush as much as we can, possibly including an end-\/of-\/stream marker (B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H). \\
\hline
{\em ctx} & A user-\/supplied pointer.\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
B\+E\+V\+\_\+\+O\+K if we wrote some data; B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E if we can't produce any more output until we get some input; and B\+E\+V\+\_\+\+E\+R\+R\+O\+R on an error. 
\end{DoxyReturn}


\subsection{Enumeration Type Documentation}
\hypertarget{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+filter\+\_\+result@{bufferevent\+\_\+filter\+\_\+result}}
\index{bufferevent\+\_\+filter\+\_\+result@{bufferevent\+\_\+filter\+\_\+result}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+filter\+\_\+result}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf bufferevent\+\_\+filter\+\_\+result}}}\label{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1}


Values that filters can return. 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{B\+E\+V\+\_\+\+O\+K@{B\+E\+V\+\_\+\+O\+K}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+O\+K@{B\+E\+V\+\_\+\+O\+K}}\item[{\em 
\hypertarget{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a794bf8211eaafdbeb382991dc5874e4d}{B\+E\+V\+\_\+\+O\+K}\label{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a794bf8211eaafdbeb382991dc5874e4d}
}]everything is okay \index{B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E@{B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E@{B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E}}\item[{\em 
\hypertarget{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a78c4f864aee50d333d74e3b46e12b8a4}{B\+E\+V\+\_\+\+N\+E\+E\+D\+\_\+\+M\+O\+R\+E}\label{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a78c4f864aee50d333d74e3b46e12b8a4}
}]the filter needs to read more data before output \index{B\+E\+V\+\_\+\+E\+R\+R\+O\+R@{B\+E\+V\+\_\+\+E\+R\+R\+O\+R}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+E\+R\+R\+O\+R@{B\+E\+V\+\_\+\+E\+R\+R\+O\+R}}\item[{\em 
\hypertarget{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a4e51550811d3dad92400c27d69277032}{B\+E\+V\+\_\+\+E\+R\+R\+O\+R}\label{bufferevent_8h_a19e499f7bfa831b802fd3575d141b4e1a4e51550811d3dad92400c27d69277032}
}]the filter encountered a critical error, no further data can be processed. \end{description}
\end{Desc}
\hypertarget{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+flush\+\_\+mode@{bufferevent\+\_\+flush\+\_\+mode}}
\index{bufferevent\+\_\+flush\+\_\+mode@{bufferevent\+\_\+flush\+\_\+mode}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+flush\+\_\+mode}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf bufferevent\+\_\+flush\+\_\+mode}}}\label{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25}


Flags that can be passed into filters to let them know how to deal with the incoming data. 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L@{B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L@{B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L}}\item[{\em 
\hypertarget{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25a81903ce04ca68ac1680dd0b7a28a7fce}{B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L}\label{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25a81903ce04ca68ac1680dd0b7a28a7fce}
}]usually set when processing data \index{B\+E\+V\+\_\+\+F\+L\+U\+S\+H@{B\+E\+V\+\_\+\+F\+L\+U\+S\+H}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+F\+L\+U\+S\+H@{B\+E\+V\+\_\+\+F\+L\+U\+S\+H}}\item[{\em 
\hypertarget{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25a77e7f15a95815dcaaef27fdabb0e6164}{B\+E\+V\+\_\+\+F\+L\+U\+S\+H}\label{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25a77e7f15a95815dcaaef27fdabb0e6164}
}]want to checkpoint all data sent. \index{B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D@{B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D@{B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D}}\item[{\em 
\hypertarget{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25acb248a91854bbebd773061df7f4bbc94}{B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D}\label{bufferevent_8h_ac35edc760057a2e48b4e8ba9ecf2ad25acb248a91854bbebd773061df7f4bbc94}
}]encountered E\+O\+F on read or done sending data \end{description}
\end{Desc}
\hypertarget{bufferevent_8h_aa4919449c62c6483e2d135509190dc65}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+options@{bufferevent\+\_\+options}}
\index{bufferevent\+\_\+options@{bufferevent\+\_\+options}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+options}]{\setlength{\rightskip}{0pt plus 5cm}enum {\bf bufferevent\+\_\+options}}}\label{bufferevent_8h_aa4919449c62c6483e2d135509190dc65}


Options that can be specified when creating a bufferevent. 

\begin{Desc}
\item[Enumerator]\par
\begin{description}
\index{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+C\+L\+O\+S\+E\+\_\+\+O\+N\+\_\+\+F\+R\+E\+E@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+C\+L\+O\+S\+E\+\_\+\+O\+N\+\_\+\+F\+R\+E\+E}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+C\+L\+O\+S\+E\+\_\+\+O\+N\+\_\+\+F\+R\+E\+E@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+C\+L\+O\+S\+E\+\_\+\+O\+N\+\_\+\+F\+R\+E\+E}}\item[{\em 
\hypertarget{bufferevent_8h_aa4919449c62c6483e2d135509190dc65a5dc89d74ef445da33295d00c8f6adc90}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+C\+L\+O\+S\+E\+\_\+\+O\+N\+\_\+\+F\+R\+E\+E}\label{bufferevent_8h_aa4919449c62c6483e2d135509190dc65a5dc89d74ef445da33295d00c8f6adc90}
}]If set, we close the underlying file descriptor/bufferevent/whatever when this bufferevent is freed. \index{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E}}\item[{\em 
\hypertarget{bufferevent_8h_aa4919449c62c6483e2d135509190dc65adfb637881b739eff1441ad848a5e3a2d}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E}\label{bufferevent_8h_aa4919449c62c6483e2d135509190dc65adfb637881b739eff1441ad848a5e3a2d}
}]If set, and threading is enabled, operations on this bufferevent are protected by a lock. \index{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S}}\item[{\em 
\hypertarget{bufferevent_8h_aa4919449c62c6483e2d135509190dc65a2fbeb24d0156aa2492c23aaace73f1d3}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S}\label{bufferevent_8h_aa4919449c62c6483e2d135509190dc65a2fbeb24d0156aa2492c23aaace73f1d3}
}]If set, callbacks are run deferred in the event loop. \index{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S}!bufferevent.\+h@{bufferevent.\+h}}\index{bufferevent.\+h@{bufferevent.\+h}!B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S@{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S}}\item[{\em 
\hypertarget{bufferevent_8h_aa4919449c62c6483e2d135509190dc65acb8ca6f6422fb8f9a748521cf8c4caf5}{B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+U\+N\+L\+O\+C\+K\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S}\label{bufferevent_8h_aa4919449c62c6483e2d135509190dc65acb8ca6f6422fb8f9a748521cf8c4caf5}
}]If set, callbacks are executed without locks being held on the bufferevent. This option currently requires that B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S also be set; a future version of Libevent might remove the requirement. \end{description}
\end{Desc}


\subsection{Function Documentation}
\hypertarget{bufferevent_8h_aadb00f5d5c054bb705db78db327ef261}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group@{bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group}}
\index{bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group@{bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bev, }
\item[{struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$}]{g}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_aadb00f5d5c054bb705db78db327ef261}


Add 'bev' to the list of bufferevents whose aggregate reading and writing is restricted by 'g'. 

If 'g' is N\+U\+L\+L, remove 'bev' from its current group.

A bufferevent may belong to no more than one rate-\/limit group at a time. If 'bev' is already a member of a group, it will be removed from its old group before being added to 'g'.

Return 0 on success and -\/1 on failure. 

References bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group(), bufferevent\+::ev\+\_\+base, bufferevent\+\_\+rate\+\_\+limit\+::group, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::n\+\_\+members, bufferevent\+\_\+private\+::rate\+\_\+limiting, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::read\+\_\+suspended, and bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::write\+\_\+suspended.

\hypertarget{bufferevent_8h_a0697dabdb9b4057ae71b40a2f0e45fed}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+base\+\_\+set@{bufferevent\+\_\+base\+\_\+set}}
\index{bufferevent\+\_\+base\+\_\+set@{bufferevent\+\_\+base\+\_\+set}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+base\+\_\+set}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+base\+\_\+set (
\begin{DoxyParamCaption}
\item[{struct {\bf event\+\_\+base} $\ast$}]{base, }
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a0697dabdb9b4057ae71b40a2f0e45fed}


Assign a bufferevent to a specific \hyperlink{structevent__base}{event\+\_\+base}. 

N\+O\+T\+E that only socket bufferevents support this function.


\begin{DoxyParams}{Parameters}
{\em base} & an \hyperlink{structevent__base}{event\+\_\+base} returned by \hyperlink{event__compat_8h_a1bf74386dd3725e1538fed2d70c1c113}{event\+\_\+init()} \\
\hline
{\em bufev} & a bufferevent struct returned by bufferevent\+\_\+new() or \hyperlink{bufferevent_8h_a501557193aa56c9f4923583d9d734395}{bufferevent\+\_\+socket\+\_\+new()} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
bufferevent\+\_\+new() 
\end{DoxySeeAlso}


References bufferevent\+::be\+\_\+ops, bufferevent\+::ev\+\_\+base, bufferevent\+::ev\+\_\+read, bufferevent\+::ev\+\_\+write, and event\+\_\+base\+\_\+set().



Referenced by evhttp\+\_\+connection\+\_\+base\+\_\+new(), and evhttp\+\_\+connection\+\_\+set\+\_\+base().

\hypertarget{bufferevent_8h_aa15582fe250247aa98d4897527215727}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+disable@{bufferevent\+\_\+disable}}
\index{bufferevent\+\_\+disable@{bufferevent\+\_\+disable}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+disable}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+disable (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{short}]{event}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_aa15582fe250247aa98d4897527215727}


Disable a bufferevent. 


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be disabled \\
\hline
{\em event} & any combination of E\+V\+\_\+\+R\+E\+A\+D $\vert$ E\+V\+\_\+\+W\+R\+I\+T\+E. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{bufferevent_8h_a1b9a3412e8c8e122c745b33d46b9643e}{bufferevent\+\_\+enable()} 
\end{DoxySeeAlso}


References bufferevent\+::be\+\_\+ops, bufferevent\+\_\+ops\+::disable, and bufferevent\+::enabled.

\hypertarget{bufferevent_8h_a1b9a3412e8c8e122c745b33d46b9643e}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+enable@{bufferevent\+\_\+enable}}
\index{bufferevent\+\_\+enable@{bufferevent\+\_\+enable}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+enable}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+enable (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{short}]{event}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a1b9a3412e8c8e122c745b33d46b9643e}


Enable a bufferevent. 


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be enabled \\
\hline
{\em event} & any combination of E\+V\+\_\+\+R\+E\+A\+D $\vert$ E\+V\+\_\+\+W\+R\+I\+T\+E. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{bufferevent_8h_aa15582fe250247aa98d4897527215727}{bufferevent\+\_\+disable()} 
\end{DoxySeeAlso}


References bufferevent\+::be\+\_\+ops, bufferevent\+\_\+private\+::bev, bufferevent\+\_\+ops\+::enable, bufferevent\+::enabled, E\+V\+\_\+\+R\+E\+A\+D, E\+V\+\_\+\+W\+R\+I\+T\+E, bufferevent\+\_\+private\+::read\+\_\+suspended, and bufferevent\+\_\+private\+::write\+\_\+suspended.



Referenced by bufferevent\+\_\+filter\+\_\+new().

\hypertarget{bufferevent_8h_ab6dea1351561f1866b0526fc1207bb69}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+filter\+\_\+new@{bufferevent\+\_\+filter\+\_\+new}}
\index{bufferevent\+\_\+filter\+\_\+new@{bufferevent\+\_\+filter\+\_\+new}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+filter\+\_\+new}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf bufferevent}$\ast$ bufferevent\+\_\+filter\+\_\+new (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{underlying, }
\item[{{\bf bufferevent\+\_\+filter\+\_\+cb}}]{input\+\_\+filter, }
\item[{{\bf bufferevent\+\_\+filter\+\_\+cb}}]{output\+\_\+filter, }
\item[{int}]{options, }
\item[{void($\ast$)(void $\ast$)}]{free\+\_\+context, }
\item[{void $\ast$}]{ctx}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_ab6dea1351561f1866b0526fc1207bb69}


Allocate a new filtering bufferevent on top of an existing bufferevent. 


\begin{DoxyParams}{Parameters}
{\em underlying} & the underlying bufferevent. \\
\hline
{\em input\+\_\+filter} & The filter to apply to data we read from the underlying bufferevent \\
\hline
{\em output\+\_\+filter} & The filer to apply to data we write to the underlying bufferevent \\
\hline
{\em options} & A bitfield of bufferevent options. \\
\hline
{\em free\+\_\+context} & A function to use to free the filter context when this bufferevent is freed. \\
\hline
{\em ctx} & A context pointer to pass to the filter functions. \\
\hline
\end{DoxyParams}


References B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E, bufferevent\+\_\+enable(), bufferevent\+\_\+setcb(), bufferevent\+\_\+filtered\+::context, bufferevent\+::ev\+\_\+base, E\+V\+\_\+\+R\+E\+A\+D, E\+V\+\_\+\+W\+R\+I\+T\+E, evbuffer\+\_\+add\+\_\+cb(), bufferevent\+\_\+filtered\+::free\+\_\+context, bufferevent\+\_\+filtered\+::outbuf\+\_\+cb, bufferevent\+\_\+filtered\+::process\+\_\+in, bufferevent\+\_\+filtered\+::process\+\_\+out, and bufferevent\+\_\+filtered\+::underlying.

\hypertarget{bufferevent_8h_a03376a35668ff9b6dc905cce0d89876d}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+flush@{bufferevent\+\_\+flush}}
\index{bufferevent\+\_\+flush@{bufferevent\+\_\+flush}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+flush}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+flush (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{short}]{iotype, }
\item[{enum {\bf bufferevent\+\_\+flush\+\_\+mode}}]{mode}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a03376a35668ff9b6dc905cce0d89876d}


Triggers the bufferevent to produce more data if possible. 


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent object \\
\hline
{\em iotype} & either E\+V\+\_\+\+R\+E\+A\+D or E\+V\+\_\+\+W\+R\+I\+T\+E or both. \\
\hline
{\em mode} & either B\+E\+V\+\_\+\+N\+O\+R\+M\+A\+L or B\+E\+V\+\_\+\+F\+L\+U\+S\+H or B\+E\+V\+\_\+\+F\+I\+N\+I\+S\+H\+E\+D \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
-\/1 on failure, 0 if no data was produces, 1 if data was produced 
\end{DoxyReturn}


References bufferevent\+::be\+\_\+ops, and bufferevent\+\_\+ops\+::flush.

\hypertarget{bufferevent_8h_a474a4cef8fd80bea09a636b5f3055bec}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+free@{bufferevent\+\_\+free}}
\index{bufferevent\+\_\+free@{bufferevent\+\_\+free}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+free}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+free (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a474a4cef8fd80bea09a636b5f3055bec}


Deallocate the storage associated with a bufferevent structure. 


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent structure to be freed. \\
\hline
\end{DoxyParams}


References bufferevent\+\_\+setcb().



Referenced by bufferevent\+\_\+pair\+\_\+new(), and evhttp\+\_\+connection\+\_\+free().

\hypertarget{bufferevent_8h_afbb4adabeb188cc9000bdee4ba23bdb2}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+get\+\_\+enabled@{bufferevent\+\_\+get\+\_\+enabled}}
\index{bufferevent\+\_\+get\+\_\+enabled@{bufferevent\+\_\+get\+\_\+enabled}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+get\+\_\+enabled}]{\setlength{\rightskip}{0pt plus 5cm}short bufferevent\+\_\+get\+\_\+enabled (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_afbb4adabeb188cc9000bdee4ba23bdb2}


Return the events that are enabled on a given bufferevent. 


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to inspect \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
A combination of E\+V\+\_\+\+R\+E\+A\+D $\vert$ E\+V\+\_\+\+W\+R\+I\+T\+E 
\end{DoxyReturn}


References bufferevent\+::enabled.

\hypertarget{bufferevent_8h_a7bc716ede3a5fc1e9107ae522e545e0c}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+get\+\_\+input@{bufferevent\+\_\+get\+\_\+input}}
\index{bufferevent\+\_\+get\+\_\+input@{bufferevent\+\_\+get\+\_\+input}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+get\+\_\+input}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf evbuffer}$\ast$ bufferevent\+\_\+get\+\_\+input (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a7bc716ede3a5fc1e9107ae522e545e0c}


Returns the input buffer. 

The user M\+U\+S\+T N\+O\+T set the callback on this buffer.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent from which to get the evbuffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the evbuffer object for the input buffer 
\end{DoxyReturn}


References bufferevent\+::input.

\hypertarget{bufferevent_8h_af3dea057c5a276461dd94a1601682be1}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+get\+\_\+output@{bufferevent\+\_\+get\+\_\+output}}
\index{bufferevent\+\_\+get\+\_\+output@{bufferevent\+\_\+get\+\_\+output}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+get\+\_\+output}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf evbuffer}$\ast$ bufferevent\+\_\+get\+\_\+output (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_af3dea057c5a276461dd94a1601682be1}


Returns the output buffer. 

The user M\+U\+S\+T N\+O\+T set the callback on this buffer.

When filters are being used, the filters need to be manually triggered if the output buffer was manipulated.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent from which to get the evbuffer \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the evbuffer object for the output buffer 
\end{DoxyReturn}


References bufferevent\+::output.



Referenced by evhttp\+\_\+send\+\_\+reply\+\_\+chunk(), and evhttp\+\_\+send\+\_\+reply\+\_\+end().

\hypertarget{bufferevent_8h_a56a61802037478591048b4967fa15599}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+lock@{bufferevent\+\_\+lock}}
\index{bufferevent\+\_\+lock@{bufferevent\+\_\+lock}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+lock}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+lock (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a56a61802037478591048b4967fa15599}


Acquire the lock on a bufferevent. 

Has no effect if locking was not enabled with B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E. \hypertarget{bufferevent_8h_a3ebd2a56a2ef87106bf76630eb0926b6}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+pair\+\_\+get\+\_\+partner@{bufferevent\+\_\+pair\+\_\+get\+\_\+partner}}
\index{bufferevent\+\_\+pair\+\_\+get\+\_\+partner@{bufferevent\+\_\+pair\+\_\+get\+\_\+partner}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+pair\+\_\+get\+\_\+partner}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf bufferevent}$\ast$ bufferevent\+\_\+pair\+\_\+get\+\_\+partner (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a3ebd2a56a2ef87106bf76630eb0926b6}


Given one bufferevent returned by \hyperlink{bufferevent_8h_af8932010b0a590ddf9848026e8a99059}{bufferevent\+\_\+pair\+\_\+new()}, returns the other one if it still exists. 

Otherwise returns N\+U\+L\+L. \hypertarget{bufferevent_8h_af8932010b0a590ddf9848026e8a99059}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+pair\+\_\+new@{bufferevent\+\_\+pair\+\_\+new}}
\index{bufferevent\+\_\+pair\+\_\+new@{bufferevent\+\_\+pair\+\_\+new}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+pair\+\_\+new}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+pair\+\_\+new (
\begin{DoxyParamCaption}
\item[{struct {\bf event\+\_\+base} $\ast$}]{base, }
\item[{int}]{options, }
\item[{struct {\bf bufferevent} $\ast$}]{pair\mbox{[}2\mbox{]}}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_af8932010b0a590ddf9848026e8a99059}


Allocate a pair of linked bufferevents. 

The bufferevents behave as would two bufferevent\+\_\+sock instances connected to opposite ends of a socketpair(), except that no internal socketpair is allocated.


\begin{DoxyParams}{Parameters}
{\em base} & The event base to associate with the socketpair. \\
\hline
{\em options} & A set of options for this bufferevent \\
\hline
{\em pair} & A pointer to an array to hold the two new bufferevent objects. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 on failure. 
\end{DoxyReturn}


References B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+D\+E\+F\+E\+R\+\_\+\+C\+A\+L\+L\+B\+A\+C\+K\+S, B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E, bufferevent\+\_\+free(), evbuffer\+\_\+freeze(), and bufferevent\+\_\+private\+::lock.

\hypertarget{bufferevent_8h_a73e1daaa7c4d52c95b16c9944fa62e90}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+priority\+\_\+set@{bufferevent\+\_\+priority\+\_\+set}}
\index{bufferevent\+\_\+priority\+\_\+set@{bufferevent\+\_\+priority\+\_\+set}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+priority\+\_\+set}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+priority\+\_\+set (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{int}]{pri}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a73e1daaa7c4d52c95b16c9944fa62e90}


Assign a priority to a bufferevent. 

Only supported for socket bufferevents.


\begin{DoxyParams}{Parameters}
{\em bufev} & a bufferevent struct \\
\hline
{\em pri} & the priority to be assigned \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred 
\end{DoxyReturn}


References bufferevent\+::be\+\_\+ops, bufferevent\+::ev\+\_\+read, bufferevent\+::ev\+\_\+write, and event\+\_\+priority\+\_\+set().

\hypertarget{bufferevent_8h_adf4304c0c47fedb8122700ce1f0def8b}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free}}
\index{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+free (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$}]{}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_adf4304c0c47fedb8122700ce1f0def8b}


Free a rate-\/limiting group. 

The group must have no members when this function is called. 

References event\+\_\+del(), E\+V\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K\+T\+Y\+P\+E\+\_\+\+R\+E\+C\+U\+R\+S\+I\+V\+E, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::lock, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::master\+\_\+refill\+\_\+event, and bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::n\+\_\+members.

\hypertarget{bufferevent_8h_a4fec52eebbe5f925dfc2eaa60100124d}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals}}
\index{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+get\+\_\+totals (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$}]{grp, }
\item[{ev\+\_\+uint64\+\_\+t $\ast$}]{total\+\_\+read\+\_\+out, }
\item[{ev\+\_\+uint64\+\_\+t $\ast$}]{total\+\_\+written\+\_\+out}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a4fec52eebbe5f925dfc2eaa60100124d}


Inspect the total bytes read/written on a group. 

Set the variable pointed to by total\+\_\+read\+\_\+out to the total number of bytes ever read on grp, and the variable pointed to by total\+\_\+written\+\_\+out to the total number of bytes ever written on grp. 

References bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::total\+\_\+read.

\hypertarget{bufferevent_8h_acf75d7e04a54e7fe4543f7efd596e7f7}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new}}
\index{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group}$\ast$ bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+new (
\begin{DoxyParamCaption}
\item[{struct {\bf event\+\_\+base} $\ast$}]{base, }
\item[{const struct {\bf ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$}]{cfg}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_acf75d7e04a54e7fe4543f7efd596e7f7}


Create a new rate-\/limit group for bufferevents. 

A rate-\/limit group constrains the maximum number of bytes sent and received, in toto, by all of its bufferevents.


\begin{DoxyParams}{Parameters}
{\em base} & An \hyperlink{structevent__base}{event\+\_\+base} to run any necessary timeouts for the group. Note that all bufferevents in the group do not necessarily need to share this \hyperlink{structevent__base}{event\+\_\+base}. \\
\hline
{\em cfg} & The rate-\/limit for this group.\\
\hline
\end{DoxyParams}
Note that all rate-\/limits hare are currently best-\/effort\+: future versions of Libevent may implement them more tightly.

Note also that only some bufferevent types currently respect rate-\/limiting. They are\+: socket-\/based bufferevents (normal and I\+O\+C\+P-\/based), and S\+S\+L-\/based bufferevents. 

References E\+V\+\_\+\+P\+E\+R\+S\+I\+S\+T, event\+\_\+add(), event\+\_\+assign(), event\+\_\+base\+\_\+gettimeofday\+\_\+cached(), E\+V\+T\+H\+R\+E\+A\+D\+\_\+\+L\+O\+C\+K\+T\+Y\+P\+E\+\_\+\+R\+E\+C\+U\+R\+S\+I\+V\+E, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::lock, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::master\+\_\+refill\+\_\+event, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::min\+\_\+share, and bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::rate\+\_\+limit.

\hypertarget{bufferevent_8h_a38c81c84dc02318bd34f41d84f468a98}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals}}
\index{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$}]{grp}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a38c81c84dc02318bd34f41d84f468a98}


Reset the total bytes read/written on a group. 

Reset the number of bytes read or written on grp as given by \hyperlink{bufferevent_8h_a38c81c84dc02318bd34f41d84f468a98}{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+reset\+\_\+totals()}. 

References bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::total\+\_\+read.

\hypertarget{bufferevent_8h_a9b766efb61af2cb92d24f6e4caa38a53}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg}}
\index{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+cfg (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$}]{, }
\item[{const struct {\bf ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$}]{}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a9b766efb61af2cb92d24f6e4caa38a53}


Change the rate-\/limiting settings for a given rate-\/limiting group. 

Return 0 on success, -\/1 on failure. 

References event\+\_\+add(), evutil\+\_\+timercmp, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::master\+\_\+refill\+\_\+event, bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::rate\+\_\+limit, ev\+\_\+token\+\_\+bucket\+::read\+\_\+limit, ev\+\_\+token\+\_\+bucket\+\_\+cfg\+::read\+\_\+maximum, and ev\+\_\+token\+\_\+bucket\+\_\+cfg\+::write\+\_\+maximum.

\hypertarget{bufferevent_8h_aa2499cfb56976dcf3c6b846801043214}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share}}
\index{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share@{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+\_\+set\+\_\+min\+\_\+share (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent\+\_\+rate\+\_\+limit\+\_\+group} $\ast$}]{, }
\item[{size\+\_\+t}]{}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_aa2499cfb56976dcf3c6b846801043214}


Change the smallest quantum we're willing to allocate to any single bufferevent in a group for reading or writing at a time. 

The rationale is that, because of T\+C\+P/\+I\+P protocol overheads and kernel behavior, if a rate-\/limiting group is so tight on bandwidth that you're only willing to send 1 byte per tick per bufferevent, you might instead want to batch up the reads and writes so that you send N bytes per 1/\+N of the bufferevents (chosen at random) each tick, so you still wind up send 1 byte per tick per bufferevent on average, but you don't send so many tiny packets.

The default min-\/share is currently 64 bytes.

Returns 0 on success, -\/1 on faulre. 

References bufferevent\+\_\+rate\+\_\+limit\+\_\+group\+::min\+\_\+share.

\hypertarget{bufferevent_8h_a6bd435529e20a39b24fead9ddcd966ba}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+read@{bufferevent\+\_\+read}}
\index{bufferevent\+\_\+read@{bufferevent\+\_\+read}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+read}]{\setlength{\rightskip}{0pt plus 5cm}size\+\_\+t bufferevent\+\_\+read (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{void $\ast$}]{data, }
\item[{size\+\_\+t}]{size}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a6bd435529e20a39b24fead9ddcd966ba}


Read data from a bufferevent buffer. 

The \hyperlink{bufferevent_8h_a6bd435529e20a39b24fead9ddcd966ba}{bufferevent\+\_\+read()} function is used to read data from the input buffer.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be read from \\
\hline
{\em data} & pointer to a buffer that will store the data \\
\hline
{\em size} & the size of the data buffer, in bytes \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the amount of data read, in bytes. 
\end{DoxyReturn}


References evbuffer\+\_\+remove(), and bufferevent\+::input.

\hypertarget{bufferevent_8h_ab2246fd48085c1acc9e98747a83af041}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+read\+\_\+buffer@{bufferevent\+\_\+read\+\_\+buffer}}
\index{bufferevent\+\_\+read\+\_\+buffer@{bufferevent\+\_\+read\+\_\+buffer}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+read\+\_\+buffer}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+read\+\_\+buffer (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{struct {\bf evbuffer} $\ast$}]{buf}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_ab2246fd48085c1acc9e98747a83af041}


Read data from a bufferevent buffer into an evbuffer. 

This avoids memory copies.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be read from \\
\hline
{\em buf} & the evbuffer to which to add data \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred. 
\end{DoxyReturn}


References evbuffer\+\_\+add\+\_\+buffer(), and bufferevent\+::input.

\hypertarget{bufferevent_8h_abdbf64b4203fe6b65b263661ef18c6f2}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group@{bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group}}
\index{bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group@{bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+remove\+\_\+from\+\_\+rate\+\_\+limit\+\_\+group (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_abdbf64b4203fe6b65b263661ef18c6f2}


Remove 'bev' from its current rate-\/limit group (if any). 



Referenced by bufferevent\+\_\+add\+\_\+to\+\_\+rate\+\_\+limit\+\_\+group().

\hypertarget{bufferevent_8h_aeb7bc9d8af4dd74b3de8dcd2941e6e02}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+set\+\_\+rate\+\_\+limit@{bufferevent\+\_\+set\+\_\+rate\+\_\+limit}}
\index{bufferevent\+\_\+set\+\_\+rate\+\_\+limit@{bufferevent\+\_\+set\+\_\+rate\+\_\+limit}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+set\+\_\+rate\+\_\+limit}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+set\+\_\+rate\+\_\+limit (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bev, }
\item[{struct {\bf ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$}]{cfg}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_aeb7bc9d8af4dd74b3de8dcd2941e6e02}


Set the rate-\/limit of a the bufferevent 'bev' to the one specified in 'cfg'. 

If 'cfg' is N\+U\+L\+L, disable any per-\/bufferevent rate-\/limiting on 'bev'.

Note that only some bufferevent types currently respect rate-\/limiting. They are\+: socket-\/based bufferevents (normal and I\+O\+C\+P-\/based), and S\+S\+L-\/based bufferevents.

Return 0 on sucess, -\/1 on failure. 

References bufferevent\+::ev\+\_\+base, event\+\_\+add(), event\+\_\+base\+\_\+gettimeofday\+\_\+cached(), event\+\_\+del(), event\+\_\+initialized(), bufferevent\+\_\+private\+::rate\+\_\+limiting, and ev\+\_\+token\+\_\+bucket\+::read\+\_\+limit.

\hypertarget{bufferevent_8h_a3686d744e67e9a530ebf8ab888ade2cf}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+set\+\_\+timeouts@{bufferevent\+\_\+set\+\_\+timeouts}}
\index{bufferevent\+\_\+set\+\_\+timeouts@{bufferevent\+\_\+set\+\_\+timeouts}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+set\+\_\+timeouts}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+set\+\_\+timeouts (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{const struct timeval $\ast$}]{timeout\+\_\+read, }
\item[{const struct timeval $\ast$}]{timeout\+\_\+write}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a3686d744e67e9a530ebf8ab888ade2cf}


Set the read and write timeout for a bufferevent. 

A bufferevent's timeout will fire the first time that the indicated amount of time has elapsed since a successful read or write operation, during which the bufferevent was trying to read or write.

(In other words, if reading or writing is disabled, or if the bufferevent's read or write operation has been suspended because there's no data to write, or not enough banwidth, or so on, the timeout isn't active. The timeout only becomes active when we we're willing to actually read or write.)

Calling bufferevent\+\_\+enable or setting a timeout for a bufferevent whose timeout is already pending resets its timeout.

If the timeout elapses, the corresponding operation (E\+V\+\_\+\+R\+E\+A\+D or E\+V\+\_\+\+W\+R\+I\+T\+E) becomes disabled until you re-\/enable it again. The bufferevent's event callback is called with the B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+T\+I\+M\+E\+O\+U\+T$\vert$\+B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+R\+E\+A\+D\+I\+N\+G or B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+T\+I\+M\+E\+O\+U\+T$\vert$\+B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+W\+R\+I\+T\+I\+N\+G.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be modified \\
\hline
{\em timeout\+\_\+read} & the read timeout, or N\+U\+L\+L \\
\hline
{\em timeout\+\_\+write} & the write timeout, or N\+U\+L\+L \\
\hline
\end{DoxyParams}


References bufferevent\+\_\+ops\+::adj\+\_\+timeouts, and bufferevent\+::be\+\_\+ops.

\hypertarget{bufferevent_8h_a63792519cb94a38beccb5e1390cd6198}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+setcb@{bufferevent\+\_\+setcb}}
\index{bufferevent\+\_\+setcb@{bufferevent\+\_\+setcb}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+setcb}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+setcb (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{{\bf bufferevent\+\_\+data\+\_\+cb}}]{readcb, }
\item[{{\bf bufferevent\+\_\+data\+\_\+cb}}]{writecb, }
\item[{{\bf bufferevent\+\_\+event\+\_\+cb}}]{eventcb, }
\item[{void $\ast$}]{cbarg}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a63792519cb94a38beccb5e1390cd6198}


Changes the callbacks for a bufferevent. 


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent object for which to change callbacks \\
\hline
{\em readcb} & callback to invoke when there is data to be read, or N\+U\+L\+L if no callback is desired \\
\hline
{\em writecb} & callback to invoke when the file descriptor is ready for writing, or N\+U\+L\+L if no callback is desired \\
\hline
{\em eventcb} & callback to invoke when there is an event on the file descriptor \\
\hline
{\em cbarg} & an argument that will be supplied to each of the callbacks (readcb, writecb, and errorcb) \\
\hline
\end{DoxyParams}
\begin{DoxySeeAlso}{See also}
bufferevent\+\_\+new() 
\end{DoxySeeAlso}


Referenced by bufferevent\+\_\+filter\+\_\+new(), and bufferevent\+\_\+free().

\hypertarget{bufferevent_8h_a0a367e404942c11265bfcd0b693aa120}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+setfd@{bufferevent\+\_\+setfd}}
\index{bufferevent\+\_\+setfd@{bufferevent\+\_\+setfd}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+setfd}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+setfd (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{{\bf evutil\+\_\+socket\+\_\+t}}]{fd}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a0a367e404942c11265bfcd0b693aa120}


Changes the file descriptor on which the bufferevent operates. 

Not supported for all bufferevent types.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent object for which to change the file descriptor \\
\hline
{\em fd} & the file descriptor to operate on \\
\hline
\end{DoxyParams}


References bufferevent\+::be\+\_\+ops, and bufferevent\+\_\+ops\+::ctrl.



Referenced by bufferevent\+\_\+socket\+\_\+connect().

\hypertarget{bufferevent_8h_a74e3835e99f8eb73bb1cd7afa7427049}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+setwatermark@{bufferevent\+\_\+setwatermark}}
\index{bufferevent\+\_\+setwatermark@{bufferevent\+\_\+setwatermark}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+setwatermark}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+setwatermark (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{short}]{events, }
\item[{size\+\_\+t}]{lowmark, }
\item[{size\+\_\+t}]{highmark}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a74e3835e99f8eb73bb1cd7afa7427049}


Sets the watermarks for read and write events. 

On input, a bufferevent does not invoke the user read callback unless there is at least low watermark data in the buffer. If the read buffer is beyond the high watermark, the bufferevent stops reading from the network.

On output, the user write callback is invoked whenever the buffered data falls below the low watermark. Filters that write to this bufev will try not to write more bytes to this buffer than the high watermark would allow, except when flushing.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be modified \\
\hline
{\em events} & E\+V\+\_\+\+R\+E\+A\+D, E\+V\+\_\+\+W\+R\+I\+T\+E or both \\
\hline
{\em lowmark} & the lower watermark to set \\
\hline
{\em highmark} & the high watermark to set \\
\hline
\end{DoxyParams}


References bufferevent\+\_\+private\+::bev, E\+V\+\_\+\+R\+E\+A\+D, E\+V\+\_\+\+W\+R\+I\+T\+E, evbuffer\+\_\+add\+\_\+cb(), evbuffer\+\_\+cb\+\_\+clear\+\_\+flags(), E\+V\+B\+U\+F\+F\+E\+R\+\_\+\+C\+B\+\_\+\+E\+N\+A\+B\+L\+E\+D, evbuffer\+\_\+cb\+\_\+set\+\_\+flags(), evbuffer\+\_\+get\+\_\+length(), bufferevent\+::input, and bufferevent\+\_\+private\+::read\+\_\+watermarks\+\_\+cb.

\hypertarget{bufferevent_8h_ac2ecbb906883ea848f7bca767d479a2a}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+socket\+\_\+connect@{bufferevent\+\_\+socket\+\_\+connect}}
\index{bufferevent\+\_\+socket\+\_\+connect@{bufferevent\+\_\+socket\+\_\+connect}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+socket\+\_\+connect}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+socket\+\_\+connect (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{, }
\item[{struct sockaddr $\ast$}]{, }
\item[{int}]{}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_ac2ecbb906883ea848f7bca767d479a2a}


Launch a connect() attempt with a socket-\/based bufferevent. 

When the connect succeeds, the eventcb will be invoked with B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D set.

If the bufferevent does not already have a socket set, we allocate a new socket here and make it nonblocking before we begin.

If no address is provided, we assume that the socket is already connecting, and configure the bufferevent so that a B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+C\+O\+N\+N\+E\+C\+T\+E\+D event will be yielded when it is done connecting.


\begin{DoxyParams}{Parameters}
{\em bufev} & an existing bufferevent allocated with \hyperlink{bufferevent_8h_a501557193aa56c9f4923583d9d734395}{bufferevent\+\_\+socket\+\_\+new()}. \\
\hline
{\em addr} & the address we should connect to \\
\hline
{\em socklen} & The length of the address \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 on success, -\/1 on failure. 
\end{DoxyReturn}


References B\+E\+V\+\_\+\+E\+V\+E\+N\+T\+\_\+\+E\+R\+R\+O\+R, bufferevent\+\_\+getfd(), bufferevent\+\_\+setfd(), bufferevent\+\_\+private\+::connecting, bufferevent\+\_\+private\+::connection\+\_\+refused, bufferevent\+::ev\+\_\+base, E\+V\+\_\+\+P\+E\+R\+S\+I\+S\+T, bufferevent\+::ev\+\_\+write, E\+V\+\_\+\+W\+R\+I\+T\+E, event\+\_\+active(), event\+\_\+assign(), evutil\+\_\+closesocket(), evutil\+\_\+make\+\_\+socket\+\_\+nonblocking(), and evutil\+\_\+socket\+\_\+t.

\hypertarget{bufferevent_8h_a797686b522045aefb217c6b87ea7ae4a}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname@{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname}}
\index{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname@{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{, }
\item[{struct {\bf evdns\+\_\+base} $\ast$}]{, }
\item[{int}]{, }
\item[{const char $\ast$}]{, }
\item[{int}]{}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a797686b522045aefb217c6b87ea7ae4a}


Resolve the hostname 'hostname' and connect to it as with \hyperlink{bufferevent_8h_ac2ecbb906883ea848f7bca767d479a2a}{bufferevent\+\_\+socket\+\_\+connect()}. 


\begin{DoxyParams}{Parameters}
{\em bufev} & An existing bufferevent allocated with \hyperlink{bufferevent_8h_a501557193aa56c9f4923583d9d734395}{bufferevent\+\_\+socket\+\_\+new()} \\
\hline
{\em \hyperlink{structevdns__base}{evdns\+\_\+base}} & Optionally, an \hyperlink{structevdns__base}{evdns\+\_\+base} to use for resolving hostnames asynchronously. May be set to N\+U\+L\+L for a blocking resolve. \\
\hline
{\em family} & A preferred address family to resolve addresses to, or A\+F\+\_\+\+U\+N\+S\+P\+E\+C for no preference. Only A\+F\+\_\+\+I\+N\+E\+T, A\+F\+\_\+\+I\+N\+E\+T6, and A\+F\+\_\+\+U\+N\+S\+P\+E\+C are supported. \\
\hline
{\em hostname} & The hostname to resolve; see below for notes on recognized formats \\
\hline
{\em port} & The port to connect to on the resolved address. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, -\/1 on failure.
\end{DoxyReturn}
Recognized hostname formats are\+: \begin{DoxyVerb}www.example.com     (hostname)
1.2.3.4             (ipv4address)
::1         (ipv6address)
[::1]               ([ipv6address])
\end{DoxyVerb}


Performance note\+: If you do not provide an \hyperlink{structevdns__base}{evdns\+\_\+base}, this function may block while it waits for a D\+N\+S response. This is probably not what you want. 

References bufferevent\+\_\+private\+::dns\+\_\+error, and evutil\+\_\+snprintf().

\hypertarget{bufferevent_8h_a9a66b02bce652cdbcc7d26636ce26d67}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error@{bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error}}
\index{bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error@{bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+socket\+\_\+get\+\_\+dns\+\_\+error (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a9a66b02bce652cdbcc7d26636ce26d67}


Return the error code for the last failed D\+N\+S lookup attempt made by \hyperlink{bufferevent_8h_a797686b522045aefb217c6b87ea7ae4a}{bufferevent\+\_\+socket\+\_\+connect\+\_\+hostname()}. 


\begin{DoxyParams}{Parameters}
{\em bev} & The bufferevent object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
D\+N\+S error code. 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
evutil\+\_\+gai\+\_\+strerror() 
\end{DoxySeeAlso}


References bufferevent\+\_\+private\+::dns\+\_\+error.

\hypertarget{bufferevent_8h_a501557193aa56c9f4923583d9d734395}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+socket\+\_\+new@{bufferevent\+\_\+socket\+\_\+new}}
\index{bufferevent\+\_\+socket\+\_\+new@{bufferevent\+\_\+socket\+\_\+new}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+socket\+\_\+new}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf bufferevent}$\ast$ bufferevent\+\_\+socket\+\_\+new (
\begin{DoxyParamCaption}
\item[{struct {\bf event\+\_\+base} $\ast$}]{base, }
\item[{{\bf evutil\+\_\+socket\+\_\+t}}]{fd, }
\item[{int}]{options}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a501557193aa56c9f4923583d9d734395}


Create a new socket bufferevent over an existing socket. 


\begin{DoxyParams}{Parameters}
{\em base} & the event base to associate with the new bufferevent. \\
\hline
{\em fd} & the file descriptor from which data is read and written to. This file descriptor is not allowed to be a pipe(2). It is safe to set the fd to -\/1, so long as you later set it with bufferevent\+\_\+setfd or \hyperlink{bufferevent_8h_ac2ecbb906883ea848f7bca767d479a2a}{bufferevent\+\_\+socket\+\_\+connect()}. \\
\hline
{\em options} & Zero or more B\+E\+V\+\_\+\+O\+P\+T\+\_\+$\ast$ flags \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a pointer to a newly allocated bufferevent struct, or N\+U\+L\+L if an error occurred 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{bufferevent_8h_a474a4cef8fd80bea09a636b5f3055bec}{bufferevent\+\_\+free()} 
\end{DoxySeeAlso}


References bufferevent\+\_\+private\+::bev, bufferevent\+::ev\+\_\+base, E\+V\+\_\+\+P\+E\+R\+S\+I\+S\+T, bufferevent\+::ev\+\_\+read, E\+V\+\_\+\+R\+E\+A\+D, bufferevent\+::ev\+\_\+write, E\+V\+\_\+\+W\+R\+I\+T\+E, evbuffer\+\_\+add\+\_\+cb(), evbuffer\+\_\+freeze(), event\+\_\+assign(), bufferevent\+::input, and bufferevent\+::output.

\hypertarget{bufferevent_8h_a53fd135567d95cab72b8bad473c97510}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+unlock@{bufferevent\+\_\+unlock}}
\index{bufferevent\+\_\+unlock@{bufferevent\+\_\+unlock}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+unlock}]{\setlength{\rightskip}{0pt plus 5cm}void bufferevent\+\_\+unlock (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a53fd135567d95cab72b8bad473c97510}


Release the lock on a bufferevent. 

Has no effect if locking was not enabled with B\+E\+V\+\_\+\+O\+P\+T\+\_\+\+T\+H\+R\+E\+A\+D\+S\+A\+F\+E. \hypertarget{bufferevent_8h_abc606695cd6bb2e3f25c4330d0c9e3ab}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+write@{bufferevent\+\_\+write}}
\index{bufferevent\+\_\+write@{bufferevent\+\_\+write}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+write}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+write (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{const void $\ast$}]{data, }
\item[{size\+\_\+t}]{size}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_abc606695cd6bb2e3f25c4330d0c9e3ab}


Write data to a bufferevent buffer. 

The \hyperlink{bufferevent_8h_abc606695cd6bb2e3f25c4330d0c9e3ab}{bufferevent\+\_\+write()} function can be used to write data to the file descriptor. The data is appended to the output buffer and written to the descriptor automatically as it becomes available for writing.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be written to \\
\hline
{\em data} & a pointer to the data to be written \\
\hline
{\em size} & the length of the data, in bytes \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{bufferevent_8h_a3b140a32a4d16c402433130dc8c3bde4}{bufferevent\+\_\+write\+\_\+buffer()} 
\end{DoxySeeAlso}


References evbuffer\+\_\+add(), and bufferevent\+::output.

\hypertarget{bufferevent_8h_a3b140a32a4d16c402433130dc8c3bde4}{\index{bufferevent.\+h@{bufferevent.\+h}!bufferevent\+\_\+write\+\_\+buffer@{bufferevent\+\_\+write\+\_\+buffer}}
\index{bufferevent\+\_\+write\+\_\+buffer@{bufferevent\+\_\+write\+\_\+buffer}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{bufferevent\+\_\+write\+\_\+buffer}]{\setlength{\rightskip}{0pt plus 5cm}int bufferevent\+\_\+write\+\_\+buffer (
\begin{DoxyParamCaption}
\item[{struct {\bf bufferevent} $\ast$}]{bufev, }
\item[{struct {\bf evbuffer} $\ast$}]{buf}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a3b140a32a4d16c402433130dc8c3bde4}


Write data from an evbuffer to a bufferevent buffer. 

The evbuffer is being drained as a result.


\begin{DoxyParams}{Parameters}
{\em bufev} & the bufferevent to be written to \\
\hline
{\em buf} & the evbuffer to be written \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 if successful, or -\/1 if an error occurred 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{bufferevent_8h_abc606695cd6bb2e3f25c4330d0c9e3ab}{bufferevent\+\_\+write()} 
\end{DoxySeeAlso}


References evbuffer\+\_\+add\+\_\+buffer(), and bufferevent\+::output.

\hypertarget{bufferevent_8h_ad918ea1e7f7967e5db895c7dde5b78ae}{\index{bufferevent.\+h@{bufferevent.\+h}!ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free@{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free}}
\index{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free@{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free}]{\setlength{\rightskip}{0pt plus 5cm}void ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+free (
\begin{DoxyParamCaption}
\item[{struct {\bf ev\+\_\+token\+\_\+bucket\+\_\+cfg} $\ast$}]{cfg}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_ad918ea1e7f7967e5db895c7dde5b78ae}


Free all storage held in 'cfg'. 

Note\+: 'cfg' is not currently reference-\/counted; it is not safe to free it until no bufferevent is using it. \hypertarget{bufferevent_8h_a60dd9d6469537b9099d2f6299c114ae6}{\index{bufferevent.\+h@{bufferevent.\+h}!ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new@{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new}}
\index{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new@{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new}!bufferevent.\+h@{bufferevent.\+h}}
\subsubsection[{ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new}]{\setlength{\rightskip}{0pt plus 5cm}struct {\bf ev\+\_\+token\+\_\+bucket\+\_\+cfg}$\ast$ ev\+\_\+token\+\_\+bucket\+\_\+cfg\+\_\+new (
\begin{DoxyParamCaption}
\item[{size\+\_\+t}]{read\+\_\+rate, }
\item[{size\+\_\+t}]{read\+\_\+burst, }
\item[{size\+\_\+t}]{write\+\_\+rate, }
\item[{size\+\_\+t}]{write\+\_\+burst, }
\item[{const struct timeval $\ast$}]{tick\+\_\+len}
\end{DoxyParamCaption}
)}}\label{bufferevent_8h_a60dd9d6469537b9099d2f6299c114ae6}


Initialize and return a new object to configure the rate-\/limiting behavior of bufferevents. 


\begin{DoxyParams}{Parameters}
{\em read\+\_\+rate} & The maximum number of bytes to read per tick on average. \\
\hline
{\em read\+\_\+burst} & The maximum number of bytes to read in any single tick. \\
\hline
{\em write\+\_\+rate} & The maximum number of bytes to write per tick on average. \\
\hline
{\em write\+\_\+burst} & The maximum number of bytes to write in any single tick. \\
\hline
{\em tick\+\_\+len} & The length of a single tick. Defaults to one second. Any fractions of a millisecond are ignored.\\
\hline
\end{DoxyParams}
Note that all rate-\/limits hare are currently best-\/effort\+: future versions of Libevent may implement them more tightly. 

References E\+V\+\_\+\+R\+A\+T\+E\+\_\+\+L\+I\+M\+I\+T\+\_\+\+M\+A\+X, ev\+\_\+token\+\_\+bucket\+\_\+cfg\+::read\+\_\+maximum, ev\+\_\+token\+\_\+bucket\+\_\+cfg\+::read\+\_\+rate, ev\+\_\+token\+\_\+bucket\+\_\+cfg\+::write\+\_\+maximum, and ev\+\_\+token\+\_\+bucket\+\_\+cfg\+::write\+\_\+rate.

