about summary refs log tree commit diff
path: root/structs.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'structs.hpp')
-rw-r--r--structs.hpp60
1 files changed, 60 insertions, 0 deletions
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;
+	
+};