1 2 #ifndef _EVENT2_BUFFER_COMPAT_H_ 3 #define _EVENT2_BUFFER_COMPAT_H_ 4 5 /** @file buffer_compat.h 6 7 Obsolete and deprecated versions of the functions in buffer.h: provided 8 only for backward compatibility. 9 */ 10 11 12 /** 13 Obsolete alias for evbuffer_readln(buffer, NULL, EOL_STYLE_ANY). 14 15 @deprecated This function is deprecated because its behavior is not correct 16 for almost any protocol, and also because it's wholly subsumed by 17 evbuffer_readln(). 18 19 @param buffer the evbuffer to read from 20 @return pointer to a single line, or NULL if an error occurred 21 22 */ 23 char *evbuffer_readline(struct evbuffer *buffer); 24 25 /** 26 Replace all callbacks on an evbuffer with a single new callback, or 27 remove them. 28 29 Subsequent calls to evbuffer_setcb() replace callbacks set by previous 30 calls. Setting the callback to NULL removes any previously set callback. 31 32 @deprecated This function is deprecated because it clears all previous 33 callbacks set on the evbuffer, which can cause confusing behavior if 34 multiple parts of the code all want to add their own callbacks on a 35 buffer. Instead, use evbuffer_add(), evbuffer_del(), and 36 evbuffer_setflags() to manage your own evbuffer callbacks without 37 interfering with callbacks set by others. 38 39 @param buffer the evbuffer to be monitored 40 @param cb the callback function to invoke when the evbuffer is modified, 41 or NULL to remove all callbacks. 42 @param cbarg an argument to be provided to the callback function 43 */ 44 void evbuffer_setcb(struct evbuffer *buffer, evbuffer_cb cb, void *cbarg); 45 46 47 /** 48 Find a string within an evbuffer. 49 50 @param buffer the evbuffer to be searched 51 @param what the string to be searched for 52 @param len the length of the search string 53 @return a pointer to the beginning of the search string, or NULL if the search failed. 54 */ 55 unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what, size_t len); 56 57 #endif 58 59