forked from yaosj2k/dnsforwarder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
socketpool.h
executable file
·42 lines (31 loc) · 866 Bytes
/
socketpool.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 SOCKETPOOL_H_INCLUDED
#define SOCKETPOOL_H_INCLUDED
#include <time.h>
#include "bst.h"
#include "stablebuffer.h"
#include "common.h"
typedef struct _SocketUnit {
SOCKET Sock;
const char *Data;
} SocketUnit;
typedef struct _SocketPool SocketPool;
struct _SocketPool{
/* private */
Bst t;
StableBuffer d;
/* public */
int (*Add)(SocketPool *sp,
SOCKET Sock,
const void *Data,
int DataLength
);
int (*Del)(SocketPool *sp, SOCKET Sock);
SOCKET (*FetchOnSet)(SocketPool *sp,
fd_set *fs,
void **Data
);
void (*CloseAll)(SocketPool *sp, SOCKET ExceptFor);
void (*Free)(SocketPool *sp, BOOL CloseAllSocket);
};
int SocketPool_Init(SocketPool *sp);
#endif // SOCKETPOOL_H_INCLUDED