diff options
author | Ubuntu <baitinq@Peces.qluofd4gyjdubpy0ojfn3gxkic.bx.internal.cloudapp.net> | 2020-06-05 17:12:19 +0000 |
---|---|---|
committer | Ubuntu <baitinq@Peces.qluofd4gyjdubpy0ojfn3gxkic.bx.internal.cloudapp.net> | 2020-06-05 17:12:19 +0000 |
commit | c739aa0cf8fc885c8cad79d2d639d0ecd49bd5ae (patch) | |
tree | 66fb3ec1af228082fab674e9aa98ba17d6b9cb44 /structs.hpp | |
download | encrypted-chat-c739aa0cf8fc885c8cad79d2d639d0ecd49bd5ae.tar.gz encrypted-chat-c739aa0cf8fc885c8cad79d2d639d0ecd49bd5ae.tar.bz2 encrypted-chat-c739aa0cf8fc885c8cad79d2d639d0ecd49bd5ae.zip |
Diffstat (limited to 'structs.hpp')
-rw-r--r-- | structs.hpp | 60 |
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; + +}; |