Lines Matching defs:evbuffer
34 An evbuffer can be used for preparing data before sending it to
40 A new evbuffer can be allocated with evbuffer_new(), and can be
68 As the contents of an evbuffer can be stored in multiple different
93 An evbuffer is an opaque data type for efficiently buffering data to be
98 struct evbuffer
105 Pointer to a position within an evbuffer.
128 /** Describes a single extent of memory inside an evbuffer. Used for
147 Allocate storage for a new evbuffer.
149 @return a pointer to a newly allocated evbuffer struct, or NULL if an error
153 struct evbuffer *evbuffer_new(void);
155 Deallocate storage for an evbuffer.
157 @param buf pointer to the evbuffer to be freed
160 void evbuffer_free(struct evbuffer *buf);
163 Enable locking on an evbuffer so that it can safely be used by multiple
170 @param buf An evbuffer to make lockable.
175 int evbuffer_enable_locking(struct evbuffer *buf, void *lock);
178 Acquire the lock on an evbuffer. Has no effect if locking was not enabled
182 void evbuffer_lock(struct evbuffer *buf);
185 Release the lock on an evbuffer. Has no effect if locking was not enabled
189 void evbuffer_unlock(struct evbuffer *buf);
209 /** Change the flags that are set for an evbuffer by adding more.
211 * @param buffer the evbuffer that the callback is watching.
217 int evbuffer_set_flags(struct evbuffer *buf, ev_uint64_t flags);
218 /** Change the flags that are set for an evbuffer by removing some.
220 * @param buffer the evbuffer that the callback is watching.
226 int evbuffer_clear_flags(struct evbuffer *buf, ev_uint64_t flags);
229 Returns the total number of bytes stored in the evbuffer
231 @param buf pointer to the evbuffer
232 @return the number of bytes stored in the evbuffer
235 size_t evbuffer_get_length(const struct evbuffer *buf);
245 @param buf pointer to the evbuffer
250 size_t evbuffer_get_contiguous_space(const struct evbuffer *buf);
253 Expands the available space in an evbuffer.
255 Expands the available space in the evbuffer to at least datlen, so that
258 @param buf the evbuffer to be expanded
263 int evbuffer_expand(struct evbuffer *buf, size_t datlen);
266 Reserves space in the last chain or chains of an evbuffer.
268 Makes space available in the last chain or chains of an evbuffer that can
287 @param buf the evbuffer in which to reserve space.
300 evbuffer_reserve_space(struct evbuffer *buf, ev_ssize_t size,
318 @param buf the evbuffer in which to reserve space.
325 int evbuffer_commit_space(struct evbuffer *buf,
329 Append data to the end of an evbuffer.
331 @param buf the evbuffer to be appended to
337 int evbuffer_add(struct evbuffer *buf, const void *data, size_t datlen);
341 Read data from an evbuffer and drain the bytes read.
343 If more bytes are requested than are available in the evbuffer, we
346 @param buf the evbuffer to be read from
352 int evbuffer_remove(struct evbuffer *buf, void *data, size_t datlen);
355 Read data from an evbuffer, and leave the buffer unchanged.
357 If more bytes are requested than are available in the evbuffer, we
360 @param buf the evbuffer to be read from
366 ev_ssize_t evbuffer_copyout(struct evbuffer *buf, void *data_out, size_t datlen);
369 Read data from the middle of an evbuffer, and leave the buffer unchanged.
371 If more bytes are requested than are available in the evbuffer, we
374 @param buf the evbuffer to be read from
381 ev_ssize_t evbuffer_copyout_from(struct evbuffer *buf, const struct evbuffer_ptr *pos, void *data_out, size_t datlen);
384 Read data from an evbuffer into another evbuffer, draining
391 @param src the evbuffer to be read from
392 @param dst the destination evbuffer to store the result into
397 int evbuffer_remove_buffer(struct evbuffer *src, struct evbuffer *dst,
425 * Read a single line from an evbuffer.
431 * @param buffer the evbuffer to read from
439 char *evbuffer_readln(struct evbuffer *buffer, size_t *n_read_out,
443 Move all data from one evbuffer into another evbuffer.
455 evbuffer *outbuf, struct evbuffer *inbuf);
458 Copy data from one evbuffer into another evbuffer.
471 int evbuffer_add_buffer_reference(struct evbuffer *outbuf,
472 struct evbuffer *inbuf);
475 A cleanup function for a piece of memory added to an evbuffer by
484 Reference memory into an evbuffer without copying.
494 referenced by this evbuffer.
499 int evbuffer_add_reference(struct evbuffer *outbuf,
504 Copy data from a file into the evbuffer for writing to a socket.
528 int evbuffer_add_file(struct evbuffer *outbuf, int fd, ev_off_t offset,
533 possibly the whole file! -- for use in writing from an evbuffer to a
537 evbuffer.
544 evbuffer, the underlying fd is closed.
557 evbuffer by any means other than writing it to the network: the sendfile
565 evbuffer it is added to may ever be accessed from more than one thread
571 A cleanup function for a evbuffer_file_segment added to an evbuffer
579 file and sending it out via an evbuffer.
584 The file descriptor must not be closed so long as any evbuffer is using
588 function that reads bytes from an evbuffer on any evbuffer containing
625 Insert some or all of an evbuffer_file_segment at the end of an evbuffer
631 segment to an evbuffer, the offset is _within the segment_ and the
640 @param buf the evbuffer to append to
647 int evbuffer_add_file_segment(struct evbuffer *buf,
651 Append a formatted string to the end of an evbuffer.
655 @param buf the evbuffer that will be appended to
663 int evbuffer_add_printf(struct evbuffer *buf, const char *fmt, ...)
670 Append a va_list formatted string to the end of an evbuffer.
672 @param buf the evbuffer that will be appended to
678 int evbuffer_add_vprintf(struct evbuffer *buf, const char *fmt, va_list ap)
686 Remove a specified number of bytes data from the beginning of an evbuffer.
688 @param buf the evbuffer to be drained
693 int evbuffer_drain(struct evbuffer *buf, size_t len);
697 Write the contents of an evbuffer to a file descriptor.
699 The evbuffer will be drained after the bytes have been successfully written.
701 @param buffer the evbuffer to be written and drained
707 int evbuffer_write(struct evbuffer *buffer, evutil_socket_t fd);
710 Write some of the contents of an evbuffer to a file descriptor.
712 The evbuffer will be drained after the bytes have been successfully written.
714 @param buffer the evbuffer to be written and drained
722 int evbuffer_write_atmost(struct evbuffer *buffer, evutil_socket_t fd,
726 Read from a file descriptor and store the result in an evbuffer.
728 @param buffer the evbuffer to store the result
736 int evbuffer_read(struct evbuffer *buffer, evutil_socket_t fd, int howmuch);
739 Search for a string within an evbuffer.
741 @param buffer the evbuffer to be searched
750 struct evbuffer_ptr evbuffer_search(struct evbuffer *buffer, const char *what, size_t len, const struct evbuffer_ptr *start);
753 Search for a string within part of an evbuffer.
755 @param buffer the evbuffer to be searched
767 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);
796 @param buffer the evbuffer to be search
804 evbuffer_ptr_set(struct evbuffer *buffer, struct evbuffer_ptr *ptr,
808 Search for an end-of-line string within an evbuffer.
810 @param buffer the evbuffer to be searched
822 struct evbuffer_ptr evbuffer_search_eol(struct evbuffer *buffer,
826 /** Function to peek at data inside an evbuffer without removing it or
837 @param buffer the evbuffer to peek into,
855 int evbuffer_peek(struct evbuffer *buffer, ev_ssize_t len,
860 /** Structure passed to an evbuffer_cb_func evbuffer callback
865 /** The number of bytes in this evbuffer when callbacks were last
875 removed from an evbuffer.
877 An evbuffer may have one or more callbacks set at a time. The order
893 typedef void (*evbuffer_cb_func)(struct evbuffer *buffer, const struct evbuffer_cb_info *info, void *arg);
896 /** Add a new callback to an evbuffer.
901 @param buffer the evbuffer to be monitored
902 @param cb the callback function to invoke when the evbuffer is modified,
908 struct evbuffer_cb_entry *evbuffer_add_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
910 /** Remove a callback from an evbuffer, given a handle returned from
919 int evbuffer_remove_cb_entry(struct evbuffer *buffer,
922 /** Remove a callback from an evbuffer, given the function and argument
929 int evbuffer_remove_cb(struct evbuffer *buffer, evbuffer_cb_func cb, void *cbarg);
940 @param buffer the evbuffer that the callback is watching.
946 int evbuffer_cb_set_flags(struct evbuffer *buffer,
951 @param buffer the evbuffer that the callback is watching.
957 int evbuffer_cb_clear_flags(struct evbuffer *buffer,
971 void evbuffer_cb_suspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
981 void evbuffer_cb_unsuspend(struct evbuffer *buffer, struct evbuffer_cb_entry *cb);
985 Makes the data at the beginning of an evbuffer contiguous.
987 @param buf the evbuffer to make contiguous
995 unsigned char *evbuffer_pullup(struct evbuffer *buf, ev_ssize_t size);
998 Prepends data to the beginning of the evbuffer
1000 @param buf the evbuffer to which to prepend data
1007 int evbuffer_prepend(struct evbuffer *buf, const void *data, size_t size);
1010 Prepends all data from the src evbuffer to the beginning of the dst
1011 evbuffer.
1013 @param dst the evbuffer to which to prepend data
1014 @param src the evbuffer to prepend; it will be emptied as a result
1018 int evbuffer_prepend_buffer(struct evbuffer *dst, struct evbuffer* src);
1021 Prevent calls that modify an evbuffer from succeeding. A buffer may
1035 int evbuffer_freeze(struct evbuffer *buf, int at_front);
1037 Re-enable calls that modify an evbuffer.
1045 int evbuffer_unfreeze(struct evbuffer *buf, int at_front);
1049 Force all the callbacks on an evbuffer to be run, not immediately after
1050 the evbuffer is altered, but instead from inside the event loop.
1056 int evbuffer_defer_callbacks(struct evbuffer *buffer, struct event_base *base);
1059 Append data from 1 or more iovec's to an evbuffer
1072 size_t evbuffer_add_iovec(struct evbuffer * buffer, struct evbuffer_iovec * vec, int n_vec);