aboutsummaryrefslogtreecommitdiff
path: root/src/shared/net/packet.hh
blob: 417fd0ee416a34fe1e202503122f5a923a9eb6ee (plain)
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
40
41
42
#ifndef SHARED_NET_PACKET_HH_
#define SHARED_NET_PACKET_HH_

#include <string>

#include "shared/net/net.hh"
#include "shared/net/proto.hh"
#include "shared/shared.hh"

namespace shared {
namespace net {

using packet_header_t = std::uint32_t;

// A packet is a simple object which holds compressed protobuf data.
// We split up upackets and rpackets as rpackets require a header on the
// (due to using the reliable stream) which is not the case for the unreliable
// stream.
class packet {
public:
    std::string data;

public:
    //virtual ~packet() = 0;
};

class upacket : public packet {
public:
    upacket(const proto::packet& proto);
    virtual ~upacket() {};
};

class rpacket : public packet {
public:
    rpacket(const proto::packet& proto);
    virtual ~rpacket() {};
};

} // namespace net
} // namespace shared

#endif