 |
C-chat
|
Go to the documentation of this file.
6 #ifndef C_CHAT_CLIENT_H
7 #define C_CHAT_CLIENT_H
9 #include "../common/sockets.h"
10 #include "../common/constants.h"
11 #include "../common/threads.h"
12 #include "../common/packets.h"
13 #include "../common/synchronization.h"
19 #define NUMBER_CLIENT_MAX 10
51 unsigned int downloadedFileId;
100 #define SYNC_CLIENT_READ(op) \
101 acquireRead(clientsLock); \
103 releaseRead(clientsLock);
109 #define SYNC_CLIENT_WRITE(op) \
110 acquireWrite(clientsLock); \
112 releaseWrite(clientsLock);
118 #define SYNC_ROOMS_READ(op) \
119 acquireRead(roomsLock); \
121 releaseRead(roomsLock);
127 #define SYNC_ROOMS_WRITE(op) \
128 acquireWrite(roomsLock); \
130 releaseWrite(roomsLock);
136 #define SYNC_ROOM_READ(room, op) \
137 acquireRead(room->lock); \
139 releaseRead(room->lock);
145 #define SYNC_ROOM_READ(room, op) \
146 acquireRead(room->lock); \
148 releaseRead(room->lock);
167 #endif //C_CHAT_CLIENT_H
A read/write lock to synchronize resource access.
Definition: synchronization.h:21
Client * clients[MAX_USERS_PER_ROOM]
Definition: server.h:78
short joined
Definition: server.h:36
Information of a socket.
Definition: sockets.h:19
#define USERNAME_MAX_LENGTH
Maximum length for a client username.
Definition: constants.h:23
struct Room * room
Definition: server.h:64
#define NUMBER_ROOM_MAX
The maximum of supported rooms.
Definition: constants.h:66
char username[USERNAME_MAX_LENGTH+1]
Definition: server.h:31
Thread thread
Definition: server.h:38
Represents a thread.
Definition: threads.h:44
Socket socket
Definition: server.h:29
void handleServerClose(int signal)
Catch interrupt signal.
Definition: server.c:26
#define ROOM_DESC_MAX_LENGTH
The maximum length for the description of a room.
Definition: constants.h:54
A type representing a connected client.
Definition: server.h:27
#define ROOM_NAME_MAX_LENGTH
The maximum length for a name of a room.
Definition: constants.h:48
#define MAX_USERS_PER_ROOM
The maximum amount of users connected simultaneously to a room.
Definition: constants.h:60
Room * rooms[NUMBER_ROOM_MAX]
Definition: server.c:24
#define MAX_CONCURRENT_FILE_TRANSFER
Maximum concurrent transfer of file allowed per client.
Definition: constants.h:42
#define NUMBER_CLIENT_MAX
Maximum of simultaneous connected clients.
Definition: server.h:19
void handleClientsPackets(Client *client)
Relay messages sent by given client to all known clients.
Definition: server.c:56