Home

Traffic Server Software Developers Kit

IO Buffer Interface

INKIOBufferAppend

Appends to an IO buffer.

Prototype

INKReturnCode INKIOBufferAppend (INKIOBuffer bufp, INKIOBufferBlock blockp)

Description

Appends a block to the IO buffer bufp. The data in the appended block is made available for reading.

Returns

INK_SUCCESS if the block was successfully appended to the specified IO buffer.

INK_ERROR if an error occurred.

INKIOBufferBlockCreate

Creates an IO buffer block.

Prototype

INKIOBufferBlock INKIOBufferBlockCreate (INKIOBufferData datap, int size, int offset)

Description

Creates a new IO buffer block and initializes it with the IO buffer data datap. The size parameter is the amount of data initially available for reading in this new buffer block. The offset parameter is the offset into datap that will be used as the start for the block. The two common uses for INKIOBufferBlockCreate are to create an empty block (by specifying size as 0) and to create a full block (by specifying size as the total size of datap). The newly-created block should be added almost immediately to an IO buffer by a call to INKIOBufferAppend, since there is no function for destroying a buffer block other than simply relying on its automatic destruction by an IO buffer.

Returns

The newly-created IO buffer block.

INKIOBufferDataCreate

Creates IO buffer data.

Prototype

INKIOBufferData INKIOBufferDataCreate (void* data, int size, INKIOBufferDataFlags flags)

Description

Creates a new IO buffer data and initialize it with data, size. The flags parameter specifies how to interpret data.

INK_DATA_ALLOCATE

The data pointer is NULL and the data associated with the INKIOBufferData should be allocated. INKIOBufferDataCreate rounds size to a power of 2 less than or equal to 32K.

INK_DATA_MALLOCED

The data pointer was allocated by INKmalloc and will be freed when the last reference to the new INKIOBufferData is released by a call to INKfree.

INK_DATA_CONSTANT

The data pointer is data that should not be freed when the last reference to the new INKIOBufferData is released.

Returns

A handle to the newly-created IO buffer.