ldns_struct_buffer Struct Reference

implementation of buffers to ease operations More...

Data Fields

size_t _position
 The current position used for reading/writing. More...
 
size_t _limit
 The read/write limit. More...
 
size_t _capacity
 The amount of data the buffer can contain. More...
 
uint8_t * _data
 The data contained in the buffer. More...
 
unsigned _fixed: 1
 If the buffer is fixed it cannot be resized. More...
 
ldns_status _status
 The current state of the buffer. More...
 

Detailed Description

implementation of buffers to ease operations

ldns_buffers can contain arbitrary information, per octet. You can write to the current end of a buffer, read from the current position, and access any data within it.

Example use of buffers is in the source code of host2str.c

Definition at line 50 of file buffer.h.

Field Documentation

◆ _position

size_t ldns_struct_buffer::_position

The current position used for reading/writing.

Definition at line 53 of file buffer.h.

◆ _limit

size_t ldns_struct_buffer::_limit

The read/write limit.

Definition at line 56 of file buffer.h.

◆ _capacity

size_t ldns_struct_buffer::_capacity

The amount of data the buffer can contain.

Definition at line 59 of file buffer.h.

◆ _data

uint8_t* ldns_struct_buffer::_data

The data contained in the buffer.

Definition at line 62 of file buffer.h.

◆ _fixed

unsigned ldns_struct_buffer::_fixed

If the buffer is fixed it cannot be resized.

Definition at line 65 of file buffer.h.

◆ _status

ldns_status ldns_struct_buffer::_status

The current state of the buffer.

If writing to the buffer fails for any reason, this value is changed. This way, you can perform multiple writes in sequence and check for success afterwards.

Definition at line 70 of file buffer.h.