#./fio-stl/102 stream.h
16 public symbols.
#Macros
#FIO_STREAM_COPY_PER_PACKET
#define FIO_STREAM_COPY_PER_PACKET 98304Break apart large memory blocks into smaller pieces. by default 96Kb
Symbol type: macro
#FIO_STREAM_ALWAYS_COPY_IF_LESS_THAN
#define FIO_STREAM_ALWAYS_COPY_IF_LESS_THAN 116If the data added is less than said bytes, copy is preferred (locality).
Symbol type: macro
#FIO_STREAM_INIT
#define FIO_STREAM_INIT(s) \
{ .next = NULL, .pos = &(s).next }Symbol type: macro
#Types
#fio_stream_packet_s
struct fio_stream_packet_sSymbol type: type
#fio_stream_s
typedef struct {
/* do not directly access! */
fio_stream_packet_s *next;
fio_stream_packet_s **pos;
size_t consumed;
size_t length;
} fio_stream_sSymbol type: type
#Functions
#fio_stream_new
inline fio_stream_s *fio_stream_new(void)Symbol type: function
#fio_stream_free
inline int fio_stream_free(fio_stream_s *stream)Symbol type: function
#fio_stream_destroy
void fio_stream_destroy(fio_stream_s *stream)Destroys the object, re-initializing its container.
Symbol type: function
#fio_stream_pack_data
fio_stream_packet_s *fio_stream_pack_data(void *buf, size_t len, size_t offset, uint8_t copy_buffer, void (*dealloc_func)(void *))Packs data into a fio_stream_packet_s container.
Symbol type: function
#fio_stream_pack_fd
fio_stream_packet_s *fio_stream_pack_fd(int fd, size_t len, size_t offset, uint8_t keep_open)Packs a file descriptor into a fio_stream_packet_s container.
Symbol type: function
#fio_stream_add
void fio_stream_add(fio_stream_s *stream, fio_stream_packet_s *packet)Adds a packet to the stream. This isn't thread safe.
Symbol type: function
#fio_stream_pack_free
void fio_stream_pack_free(fio_stream_packet_s *packet)Destroys the fio_stream_packet_s - call this ONLY if unused.
Symbol type: function
#fio_stream_read
void fio_stream_read(fio_stream_s *stream, char **buf, size_t *len)Reads data from the stream (if any), leaving it in the stream.
buf MUST point to a buffer with - at least - len bytes. This is required
in case the packed data is fragmented or references a file and needs to be
copied to an available buffer.
On error, or if the stream is empty, buf will be set to NULL and len will
be set to zero.
Otherwise, buf may retain the same value or it may point directly to a
memory address within the stream's buffer (the original value may be lost)
and len will be updated to the largest possible value for valid data that
can be read from buf.
Note: this isn't thread safe.
Symbol type: function
#fio_stream_advance
void fio_stream_advance(fio_stream_s *stream, size_t len)Advances the Stream, so the first len bytes are marked as consumed.
Note: this isn't thread safe.
Symbol type: function
#fio_stream_any
inline uint8_t fio_stream_any(fio_stream_s *stream)Returns true if there's any data in the stream.
Note: this isn't truly thread safe.
Symbol type: function
#fio_stream_length
inline size_t fio_stream_length(fio_stream_s *stream)Returns the number of bytes waiting in the stream.
Note: this isn't truly thread safe.
Symbol type: function