You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lokinet/include/llarp/buffer.h

47 lines
848 B
C

7 years ago
#ifndef LLARP_BUFFER_H_
#define LLARP_BUFFER_H_
6 years ago
#include <llarp/common.h>
6 years ago
#include <llarp/mem.h>
#include <stdbool.h>
6 years ago
#include <stdio.h>
7 years ago
#include <stdlib.h>
6 years ago
#include <string.h>
7 years ago
#ifdef __cplusplus
extern "C" {
#endif
typedef uint8_t byte_t;
typedef struct llarp_buffer_t
{
byte_t *base;
byte_t *cur;
7 years ago
size_t sz;
} llarp_buffer_t;
size_t
llarp_buffer_size_left(llarp_buffer_t *buff);
6 years ago
bool
llarp_buffer_write(llarp_buffer_t *buff, const void *data, size_t sz);
7 years ago
bool
llarp_buffer_writef(llarp_buffer_t *buff, const char *fmt, ...);
6 years ago
bool
llarp_buffer_readfile(llarp_buffer_t *buff, FILE *f, struct llarp_alloc *mem);
6 years ago
size_t
llarp_buffer_read_until(llarp_buffer_t *buff, char delim, byte_t *result,
size_t resultlen);
6 years ago
bool
llarp_buffer_eq(llarp_buffer_t buff, const char *data);
6 years ago
7 years ago
#ifdef __cplusplus
}
#endif
7 years ago
7 years ago
#endif