#include "rdesktop.h"
#include <winsock2.h>
Go to the source code of this file.
◆ INADDR_NONE
Definition at line 38 of file tcp.c.
◆ socklen_t
Definition at line 35 of file tcp.c.
◆ tcp_connect()
Definition at line 205 of file tcp.c.
206{
207 int true_value = 1;
208
209#ifdef IPv6
210
213 char tcp_port_rdp_s[10];
214
216
220
222 {
223 error(
"getaddrinfo: %s\n", gai_strerror(
n));
225 }
226
230 {
232 if (!(
This->tcp.sock < 0))
233 {
235 break;
238 }
240 }
242
243 if (
This->tcp.sock == -1)
244 {
247 }
248
249#else
250
253
255 {
256 memcpy(&servaddr.sin_addr, nslookup->h_addr,
sizeof(servaddr.sin_addr));
257 }
259 {
261 This->disconnect_reason = 260;
263 }
264
266 {
267
269 }
270
272 servaddr.sin_port =
htons(
This->tcp_port_rdp);
273
274
275
277 {
278
279 This->disconnect_reason = 516;
282 }
283
284#endif
285
287
288 This->tcp.in.size = 4096;
290
292 {
293 This->disconnect_reason = 262;
295 }
296
297 This->tcp.out.size = 4096;
299
301 {
302 This->disconnect_reason = 262;
304 }
305
307}
ULONG WSAAPI inet_addr(IN CONST CHAR FAR *cp)
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
#define memcpy(s1, s2, n)
namespace GUID const ADDRINFOEXW * hints
INT WSAAPI setsockopt(IN SOCKET s, IN INT level, IN INT optname, IN CONST CHAR FAR *optval, IN INT optlen)
SOCKET WSAAPI socket(IN INT af, IN INT type, IN INT protocol)
static rfbScreenInfoPtr server
◆ tcp_disconnect()
◆ tcp_get_address()
Definition at line 318 of file tcp.c.
319{
320#if 0
321 static char ipaddr[32];
325 {
326 unsigned char *
ip = (
unsigned char *) &
sockaddr.sin_addr;
328 }
329 else
330 strcpy(ipaddr,
"127.0.0.1");
331 return ipaddr;
332#endif
334}
#define sprintf(buf, format,...)
INT WSAAPI getsockname(IN SOCKET s, OUT LPSOCKADDR name, IN OUT INT FAR *namelen)
◆ tcp_init()
Definition at line 43 of file tcp.c.
44{
45 if (maxlen >
This->tcp.out.size)
46 {
48
50
52 {
53 This->disconnect_reason = 262;
55 }
56
58 This->tcp.out.size = maxlen;
59 }
60
61 This->tcp.out.p =
This->tcp.out.data;
62 This->tcp.out.end =
This->tcp.out.data +
This->tcp.out.size;
63 return &
This->tcp.out;
64}
◆ tcp_recv()
Definition at line 110 of file tcp.c.
111{
112 unsigned int new_length, end_offset, p_offset;
114
116 {
117
119 {
121
123 {
124 This->disconnect_reason = 262;
126 }
127
130 }
133 }
134 else
135 {
136
137 new_length = (
unsigned int)(
s->end -
s->data) +
length;
138 if (new_length >
s->size)
139 {
141
143 {
144 This->disconnect_reason = 262;
146 }
147
148 p_offset = (
unsigned int)(
s->p -
s->data);
149 end_offset = (
unsigned int)(
s->end -
s->data);
151 s->size = new_length;
152 s->p =
s->data + p_offset;
153 s->end =
s->data + end_offset;
154 }
155 }
156
158 {
161
163
165
167
169 {
170
172 break;
173
174
176 default:
177 This->disconnect_reason = 1028;
178
179
182 break;
183 }
184
185
188
189 if (rcvd == 0)
190 {
191 error(
"Connection closed\n");
192 This->disconnect_reason = 2308;
194 }
195
198 }
199
201}
int ui_select(int rdp_socket)
BOOL WINAPI CancelIo(IN HANDLE hFile)
#define ReadFile(a, b, c, d, e)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
GLuint GLsizei GLsizei * length
BOOL WINAPI GetOverlappedResult(IN HANDLE hFile, IN LPOVERLAPPED lpOverlapped, OUT LPDWORD lpNumberOfBytesTransferred, IN BOOL bWait)
namespace GUID const ADDRINFOEXW ADDRINFOEXW struct timeval OVERLAPPED * overlapped
DWORD WINAPI WaitForSingleObjectEx(IN HANDLE hHandle, IN DWORD dwMilliseconds, IN BOOL bAlertable)
#define WAIT_IO_COMPLETION
◆ tcp_reset_state()
Definition at line 339 of file tcp.c.
340{
342
343
349 This->tcp.in.size = 0;
355
356
362 This->tcp.out.size = 0;
368}
◆ tcp_send()
Definition at line 68 of file tcp.c.
69{
73
76
78 {
80
82 {
83
85 break;
86
87
89 default:
90 This->disconnect_reason = 772;
91
92
95 break;
96 }
97
98
101
103 }
104
106}
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)