forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 9
/
socketpuller.h
executable file
·47 lines (34 loc) · 1.28 KB
/
socketpuller.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
46
47
#ifndef SOCKETPULLER_H_INCLUDED
#define SOCKETPULLER_H_INCLUDED
/** Non-thread-safe socket puller */
#include "socketpool.h"
#include "common.h"
#include "oo.h"
typedef struct _SocketPuller SocketPuller;
struct _SocketPuller{
PRIMEMB SocketPool p;
PRIMEMB fd_set s;
PRIMEMB SOCKET Max;
PUBMEMB int (*Add)(SocketPuller *p,
SOCKET s,
const void *Data,
int DataLength
);
int (*Del)(SocketPuller *p, SOCKET s);
PUBMEMB SOCKET (*Select)(SocketPuller *p,
struct timeval *tv,
void **Data,
BOOL Reading,
BOOL Writing,
int *err
);
PUBMEMB void (*CloseAll)(SocketPuller *p, SOCKET ExceptFor);
PUBMEMB void (*Free)(SocketPuller *p);
PUBMEMB void (*FreeWithoutClose)(SocketPuller *p);
};
int SocketPuller_Init(SocketPuller *p, int DataLength);
SocketPuller **SocketPullers_Init(int Count, int DataLength);
void SocketPullers_CloseAll(SocketPuller **Pullers);
void SocketPullers_FreeWithoutClose(SocketPuller **Pullers);
void SocketPullers_Free(SocketPuller **Pullers);
#endif /* SOCKETPULLER_H_INCLUDED */