-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.h
30 lines (24 loc) · 1.07 KB
/
server.h
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
#define MAX_COMMAND 11
/* Mutex & Threads */
pthread_mutex_t socket_mtx;
pthread_mutex_t list_mtx;
pthread_t thread;
pthread_attr_t thread_att;
/* Controls the access to the socket generated by the connection 'accept' */
pthread_cond_t free_socket;
pthread_cond_t free_list;
/* Variable that controls the state of the socket created by the connection 'accept' */
int busy_socket;
/* Declare the server socket as global variable */
int s_server;
/* Declare the list of users */
struct user *users;
char * store_service_ip; /* Variable for the IP of the message storage service server */
/* ================FUNCTION HEADERS================ */
void interruptHandler(int sig);
void * manageRequest(int *sd);
void toUpperCase(char * string);
int sendMessage(char * sender, char * receiver, char * msg, char * md5, unsigned int msg_id, char stored);
void sendAck(char * sender, unsigned int msg_id);
int storeMessage(char * sender, char * receiver, char * msg, char * md5, unsigned int mgs_id);
void storeMessage_svc(char * sender, char * receiver, unsigned int id, char * msg, char * md5);