2022-09-13 21:40:23 +02:00
|
|
|
#ifndef SERVER_H
|
|
|
|
#define SERVER_H
|
|
|
|
|
2022-10-19 22:55:51 +02:00
|
|
|
#define LISTEN_ALL // define to listen on 0.0.0.0, else loopback
|
2022-10-21 13:39:01 +02:00
|
|
|
#define MAX_CLIENTS 100 // how many clients the server can handle
|
|
|
|
|
|
|
|
/* Details for each client, used by Dispatcher and passed to client threads */
|
|
|
|
struct client_details {
|
|
|
|
int id, pipe, sockid;
|
|
|
|
};
|
2022-10-19 22:55:51 +02:00
|
|
|
|
2022-10-21 10:28:23 +02:00
|
|
|
/* Thread, parses and handles messages */
|
2022-10-21 11:05:39 +02:00
|
|
|
void *Dispatcher(void*);
|
2022-10-21 10:28:23 +02:00
|
|
|
|
2022-10-21 09:43:04 +02:00
|
|
|
/* Thread, listens for incoming messages */
|
2022-10-21 11:05:39 +02:00
|
|
|
void *ClientListener(void*);
|
2022-10-21 09:43:04 +02:00
|
|
|
|
|
|
|
/* Thread, sends messages to the client */
|
2022-10-21 11:05:39 +02:00
|
|
|
void *ClientSender(void*);
|
2022-10-21 09:43:04 +02:00
|
|
|
|
2022-10-19 22:35:06 +02:00
|
|
|
/* Handles a client after its connection */
|
2022-09-13 21:40:23 +02:00
|
|
|
void service(int);
|
|
|
|
|
2022-10-19 22:35:06 +02:00
|
|
|
/* Handler for signal() */
|
2022-09-13 21:40:23 +02:00
|
|
|
void interrupt(int);
|
|
|
|
|
|
|
|
#endif
|