ReactOS 0.4.15-dev-8393-g61b7fb9
send.c File Reference
#include <ws2_32.h>
#include <debug.h>
Include dependency graph for send.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INT WSAAPI send (IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
 
INT WSAAPI sendto (IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags, IN CONST struct sockaddr *to, IN INT tolen)
 
INT WSAAPI WSASend (IN SOCKET s, IN LPWSABUF lpBuffers, IN DWORD dwBufferCount, OUT LPDWORD lpNumberOfBytesSent, IN DWORD dwFlags, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 
INT WSAAPI WSASendDisconnect (IN SOCKET s, IN LPWSABUF lpOutboundDisconnectData)
 
INT WSAAPI WSASendTo (IN SOCKET s, IN LPWSABUF lpBuffers, IN DWORD dwBufferCount, OUT LPDWORD lpNumberOfBytesSent, IN DWORD dwFlags, IN CONST struct sockaddr *lpTo, IN INT iToLen, IN LPWSAOVERLAPPED lpOverlapped, IN LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file send.c.

Function Documentation

◆ send()

INT WSAAPI send ( IN SOCKET  s,
IN CONST CHAR FAR buf,
IN INT  len,
IN INT  flags 
)

Definition at line 23 of file send.c.

27{
28 PWSSOCKET Socket;
29 INT Status;
31 LPWSATHREADID ThreadId;
33 DWORD BytesSent;
34 DPRINT("send: %lx, %lx, %lx, %p\n", s, flags, len, buf);
35
36 /* Check for WSAStartup */
37 if ((ErrorCode = WsQuickPrologTid(&ThreadId)) == ERROR_SUCCESS)
38 {
39 /* Get the Socket Context */
40 if ((Socket = WsSockGetSocket(s)))
41 {
42 /* Setup the buffers */
43 Buffers.buf = (PCHAR)buf;
44 Buffers.len = len;
45
46 /* Make the call */
48 &Buffers,
49 1,
50 &BytesSent,
51 (DWORD)flags,
52 NULL,
53 NULL,
54 ThreadId,
55 &ErrorCode);
56 /* Deference the Socket Context */
57 WsSockDereference(Socket);
58
59 /* Return Provider Value */
60 if (Status == ERROR_SUCCESS) return BytesSent;
61
62 /* If everything seemed fine, then the WSP call failed itself */
64 }
65 else
66 {
67 /* No Socket Context Found */
69 }
70 }
71
72 /* Return with an Error */
74 return SOCKET_ERROR;
75}
PVOID Buffers[0x100]
#define NO_ERROR
Definition: dderror.h:5
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define SetLastError(x)
Definition: compat.h:752
unsigned long DWORD
Definition: ntddk_ex.h:95
Status
Definition: gdiplustypes.h:25
GLdouble s
Definition: gl.h:2039
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLbitfield flags
Definition: glext.h:7161
GLenum GLsizei len
Definition: glext.h:6722
#define PCHAR
Definition: match.c:90
_In_ NDIS_ERROR_CODE ErrorCode
Definition: ndis.h:4436
#define DPRINT
Definition: sndvol32.h:73
WSPPROC_TABLE Service
Definition: ws2_32p.h:80
LPWSPSEND lpWSPSend
Definition: ws2spi.h:484
PTPROVIDER Provider
Definition: ws2_32p.h:199
int32_t INT
Definition: typedefs.h:58
#define WSASYSCALLFAILURE
Definition: winerror.h:1994
#define WSAENOTSOCK
Definition: winerror.h:1951
#define SOCKET_ERROR
Definition: winsock.h:333
VOID WSAAPI WsSockDereference(IN PWSSOCKET Socket)
Definition: dsocket.c:205
FORCEINLINE DWORD WsQuickPrologTid(LPWSATHREADID *Tid)
Definition: ws2_32p.h:900
PWSSOCKET WSAAPI WsSockGetSocket(IN SOCKET Handle)
Definition: dsocket.c:140

Referenced by adns_writev(), do_synchronous_send(), DoTelnetHandshake(), EchoIncomingPackets(), event_client(), fprintfSocket(), fputcSocket(), fputSocket(), fputsSocket(), GetRequestAndWait(), InternetTransport_Write(), main(), NETCON_set_timeout(), netconn_set_timeout(), netfinger(), RequestHandler::OkToSend(), processRequest(), proxtrans(), push_dochost_task(), read_data(), read_pipe(), ReadFromPipeThread(), ReceiveLine(), recvrequest(), rpcrt4_conn_tcp_write(), SConnect(), select_server(), send_buf(), send_subvol(), SendLine(), SendQuote(), sendrequest(), SendTelnetInterrupt(), SendTime(), server_send_reply(), server_send_string(), server_thread(), sock_send(), SSend(), START_TEST(), Mapdesc::subdivide(), SWrite(), tcp_send(), test_communication(), test_events(), Test_Overread(), test_select(), test_send(), test_WithWSAStartup(), CServerClientSocket::Transmit(), uninit(), UserLoginThread(), WinHttpSetTimeouts(), write_vc(), TNetwork::WriteString(), WriteToPipeThread(), ZSTD_compressSubBlock_multi(), and ZSTD_seqDecompressedSize().

◆ sendto()

INT WSAAPI sendto ( IN SOCKET  s,
IN CONST CHAR FAR buf,
IN INT  len,
IN INT  flags,
IN CONST struct sockaddr to,
IN INT  tolen 
)

Definition at line 82 of file send.c.

88{
89 PWSSOCKET Socket;
90 INT Status;
92 LPWSATHREADID ThreadId;
94 DWORD BytesSent;
95 DPRINT("sendto: %lx, %lx, %lx, %p\n", s, flags, len, buf);
96
97 /* Check for WSAStartup */
98 if ((ErrorCode = WsQuickPrologTid(&ThreadId)) == ERROR_SUCCESS)
99 {
100 /* Get the Socket Context */
101 if ((Socket = WsSockGetSocket(s)))
102 {
103 /* Setup the buffers */
104 Buffers.buf = (PCHAR)buf;
105 Buffers.len = len;
106
107 /* Make the call */
109 &Buffers,
110 1,
111 &BytesSent,
112 (DWORD)flags,
113 to,
114 tolen,
115 NULL,
116 NULL,
117 ThreadId,
118 &ErrorCode);
119 /* Deference the Socket Context */
120 WsSockDereference(Socket);
121
122 /* Return Provider Value */
123 if (Status == ERROR_SUCCESS) return BytesSent;
124
125 /* If everything seemed fine, then the WSP call failed itself */
127 }
128 else
129 {
130 /* No Socket Context Found */
132 }
133 }
134
135 /* Return with an Error */
137 return SOCKET_ERROR;
138}
LPWSPSENDTO lpWSPSendTo
Definition: ws2spi.h:486

Referenced by __rpc_get_time_offset(), adns__query_send(), main(), processRequest(), rpc_broadcast_exp(), rtime(), send_packet(), SendData(), SendRequest(), Sendto(), SendtoByName(), SSendto(), SSendtoByName(), svc_dg_recv(), svc_dg_reply(), Test_CloseDuplicatedSocket(), test_ip_pktinfo(), test_sendto(), vsyslog(), and write_packet().

◆ WSASend()

INT WSAAPI WSASend ( IN SOCKET  s,
IN LPWSABUF  lpBuffers,
IN DWORD  dwBufferCount,
OUT LPDWORD  lpNumberOfBytesSent,
IN DWORD  dwFlags,
IN LPWSAOVERLAPPED  lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
)

Definition at line 145 of file send.c.

152{
153 PWSSOCKET Socket;
154 INT Status;
156 LPWSATHREADID ThreadId;
157 DPRINT("WSASend: %lx, %lx, %lx, %p\n", s, dwFlags, dwBufferCount, lpBuffers);
158
159 /* Check for WSAStartup */
160 if ((ErrorCode = WsQuickPrologTid(&ThreadId)) == ERROR_SUCCESS)
161 {
162 /* Get the Socket Context */
163 if ((Socket = WsSockGetSocket(s)))
164 {
165 /* Make the call */
166 Status = Socket->Provider->Service.lpWSPSend(s,
167 lpBuffers,
168 dwBufferCount,
169 lpNumberOfBytesSent,
170 dwFlags,
172 lpCompletionRoutine,
173 ThreadId,
174 &ErrorCode);
175 /* Deference the Socket Context */
176 WsSockDereference(Socket);
177
178 /* Return Provider Value */
179 if (Status == ERROR_SUCCESS) return Status;
180
181 /* If everything seemed fine, then the WSP call failed itself */
183 }
184 else
185 {
186 /* No Socket Context Found */
188 }
189 }
190
191 /* Return with an Error */
193 return SOCKET_ERROR;
194}
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED lpOverlapped
Definition: mswsock.h:93
_In_ PCCERT_CONTEXT _In_ DWORD dwFlags
Definition: wincrypt.h:1176

Referenced by NetBTSend(), NetBTSessionReq(), and Test_WSARecv().

◆ WSASendDisconnect()

INT WSAAPI WSASendDisconnect ( IN SOCKET  s,
IN LPWSABUF  lpOutboundDisconnectData 
)

Definition at line 201 of file send.c.

203{
206 PWSSOCKET Socket;
208 INT Status;
209 DPRINT("WSASendDisconnect: %lx %p\n", s, lpOutboundDisconnectData);
210
211 /* Enter prolog */
213 {
214 /* Get the Socket Context */
215 if ((Socket = WsSockGetSocket(s)))
216 {
217 /* Make the call */
219 lpOutboundDisconnectData,
220 &ErrorCode);
221 /* Deference the Socket Context */
222 WsSockDereference(Socket);
223
224 /* Return Provider Value */
225 if (Status == ERROR_SUCCESS) return ERROR_SUCCESS;
226
227 /* If everything seemed fine, then the WSP call failed itself */
229 }
230 else
231 {
232 /* No Socket Context Found */
234 }
235 }
236
237 /* Return with an Error */
239 return SOCKET_ERROR;
240}
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
LPWSPSENDDISCONNECT lpWSPSendDisconnect
Definition: ws2spi.h:485
INT WSAAPI WsApiProlog(OUT PWSPROCESS *Process, OUT PWSTHREAD *Thread)
Definition: wsautil.c:91

◆ WSASendTo()

INT WSAAPI WSASendTo ( IN SOCKET  s,
IN LPWSABUF  lpBuffers,
IN DWORD  dwBufferCount,
OUT LPDWORD  lpNumberOfBytesSent,
IN DWORD  dwFlags,
IN CONST struct sockaddr lpTo,
IN INT  iToLen,
IN LPWSAOVERLAPPED  lpOverlapped,
IN LPWSAOVERLAPPED_COMPLETION_ROUTINE  lpCompletionRoutine 
)

Definition at line 247 of file send.c.

256{
257 PWSSOCKET Socket;
258 INT Status;
260 LPWSATHREADID ThreadId;
261 DPRINT("WSASendTo: %lx, %lx, %lx, %p\n", s, dwFlags, dwBufferCount, lpBuffers);
262
263 /* Check for WSAStartup */
264 if ((ErrorCode = WsQuickPrologTid(&ThreadId)) == ERROR_SUCCESS)
265 {
266 /* Get the Socket Context */
267 if ((Socket = WsSockGetSocket(s)))
268 {
269 /* Make the call */
271 lpBuffers,
272 dwBufferCount,
273 lpNumberOfBytesSent,
274 dwFlags,
275 lpTo,
276 iToLen,
278 lpCompletionRoutine,
279 ThreadId,
280 &ErrorCode);
281 /* Deference the Socket Context */
282 WsSockDereference(Socket);
283
284 /* Return Provider Value */
285 if (Status == ERROR_SUCCESS) return Status;
286
287 /* If everything seemed fine, then the WSP call failed itself */
289 }
290 else
291 {
292 /* No Socket Context Found */
294 }
295 }
296
297 /* Return with an Error */
299 return SOCKET_ERROR;
300}

Referenced by NetBTSendNameQuery().