LexLeo 0.0.0-dev+f8e5087-dirty
Technical documentation
Loading...
Searching...
No Matches
stream_adapters_api.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
26#ifndef LEXLEO_STREAM_ADAPTERS_API_H
27#define LEXLEO_STREAM_ADAPTERS_API_H
28
31
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
56typedef size_t (*stream_read_fn_t)(
57 void *backend,
58 void *buf,
59 size_t n,
60 stream_status_t *st);
61
80typedef size_t (*stream_write_fn_t)(
81 void *backend,
82 const void *buf,
83 size_t n,
84 stream_status_t *st);
85
95typedef stream_status_t (*stream_flush_fn_t)(void *backend);
96
110typedef stream_status_t (*stream_close_fn_t)(void *backend);
111
135
178 stream_t **out,
179 const stream_vtbl_t *vtbl,
180 void *backend,
181 const stream_env_t *env);
182
183#ifdef __cplusplus
184}
185#endif
186
187#endif // LEXLEO_STREAM_ADAPTERS_API_H
size_t(* stream_write_fn_t)(void *backend, const void *buf, size_t n, stream_status_t *st)
Backend write operation for a stream adapter.
size_t(* stream_read_fn_t)(void *backend, void *buf, size_t n, stream_status_t *st)
Backend read operation for a stream adapter.
stream_status_t(* stream_flush_fn_t)(void *backend)
Backend flush operation for a stream adapter.
stream_status_t stream_create(stream_t **out, const stream_vtbl_t *vtbl, void *backend, const stream_env_t *env)
Create a generic stream handle from adapter-provided backend bindings.
Definition stream.c:69
stream_status_t(* stream_close_fn_t)(void *backend)
Backend close operation for a stream adapter.
Public environment type for the stream port.
Borrower-visible public types for the stream port.
stream_status_t
Public status codes used by the stream port.
Runtime environment for the stream port.
Definition stream_env.h:35
Private handle structure for a stream_t.
Adapter dispatch table bound to a stream_t instance.
stream_read_fn_t read
stream_write_fn_t write
stream_close_fn_t close
stream_flush_fn_t flush