summaryrefslogtreecommitdiff
path: root/src/apk_io.h
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2008-11-07 17:11:08 +0200
committerTimo Teras <timo.teras@iki.fi>2008-11-07 17:11:08 +0200
commitaef0f036f08f8949e4e2a5b84c9199ef8ec40595 (patch)
tree423ba9a4e5db4b8b38b6ccf2578c8c205ff7db4d /src/apk_io.h
parent6967c28b96784d474e6c2f50b075895d89f9ce02 (diff)
downloadapk-tools-aef0f036f08f8949e4e2a5b84c9199ef8ec40595.tar.gz
apk-tools-aef0f036f08f8949e4e2a5b84c9199ef8ec40595.tar.bz2
apk-tools-aef0f036f08f8949e4e2a5b84c9199ef8ec40595.tar.xz
apk-tools-aef0f036f08f8949e4e2a5b84c9199ef8ec40595.zip
use zlib internally to decompress
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/apk_io.h b/src/apk_io.h
new file mode 100644
index 0000000..a0ceac2
--- /dev/null
+++ b/src/apk_io.h
@@ -0,0 +1,38 @@
+/* apk_io.h - Alpine Package Keeper (APK)
+ *
+ * Copyright (C) 2008 Timo Teräs <timo.teras@iki.fi>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation. See http://www.gnu.org/ for details.
+ */
+
+#ifndef APK_IO
+#define APK_IO
+
+#include "apk_defines.h"
+#include "apk_blob.h"
+
+struct apk_istream {
+ size_t (*read)(void *stream, void *ptr, size_t size);
+ size_t (*splice)(void *stream, int fd, size_t size);
+ void (*close)(void *stream);
+};
+
+struct apk_bstream {
+ size_t (*read)(void *stream, void **ptr);
+ void (*close)(void *stream, csum_t csum);
+};
+
+struct apk_istream *apk_istream_from_fd(int fd);
+struct apk_istream *apk_istream_from_file(const char *file);
+size_t apk_istream_skip(struct apk_istream *istream, size_t size);
+size_t apk_istream_splice(void *stream, int fd, size_t size);
+
+struct apk_bstream *apk_bstream_from_istream(struct apk_istream *istream);
+struct apk_bstream *apk_bstream_from_fd(int fd);
+
+apk_blob_t apk_blob_from_istream(struct apk_istream *istream, size_t size);
+
+#endif