-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_VNC_v33.c
140 lines (107 loc) · 2.33 KB
/
_VNC_v33.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*
* Copyright (c) 2023-2024 Rene W. Olsen < renewolsen @ gmail . com >
*
* This software is released under the GNU General Public License, version 3.
* For the full text of the license, please visit:
* https://www.gnu.org/licenses/gpl-3.0.html
*
* You can also find a copy of the license in the LICENSE file included with this software.
*/
// --
#include "RVNCd.h"
// --
static int myRead_Unknown( struct Config *cfg )
{
int error;
int rc;
error = TRUE;
rc = myNetRead( cfg, cfg->NetRead_ReadBuffer, cfg->NetRead_ReadBufferSize, 0 );
if ( rc <= 0 )
{
goto bailout;
}
Log_PrintF( cfg, LOGTYPE_Info, "Skipping packet data (%ld)", rc );
error = FALSE;
bailout:
return( error );
}
// --
int VNC_HandleCmds_33( struct Config *cfg )
{
char type;
int error;
int stat;
int rc;
// --
error = TRUE;
rc = myNetRead( cfg, & type, 1, MSG_WAITALL|MSG_PEEK );
if ( rc <= 0 )
{
goto bailout;
}
// --
switch( type )
{
// Client -> Server Commands
// v3.3 Protocol
case 0: // Set Pixel Format
{
// IExec->DebugPrintF( "VNC_SetPixelFormat\n" );
// Log_PrintF( cfg, LOGTYPE_Error, "VNC_SetPixelFormat" );
stat = VNC_SetPixelFormat( cfg );
break;
}
// 1 - Not used
case 2: // Set Encoding
{
// IExec->DebugPrintF( "VNC_SetEncoding\n" );
// Log_PrintF( cfg, LOGTYPE_Error, "VNC_SetEncoding" );
stat = VNC_SetEncoding( cfg );
break;
}
case 3: // Update Request
{
// IExec->DebugPrintF( "VNC_UpdateRequest\n" );
// Log_PrintF( cfg, LOGTYPE_Error, "VNC_UpdateRequest" );
stat = VNC_UpdateRequest( cfg );
break;
}
case 4: // Key
{
// IExec->DebugPrintF( "VNC_Keyboard\n" );
// Log_PrintF( cfg, LOGTYPE_Error, "VNC_Keyboard" );
stat = VNC_Keyboard( cfg );
break;
}
case 5: // Mouse
{
// IExec->DebugPrintF( "VNC_Mouse\n" );
// Log_PrintF( cfg, LOGTYPE_Error, "VNC_Mouse" );
stat = VNC_Mouse( cfg );
break;
}
case 6: // Clipboard
{
// IExec->DebugPrintF( "VNC_Clipboard\n" );
// Log_PrintF( cfg, LOGTYPE_Error, "VNC_Clipboard" );
stat = VNC_Clipboard( cfg );
break;
}
default:
{
stat = myRead_Unknown( cfg );
break;
}
}
if ( stat )
{
// IExec->DebugPrintF( "Stat error %d\n", stat );
error = TRUE;
Log_PrintF( cfg, LOGTYPE_Error, "Error Stat : %ld\n", stat );
goto bailout;
}
// --
error = FALSE;
bailout:
return( error );
}