diff --git a/lib/isc/buffer.c b/lib/isc/buffer.c index 44d5477736..06ee057a10 100644 --- a/lib/isc/buffer.c +++ b/lib/isc/buffer.c @@ -104,6 +104,14 @@ isc_buffer_used(isc_buffer_t *b, isc_region_t *r) { r->length = b->used; } +unsigned int +isc_buffer_usedcount(isc_buffer_t *b) +{ + REQUIRE(VALID_BUFFER(b)); + + return (b->used); +} + void isc_buffer_available(isc_buffer_t *b, isc_region_t *r) { /* @@ -117,6 +125,13 @@ isc_buffer_available(isc_buffer_t *b, isc_region_t *r) { r->length = b->length - b->used; } +unsigned int +isc_buffer_availablecount(isc_buffer_t *b) +{ + REQUIRE(VALID_BUFFER(b)); + + return (b->length - b->used); +} void isc_buffer_add(isc_buffer_t *b, unsigned int n) { diff --git a/lib/isc/include/isc/buffer.h b/lib/isc/include/isc/buffer.h index b5efecf0a7..0a8f7c3621 100644 --- a/lib/isc/include/isc/buffer.h +++ b/lib/isc/include/isc/buffer.h @@ -141,8 +141,6 @@ struct isc_buffer { isc_mem_t *mctx; }; -typedef ISC_LIST(isc_buffer_t) isc_bufferlist_t; - /*** *** Functions ***/ @@ -248,6 +246,16 @@ isc_buffer_used(isc_buffer_t *b, isc_region_t *r); * 'r' points to a region structure. */ +unsigned int +isc_buffer_usedcount(isc_buffer_t *b); +/* + * Return the size of the used region of buffer 'b' + * + * Requires: + * + * 'b' is a valid buffer. + */ + void isc_buffer_available(isc_buffer_t *b, isc_region_t *r); /* @@ -260,6 +268,16 @@ isc_buffer_available(isc_buffer_t *b, isc_region_t *r); * 'r' points to a region structure. */ +unsigned int +isc_buffer_availablecount(isc_buffer_t *b); +/* + * Return the size of the available region of buffer 'b' + * + * Requires: + * + * 'b' is a valid buffer. + */ + void isc_buffer_add(isc_buffer_t *b, unsigned int n); /*