1 | /* $Id: socket.cpp,v 1.9 2001-07-07 14:29:22 achimha Exp $ */
|
---|
2 | /*
|
---|
3 | * based on Windows Sockets 1.1 specs
|
---|
4 | * (ftp.microsoft.com:/Advsys/winsock/spec11/WINSOCK.TXT)
|
---|
5 | *
|
---|
6 | * (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka.
|
---|
7 | *
|
---|
8 | * NOTE: If you make any changes to fix a particular app, make sure
|
---|
9 | * they don't break something else like Netscape or telnet and ftp
|
---|
10 | * clients and servers (www.winsite.com got a lot of those).
|
---|
11 | *
|
---|
12 | * NOTE 2: Many winsock structs such as servent, hostent, protoent, ...
|
---|
13 | * are used with 1-byte alignment for Win16 programs and 4-byte alignment
|
---|
14 | * for Win32 programs in winsock.h. winsock2.h uses forced 4-byte alignment.
|
---|
15 | * So we have non-forced (just as MSDN) ws_XXXXent (winsock.h), 4-byte forced
|
---|
16 | * ws_XXXXent32 (winsock2.h) and 1-byte forced ws_XXXXent16 (winsock16.h).
|
---|
17 | */
|
---|
18 |
|
---|
19 | #include <odin.h>
|
---|
20 | #include <winsock2.h>
|
---|
21 | #include <debugtools.h>
|
---|
22 |
|
---|
23 | /***********************************************************************
|
---|
24 | * WSACreateEvent() (WS2_32.???)
|
---|
25 | *
|
---|
26 | */
|
---|
27 | WSAEVENT WINAPI WSACreateEvent(void)
|
---|
28 | {
|
---|
29 | /* Create a manual-reset event, with initial state: unsignealed */
|
---|
30 | TRACE("WSACreateEvent");
|
---|
31 |
|
---|
32 | return CreateEventA(NULL, TRUE, FALSE, NULL);
|
---|
33 | }
|
---|
34 |
|
---|
35 | BOOL WINAPI WSASetEvent(WSAEVENT hEvent)
|
---|
36 | {
|
---|
37 | TRACE("WSASetEvent event=0x%x\n", hEvent);
|
---|
38 | return SetEvent(hEvent);
|
---|
39 | }
|
---|
40 |
|
---|
41 | /***********************************************************************
|
---|
42 | * WSACloseEvent() (WS2_32.???)
|
---|
43 | *
|
---|
44 | */
|
---|
45 | BOOL WINAPI WSACloseEvent(WSAEVENT hEvent)
|
---|
46 | {
|
---|
47 | TRACE ("WSACloseEvent event=0x%x\n", hEvent);
|
---|
48 |
|
---|
49 | return CloseHandle(hEvent);
|
---|
50 | }
|
---|
51 |
|
---|
52 | /***********************************************************************
|
---|
53 | * WSASocketA() (WS2_32.???)
|
---|
54 | *
|
---|
55 | */
|
---|
56 | SOCKET WINAPI WSASocketA(int af, int type, int protocol,
|
---|
57 | LPWSAPROTOCOL_INFOA lpProtocolInfo,
|
---|
58 | GROUP g, DWORD dwFlags)
|
---|
59 | {
|
---|
60 | /*
|
---|
61 | FIXME: The "advanced" parameters of WSASocketA (lpProtocolInfo,
|
---|
62 | g, dwFlags) are ignored.
|
---|
63 | */
|
---|
64 |
|
---|
65 | TRACE("WSASocketA af=%d type=%d protocol=%d protocol_info=%p group=%d flags=0x%lx\n",
|
---|
66 | af, type, protocol, lpProtocolInfo, g, dwFlags );
|
---|
67 |
|
---|
68 | return ( socket (af, type, protocol) );
|
---|
69 | }
|
---|
70 |
|
---|
71 | /***********************************************************************
|
---|
72 | * WSASocketA() (WS2_32.???)
|
---|
73 | *
|
---|
74 | */
|
---|
75 | SOCKET WINAPI WSASocketW(int af, int type, int protocol,
|
---|
76 | LPWSAPROTOCOL_INFOW lpProtocolInfo,
|
---|
77 | GROUP g, DWORD dwFlags)
|
---|
78 | {
|
---|
79 | /*
|
---|
80 | FIXME: The "advanced" parameters of WSASocketA (lpProtocolInfo,
|
---|
81 | g, dwFlags) are ignored.
|
---|
82 | */
|
---|
83 |
|
---|
84 | TRACE("WSASocketW af=%d type=%d protocol=%d protocol_info=%p group=%d flags=0x%lx\n",
|
---|
85 | af, type, protocol, lpProtocolInfo, g, dwFlags );
|
---|
86 |
|
---|
87 | return ( socket (af, type, protocol) );
|
---|
88 | }
|
---|