Mineserver
A rewrite of Minecraft 1.8.9 in C++ !
Loading...
Searching...
No Matches
packet.h
Go to the documentation of this file.
1
12#ifndef MINESERVER_PACKET_H
13#define MINESERVER_PACKET_H
14
15#include <net/stream.h>
16
25{
26protected:
37 virtual void write(IMCStream *stream) = 0;
38
45 IPacket(int id) : id(id)
46 {
47 }
48
49public:
54 virtual ~IPacket() = default;
61 int id;
62
72 virtual void read(IMCStream *stream) = 0;
82 void send(IMCStream *stream);
83};
84
85#endif // MINESERVER_PACKET_H
Stream interface.
Definition stream.h:32
Interface for all Packets.
Definition packet.h:25
IPacket(int id)
Construct a new IPacket object.
Definition packet.h:45
void send(IMCStream *stream)
Sends a Packet in Minecraft format.
Definition packet.cpp:15
virtual void write(IMCStream *stream)=0
Write packet data to stream.
virtual void read(IMCStream *stream)=0
Reads data from the stream to a packet.
virtual ~IPacket()=default
Destroy the IPacket object.
int id
Packet Id.
Definition packet.h:61
The file containing data for all of the streams.