blob: b94ad372a902cf24e5ac0808064ca0e35e1891d6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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;
};
|