From ad541c67761b8aa6da1566802c347cac4018d0c2 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 2 Nov 2026 20:50:24 +0100 Subject: Move the build sources into src/ --- ot_batch.h | 46 ---------------------------------------------- 1 file changed, 46 deletions(-) delete mode 100644 ot_batch.h (limited to 'ot_batch.h') diff --git a/ot_batch.h b/ot_batch.h deleted file mode 100644 index 910bea7..0000000 --- a/ot_batch.h +++ /dev/null @@ -1,46 +0,0 @@ -/* This software was written by Dirk Engling - It is considered beerware. Prost. Skol. Cheers or whatever. */ - -#ifndef OT_BATCH_H__ -#define OT_BATCH_H__ - -#include -#include -#include - -/* A queue of buffers on their way to one socket. The batch owns every buffer - handed to it and frees each one as soon as it has left, so a client that - reads slowly costs memory only for what it has not received yet. - - A zeroed ot_batch is ready to use. */ -typedef struct { - struct iovec *entries; - size_t space; - size_t count; - size_t first; /* entries before this one are sent and freed */ - size_t offset; /* bytes of entries[first] already sent */ -} ot_batch; - -static inline int batch_pending(const ot_batch *batch) { return batch->first != batch->count; } - -/* What batch_send reports instead of a byte count */ -enum { BATCH_DONE = 0, BATCH_AGAIN = -1, BATCH_FAILED = -2 }; - -/* Queue buf and take ownership of it. Returns 0, or -1 having freed buf. */ -int batch_add(ot_batch *batch, void *buf, size_t len); - -/* Write as much as the socket takes. Returns the number of bytes written, or - BATCH_DONE, BATCH_AGAIN or BATCH_FAILED. */ -ssize_t batch_send(int s, ot_batch *batch); - -/* Queue every entry of a vector, taking ownership of each buffer but not of - the vector itself. Returns 0, or -1 having freed all of them. */ -int batch_add_vector(ot_batch *batch, const struct iovec *entries, size_t count); - -/* Queue a copy of buf, which the batch then owns. Returns 0, or -1. */ -int batch_add_copy(ot_batch *batch, const void *buf, size_t len); - -/* Free whatever has not left yet, along with the batch's own array */ -void batch_reset(ot_batch *batch); - -#endif -- cgit v1.3