1 .TH "event2/buffer_compat.h" 3 "Tue Jan 27 2015" "libevent" \" -*- nroff -*-
5 event2/buffer_compat.h \-
7 Obsolete and deprecated versions of the functions in \fBbuffer\&.h\fP: provided only for backward compatibility\&.
16 .RI "#define \fBEVBUFFER_DATA\fP(x) \fBevbuffer_pullup\fP((x), -1)"
18 .RI "\fIdeprecated in favor of calling the functions directly \fP"
20 .RI "#define \fBEVBUFFER_LENGTH\fP(x) \fBevbuffer_get_length\fP(x)"
22 .RI "\fIdeprecated in favor of calling the functions directly \fP"
28 .RI "typedef void(* \fBevbuffer_cb\fP )(struct \fBevbuffer\fP *buffer, size_t old_len, size_t new_len, void *arg)"
30 .RI "\fIType definition for a callback that is invoked whenever data is added or removed from an evbuffer\&. \fP"
36 .RI "unsigned char * \fBevbuffer_find\fP (struct \fBevbuffer\fP *buffer, const unsigned char *what, size_t len)"
38 .RI "\fIFind a string within an evbuffer\&. \fP"
40 .RI "char * \fBevbuffer_readline\fP (struct \fBevbuffer\fP *buffer)"
42 .RI "\fIObsolete alias for evbuffer_readln(buffer, NULL, EOL_STYLE_ANY)\&. \fP"
44 .RI "void \fBevbuffer_setcb\fP (struct \fBevbuffer\fP *buffer, \fBevbuffer_cb\fP cb, void *cbarg)"
46 .RI "\fIReplace all callbacks on an evbuffer with a single new callback, or remove them\&. \fP"
48 .SH "Detailed Description"
50 Obsolete and deprecated versions of the functions in \fBbuffer\&.h\fP: provided only for backward compatibility\&.
53 .SH "Typedef Documentation"
55 .SS "typedef void(* evbuffer_cb)(struct \fBevbuffer\fP *buffer, size_t old_len, size_t new_len, void *arg)"
58 Type definition for a callback that is invoked whenever data is added or removed from an evbuffer\&. An evbuffer may have one or more callbacks set at a time\&. The order in which they are executed is undefined\&.
60 A callback function may add more callbacks, or remove itself from the list of callbacks, or add or remove data from the buffer\&. It may not remove another callback from the list\&.
62 If a callback adds or removes data from the buffer or from another buffer, this can cause a recursive invocation of your callback or other callbacks\&. If you ask for an infinite loop, you might just get one: watch out!
66 \fIbuffer\fP the buffer whose size has changed
68 \fIold_len\fP the previous length of the buffer
70 \fInew_len\fP the current length of the buffer
72 \fIarg\fP a pointer to user data
76 .SH "Function Documentation"
78 .SS "unsigned char* evbuffer_find (struct \fBevbuffer\fP *buffer, const unsigned char *what, size_tlen)"
81 Find a string within an evbuffer\&.
85 \fIbuffer\fP the evbuffer to be searched
87 \fIwhat\fP the string to be searched for
89 \fIlen\fP the length of the search string
94 a pointer to the beginning of the search string, or NULL if the search failed\&.
98 .SS "char* evbuffer_readline (struct \fBevbuffer\fP *buffer)"
101 Obsolete alias for evbuffer_readln(buffer, NULL, EOL_STYLE_ANY)\&.
105 This function is deprecated because its behavior is not correct for almost any protocol, and also because it's wholly subsumed by \fBevbuffer_readln()\fP\&.
111 \fIbuffer\fP the evbuffer to read from
116 pointer to a single line, or NULL if an error occurred
120 .SS "void evbuffer_setcb (struct \fBevbuffer\fP *buffer, \fBevbuffer_cb\fPcb, void *cbarg)"
123 Replace all callbacks on an evbuffer with a single new callback, or remove them\&. Subsequent calls to \fBevbuffer_setcb()\fP replace callbacks set by previous calls\&. Setting the callback to NULL removes any previously set callback\&.
127 This function is deprecated because it clears all previous callbacks set on the evbuffer, which can cause confusing behavior if multiple parts of the code all want to add their own callbacks on a buffer\&. Instead, use \fBevbuffer_add()\fP, evbuffer_del(), and evbuffer_setflags() to manage your own evbuffer callbacks without interfering with callbacks set by others\&.
133 \fIbuffer\fP the evbuffer to be monitored
135 \fIcb\fP the callback function to invoke when the evbuffer is modified, or NULL to remove all callbacks\&.
137 \fIcbarg\fP an argument to be provided to the callback function
143 Generated automatically by Doxygen for libevent from the source code\&.