-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.h
More file actions
58 lines (48 loc) · 1.08 KB
/
Copy pathserver.h
File metadata and controls
58 lines (48 loc) · 1.08 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __SERVER_H__
#define __SERVER_H__
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "c_hashmap/hashmap.h"
#include "crc32/crc32.h"
#include "server_configs.h"
#include "packet.h"
#include "mysql_connector.h"
#include "random_pool.h"
#include "list/gnu_list.h"
#include "timer.h"
#include "server_configs.h"
#include "messages.h"
struct user;
struct timeout {
int alive_time;
};
struct client {
struct epoll_event event;
struct cbtimer timer;
char name[20], ipaddr[20];
int fd;
struct sockaddr addr;
struct timeout timeout;
struct user *usr;
struct message_looper looper;
int buffer_offset;
char buffer[SERVER_MAX_PACKETS];
char respond[SERVER_MAX_PACKETS];
};
struct server {
int serverfd, epollfd, stop_server;
struct epoll_event event, eventlist[MAX_EVENTS];
struct sockaddr_in serveraddr;
struct mysql_config *mysql_config;
struct random_pool random;
int dump;
map_t clients_map;
map_t methods_map;
map_t users_map;
map_t tokens_map;
struct list_head timers_list;
};
#endif /*__SERVER_H__*/