2013-01-29 21:45:44 -07:00
|
|
|
#ifndef _STREAM_H
|
|
|
|
#define _STREAM_H
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
|
|
struct stream {
|
2013-01-29 21:53:17 -07:00
|
|
|
char const *buf;
|
|
|
|
size_t len;
|
2013-01-29 21:45:44 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
void sinit(struct stream *s, char const *buf, size_t len);
|
|
|
|
bool sskip(struct stream *s, size_t count);
|
|
|
|
bool sread(struct stream *s, void *buf, size_t count);
|
|
|
|
uint8_t read_uint8(struct stream *s);
|
|
|
|
uint16_t read_uint16be(struct stream *s);
|
|
|
|
uint16_t read_uint16le(struct stream *s);
|
|
|
|
uint32_t read_uint32be(struct stream *s);
|
|
|
|
uint32_t read_uint32le(struct stream *s);
|
|
|
|
|
|
|
|
#endif
|