source: abuse/tags/pd/macabuse/imlib/include/packet.hpp @ 49

Last change on this file since 49 was 49, checked in by Sam Hocevar, 12 years ago
  • Imported original public domain release, for future reference.
File size: 694 bytes
Line 
1#ifndef __PACKET_HPP_
2#define __PACKET_HPP_
3#include "macs.hpp"
4class packet
5{
6  public :
7  uchar *buf;
8  long 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(uchar *buffer, int size);
15  int write(uchar *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(long offset);
21
22  void write_long(ulong x);      // writes can't fail...
23  void write_short(ushort x);
24  void write_byte(uchar 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.