HY335a-Project
A_multithread_chat_Server_and_chat_client
 All Data Structures Files Functions Variables Typedefs Enumerations Macros
chatclient.h
Go to the documentation of this file.
1 #ifndef CHATCLIENT_H
2 #define CHATCLIENT_H
3 
30 #include <stddef.h>
31 typedef char boolean;
32 
33 #define TRUE 1
34 #define FALSE 0
35 
36 
56 typedef enum {
57  LOGIN_MSG = 0x1,
58  LOGOUT_MSG = 0x2,
59  TEXT_MSG = 0x3,
60  USERNAME_NOT_EXIST = 0x4,
61  USER_ALREADY_LOGGED = 0x5,
62  USERS_LOGGED_REQUEST = 0x6,
63  USERS_LOGGED_RESPONSE = 0x7,
64  BROADCAST_MSG = 0x8,
65  UKNOWN_MSG_TYPE = 0xFE,
66  GENERAL_ERROR = 0xFF
67 } msg_type_t;
68 
79 int connect_to_server(int port, char *ip);
80 
81 
92 msg_type_t get_message_type(char *buffer, size_t buf_len);
93 
94 /*
95  * fill the rest of the functions that you may use
96  */
97 #endif