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