Some work on winsock stack
[reactos.git] / reactos / lib / ws2_32 / misc / sndrcv.c
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS WinSock 2 DLL
4 * FILE: misc/sndrcv.c
5 * PURPOSE: Send/receive functions
6 * PROGRAMMERS: Casper S. Hornstrup (chorns@users.sourceforge.net)
7 * REVISIONS:
8 * CSH 01/09-2000 Created
9 */
10 #include <ws2_32.h>
11 #include <catalog.h>
12
13 INT
14 EXPORT
15 recv(
16 IN SOCKET s,
17 OUT CHAR FAR* buf,
18 IN INT len,
19 IN INT flags)
20 {
21 UNIMPLEMENTED
22
23 return 0;
24 }
25
26
27 INT
28 EXPORT
29 recvfrom(
30 IN SOCKET s,
31 OUT CHAR FAR* buf,
32 IN INT len,
33 IN INT flags,
34 OUT LPSOCKADDR from,
35 IN OUT INT FAR* fromlen)
36 {
37 UNIMPLEMENTED
38
39 return 0;
40 }
41
42
43 INT
44 EXPORT
45 send(
46 IN SOCKET s,
47 IN CONST CHAR FAR* buf,
48 IN INT len,
49 IN INT flags)
50 {
51 UNIMPLEMENTED
52
53 return 0;
54 }
55
56
57 INT
58 EXPORT
59 sendto(
60 IN SOCKET s,
61 IN CONST CHAR FAR* buf,
62 IN INT len,
63 IN INT flags,
64 IN CONST LPSOCKADDR to,
65 IN INT tolen)
66 {
67 DWORD BytesSent;
68 WSABUF WSABuf;
69
70 WS_DbgPrint(MAX_TRACE, ("s (0x%X) buf (0x%X) len (0x%X) flags (0x%X).\n",
71 s, buf, len, flags));
72
73 WSABuf.len = len;
74 WSABuf.buf = (CHAR FAR*)buf;
75
76 return WSASendTo(s, &WSABuf, 1, &BytesSent, flags, to, tolen, NULL, NULL);
77 }
78
79
80 INT
81 EXPORT
82 WSARecv(
83 IN SOCKET s,
84 IN OUT LPWSABUF lpBuffers,
85 IN DWORD dwBufferCount,
86 OUT LPDWORD lpNumberOfBytesRecvd,
87 IN OUT LPDWORD lpFlags,
88 IN LPWSAOVERLAPPED lpOverlapped,
89 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
90 {
91 UNIMPLEMENTED
92
93 return 0;
94 }
95
96
97 INT
98 EXPORT
99 WSARecvDisconnect(
100 IN SOCKET s,
101 OUT LPWSABUF lpInboundDisconnectData)
102 {
103 UNIMPLEMENTED
104
105 return 0;
106 }
107
108
109 INT
110 EXPORT
111 WSARecvFrom(
112 IN SOCKET s,
113 IN OUT LPWSABUF lpBuffers,
114 IN DWORD dwBufferCount,
115 OUT LPDWORD lpNumberOfBytesRecvd,
116 IN OUT LPDWORD lpFlags,
117 OUT LPSOCKADDR lpFrom,
118 IN OUT LPINT lpFromlen,
119 IN LPWSAOVERLAPPED lpOverlapped,
120 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
121 {
122 UNIMPLEMENTED
123
124 return 0;
125 }
126
127
128 INT
129 EXPORT
130 WSASend(
131 IN SOCKET s,
132 IN LPWSABUF lpBuffers,
133 IN DWORD dwBufferCount,
134 OUT LPDWORD lpNumberOfBytesSent,
135 IN DWORD dwFlags,
136 IN LPWSAOVERLAPPED lpOverlapped,
137 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
138 {
139 UNIMPLEMENTED
140
141 return 0;
142 }
143
144
145 INT
146 EXPORT
147 WSASendDisconnect(
148 IN SOCKET s,
149 IN LPWSABUF lpOutboundDisconnectData)
150 {
151 UNIMPLEMENTED
152
153 return 0;
154 }
155
156
157 INT
158 EXPORT
159 WSASendTo(
160 IN SOCKET s,
161 IN LPWSABUF lpBuffers,
162 IN DWORD dwBufferCount,
163 OUT LPDWORD lpNumberOfBytesSent,
164 IN DWORD dwFlags,
165 IN CONST LPSOCKADDR lpTo,
166 IN INT iToLen,
167 IN LPWSAOVERLAPPED lpOverlapped,
168 IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
169 {
170 PCATALOG_ENTRY Provider;
171 INT Errno;
172 INT Code;
173
174 WS_DbgPrint(MAX_TRACE, ("Called.\n"));
175
176 if (!ReferenceProviderByHandle((HANDLE)s, &Provider)) {
177 WSASetLastError(WSAENOTSOCK);
178 return SOCKET_ERROR;
179 }
180
181 Code = Provider->ProcTable.lpWSPSendTo(s, lpBuffers, dwBufferCount,
182 lpNumberOfBytesSent, dwFlags, lpTo, iToLen, lpOverlapped,
183 lpCompletionRoutine, NULL /* lpThreadId */, &Errno);
184
185 DereferenceProviderByPointer(Provider);
186
187 if (Code == SOCKET_ERROR)
188 WSASetLastError(Errno);
189
190 return Code;
191 }
192
193 /* EOF */