Last change
on this file since 28 was
17,
checked in by Sam Hocevar, 18 years ago
|
- absolute shitloads of 64 bit fixes.
|
File size:
717 bytes
|
Line | |
---|
1 | #ifndef __PACKET_HPP_ |
---|
2 | #define __PACKET_HPP_ |
---|
3 | #include "macs.hpp" |
---|
4 | class packet |
---|
5 | { |
---|
6 | public : |
---|
7 | uint8_t *buf; |
---|
8 | int32_t buf_size,ro,wo,rend; |
---|
9 | int pre_size; |
---|
10 | void make_bigger(int max); |
---|
11 | |
---|
12 | int get_read_position() { return ro; } |
---|
13 | void set_read_position(int x) { ro=x; } |
---|
14 | int read(uint8_t *buffer, int size); |
---|
15 | int write(uint8_t *buffer, int size); |
---|
16 | int eop() { return ro>=rend; } |
---|
17 | void reset(); |
---|
18 | packet(int prefix_size=2); |
---|
19 | void get_string(char *st, int len); |
---|
20 | int advance(int32_t offset); |
---|
21 | |
---|
22 | void write_uint32(uint32_t x); // writes can't fail... |
---|
23 | void write_uint16(uint16_t x); |
---|
24 | void write_uint8(uint8_t x); |
---|
25 | void insert_into(packet &pk); |
---|
26 | int size() { return rend-pre_size; } |
---|
27 | ~packet(); |
---|
28 | } ; |
---|
29 | |
---|
30 | |
---|
31 | |
---|
32 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.