Define basic IO abstractions, implement for FD

This commit is contained in:
Daniel Thorpe
2024-06-20 14:23:33 +01:00
parent e38e0f8415
commit d7fbb0b4f0
5 changed files with 59 additions and 0 deletions

17
lib/include/io_abs.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef IO_ABS_H
#define IO_ABS_H
#include <stdlib.h>
#include <stdint.h>
struct io_reader {
void *ctx;
ssize_t (*read)(void *ctx, uint8_t *buf, size_t len);
};
struct io_writer {
void *ctx;
ssize_t (*write)(void *ctx, const uint8_t *buf, size_t len);
};
#endif