-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient_handler.h
More file actions
39 lines (29 loc) · 846 Bytes
/
client_handler.h
File metadata and controls
39 lines (29 loc) · 846 Bytes
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
#ifndef __CLIENT_HANDLER_H__
#define __CLIENT_HANDLER_H__
// Macro definitions
#define BUFFER_SIZE 1024
// Custom includes
#include "shared.h"
// Commands
#define CMD_PREFIX '.'
#define CMD_HELP ".help"
#define CMD_QUIT ".quit"
#define CMD_NAME ".name"
#define CMD_MSG ".msg"
#define CMD_MSG_ALL ".msg_all"
#define CMD_LIST ".list"
// Add client to room
client_t* register_client(char *name, char *ip_address, int conn_fd);
// Remove client from room
void remove_client(int conn_fd);
// List all active clients
void send_active_clients(int conn_fd);
// Handle client communication
void handle_clients();
// Get pending client
client_t* get_pending_client();
// Get pointer to free slot from shrared memory
client_t* get_free_slot();
// Terminates string on newline character
void strip_newline(char *s);
#endif