source: abuse/trunk/src/imlib/packet.hpp @ 128

Last change on this file since 128 was 57, checked in by Sam Hocevar, 15 years ago
  • Move each header to the same directory as its corresponding source, to get a better idea of which files are likely to export symbols.
File size: 981 bytes
RevLine 
[56]1/*
2 *  Abuse - dark 2D side-scrolling platform game
3 *  Copyright (c) 1995 Crack dot Com
4 *
5 *  This software was released into the Public Domain. As with most public
6 *  domain software, no warranty is made or implied by Crack dot Com or
7 *  Jonathan Clark.
8 */
9
[2]10#ifndef __PACKET_HPP_
11#define __PACKET_HPP_
12#include "macs.hpp"
13class packet
14{
15  public :
[17]16  uint8_t *buf;
17  int32_t buf_size,ro,wo,rend;
[2]18  int pre_size;
19  void make_bigger(int max);
20
21  int get_read_position() { return ro; }
22  void set_read_position(int x) { ro=x; }
[17]23  int read(uint8_t *buffer, int size);
24  int write(uint8_t *buffer, int size);
[2]25  int eop() { return ro>=rend; }
26  void reset();
27  packet(int prefix_size=2);
28  void get_string(char *st, int len);
[17]29  int advance(int32_t offset);
[2]30
[17]31  void write_uint32(uint32_t x);      // writes can't fail...
32  void write_uint16(uint16_t x);
33  void write_uint8(uint8_t x);
[2]34  void insert_into(packet &pk);
35  int size() { return rend-pre_size; }
36  ~packet();
37} ;
38
39
40
41#endif
Note: See TracBrowser for help on using the repository browser.