1 |
/* -*- c-basic-offset: 8 -*- |
/* -*- c-basic-offset: 8 -*- |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
Protocol services - ISO layer |
Protocol services - ISO layer |
4 |
Copyright (C) Matthew Chapman 1999-2002 |
Copyright (C) Matthew Chapman 1999-2008 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
it under the terms of the GNU General Public License as published by |
it under the terms of the GNU General Public License as published by |
8 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
(at your option) any later version. |
10 |
|
|
11 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
GNU General Public License for more details. |
GNU General Public License for more details. |
15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
17 |
along with this program; if not, write to the Free Software |
along with this program; if not, write to the Free Software |
18 |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
98 |
next_be(s, length); |
next_be(s, length); |
99 |
} |
} |
100 |
} |
} |
101 |
|
if (length < 4) |
102 |
|
{ |
103 |
|
error("Bad packet header\n"); |
104 |
|
return NULL; |
105 |
|
} |
106 |
s = tcp_recv(s, length - 4); |
s = tcp_recv(s, length - 4); |
107 |
if (s == NULL) |
if (s == NULL) |
108 |
return NULL; |
return NULL; |
173 |
} |
} |
174 |
|
|
175 |
/* Establish a connection up to the ISO layer */ |
/* Establish a connection up to the ISO layer */ |
176 |
BOOL |
RD_BOOL |
177 |
iso_connect(char *server, char *username) |
iso_connect(char *server, char *username) |
178 |
{ |
{ |
179 |
uint8 code = 0; |
uint8 code = 0; |
196 |
return True; |
return True; |
197 |
} |
} |
198 |
|
|
199 |
|
/* Establish a reconnection up to the ISO layer */ |
200 |
|
RD_BOOL |
201 |
|
iso_reconnect(char *server) |
202 |
|
{ |
203 |
|
uint8 code = 0; |
204 |
|
|
205 |
|
if (!tcp_connect(server)) |
206 |
|
return False; |
207 |
|
|
208 |
|
iso_send_msg(ISO_PDU_CR); |
209 |
|
|
210 |
|
if (iso_recv_msg(&code, NULL) == NULL) |
211 |
|
return False; |
212 |
|
|
213 |
|
if (code != ISO_PDU_CC) |
214 |
|
{ |
215 |
|
error("expected CC, got 0x%x\n", code); |
216 |
|
tcp_disconnect(); |
217 |
|
return False; |
218 |
|
} |
219 |
|
|
220 |
|
return True; |
221 |
|
} |
222 |
|
|
223 |
/* Disconnect from the ISO layer */ |
/* Disconnect from the ISO layer */ |
224 |
void |
void |
225 |
iso_disconnect(void) |
iso_disconnect(void) |
227 |
iso_send_msg(ISO_PDU_DR); |
iso_send_msg(ISO_PDU_DR); |
228 |
tcp_disconnect(); |
tcp_disconnect(); |
229 |
} |
} |
230 |
|
|
231 |
|
/* reset the state to support reconnecting */ |
232 |
|
void |
233 |
|
iso_reset_state(void) |
234 |
|
{ |
235 |
|
tcp_reset_state(); |
236 |
|
} |