ReactOS  0.4.14-dev-599-g2d4d3f5
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 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define error(str)
Definition: mkdosfs.c:1605
static BOOL iso_send_connection_request(RDPCLIENT *This, char *cookie)
Definition: iso.c:49
smooth NULL
Definition: ftsmooth.c:416
#define True
Definition: types.h:24
#define False
Definition: types.h:25
unsigned char uint8
Definition: types.h:28
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
void tcp_disconnect(void)
Definition: tcp.c:832
Definition: cookie.c:33
static STREAM iso_recv_msg(RDPCLIENT *This, uint8 *code, uint8 *rdpver)
Definition: iso.c:78

◆ iso_disconnect()

BOOL iso_disconnect ( RDPCLIENT This)

Definition at line 229 of file iso.c.

230 {
232  return tcp_disconnect(This);
233 }
static BOOL iso_send_msg(RDPCLIENT *This, uint8 code)
Definition: iso.c:25
void tcp_disconnect(void)
Definition: tcp.c:832

◆ 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 }
smooth NULL
Definition: ftsmooth.c:416
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
#define s_push_layer(s, h, n)
Definition: parse.h:39

◆ 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 }
static rfbScreenInfoPtr server
Definition: vnc.c:74
#define error(str)
Definition: mkdosfs.c:1605
static BOOL iso_send_connection_request(RDPCLIENT *This, char *cookie)
Definition: iso.c:49
smooth NULL
Definition: ftsmooth.c:416
#define True
Definition: types.h:24
#define False
Definition: types.h:25
unsigned char uint8
Definition: types.h:28
RD_BOOL tcp_connect(char *server)
Definition: tcp.c:717
void tcp_disconnect(void)
Definition: tcp.c:832
Definition: cookie.c:33
static STREAM iso_recv_msg(RDPCLIENT *This, uint8 *code, uint8 *rdpver)
Definition: iso.c:78

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 }
#define error(str)
Definition: mkdosfs.c:1605
smooth NULL
Definition: ftsmooth.c:416
unsigned char uint8
Definition: types.h:28
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
static STREAM iso_recv_msg(RDPCLIENT *This, uint8 *code, uint8 *rdpver)
Definition: iso.c:78

◆ 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;
81  uint16 length;
82  uint8 version;
83 
84  s = tcp_recv(This, NULL, 4);
85  if (s == NULL)
86  return NULL;
87  in_uint8(s, version);
88  if (rdpver != NULL)
89  *rdpver = version;
90  if (version == 3)
91  {
92  in_uint8s(s, 1); /* pad */
94  }
95  else
96  {
97  in_uint8(s, length);
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 }
STREAM tcp_recv(STREAM s, uint32 length)
Definition: tcp.c:344
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR version[]
Definition: asmname.c:66
#define in_uint8s(s, n)
Definition: parse.h:91
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
unsigned char uint8
Definition: types.h:28
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
unsigned short uint16
Definition: types.h:30
#define in_uint8(s, v)
Definition: parse.h:88
#define next_be(s, v)
Definition: parse.h:97
#define in_uint16_be(s, v)
Definition: parse.h:75

Referenced by iso_connect(), iso_reconnect(), and iso_recv().

◆ 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 {
140  uint16 length;
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 }
void tcp_send(STREAM s)
Definition: tcp.c:270
#define out_uint8(s, v)
Definition: parse.h:92
#define s_pop_layer(s, h)
Definition: parse.h:40
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
GLdouble s
Definition: gl.h:2039
unsigned short uint16
Definition: types.h:30
#define out_uint16_be(s, v)
Definition: parse.h:77

◆ 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 
55  s = tcp_init(This, length);
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 
72  s_mark_end(s);
73  return tcp_send(This, s);
74 }
#define out_uint8p(s, v, n)
Definition: parse.h:93
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define out_uint16(s, v)
Definition: parse.h:84
void tcp_send(STREAM s)
Definition: tcp.c:270
#define out_uint8(s, v)
Definition: parse.h:92
smooth NULL
Definition: ftsmooth.c:416
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82
#define False
Definition: types.h:25
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
Definition: cookie.c:33
#define out_uint16_be(s, v)
Definition: parse.h:77
#define s_mark_end(s)
Definition: parse.h:41
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by iso_connect(), and iso_reconnect().

◆ 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 */
39  out_uint8(s, code);
40  out_uint16(s, 0); /* dst_ref */
41  out_uint16(s, 0); /* src_ref */
42  out_uint8(s, 0); /* class */
43 
44  s_mark_end(s);
45  return tcp_send(This, s);
46 }
#define out_uint16(s, v)
Definition: parse.h:84
void tcp_send(STREAM s)
Definition: tcp.c:270
#define out_uint8(s, v)
Definition: parse.h:92
smooth NULL
Definition: ftsmooth.c:416
STREAM tcp_init(uint32 maxlen)
Definition: tcp.c:82
#define False
Definition: types.h:25
Definition: parse.h:22
GLdouble s
Definition: gl.h:2039
#define out_uint16_be(s, v)
Definition: parse.h:77
#define s_mark_end(s)
Definition: parse.h:41

Referenced by iso_disconnect().