Added a method to bio_writer_t that allows to extract the internal buffer
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Tobias Brunner
|
||||
* Hochschule fuer Technik Rapperswil
|
||||
*
|
||||
* Copyright (C) 2010 Martin Willi
|
||||
* Copyright (C) 2010 revosec AG
|
||||
*
|
||||
@@ -27,6 +30,8 @@ typedef struct bio_writer_t bio_writer_t;
|
||||
|
||||
/**
|
||||
* Buffered output generator.
|
||||
*
|
||||
* @note Integers are converted to network byte order before writing.
|
||||
*/
|
||||
struct bio_writer_t {
|
||||
|
||||
@@ -127,6 +132,14 @@ struct bio_writer_t {
|
||||
*/
|
||||
chunk_t (*get_buf)(bio_writer_t *this);
|
||||
|
||||
/**
|
||||
* Return the encoded data buffer and detach it from the writer (resets
|
||||
* the internal buffer).
|
||||
*
|
||||
* @return chunk to internal buffer (has to be freed)
|
||||
*/
|
||||
chunk_t (*extract_buf)(bio_writer_t *this);
|
||||
|
||||
/**
|
||||
* Destroy a bio_writer_t.
|
||||
*/
|
||||
@@ -136,6 +149,9 @@ struct bio_writer_t {
|
||||
/**
|
||||
* Create a bio_writer instance.
|
||||
*
|
||||
* The size of the internal buffer is increased automatically by bufsize (or a
|
||||
* default if not given) if the initial size does not suffice.
|
||||
*
|
||||
* @param bufsize initially allocated buffer size
|
||||
*/
|
||||
bio_writer_t *bio_writer_create(u_int32_t bufsize);
|
||||
|
||||
Reference in New Issue
Block a user