-
Notifications
You must be signed in to change notification settings - Fork 0
/
stream_buffer.h
executable file
·39 lines (31 loc) · 1.71 KB
/
stream_buffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef STREAM_BUFFER_H_
#define STREAM_BUFFER_H_
#include <stdint.h>
#include <string.h>
struct stream_buffer {
unsigned char* buffer;
size_t size;
int head, write_offset;
};
void stream_initialize(struct stream_buffer* stream, unsigned char* buffer, size_t size);
void stream_free(struct stream_buffer* stream);
void stream_resize(struct stream_buffer* stream, size_t size);
void stream_read(struct stream_buffer* stream, void* buffer, size_t size);
void stream_write(struct stream_buffer* stream, void* buffer, size_t size);
void stream_read_int32(struct stream_buffer* stream, int32_t* out_data);
void stream_read_int16(struct stream_buffer* stream, int16_t* out_data);
void stream_read_int8(struct stream_buffer* stream, int8_t* out_data);
void stream_read_uint32(struct stream_buffer* stream, uint32_t* out_data);
void stream_read_uint16(struct stream_buffer* stream, uint16_t* out_data);
void stream_read_uint8(struct stream_buffer* stream, uint8_t* out_data);
void stream_read_string(struct stream_buffer* stream, char* out_data, size_t size);
void stream_read_string64(struct stream_buffer* stream, char* out_data);
void stream_write_int32(struct stream_buffer* stream, int32_t in_data);
void stream_write_int16(struct stream_buffer* stream, int16_t in_data);
void stream_write_int8(struct stream_buffer* stream, int8_t in_data);
void stream_write_uint32(struct stream_buffer* stream, uint32_t in_data);
void stream_write_uint16(struct stream_buffer* stream, uint16_t in_data);
void stream_write_uint8(struct stream_buffer* stream, uint8_t in_data);
void stream_write_string(struct stream_buffer* stream, char* in_data, size_t size);
void stream_write_string64(struct stream_buffer* stream, char* in_data);
#endif // STREAM_BUFFER_H_