From c739aa0cf8fc885c8cad79d2d639d0ecd49bd5ae Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Fri, 5 Jun 2020 17:12:19 +0000 Subject: Release --- structs.hpp | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 structs.hpp (limited to 'structs.hpp') diff --git a/structs.hpp b/structs.hpp new file mode 100644 index 0000000..b94ad37 --- /dev/null +++ b/structs.hpp @@ -0,0 +1,60 @@ +struct Options +{ + bool server; + char name[20]; + char ip[20]; + char port[20]; + bool encryption; + bool pass; + char password[20]; + bool interactive; + int max_clients; + int sockfd; +}; + + +enum class PacketType +{ + packet_connect, + packet_disconnect, + packet_message, + packet_ping +}; + +struct PacketConnect +{ + char name[20]; + bool pass; + char password[20]; +}; + +struct PacketDisconnect +{ + char name[20]; +}; + +struct PacketMessage +{ + int client_fd; + bool server; + char name[20]; + char message[200];//make it var length +}; + +struct PacketPing +{ + char name[20]; +}; + +struct Packet +{ + PacketType type; + union + { + PacketConnect packet_connect; + PacketDisconnect packet_disconnect; + PacketMessage packet_message; + PacketPing packet_ping; + } data; + +}; -- cgit 1.4.1