1 |
matty |
3 |
/* |
2 |
|
|
rdesktop: A Remote Desktop Protocol client. |
3 |
|
|
Function prototypes |
4 |
|
|
Copyright (C) Matthew Chapman 1999-2000 |
5 |
|
|
|
6 |
|
|
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 |
8 |
|
|
the Free Software Foundation; either version 2 of the License, or |
9 |
|
|
(at your option) any later version. |
10 |
|
|
|
11 |
|
|
This program is distributed in the hope that it will be useful, |
12 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 |
|
|
GNU General Public License for more details. |
15 |
|
|
|
16 |
|
|
You should have received a copy of the GNU General Public License |
17 |
|
|
along with this program; if not, write to the Free Software |
18 |
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
/* Parsing layer */ |
22 |
|
|
BOOL prs_io_uint8(STREAM s, uint8 *i); |
23 |
|
|
BOOL prs_io_uint8s(STREAM s, uint8 *p, unsigned int length); |
24 |
|
|
BOOL msb_io_uint16(STREAM s, uint16 *i); |
25 |
|
|
BOOL lsb_io_uint16(STREAM s, uint16 *i); |
26 |
|
|
BOOL lsb_io_uint32(STREAM s, uint32 *i); |
27 |
|
|
|
28 |
|
|
/* TCP layer */ |
29 |
|
|
HCONN tcp_connect(char *server); |
30 |
|
|
void tcp_disconnect(HCONN conn); |
31 |
|
|
BOOL tcp_send(HCONN conn); |
32 |
|
|
BOOL tcp_recv(HCONN conn, int length); |
33 |
|
|
|
34 |
|
|
/* ISO layer */ |
35 |
|
|
HCONN iso_connect(char *server); |
36 |
|
|
void iso_disconnect(HCONN conn); |
37 |
|
|
BOOL iso_send_msg(HCONN conn, uint8 code); |
38 |
|
|
BOOL iso_recv_msg(HCONN conn, uint8 *code); |
39 |
|
|
void iso_init(struct connection *conn); |
40 |
|
|
BOOL iso_send(HCONN conn); |
41 |
|
|
BOOL iso_recv(HCONN conn); |
42 |
|
|
void iso_make_tpkt(TPKT *tpkt, int length); |
43 |
|
|
BOOL iso_io_tpkt(STREAM s, TPKT *tpkt); |
44 |
|
|
void iso_make_tpdu(TPDU *tpdu, uint8 code); |
45 |
|
|
BOOL iso_io_tpdu(STREAM s, TPDU *tpdu); |
46 |
|
|
|
47 |
|
|
/* MCS layer */ |
48 |
|
|
HCONN mcs_connect(char *server); |
49 |
|
|
BOOL mcs_join_channel(HCONN conn, uint16 chanid); |
50 |
|
|
void mcs_disconnect(HCONN conn); |
51 |
|
|
void mcs_send_connect_initial(HCONN conn); |
52 |
|
|
void mcs_send_edrq(HCONN conn); |
53 |
|
|
void mcs_send_aurq(HCONN conn); |
54 |
|
|
void mcs_send_cjrq(HCONN conn, uint16 chanid); |
55 |
|
|
void mcs_init_data(HCONN conn); |
56 |
|
|
void mcs_send_data(HCONN conn, uint16 chanid, BOOL request); |
57 |
|
|
int mcs_recv(HCONN conn, BOOL request); |
58 |
|
|
void mcs_make_domain_params(DOMAIN_PARAMS *dp, uint16 max_channels, |
59 |
|
|
uint16 max_users, uint16 max_tokens, uint16 max_pdusize); |
60 |
|
|
void mcs_make_connect_initial(MCS_CONNECT_INITIAL *mci); |
61 |
|
|
BOOL ber_io_header(STREAM s, BOOL islong, int tagval, int *length); |
62 |
|
|
BOOL ber_io_octet_string(STREAM s, OCTET_STRING *os); |
63 |
|
|
BOOL ber_io_integer(STREAM s, uint16 *i); |
64 |
|
|
BOOL ber_io_uint8(STREAM s, uint8 *i, int tagval); |
65 |
|
|
BOOL mcs_io_domain_params(STREAM s, DOMAIN_PARAMS *dp); |
66 |
|
|
BOOL mcs_io_connect_initial(STREAM s, MCS_CONNECT_INITIAL *mci); |
67 |
|
|
BOOL mcs_io_connect_response(STREAM s, MCS_CONNECT_RESPONSE *mcr); |
68 |
|
|
BOOL mcs_io_edrq(STREAM s, MCS_EDRQ *edrq); |
69 |
|
|
BOOL mcs_io_aurq(STREAM s, MCS_AURQ *aurq); |
70 |
|
|
BOOL mcs_io_aucf(STREAM s, MCS_AUCF *aucf); |
71 |
|
|
BOOL mcs_io_cjrq(STREAM s, MCS_CJRQ *cjrq); |
72 |
|
|
BOOL mcs_io_cjcf(STREAM s, MCS_CJCF *cjcf); |
73 |
|
|
BOOL mcs_io_data(STREAM s, MCS_DATA *dt, BOOL request); |
74 |
|
|
|
75 |
|
|
/* RDP layer */ |
76 |
|
|
HCONN rdp_connect(char *server); |
77 |
matty |
6 |
void rdp_main_loop(HCONN conn); |
78 |
matty |
3 |
void process_orders(HCONN conn, RDP_ORDER_STATE *os); |
79 |
|
|
void rdp_establish_key(HCONN conn); |
80 |
|
|
void rdp_send_cert(HCONN conn); |
81 |
|
|
void rdp_send_confirm_active(HCONN conn); |
82 |
|
|
void rdp_send_control(HCONN conn, uint16 action); |
83 |
|
|
void rdp_send_synchronize(HCONN conn); |
84 |
|
|
void rdp_send_fonts(HCONN conn, uint16 seqno); |
85 |
|
|
void rdp_send_input(HCONN conn); |
86 |
|
|
BOOL rdp_recv_pdu(HCONN conn, uint8 *type); |
87 |
|
|
void rdp_disconnect(HCONN conn); |
88 |
|
|
void rdp_make_header(RDP_HEADER *hdr, uint16 length, uint16 pdu_type, |
89 |
|
|
uint16 userid); |
90 |
|
|
void rdp_make_data_header(RDP_DATA_HEADER *hdr, uint32 shareid, |
91 |
|
|
uint16 length, uint16 data_pdu_type); |
92 |
|
|
void rdp_make_general_caps(RDP_GENERAL_CAPS *caps); |
93 |
|
|
void rdp_make_bitmap_caps(RDP_BITMAP_CAPS *caps); |
94 |
|
|
void rdp_make_order_caps(RDP_ORDER_CAPS *caps); |
95 |
|
|
void rdp_make_bmpcache_caps(RDP_BMPCACHE_CAPS *caps); |
96 |
|
|
void rdp_make_control_caps(RDP_CONTROL_CAPS *caps); |
97 |
|
|
void rdp_make_activate_caps(RDP_ACTIVATE_CAPS *caps); |
98 |
|
|
void rdp_make_pointer_caps(RDP_POINTER_CAPS *caps); |
99 |
|
|
void rdp_make_share_caps(RDP_SHARE_CAPS *caps, uint16 userid); |
100 |
|
|
void rdp_make_colcache_caps(RDP_COLCACHE_CAPS *caps); |
101 |
|
|
void rdp_make_active_pdu(RDP_ACTIVE_PDU *pdu, uint32 shareid, uint16 userid); |
102 |
|
|
void rdp_make_control_pdu(RDP_CONTROL_PDU *pdu, uint16 action); |
103 |
|
|
void rdp_make_synchronize_pdu(RDP_SYNCHRONIZE_PDU *pdu, uint16 userid); |
104 |
|
|
void rdp_make_font_pdu(RDP_FONT_PDU *pdu, uint16 seqno); |
105 |
|
|
void rdp_make_input_pdu(RDP_INPUT_PDU *pdu); |
106 |
|
|
BOOL rdp_io_header(STREAM s, RDP_HEADER *hdr); |
107 |
|
|
BOOL rdp_io_data_header(STREAM s, RDP_DATA_HEADER *hdr); |
108 |
|
|
BOOL rdp_io_general_caps(STREAM s, RDP_GENERAL_CAPS *caps); |
109 |
|
|
BOOL rdp_io_bitmap_caps(STREAM s, RDP_BITMAP_CAPS *caps); |
110 |
|
|
BOOL rdp_io_order_caps(STREAM s, RDP_ORDER_CAPS *caps); |
111 |
|
|
BOOL rdp_io_bmpcache_info(STREAM s, RDP_BMPCACHE_INFO *info); |
112 |
|
|
BOOL rdp_io_bmpcache_caps(STREAM s, RDP_BMPCACHE_CAPS *caps); |
113 |
|
|
BOOL rdp_io_control_caps(STREAM s, RDP_CONTROL_CAPS *caps); |
114 |
|
|
BOOL rdp_io_activate_caps(STREAM s, RDP_ACTIVATE_CAPS *caps); |
115 |
|
|
BOOL rdp_io_pointer_caps(STREAM s, RDP_POINTER_CAPS *caps); |
116 |
|
|
BOOL rdp_io_share_caps(STREAM s, RDP_SHARE_CAPS *caps); |
117 |
|
|
BOOL rdp_io_colcache_caps(STREAM s, RDP_COLCACHE_CAPS *caps); |
118 |
|
|
BOOL rdp_io_active_pdu(STREAM s, RDP_ACTIVE_PDU *pdu, int pdutype); |
119 |
|
|
BOOL rdp_io_control_pdu(STREAM s, RDP_CONTROL_PDU *pdu); |
120 |
|
|
BOOL rdp_io_synchronize_pdu(STREAM s, RDP_SYNCHRONIZE_PDU *pdu); |
121 |
|
|
BOOL rdp_io_input_event(STREAM s, RDP_INPUT_EVENT *evt); |
122 |
|
|
BOOL rdp_io_input_pdu(STREAM s, RDP_INPUT_PDU *pdu); |
123 |
|
|
BOOL rdp_io_font_info(STREAM s, RDP_FONT_INFO *font); |
124 |
|
|
BOOL rdp_io_font_pdu(STREAM s, RDP_FONT_PDU *pdu); |
125 |
|
|
BOOL rdp_io_update_pdu(STREAM s, RDP_UPDATE_PDU *pdu); |
126 |
|
|
BOOL rdp_io_secondary_order(STREAM s, RDP_SECONDARY_ORDER *rso); |
127 |
|
|
BOOL rdp_io_bitmap_header(STREAM s, RDP_BITMAP_HEADER *rdh); |
128 |
|
|
|
129 |
|
|
/* Utility routines */ |
130 |
|
|
void *xmalloc(int size); |
131 |
|
|
void *xrealloc(void *oldmem, int size); |
132 |
|
|
BOOL bitmap_decompress(unsigned char *input, int size, |
133 |
|
|
unsigned char *output, int width); |
134 |
|
|
|
135 |
matty |
6 |
/* User interface routines */ |
136 |
|
|
HWINDOW ui_create_window(int width, int height); |
137 |
|
|
void ui_destroy_window(HWINDOW wnd); |
138 |
|
|
HBITMAP ui_create_bitmap(HWINDOW wnd, int width, int height, uint8 *data); |
139 |
|
|
void ui_destroy_bitmap(HBITMAP bmp); |
140 |
|
|
void ui_paint_bitmap(HWINDOW wnd, HBITMAP bmp, int x, int y); |
141 |
|
|
|