13 #ifndef LDNS_SBUFFER_H 14 #define LDNS_SBUFFER_H 24 # define INLINE static 26 # define INLINE static inline 37 #ifdef ALLOW_UNALIGNED_ACCESSES 38 return ntohs(*(
const uint16_t *) src);
48 #ifdef ALLOW_UNALIGNED_ACCESSES 49 return ntohl(*(
const uint32_t *) src);
66 #ifdef ALLOW_UNALIGNED_ACCESSES 70 p[0] = (
uint8_t) ((data >> 8) & 0xff);
78 #ifdef ALLOW_UNALIGNED_ACCESSES 82 p[0] = (
uint8_t) ((data >> 24) & 0xff);
83 p[1] = (
uint8_t) ((data >> 16) & 0xff);
84 p[2] = (
uint8_t) ((data >> 8) & 0xff);
94 p[0] = (
uint8_t) ((data >> 40) & 0xff);
95 p[1] = (
uint8_t) ((data >> 32) & 0xff);
96 p[2] = (
uint8_t) ((data >> 24) & 0xff);
97 p[3] = (
uint8_t) ((data >> 16) & 0xff);
98 p[4] = (
uint8_t) ((data >> 8) & 0xff);
160 assert(buffer != NULL);
358 return buffer->
_data + at;
488 memset(buffer->
_data + at, c,
541 if (buffer->
_vfixed && at +
sizeof(data) > buffer->
_limit)
return;
543 buffer->
_data[at] = data;
567 if (buffer->
_vfixed && at +
sizeof(data) > buffer->
_limit)
return;
593 if (buffer->
_vfixed && at +
sizeof(data) > buffer->
_limit)
return;
673 return buffer->
_data[at];
774 ATTR_FORMAT(printf, 2, 3);
INLINE int sldns_buffer_available(sldns_buffer *buffer, size_t count)
INLINE uint32_t sldns_buffer_read_u32_at(sldns_buffer *buffer, size_t at)
void sldns_buffer_copy(sldns_buffer *result, sldns_buffer *from)
INLINE size_t sldns_buffer_remaining(sldns_buffer *buffer)
INLINE void sldns_buffer_set_limit(sldns_buffer *buffer, size_t limit)
INLINE void sldns_buffer_write_u16_at(sldns_buffer *buffer, size_t at, uint16_t data)
INLINE void sldns_write_uint16(void *dst, uint16_t data)
INLINE void sldns_buffer_invariant(sldns_buffer *buffer)
INLINE void sldns_buffer_clear(sldns_buffer *buffer)
INLINE size_t sldns_buffer_remaining_at(sldns_buffer *buffer, size_t at)
INLINE void sldns_buffer_rewind(sldns_buffer *buffer)
INLINE uint32_t sldns_read_uint32(const void *src)
void * sldns_buffer_export(sldns_buffer *buffer)
INLINE void sldns_buffer_read(sldns_buffer *buffer, void *data, size_t count)
INLINE void sldns_buffer_write(sldns_buffer *buffer, const void *data, size_t count)
INLINE uint32_t sldns_buffer_read_u32(sldns_buffer *buffer)
INLINE void sldns_buffer_write_u32(sldns_buffer *buffer, uint32_t data)
INLINE uint8_t sldns_buffer_read_u8_at(sldns_buffer *buffer, size_t at)
INLINE void sldns_write_uint32(void *dst, uint32_t data)
INLINE void sldns_buffer_read_at(sldns_buffer *buffer, size_t at, void *data, size_t count)
INLINE void sldns_write_uint48(void *dst, uint64_t data)
void sldns_buffer_init_frm_data(sldns_buffer *buffer, void *data, size_t size)
INLINE uint16_t sldns_buffer_read_u16_at(sldns_buffer *buffer, size_t at)
INLINE uint16_t sldns_buffer_read_u16(sldns_buffer *buffer)
INLINE void sldns_buffer_write_u8_at(sldns_buffer *buffer, size_t at, uint8_t data)
INLINE size_t sldns_buffer_capacity(sldns_buffer *buffer)
INLINE void sldns_buffer_write_string(sldns_buffer *buffer, const char *str)
INLINE uint8_t * sldns_buffer_begin(const sldns_buffer *buffer)
INLINE int sldns_buffer_status_ok(sldns_buffer *buffer)
int sldns_buffer_printf(sldns_buffer *buffer, const char *format,...) ATTR_FORMAT(printf
INLINE uint16_t sldns_read_uint16(const void *src)
INLINE void sldns_buffer_write_u48(sldns_buffer *buffer, uint64_t data)
INLINE uint8_t sldns_buffer_read_u8(sldns_buffer *buffer)
mdb_size_t count(MDB_cursor *cur)
INLINE void sldns_buffer_write_u16(sldns_buffer *buffer, uint16_t data)
sldns_buffer * sldns_buffer_new(size_t capacity)
void sldns_buffer_new_frm_data(sldns_buffer *buffer, void *data, size_t size)
INLINE void sldns_buffer_write_u48_at(sldns_buffer *buffer, size_t at, uint64_t data)
INLINE void sldns_buffer_write_at(sldns_buffer *buffer, size_t at, const void *data, size_t count)
INLINE void sldns_buffer_write_u32_at(sldns_buffer *buffer, size_t at, uint32_t data)
INLINE void sldns_buffer_write_string_at(sldns_buffer *buffer, size_t at, const char *str)
INLINE void sldns_buffer_set_at(sldns_buffer *buffer, size_t at, int c, size_t count)
unsigned __int64 uint64_t
int sldns_buffer_set_capacity(sldns_buffer *buffer, size_t capacity)
INLINE uint8_t * sldns_buffer_end(sldns_buffer *buffer)
INLINE size_t sldns_buffer_limit(sldns_buffer *buffer)
int void sldns_buffer_free(sldns_buffer *buffer)
INLINE void sldns_buffer_skip(sldns_buffer *buffer, ssize_t count)
int sldns_buffer_reserve(sldns_buffer *buffer, size_t amount)
INLINE int sldns_buffer_status(sldns_buffer *buffer)
void * memcpy(void *a, const void *b, size_t c)
INLINE void sldns_buffer_flip(sldns_buffer *buffer)
INLINE int sldns_buffer_available_at(sldns_buffer *buffer, size_t at, size_t count)
void sldns_buffer_init_vfixed_frm_data(sldns_buffer *buffer, void *data, size_t size)
INLINE size_t sldns_buffer_position(sldns_buffer *buffer)
INLINE uint8_t * sldns_buffer_current(sldns_buffer *buffer)
INLINE void sldns_buffer_set_position(sldns_buffer *buffer, size_t mark)
INLINE void sldns_buffer_write_u8(sldns_buffer *buffer, uint8_t data)
INLINE uint8_t * sldns_buffer_at(const sldns_buffer *buffer, size_t at)