diff options
| author | jakob <jakob@memeware.net> | 2017-03-01 19:03:20 -0500 |
|---|---|---|
| committer | jakob <jakob@memeware.net> | 2017-03-01 19:03:20 -0500 |
| commit | 0e67a05edcc3ba01221a6bfd14750b5b8090887f (patch) | |
| tree | 94729dcef273244164d6b84d72d17481818baa7f /src/io.h | |
| parent | d65a3ae8790ae28a90f0ebcf0bc4dc078c67dc35 (diff) | |
First working commit of the rewrite.
Diffstat (limited to 'src/io.h')
| -rw-r--r-- | src/io.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -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); |