LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
stream_types.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: GPL-3.0-or-later
2 * Copyright (C) 2026 Sylvain Labopin
3 */
4
15#ifndef LEXLEO_STREAM_TYPES_H
16#define LEXLEO_STREAM_TYPES_H
17
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
31typedef struct stream_t stream_t;
32
68
76typedef struct stream_ops_t {
95 size_t (*read)(stream_t *s, void *buf, size_t n, stream_status_t *st);
96
115 size_t (*write)(stream_t *s, const void *buf, size_t n, stream_status_t *st);
116
128
129#ifdef __cplusplus
130}
131#endif
132
133#endif // LEXLEO_STREAM_TYPES_H
stream_status_t
Public status codes used by the stream port.
@ STREAM_STATUS_INVALID
@ STREAM_STATUS_EOF
@ STREAM_STATUS_IO_ERROR
@ STREAM_STATUS_OK
@ STREAM_STATUS_FULL
@ STREAM_STATUS_NOT_FOUND
@ STREAM_STATUS_OOM
@ STREAM_STATUS_ALREADY_EXISTS
@ STREAM_STATUS_NO_BACKEND
Borrower-facing operation table for the stream port.
stream_status_t(* flush)(stream_t *s)
Flush a stream.
size_t(* read)(stream_t *s, void *buf, size_t n, stream_status_t *st)
Read bytes from a stream.
size_t(* write)(stream_t *s, const void *buf, size_t n, stream_status_t *st)
Write bytes to a stream.
Private handle structure for a stream_t.