-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclt.h
42 lines (34 loc) · 837 Bytes
/
clt.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
#ifndef CLT_H_
#define CLT_H_
#include <time.h>
typedef enum{
CLIENT_STATE_EMPTY = -1,
CLIENT_STATE_REGISTERING = 0,
CLIENT_STATE_INIT,
CLIENT_STATE_READY
} client_state_t;
struct client{
int nid;
client_state_t state;
time_t lastact;
bool auth;
char *username;
char *nickname;
bool needs_playback;
char ping[11];
time_t pingsent;
};
void clt_clients_cinit(int cid);
int clt_clients_nid2cid(int nid);
int clt_clients_add(int nid);
void clt_clients_remove_cid(int cid);
void clt_clients_remove_nid(int nid);
int clt_init(void);
void clt_tick(void);
int clt_accept(void);
void clt_ping_send(int cid, int len);
void clt_ping_check(int cid, const char *pong);
void clt_message_process(int nid, char *buf);
void clt_message_sendf(int id, const char *format, ... );
void clt_message_send(int id, const char *data);
#endif