/[rdesktop]/sourceforge.net/branches/seamlessrdp-branch/rdesktop/channels.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /sourceforge.net/branches/seamlessrdp-branch/rdesktop/channels.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 419 - (show annotations)
Wed Jun 11 07:12:18 2003 UTC (21 years ago) by forsberg
Original Path: sourceforge.net/trunk/rdesktop/channels.c
File MIME type: text/plain
File size: 2865 byte(s)
Added comment about TAG_SRV_SRV_3. And some debug output.

1 /* -*- c-basic-offset: 8 -*-
2 rdesktop: A Remote Desktop Protocol client.
3 Protocol services - Channel register
4 Copyright (C) Erik Forsberg <forsberg@cendio.se> 2003
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 #include "rdesktop.h"
22
23 static uint16 num_channels;
24 static rdp5_channel *channels[MAX_RDP5_CHANNELS];
25
26 uint16
27 get_num_channels(void)
28 {
29 return num_channels;
30 }
31
32 /* FIXME: We should use the information in TAG_SRV_SRV_3 to map RDP5
33 channels to MCS channels.
34
35 The format of TAG_SRV_SRV_3 seems to be
36
37 global_channel_no (uint16le)
38 number_of_other_channels (uint16le)
39 ..followed by uint16les for the other channels.
40 Might be a few (two) bytes of padding at the end.
41
42 */
43
44 void
45 register_channel(char *name, uint32 flags, void (*callback) (STREAM, uint16))
46 {
47 if (num_channels > MAX_RDP5_CHANNELS)
48 {
49 error("Maximum number of RDP5 channels reached. Redefine MAX_RDP5_CHANNELS in constants.h and recompile!\n!");
50 }
51 num_channels++;
52 channels[num_channels - 1] = xrealloc(channels[num_channels - 1],
53 sizeof(rdp5_channel) * num_channels);
54 channels[num_channels - 1]->channelno = MCS_GLOBAL_CHANNEL + num_channels;
55 strcpy(channels[num_channels - 1]->name, name);
56 channels[num_channels - 1]->channelflags = flags;
57 channels[num_channels - 1]->channelcallback = callback;
58 }
59
60 rdp5_channel *
61 find_channel_by_channelno(uint16 channelno)
62 {
63 if (channelno > MCS_GLOBAL_CHANNEL + num_channels)
64 {
65 warning("Channel %d not defined. Highest channel defined is %d\n",
66 channelno, MCS_GLOBAL_CHANNEL + num_channels);
67 return NULL;
68 }
69 else
70 {
71 return channels[channelno - MCS_GLOBAL_CHANNEL - 1];
72 }
73 }
74
75 rdp5_channel *
76 find_channel_by_num(uint16 num)
77 {
78 if (num > num_channels)
79 {
80 error("There are only %d channels defined, channel %d doesn't exist\n",
81 num_channels, num);
82 }
83 else
84 {
85 return channels[num];
86 }
87 return NULL; // Shut the compiler up
88 }
89
90
91
92 void
93 dummy_callback(STREAM s, uint16 channelno)
94 {
95 warning("Server is sending information on our dummy channel (%d). Why?\n", channelno);
96 }
97
98 void
99 channels_init(void)
100 {
101 DEBUG_RDP5(("channels_init\n"));
102 register_channel("dummych", 0xc0a0, dummy_callback);
103 register_channel("cliprdr", 0xc0a0, cliprdr_callback);
104 }

  ViewVC Help
Powered by ViewVC 1.1.26