From 0e67a05edcc3ba01221a6bfd14750b5b8090887f Mon Sep 17 00:00:00 2001 From: jakob Date: Wed, 1 Mar 2017 19:03:20 -0500 Subject: First working commit of the rewrite. --- src/io.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/io.h') 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); -- cgit v1.3