mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-11-11 07:10:36 +00:00
38 lines
823 B
C
38 lines
823 B
C
#ifndef LLARP_BUFFER_H_
|
|
#define LLARP_BUFFER_H_
|
|
#include <llarp/common.h>
|
|
#include <llarp/mem.h>
|
|
#include <stdbool.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
typedef struct llarp_buffer_t {
|
|
char *base;
|
|
size_t sz;
|
|
char *cur;
|
|
} llarp_buffer_t;
|
|
|
|
size_t llarp_buffer_size_left(llarp_buffer_t *buff);
|
|
|
|
bool llarp_buffer_write(llarp_buffer_t *buff, const void *data, size_t sz);
|
|
|
|
bool llarp_buffer_writef(llarp_buffer_t *buff, const char *fmt, ...);
|
|
|
|
bool llarp_buffer_readfile(llarp_buffer_t *buff, FILE *f,
|
|
struct llarp_alloc *mem);
|
|
|
|
size_t llarp_buffer_read_until(llarp_buffer_t * buff, char delim, char * result, size_t resultlen);
|
|
|
|
bool llarp_buffer_eq(llarp_buffer_t buff, const char * data);
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|