-
Notifications
You must be signed in to change notification settings - Fork 2
/
clients.h
41 lines (31 loc) · 879 Bytes
/
clients.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
#ifndef CLIENTSH
#define CLIENTSH
#include <poll.h>
#include <time.h>
#include <string.h>
struct TClient
{
int m_sock;
char* m_sendbuff;
size_t m_remain;
int m_ipid;
int m_opid;
struct timeval m_timer;
};
struct TClients
{
struct TClient* m_client;
int m_count;
int m_blocked;
};
extern struct TClients g_clients;
int client2set(int index);
int clients_loop(char* recvbuff, int nready);
void client_add(int socket);
int client_POLLOUT(int nready, struct pollfd* set, struct TClient* client, char* recvbuff);
int client_POLLIN (int nready, struct pollfd* set, struct TClient* client, char* recvbuff);
void client_sendall(char* buff, const size_t buffsize);
void client_disconnect(struct TClient* client);
void client_tdisconnect(struct TClient* client);
void client_disconnectall();
#endif