ReactOS 0.4.16-dev-109-gf4cb10f
iso.c File Reference
#include "rdesktop.h"
Include dependency graph for iso.c:

Go to the source code of this file.

Functions

static BOOL iso_send_msg (RDPCLIENT *This, uint8 code)
 
static BOOL iso_send_connection_request (RDPCLIENT *This, char *cookie)
 
static STREAM iso_recv_msg (RDPCLIENT *This, uint8 *code, uint8 *rdpver)
 
STREAM iso_init (RDPCLIENT *This, int length)
 
BOOL iso_send (RDPCLIENT *This, STREAM s)
 
STREAM iso_recv (RDPCLIENT *This, uint8 *rdpver)
 
BOOL iso_connect (RDPCLIENT *This, char *server, char *cookie)
 
BOOL iso_reconnect (RDPCLIENT *This, char *server, char *cookie)
 
BOOL iso_disconnect (RDPCLIENT *This)
 
void iso_reset_state (RDPCLIENT *This)
 

Function Documentation

◆ iso_connect()

BOOL iso_connect ( RDPCLIENT This,
char server,
char cookie 
)

Definition at line 179 of file iso.c.

180{
181 uint8 code = 0;
182
183 if (!tcp_connect(This, server))
184 return False;
185
187 return False;
188
189 if (iso_recv_msg(This, &code, NULL) == NULL)
190 return False;
191
192 if (code != ISO_PDU_CC)
193 {
194 error("expected CC, got 0x%x\n", code);
196 return False;
197 }
198
199 return True;
200}
@ ISO_PDU_CC
Definition: constants.h:30
static STREAM iso_recv_msg(uint8 *code, uint8 *rdpver)
Definition: iso.c:101
static void iso_send_connection_request(char *username, uint32 neg_proto)
Definition: iso.c:60
void tcp_disconnect(void)
Definition: tcp.c:832
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
#define False
Definition: types.h:25
#define True
Definition: types.h:24
unsigned char uint8
Definition: types.h:28
#define NULL
Definition: types.h:112
#define error(str)
Definition: mkdosfs.c:1605
Definition: inflate.c:139
Definition: cookie.c:34
static rfbScreenInfoPtr server
Definition: vnc.c:74

◆ iso_disconnect()

BOOL iso_disconnect ( RDPCLIENT This)

Definition at line 229 of file iso.c.

230{
232 return tcp_disconnect(This);
233}
@ ISO_PDU_DR
Definition: constants.h:31
static void iso_send_msg(uint8 code)
Definition: iso.c:39

◆ iso_init()

STREAM iso_init ( RDPCLIENT This,
int  length 
)

Definition at line 122 of file iso.c.

123{
124 STREAM s;
125
126 s = tcp_init(This, length + 7);
127
128 if(s == NULL)
129 return NULL;
130
131 s_push_layer(s, iso_hdr, 7);
132
133 return s;
134}
#define s_push_layer(s, h, n)
Definition: parse.h:39
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82
GLdouble s
Definition: gl.h:2039
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
Definition: parse.h:23

◆ iso_reconnect()

BOOL iso_reconnect ( RDPCLIENT This,
char server,
char cookie 
)

Definition at line 204 of file iso.c.

205{
206 uint8 code = 0;
207
208 if (!tcp_connect(This, server))
209 return False;
210
211 if (!iso_send_connection_request(This, cookie)) // BUGBUG should we really pass the cookie here?
212 return False;
213
214 if (iso_recv_msg(This, &code, NULL) == NULL)
215 return False;
216
217 if (code != ISO_PDU_CC)
218 {
219 error("expected CC, got 0x%x\n", code);
221 return False;
222 }
223
224 return True;
225}

Referenced by mcs_reconnect().

◆ iso_recv()

STREAM iso_recv ( RDPCLIENT This,
uint8 rdpver 
)

Definition at line 158 of file iso.c.

159{
160 STREAM s;
161 uint8 code = 0;
162
163 s = iso_recv_msg(This, &code, rdpver);
164 if (s == NULL)
165 return NULL;
166 if (rdpver != NULL)
167 if (*rdpver != 3)
168 return s;
169 if (code != ISO_PDU_DT)
170 {
171 error("expected DT, got 0x%x\n", code);
172 return NULL;
173 }
174 return s;
175}
@ ISO_PDU_DT
Definition: constants.h:32

◆ iso_recv_msg()

static STREAM iso_recv_msg ( RDPCLIENT This,
uint8 code,
uint8 rdpver 
)
static

Definition at line 78 of file iso.c.

79{
80 STREAM s;
83
84 s = tcp_recv(This, NULL, 4);
85 if (s == NULL)
86 return NULL;
88 if (rdpver != NULL)
89 *rdpver = version;
90 if (version == 3)
91 {
92 in_uint8s(s, 1); /* pad */
94 }
95 else
96 {
98 if (length & 0x80)
99 {
100 length &= ~0x80;
101 next_be(s, length);
102 }
103 }
104 s = tcp_recv(This, s, length - 4);
105 if (s == NULL)
106 return NULL;
107 if (version != 3)
108 return s;
109 in_uint8s(s, 1); /* hdrlen */
110 in_uint8(s, *code);
111 if (*code == ISO_PDU_DT)
112 {
113 in_uint8s(s, 1); /* eot */
114 return s;
115 }
116 in_uint8s(s, 5); /* dst_ref, src_ref, class */
117 return s;
118}
#define in_uint8s(s, n)
Definition: parse.h:91
#define next_be(s, v)
Definition: parse.h:97
#define in_uint8(s, v)
Definition: parse.h:88
#define in_uint16_be(s, v)
Definition: parse.h:75
STREAM tcp_recv(STREAM s, uint32 length)
Definition: tcp.c:344
unsigned short uint16
Definition: types.h:30
static const WCHAR version[]
Definition: asmname.c:66

◆ iso_reset_state()

void iso_reset_state ( RDPCLIENT This)

Definition at line 237 of file iso.c.

238{
240}
void tcp_reset_state(void)
Definition: tcp.c:894

◆ iso_send()

BOOL iso_send ( RDPCLIENT This,
STREAM  s 
)

Definition at line 138 of file iso.c.

139{
141
142 s_pop_layer(s, iso_hdr);
143 length = (uint16)(s->end - s->p);
144
145 out_uint8(s, 3); /* version */
146 out_uint8(s, 0); /* reserved */
148
149 out_uint8(s, 2); /* hdrlen */
150 out_uint8(s, ISO_PDU_DT); /* code */
151 out_uint8(s, 0x80); /* eot */
152
153 return tcp_send(This, s);
154}
#define s_pop_layer(s, h)
Definition: parse.h:40
#define out_uint8(s, v)
Definition: parse.h:92
#define out_uint16_be(s, v)
Definition: parse.h:77
void tcp_send(STREAM s)
Definition: tcp.c:270

◆ iso_send_connection_request()

static BOOL iso_send_connection_request ( RDPCLIENT This,
char cookie 
)
static

Definition at line 49 of file iso.c.

50{
51 STREAM s;
52 int cookielen = (int)strlen(cookie);
53 int length = 11 + cookielen;
54
56
57 if(s == NULL)
58 return False;
59
60 out_uint8(s, 3); /* version */
61 out_uint8(s, 0); /* reserved */
62 out_uint16_be(s, length); /* length */
63
64 out_uint8(s, length - 5); /* hdrlen */
66 out_uint16(s, 0); /* dst_ref */
67 out_uint16(s, 0); /* src_ref */
68 out_uint8(s, 0); /* class */
69
70 out_uint8p(s, cookie, cookielen);
71
73 return tcp_send(This, s);
74}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
@ ISO_PDU_CR
Definition: constants.h:29
#define s_mark_end(s)
Definition: parse.h:41
#define out_uint8p(s, v, n)
Definition: parse.h:93
#define out_uint16(s, v)
Definition: parse.h:84
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

◆ iso_send_msg()

static BOOL iso_send_msg ( RDPCLIENT This,
uint8  code 
)
static

Definition at line 25 of file iso.c.

26{
27 STREAM s;
28
29 s = tcp_init(This, 11);
30
31 if(s == NULL)
32 return False;
33
34 out_uint8(s, 3); /* version */
35 out_uint8(s, 0); /* reserved */
36 out_uint16_be(s, 11); /* length */
37
38 out_uint8(s, 6); /* hdrlen */
40 out_uint16(s, 0); /* dst_ref */
41 out_uint16(s, 0); /* src_ref */
42 out_uint8(s, 0); /* class */
43
45 return tcp_send(This, s);
46}