diff options
Diffstat (limited to 'src/Network.hpp')
-rw-r--r-- | src/Network.hpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/Network.hpp b/src/Network.hpp new file mode 100644 index 0000000..1281289 --- /dev/null +++ b/src/Network.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include <memory> +#include "Socket.hpp" +#include "Packet.hpp" + +enum ConnectionState { + Handshaking, + Login, + Play, + Status, +}; + +class Network { + Socket *socket; + StreamSocket *stream; + + std::shared_ptr<Packet> ReceivePacketByPacketId(int packetId, ConnectionState state, StreamInput &stream); +public: + Network(std::string address, unsigned short port); + ~Network(); + + std::shared_ptr<Packet> ReceivePacket(ConnectionState state = Play); + void SendPacket(Packet &packet); + std::shared_ptr<Packet> ParsePacketPlay(PacketNamePlayCB id); +};
\ No newline at end of file |