Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
libvncserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rasky
libvncserver
Commits
5ea7e51e
Commit
5ea7e51e
authored
Jan 12, 2012
by
Christian Beier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'websockets' of
https://github.com/kanaka/libvncserver
parents
66b0603b
f597599d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
18 deletions
+31
-18
CMakeLists.txt
CMakeLists.txt
+13
-11
websockets.c
libvncserver/websockets.c
+18
-7
No files found.
CMakeLists.txt
View file @
5ea7e51e
...
...
@@ -11,6 +11,12 @@ set(FULL_PACKAGE_NAME "LibVNCServer")
set
(
PACKAGE_VERSION
"0.9.8.1"
)
set
(
PROJECT_BUGREPORT_PATH
"http://sourceforge.net/projects/libvncserver"
)
set
(
CMAKE_C_FLAGS
"-O2 -W -Wall -g"
)
set
(
LIBVNCSERVER_DIR
${
CMAKE_SOURCE_DIR
}
/libvncserver
)
set
(
COMMON_DIR
${
CMAKE_SOURCE_DIR
}
/common
)
set
(
LIBVNCCLIENT_DIR
${
CMAKE_SOURCE_DIR
}
/libvncclient
)
set
(
LIBVNCSRVTEST_DIR
${
CMAKE_SOURCE_DIR
}
/examples
)
set
(
LIBVNCCLITEST_DIR
${
CMAKE_SOURCE_DIR
}
/client_examples
)
include_directories
(
${
CMAKE_SOURCE_DIR
}
${
CMAKE_BINARY_DIR
}
${
CMAKE_SOURCE_DIR
}
/libvncserver
${
CMAKE_SOURCE_DIR
}
/common
)
...
...
@@ -47,11 +53,15 @@ if(GNUTLS_FOUND)
set
(
LIBVNCSERVER_WITH_CLIENT_TLS 1
)
option
(
LIBVNCSERVER_WITH_WEBSOCKETS
"Build with websockets support (gnutls)"
ON
)
set
(
WEBSOCKET_LIBRARIES -lresolv
${
GNUTLS_LIBRARIES
}
)
set
(
WSSRCS
rfbssl
_gnutls
)
set
(
WSSRCS
${
LIBVNCSERVER_DIR
}
/rfbssl_gnutls
${
LIBVNCSERVER_DIR
}
/rfbcrypto
_gnutls
)
elseif
(
OPENSSL_FOUND
)
option
(
LIBVNCSERVER_WITH_WEBSOCKETS
"Build with websockets support (openssl)"
ON
)
set
(
WEBSOCKET_LIBRARIES -lresolv
${
OPENSSL_LIBRARIES
}
)
set
(
WSSRCS rfbssl_openssl
)
set
(
WSSRCS
${
LIBVNCSERVER_DIR
}
/rfbssl_openssl
${
LIBVNCSERVER_DIR
}
/rfbcrypto_openssl
)
else
()
option
(
LIBVNCSERVER_WITH_WEBSOCKETS
"Build with websockets support (no ssl)"
ON
)
set
(
WEBSOCKET_LIBRARIES -lresolv
)
set
(
WSSRCS
${
LIBVNCSERVER_DIR
}
/rfbssl_none.c
${
LIBVNCSERVER_DIR
}
/rfbcrypto_included.c
${
COMMON_DIR
}
/md5.c
${
COMMON_DIR
}
/sha1.c
)
endif
()
if
(
LIBGCRYPT_LIBRARIES
)
...
...
@@ -106,12 +116,6 @@ TEST_BIG_ENDIAN(LIBVNCSERVER_WORDS_BIGENDIAN)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/rfb/rfbconfig.h.cmake
${
CMAKE_BINARY_DIR
}
/rfb/rfbconfig.h
)
configure_file
(
${
CMAKE_SOURCE_DIR
}
/rfb/rfbint.h.cmake
${
CMAKE_BINARY_DIR
}
/rfb/rfbint.h
)
set
(
LIBVNCSERVER_DIR
${
CMAKE_SOURCE_DIR
}
/libvncserver
)
set
(
COMMON_DIR
${
CMAKE_SOURCE_DIR
}
/common
)
set
(
LIBVNCCLIENT_DIR
${
CMAKE_SOURCE_DIR
}
/libvncclient
)
set
(
LIBVNCSRVTEST_DIR
${
CMAKE_SOURCE_DIR
}
/examples
)
set
(
LIBVNCCLITEST_DIR
${
CMAKE_SOURCE_DIR
}
/client_examples
)
set
(
LIBVNCSERVER_SOURCES
${
LIBVNCSERVER_DIR
}
/main.c
${
LIBVNCSERVER_DIR
}
/rfbserver.c
...
...
@@ -191,9 +195,7 @@ if(LIBVNCSERVER_WITH_WEBSOCKETS)
set
(
LIBVNCSERVER_SOURCES
${
LIBVNCSERVER_SOURCES
}
${
LIBVNCSERVER_DIR
}
/websockets.c
${
LIBVNCSERVER_DIR
}
/
${
WSSRCS
}
${
COMMON_DIR
}
/md5.c
${
COMMON_DIR
}
/sha1.c
${
WSSRCS
}
)
endif
(
LIBVNCSERVER_WITH_WEBSOCKETS
)
...
...
libvncserver/websockets.c
View file @
5ea7e51e
...
...
@@ -527,7 +527,10 @@ webSocketsDecodeHixie(rfbClientPtr cl, char *dst, int len)
n
=
ws_peek
(
cl
,
buf
,
len
*
2
+
2
);
if
(
n
<=
0
)
{
/* save errno because rfbErr() will tamper it */
int
olderrno
=
errno
;
rfbErr
(
"%s: peek (%d) %m
\n
"
,
__func__
,
errno
);
errno
=
olderrno
;
return
n
;
}
...
...
@@ -642,14 +645,20 @@ webSocketsDecodeHybi(rfbClientPtr cl, char *dst, int len)
buf
=
wsctx
->
codeBuf
;
header
=
(
ws_header_t
*
)
wsctx
->
codeBuf
;
if
(
-
1
==
(
ret
=
ws_peek
(
cl
,
buf
,
B64LEN
(
len
)
+
WSHLENMAX
)))
{
rfbErr
(
"%s: peek; %m
\n
"
,
__func__
);
goto
spor
;
}
ret
=
ws_peek
(
cl
,
buf
,
B64LEN
(
len
)
+
WSHLENMAX
);
if
(
ret
<
2
)
{
rfbErr
(
"%s: peek; got %d bytes
\n
"
,
__func__
,
ret
);
goto
spor
;
/* Incomplete frame header */
/* save errno because rfbErr() will tamper it */
if
(
-
1
==
ret
)
{
int
olderrno
=
errno
;
rfbErr
(
"%s: peek; %m
\n
"
,
__func__
);
errno
=
olderrno
;
}
else
if
(
0
==
ret
)
{
result
=
0
;
}
else
{
errno
=
EAGAIN
;
}
goto
spor
;
}
opcode
=
header
->
b0
&
0x0f
;
...
...
@@ -691,7 +700,9 @@ webSocketsDecodeHybi(rfbClientPtr cl, char *dst, int len)
payload
=
buf
+
fhlen
+
4
;
/* header length + mask */
if
(
-
1
==
(
ret
=
ws_read
(
cl
,
buf
,
total
)))
{
int
olderrno
=
errno
;
rfbErr
(
"%s: read; %m"
,
__func__
);
errno
=
olderrno
;
return
ret
;
}
else
if
(
ret
<
total
)
{
/* GT TODO: hmm? */
...
...
@@ -760,7 +771,7 @@ webSocketsEncodeHybi(rfbClientPtr cl, const char *src, int len, char **dst)
* 0xA - pong
**/
if
(
!
len
)
{
rfbLog
(
"%s: nothing to encode
\n
"
,
__func__
);
/* nothing to encode */
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment