Last change
on this file since 32 was
17,
checked in by Sam Hocevar, 17 years ago
|
- absolute shitloads of 64 bit fixes.
|
File size:
717 bytes
|
Rev | Line | |
---|
[2] | 1 | #ifndef __PACKET_HPP_ |
---|
| 2 | #define __PACKET_HPP_ |
---|
| 3 | #include "macs.hpp" |
---|
| 4 | class packet |
---|
| 5 | { |
---|
| 6 | public : |
---|
[17] | 7 | uint8_t *buf; |
---|
| 8 | int32_t buf_size,ro,wo,rend; |
---|
[2] | 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; } |
---|
[17] | 14 | int read(uint8_t *buffer, int size); |
---|
| 15 | int write(uint8_t *buffer, int size); |
---|
[2] | 16 | int eop() { return ro>=rend; } |
---|
| 17 | void reset(); |
---|
| 18 | packet(int prefix_size=2); |
---|
| 19 | void get_string(char *st, int len); |
---|
[17] | 20 | int advance(int32_t offset); |
---|
[2] | 21 | |
---|
[17] | 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); |
---|
[2] | 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.