From 81e1b39d2ea9ffa07f11aed3f230a7f26792058f Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Wed, 29 Jan 2020 22:57:39 +0100 Subject: openpgp-ffi: Add a general writer interface. --- openpgp-ffi/include/sequoia/io.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'openpgp-ffi/include') diff --git a/openpgp-ffi/include/sequoia/io.h b/openpgp-ffi/include/sequoia/io.h index 103116ae..8cce06c5 100644 --- a/openpgp-ffi/include/sequoia/io.h +++ b/openpgp-ffi/include/sequoia/io.h @@ -83,6 +83,18 @@ pgp_writer_t pgp_writer_from_bytes (uint8_t *buf, size_t len); /*/ pgp_writer_t pgp_writer_alloc (void **buf, size_t *len); +/*/ +/// The callback type for the generic callback-based writer interface. +/*/ +typedef ssize_t (*pgp_writer_cb_t) (void *cookie, const void *buf, size_t len); + +/*/ +/// Creates an writer from a callback and cookie. +/// +/// This writer calls the given callback to write data. +/*/ +pgp_writer_t pgp_writer_from_callback (pgp_writer_cb_t, void *); + /*/ /// Frees a writer. /*/ -- cgit v1.2.3