summaryrefslogtreecommitdiff
path: root/src/io.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/io.h')
-rw-r--r--src/io.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/io.h b/src/io.h
index a543ae5..5c64857 100644
--- a/src/io.h
+++ b/src/io.h
@@ -43,6 +43,12 @@ struct stream {
structure pointing to it. */
struct stream *stream_new(size_t len);
+/* Copies `n` bytes from `s` into a new stream structure. */
+struct stream *stream_clone(struct stream *s, size_t n);
+
+/* Maps the file at the given `path` into a stream structure. */
+struct stream *stream_from_file(char *path);
+
/* Called to free or unmap the memory chunk associated with the given
stream, as well as the stream structure itself. */
void stream_free(struct stream *s);
@@ -55,6 +61,9 @@ void stream_read(void *dest, struct stream *s, size_t n);
by `src`. The stream's cursor is advanced appropriately. */
void stream_write(struct stream *s, void *src, size_t n);
+/* Dumps the contents of `s` into the file specified by `fp`. */
+void stream_dump(FILE *fp, struct stream *s, size_t n);
+
/* Applies an initial and primary key to the given stream, effectively
encrypting or decrypting it. */
void stream_xor(struct stream *s, uint8_t initial, uint8_t primary);