WvStreams
win32
streams.h
1
#ifndef __WIN32_STREAMS_H
2
#define __WIN32_STREAMS_H
3
4
#include <winsock2.h>
5
6
extern
"C"
{
7
int
close(
int
fd);
8
int
read(
int
fd,
void
*buf,
size_t
count);
9
int
write(
int
fd,
const
void
*buf,
size_t
count);
10
11
unsigned
int
sleep(
unsigned
int
seconds);
// does this belong here?
12
}
13
14
#ifndef __GNUC__
15
16
// this little trick allows us to define our own close/read/write
17
// (in streams.cc) that optionally call _close/_read/_write (defined in <io.h>)
18
#define __STDC__ 1
// prevents io.h from dllimporting close/read/write
19
20
#endif
21
22
#include <io.h>
23
24
struct
socket_fd_pair
25
{
26
SOCKET socket;
27
int
fd;
28
};
29
30
class
SocketFromFDMaker
31
{
32
protected
:
33
HANDLE m_hThread;
34
socket_fd_pair
m_pair;
35
SOCKET m_socket;
36
bool
m_wait;
37
public
:
38
SocketFromFDMaker
(
int
fd, LPTHREAD_START_ROUTINE lpt,
39
bool
wait_for_termination =
false
);
40
~SocketFromFDMaker
();
41
SOCKET GetSocket() {
return
m_socket; }
42
};
43
44
DWORD WINAPI fd2socket_fwd(LPVOID lpThreadParameter);
45
DWORD WINAPI socket2fd_fwd(LPVOID lpThreadParameter);
46
47
#endif
// __WIN32_STREAMS_H
SocketFromFDMaker
Definition
streams.h:31
socket_fd_pair
Definition
streams.h:25
Generated by
1.9.8