Lines Matching defs:evbuffer
35 An evbuffer can be used for preparing data before sending it to
41 A new evbuffer can be allocated with evbuffer_new(), and can be
69 As the contents of an evbuffer can be stored in multiple different
94 An evbuffer is an opaque data type for efficiently buffering data to be
99 struct evbuffer
106 Pointer to a position within an evbuffer.
129 /** Describes a single extent of memory inside an evbuffer. Used for
148 Allocate storage for a new evbuffer.
150 @return a pointer to a newly allocated evbuffer struct, or NULL if an error
154 struct evbuffer *evbuffer_new(void);
156 Deallocate storage for an evbuffer.
158 @param buf pointer to the evbuffer to be freed
161 void evbuffer_free(struct evbuffer *buf);
164 Enable locking on an evbuffer so that it can safely be used by multiple
171 @param buf An evbuffer to make lockable.
176 int evbuffer_enable_locking(struct evbuffer *buf, void *lock);
179 Acquire the lock on an evbuffer. Has no effect if locking was not enabled
183 void evbuffer_lock(struct evbuffer *buf);
186 Release the lock on an evbuffer. Has no effect if locking was not enabled
190 void evbuffer_unlock(struct evbuffer *buf);
210 /** Change the flags that are set for an evbuffer by adding more.
212 * @param buffer the evbuffer that the callback is watching.
218 int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
219 /** Change the flags that are set for an evbuffer by removing some.
221 * @param buffer the evbuffer that the callback is watching.
227 int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
230 Returns the total number of bytes stored in the evbuffer
232 @param buf pointer to the evbuffer
233 @return the number of bytes stored in the evbuffer
236 size_t evbuffer_get_length(const struct evbuffer *buf);
246 @param buf pointer to the evbuffer
251 size_t evbuffer_get_contiguous_space(const struct evbuffer *buf);
254 Expands the available space in an evbuffer.
256 Expands the available space in the evbuffer to at least datlen, so that
259 @param buf the evbuffer to be expanded
264 int evbuffer_expand(struct evbuffer *buf, size_t datlen);
267 Reserves space in the last chain or chains of an evbuffer.
269 Makes space available in the last chain or chains of an evbuffer that can
288 @param buf the evbuffer in which to reserve space.
301 evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
319 @param buf the evbuffer in which to reserve space.
326 int evbuffer_commit_space(struct evbuffer *buf,
330 Append data to the end of an evbuffer.
332 @param buf the evbuffer to be appended to
338 int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen);
342 Read data from an evbuffer and drain the bytes read.
344 If more bytes are requested than are available in the evbuffer, we
347 @param buf the evbuffer to be read from
353 int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen);
356 Read data from an evbuffer, and leave the buffer unchanged.
358 If more bytes are requested than are available in the evbuffer, we
361 @param buf the evbuffer to be read from
367 ev_ssize_t evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen);
370 Read data from the middle of an evbuffer, and leave the buffer unchanged.
372 If more bytes are requested than are available in the evbuffer, we
375 @param buf the evbuffer to be read from
382 ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos, void *data_out, size_t datlen);
385 Read data from an evbuffer into another evbuffer, draining
392 @param src the evbuffer to be read from
393 @param dst the destination evbuffer to store the result into
398 int evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
426 * Read a single line from an evbuffer.
432 * @param buffer the evbuffer to read from
440 char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
444 Move all data from one evbuffer into another evbuffer.
456 evbuffer *outbuf, struct evbuffer *inbuf);
459 Copy data from one evbuffer into another evbuffer.
472 int evbuffer_add_buffer_reference(struct evbuffer *outbuf,
473 struct evbuffer *inbuf);
476 A cleanup function for a piece of memory added to an evbuffer by
485 Reference memory into an evbuffer without copying.
495 referenced by this evbuffer.
500 int evbuffer_add_reference(struct evbuffer *outbuf,
505 Copy data from a file into the evbuffer for writing to a socket.
529 int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset,
534 possibly the whole file! -- for use in writing from an evbuffer to a
538 evbuffer.
545 evbuffer, the underlying fd is closed.
558 evbuffer by any means other than writing it to the network: the sendfile
566 evbuffer it is added to may ever be accessed from more than one thread
572 A cleanup function for a evbuffer_file_segment added to an evbuffer
580 file and sending it out via an evbuffer.
585 The file descriptor must not be closed so long as any evbuffer is using
589 function that reads bytes from an evbuffer on any evbuffer containing
626 Insert some or all of an evbuffer_file_segment at the end of an evbuffer
632 segment to an evbuffer, the offset is _within the segment_ and the
641 @param buf the evbuffer to append to
648 int evbuffer_add_file_segment(struct evbuffer *buf,
652 Append a formatted string to the end of an evbuffer.
656 @param buf the evbuffer that will be appended to
664 int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
671 Append a va_list formatted string to the end of an evbuffer.
673 @param buf the evbuffer that will be appended to
679 int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
687 Remove a specified number of bytes data from the beginning of an evbuffer.
689 @param buf the evbuffer to be drained
694 int evbuffer_drain(struct evbuffer *buf, size_t len);
698 Write the contents of an evbuffer to a file descriptor.
700 The evbuffer will be drained after the bytes have been successfully written.
702 @param buffer the evbuffer to be written and drained
708 int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd);
711 Write some of the contents of an evbuffer to a file descriptor.
713 The evbuffer will be drained after the bytes have been successfully written.
715 @param buffer the evbuffer to be written and drained
723 int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
727 Read from a file descriptor and store the result in an evbuffer.
729 @param buffer the evbuffer to store the result
737 int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
740 Search for a string within an evbuffer.
742 @param buffer the evbuffer to be searched
751 struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start);
754 Search for a string within part of an evbuffer.
756 @param buffer the evbuffer to be searched
768 struct evbuffer_ptr evbuffer_search_range(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start, const struct evbuffer_ptr *end);
797 @param buffer the evbuffer to be search
805 evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr,
809 Search for an end-of-line string within an evbuffer.
811 @param buffer the evbuffer to be searched
823 struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer,
827 /** Function to peek at data inside an evbuffer without removing it or
838 @param buffer the evbuffer to peek into,
856 int evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
861 /** Structure passed to an evbuffer_cb_func evbuffer callback
866 /** The number of bytes in this evbuffer when callbacks were last
876 removed from an evbuffer.
878 An evbuffer may have one or more callbacks set at a time. The order
894 typedef void (*evbuffer_cb_func)(struct evbuffer *buffer, const struct evbuffer_cb_info *info, void *arg);
897 /** Add a new callback to an evbuffer.
902 @param buffer the evbuffer to be monitored
903 @param cb the callback function to invoke when the evbuffer is modified,
909 struct evbuffer_cb_entry *evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
911 /** Remove a callback from an evbuffer, given a handle returned from
920 int evbuffer_remove_cb_entry(struct evbuffer *buffer,
923 /** Remove a callback from an evbuffer, given the function and argument
930 int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
941 @param buffer the evbuffer that the callback is watching.
947 int evbuffer_cb_set_flags(struct evbuffer *buffer,
952 @param buffer the evbuffer that the callback is watching.
958 int evbuffer_cb_clear_flags(struct evbuffer *buffer,
972 void evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
982 void evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
986 Makes the data at the beginning of an evbuffer contiguous.
988 @param buf the evbuffer to make contiguous
996 unsigned char *evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size);
999 Prepends data to the beginning of the evbuffer
1001 @param buf the evbuffer to which to prepend data
1008 int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size);
1011 Prepends all data from the src evbuffer to the beginning of the dst
1012 evbuffer.
1014 @param dst the evbuffer to which to prepend data
1015 @param src the evbuffer to prepend; it will be emptied as a result
1019 int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
1022 Prevent calls that modify an evbuffer from succeeding. A buffer may
1036 int evbuffer_freeze(struct evbuffer *buf, int at_front);
1038 Re-enable calls that modify an evbuffer.
1046 int evbuffer_unfreeze(struct evbuffer *buf, int at_front);
1050 Force all the callbacks on an evbuffer to be run, not immediately after
1051 the evbuffer is altered, but instead from inside the event loop.
1057 int evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base);
1060 Append data from 1 or more iovec's to an evbuffer
1073 size_t evbuffer_add_iovec(struct evbuffer * buffer, struct evbuffer_iovec * vec, int n_vec);