HY335a-Project
A_multithread_chat_Server_and_chat_client
 All Classes Files Functions Variables Typedefs Enumerations Macros
chatclient.h
Go to the documentation of this file.
1 #ifndef CHATCLIENT_H
2 #define CHATCLIENT_H
3 
27 #include <stddef.h>
28 #include <string>
29 
30 
31 
51 typedef enum {
52  LOGIN_MSG = 0x1,
53  LOGOUT_MSG = 0x2,
54  TEXT_MSG = 0x3,
55  USERNAME_NOT_EXIST = 0x4,
56  USER_ALREADY_LOGGED = 0x5,
57  USERS_LOGGED_REQUEST = 0x6,
58  USERS_LOGGED_RESPONSE = 0x7,
59  BROADCAST_MSG = 0x8,
60  UKNOWN_MSG_TYPE = 0xFE,
61  GENERAL_ERROR = 0xFF
62 } msg_type_t;
63 
64 class chatclient{
65 private:
66  unsigned int d_server_port;
67 
68  std::string d_server_ip;
69  std::string d_username;
70 
71  bool d_use_automatic_server_disc;
72 
73 public:
87  chatclient(std::string server_ip,
88  unsigned int port,
89  bool automatic_discovery,
90  std::string username);
91 
102  msg_type_t get_message_type(char *buffer, size_t buf_len);
103 
104  /*
105  * Fill your methods here!
106  */
107 };
108 
109 #endif