24 #if defined(APR_BUCKET_DEBUG) && !defined(APR_RING_DEBUG)
25 #define APR_RING_DEBUG
36 #if APR_HAVE_SYS_UIO_H
54 #define APR_BUCKET_BUFF_SIZE 8000
289 #ifdef APR_BUCKET_DEBUG
291 #define APR_BRIGADE_CHECK_CONSISTENCY(b) do { \
292 APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link); \
293 assert(b->p != NULL); \
294 assert(b->bucket_alloc != NULL); \
297 #define APR_BUCKET_CHECK_CONSISTENCY(e) \
298 APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)
307 #define APR_BRIGADE_CHECK_CONSISTENCY(b)
314 #define APR_BUCKET_CHECK_CONSISTENCY(e)
334 #define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
341 #define APR_BRIGADE_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link)
348 #define APR_BRIGADE_FIRST(b) APR_RING_FIRST(&(b)->list)
354 #define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
361 #define APR_BRIGADE_INSERT_HEAD(b, e) do { \
362 apr_bucket *ap__b = (e); \
363 APR_RING_INSERT_HEAD(&(b)->list, ap__b, apr_bucket, link); \
364 APR_BRIGADE_CHECK_CONSISTENCY((b)); \
372 #define APR_BRIGADE_INSERT_TAIL(b, e) do { \
373 apr_bucket *ap__b = (e); \
374 APR_RING_INSERT_TAIL(&(b)->list, ap__b, apr_bucket, link); \
375 APR_BRIGADE_CHECK_CONSISTENCY((b)); \
383 #define APR_BRIGADE_CONCAT(a, b) do { \
384 APR_RING_CONCAT(&(a)->list, &(b)->list, apr_bucket, link); \
385 APR_BRIGADE_CHECK_CONSISTENCY((a)); \
393 #define APR_BRIGADE_PREPEND(a, b) do { \
394 APR_RING_PREPEND(&(a)->list, &(b)->list, apr_bucket, link); \
395 APR_BRIGADE_CHECK_CONSISTENCY((a)); \
403 #define APR_BUCKET_INSERT_BEFORE(a, b) do { \
404 apr_bucket *ap__a = (a), *ap__b = (b); \
405 APR_RING_INSERT_BEFORE(ap__a, ap__b, link); \
406 APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
414 #define APR_BUCKET_INSERT_AFTER(a, b) do { \
415 apr_bucket *ap__a = (a), *ap__b = (b); \
416 APR_RING_INSERT_AFTER(ap__a, ap__b, link); \
417 APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
425 #define APR_BUCKET_NEXT(e) APR_RING_NEXT((e), link)
431 #define APR_BUCKET_PREV(e) APR_RING_PREV((e), link)
437 #define APR_BUCKET_REMOVE(e) APR_RING_REMOVE((e), link)
443 #define APR_BUCKET_INIT(e) APR_RING_ELEM_INIT((e), link)
451 #define APR_BUCKET_IS_METADATA(e) ((e)->type->is_metadata)
458 #define APR_BUCKET_IS_FLUSH(e) ((e)->type == &apr_bucket_type_flush)
464 #define APR_BUCKET_IS_EOS(e) ((e)->type == &apr_bucket_type_eos)
470 #define APR_BUCKET_IS_FILE(e) ((e)->type == &apr_bucket_type_file)
476 #define APR_BUCKET_IS_PIPE(e) ((e)->type == &apr_bucket_type_pipe)
482 #define APR_BUCKET_IS_SOCKET(e) ((e)->type == &apr_bucket_type_socket)
488 #define APR_BUCKET_IS_HEAP(e) ((e)->type == &apr_bucket_type_heap)
494 #define APR_BUCKET_IS_TRANSIENT(e) ((e)->type == &apr_bucket_type_transient)
500 #define APR_BUCKET_IS_IMMORTAL(e) ((e)->type == &apr_bucket_type_immortal)
507 #define APR_BUCKET_IS_MMAP(e) ((e)->type == &apr_bucket_type_mmap)
514 #define APR_BUCKET_IS_POOL(e) ((e)->type == &apr_bucket_type_pool)
556 void (*free_func)(
void *data);
651 #define APR_BUCKET_ALLOC_SIZE APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs))
663 __attribute__((nonnull(1,2)));
671 __attribute__((nonnull(1)));
685 __attribute__((nonnull(1)));
705 __attribute__((nonnull(1,2)));
720 __attribute__((nonnull(1,2)));
737 __attribute__((nonnull(1,3)));
750 __attribute__((nonnull(1,3)));
762 __attribute__((nonnull(1,2,3)));
775 __attribute__((nonnull(1,2,3,4)));
789 __attribute__((nonnull(1,2)));
801 struct iovec *vec,
int *nvec)
802 __attribute__((nonnull(1,2,3)));
816 __attribute__((nonnull(1)));
843 const
char *str, apr_size_t nbyte)
844 __attribute__((nonnull(1,4)));
858 const struct iovec *vec,
860 __attribute__((nonnull(1,4)));
873 __attribute__((nonnull(1,4)));
886 __attribute__((nonnull(1)));
899 #if defined(__GNUC__) && __GNUC__ >= 4
900 __attribute__((sentinel))
902 __attribute__((nonnull(1)))
918 const
char *fmt, ...)
919 __attribute__((format(printf,4,5)))
920 __attribute__((nonnull(1)));
935 const
char *fmt, va_list va)
936 __attribute__((nonnull(1,4)));
955 __attribute__((nonnull(1,2,5)));
985 __attribute__((nonnull(1)));
992 __attribute__((nonnull(1)));
1001 __attribute__((nonnull(2)));
1008 __attribute__((nonnull(1)));
1018 #define apr_bucket_destroy(e) do { \
1019 (e)->type->destroy((e)->data); \
1034 #define apr_bucket_delete(e) do { \
1035 APR_BUCKET_REMOVE(e); \
1036 apr_bucket_destroy(e); \
1106 #define apr_bucket_read(e,str,len,block) (e)->type->read(e, str, len, block)
1114 #define apr_bucket_setaside(e,p) (e)->type->setaside(e,p)
1126 #define apr_bucket_split(e,point) (e)->type->split(e, point)
1133 #define apr_bucket_copy(e,c) (e)->type->copy(e, c)
1370 __attribute__((nonnull(1)));
1380 __attribute__((nonnull(1)));
1390 __attribute__((nonnull(1)));
1402 __attribute__((nonnull(1,3)));
1414 __attribute__((nonnull(1,2)));
1426 __attribute__((nonnull(1,3)));
1438 __attribute__((nonnull(1,2)));
1456 void (*free_func)(
void *data),
1458 __attribute__((nonnull(1,4)));
1470 void (*free_func)(
void *data))
1471 __attribute__((nonnull(1,2)));
1486 __attribute__((nonnull(1,3,4)));
1499 __attribute__((nonnull(1,2,4)));
1515 __attribute__((nonnull(1,4)));
1529 __attribute__((nonnull(1,2)));
1540 __attribute__((nonnull(1,2)));
1549 __attribute__((nonnull(1,2)));
1559 __attribute__((nonnull(1,2)));
1569 __attribute__((nonnull(1,2)));
1592 __attribute__((nonnull(1,4,5)));
1607 __attribute__((nonnull(1,2,5)));
1617 __attribute__((nonnull(1)));
apr_bucket * apr_bucket_flush_create(apr_bucket_alloc_t *list)
apr_status_t apr_brigade_split_line(apr_bucket_brigade *bbOut, apr_bucket_brigade *bbIn, apr_read_type_e block, apr_off_t maxbytes)
struct apr_socket_t apr_socket_t
Definition: apr_network_io.h:246
apr_file_t * fd
Definition: apr_buckets.h:619
apr_status_t apr_bucket_copy_notimpl(apr_bucket *e, apr_bucket **c)
Definition: apr_buckets.h:546
apr_status_t apr_brigade_putstrs(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx,...)
apr_status_t apr_bucket_setaside_notimpl(apr_bucket *data, apr_pool_t *pool)
apr_bucket * apr_bucket_immortal_make(apr_bucket *b, const char *buf, apr_size_t nbyte)
char * base
Definition: apr_buckets.h:552
apr_status_t apr_brigade_printf(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char *fmt,...)
void * data
Definition: apr_buckets.h:244
apr_bucket * apr_bucket_eos_create(apr_bucket_alloc_t *list)
const apr_bucket_type_t apr_bucket_type_pool
apr_status_t apr_brigade_vprintf(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char *fmt, va_list va)
APR_RING_ENTRY(apr_bucket) link
int can_mmap
Definition: apr_buckets.h:626
const apr_bucket_type_t apr_bucket_type_pipe
apr_status_t apr_brigade_write(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char *str, apr_size_t nbyte)
enum apr_bucket_type_t::@0 is_metadata
apr_status_t(* setaside)(apr_bucket *e, apr_pool_t *pool)
Definition: apr_buckets.h:192
Definition: apr_buckets.h:615
apr_status_t apr_brigade_vputstrs(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, va_list va)
apr_bucket * apr_bucket_eos_make(apr_bucket *b)
apr_status_t(* read)(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block)
Definition: apr_buckets.h:176
apr_bucket_alloc_t * bucket_alloc
Definition: apr_buckets.h:275
apr_status_t(* split)(apr_bucket *e, apr_size_t point)
Definition: apr_buckets.h:203
struct apr_allocator_t apr_allocator_t
Definition: apr_allocator.h:41
apr_pool_t * readpool
Definition: apr_buckets.h:622
apr_bucket * apr_bucket_heap_create(const char *buf, apr_size_t nbyte, void(*free_func)(void *data), apr_bucket_alloc_t *list)
void apr_bucket_free(void *block)
apr_bucket * apr_bucket_socket_create(apr_socket_t *thissock, apr_bucket_alloc_t *list)
const apr_bucket_type_t apr_bucket_type_transient
apr_read_type_e
Definition: apr_buckets.h:57
apr_bucket * apr_bucket_shared_make(apr_bucket *b, void *data, apr_off_t start, apr_size_t length)
apr_pool_t * p
Definition: apr_buckets.h:264
apr_status_t apr_brigade_length(apr_bucket_brigade *bb, int read_all, apr_off_t *length)
apr_status_t apr_brigade_writev(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const struct iovec *vec, apr_size_t nvec)
apr_bucket * apr_bucket_file_create(apr_file_t *fd, apr_off_t offset, apr_size_t len, apr_pool_t *p, apr_bucket_alloc_t *list)
apr_bucket_refcount refcount
Definition: apr_buckets.h:548
apr_bucket b
Definition: apr_buckets.h:637
Definition: apr_buckets.h:258
APR Miscellaneous library routines.
apr_bucket_alloc_t * apr_bucket_alloc_create_ex(apr_allocator_t *allocator)
apr_bucket * apr_bucket_flush_make(apr_bucket *b)
apr_size_t alloc_len
Definition: apr_buckets.h:554
struct apr_bucket_alloc_t apr_bucket_alloc_t
Definition: apr_buckets.h:123
apr_bucket_refcount refcount
Definition: apr_buckets.h:604
apr_status_t apr_bucket_shared_split(apr_bucket *b, apr_size_t point)
const apr_bucket_type_t apr_bucket_type_eos
void(* free)(void *e)
Definition: apr_buckets.h:252
apr_bucket_file file
Definition: apr_buckets.h:643
const char * base
Definition: apr_buckets.h:582
Definition: apr_mmap.h:62
int apr_bucket_shared_destroy(void *data)
apr_status_t apr_bucket_file_enable_mmap(apr_bucket *b, int enabled)
struct apr_file_t apr_file_t
Definition: apr_file_io.h:216
apr_status_t apr_bucket_simple_copy(apr_bucket *a, apr_bucket **b)
APR_RING_HEAD(apr_bucket_list, apr_bucket) list
apr_pool_t * pool
Definition: apr_buckets.h:589
apr_bucket * apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm, apr_off_t start, apr_size_t length)
const apr_bucket_type_t apr_bucket_type_immortal
apr_bucket * apr_bucket_heap_make(apr_bucket *b, const char *buf, apr_size_t nbyte, void(*free_func)(void *data))
const apr_bucket_type_t apr_bucket_type_mmap
Definition: apr_buckets.h:224
Definition: apr_buckets.h:636
apr_bucket * apr_bucket_pipe_make(apr_bucket *b, apr_file_t *thispipe)
apr_status_t apr_brigade_to_iovec(apr_bucket_brigade *b, struct iovec *vec, int *nvec)
apr_status_t apr_brigade_puts(apr_bucket_brigade *bb, apr_brigade_flush flush, void *ctx, const char *str)
apr_bucket * apr_bucket_mmap_create(apr_mmap_t *mm, apr_off_t start, apr_size_t length, apr_bucket_alloc_t *list)
apr_status_t apr_brigade_cleanup(void *data)
Definition: apr_buckets.h:564
APR Platform Definitions.
apr_bucket * apr_brigade_insert_file(apr_bucket_brigade *bb, apr_file_t *f, apr_off_t start, apr_off_t len, apr_pool_t *p)
apr_bucket * apr_bucket_immortal_create(const char *buf, apr_size_t nbyte, apr_bucket_alloc_t *list)
apr_status_t(* apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx)
Definition: apr_buckets.h:282
Definition: apr_buckets.h:534
apr_status_t(* copy)(apr_bucket *e, apr_bucket **c)
Definition: apr_buckets.h:211
const apr_bucket_type_t apr_bucket_type_flush
const apr_bucket_type_t apr_bucket_type_heap
apr_status_t apr_brigade_pflatten(apr_bucket_brigade *bb, char **c, apr_size_t *len, apr_pool_t *pool)
apr_bucket_brigade * apr_brigade_split_ex(apr_bucket_brigade *b, apr_bucket *e, apr_bucket_brigade *a)
int num_func
Definition: apr_buckets.h:140
void apr_bucket_alloc_destroy(apr_bucket_alloc_t *list)
const apr_bucket_type_t apr_bucket_type_socket
apr_bucket * apr_bucket_pool_create(const char *buf, apr_size_t length, apr_pool_t *pool, apr_bucket_alloc_t *list)
apr_status_t apr_brigade_partition(apr_bucket_brigade *b, apr_off_t point, apr_bucket **after_point)
apr_status_t apr_bucket_shared_copy(apr_bucket *a, apr_bucket **b)
apr_bucket * apr_bucket_socket_make(apr_bucket *b, apr_socket_t *thissock)
apr_off_t start
Definition: apr_buckets.h:242
apr_bucket_brigade * apr_brigade_split(apr_bucket_brigade *b, apr_bucket *e)
int refcount
Definition: apr_buckets.h:536
apr_bucket * apr_bucket_pool_make(apr_bucket *b, const char *buf, apr_size_t length, apr_pool_t *pool)
void apr_bucket_destroy_noop(void *data)
Definition: apr_buckets.h:131
void(* destroy)(void *data)
Definition: apr_buckets.h:164
apr_bucket * apr_bucket_transient_create(const char *buf, apr_size_t nbyte, apr_bucket_alloc_t *list)
Definition: apr_buckets.h:58
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: apr_buckets.h:153
apr_bucket_alloc_t * list
Definition: apr_buckets.h:593
int apr_status_t
Definition: apr_errno.h:44
apr_bucket * apr_bucket_file_make(apr_bucket *b, apr_file_t *fd, apr_off_t offset, apr_size_t len, apr_pool_t *p)
const apr_bucket_type_t * type
Definition: apr_buckets.h:228
apr_status_t apr_bucket_split_notimpl(apr_bucket *data, apr_size_t point)
apr_bucket_refcount refcount
Definition: apr_buckets.h:617
apr_bucket_mmap mmap
Definition: apr_buckets.h:641
apr_bucket_brigade * apr_brigade_create(apr_pool_t *p, apr_bucket_alloc_t *list)
apr_bucket_pool pool
Definition: apr_buckets.h:639
Definition: apr_buckets.h:602
apr_status_t apr_bucket_setaside_noop(apr_bucket *data, apr_pool_t *pool)
void * apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list)
apr_bucket * apr_bucket_pipe_create(apr_file_t *thispipe, apr_bucket_alloc_t *list)
apr_bucket * apr_bucket_transient_make(apr_bucket *b, const char *buf, apr_size_t nbyte)
apr_bucket_alloc_t * list
Definition: apr_buckets.h:254
apr_status_t apr_brigade_flatten(apr_bucket_brigade *bb, char *c, apr_size_t *len)
Definition: apr_buckets.h:59
apr_bucket_heap heap
Definition: apr_buckets.h:638
apr_size_t length
Definition: apr_buckets.h:234
apr_status_t apr_brigade_destroy(apr_bucket_brigade *b)
apr_status_t apr_bucket_simple_split(apr_bucket *b, apr_size_t point)
const apr_bucket_type_t apr_bucket_type_file
apr_bucket_heap heap
Definition: apr_buckets.h:576
apr_status_t apr_brigade_putc(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char c)
Definition: apr_buckets.h:155
const char * name
Definition: apr_buckets.h:135
apr_mmap_t * mmap
Definition: apr_buckets.h:606
apr_bucket_alloc_t * apr_bucket_alloc_create(apr_pool_t *p)