Apache Portable Runtime Utility Library
apr_buckets.h
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
21#ifndef APR_BUCKETS_H
22#define APR_BUCKETS_H
23
24#if defined(APR_BUCKET_DEBUG) && !defined(APR_RING_DEBUG)
25#define APR_RING_DEBUG
26#endif
27
28#include "apu.h"
29#include "apr_network_io.h"
30#include "apr_file_io.h"
31#include "apr_general.h"
32#include "apr_mmap.h"
33#include "apr_errno.h"
34#include "apr_ring.h"
35#include "apr.h"
36#if APR_HAVE_SYS_UIO_H
37#include <sys/uio.h> /* for struct iovec */
38#endif
39#if APR_HAVE_STDARG_H
40#include <stdarg.h>
41#endif
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
54#define APR_BUCKET_BUFF_SIZE 8000
55
57typedef enum {
61
114/*
115 * Forward declaration of the main types.
116 */
117
121typedef struct apr_bucket apr_bucket;
124
127
135 const char *name;
151 enum {
164 void (*destroy)(void *data);
165
176 apr_status_t (*read)(apr_bucket *b, const char **str, apr_size_t *len,
177 apr_read_type_e block);
178
192 apr_status_t (*setaside)(apr_bucket *e, apr_pool_t *pool);
193
203 apr_status_t (*split)(apr_bucket *e, apr_size_t point);
204
211 apr_status_t (*copy)(apr_bucket *e, apr_bucket **c);
212
213};
214
234 apr_size_t length;
242 apr_off_t start;
244 void *data;
252 void (*free)(void *e);
255};
256
264 apr_pool_t *p;
266 /*
267 * The apr_bucket_list structure doesn't actually need a name tag
268 * because it has no existence independent of struct apr_bucket_brigade;
269 * the ring macros are designed so that you can leave the name tag
270 * argument empty in this situation but apparently the Windows compiler
271 * doesn't like that.
272 */
273 APR_RING_HEAD(apr_bucket_list, apr_bucket) list;
276};
277
278
282typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx);
283
284/*
285 * define APR_BUCKET_DEBUG if you want your brigades to be checked for
286 * validity at every possible instant. this will slow your code down
287 * substantially but is a very useful debugging tool.
288 */
289#ifdef APR_BUCKET_DEBUG
290
291#define APR_BRIGADE_CHECK_CONSISTENCY(b) \
292 APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link)
293
294#define APR_BUCKET_CHECK_CONSISTENCY(e) \
295 APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link)
296
297#else
304#define APR_BRIGADE_CHECK_CONSISTENCY(b)
311#define APR_BUCKET_CHECK_CONSISTENCY(e)
312#endif
313
314
331#define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket, link)
332
338#define APR_BRIGADE_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link)
339
345#define APR_BRIGADE_FIRST(b) APR_RING_FIRST(&(b)->list)
351#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list)
352
358#define APR_BRIGADE_INSERT_HEAD(b, e) do { \
359 apr_bucket *ap__b = (e); \
360 APR_RING_INSERT_HEAD(&(b)->list, ap__b, apr_bucket, link); \
361 APR_BRIGADE_CHECK_CONSISTENCY((b)); \
362 } while (0)
363
369#define APR_BRIGADE_INSERT_TAIL(b, e) do { \
370 apr_bucket *ap__b = (e); \
371 APR_RING_INSERT_TAIL(&(b)->list, ap__b, apr_bucket, link); \
372 APR_BRIGADE_CHECK_CONSISTENCY((b)); \
373 } while (0)
374
380#define APR_BRIGADE_CONCAT(a, b) do { \
381 APR_RING_CONCAT(&(a)->list, &(b)->list, apr_bucket, link); \
382 APR_BRIGADE_CHECK_CONSISTENCY((a)); \
383 } while (0)
384
390#define APR_BRIGADE_PREPEND(a, b) do { \
391 APR_RING_PREPEND(&(a)->list, &(b)->list, apr_bucket, link); \
392 APR_BRIGADE_CHECK_CONSISTENCY((a)); \
393 } while (0)
394
400#define APR_BUCKET_INSERT_BEFORE(a, b) do { \
401 apr_bucket *ap__a = (a), *ap__b = (b); \
402 APR_RING_INSERT_BEFORE(ap__a, ap__b, link); \
403 APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
404 } while (0)
405
411#define APR_BUCKET_INSERT_AFTER(a, b) do { \
412 apr_bucket *ap__a = (a), *ap__b = (b); \
413 APR_RING_INSERT_AFTER(ap__a, ap__b, link); \
414 APR_BUCKET_CHECK_CONSISTENCY(ap__a); \
415 } while (0)
416
422#define APR_BUCKET_NEXT(e) APR_RING_NEXT((e), link)
428#define APR_BUCKET_PREV(e) APR_RING_PREV((e), link)
429
434#define APR_BUCKET_REMOVE(e) APR_RING_REMOVE((e), link)
435
440#define APR_BUCKET_INIT(e) APR_RING_ELEM_INIT((e), link)
441
448#define APR_BUCKET_IS_METADATA(e) ((e)->type->is_metadata)
449
455#define APR_BUCKET_IS_FLUSH(e) ((e)->type == &apr_bucket_type_flush)
461#define APR_BUCKET_IS_EOS(e) ((e)->type == &apr_bucket_type_eos)
467#define APR_BUCKET_IS_FILE(e) ((e)->type == &apr_bucket_type_file)
473#define APR_BUCKET_IS_PIPE(e) ((e)->type == &apr_bucket_type_pipe)
479#define APR_BUCKET_IS_SOCKET(e) ((e)->type == &apr_bucket_type_socket)
485#define APR_BUCKET_IS_HEAP(e) ((e)->type == &apr_bucket_type_heap)
491#define APR_BUCKET_IS_TRANSIENT(e) ((e)->type == &apr_bucket_type_transient)
497#define APR_BUCKET_IS_IMMORTAL(e) ((e)->type == &apr_bucket_type_immortal)
498#if APR_HAS_MMAP
504#define APR_BUCKET_IS_MMAP(e) ((e)->type == &apr_bucket_type_mmap)
505#endif
511#define APR_BUCKET_IS_POOL(e) ((e)->type == &apr_bucket_type_pool)
512
513/*
514 * General-purpose reference counting for the various bucket types.
515 *
516 * Any bucket type that keeps track of the resources it uses (i.e.
517 * most of them except for IMMORTAL, TRANSIENT, and EOS) needs to
518 * attach a reference count to the resource so that it can be freed
519 * when the last bucket that uses it goes away. Resource-sharing may
520 * occur because of bucket splits or buckets that refer to globally
521 * cached data. */
522
534};
535
536/* ***** Reference-counted bucket types ***** */
537
549 char *base;
551 apr_size_t alloc_len;
553 void (*free_func)(void *data);
554};
555
579 const char *base;
586 apr_pool_t *pool;
591};
592
593#if APR_HAS_MMAP
603 apr_mmap_t *mmap;
604};
605#endif
606
616 apr_file_t *fd;
619 apr_pool_t *readpool;
620#if APR_HAS_MMAP
624#endif /* APR_HAS_MMAP */
626 apr_size_t read_size;
627};
628
639#if APR_HAS_MMAP
641#endif
643};
644
650#define APR_BUCKET_ALLOC_SIZE APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs))
651
652/* ***** Bucket Brigade Functions ***** */
660APU_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p,
661 apr_bucket_alloc_t *list);
662
668APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b);
669
681APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data);
682
699 apr_bucket *e,
701
714 apr_bucket *e);
715
728APU_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b,
729 apr_off_t point,
730 apr_bucket **after_point);
731
740APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb,
741 int read_all,
742 apr_off_t *length);
743
751APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb,
752 char *c,
753 apr_size_t *len);
754
762APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb,
763 char **c,
764 apr_size_t *len,
765 apr_pool_t *pool);
766
775APU_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut,
776 apr_bucket_brigade *bbIn,
777 apr_read_type_e block,
778 apr_off_t maxbytes);
779
789APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b,
790 struct iovec *vec, int *nvec);
791
800APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b,
801 apr_brigade_flush flush,
802 void *ctx,
803 va_list va);
804
828APU_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b,
829 apr_brigade_flush flush, void *ctx,
830 const char *str, apr_size_t nbyte);
831
841APU_DECLARE(apr_status_t) apr_brigade_writev(apr_bucket_brigade *b,
842 apr_brigade_flush flush,
843 void *ctx,
844 const struct iovec *vec,
845 apr_size_t nvec);
846
855APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb,
856 apr_brigade_flush flush, void *ctx,
857 const char *str);
858
867APU_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b,
868 apr_brigade_flush flush, void *ctx,
869 const char c);
870
879APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b,
880 apr_brigade_flush flush,
881 void *ctx, ...);
882
893APU_DECLARE_NONSTD(apr_status_t) apr_brigade_printf(apr_bucket_brigade *b,
894 apr_brigade_flush flush,
895 void *ctx,
896 const char *fmt, ...)
897 __attribute__((format(printf,4,5)));
898
909APU_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b,
910 apr_brigade_flush flush,
911 void *ctx,
912 const char *fmt, va_list va);
913
927 apr_file_t *f,
928 apr_off_t start,
929 apr_off_t len,
930 apr_pool_t *p);
931
932
933
934/* ***** Bucket freelist functions ***** */
948APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p);
949
958APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(apr_allocator_t *allocator);
959
964APU_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list);
965
974APU_DECLARE_NONSTD(apr_size_t) apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list,
975 apr_size_t size)
976 __attribute__((nonnull(1)));
977
983APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list);
984
989APU_DECLARE_NONSTD(void) apr_bucket_free(void *block);
990
991
992/* ***** Bucket Functions ***** */
999#define apr_bucket_destroy(e) do { \
1000 apr_bucket *apr__d = (e); \
1001 apr__d->type->destroy(apr__d->data); \
1002 apr__d->free(apr__d); \
1003 } while (0)
1004
1016#define apr_bucket_delete(e) do { \
1017 apr_bucket *apr__b = (e); \
1018 APR_BUCKET_REMOVE(apr__b); \
1019 apr_bucket_destroy(apr__b); \
1020 } while (0)
1021
1089#define apr_bucket_read(e,str,len,block) (e)->type->read(e, str, len, block)
1090
1097#define apr_bucket_setaside(e,p) (e)->type->setaside(e,p)
1098
1109#define apr_bucket_split(e,point) (e)->type->split(e, point)
1110
1116#define apr_bucket_copy(e,c) (e)->type->copy(e, c)
1117
1118/* Bucket type handling */
1119
1129APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data,
1130 apr_pool_t *pool);
1131
1139APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data,
1140 apr_pool_t *pool);
1141
1149APU_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data,
1150 apr_size_t point);
1151
1159APU_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e,
1160 apr_bucket **c);
1161
1171APU_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data);
1172
1179/* There is no apr_bucket_read_notimpl, because it is a required function
1180 */
1181
1182
1183/* All of the bucket types implemented by the core */
1188APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_flush;
1194APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_eos;
1198APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_file;
1203APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_heap;
1204#if APR_HAS_MMAP
1208APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_mmap;
1209#endif
1215APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pool;
1219APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pipe;
1225APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_immortal;
1231APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_transient;
1235APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_socket;
1236
1237
1238/* ***** Simple buckets ***** */
1239
1251APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *b,
1252 apr_size_t point);
1253
1264APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a,
1265 apr_bucket **b);
1266
1267
1268/* ***** Shared, reference-counted buckets ***** */
1269
1284APU_DECLARE(apr_bucket *) apr_bucket_shared_make(apr_bucket *b, void *data,
1285 apr_off_t start,
1286 apr_size_t length);
1287
1296APU_DECLARE(int) apr_bucket_shared_destroy(void *data);
1297
1309APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *b,
1310 apr_size_t point);
1311
1321APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a,
1322 apr_bucket **b);
1323
1324
1325/* ***** Functions to Create Buckets of varying types ***** */
1326/*
1327 * Each bucket type foo has two initialization functions:
1328 * apr_bucket_foo_make which sets up some already-allocated memory as a
1329 * bucket of type foo; and apr_bucket_foo_create which allocates memory
1330 * for the bucket, calls apr_bucket_make_foo, and initializes the
1331 * bucket's list pointers. The apr_bucket_foo_make functions are used
1332 * inside the bucket code to change the type of buckets in place;
1333 * other code should call apr_bucket_foo_create. All the initialization
1334 * functions change nothing if they fail.
1335 */
1336
1344
1353
1362
1371
1379APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(const char *buf,
1380 apr_size_t nbyte,
1381 apr_bucket_alloc_t *list);
1382
1391 const char *buf,
1392 apr_size_t nbyte);
1393
1401APU_DECLARE(apr_bucket *) apr_bucket_transient_create(const char *buf,
1402 apr_size_t nbyte,
1403 apr_bucket_alloc_t *list);
1404
1413 const char *buf,
1414 apr_size_t nbyte);
1415
1430APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf,
1431 apr_size_t nbyte,
1432 void (*free_func)(void *data),
1433 apr_bucket_alloc_t *list);
1443APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char *buf,
1444 apr_size_t nbyte,
1445 void (*free_func)(void *data));
1446
1456APU_DECLARE(apr_bucket *) apr_bucket_pool_create(const char *buf,
1457 apr_size_t length,
1458 apr_pool_t *pool,
1459 apr_bucket_alloc_t *list);
1460
1469APU_DECLARE(apr_bucket *) apr_bucket_pool_make(apr_bucket *b, const char *buf,
1470 apr_size_t length,
1471 apr_pool_t *pool);
1472
1473#if APR_HAS_MMAP
1483APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(apr_mmap_t *mm,
1484 apr_off_t start,
1485 apr_size_t length,
1486 apr_bucket_alloc_t *list);
1487
1497APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm,
1498 apr_off_t start,
1499 apr_size_t length);
1500#endif
1501
1508APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *thissock,
1509 apr_bucket_alloc_t *list);
1517 apr_socket_t *thissock);
1518
1525APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *thispipe,
1526 apr_bucket_alloc_t *list);
1527
1535 apr_file_t *thispipe);
1536
1553APU_DECLARE(apr_bucket *) apr_bucket_file_create(apr_file_t *fd,
1554 apr_off_t offset,
1555 apr_size_t len,
1556 apr_pool_t *p,
1557 apr_bucket_alloc_t *list);
1558
1569APU_DECLARE(apr_bucket *) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd,
1570 apr_off_t offset,
1571 apr_size_t len, apr_pool_t *p);
1572
1579APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b,
1580 int enabled);
1581
1592APU_DECLARE(apr_status_t) apr_bucket_file_set_buf_size(apr_bucket *b,
1593 apr_size_t size);
1594
1596#ifdef __cplusplus
1597}
1598#endif
1599
1600#endif /* !APR_BUCKETS_H */
apr_bucket * apr_bucket_eos_make(apr_bucket *b)
void apr_bucket_destroy_noop(void *data)
apr_status_t apr_bucket_simple_copy(apr_bucket *a, apr_bucket **b)
apr_bucket * apr_bucket_pool_make(apr_bucket *b, const char *buf, apr_size_t length, apr_pool_t *pool)
const apr_bucket_type_t apr_bucket_type_transient
apr_bucket * apr_bucket_socket_make(apr_bucket *b, apr_socket_t *thissock)
apr_status_t apr_brigade_putstrs(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx,...)
apr_bucket * apr_bucket_flush_make(apr_bucket *b)
apr_bucket * apr_bucket_socket_create(apr_socket_t *thissock, apr_bucket_alloc_t *list)
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_status_t apr_brigade_split_line(apr_bucket_brigade *bbOut, apr_bucket_brigade *bbIn, apr_read_type_e block, apr_off_t maxbytes)
apr_bucket * apr_bucket_pipe_create(apr_file_t *thispipe, apr_bucket_alloc_t *list)
apr_bucket * apr_bucket_heap_create(const char *buf, apr_size_t nbyte, void(*free_func)(void *data), apr_bucket_alloc_t *list)
const apr_bucket_type_t apr_bucket_type_heap
apr_bucket * apr_bucket_immortal_make(apr_bucket *b, const char *buf, apr_size_t nbyte)
apr_status_t apr_brigade_puts(apr_bucket_brigade *bb, apr_brigade_flush flush, void *ctx, const char *str)
apr_status_t apr_bucket_shared_copy(apr_bucket *a, apr_bucket **b)
apr_status_t apr_brigade_destroy(apr_bucket_brigade *b)
apr_status_t apr_brigade_flatten(apr_bucket_brigade *bb, char *c, apr_size_t *len)
apr_status_t apr_bucket_split_notimpl(apr_bucket *data, apr_size_t point)
const apr_bucket_type_t apr_bucket_type_pipe
apr_status_t apr_brigade_putc(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char c)
apr_status_t apr_brigade_vputstrs(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, va_list va)
const apr_bucket_type_t apr_bucket_type_immortal
apr_bucket_brigade * apr_brigade_split(apr_bucket_brigade *b, apr_bucket *e)
apr_bucket * apr_bucket_transient_make(apr_bucket *b, const char *buf, apr_size_t nbyte)
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_printf(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char *fmt,...)
int apr_bucket_shared_destroy(void *data)
apr_bucket * apr_bucket_heap_make(apr_bucket *b, const char *buf, apr_size_t nbyte, void(*free_func)(void *data))
apr_status_t apr_brigade_partition(apr_bucket_brigade *b, apr_off_t point, apr_bucket **after_point)
apr_bucket * apr_bucket_flush_create(apr_bucket_alloc_t *list)
const apr_bucket_type_t apr_bucket_type_file
apr_bucket * apr_bucket_pipe_make(apr_bucket *b, apr_file_t *thispipe)
apr_status_t apr_bucket_copy_notimpl(apr_bucket *e, apr_bucket **c)
apr_bucket * apr_bucket_shared_make(apr_bucket *b, void *data, apr_off_t start, apr_size_t length)
const apr_bucket_type_t apr_bucket_type_mmap
apr_status_t apr_brigade_length(apr_bucket_brigade *bb, int read_all, apr_off_t *length)
apr_status_t apr_brigade_write(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char *str, apr_size_t nbyte)
apr_read_type_e
Definition: apr_buckets.h:57
apr_bucket_alloc_t * apr_bucket_alloc_create(apr_pool_t *p)
apr_bucket * apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm, apr_off_t start, apr_size_t length)
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)
apr_bucket_brigade * apr_brigade_create(apr_pool_t *p, apr_bucket_alloc_t *list)
const apr_bucket_type_t apr_bucket_type_eos
apr_status_t apr_bucket_shared_split(apr_bucket *b, apr_size_t point)
const apr_bucket_type_t apr_bucket_type_pool
apr_bucket_brigade * apr_brigade_split_ex(apr_bucket_brigade *b, apr_bucket *e, apr_bucket_brigade *a)
void * apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list)
apr_status_t apr_brigade_to_iovec(apr_bucket_brigade *b, struct iovec *vec, int *nvec)
void apr_bucket_free(void *block)
struct apr_bucket_alloc_t apr_bucket_alloc_t
Definition: apr_buckets.h:123
apr_status_t apr_brigade_vprintf(apr_bucket_brigade *b, apr_brigade_flush flush, void *ctx, const char *fmt, va_list va)
apr_status_t apr_bucket_simple_split(apr_bucket *b, apr_size_t point)
apr_status_t apr_brigade_pflatten(apr_bucket_brigade *bb, char **c, apr_size_t *len, apr_pool_t *pool)
const apr_bucket_type_t apr_bucket_type_socket
apr_status_t apr_bucket_file_set_buf_size(apr_bucket *b, apr_size_t size)
apr_size_t apr_bucket_alloc_aligned_floor(apr_bucket_alloc_t *list, apr_size_t size)
apr_status_t apr_bucket_file_enable_mmap(apr_bucket *b, int enabled)
apr_bucket * apr_bucket_eos_create(apr_bucket_alloc_t *list)
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 * apr_bucket_pool_create(const char *buf, apr_size_t length, apr_pool_t *pool, apr_bucket_alloc_t *list)
apr_bucket * apr_bucket_immortal_create(const char *buf, apr_size_t nbyte, apr_bucket_alloc_t *list)
apr_status_t apr_bucket_setaside_notimpl(apr_bucket *data, apr_pool_t *pool)
apr_bucket_alloc_t * apr_bucket_alloc_create_ex(apr_allocator_t *allocator)
apr_status_t apr_bucket_setaside_noop(apr_bucket *data, apr_pool_t *pool)
const apr_bucket_type_t apr_bucket_type_flush
void apr_bucket_alloc_destroy(apr_bucket_alloc_t *list)
apr_bucket * apr_bucket_transient_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
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_status_t apr_brigade_cleanup(void *data)
@ APR_BLOCK_READ
Definition: apr_buckets.h:58
@ APR_NONBLOCK_READ
Definition: apr_buckets.h:59
Definition: apr_buckets.h:258
APR_RING_HEAD(apr_bucket_list, apr_bucket) list
apr_pool_t * p
Definition: apr_buckets.h:264
apr_bucket_alloc_t * bucket_alloc
Definition: apr_buckets.h:275
Definition: apr_buckets.h:612
apr_pool_t * readpool
Definition: apr_buckets.h:619
int can_mmap
Definition: apr_buckets.h:623
apr_size_t read_size
Definition: apr_buckets.h:626
apr_file_t * fd
Definition: apr_buckets.h:616
apr_bucket_refcount refcount
Definition: apr_buckets.h:614
Definition: apr_buckets.h:543
apr_bucket_refcount refcount
Definition: apr_buckets.h:545
char * base
Definition: apr_buckets.h:549
void(* free_func)(void *data)
Definition: apr_buckets.h:553
apr_size_t alloc_len
Definition: apr_buckets.h:551
Definition: apr_buckets.h:599
apr_mmap_t * mmap
Definition: apr_buckets.h:603
apr_bucket_refcount refcount
Definition: apr_buckets.h:601
Definition: apr_buckets.h:561
apr_bucket_heap heap
Definition: apr_buckets.h:573
apr_bucket_alloc_t * list
Definition: apr_buckets.h:590
const char * base
Definition: apr_buckets.h:579
apr_pool_t * pool
Definition: apr_buckets.h:586
Definition: apr_buckets.h:531
int refcount
Definition: apr_buckets.h:533
Definition: apr_buckets.h:131
@ APR_BUCKET_DATA
Definition: apr_buckets.h:153
@ APR_BUCKET_METADATA
Definition: apr_buckets.h:155
apr_status_t(* split)(apr_bucket *e, apr_size_t point)
Definition: apr_buckets.h:203
apr_status_t(* copy)(apr_bucket *e, apr_bucket **c)
Definition: apr_buckets.h:211
apr_status_t(* read)(apr_bucket *b, const char **str, apr_size_t *len, apr_read_type_e block)
Definition: apr_buckets.h:176
enum apr_bucket_type_t::@0 is_metadata
const char * name
Definition: apr_buckets.h:135
int num_func
Definition: apr_buckets.h:140
apr_status_t(* setaside)(apr_bucket *e, apr_pool_t *pool)
Definition: apr_buckets.h:192
void(* destroy)(void *data)
Definition: apr_buckets.h:164
Definition: apr_buckets.h:224
apr_size_t length
Definition: apr_buckets.h:234
void(* free)(void *e)
Definition: apr_buckets.h:252
apr_off_t start
Definition: apr_buckets.h:242
apr_bucket_alloc_t * list
Definition: apr_buckets.h:254
void * data
Definition: apr_buckets.h:244
APR_RING_ENTRY(apr_bucket) link
const apr_bucket_type_t * type
Definition: apr_buckets.h:228
Definition: apr_buckets.h:635
apr_bucket_heap heap
Definition: apr_buckets.h:637
apr_bucket_mmap mmap
Definition: apr_buckets.h:640
apr_bucket b
Definition: apr_buckets.h:636
apr_bucket_file file
Definition: apr_buckets.h:642
apr_bucket_pool pool
Definition: apr_buckets.h:638