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
658b65ad
Commit
658b65ad
authored
Dec 01, 2004
by
dscho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support MinGW32!
parent
7d3b1c97
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
183 additions
and
51 deletions
+183
-51
ChangeLog
ChangeLog
+3
-0
TODO
TODO
+1
-0
Makefile.am
client_examples/Makefile.am
+1
-1
SDLvncviewer.c
client_examples/SDLvncviewer.c
+45
-1
configure.ac
configure.ac
+7
-1
Makefile.am
contrib/Makefile.am
+1
-1
Makefile.am
examples/Makefile.am
+1
-1
vncev.c
examples/vncev.c
+2
-0
listen.c
libvncclient/listen.c
+12
-2
rfbproto.c
libvncclient/rfbproto.c
+2
-0
sockets.c
libvncclient/sockets.c
+58
-19
vncviewer.c
libvncclient/vncviewer.c
+12
-1
libvncserver-config.in
libvncserver-config.in
+1
-1
httpd.c
libvncserver/httpd.c
+5
-0
main.c
libvncserver/main.c
+2
-0
sockets.c
libvncserver/sockets.c
+10
-13
rfb.h
rfb/rfb.h
+5
-1
rfbproto.h
rfb/rfbproto.h
+2
-2
Makefile.am
test/Makefile.am
+3
-3
Makefile.am
vncterm/Makefile.am
+9
-3
Makefile.am
x11vnc/Makefile.am
+1
-1
No files found.
ChangeLog
View file @
658b65ad
2004-12-02 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
* make LibVNCServer compile & work on MinGW32
2004-11-30 "Leiradella, Andre V Matos Da Cunha" <ANDRE.LEIRADELLA@bra.xerox.com>
2004-11-30 "Leiradella, Andre V Matos Da Cunha" <ANDRE.LEIRADELLA@bra.xerox.com>
* libvncclient/sockets.c: return TRUE in every case of success
* libvncclient/sockets.c: return TRUE in every case of success
...
...
TODO
View file @
658b65ad
immediate:
immediate:
----------
----------
MinGW32 doesn't do fcntl on sockets; use setsockopt instead...
always undraw cursor after sending updates, but do not mark region as modified.
always undraw cursor after sending updates, but do not mark region as modified.
add automatic tests (plasma?)
add automatic tests (plasma?)
if preferredEncoding is set outside of libvncserver, don't override it.
if preferredEncoding is set outside of libvncserver, don't override it.
...
...
client_examples/Makefile.am
View file @
658b65ad
DEFINES
=
-I
..
-g
-Wall
DEFINES
=
-I
..
-g
-Wall
LDADD
=
../libvncclient/libvncclient.a
LDADD
=
../libvncclient/libvncclient.a
@WSOCKLIB@
if
WITH_FFMPEG
if
WITH_FFMPEG
FFMPEG_HOME
=
@with_ffmpeg@
FFMPEG_HOME
=
@with_ffmpeg@
...
...
client_examples/SDLvncviewer.c
View file @
658b65ad
#include <SDL
/SDL
.h>
#include <SDL.h>
#include <rfb/rfbclient.h>
#include <rfb/rfbclient.h>
static
rfbBool
resize
(
rfbClient
*
client
)
{
static
rfbBool
resize
(
rfbClient
*
client
)
{
...
@@ -186,6 +186,46 @@ void update(rfbClient* cl,int x,int y,int w,int h) {
...
@@ -186,6 +186,46 @@ void update(rfbClient* cl,int x,int y,int w,int h) {
SDL_UpdateRect
(
cl
->
clientData
,
x
,
y
,
w
,
h
);
SDL_UpdateRect
(
cl
->
clientData
,
x
,
y
,
w
,
h
);
}
}
#ifdef __MINGW32__
#define LOG_TO_FILE
#endif
#ifdef LOG_TO_FILE
#include <stdarg.h>
static
void
log_to_file
(
const
char
*
format
,
...)
{
FILE
*
logfile
;
static
char
*
logfile_str
=
0
;
va_list
args
;
char
buf
[
256
];
time_t
log_clock
;
if
(
!
rfbEnableClientLogging
)
return
;
if
(
logfile_str
==
0
)
{
logfile_str
=
getenv
(
"VNCLOG"
);
if
(
logfile_str
==
0
)
logfile_str
=
"vnc.log"
;
}
logfile
=
fopen
(
logfile_str
,
"a"
);
va_start
(
args
,
format
);
time
(
&
log_clock
);
strftime
(
buf
,
255
,
"%d/%m/%Y %X "
,
localtime
(
&
log_clock
));
fprintf
(
logfile
,
buf
);
vfprintf
(
logfile
,
format
,
args
);
fflush
(
logfile
);
va_end
(
args
);
fclose
(
logfile
);
}
#endif
#ifdef mac
#ifdef mac
#define main SDLmain
#define main SDLmain
#endif
#endif
...
@@ -195,6 +235,10 @@ int main(int argc,char** argv) {
...
@@ -195,6 +235,10 @@ int main(int argc,char** argv) {
int
i
,
buttonMask
=
0
;
int
i
,
buttonMask
=
0
;
SDL_Event
e
;
SDL_Event
e
;
#ifdef LOG_TO_FILE
rfbClientLog
=
rfbClientErr
=
log_to_file
;
#endif
SDL_Init
(
SDL_INIT_VIDEO
|
SDL_INIT_NOPARACHUTE
);
SDL_Init
(
SDL_INIT_VIDEO
|
SDL_INIT_NOPARACHUTE
);
cl
=
rfbGetClient
(
5
,
3
,
2
);
cl
=
rfbGetClient
(
5
,
3
,
2
);
...
...
configure.ac
View file @
658b65ad
...
@@ -32,7 +32,6 @@ fi
...
@@ -32,7 +32,6 @@ fi
AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)])
AH_TEMPLATE(FFMPEG, [Use ffmpeg (for vnc2mpg)])
AC_ARG_WITH(ffmpeg,
AC_ARG_WITH(ffmpeg,
[ --with-ffmpeg=dir set ffmpeg home directory],,)
[ --with-ffmpeg=dir set ffmpeg home directory],,)
#AM_DEFINE(FFMPEG, "$with_ffmpeg")
AC_SUBST(with_ffmpeg)
AC_SUBST(with_ffmpeg)
AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
AM_CONDITIONAL(WITH_FFMPEG, test ! -z "$with_ffmpeg")
...
@@ -143,6 +142,13 @@ AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes")
...
@@ -143,6 +142,13 @@ AM_CONDITIONAL(HAVE_LIBSDL, test "x$with_sdl" = "xyes")
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_LIBS)
MINGW=`uname -s | grep MINGW 2>/dev/null`
AM_CONDITIONAL(MINGW, test ! -z "$MINGW" )
if test ! -z "$MINGW"; then
WSOCKLIB="-lws2_32"
fi
AC_SUBST(WSOCKLIB)
# Checks for header files.
# Checks for header files.
AC_HEADER_STDC
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h])
AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h syslog.h unistd.h])
...
...
contrib/Makefile.am
View file @
658b65ad
DEFINES
=
-I
..
DEFINES
=
-I
..
LDADD
=
../libvncserver/libvncserver.a
LDADD
=
../libvncserver/libvncserver.a
@WSOCKLIB@
noinst_PROGRAMS
=
zippy
noinst_PROGRAMS
=
zippy
...
...
examples/Makefile.am
View file @
658b65ad
DEFINES
=
-I
..
-g
-Wall
DEFINES
=
-I
..
-g
-Wall
LDADD
=
../libvncserver/libvncserver.a
LDADD
=
../libvncserver/libvncserver.a
@WSOCKLIB@
if
OSX
if
OSX
MAC
=
mac
MAC
=
mac
...
...
examples/vncev.c
View file @
658b65ad
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/types.h>
#ifndef __MINGW32__
#include <sys/socket.h>
#include <sys/socket.h>
#endif
#include <rfb/rfb.h>
#include <rfb/rfb.h>
#include <rfb/default8x16.h>
#include <rfb/default8x16.h>
...
...
libvncclient/listen.c
View file @
658b65ad
...
@@ -23,9 +23,13 @@
...
@@ -23,9 +23,13 @@
#include <unistd.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/types.h>
#ifdef __MINGW32__
#include <winsock2.h>
#else
#include <sys/wait.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/utsname.h>
#include <sys/utsname.h>
#endif
#include <sys/time.h>
#include <rfb/rfbclient.h>
#include <rfb/rfbclient.h>
/*
/*
...
@@ -36,6 +40,11 @@
...
@@ -36,6 +40,11 @@
void
void
listenForIncomingConnections
(
rfbClient
*
client
)
listenForIncomingConnections
(
rfbClient
*
client
)
{
{
#ifdef __MINGW32__
/* FIXME */
rfbClientErr
(
"listenForIncomingConnections on MinGW32 NOT IMPLEMENTED
\n
"
);
return
;
#else
int
listenSocket
;
int
listenSocket
;
fd_set
fds
;
fd_set
fds
;
...
@@ -77,7 +86,7 @@ listenForIncomingConnections(rfbClient* client)
...
@@ -77,7 +86,7 @@ listenForIncomingConnections(rfbClient* client)
switch
(
fork
())
{
switch
(
fork
())
{
case
-
1
:
case
-
1
:
rfbClientErr
(
"fork"
);
rfbClientErr
(
"fork
\n
"
);
return
;
return
;
case
0
:
case
0
:
...
@@ -92,6 +101,7 @@ listenForIncomingConnections(rfbClient* client)
...
@@ -92,6 +101,7 @@ listenForIncomingConnections(rfbClient* client)
}
}
}
}
}
}
#endif
}
}
libvncclient/rfbproto.c
View file @
658b65ad
...
@@ -25,7 +25,9 @@
...
@@ -25,7 +25,9 @@
#include <unistd.h>
#include <unistd.h>
#include <errno.h>
#include <errno.h>
#ifndef __MINGW32__
#include <pwd.h>
#include <pwd.h>
#endif
#include <rfb/rfbclient.h>
#include <rfb/rfbclient.h>
#ifdef LIBVNCSERVER_HAVE_LIBZ
#ifdef LIBVNCSERVER_HAVE_LIBZ
#include <zlib.h>
#include <zlib.h>
...
...
libvncclient/sockets.c
View file @
658b65ad
...
@@ -22,15 +22,23 @@
...
@@ -22,15 +22,23 @@
*/
*/
#include <unistd.h>
#include <unistd.h>
#include <sys/socket.h>
#include <errno.h>
#include <errno.h>
#include <fcntl.h>
#include <assert.h>
#include <rfb/rfbclient.h>
#ifdef WIN32
#include <winsock2.h>
#define EWOULDBLOCK WSAEWOULDBLOCK
#define close closesocket
#define read(sock,buf,len) recv(sock,buf,len,0)
#define write(sock,buf,len) send(sock,buf,len,0)
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netdb.h>
#include <fcntl.h>
#endif
#include <assert.h>
#include <rfb/rfbclient.h>
void
PrintInHex
(
char
*
buf
,
int
len
);
void
PrintInHex
(
char
*
buf
,
int
len
);
...
@@ -81,7 +89,12 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
...
@@ -81,7 +89,12 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
diff
.
tv_usec
+=
1000000
;
diff
.
tv_usec
+=
1000000
;
}
}
sleep
(
diff
.
tv_sec
);
sleep
(
diff
.
tv_sec
);
#ifndef __MINGW32__
/* FIXME */
usleep
(
diff
.
tv_usec
);
usleep
(
diff
.
tv_usec
);
#else
rfbClientErr
(
"usleep on MinGW32 NOT IMPLEMENTED
\n
"
);
#endif
}
}
rec
->
tv
=
tv
;
rec
->
tv
=
tv
;
...
@@ -114,13 +127,16 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
...
@@ -114,13 +127,16 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
int
i
=
read
(
client
->
sock
,
client
->
buf
+
client
->
buffered
,
RFB_BUF_SIZE
-
client
->
buffered
);
int
i
=
read
(
client
->
sock
,
client
->
buf
+
client
->
buffered
,
RFB_BUF_SIZE
-
client
->
buffered
);
if
(
i
<=
0
)
{
if
(
i
<=
0
)
{
if
(
i
<
0
)
{
if
(
i
<
0
)
{
#ifdef WIN32
errno
=
WSAGetLastError
();
#endif
if
(
errno
==
EWOULDBLOCK
||
errno
==
EAGAIN
)
{
if
(
errno
==
EWOULDBLOCK
||
errno
==
EAGAIN
)
{
/* TODO:
/* TODO:
ProcessXtEvents();
ProcessXtEvents();
*/
*/
i
=
0
;
i
=
0
;
}
else
{
}
else
{
rfbClientErr
(
"read
"
);
rfbClientErr
(
"read
(%d: %s)
\n
"
,
errno
,
strerror
(
errno
)
);
return
FALSE
;
return
FALSE
;
}
}
}
else
{
}
else
{
...
@@ -143,13 +159,16 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
...
@@ -143,13 +159,16 @@ ReadFromRFBServer(rfbClient* client, char *out, unsigned int n)
int
i
=
read
(
client
->
sock
,
out
,
n
);
int
i
=
read
(
client
->
sock
,
out
,
n
);
if
(
i
<=
0
)
{
if
(
i
<=
0
)
{
if
(
i
<
0
)
{
if
(
i
<
0
)
{
#ifdef WIN32
errno
=
WSAGetLastError
();
#endif
if
(
errno
==
EWOULDBLOCK
||
errno
==
EAGAIN
)
{
if
(
errno
==
EWOULDBLOCK
||
errno
==
EAGAIN
)
{
/* TODO:
/* TODO:
ProcessXtEvents();
ProcessXtEvents();
*/
*/
i
=
0
;
i
=
0
;
}
else
{
}
else
{
rfbClientErr
(
"read
"
);
rfbClientErr
(
"read
(%s)
\n
"
,
strerror
(
errno
)
);
return
FALSE
;
return
FALSE
;
}
}
}
else
{
}
else
{
...
@@ -200,12 +219,12 @@ WriteToRFBServer(rfbClient* client, char *buf, int n)
...
@@ -200,12 +219,12 @@ WriteToRFBServer(rfbClient* client, char *buf, int n)
FD_SET
(
client
->
sock
,
&
fds
);
FD_SET
(
client
->
sock
,
&
fds
);
if
(
select
(
client
->
sock
+
1
,
NULL
,
&
fds
,
NULL
,
NULL
)
<=
0
)
{
if
(
select
(
client
->
sock
+
1
,
NULL
,
&
fds
,
NULL
,
NULL
)
<=
0
)
{
rfbClientErr
(
"select"
);
rfbClientErr
(
"select
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
j
=
0
;
j
=
0
;
}
else
{
}
else
{
rfbClientErr
(
"write"
);
rfbClientErr
(
"write
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
}
else
{
}
else
{
...
@@ -230,25 +249,41 @@ ConnectClientToTcpAddr(unsigned int host, int port)
...
@@ -230,25 +249,41 @@ ConnectClientToTcpAddr(unsigned int host, int port)
struct
sockaddr_in
addr
;
struct
sockaddr_in
addr
;
int
one
=
1
;
int
one
=
1
;
#ifdef WIN32
WSADATA
trash
;
static
rfbBool
WSAinitted
=
FALSE
;
if
(
!
WSAinitted
)
{
WSAinitted
=
TRUE
;
int
i
=
WSAStartup
(
MAKEWORD
(
2
,
0
),
&
trash
);
if
(
i
!=
0
)
{
rfbClientErr
(
"Couldn't init Windows Sockets
\n
"
);
return
-
1
;
}
}
#endif
addr
.
sin_family
=
AF_INET
;
addr
.
sin_family
=
AF_INET
;
addr
.
sin_port
=
htons
(
port
);
addr
.
sin_port
=
htons
(
port
);
addr
.
sin_addr
.
s_addr
=
host
;
addr
.
sin_addr
.
s_addr
=
host
;
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
<
0
)
{
if
(
sock
<
0
)
{
rfbClientErr
(
"ConnectToTcpAddr: socket"
);
#ifdef WIN32
errno
=
WSAGetLastError
();
#endif
rfbClientErr
(
"ConnectToTcpAddr: socket (%s)
\n
"
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
<
0
)
{
if
(
connect
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
<
0
)
{
rfbClientErr
(
"ConnectToTcpAddr: connect"
);
rfbClientErr
(
"ConnectToTcpAddr: connect
\n
"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
if
(
setsockopt
(
sock
,
IPPROTO_TCP
,
TCP_NODELAY
,
if
(
setsockopt
(
sock
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
(
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
rfbClientErr
(
"ConnectToTcpAddr: setsockopt"
);
rfbClientErr
(
"ConnectToTcpAddr: setsockopt
\n
"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
...
@@ -274,7 +309,7 @@ FindFreeTcpPort(void)
...
@@ -274,7 +309,7 @@ FindFreeTcpPort(void)
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
<
0
)
{
if
(
sock
<
0
)
{
rfbClientErr
(
": FindFreeTcpPort: socket"
);
rfbClientErr
(
": FindFreeTcpPort: socket
\n
"
);
return
0
;
return
0
;
}
}
...
@@ -308,25 +343,25 @@ ListenAtTcpPort(int port)
...
@@ -308,25 +343,25 @@ ListenAtTcpPort(int port)
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
sock
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
);
if
(
sock
<
0
)
{
if
(
sock
<
0
)
{
rfbClientErr
(
"ListenAtTcpPort: socket"
);
rfbClientErr
(
"ListenAtTcpPort: socket
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
if
(
setsockopt
(
sock
,
SOL_SOCKET
,
SO_REUSEADDR
,
(
const
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
(
const
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
rfbClientErr
(
"ListenAtTcpPort: setsockopt"
);
rfbClientErr
(
"ListenAtTcpPort: setsockopt
\n
"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
<
0
)
{
if
(
bind
(
sock
,
(
struct
sockaddr
*
)
&
addr
,
sizeof
(
addr
))
<
0
)
{
rfbClientErr
(
"ListenAtTcpPort: bind"
);
rfbClientErr
(
"ListenAtTcpPort: bind
\n
"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
if
(
listen
(
sock
,
5
)
<
0
)
{
if
(
listen
(
sock
,
5
)
<
0
)
{
rfbClientErr
(
"ListenAtTcpPort: listen"
);
rfbClientErr
(
"ListenAtTcpPort: listen
\n
"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
...
@@ -349,13 +384,13 @@ AcceptTcpConnection(int listenSock)
...
@@ -349,13 +384,13 @@ AcceptTcpConnection(int listenSock)
sock
=
accept
(
listenSock
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
sock
=
accept
(
listenSock
,
(
struct
sockaddr
*
)
&
addr
,
&
addrlen
);
if
(
sock
<
0
)
{
if
(
sock
<
0
)
{
rfbClientErr
(
"AcceptTcpConnection: accept"
);
rfbClientErr
(
"AcceptTcpConnection: accept
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
setsockopt
(
sock
,
IPPROTO_TCP
,
TCP_NODELAY
,
if
(
setsockopt
(
sock
,
IPPROTO_TCP
,
TCP_NODELAY
,
(
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
(
char
*
)
&
one
,
sizeof
(
one
))
<
0
)
{
rfbClientErr
(
"AcceptTcpConnection: setsockopt"
);
rfbClientErr
(
"AcceptTcpConnection: setsockopt
\n
"
);
close
(
sock
);
close
(
sock
);
return
-
1
;
return
-
1
;
}
}
...
@@ -371,10 +406,14 @@ AcceptTcpConnection(int listenSock)
...
@@ -371,10 +406,14 @@ AcceptTcpConnection(int listenSock)
rfbBool
rfbBool
SetNonBlocking
(
int
sock
)
SetNonBlocking
(
int
sock
)
{
{
#ifndef __MINGW32__
if
(
fcntl
(
sock
,
F_SETFL
,
O_NONBLOCK
)
<
0
)
{
if
(
fcntl
(
sock
,
F_SETFL
,
O_NONBLOCK
)
<
0
)
{
rfbClientErr
(
"AcceptTcpConnection: fcntl"
);
rfbClientErr
(
"AcceptTcpConnection: fcntl
\n
"
);
return
FALSE
;
return
FALSE
;
}
}
#else
rfbClientErr
(
"O_NONBLOCK on MinGW32 NOT IMPLEMENTED
\n
"
);
#endif
return
TRUE
;
return
TRUE
;
}
}
...
...
libvncclient/vncviewer.c
View file @
658b65ad
...
@@ -37,9 +37,18 @@ static void DummyRect(rfbClient* client, int x, int y, int w, int h) {
...
@@ -37,9 +37,18 @@ static void DummyRect(rfbClient* client, int x, int y, int w, int h) {
static
char
*
NoPassword
(
rfbClient
*
client
)
{
static
char
*
NoPassword
(
rfbClient
*
client
)
{
return
strdup
(
""
);
return
strdup
(
""
);
}
}
#ifndef __MINGW32__
#include <stdio.h>
#include <stdio.h>
#include <termios.h>
#include <termios.h>
#endif
static
char
*
ReadPassword
(
rfbClient
*
client
)
{
static
char
*
ReadPassword
(
rfbClient
*
client
)
{
#ifdef __MINGW32__
/* FIXME */
rfbClientErr
(
"ReadPassword on MinGW32 NOT IMPLEMENTED
\n
"
);
return
NoPassword
(
client
);
#else
int
i
;
int
i
;
char
*
p
=
malloc
(
9
);
char
*
p
=
malloc
(
9
);
struct
termios
save
,
noecho
;
struct
termios
save
,
noecho
;
...
@@ -61,6 +70,7 @@ static char* ReadPassword(rfbClient* client) {
...
@@ -61,6 +70,7 @@ static char* ReadPassword(rfbClient* client) {
}
}
tcsetattr
(
fileno
(
stdin
),
TCSAFLUSH
,
&
save
);
tcsetattr
(
fileno
(
stdin
),
TCSAFLUSH
,
&
save
);
return
p
;
return
p
;
#endif
}
}
static
rfbBool
MallocFrameBuffer
(
rfbClient
*
client
)
{
static
rfbBool
MallocFrameBuffer
(
rfbClient
*
client
)
{
if
(
client
->
frameBuffer
)
if
(
client
->
frameBuffer
)
...
@@ -196,7 +206,8 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
...
@@ -196,7 +206,8 @@ rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv) {
char
*
colon
=
strchr
(
argv
[
i
],
':'
);
char
*
colon
=
strchr
(
argv
[
i
],
':'
);
if
(
colon
)
{
if
(
colon
)
{
client
->
serverHost
=
strndup
(
argv
[
i
],(
int
)(
colon
-
argv
[
i
]));
client
->
serverHost
=
strdup
(
argv
[
i
]);
client
->
serverHost
[(
int
)(
colon
-
argv
[
i
])]
=
'\0'
;
client
->
serverPort
=
atoi
(
colon
+
1
);
client
->
serverPort
=
atoi
(
colon
+
1
);
}
else
{
}
else
{
client
->
serverHost
=
strdup
(
argv
[
i
]);
client
->
serverHost
=
strdup
(
argv
[
i
]);
...
...
libvncserver-config.in
View file @
658b65ad
...
@@ -60,7 +60,7 @@ while test $# -gt 0; do
...
@@ -60,7 +60,7 @@ while test $# -gt 0; do
else
else
libdirs
=
"-L
$libdir
"
libdirs
=
"-L
$libdir
"
fi
fi
echo
"
$libdirs
"
-lvncserver
@LIBS@
echo
"
$libdirs
"
-lvncserver
@LIBS@
@WSOCKLIB@
;;
;;
--link
)
--link
)
echo
@CC@
echo
@CC@
...
...
libvncserver/httpd.c
View file @
658b65ad
...
@@ -161,6 +161,9 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
...
@@ -161,6 +161,9 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
rfbLogPerror
(
"httpCheckFds: accept"
);
rfbLogPerror
(
"httpCheckFds: accept"
);
return
;
return
;
}
}
#ifdef __MINGW32__
rfbErr
(
"O_NONBLOCK on MinGW32 NOT IMPLEMENTED"
);
#else
#ifdef USE_LIBWRAP
#ifdef USE_LIBWRAP
if
(
!
hosts_ctl
(
"vnc"
,
STRING_UNKNOWN
,
inet_ntoa
(
addr
.
sin_addr
),
if
(
!
hosts_ctl
(
"vnc"
,
STRING_UNKNOWN
,
inet_ntoa
(
addr
.
sin_addr
),
STRING_UNKNOWN
))
{
STRING_UNKNOWN
))
{
...
@@ -176,6 +179,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
...
@@ -176,6 +179,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
rfbScreen
->
httpSock
=
-
1
;
rfbScreen
->
httpSock
=
-
1
;
return
;
return
;
}
}
flags
=
fcntl
(
rfbScreen
->
httpSock
,
F_GETFL
);
flags
=
fcntl
(
rfbScreen
->
httpSock
,
F_GETFL
);
if
(
flags
==-
1
||
if
(
flags
==-
1
||
fcntl
(
rfbScreen
->
httpSock
,
F_SETFL
,
flags
|
O_NONBLOCK
)
==-
1
)
{
fcntl
(
rfbScreen
->
httpSock
,
F_SETFL
,
flags
|
O_NONBLOCK
)
==-
1
)
{
...
@@ -184,6 +188,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
...
@@ -184,6 +188,7 @@ rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
rfbScreen
->
httpSock
=-
1
;
rfbScreen
->
httpSock
=-
1
;
return
;
return
;
}
}
#endif
/*AddEnabledDevice(httpSock);*/
/*AddEnabledDevice(httpSock);*/
}
}
...
...
libvncserver/main.c
View file @
658b65ad
...
@@ -762,8 +762,10 @@ void rfbInitServer(rfbScreenInfoPtr screen)
...
@@ -762,8 +762,10 @@ void rfbInitServer(rfbScreenInfoPtr screen)
#endif
#endif
rfbInitSockets
(
screen
);
rfbInitSockets
(
screen
);
rfbHttpInitSockets
(
screen
);
rfbHttpInitSockets
(
screen
);
#ifndef __MINGW32__
if
(
screen
->
ignoreSIGPIPE
)
if
(
screen
->
ignoreSIGPIPE
)
signal
(
SIGPIPE
,
SIG_IGN
);
signal
(
SIGPIPE
,
SIG_IGN
);
#endif
}
}
#ifndef LIBVNCSERVER_HAVE_GETTIMEOFDAY
#ifndef LIBVNCSERVER_HAVE_GETTIMEOFDAY
...
...
libvncserver/sockets.c
View file @
658b65ad
...
@@ -45,14 +45,6 @@
...
@@ -45,14 +45,6 @@
#include <sys/types.h>
#include <sys/types.h>
#endif
#endif
#ifdef WIN32
#pragma warning (disable: 4018 4761)
#define close closesocket
#define read(sock,buf,len) recv(sock,buf,len,0)
#define EWOULDBLOCK WSAEWOULDBLOCK
#define ETIMEDOUT WSAETIMEDOUT
#define write(sock,buf,len) send(sock,buf,len,0)
#else
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
#include <sys/time.h>
#include <sys/time.h>
#endif
#endif
...
@@ -68,7 +60,6 @@
...
@@ -68,7 +60,6 @@
#ifdef LIBVNCSERVER_HAVE_UNISTD_H
#ifdef LIBVNCSERVER_HAVE_UNISTD_H
#include <unistd.h>
#include <unistd.h>
#endif
#endif
#endif
#if defined(__linux__) && defined(NEED_TIMEVAL)
#if defined(__linux__) && defined(NEED_TIMEVAL)
struct
timeval
struct
timeval
...
@@ -91,10 +82,14 @@ int allow_severity=LOG_INFO;
...
@@ -91,10 +82,14 @@ int allow_severity=LOG_INFO;
int
deny_severity
=
LOG_WARNING
;
int
deny_severity
=
LOG_WARNING
;
#endif
#endif
/*#ifndef WIN32
#if defined(WIN32)
int max(int i,int j) { return(i<j?j:i); }
#pragma warning (disable: 4018 4761)
#define close closesocket
#define read(sock,buf,len) recv(sock,buf,len,0)
#define EWOULDBLOCK WSAEWOULDBLOCK
#define ETIMEDOUT WSAETIMEDOUT
#define write(sock,buf,len) send(sock,buf,len,0)
#endif
#endif
*/
int
rfbMaxClientWait
=
20000
;
/* time (ms) after which we decide client has
int
rfbMaxClientWait
=
20000
;
/* time (ms) after which we decide client has
gone away - needed to stop us hanging */
gone away - needed to stop us hanging */
...
@@ -334,7 +329,9 @@ rfbCloseClient(cl)
...
@@ -334,7 +329,9 @@ rfbCloseClient(cl)
while
(
cl
->
screen
->
maxFd
>
0
while
(
cl
->
screen
->
maxFd
>
0
&&
!
FD_ISSET
(
cl
->
screen
->
maxFd
,
&
(
cl
->
screen
->
allFds
)))
&&
!
FD_ISSET
(
cl
->
screen
->
maxFd
,
&
(
cl
->
screen
->
allFds
)))
cl
->
screen
->
maxFd
--
;
cl
->
screen
->
maxFd
--
;
#ifndef __MINGW32__
shutdown
(
cl
->
sock
,
SHUT_RDWR
);
shutdown
(
cl
->
sock
,
SHUT_RDWR
);
#endif
close
(
cl
->
sock
);
close
(
cl
->
sock
);
cl
->
sock
=
-
1
;
cl
->
sock
=
-
1
;
}
}
...
@@ -414,7 +411,7 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
...
@@ -414,7 +411,7 @@ rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
}
else
{
}
else
{
#ifdef WIN32
#ifdef WIN32
errno
=
WSAGetLastError
();
errno
=
WSAGetLastError
();
#endif
#endif
if
(
errno
==
EINTR
)
if
(
errno
==
EINTR
)
continue
;
continue
;
...
...
rfb/rfb.h
View file @
658b65ad
...
@@ -41,6 +41,10 @@ extern "C"
...
@@ -41,6 +41,10 @@ extern "C"
#include <sys/types.h>
#include <sys/types.h>
#endif
#endif
#ifdef __MINGW32__
#include <winsock2.h>
#endif
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
#include <pthread.h>
#include <pthread.h>
#if 0 /* debugging */
#if 0 /* debugging */
...
@@ -208,7 +212,7 @@ typedef struct _rfbScreenInfo
...
@@ -208,7 +212,7 @@ typedef struct _rfbScreenInfo
SOCKET
listenSock
;
SOCKET
listenSock
;
int
maxSock
;
int
maxSock
;
int
maxFd
;
int
maxFd
;
fd_set
allFds
;
struct
fd_set
allFds
;
rfbBool
socketInitDone
;
rfbBool
socketInitDone
;
SOCKET
inetdSock
;
SOCKET
inetdSock
;
...
...
rfb/rfbproto.h
View file @
658b65ad
...
@@ -47,7 +47,7 @@
...
@@ -47,7 +47,7 @@
*/
*/
#if defined(WIN32)
#if defined(WIN32)
&& !defined(__MINGW32__)
#define LIBVNCSERVER_WORDS_BIGENDIAN
#define LIBVNCSERVER_WORDS_BIGENDIAN
#define rfbBool int
#define rfbBool int
#include <sys/timeb.h>
#include <sys/timeb.h>
...
@@ -65,7 +65,7 @@
...
@@ -65,7 +65,7 @@
#endif
#endif
#if !defined(WIN32)
#if !defined(WIN32)
|| defined(__MINGW32__)
#define max(a,b) (((a)>(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
#include <sys/time.h>
#include <sys/time.h>
...
...
test/Makefile.am
View file @
658b65ad
DEFINES
=
-I
..
-g
-Wall
DEFINES
=
-I
..
-g
-Wall
LDADD
=
../libvncserver/libvncserver.a ../libvncclient/libvncclient.a @WSOCKLIB@
if
HAVE_LIBPTHREAD
if
HAVE_LIBPTHREAD
BACKGROUND_TEST
=
blooptest
BACKGROUND_TEST
=
blooptest
ENCODINGS_TEST
=
encodingstest
endif
endif
copyrecttest_LDADD
=
$(LDADD)
-lm
copyrecttest_LDADD
=
$(LDADD)
-lm
noinst_PROGRAMS
=
encodingstest cargstest copyrecttest
$(BACKGROUND_TEST)
noinst_PROGRAMS
=
$(ENCODINGS_TEST)
cargstest copyrecttest
$(BACKGROUND_TEST)
LDADD
=
../libvncserver/libvncserver.a ../libvncclient/libvncclient.a
test
:
encodingstest cargstest copyrecttest
test
:
encodingstest cargstest copyrecttest
./encodingstest
&&
./cargstest
./encodingstest
&&
./cargstest
...
...
vncterm/Makefile.am
View file @
658b65ad
...
@@ -4,7 +4,7 @@ noinst_HEADERS=VNConsole.h vga.h
...
@@ -4,7 +4,7 @@ noinst_HEADERS=VNConsole.h vga.h
CFLAGS_ADD
=
-I
..
CFLAGS_ADD
=
-I
..
LDADD
=
../libvncserver/libvncserver.a
LDADD
=
../libvncserver/libvncserver.a
@WSOCKLIB@
INCLUDES
=
-I
.
INCLUDES
=
-I
.
if
LINUX
if
LINUX
...
@@ -12,7 +12,13 @@ bin_PROGRAMS=LinuxVNC
...
@@ -12,7 +12,13 @@ bin_PROGRAMS=LinuxVNC
LinuxVNC_SOURCES
=
LinuxVNC.c
$(CONSOLE_SRCS)
LinuxVNC_SOURCES
=
LinuxVNC.c
$(CONSOLE_SRCS)
endif
endif
noinst_PROGRAMS
=
VNCommand example
if
!
MINGW
VNCommand_SOURCES
=
VNCommand.c
$(CONSOLE_SRCS)
VNCOMMAND
=
VNCommand
endif
noinst_PROGRAMS
=
example
$(VNCOMMAND)
example_SOURCES
=
example.c
$(CONSOLE_SRCS)
example_SOURCES
=
example.c
$(CONSOLE_SRCS)
VNCommand_SOURCES
=
VNCommand.c
$(CONSOLE_SRCS)
x11vnc/Makefile.am
View file @
658b65ad
DEFINES
=
-I
..
DEFINES
=
-I
..
LDADD
=
../libvncserver/libvncserver.a
LDADD
=
../libvncserver/libvncserver.a
@WSOCKLIB@
man_MANS
=
x11vnc.1
man_MANS
=
x11vnc.1
EXTRA_DIST
=
ChangeLog README
$(man_MANS)
EXTRA_DIST
=
ChangeLog README
$(man_MANS)
...
...
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