summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/include
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-01-29 22:57:39 +0100
committerJustus Winter <justus@sequoia-pgp.org>2020-01-29 23:48:15 +0100
commit81e1b39d2ea9ffa07f11aed3f230a7f26792058f (patch)
tree509b61e4b3e0535e82d4277e809e3023ec8cf839 /openpgp-ffi/include
parente5ee74691f21f46bdc30556a6b67ecf5f9532ece (diff)
openpgp-ffi: Add a general writer interface.
Diffstat (limited to 'openpgp-ffi/include')
-rw-r--r--openpgp-ffi/include/sequoia/io.h12
1 files changed, 12 insertions, 0 deletions
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
@@ -84,6 +84,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.
/*/
void pgp_writer_free (pgp_writer_t writer);