aboutsummaryrefslogtreecommitdiffstats
path: root/toj/center/src/center_server.h
blob: 039e84beeb5d4d93a17050d164bd07078684b77b (plain) (blame)
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 SERVER_JUDGE_PORT 2573
#define SERVER_WEB_PORT 2501
#define SERVER_EPOLL_MAXEVENT 4096

#define SERVER_EPEV_JUDGESERVER 0
#define SERVER_EPEV_JUDGECLIENT 1
#define SERVER_EPEV_WEBSERVER 2
#define SERVER_EPEV_WEBCLIENT 3
#define SERVER_EPEV_TPOOL 4
class server_epevdata{
public:
    int fd;
    int type;
    void *data;

    server_epevdata(int fd,int type,void *data);
};

class server_web_conn{
private:
    int fd;
    char buf[65536];
    int off;
    int count;

public:
    server_web_conn(int fd);
    ~server_web_conn();
    int readio();
};

static int server_addepev(int fd,unsigned int flag,int type,void *data);
static int server_delepev(server_epevdata *epevdata);
static int server_epfd;

extern int center_manage_init(tpool **tpinfo);
extern int center_manage_updatedata();
extern int center_manage_submit(int subid,char *param);

extern int center_judge_init();
extern void* center_judge_addconn(int fd);
extern int center_judge_dispatch(int ev_flag,void *data);

extern int pack_pack(char *pack_path,char *dir_path);
extern int pack_unpack(char *pack_path,char *target_path);