-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.h
45 lines (31 loc) · 850 Bytes
/
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#define F_INIT 0x01
#define F_INIT_GOOD 0x02
#define F_INIT_BAD 0x03
#define F_BCAST 0x04
#define F_MSG 0x05
#define F_ERROR 0x07
#define F_EXIT 0x08
#define F_ACK 0x09
#define F_LIST 0x0A
#define F_INC 0x0B
#define F_HNDL 0x0C
#define MAXHNDL 100
#define BACKLOG 5
typedef struct HandleNode {
char* handle;
u_char handleLength;
int socket;
struct HandleNode* next;
} HandleNode;
void serve();
void serveClient(int client_socket);
void serveInit(char* packet, int inc_socket);
void serveMsg(char* packet, int inc_socket);
void serveBCast(char* packet, int inc_socket);
void serveList(int inc_socket);
void serveExit(int inc_socket);
int setupServer(int port);
void sendErrorPacket(int socket_num, char *handle, u_char handleLength);
int isHandleOpen(char* handle);
int getSocket(char* handle);
void removeClient(int client_socket);