mirror of
https://github.com/KDE/krfb
synced 2026-07-02 16:01:17 -07:00
Compare commits
5 Commits
Applicatio
...
v4.9.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
636dd0ffc6 | ||
|
|
eb85bfd08d | ||
|
|
a76a94a581 | ||
|
|
cbe1659ec5 | ||
|
|
61d62a1221 |
@@ -3,49 +3,32 @@ project(krfb)
|
||||
if(NOT INSIDE_KDENETWORK)
|
||||
message("Not building inside KDENetwork, loading KDE CMake Macros.")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules ${CMAKE_MODULE_PATH})
|
||||
|
||||
find_package(KDE4 REQUIRED)
|
||||
|
||||
include(KDE4Defaults)
|
||||
include(MacroLibrary)
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(CheckIncludeFiles)
|
||||
include(CheckSymbolExists)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckLibraryExists)
|
||||
include(CheckPrototypeExists)
|
||||
include(CheckTypeSize)
|
||||
|
||||
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE4_PLATFORM_DEFINITIONS})
|
||||
if(WIN32)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${KDEWIN32_LIBRARIES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${KDEWIN32_INCLUDES})
|
||||
endif(WIN32)
|
||||
add_definitions(${QT_DEFINITIONS} ${QT_QTDBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
add_definitions(-DQT_USE_FAST_CONCATENATION -DQT_USE_FAST_OPERATOR_PLUS)
|
||||
macro_optional_find_package(TelepathyQt4)
|
||||
macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
|
||||
|
||||
set(CMAKE_REQUIRED_DEFINITIONS ${_KDE_PLATFORM_DEFINITIONS})
|
||||
|
||||
add_definitions(${QT_DEFINITIONS} ${QT_DBUS_DEFINITIONS} ${KDE4_DEFINITIONS})
|
||||
include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${KDE4_INCLUDES})
|
||||
endif(NOT INSIDE_KDENETWORK)
|
||||
|
||||
set(IS_KTP_INTERNAL_MODULE TRUE)
|
||||
set(CMAKE_MODULE_PATH
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
|
||||
${CMAKE_MODULE_PATH}
|
||||
)
|
||||
|
||||
find_package(LibVNCServer REQUIRED)
|
||||
|
||||
macro_optional_find_package(TelepathyQt4)
|
||||
macro_log_feature(TelepathyQt4_FOUND "telepathy-qt" "Telepathy Qt Bindings" "http://telepathy.freedesktop.org" FALSE "0.9" "Needed to build Telepathy Tubes support.")
|
||||
|
||||
macro_optional_find_package(KTp)
|
||||
macro_log_feature(KTP_FOUND "KTP" "KDE Telepathy" "https://projects.kde.org/projects/extragear/network/telepathy" FALSE "" "Needed to build KDE IM Contacts Display in KRFB.")
|
||||
|
||||
macro_bool_to_01(X11_Xdamage_FOUND HAVE_XDAMAGE)
|
||||
macro_bool_to_01(X11_XShm_FOUND HAVE_XSHM)
|
||||
|
||||
include_directories ("${CMAKE_CURRENT_BINARY_DIR}/krfb"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/krfb"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/krfb/ui"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/libvncserver/"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libvncserver/"
|
||||
)
|
||||
|
||||
if(Q_WS_X11)
|
||||
@@ -54,9 +37,9 @@ if(Q_WS_X11)
|
||||
endif(NOT X11_XTest_FOUND)
|
||||
endif(Q_WS_X11)
|
||||
|
||||
add_subdirectory(libvncserver)
|
||||
add_subdirectory(krfb)
|
||||
add_subdirectory(framebuffers)
|
||||
add_subdirectory(doc)
|
||||
add_subdirectory (framebuffers)
|
||||
|
||||
if (NOT INSIDE_KDENETWORK)
|
||||
macro_display_feature_log()
|
||||
|
||||
347
COPYING
347
COPYING
@@ -1,347 +0,0 @@
|
||||
NOTE! The GPL below is copyrighted by the Free Software Foundation, but
|
||||
the instance of code that it refers to (the kde programs) are copyrighted
|
||||
by the authors who actually wrote it.
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Library General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) 19yy <name of author>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) 19yy name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Library General
|
||||
Public License instead of this License.
|
||||
397
COPYING.DOC
397
COPYING.DOC
@@ -1,397 +0,0 @@
|
||||
GNU Free Documentation License
|
||||
Version 1.2, November 2002
|
||||
|
||||
|
||||
Copyright (C) 2000,2001,2002 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
0. PREAMBLE
|
||||
|
||||
The purpose of this License is to make a manual, textbook, or other
|
||||
functional and useful document "free" in the sense of freedom: to
|
||||
assure everyone the effective freedom to copy and redistribute it,
|
||||
with or without modifying it, either commercially or noncommercially.
|
||||
Secondarily, this License preserves for the author and publisher a way
|
||||
to get credit for their work, while not being considered responsible
|
||||
for modifications made by others.
|
||||
|
||||
This License is a kind of "copyleft", which means that derivative
|
||||
works of the document must themselves be free in the same sense. It
|
||||
complements the GNU General Public License, which is a copyleft
|
||||
license designed for free software.
|
||||
|
||||
We have designed this License in order to use it for manuals for free
|
||||
software, because free software needs free documentation: a free
|
||||
program should come with manuals providing the same freedoms that the
|
||||
software does. But this License is not limited to software manuals;
|
||||
it can be used for any textual work, regardless of subject matter or
|
||||
whether it is published as a printed book. We recommend this License
|
||||
principally for works whose purpose is instruction or reference.
|
||||
|
||||
|
||||
1. APPLICABILITY AND DEFINITIONS
|
||||
|
||||
This License applies to any manual or other work, in any medium, that
|
||||
contains a notice placed by the copyright holder saying it can be
|
||||
distributed under the terms of this License. Such a notice grants a
|
||||
world-wide, royalty-free license, unlimited in duration, to use that
|
||||
work under the conditions stated herein. The "Document", below,
|
||||
refers to any such manual or work. Any member of the public is a
|
||||
licensee, and is addressed as "you". You accept the license if you
|
||||
copy, modify or distribute the work in a way requiring permission
|
||||
under copyright law.
|
||||
|
||||
A "Modified Version" of the Document means any work containing the
|
||||
Document or a portion of it, either copied verbatim, or with
|
||||
modifications and/or translated into another language.
|
||||
|
||||
A "Secondary Section" is a named appendix or a front-matter section of
|
||||
the Document that deals exclusively with the relationship of the
|
||||
publishers or authors of the Document to the Document's overall subject
|
||||
(or to related matters) and contains nothing that could fall directly
|
||||
within that overall subject. (Thus, if the Document is in part a
|
||||
textbook of mathematics, a Secondary Section may not explain any
|
||||
mathematics.) The relationship could be a matter of historical
|
||||
connection with the subject or with related matters, or of legal,
|
||||
commercial, philosophical, ethical or political position regarding
|
||||
them.
|
||||
|
||||
The "Invariant Sections" are certain Secondary Sections whose titles
|
||||
are designated, as being those of Invariant Sections, in the notice
|
||||
that says that the Document is released under this License. If a
|
||||
section does not fit the above definition of Secondary then it is not
|
||||
allowed to be designated as Invariant. The Document may contain zero
|
||||
Invariant Sections. If the Document does not identify any Invariant
|
||||
Sections then there are none.
|
||||
|
||||
The "Cover Texts" are certain short passages of text that are listed,
|
||||
as Front-Cover Texts or Back-Cover Texts, in the notice that says that
|
||||
the Document is released under this License. A Front-Cover Text may
|
||||
be at most 5 words, and a Back-Cover Text may be at most 25 words.
|
||||
|
||||
A "Transparent" copy of the Document means a machine-readable copy,
|
||||
represented in a format whose specification is available to the
|
||||
general public, that is suitable for revising the document
|
||||
straightforwardly with generic text editors or (for images composed of
|
||||
pixels) generic paint programs or (for drawings) some widely available
|
||||
drawing editor, and that is suitable for input to text formatters or
|
||||
for automatic translation to a variety of formats suitable for input
|
||||
to text formatters. A copy made in an otherwise Transparent file
|
||||
format whose markup, or absence of markup, has been arranged to thwart
|
||||
or discourage subsequent modification by readers is not Transparent.
|
||||
An image format is not Transparent if used for any substantial amount
|
||||
of text. A copy that is not "Transparent" is called "Opaque".
|
||||
|
||||
Examples of suitable formats for Transparent copies include plain
|
||||
ASCII without markup, Texinfo input format, LaTeX input format, SGML
|
||||
or XML using a publicly available DTD, and standard-conforming simple
|
||||
HTML, PostScript or PDF designed for human modification. Examples of
|
||||
transparent image formats include PNG, XCF and JPG. Opaque formats
|
||||
include proprietary formats that can be read and edited only by
|
||||
proprietary word processors, SGML or XML for which the DTD and/or
|
||||
processing tools are not generally available, and the
|
||||
machine-generated HTML, PostScript or PDF produced by some word
|
||||
processors for output purposes only.
|
||||
|
||||
The "Title Page" means, for a printed book, the title page itself,
|
||||
plus such following pages as are needed to hold, legibly, the material
|
||||
this License requires to appear in the title page. For works in
|
||||
formats which do not have any title page as such, "Title Page" means
|
||||
the text near the most prominent appearance of the work's title,
|
||||
preceding the beginning of the body of the text.
|
||||
|
||||
A section "Entitled XYZ" means a named subunit of the Document whose
|
||||
title either is precisely XYZ or contains XYZ in parentheses following
|
||||
text that translates XYZ in another language. (Here XYZ stands for a
|
||||
specific section name mentioned below, such as "Acknowledgements",
|
||||
"Dedications", "Endorsements", or "History".) To "Preserve the Title"
|
||||
of such a section when you modify the Document means that it remains a
|
||||
section "Entitled XYZ" according to this definition.
|
||||
|
||||
The Document may include Warranty Disclaimers next to the notice which
|
||||
states that this License applies to the Document. These Warranty
|
||||
Disclaimers are considered to be included by reference in this
|
||||
License, but only as regards disclaiming warranties: any other
|
||||
implication that these Warranty Disclaimers may have is void and has
|
||||
no effect on the meaning of this License.
|
||||
|
||||
|
||||
2. VERBATIM COPYING
|
||||
|
||||
You may copy and distribute the Document in any medium, either
|
||||
commercially or noncommercially, provided that this License, the
|
||||
copyright notices, and the license notice saying this License applies
|
||||
to the Document are reproduced in all copies, and that you add no other
|
||||
conditions whatsoever to those of this License. You may not use
|
||||
technical measures to obstruct or control the reading or further
|
||||
copying of the copies you make or distribute. However, you may accept
|
||||
compensation in exchange for copies. If you distribute a large enough
|
||||
number of copies you must also follow the conditions in section 3.
|
||||
|
||||
You may also lend copies, under the same conditions stated above, and
|
||||
you may publicly display copies.
|
||||
|
||||
|
||||
3. COPYING IN QUANTITY
|
||||
|
||||
If you publish printed copies (or copies in media that commonly have
|
||||
printed covers) of the Document, numbering more than 100, and the
|
||||
Document's license notice requires Cover Texts, you must enclose the
|
||||
copies in covers that carry, clearly and legibly, all these Cover
|
||||
Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
|
||||
the back cover. Both covers must also clearly and legibly identify
|
||||
you as the publisher of these copies. The front cover must present
|
||||
the full title with all words of the title equally prominent and
|
||||
visible. You may add other material on the covers in addition.
|
||||
Copying with changes limited to the covers, as long as they preserve
|
||||
the title of the Document and satisfy these conditions, can be treated
|
||||
as verbatim copying in other respects.
|
||||
|
||||
If the required texts for either cover are too voluminous to fit
|
||||
legibly, you should put the first ones listed (as many as fit
|
||||
reasonably) on the actual cover, and continue the rest onto adjacent
|
||||
pages.
|
||||
|
||||
If you publish or distribute Opaque copies of the Document numbering
|
||||
more than 100, you must either include a machine-readable Transparent
|
||||
copy along with each Opaque copy, or state in or with each Opaque copy
|
||||
a computer-network location from which the general network-using
|
||||
public has access to download using public-standard network protocols
|
||||
a complete Transparent copy of the Document, free of added material.
|
||||
If you use the latter option, you must take reasonably prudent steps,
|
||||
when you begin distribution of Opaque copies in quantity, to ensure
|
||||
that this Transparent copy will remain thus accessible at the stated
|
||||
location until at least one year after the last time you distribute an
|
||||
Opaque copy (directly or through your agents or retailers) of that
|
||||
edition to the public.
|
||||
|
||||
It is requested, but not required, that you contact the authors of the
|
||||
Document well before redistributing any large number of copies, to give
|
||||
them a chance to provide you with an updated version of the Document.
|
||||
|
||||
|
||||
4. MODIFICATIONS
|
||||
|
||||
You may copy and distribute a Modified Version of the Document under
|
||||
the conditions of sections 2 and 3 above, provided that you release
|
||||
the Modified Version under precisely this License, with the Modified
|
||||
Version filling the role of the Document, thus licensing distribution
|
||||
and modification of the Modified Version to whoever possesses a copy
|
||||
of it. In addition, you must do these things in the Modified Version:
|
||||
|
||||
A. Use in the Title Page (and on the covers, if any) a title distinct
|
||||
from that of the Document, and from those of previous versions
|
||||
(which should, if there were any, be listed in the History section
|
||||
of the Document). You may use the same title as a previous version
|
||||
if the original publisher of that version gives permission.
|
||||
B. List on the Title Page, as authors, one or more persons or entities
|
||||
responsible for authorship of the modifications in the Modified
|
||||
Version, together with at least five of the principal authors of the
|
||||
Document (all of its principal authors, if it has fewer than five),
|
||||
unless they release you from this requirement.
|
||||
C. State on the Title page the name of the publisher of the
|
||||
Modified Version, as the publisher.
|
||||
D. Preserve all the copyright notices of the Document.
|
||||
E. Add an appropriate copyright notice for your modifications
|
||||
adjacent to the other copyright notices.
|
||||
F. Include, immediately after the copyright notices, a license notice
|
||||
giving the public permission to use the Modified Version under the
|
||||
terms of this License, in the form shown in the Addendum below.
|
||||
G. Preserve in that license notice the full lists of Invariant Sections
|
||||
and required Cover Texts given in the Document's license notice.
|
||||
H. Include an unaltered copy of this License.
|
||||
I. Preserve the section Entitled "History", Preserve its Title, and add
|
||||
to it an item stating at least the title, year, new authors, and
|
||||
publisher of the Modified Version as given on the Title Page. If
|
||||
there is no section Entitled "History" in the Document, create one
|
||||
stating the title, year, authors, and publisher of the Document as
|
||||
given on its Title Page, then add an item describing the Modified
|
||||
Version as stated in the previous sentence.
|
||||
J. Preserve the network location, if any, given in the Document for
|
||||
public access to a Transparent copy of the Document, and likewise
|
||||
the network locations given in the Document for previous versions
|
||||
it was based on. These may be placed in the "History" section.
|
||||
You may omit a network location for a work that was published at
|
||||
least four years before the Document itself, or if the original
|
||||
publisher of the version it refers to gives permission.
|
||||
K. For any section Entitled "Acknowledgements" or "Dedications",
|
||||
Preserve the Title of the section, and preserve in the section all
|
||||
the substance and tone of each of the contributor acknowledgements
|
||||
and/or dedications given therein.
|
||||
L. Preserve all the Invariant Sections of the Document,
|
||||
unaltered in their text and in their titles. Section numbers
|
||||
or the equivalent are not considered part of the section titles.
|
||||
M. Delete any section Entitled "Endorsements". Such a section
|
||||
may not be included in the Modified Version.
|
||||
N. Do not retitle any existing section to be Entitled "Endorsements"
|
||||
or to conflict in title with any Invariant Section.
|
||||
O. Preserve any Warranty Disclaimers.
|
||||
|
||||
If the Modified Version includes new front-matter sections or
|
||||
appendices that qualify as Secondary Sections and contain no material
|
||||
copied from the Document, you may at your option designate some or all
|
||||
of these sections as invariant. To do this, add their titles to the
|
||||
list of Invariant Sections in the Modified Version's license notice.
|
||||
These titles must be distinct from any other section titles.
|
||||
|
||||
You may add a section Entitled "Endorsements", provided it contains
|
||||
nothing but endorsements of your Modified Version by various
|
||||
parties--for example, statements of peer review or that the text has
|
||||
been approved by an organization as the authoritative definition of a
|
||||
standard.
|
||||
|
||||
You may add a passage of up to five words as a Front-Cover Text, and a
|
||||
passage of up to 25 words as a Back-Cover Text, to the end of the list
|
||||
of Cover Texts in the Modified Version. Only one passage of
|
||||
Front-Cover Text and one of Back-Cover Text may be added by (or
|
||||
through arrangements made by) any one entity. If the Document already
|
||||
includes a cover text for the same cover, previously added by you or
|
||||
by arrangement made by the same entity you are acting on behalf of,
|
||||
you may not add another; but you may replace the old one, on explicit
|
||||
permission from the previous publisher that added the old one.
|
||||
|
||||
The author(s) and publisher(s) of the Document do not by this License
|
||||
give permission to use their names for publicity for or to assert or
|
||||
imply endorsement of any Modified Version.
|
||||
|
||||
|
||||
5. COMBINING DOCUMENTS
|
||||
|
||||
You may combine the Document with other documents released under this
|
||||
License, under the terms defined in section 4 above for modified
|
||||
versions, provided that you include in the combination all of the
|
||||
Invariant Sections of all of the original documents, unmodified, and
|
||||
list them all as Invariant Sections of your combined work in its
|
||||
license notice, and that you preserve all their Warranty Disclaimers.
|
||||
|
||||
The combined work need only contain one copy of this License, and
|
||||
multiple identical Invariant Sections may be replaced with a single
|
||||
copy. If there are multiple Invariant Sections with the same name but
|
||||
different contents, make the title of each such section unique by
|
||||
adding at the end of it, in parentheses, the name of the original
|
||||
author or publisher of that section if known, or else a unique number.
|
||||
Make the same adjustment to the section titles in the list of
|
||||
Invariant Sections in the license notice of the combined work.
|
||||
|
||||
In the combination, you must combine any sections Entitled "History"
|
||||
in the various original documents, forming one section Entitled
|
||||
"History"; likewise combine any sections Entitled "Acknowledgements",
|
||||
and any sections Entitled "Dedications". You must delete all sections
|
||||
Entitled "Endorsements".
|
||||
|
||||
|
||||
6. COLLECTIONS OF DOCUMENTS
|
||||
|
||||
You may make a collection consisting of the Document and other documents
|
||||
released under this License, and replace the individual copies of this
|
||||
License in the various documents with a single copy that is included in
|
||||
the collection, provided that you follow the rules of this License for
|
||||
verbatim copying of each of the documents in all other respects.
|
||||
|
||||
You may extract a single document from such a collection, and distribute
|
||||
it individually under this License, provided you insert a copy of this
|
||||
License into the extracted document, and follow this License in all
|
||||
other respects regarding verbatim copying of that document.
|
||||
|
||||
|
||||
7. AGGREGATION WITH INDEPENDENT WORKS
|
||||
|
||||
A compilation of the Document or its derivatives with other separate
|
||||
and independent documents or works, in or on a volume of a storage or
|
||||
distribution medium, is called an "aggregate" if the copyright
|
||||
resulting from the compilation is not used to limit the legal rights
|
||||
of the compilation's users beyond what the individual works permit.
|
||||
When the Document is included in an aggregate, this License does not
|
||||
apply to the other works in the aggregate which are not themselves
|
||||
derivative works of the Document.
|
||||
|
||||
If the Cover Text requirement of section 3 is applicable to these
|
||||
copies of the Document, then if the Document is less than one half of
|
||||
the entire aggregate, the Document's Cover Texts may be placed on
|
||||
covers that bracket the Document within the aggregate, or the
|
||||
electronic equivalent of covers if the Document is in electronic form.
|
||||
Otherwise they must appear on printed covers that bracket the whole
|
||||
aggregate.
|
||||
|
||||
|
||||
8. TRANSLATION
|
||||
|
||||
Translation is considered a kind of modification, so you may
|
||||
distribute translations of the Document under the terms of section 4.
|
||||
Replacing Invariant Sections with translations requires special
|
||||
permission from their copyright holders, but you may include
|
||||
translations of some or all Invariant Sections in addition to the
|
||||
original versions of these Invariant Sections. You may include a
|
||||
translation of this License, and all the license notices in the
|
||||
Document, and any Warranty Disclaimers, provided that you also include
|
||||
the original English version of this License and the original versions
|
||||
of those notices and disclaimers. In case of a disagreement between
|
||||
the translation and the original version of this License or a notice
|
||||
or disclaimer, the original version will prevail.
|
||||
|
||||
If a section in the Document is Entitled "Acknowledgements",
|
||||
"Dedications", or "History", the requirement (section 4) to Preserve
|
||||
its Title (section 1) will typically require changing the actual
|
||||
title.
|
||||
|
||||
|
||||
9. TERMINATION
|
||||
|
||||
You may not copy, modify, sublicense, or distribute the Document except
|
||||
as expressly provided for under this License. Any other attempt to
|
||||
copy, modify, sublicense or distribute the Document is void, and will
|
||||
automatically terminate your rights under this License. However,
|
||||
parties who have received copies, or rights, from you under this
|
||||
License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
|
||||
10. FUTURE REVISIONS OF THIS LICENSE
|
||||
|
||||
The Free Software Foundation may publish new, revised versions
|
||||
of the GNU Free Documentation License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns. See
|
||||
http://www.gnu.org/copyleft/.
|
||||
|
||||
Each version of the License is given a distinguishing version number.
|
||||
If the Document specifies that a particular numbered version of this
|
||||
License "or any later version" applies to it, you have the option of
|
||||
following the terms and conditions either of that specified version or
|
||||
of any later version that has been published (not as a draft) by the
|
||||
Free Software Foundation. If the Document does not specify a version
|
||||
number of this License, you may choose any version ever published (not
|
||||
as a draft) by the Free Software Foundation.
|
||||
|
||||
|
||||
ADDENDUM: How to use this License for your documents
|
||||
|
||||
To use this License in a document you have written, include a copy of
|
||||
the License in the document and put the following copyright and
|
||||
license notices just after the title page:
|
||||
|
||||
Copyright (c) YEAR YOUR NAME.
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU Free Documentation License, Version 1.2
|
||||
or any later version published by the Free Software Foundation;
|
||||
with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
|
||||
A copy of the license is included in the section entitled "GNU
|
||||
Free Documentation License".
|
||||
|
||||
If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
|
||||
replace the "with...Texts." line with this:
|
||||
|
||||
with the Invariant Sections being LIST THEIR TITLES, with the
|
||||
Front-Cover Texts being LIST, and with the Back-Cover Texts being LIST.
|
||||
|
||||
If you have Invariant Sections without Cover Texts, or some other
|
||||
combination of the three, merge those two alternatives to suit the
|
||||
situation.
|
||||
|
||||
If your document contains nontrivial examples of program code, we
|
||||
recommend releasing these examples in parallel under your choice of
|
||||
free software license, such as the GNU General Public License,
|
||||
to permit their use in free software.
|
||||
510
COPYING.LIB
510
COPYING.LIB
@@ -1,510 +0,0 @@
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations
|
||||
below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it
|
||||
becomes a de-facto standard. To achieve this, non-free programs must
|
||||
be allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control
|
||||
compilation and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at least
|
||||
three years, to give the same user the materials specified in
|
||||
Subsection 6a, above, for a charge no more than the cost of
|
||||
performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply, and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License
|
||||
may add an explicit geographical distribution limitation excluding those
|
||||
countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms
|
||||
of the ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library.
|
||||
It is safest to attach them to the start of each source file to most
|
||||
effectively convey the exclusion of warranty; and each file should
|
||||
have at least the "copyright" line and a pointer to where the full
|
||||
notice is found.
|
||||
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
your school, if any, to sign a "copyright disclaimer" for the library,
|
||||
if necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James
|
||||
Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
# Try to find the KTp library
|
||||
# KTP_FOUND
|
||||
# KTP_INCLUDE_DIR
|
||||
# KTP_LIBRARIES
|
||||
# KTP_MODELS_LIBRARIES
|
||||
# KTP_WIDGETS_LIBRARIES
|
||||
|
||||
# Copyright (c) 2011, Dario Freddi <drf@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
if (NOT IS_KTP_INTERNAL_MODULE)
|
||||
message (FATAL_ERROR "KTp can be used just from internal components at this time")
|
||||
endif (NOT IS_KTP_INTERNAL_MODULE)
|
||||
|
||||
SET (KTP_FIND_REQUIRED ${KTp_FIND_REQUIRED})
|
||||
if (KTP_INCLUDE_DIRS AND KTP_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
set(KTP_FIND_QUIETLY TRUE)
|
||||
endif (KTP_INCLUDE_DIRS AND KTP_LIBRARIES)
|
||||
|
||||
find_path(KTP_INCLUDE_DIR
|
||||
NAMES KTp/presence.h
|
||||
PATHS ${KDE4_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
find_library(KTP_LIBRARIES NAMES ktpcommoninternalsprivate )
|
||||
find_library(KTP_MODELS_LIBRARIES NAMES ktpmodelsprivate )
|
||||
find_library(KTP_WIDGETS_LIBRARIES NAMES ktpwidgetsprivate )
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(KTp DEFAULT_MSG
|
||||
KTP_LIBRARIES
|
||||
KTP_MODELS_LIBRARIES
|
||||
KTP_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(KTP_INCLUDE_DIRS KTP_LIBRARIES)
|
||||
@@ -1,41 +0,0 @@
|
||||
# cmake macro to test LIBVNCSERVER LIB
|
||||
|
||||
# Copyright (c) 2006, Alessandro Praduroux <pradu@pradu.it>
|
||||
# Copyright (c) 2007, Urs Wolfer <uwolfer @ kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
INCLUDE(CheckPointerMember)
|
||||
|
||||
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(LIBVNCSERVER_FIND_QUIETLY TRUE)
|
||||
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||
|
||||
FIND_PATH(LIBVNCSERVER_INCLUDE_DIR rfb/rfb.h)
|
||||
|
||||
FIND_LIBRARY(LIBVNCSERVER_LIBRARIES NAMES vncserver libvncserver)
|
||||
|
||||
# libvncserver and libvncclient are in the same package, so it does
|
||||
# not make sense to add a new cmake script for finding libvncclient.
|
||||
# instead just find the libvncclient also in this file.
|
||||
FIND_PATH(LIBVNCCLIENT_INCLUDE_DIR rfb/rfbclient.h)
|
||||
FIND_LIBRARY(LIBVNCCLIENT_LIBRARIES NAMES vncclient libvncclient)
|
||||
|
||||
IF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||
SET(CMAKE_REQUIRED_INCLUDES "${LIBVNCSERVER_INCLUDE_DIR}" "${CMAKE_REQUIRED_INCLUDES}")
|
||||
CHECK_POINTER_MEMBER(rfbClient* GotXCutText rfb/rfbclient.h LIBVNCSERVER_FOUND)
|
||||
ENDIF (LIBVNCSERVER_INCLUDE_DIR AND LIBVNCSERVER_LIBRARIES)
|
||||
|
||||
IF (LIBVNCSERVER_FOUND)
|
||||
IF (NOT LIBVNCSERVER_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found LibVNCServer: ${LIBVNCSERVER_LIBRARIES}")
|
||||
ENDIF (NOT LIBVNCSERVER_FIND_QUIETLY)
|
||||
ELSE (LIBVNCSERVER_FOUND)
|
||||
IF (LIBVNCSERVER_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could NOT find acceptable version of LibVNCServer (version 0.9 or later required).")
|
||||
ENDIF (LIBVNCSERVER_FIND_REQUIRED)
|
||||
ENDIF (LIBVNCSERVER_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(LIBVNCSERVER_INCLUDE_DIR LIBVNCSERVER_LIBRARIES)
|
||||
@@ -1,2 +1,2 @@
|
||||
########### install files ###############
|
||||
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en SUBDIR krfb)
|
||||
kde4_create_handbook(index.docbook INSTALL_DESTINATION ${HTML_INSTALL_DIR}/en)
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
]>
|
||||
<!-- Based on kdoctemplate v0.9 January 10 2003 -->
|
||||
|
||||
<book id="krfb" lang="&language;">
|
||||
<book lang="&language;">
|
||||
|
||||
<!-- This header contains all of the meta-information for the document such
|
||||
as Authors, publish date, the abstract, and Keywords -->
|
||||
@@ -43,8 +43,8 @@ Please respect the format of the date (YYYY-MM-DD) and of the version
|
||||
(V.MM.LL), it could be used by automation scripts.
|
||||
Do NOT change these in the translation. -->
|
||||
|
||||
<date>2013-06-19</date>
|
||||
<releaseinfo>&kde; 4.11</releaseinfo>
|
||||
<date>2010-02-09</date>
|
||||
<releaseinfo>&kde; 4.4</releaseinfo>
|
||||
|
||||
<!-- Abstract about this handbook -->
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
Encoding=UTF-8
|
||||
Comment=Qt based Framebuffer for KRfb.
|
||||
Comment[ast]=Esquema Qt de buffer pa KRfb
|
||||
Comment[bg]=Основан на Qt фреймбуфер за KRfb.
|
||||
Comment[bs]=Kadrobafer za KRfb na osnovu Qt.
|
||||
Comment[bs]=Kadrobafer za KRfb na osnovu Qt
|
||||
Comment[ca]=«Framebuffer» basat en Qt per al KRfb.
|
||||
Comment[ca@valencia]=«Framebuffer» basat en Qt per al KRfb.
|
||||
Comment[cs]=Framebuffer založený na Qt pro KRfb.
|
||||
@@ -34,7 +33,6 @@ Comment[nn]=Qt basert framebuffer for KRfb.
|
||||
Comment[pl]=Bufor ramki na podstawie Qt dla KRfb.
|
||||
Comment[pt]='Framebuffer' baseado no Qt para o KRfb.
|
||||
Comment[pt_BR]=Framebuffer baseado no Qt para o KRfb.
|
||||
Comment[ru]=Буфер экрана для KRfb на базе Qt.
|
||||
Comment[si]=KRfb සඳහා Qt මත පදනම් වූ රාමු බෆරය
|
||||
Comment[sk]=Framebuffer založený na Qt pre KRfb.
|
||||
Comment[sl]=Slikovni medpomnilnik za KRFB, ki temelji na Qt
|
||||
@@ -50,7 +48,6 @@ Comment[zh_CN]=基于 Qt 的 KRfb 帧缓冲机制
|
||||
Comment[zh_TW]=KRfb 的 Qt-based Framebuffer
|
||||
Name=Qt Framebuffer for KRfb
|
||||
Name[ast]=Esquema Qt de buffer pa KRfb
|
||||
Name[bg]=Qt фреймбуфер за KRfb
|
||||
Name[bs]=Qt-ov kadrobafer za KRFB
|
||||
Name[ca]=«Framebuffer» Qt per al KRfb.
|
||||
Name[ca@valencia]=«Framebuffer» Qt per al KRfb.
|
||||
@@ -82,7 +79,6 @@ Name[nn]=Qt-framebuffer for KRfb
|
||||
Name[pl]=Bufor ramki Qt dla KRfb
|
||||
Name[pt]='Framebuffer' do Qt para o KRfb
|
||||
Name[pt_BR]=Framebuffer do Qt para o KRfb
|
||||
Name[ru]=Буфер экрана Qt для KRfb
|
||||
Name[si]=KRfb සඳහා වන Qt රාමුබෆරය
|
||||
Name[sk]=Qt Framebuffer pre KRfb
|
||||
Name[sl]=Slikovni medpomnilnik Qt za KRFB
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
Encoding=UTF-8
|
||||
Comment=X11 XDamage/XShm based Framebuffer for KRfb.
|
||||
Comment[ast]=Esquema de buffer pa KRfb basáu en XDamage/XShm
|
||||
Comment[bg]=Основан на X11 XDamage/XShm фреймбуфер за KRfb.
|
||||
Comment[bs]=X11 XDamage/XShm baziran framebafer za KRfb.
|
||||
Comment[ca]=«Framebuffer» basat en XDamage/XShmQt de l'X11 per al KRfb.
|
||||
Comment[ca@valencia]=«Framebuffer» basat en XDamage/XShmQt de l'X11 per al KRfb.
|
||||
@@ -15,7 +14,7 @@ Comment[es]=Memoria intermedia de vídeo basada en X11 Damage/XShm para KRfb.
|
||||
Comment[et]=KRfb X11 XDamage/XShm põhine kaadripuhver
|
||||
Comment[eu]=X11 XDamage/XShm oinarritutako KRfb-ren irteerako bideoa.
|
||||
Comment[fi]=X11 XDamage/XShm-perustainen kehyspuskui KRfb:lle.
|
||||
Comment[fr]=Sortie vidéo fondée sur X11 « XDamage / XShm » pour Krfb.
|
||||
Comment[fr]=Sortie vidéo fondée sur X11 XDamage / XShm pour Krfb.
|
||||
Comment[ga]=Maolán fráma le haghaidh KRfb, bunaithe ar X11 XDamage/XShm
|
||||
Comment[gl]=Framebuffer baseado en Xll XDamage/Xshm para XRfb.
|
||||
Comment[hr]=Međuspreminik okvira baziran na X11 XDamage/XShm za KRfb.
|
||||
@@ -34,7 +33,6 @@ Comment[nn]=X11 XDamage/XShm basert framebuffer for KRfb.
|
||||
Comment[pl]=Bufor ramki na podstawie X11 XDamage/XShm dla KRfb.
|
||||
Comment[pt]='Framebuffer' baseado no XDamage/XShm do X11 para o KRfb.
|
||||
Comment[pt_BR]=Framebuffer baseado no XDamage/XShm do X11 para o KRfb.
|
||||
Comment[ru]=Буфер экрана для KRfb на базе X11 XDamage/XShm
|
||||
Comment[si]=KRfb සඳහා වන රාමු බෆරය මත පදනම් වූ X11 XDamage/XShm.
|
||||
Comment[sk]=Framebuffer založený na X11 XDamage/XShm pre KRfb.
|
||||
Comment[sl]=Slikovni medpomnilnik za KRFB, ki temelji na X11 XDamage/XShm
|
||||
@@ -50,7 +48,6 @@ Comment[zh_CN]=基于 X11 XDamage/XShm 扩展的 KRfb 帧缓冲机制。
|
||||
Comment[zh_TW]=KRfb 的 X11 XDamage/XShm based Framebuffer
|
||||
Name=X11 Framebuffer for KRfb
|
||||
Name[ast]=Buffer de X11 pa KRfb
|
||||
Name[bg]=X11 фреймбуфер за KRfb
|
||||
Name[bs]=X11 frame bafer za KRfb
|
||||
Name[ca]=«Framebuffer» de l'X11 per al KRfb.
|
||||
Name[ca@valencia]=«Framebuffer» de l'X11 per al KRfb.
|
||||
@@ -82,7 +79,6 @@ Name[nn]=X11-framebuffer for KRfb
|
||||
Name[pl]=Bufor ramki X11 dla KRfb
|
||||
Name[pt]='Framebuffer' do X11 para o KRfb
|
||||
Name[pt_BR]=Framebuffer do X11 para o KRfb
|
||||
Name[ru]=Буфер экрана X11 для KRfb
|
||||
Name[si]=KRfb සඳහා X11 රාමු බෆරය
|
||||
Name[sk]=X11 Framebuffer pre KRfb
|
||||
Name[sl]=Slikovni medpomnilnik X11 za KRFB
|
||||
|
||||
17
kcm_krfb/CMakeLists.txt
Normal file
17
kcm_krfb/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
include_directories(${CMAKE_BINARY_DIR}/krfb/krfb)
|
||||
|
||||
set(kcm_krfb_PART_SRCS kcm_krfb.cpp ${krfbconfig_SRCS})
|
||||
|
||||
kde4_add_ui3_files(kcm_krfb_PART_SRCS configurationwidget.ui)
|
||||
kde4_add_ui3_files(kcm_krfb_PART_SRCS
|
||||
${CMAKE_SOURCE_DIR}/krfb/krfb/manageinvitations.ui
|
||||
${CMAKE_SOURCE_DIR}/krfb/krfb/personalinvitewidget.ui
|
||||
${CMAKE_SOURCE_DIR}/krfb/krfb/invitewidget.ui)
|
||||
|
||||
kde4_add_plugin(kcm_krfb ${kcm_krfb_PART_SRCS})
|
||||
|
||||
target_link_libraries(kcm_krfb ${KDE4_KDECORE_LIBS} ${KDE4_KDE3SUPPORT_LIBS})
|
||||
|
||||
install(TARGETS kcm_krfb DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
install( FILES kcmkrfb.desktop DESTINATION ${SERVICES_INSTALL_DIR})
|
||||
3
kcm_krfb/Messages.sh
Normal file
3
kcm_krfb/Messages.sh
Normal file
@@ -0,0 +1,3 @@
|
||||
#! /bin/sh
|
||||
$EXTRACTRC *.ui >> rc.cpp
|
||||
$XGETTEXT *.cpp -o $podir/kcm_krfb.pot
|
||||
509
kcm_krfb/configurationwidget.ui
Normal file
509
kcm_krfb/configurationwidget.ui
Normal file
@@ -0,0 +1,509 @@
|
||||
<!DOCTYPE UI><UI version="3.1" stdsetdef="1">
|
||||
<class>ConfigurationWidget</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>ConfigurationWidget</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>421</width>
|
||||
<height>445</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<pixmap>image0</pixmap>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QTabWidget">
|
||||
<property name="name">
|
||||
<cstring>TabWidget2</cstring>
|
||||
</property>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>tab</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>Acc&ess</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Invitations</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>AlignAuto</set>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>invitationNumLabel</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>You have no open invitations.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton">
|
||||
<property name="name">
|
||||
<cstring>manageInvitations</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Create && &Manage Invitations...</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Click to view or delete the open invitations.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QButtonGroup">
|
||||
<property name="name">
|
||||
<cstring>ButtonGroup7</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>1</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Uninvited Connections</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>allowUninvitedCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow &uninvited connections</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Select this option to allow connecting without inviting. This is useful if you want to access your desktop remotely.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>enableSLPCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Announce service &on the network</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>If you allow uninvited connections and enable this option, Desktop Sharing will announce the service and your identity on the local network, so people can find you and your computer.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>confirmConnectionsCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Confirm uninvited connections &before accepting</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>If enabled, a dialog will appear when somebody attempts to connect, asking you whether you want to accept the connection.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>allowDesktopControlCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>A&llow uninvited connections to control the desktop</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Enable this option to allow uninvited user to control your desktop (using mouse and keyboard).</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame">
|
||||
<property name="name">
|
||||
<cstring>Frame4</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>5</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Plain</enum>
|
||||
</property>
|
||||
<property name="layoutMargin" stdset="0">
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>TextLabel1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>1</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pass&word:</string>
|
||||
</property>
|
||||
<property name="buddy" stdset="0">
|
||||
<cstring>passwordInput</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit">
|
||||
<property name="name">
|
||||
<cstring>passwordInput</cstring>
|
||||
</property>
|
||||
<property name="maxLength">
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>Password</enum>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>If you allow uninvited connections, it is highly recommended to set a password in order to protect your computer from unauthorized access.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>Spacer3</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>tab</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>&Session</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>GroupBox4</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Session Preferences</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>disableBackgroundCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Always disable &background image</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Check this option to always disable the background image during a remote session. Otherwise the client decides whether the background will be enabled or disabled.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>Spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>tab</cstring>
|
||||
</property>
|
||||
<attribute name="title">
|
||||
<string>&Network</string>
|
||||
</attribute>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QGroupBox">
|
||||
<property name="name">
|
||||
<cstring>GroupBox3</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Network Port</string>
|
||||
</property>
|
||||
<vbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QCheckBox">
|
||||
<property name="name">
|
||||
<cstring>autoPortCB</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Assi&gn port automatically</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Check this option to assign the network port automatically. This is recommended unless your network setup requires you to use a fixed port, for example because of a firewall.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QFrame">
|
||||
<property name="name">
|
||||
<cstring>portInputFrame</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>Plain</enum>
|
||||
</property>
|
||||
<hbox>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLabel">
|
||||
<property name="name">
|
||||
<cstring>TextLabel1_2</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>P&ort:</string>
|
||||
</property>
|
||||
<property name="buddy" stdset="0">
|
||||
<cstring>portInput</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="KIntNumInput">
|
||||
<property name="name">
|
||||
<cstring>portInput</cstring>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5900</number>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1024</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>32767</number>
|
||||
</property>
|
||||
<property name="toolTip" stdset="0">
|
||||
<string>Enter the TCP port number here</string>
|
||||
</property>
|
||||
<property name="whatsThis" stdset="0">
|
||||
<string>Use this field to set a static port number for the desktop sharing service. Note that if the port is already in use the Desktop Sharing service will not be accessible until you free it. It is recommended to assign the port automatically unless you know what you are doing.
|
||||
Most VNC clients use a display number instead of the actual port. This display number is the offset to port 5900, so port 5901 has the display number 1.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</hbox>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<spacer>
|
||||
<property name="name">
|
||||
<cstring>Spacer4</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</vbox>
|
||||
</widget>
|
||||
</widget>
|
||||
</vbox>
|
||||
</widget>
|
||||
<images>
|
||||
<image name="image0">
|
||||
<data format="XPM.GZ" length="8078">789cdd98c7721cc91186ef7c0a04f3c650d4b637a1d001de5b8200880d1db2da604038c29b0dbdbb32ffeceec582b30448015a85fa2726e69b32592633ab9abf7c98d8db589df8f0cbbbcb2bbe3aac26aa115f4c7ca8af4f4eee7ffde73f7e7bf73e2926e45f144413d1fbbfbd7bbf7935514dac9d9d360a540a50204f91827707f6e09d9ecb045c0c8c726e7be600e579cfde787960eb7f69e01cbc38b08d67a6e7cadaef0d8cc15336b0f5b73270095e1898c1d33dd7d65f3a30ca997b6eac7c75e00a3cdf738bf9f36dc789f5cfdd78c3a8e3bb9ebbfa67c651d0b4e059e3b4ecca0fc06110e636ff29701224b5958fc07990e7982f1f838ba0c863d4bfeb990bf06dcfb65eecc0555065980faff45cdafc6e94c57c5085e0497012266cfd7f06a761da98fd7be3346d6d3e042ec222857d5eee39afc14b3d97369e4d30879cc31e1f82abb04a8dbf2847611426d6df09b8888a18fdd145cf564ee7039bbd4fe0322a131baf0773c4dd78578de3dcfc81bf1a6741577e04aea22a36ffb4f2366a538cdf61be71a002c37f623c688f7889b3986d3c740dce55ca1efb19972a947f04b30a7c05ae5460ac775cabd0ff3eb851c13ee697a8c398ff263d77fe760ad60db5f5c57e26910aed2b70ac42f95ec789ad1f617f123c28dfedd8a7660ff3497215cae14f89ec4e6bf383ff279cb0ad1f617f13af427dc46bd2a850bedf73b71f5bc659d2f9f38331e7564e985faa0e6af35b372eb8b6f961fc69a44239e22b8d55e035e33ca96dbf108f291e30fc2fcd5560c45f5aa49dbfd343cfa5cd7f71602b877fa4a50ae3413e49598572f853ea5528477e936013a11cf34f5b1518fb95052ad4477916aac073e04805463ece6215da07e04485f20d70aa02637db24285f94c0f0cfb0ef3cd4a15fac3fa659c716bf9cfec3377f1e642709575f9c7213eb24605b6f1b42af477a98c70c1781dfc01ee65feb7615c8a03a17c1b8c0d427bc4439ea9c0c87f391eb4afc1850aede17f79a902233fe75e0546fce5950a6ced1b1518f92c6f5560c46fa109d8e263aee7ce5fd1bed08465fb83f82f621518fe05f7b2fd803f633b301f1781310130fcadc083fe91bfc4f94428473e90c34104463e2abc0aeb61e5f5b01e8db10a8cfd281a15ea6f1bcbf6dbfa20df16ad0a8c7c50062a30e2bfd4846cf385bf20fd59fc7d34f67965ed11cf65a2c27c62b0844fe74fc83f703fac8747fc9479ef1fd41aabd03fe683e5b0f9e1bc2ef18011dfa55781719e9655d99d8f0ef9a0ac55b067fd377dff0ee74fd9aac028e780bbfb9047bc72d8f7478db10af5b15fac0794e527c4030febe30f3aeec7931aab501ff1cdc9b0bf38df905ecc7f70bf630d50ac175bfba2efdf4d1b73777f7038afb954c13efc957def8fdec65f0dfe3569ac42ff8877ae5311eab3f130be0b631518e7918f5460ecb78f55609cbf382e2cfe71fff4591cc6b67e386fe0ce367e9c5fd84e1b1fee239e55606b5fa9c0b82ff95a85fe111fbef56d63fb8178ab8234b0f3cee1fe54e985c5ce1b8cb78afaf3c0e17cc3f16dfb83f8a9121518f9bd2afaf561ac078663f1087fa9e5f6d79d7fe71db71d633feb34f4a1ddcf118f75a502aff7dcd59f346eea8e919f6a3cd81fe4c7bad11b0f18f9b389faf5a559631518ebd170d3e577c27e3778c0c8cf4807666fbe63dfd547be40b8d8f981fcd9e251debc7a5bfd3fd970f4b6ea6cb0f3ae7a1379c79d0def6ad7bc896ae73b1b9550fb266a5cf5071b076ef48a3318497fdfda18b9c357dc8943e9ef5b1bc2afe84f439fdfda18efe3eecb78fd594cfc6fd9403f47eed89db85377e6beba737c5ec86f47ee12ba72d7eee65b7b2fb1d18df356dadfc1c6bd7b7093d2df949b76336e56becdb979b720658b6ec92dbb15b7ea7ecec68d5b73eb9d8d0de97bd36db98f6e5b2cad49ff7332ab4f52b2e376dd9eb4fe211bd2fb9e8cebb3accb2c32c0a6db7781f4baef42c8beebe7ba8bc4eeb1cc65512c0d6bf6021bb72e76898c3b95fe16e4db9cacd4becb9e7c6ebb5c4a75fd1624166a996d2163bb79a18d52685dfa08c9c96865e5895c46fce433971a819b222f9f3955549346f7f5f33630df496aa5fd9cf4f3209f0734a2c331fa227bd4d721cc6ec10574841ebe6fe356b4a4eb43c774e20ee994cee82b9dd3c5139dcbaf67526a3aa64bf7402c6b78891ebe6fa3141d637d8ec5c2155d4b5f37744b774f742bbf7e9552d3bd58913594b98cd0c3f76d8c44fbb63e92d7127aa0499aa2699a79a269f975524a5b95ccbb5fbd7df1e6fbefdba04b99f59c3b84029aa5399aa705e973919668b9d392d00cadd02aadd13a6dd026cdcabea38dcc678bb69eb1712ffa28b557685b2c7c1a6c2cd10eed76da119aa13db1f299f6c5caa6d49ba56d8976b1213bbff0cc5a8928704b144acb88624a28a58c722aa864c7e2b4eca814ca75c5e4a5de7325354da15be25a6672fcbc0d6eac8dbc257866f4d5f2018ff810a587f2ed80db3136b44df3fcf9f1a73646fc858f507a24df466f62e3984ffa338e4f84feaa79c8ce4b0efa791b2fd90ff1603e7d990dc955f0abdf6d8cf5ab8c523ee3af7cde8de8c2ad0f169ecfbb44a77cc9577ccd3712012b120963e2836ff98eeff98127bb55bab4de5f98dbe517b132c5d37c2d91bc2a56c6c439cff02ccff124cf77abb4f023365047577ec15df2222ff132af3ccd57bcca6bbcce1bac2f5f8dd45b787cdff8817bc97023e3cda77997b7f823eb4938d4f9c9bbcfef363e3d3d3f788777794f6efcffa18d71d69eeaf5ee893faabfdec6ab69bc0dbc7ff067de7f95b7c3f1ef1f788fa223b9535db9377a8fe280438e38e6c48d38e54cbe871cd87b1d37b84b8ce49e7b80d1ac0ddf1f973eae33f67d90732eb8f4ce935bf3ec3d97c27957774dee43aa44eef1adfc25c3f7c7a58feb8cb5e12bce7ded1b2fe3f40762a516aebaba07729b55ddc93b482b7f77c3f7c7a58feb3cb1e147725b997a0bd1961ffd17ff2fe36d6dfcebefeffe0dd22dc353</data>
|
||||
</image>
|
||||
</images>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>autoPortCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>portInputFrame</receiver>
|
||||
<slot>setDisabled(bool)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>allowUninvitedCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>confirmConnectionsCB</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>allowUninvitedCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>allowDesktopControlCB</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>allowUninvitedCB</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>Frame4</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
</connection>
|
||||
</connections>
|
||||
<tabstops>
|
||||
<tabstop>autoPortCB</tabstop>
|
||||
<tabstop>TabWidget2</tabstop>
|
||||
<tabstop>manageInvitations</tabstop>
|
||||
<tabstop>allowUninvitedCB</tabstop>
|
||||
<tabstop>confirmConnectionsCB</tabstop>
|
||||
<tabstop>allowDesktopControlCB</tabstop>
|
||||
<tabstop>passwordInput</tabstop>
|
||||
<tabstop>portInput</tabstop>
|
||||
</tabstops>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KIntNumInput</class>
|
||||
<header location="global">knuminput.h</header>
|
||||
<container>0</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<includehints>
|
||||
<includehint>knuminput.h</includehint>
|
||||
<includehint>knuminput.h</includehint>
|
||||
</includehints>
|
||||
</UI>
|
||||
180
kcm_krfb/kcm_krfb.cpp
Normal file
180
kcm_krfb/kcm_krfb.cpp
Normal file
@@ -0,0 +1,180 @@
|
||||
|
||||
/***************************************************************************
|
||||
kcm_krfb.cpp
|
||||
--------------
|
||||
begin : Sat Mar 02 2002
|
||||
copyright : (C) 2002 by Tim Jansen
|
||||
email : tim@tjansen.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "kcm_krfb.h"
|
||||
#include "kcm_krfb.moc"
|
||||
|
||||
#include <qlayout.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qbuttongroup.h>
|
||||
#include <qdatastream.h>
|
||||
#include <kdialog.h>
|
||||
#include <knuminput.h>
|
||||
#include <klocale.h>
|
||||
#include <kaboutdata.h>
|
||||
#include <kconfig.h>
|
||||
#include <kgenericfactory.h>
|
||||
#include <kdebug.h>
|
||||
#include <QDBusInterface>
|
||||
#include <QDBusReply>
|
||||
#define VERSION "0.7"
|
||||
|
||||
|
||||
typedef KGenericFactory<KcmKRfb, QWidget> KcmKRfbFactory;
|
||||
K_EXPORT_COMPONENT_FACTORY(krfb, KcmKRfbFactory("kcm_krfb"))
|
||||
|
||||
|
||||
|
||||
KcmKRfb::KcmKRfb(QWidget *p, const QStringList &) :
|
||||
KCModule(KcmKRfbFactory::componentData(), p),
|
||||
m_configuration(KRFB_CONFIGURATION_MODE)
|
||||
{
|
||||
|
||||
KGlobal::locale()->insertCatalog("krfb");
|
||||
m_confWidget = new ConfigurationWidget(this);
|
||||
|
||||
QVBoxLayout *l = new QVBoxLayout(this);
|
||||
l->setSpacing(KDialog::spacingHint());
|
||||
l->setMargin(0);
|
||||
l->add(m_confWidget);
|
||||
|
||||
setButtons(Default | Apply | Default);
|
||||
|
||||
KAboutData *about = new KAboutData("kcm_krfb", 0, ki18n("Desktop Sharing Control Module"),
|
||||
VERSION,
|
||||
ki18n("Configure desktop sharing"), KAboutData::License_GPL,
|
||||
ki18n("(c) 2002, Tim Jansen\n"),
|
||||
KLocalizedString(), "http://www.tjansen.de/krfb", "tim@tjansen.de");
|
||||
about->addAuthor(ki18n("Tim Jansen"), KLocalizedString(), "tim@tjansen.de");
|
||||
setAboutData(about);
|
||||
|
||||
load();
|
||||
|
||||
connect(m_confWidget->passwordInput, SIGNAL(textChanged(QString)), SLOT(configChanged()));
|
||||
connect(m_confWidget->allowUninvitedCB, SIGNAL(clicked()), SLOT(configChanged()));
|
||||
connect(m_confWidget->enableSLPCB, SIGNAL(clicked()), SLOT(configChanged()));
|
||||
connect(m_confWidget->confirmConnectionsCB, SIGNAL(clicked()), SLOT(configChanged()));
|
||||
connect(m_confWidget->allowDesktopControlCB, SIGNAL(clicked()), SLOT(configChanged()));
|
||||
connect(m_confWidget->autoPortCB, SIGNAL(clicked()), SLOT(configChanged()));
|
||||
connect(m_confWidget->portInput, SIGNAL(valueChanged(int)), SLOT(configChanged()));
|
||||
connect((QObject *)m_confWidget->manageInvitations, SIGNAL(clicked()),
|
||||
&m_configuration, SLOT(showManageInvitationsDialog()));
|
||||
connect(&m_configuration, SIGNAL(invitationNumChanged(int)),
|
||||
this, SLOT(setInvitationNum(int)));
|
||||
setInvitationNum(m_configuration.invitations().size());
|
||||
connect(m_confWidget->disableBackgroundCB, SIGNAL(clicked()), SLOT(configChanged()));
|
||||
}
|
||||
|
||||
void KcmKRfb::configChanged()
|
||||
{
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
void KcmKRfb::setInvitationNum(int num)
|
||||
{
|
||||
if (num == 0) {
|
||||
m_confWidget->invitationNumLabel->setText(i18n("You have no open invitation."));
|
||||
} else {
|
||||
m_confWidget->invitationNumLabel->setText(i18n("Open invitations: %1", num));
|
||||
}
|
||||
}
|
||||
|
||||
void KcmKRfb::checkKInetd(bool &kinetdAvailable, bool &krfbAvailable)
|
||||
{
|
||||
kinetdAvailable = false;
|
||||
krfbAvailable = false;
|
||||
//TODO verify it when kinetd will port
|
||||
QDBusInterface kinetd("org.kde.kded", "/modules/kinetd", "org.kde.kinetd");
|
||||
QDBusReply<bool> reply = kinetd.call("isInstalled", "krfb");
|
||||
|
||||
if (!reply.isValid()) {
|
||||
return;
|
||||
}
|
||||
|
||||
krfbAvailable = reply;
|
||||
kinetdAvailable = true;
|
||||
}
|
||||
|
||||
void KcmKRfb::load()
|
||||
{
|
||||
bool kinetdAvailable, krfbAvailable;
|
||||
checkKInetd(kinetdAvailable, krfbAvailable);
|
||||
|
||||
m_confWidget->allowUninvitedCB->setChecked(m_configuration.allowUninvitedConnections());
|
||||
m_confWidget->enableSLPCB->setChecked(m_configuration.enableSLP());
|
||||
m_confWidget->confirmConnectionsCB->setChecked(m_configuration.askOnConnect());
|
||||
m_confWidget->allowDesktopControlCB->setChecked(m_configuration.allowDesktopControl());
|
||||
m_confWidget->passwordInput->setText(m_configuration.password());
|
||||
m_confWidget->autoPortCB->setChecked(m_configuration.preferredPort() < 0);
|
||||
m_confWidget->portInput->setValue(m_configuration.preferredPort() > 0 ?
|
||||
m_configuration.preferredPort() : 5900);
|
||||
m_confWidget->disableBackgroundCB->setChecked(m_configuration.disableBackground());
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void KcmKRfb::save()
|
||||
{
|
||||
|
||||
m_configuration.update();
|
||||
bool allowUninvited = m_confWidget->allowUninvitedCB->isChecked();
|
||||
m_configuration.setAllowUninvited(allowUninvited);
|
||||
m_configuration.setEnableSLP(m_confWidget->enableSLPCB->isChecked());
|
||||
m_configuration.setAskOnConnect(m_confWidget->confirmConnectionsCB->isChecked());
|
||||
m_configuration.setAllowDesktopControl(m_confWidget->allowDesktopControlCB->isChecked());
|
||||
m_configuration.setPassword(m_confWidget->passwordInput->text());
|
||||
|
||||
if (m_confWidget->autoPortCB->isChecked()) {
|
||||
m_configuration.setPreferredPort(-1);
|
||||
} else {
|
||||
m_configuration.setPreferredPort(m_confWidget->portInput->value());
|
||||
}
|
||||
|
||||
m_configuration.setDisableBackground(m_confWidget->disableBackgroundCB->isChecked());
|
||||
m_configuration.save();
|
||||
#if 0
|
||||
kapp->dcopClient()->emitDCOPSignal("KRFB::ConfigChanged", "KRFB_ConfigChanged()", QByteArray());
|
||||
#endif
|
||||
emit changed(false);
|
||||
}
|
||||
|
||||
void KcmKRfb::defaults()
|
||||
{
|
||||
bool kinetdAvailable, krfbAvailable;
|
||||
checkKInetd(kinetdAvailable, krfbAvailable);
|
||||
|
||||
m_confWidget->allowUninvitedCB->setChecked(false);
|
||||
m_confWidget->enableSLPCB->setChecked(true);
|
||||
m_confWidget->confirmConnectionsCB->setChecked(false);
|
||||
m_confWidget->allowDesktopControlCB->setChecked(false);
|
||||
m_confWidget->passwordInput->setText("");
|
||||
m_confWidget->autoPortCB->setChecked(true);
|
||||
m_confWidget->portInput->setValue(5900);
|
||||
m_confWidget->disableBackgroundCB->setChecked(false);
|
||||
emit changed(true);
|
||||
}
|
||||
|
||||
QString KcmKRfb::quickHelp() const
|
||||
{
|
||||
return i18n("<h1>Desktop Sharing</h1> This module allows you to configure"
|
||||
" the KDE desktop sharing.");
|
||||
}
|
||||
|
||||
|
||||
50
kcm_krfb/kcm_krfb.h
Normal file
50
kcm_krfb/kcm_krfb.h
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
/***************************************************************************
|
||||
kcm_krfb.h
|
||||
------------
|
||||
begin : Sat Mar 02 2002
|
||||
copyright : (C) 2002 by Tim Jansen
|
||||
email : tim@tjansen.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _KCM_KRFB_H_
|
||||
#define _KCM_KRFB_H_
|
||||
|
||||
#include <qobject.h>
|
||||
#include <qdatetime.h>
|
||||
#define KDE3_SUPPORT
|
||||
#include <kcmodule.h>
|
||||
#undef KDE3_SUPPORT
|
||||
#include "configurationwidget.h"
|
||||
#include "../krfb/configuration.h"
|
||||
|
||||
class KcmKRfb : public KCModule
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
Configuration m_configuration;
|
||||
ConfigurationWidget *m_confWidget;
|
||||
void checkKInetd(bool &, bool &);
|
||||
public:
|
||||
KcmKRfb(QWidget *p, const QStringList &);
|
||||
|
||||
void load();
|
||||
void save();
|
||||
void defaults();
|
||||
QString quickHelp() const;
|
||||
private slots:
|
||||
void setInvitationNum(int num);
|
||||
void configChanged();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
196
kcm_krfb/kcmkrfb.desktop
Normal file
196
kcm_krfb/kcmkrfb.desktop
Normal file
@@ -0,0 +1,196 @@
|
||||
[Desktop Entry]
|
||||
Icon=krfb
|
||||
Exec=kcmshell4 kcmkrfb
|
||||
Type=Service
|
||||
X-DocPath=krfb/krfb-configuration.html
|
||||
X-KDE-ServiceTypes=KCModule
|
||||
|
||||
|
||||
X-KDE-Library=kcm_krfb
|
||||
X-KDE-Factoryname=krfb
|
||||
X-KDE-ParentApp=kcontrol
|
||||
|
||||
Name=Desktop Sharing
|
||||
Name[af]=Werkskerm Deeling
|
||||
Name[ar]=مشاركة سطح المكتب
|
||||
Name[ast]=Escritoriu compartiu
|
||||
Name[bg]=Споделяне на работния плот
|
||||
Name[bn]=ডেস্কটপ ভাগাভাগি
|
||||
Name[br]=Rannañ ar vurev
|
||||
Name[bs]=Dijeljenje radne površine
|
||||
Name[ca]=Compartició de l'escriptori
|
||||
Name[ca@valencia]=Compartició de l'escriptori
|
||||
Name[cs]=Sdílení pracovní plochy
|
||||
Name[cy]=Rhannu Penbwrdd
|
||||
Name[da]=Desktopdeling
|
||||
Name[de]=Arbeitsflächen-Freigabe
|
||||
Name[el]=Κοινή χρήση επιφάνειας εργασίας
|
||||
Name[en_GB]=Desktop Sharing
|
||||
Name[eo]=Tabula komunigado
|
||||
Name[es]=Escritorio compartido
|
||||
Name[et]=Töölaua jagamine
|
||||
Name[eu]=Mahaigaina partekatzea
|
||||
Name[fa]=اشتراک رومیزی
|
||||
Name[fi]=Työpöydän jakaminen
|
||||
Name[fr]=Partage de bureau
|
||||
Name[ga]=Roinnt Deisce
|
||||
Name[gl]=Compartimento do escritorio
|
||||
Name[he]=שיתוף שולחנות עבודה
|
||||
Name[hi]=डेस्कटॉप साझेदारी
|
||||
Name[hne]=डेस्कटाप साझेदारी
|
||||
Name[hr]=Dijeljenje radne površine
|
||||
Name[hu]=Munkaasztal-megosztás
|
||||
Name[ia]=Compartir de scriptorio
|
||||
Name[is]=Skjáborðamiðlun
|
||||
Name[it]=Condivisione del desktop
|
||||
Name[ja]=デスクトップ共有
|
||||
Name[kk]=Үстелді ортақтастыру
|
||||
Name[km]=ការចែករំលែកផ្ទៃតុ
|
||||
Name[ko]=데스크톱 공유
|
||||
Name[lt]=Dalinimasis darbastaliu
|
||||
Name[lv]=Darbvirsmas koplietošana
|
||||
Name[mk]=Делење на работната површина
|
||||
Name[ml]=പണിയിടം പങ്കുവെക്കല്
|
||||
Name[ms]=Perkongsian Ruang Kerja
|
||||
Name[nb]=Delte skrivebord
|
||||
Name[nds]=Schriefdisch-Freegaav
|
||||
Name[ne]=डेस्कटप साझेदारी
|
||||
Name[nl]=Bureaublad delen
|
||||
Name[nn]=Skrivebordsdeling
|
||||
Name[pa]=ਡੈਸਕਟਾਪ ਸ਼ੇਅਰਿੰਗ
|
||||
Name[pl]=Współdzielenie pulpitu
|
||||
Name[pt]=Partilha do Ecrã
|
||||
Name[pt_BR]=Compartilhamento do área de trabalho
|
||||
Name[ro]=Partajare birou
|
||||
Name[ru]=Общий рабочий стол
|
||||
Name[se]=Čállinbeavdejuohkkin
|
||||
Name[si]=වැඩතල හවුල්
|
||||
Name[sk]=Zdieľanie pracovnej plochy
|
||||
Name[sl]=Deljenje namizja
|
||||
Name[sr]=Дељење површи
|
||||
Name[sr@ijekavian]=Дијељење површи
|
||||
Name[sr@ijekavianlatin]=Dijeljenje površi
|
||||
Name[sr@latin]=Deljenje površi
|
||||
Name[sv]=Dela ut skrivbordet
|
||||
Name[ta]=பணிமேடை பகிர்வு
|
||||
Name[tg]=Истифодабарии муштараки Мизи корӣ
|
||||
Name[th]=ใช้งานพื้นที่ทำงานร่วมกัน
|
||||
Name[tr]=Masaüstü Paylaşımı
|
||||
Name[ug]=ئۈستەلئۈستىنى ھەمبەھىرلەش
|
||||
Name[uk]=Спільні стільниці
|
||||
Name[vi]=Chia sẻ màn hình nền
|
||||
Name[xh]=Ukwehlulelana kwe Desktop
|
||||
Name[x-test]=xxDesktop Sharingxx
|
||||
Name[zh_CN]=桌面共享
|
||||
Name[zh_HK]=桌面分享
|
||||
Name[zh_TW]=桌面分享
|
||||
|
||||
Comment=Configure Desktop Sharing
|
||||
Comment[af]=Konfigureer Werkskerm Deeling
|
||||
Comment[ar]=تعديل مشاركة سطح المكتب
|
||||
Comment[ast]=Configura'l to escritoriu compartíu
|
||||
Comment[bg]=Настройки на споделянето на работния плот
|
||||
Comment[bn]=ডেস্কটপ ভাগাভাগি কনফিগার করুন
|
||||
Comment[br]=Kefluniañ rannañ ar vurev
|
||||
Comment[bs]=Podešavanje dijeljenja površine
|
||||
Comment[ca]=Lupa de l'escriptori
|
||||
Comment[ca@valencia]=Lupa de l'escriptori
|
||||
Comment[cs]=Nastavit sdílení pracovní plochy
|
||||
Comment[cy]=Ffurfweddu Rhannu Penbwrdd
|
||||
Comment[da]=Indstil desktopdeling
|
||||
Comment[de]=Freigabe der Arbeitsfläche einrichten
|
||||
Comment[el]=Ρύθμιση της κοινής χρήσης της επιφάνειας εργασίας
|
||||
Comment[en_GB]=Configure Desktop Sharing
|
||||
Comment[eo]=Agordi la tabulan komunigadon
|
||||
Comment[es]=Configure su escritorio compartido
|
||||
Comment[et]=Töölaua jagamise seadistamine
|
||||
Comment[eu]=Konfiguratu mahaigaina partekatzea
|
||||
Comment[fa]=پیکربندی اشتراک رومیزی
|
||||
Comment[fi]=Aseta työpöydän jakaminen
|
||||
Comment[fr]=Configuration du partage du bureau
|
||||
Comment[ga]=Cumraigh Roinnt Deisce
|
||||
Comment[gl]=Configurar o compartimento do escritorio
|
||||
Comment[he]=שינוי הגדרות שיתוף שולחנות העבודה
|
||||
Comment[hi]=डेस्कटॉप साझेदारी कॉन्फ़िगर करें
|
||||
Comment[hne]=डेस्कटाप साझेदारी कान्फिगर करव
|
||||
Comment[hr]=Podešavanje dijeljenja radne površine
|
||||
Comment[hu]=A munkaasztal-megosztás beállításai
|
||||
Comment[ia]=Configura le compartir de scriptorio
|
||||
Comment[is]=Stilla skjáborðsmiðlun
|
||||
Comment[it]=Configura condivisione del desktop
|
||||
Comment[ja]=デスクトップ共有の設定
|
||||
Comment[kk]=Үстелді ортақтастыруды баптау
|
||||
Comment[km]=កំណត់រចនាសម្ព័ន្ធការចែករំលែកផ្ទៃតុ
|
||||
Comment[ko]=데스크톱 공유 설정
|
||||
Comment[lt]=Konfigūruoti dalinimąsi darbastaliu
|
||||
Comment[lv]=Konfigurē darbvirsmas koplietošanu
|
||||
Comment[mk]=Конфигурирајте делење на површината
|
||||
Comment[ml]=പണിയിടം പങ്കുവെക്കല് ക്രമീകരിക്കാം
|
||||
Comment[ms]= Selaraskan Perkongsian Desktop
|
||||
Comment[nb]=Tilpass delte skrivebord
|
||||
Comment[nds]=Schriefdisch-Freegaav instellen
|
||||
Comment[ne]=डेस्कटप साझेदारी कन्फिगर गर्नुहोस्
|
||||
Comment[nl]=Bureaublad delen instellen
|
||||
Comment[nn]=Set opp skrivebordsdeling
|
||||
Comment[pa]=ਡੈਸਕਟਾਪ ਸ਼ੇਅਰਿੰਗ ਸੰਰਚਨਾ
|
||||
Comment[pl]=Konfiguracja współdzielenia pulpitu
|
||||
Comment[pt]=Configurar a Partilha do Ecrã
|
||||
Comment[pt_BR]=Configura o compartilhamento da área de trabalho
|
||||
Comment[ro]=Configurează partajarea biroului
|
||||
Comment[ru]=Параметры общего рабочего стола
|
||||
Comment[se]=Heivet čállinbeavdejuohkkima
|
||||
Comment[si]=වැඩතල හවුල් සකසන්න
|
||||
Comment[sk]=Nastavenie zdieľania pracovnej plochy
|
||||
Comment[sl]=Nastavi deljenje namizja
|
||||
Comment[sr]=Подешавање дељења површи
|
||||
Comment[sr@ijekavian]=Подешавање дијељења површи
|
||||
Comment[sr@ijekavianlatin]=Podešavanje dijeljenja površi
|
||||
Comment[sr@latin]=Podešavanje deljenja površi
|
||||
Comment[sv]=Anpassa utdelning av skrivbord
|
||||
Comment[ta]=பணிமேடை பகிர்வை உள்ளமை
|
||||
Comment[tg]=Батанзимдарории Истифодабарии муштараки Мизи корӣ
|
||||
Comment[th]=ปรับแต่งการแบ่งการใช้งานพื้นที่ทำงานร่วมกัน
|
||||
Comment[tr]=Masaüstü Paylaşımını Yapılandır
|
||||
Comment[uk]=Налаштувати спільні стільниці
|
||||
Comment[vi]=Cấu hình chia sẻ màn hình nền
|
||||
Comment[xh]=Qwalasela Ukusebenzisa ngokuhlangeneyo kwe Desktop
|
||||
Comment[x-test]=xxConfigure Desktop Sharingxx
|
||||
Comment[zh_CN]=配置桌面共享
|
||||
Comment[zh_HK]=設定桌面分享
|
||||
Comment[zh_TW]=設定桌面分享
|
||||
X-KDE-Keywords=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited
|
||||
X-KDE-Keywords[ca]=compartició d'escriptori,krfb,vnc,compartició,krdc,connexió d'escriptori remot,invitació,port,slp,no invitat
|
||||
X-KDE-Keywords[ca@valencia]=compartició d'escriptori,krfb,vnc,compartició,krdc,connexió d'escriptori remot,invitació,port,slp,no invitat
|
||||
X-KDE-Keywords[da]=skrivebordsdeling,krfb,vnc,deling,krdc,remote desktop,fjernskrivebord,invitation,port,slp,uinviteret
|
||||
X-KDE-Keywords[de]=freigabe der arbeitsfläche,krfb,vnc,freigabe,krdc,fernwartung,einladung,port,slp
|
||||
X-KDE-Keywords[el]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited
|
||||
X-KDE-Keywords[es]=compartición de escritorio,krfb,vnc,compartición,krdc,conexión de escritorio en remoto,invitación,puerto,slp,no invitado
|
||||
X-KDE-Keywords[et]=töölaua jagamine,krfb,vnc,jagamine,rdp,krdc,kaugtöölaua ühendus,rdp,kutse,port,slp,kutsumata
|
||||
X-KDE-Keywords[fi]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,työpöydän jakaminen,jakaminen,etätyöpöytä,etäyhteys,kutsu,portti
|
||||
X-KDE-Keywords[fr]=partage de bureau, Krfb, vnc, partage, Krdc, connexion à un bureau distant, invitation, port, slp, non-invité
|
||||
X-KDE-Keywords[hu]=asztalmegosztás,krfb,vnc,megosztás,krdc,távoliasztal-kapcsolat,meghívás,port,slp,meghívatlan
|
||||
X-KDE-Keywords[ia]=compartir de scriptorio,krfb.vnc,compartir,krdc,connexion de scriptorio remote,invitation,porto,slp,non invitate
|
||||
X-KDE-Keywords[it]=condivisione desktop,krfb,vnc,condivisione,krdc,connessione desktop remoto,invito,porta,slp,non invitato
|
||||
X-KDE-Keywords[kk]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited
|
||||
X-KDE-Keywords[km]=ការចែករំលែកផ្ទៃតុ,krfb,vnc,ការចែករំលែក,krdc,ការតភ្ជាប់ផ្ទៃតុពីចម្ងាយ,ការអញ្ជើញ,ច្រក,slp,មិនត្រូវបានអញ្ជើញ
|
||||
X-KDE-Keywords[ko]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,데스크톱,공유,원격 데스크톱,포트
|
||||
X-KDE-Keywords[nb]=skrivebordsdeling,krfb,vnc,deling,krdc,tilkoblng til annet skrivebord,invitasjon,port,slp,ikke invitert
|
||||
X-KDE-Keywords[nds]=Schriefdischfreegaav,krfb,vnc,Freegaav,Verbinnen na feern Schriefdisch,Inladen,Port,Koppelsteed,slp,nich inlaadt
|
||||
X-KDE-Keywords[nl]=delen van bureaublad,krfb,vnc,delen,krdc,verbinding naar bureaublad op afstand,invitatie,poort,slp,ongenodigd
|
||||
X-KDE-Keywords[pl]=współdzielenie pulpitu,krfb,vnc,współdzielenie,krdc,podłączenie zdalnego pulpitu,zaproszenie,port,slp,niezaproszony
|
||||
X-KDE-Keywords[pt]=partilha do ecrã,krfb,vnc,partilha,krdc,ligação ecrã remoto,convite,porto,slp,sem convite
|
||||
X-KDE-Keywords[pt_BR]=compartilhamento da área de trabalho,krfb,vnc,compartilhar,krdc,conexão à área de trabalho remota,convite,porta,desconvidar
|
||||
X-KDE-Keywords[sk]=zdieľanie plochy,krfb,vnc,zdieľanie,krdc,vzdialené pripojenie plochy,pozvanie,port,slp,nepozvaný
|
||||
X-KDE-Keywords[sl]=namizje,deljenje,souporaba,krfb,vnc,krdc,povezava oddaljenega namizja, povabilo,port,slp,nepovabljen
|
||||
X-KDE-Keywords[sr]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,дељење површи,КРФБ,ВНЦ,дељење,КРДЦ,удаљена површ,позивница,порт,СЛП,непозван
|
||||
X-KDE-Keywords[sr@ijekavian]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,дељење површи,КРФБ,ВНЦ,дељење,КРДЦ,удаљена површ,позивница,порт,СЛП,непозван
|
||||
X-KDE-Keywords[sr@ijekavianlatin]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,deljenje površi,KRFB,VNC,deljenje,KRDC,udaljena površ,pozivnica,port,SLP,nepozvan
|
||||
X-KDE-Keywords[sr@latin]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,deljenje površi,KRFB,VNC,deljenje,KRDC,udaljena površ,pozivnica,port,SLP,nepozvan
|
||||
X-KDE-Keywords[sv]=dela skrivbord,krfb,vnc,dela,krdc,fjärrskrivbordsanslutning,inbjudan,port,slp,oinbjuden
|
||||
X-KDE-Keywords[tr]=masaüstü paylaşımı,krfb,vnc,paylaşım,krdc,uzak masaüstü bağlantısı,davet,port,slp,davet edilmemiş
|
||||
X-KDE-Keywords[uk]=krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,спільне використання,керування,оприлюднення,віддалене з’єднання,запрошення,порт,небажане
|
||||
X-KDE-Keywords[x-test]=xxdesktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvitedxx
|
||||
X-KDE-Keywords[zh_CN]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited,桌面共享,共享,远程桌面,远程桌面连接,邀请,端口,取消邀请
|
||||
X-KDE-Keywords[zh_TW]=desktop sharing,krfb,vnc,sharing,krdc,remote desktop connection,invitation,port,slp,uninvited
|
||||
|
||||
Categories=Qt;KDE;X-KDE-settings-network;Settings;
|
||||
20
kinetd/CMakeLists.txt
Normal file
20
kinetd/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
########### next target ###############
|
||||
|
||||
set(kded_kinetd_PART_SRCS kinetd.cpp)
|
||||
|
||||
message(STATUS "Port to krfb DBUS")
|
||||
# kde4_add_dcop_skels(kded_kinetd_PART_SRCS kinetd.h )
|
||||
|
||||
kde4_add_plugin(kded_kinetd ${kded_kinetd_PART_SRCS})
|
||||
|
||||
|
||||
target_link_libraries(kded_kinetd ${KDE4_KIO_LIBS} ${KDE4_KDNSSD_LIBS})
|
||||
|
||||
install(TARGETS kded_kinetd DESTINATION ${PLUGIN_INSTALL_DIR})
|
||||
|
||||
|
||||
########### install files ###############
|
||||
|
||||
install(FILES kinetd.notifyrc DESTINATION ${DATA_INSTALL_DIR}/krfb)
|
||||
install(FILES kinetdmodule.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
|
||||
install(FILES kinetd.desktop DESTINATION ${SERVICES_INSTALL_DIR}/kded)
|
||||
2
kinetd/Messages.sh
Normal file
2
kinetd/Messages.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#! /bin/sh
|
||||
$XGETTEXT *.cpp -o $podir/kinetd.pot
|
||||
13
kinetd/README.debugging
Normal file
13
kinetd/README.debugging
Normal file
@@ -0,0 +1,13 @@
|
||||
Recommended practice to debug a kinetd program
|
||||
==============================================
|
||||
|
||||
Instead of executing your program directly, start a wrapper script that
|
||||
looks like this:
|
||||
|
||||
#!/bin/sh
|
||||
exec xterm -e gdb --args /opt/kde/bin/krfb $1 $2
|
||||
|
||||
Note that you cannot use konsole because it closes the file descriptor. You need
|
||||
a very recent gdb version for the "--args" option (>= 5.2, only available as
|
||||
CVS snapshot at this time).
|
||||
|
||||
781
kinetd/kinetd.cpp
Normal file
781
kinetd/kinetd.cpp
Normal file
@@ -0,0 +1,781 @@
|
||||
|
||||
/***************************************************************************
|
||||
kinetd.cpp
|
||||
--------------
|
||||
begin : Mon Feb 11 2002
|
||||
copyright : (C) 2002 by Tim Jansen
|
||||
email : tim@tjansen.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "kinetd.h"
|
||||
#include "kinetd.moc"
|
||||
#include "kinetinterface.h"
|
||||
#include "kuser.h"
|
||||
#include "uuid.h"
|
||||
#include <qregexp.h>
|
||||
#include <kservicetype.h>
|
||||
#include <kdebug.h>
|
||||
#include <kstandarddirs.h>
|
||||
#include <kconfig.h>
|
||||
#include <KNotification>
|
||||
#include <ksocketaddress.h>
|
||||
#include <ksocketdevice.h>
|
||||
#include <klocale.h>
|
||||
#include <kglobal.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <kpluginfactory.h>
|
||||
#include <kpluginloader.h>
|
||||
|
||||
K_PLUGIN_FACTORY(KInetDFactory,
|
||||
registerPlugin<KInetD>();
|
||||
)
|
||||
K_EXPORT_PLUGIN(KInetDFactory("kinetd"))
|
||||
|
||||
PortListener::PortListener(KService::Ptr s,
|
||||
KConfig *config,
|
||||
KServiceRegistry *srvreg) :
|
||||
m_port(-1),
|
||||
m_serviceRegistered(false),
|
||||
m_socket(0),
|
||||
m_config(config),
|
||||
m_srvreg(srvreg),
|
||||
m_dnssdreg(0)
|
||||
{
|
||||
m_uuid = createUUID();
|
||||
loadConfig(s);
|
||||
|
||||
if (m_valid && m_enabled) {
|
||||
acquirePort();
|
||||
}
|
||||
}
|
||||
|
||||
bool PortListener::acquirePort()
|
||||
{
|
||||
if (m_socket) {
|
||||
if ((m_port >= m_portBase) &&
|
||||
(m_port < (m_portBase + m_autoPortRange))) {
|
||||
return true;
|
||||
} else {
|
||||
delete m_socket;
|
||||
}
|
||||
}
|
||||
|
||||
m_port = m_portBase;
|
||||
m_socket = new KNetwork::KServerSocket(m_port, false);
|
||||
|
||||
while (!m_socket->bindAndListen()) {
|
||||
m_port++;
|
||||
|
||||
if (m_port >= (m_portBase + m_autoPortRange)) {
|
||||
kDebug() << "Kinetd cannot load service " << m_serviceName
|
||||
<< ": unable to get port" << endl;
|
||||
m_port = -1;
|
||||
delete m_socket;
|
||||
m_socket = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
delete m_socket;
|
||||
m_socket = new KNetwork::KServerSocket(m_port, false);
|
||||
}
|
||||
|
||||
connect(m_socket, SIGNAL(accepted(KSocket*)),
|
||||
SLOT(accepted(KSocket*)));
|
||||
|
||||
bool s = m_registerService;
|
||||
bool sd = m_dnssdRegister;
|
||||
setServiceRegistrationEnabledInternal(false);
|
||||
dnssdRegister(false);
|
||||
setServiceRegistrationEnabledInternal(s);
|
||||
dnssdRegister(sd);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PortListener::freePort()
|
||||
{
|
||||
m_port = -1;
|
||||
delete m_socket;
|
||||
m_socket = 0;
|
||||
setServiceRegistrationEnabledInternal(m_registerService);
|
||||
dnssdRegister(false);
|
||||
}
|
||||
|
||||
void PortListener::loadConfig(KService::Ptr s)
|
||||
{
|
||||
m_valid = true;
|
||||
m_autoPortRange = 0;
|
||||
m_enabled = true;
|
||||
m_argument.clear();
|
||||
m_multiInstance = false;
|
||||
|
||||
QVariant vid, vport, vautoport, venabled, vargument, vmultiInstance, vurl,
|
||||
vsattributes, vslifetime, vdname, vdtype, vddata;
|
||||
|
||||
m_execPath = s->exec().utf8();
|
||||
vid = s->property("X-KDE-KINETD-id");
|
||||
vport = s->property("X-KDE-KINETD-port");
|
||||
vautoport = s->property("X-KDE-KINETD-autoPortRange");
|
||||
venabled = s->property("X-KDE-KINETD-enabled");
|
||||
vargument = s->property("X-KDE-KINETD-argument");
|
||||
vmultiInstance = s->property("X-KDE-KINETD-multiInstance");
|
||||
vurl = s->property("X-KDE-KINETD-serviceURL");
|
||||
vsattributes = s->property("X-KDE-KINETD-serviceAttributes");
|
||||
vslifetime = s->property("X-KDE-KINETD-serviceLifetime");
|
||||
vdname = s->property("X-KDE-KINETD-DNSSD-Name");
|
||||
vdtype = s->property("X-KDE-KINETD-DNSSD-Type");
|
||||
vddata = s->property("X-KDE-KINETD-DNSSD-Properties");
|
||||
|
||||
if (!vid.isValid()) {
|
||||
kDebug() << "Kinetd cannot load service " << m_serviceName
|
||||
<< ": no id set" << endl;
|
||||
m_valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!vport.isValid()) {
|
||||
kDebug() << "Kinetd cannot load service " << m_serviceName
|
||||
<< ": invalid port" << endl;
|
||||
m_valid = false;
|
||||
return;
|
||||
}
|
||||
|
||||
m_serviceName = vid.toString();
|
||||
m_serviceLifetime = vslifetime.toInt();
|
||||
|
||||
if (m_serviceLifetime < 120) { // never less than 120 s
|
||||
m_serviceLifetime = 120;
|
||||
}
|
||||
|
||||
m_portBase = vport.toInt();
|
||||
|
||||
if (vautoport.isValid()) {
|
||||
m_autoPortRange = vautoport.toInt();
|
||||
}
|
||||
|
||||
if (venabled.isValid()) {
|
||||
m_enabled = venabled.toBool();
|
||||
}
|
||||
|
||||
if (vargument.isValid()) {
|
||||
m_argument = vargument.toString();
|
||||
}
|
||||
|
||||
if (vmultiInstance.isValid()) {
|
||||
m_multiInstance = vmultiInstance.toBool();
|
||||
}
|
||||
|
||||
if (vurl.isValid()) {
|
||||
m_serviceURL = vurl.toString();
|
||||
m_registerService = true;
|
||||
} else {
|
||||
m_serviceURL.clear();
|
||||
m_registerService = false;
|
||||
}
|
||||
|
||||
if (vsattributes.isValid()) {
|
||||
m_serviceAttributes = vsattributes.toString();
|
||||
} else {
|
||||
m_serviceAttributes = "";
|
||||
}
|
||||
|
||||
if (vddata.isValid()) {
|
||||
QStringList attrs = vddata.toStringList();
|
||||
|
||||
for (QStringList::iterator it = attrs.begin();
|
||||
it != attrs.end(); it++) {
|
||||
QString key = (*it).section('=', 0, 0);
|
||||
QString value = processServiceTemplate((*it).section('=', 1))[0];
|
||||
|
||||
if (!key.isEmpty()) {
|
||||
m_dnssdData[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (vdname.isValid() && vdtype.isValid()) {
|
||||
m_dnssdName = processServiceTemplate(vdname.toString())[0];
|
||||
m_dnssdType = vdtype.toString();
|
||||
m_dnssdRegister = true;
|
||||
kDebug() << "DNS-SD register is enabled\n";
|
||||
} else {
|
||||
m_dnssdRegister = false;
|
||||
}
|
||||
|
||||
|
||||
m_slpLifetimeEnd = QDateTime::currentDateTime().addSecs(m_serviceLifetime);
|
||||
m_defaultPortBase = m_portBase;
|
||||
m_defaultAutoPortRange = m_autoPortRange;
|
||||
|
||||
m_config->setGroup("ListenerConfig");
|
||||
m_enabled = m_config->readEntry("enabled_" + m_serviceName,
|
||||
m_enabled);
|
||||
m_portBase = m_config->readEntry("port_base_" + m_serviceName,
|
||||
m_portBase);
|
||||
m_autoPortRange = m_config->readEntry("auto_port_range_" + m_serviceName,
|
||||
m_autoPortRange);
|
||||
QDateTime nullTime;
|
||||
m_expirationTime = m_config->readDateTimeEntry("enabled_expiration_" + m_serviceName,
|
||||
&nullTime);
|
||||
|
||||
if ((!m_expirationTime.isNull()) && (m_expirationTime < QDateTime::currentDateTime())) {
|
||||
m_enabled = false;
|
||||
}
|
||||
|
||||
m_registerService = m_config->readEntry("enabled_srvreg_" + m_serviceName,
|
||||
m_registerService);
|
||||
}
|
||||
|
||||
void PortListener::accepted(KSocket *sock)
|
||||
{
|
||||
QString host, port;
|
||||
KSocketDevice device(sock->socket());
|
||||
KSocketAddress ksa = device->peerAddress();
|
||||
|
||||
if (ksa.address()) {
|
||||
delete sock;
|
||||
return;
|
||||
}
|
||||
|
||||
KExtendedSocket::resolve(ksa, host, port);
|
||||
KNotification::event("IncomingConnection",
|
||||
i18n("Connection from %1", host));
|
||||
delete ksa;
|
||||
|
||||
if ((!m_enabled) ||
|
||||
((!m_multiInstance) && m_process.isRunning())) {
|
||||
delete sock;
|
||||
return;
|
||||
}
|
||||
|
||||
// disable CLOEXEC flag, fixes #77412
|
||||
fcntl(sock->socket(), F_SETFD, fcntl(sock->socket(), F_GETFD) & ~FD_CLOEXEC);
|
||||
|
||||
m_process.clearArguments();
|
||||
m_process << m_execPath << m_argument << QString::number(sock->socket());
|
||||
|
||||
if (!m_process.start(K3Process::DontCare)) {
|
||||
KNotification::event("ProcessFailed",
|
||||
i18n("Call \"%1 %2 %3\" failed", m_execPath,
|
||||
m_argument,
|
||||
sock->socket()));
|
||||
}
|
||||
|
||||
delete sock;
|
||||
}
|
||||
|
||||
bool PortListener::isValid()
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
bool PortListener::isEnabled()
|
||||
{
|
||||
return m_enabled && m_valid;
|
||||
}
|
||||
|
||||
int PortListener::port()
|
||||
{
|
||||
return m_port;
|
||||
}
|
||||
|
||||
QStringList PortListener::processServiceTemplate(const QString &a)
|
||||
{
|
||||
QStringList l;
|
||||
QValueVector<KInetInterface> v = KInetInterface::getAllInterfaces(false);
|
||||
QValueVector<KInetInterface>::Iterator it = v.begin();
|
||||
|
||||
while (it != v.end()) {
|
||||
KInetSocketAddress *address = (*(it++)).address();
|
||||
|
||||
if (!address) {
|
||||
continue;
|
||||
}
|
||||
|
||||
QString hostName = address->nodeName();
|
||||
KUser u;
|
||||
QString x = a; // replace does not work in const QString. Why??
|
||||
l.append(x.replace(QString("%h"), KServiceRegistry::encodeAttributeValue(hostName))
|
||||
.replace(QString("%p"), QString::number(m_port))
|
||||
.replace(QString("%u"), KServiceRegistry::encodeAttributeValue(u.loginName()))
|
||||
.replace(QString("%i"), KServiceRegistry::encodeAttributeValue(m_uuid))
|
||||
.replace(QString("%f"), KServiceRegistry::encodeAttributeValue(u.fullName())));
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
bool PortListener::setPort(int port, int autoPortRange)
|
||||
{
|
||||
if ((port == m_portBase) && (autoPortRange == m_autoPortRange)) {
|
||||
return (m_port != -1);
|
||||
}
|
||||
|
||||
m_config->setGroup("ListenerConfig");
|
||||
|
||||
if (port > 0) {
|
||||
m_portBase = port;
|
||||
m_autoPortRange = autoPortRange;
|
||||
|
||||
m_config->writeEntry("port_base_" + m_serviceName, m_portBase);
|
||||
m_config->writeEntry("auto_port_range_" + m_serviceName, m_autoPortRange);
|
||||
} else {
|
||||
m_portBase = m_defaultPortBase;
|
||||
m_autoPortRange = m_defaultAutoPortRange;
|
||||
|
||||
m_config->deleteEntry("port_base_" + m_serviceName);
|
||||
m_config->deleteEntry("auto_port_range_" + m_serviceName);
|
||||
}
|
||||
|
||||
m_config->sync();
|
||||
|
||||
if (m_enabled) {
|
||||
return acquirePort();
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void PortListener::setEnabled(bool e)
|
||||
{
|
||||
setEnabledInternal(e, QDateTime());
|
||||
}
|
||||
|
||||
void PortListener::setEnabledInternal(bool e, const QDateTime &ex)
|
||||
{
|
||||
m_config->setGroup("ListenerConfig");
|
||||
m_config->writeEntry("enabled_" + m_serviceName, e);
|
||||
m_config->writeEntry("enabled_expiration_" + m_serviceName, ex);
|
||||
m_config->sync();
|
||||
|
||||
m_expirationTime = ex;
|
||||
|
||||
if (e) {
|
||||
if (m_port < 0) {
|
||||
acquirePort();
|
||||
}
|
||||
|
||||
m_enabled = m_port >= 0;
|
||||
|
||||
} else {
|
||||
freePort();
|
||||
m_enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
void PortListener::setEnabled(const QDateTime &ex)
|
||||
{
|
||||
setEnabledInternal(true, ex);
|
||||
}
|
||||
|
||||
bool PortListener::isServiceRegistrationEnabled()
|
||||
{
|
||||
return m_registerService;
|
||||
}
|
||||
|
||||
void PortListener::setServiceRegistrationEnabled(bool e)
|
||||
{
|
||||
setServiceRegistrationEnabledInternal(e);
|
||||
dnssdRegister(e && m_enabled);
|
||||
m_config->setGroup("ListenerConfig");
|
||||
m_config->writeEntry("enable_srvreg_" + m_serviceName, e);
|
||||
m_config->sync();
|
||||
}
|
||||
|
||||
void PortListener::setServiceRegistrationEnabledInternal(bool e)
|
||||
{
|
||||
m_registerService = e;
|
||||
|
||||
if ((!m_srvreg) || m_serviceURL.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_serviceRegistered == (m_enabled && e)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_enabled && e) {
|
||||
m_registeredServiceURLs = processServiceTemplate(m_serviceURL);
|
||||
QStringList attributes = processServiceTemplate(m_serviceAttributes);
|
||||
QStringList::Iterator it = m_registeredServiceURLs.begin();
|
||||
QStringList::Iterator it2 = attributes.begin();
|
||||
|
||||
while ((it != m_registeredServiceURLs.end()) &&
|
||||
(it2 != attributes.end())) {
|
||||
if (!m_srvreg->registerService(
|
||||
*(it++),
|
||||
*(it2++),
|
||||
m_serviceLifetime)) {
|
||||
kDebug(7021) << "Failure registering SLP service (no slpd running?)";
|
||||
}
|
||||
}
|
||||
|
||||
m_serviceRegistered = true;
|
||||
// make lifetime 30s shorter, because the timeout is not precise
|
||||
m_slpLifetimeEnd = QDateTime::currentDateTime().addSecs(m_serviceLifetime - 30);
|
||||
} else {
|
||||
QStringList::Iterator it = m_registeredServiceURLs.begin();
|
||||
|
||||
while (it != m_registeredServiceURLs.end()) {
|
||||
m_srvreg->unregisterService(*(it++));
|
||||
}
|
||||
|
||||
m_serviceRegistered = false;
|
||||
}
|
||||
}
|
||||
|
||||
void PortListener::dnssdRegister(bool e)
|
||||
{
|
||||
if (m_dnssdName.isNull() || m_dnssdType.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_dnssdRegistered == e) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (e) {
|
||||
m_dnssdRegistered = true;
|
||||
m_dnssdreg = new DNSSD::PublicService(m_dnssdName, m_dnssdType, m_port);
|
||||
m_dnssdreg->setTextData(m_dnssdData);
|
||||
m_dnssdreg->publishAsync();
|
||||
} else {
|
||||
m_dnssdRegistered = false;
|
||||
delete m_dnssdreg;
|
||||
m_dnssdreg = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void PortListener::refreshRegistration()
|
||||
{
|
||||
if (m_serviceRegistered && (m_slpLifetimeEnd.addSecs(-90) < QDateTime::currentDateTime())) {
|
||||
setServiceRegistrationEnabledInternal(false);
|
||||
setServiceRegistrationEnabledInternal(true);
|
||||
}
|
||||
}
|
||||
|
||||
QDateTime PortListener::expiration()
|
||||
{
|
||||
return m_expirationTime;
|
||||
}
|
||||
|
||||
QDateTime PortListener::serviceLifetimeEnd()
|
||||
{
|
||||
if (m_serviceRegistered) {
|
||||
return m_slpLifetimeEnd;
|
||||
} else {
|
||||
return QDateTime();
|
||||
}
|
||||
}
|
||||
|
||||
QString PortListener::name()
|
||||
{
|
||||
return m_serviceName;
|
||||
}
|
||||
|
||||
PortListener::~PortListener()
|
||||
{
|
||||
setServiceRegistrationEnabledInternal(false);
|
||||
delete m_socket;
|
||||
}
|
||||
|
||||
|
||||
KInetD::KInetD(QObject *parent, const QList<QVariant>&) :
|
||||
KDEDModule(parent)
|
||||
{
|
||||
m_config = new KConfig("kinetdrc");
|
||||
m_srvreg = new KServiceRegistry();
|
||||
|
||||
if (!m_srvreg->available()) {
|
||||
kDebug(7021) << "SLP not available";
|
||||
delete m_srvreg;
|
||||
m_srvreg = 0;
|
||||
}
|
||||
|
||||
m_portListeners.setAutoDelete(true);
|
||||
connect(&m_expirationTimer, SIGNAL(timeout()), SLOT(setExpirationTimer()));
|
||||
connect(&m_portRetryTimer, SIGNAL(timeout()), SLOT(portRetryTimer()));
|
||||
connect(&m_reregistrationTimer, SIGNAL(timeout()), SLOT(reregistrationTimer()));
|
||||
loadServiceList();
|
||||
}
|
||||
|
||||
void KInetD::loadServiceList()
|
||||
{
|
||||
m_portListeners.clear();
|
||||
|
||||
|
||||
KService::List kinetdModules =
|
||||
KServiceType::offers("KInetDModule");
|
||||
|
||||
for (KService::List::ConstIterator it = kinetdModules.begin();
|
||||
it != kinetdModules.end();
|
||||
it++) {
|
||||
KService::Ptr s = *it;
|
||||
PortListener *pl = new PortListener(s, m_config, m_srvreg);
|
||||
|
||||
if (pl->isValid()) {
|
||||
m_portListeners.append(pl);
|
||||
} else {
|
||||
delete pl;
|
||||
}
|
||||
}
|
||||
|
||||
setExpirationTimer();
|
||||
setPortRetryTimer(true);
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
void KInetD::expirationTimer()
|
||||
{
|
||||
setExpirationTimer();
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
void KInetD::setExpirationTimer()
|
||||
{
|
||||
QDateTime nextEx = getNextExpirationTime(); // disables expired portlistener!
|
||||
|
||||
if (!nextEx.isNull())
|
||||
m_expirationTimer.start(QDateTime::currentDateTime().secsTo(nextEx) * 1000 + 30000,
|
||||
false);
|
||||
else {
|
||||
m_expirationTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void KInetD::portRetryTimer()
|
||||
{
|
||||
setPortRetryTimer(true);
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
void KInetD::setReregistrationTimer()
|
||||
{
|
||||
QDateTime d;
|
||||
PortListener *pl = m_portListeners.first();
|
||||
|
||||
while (pl) {
|
||||
QDateTime d2 = pl->serviceLifetimeEnd();
|
||||
|
||||
if (!d2.isNull()) {
|
||||
if (d2 < QDateTime::currentDateTime()) {
|
||||
m_reregistrationTimer.start(0, true);
|
||||
return;
|
||||
} else if (d.isNull() || (d2 < d)) {
|
||||
d = d2;
|
||||
}
|
||||
}
|
||||
|
||||
pl = m_portListeners.next();
|
||||
}
|
||||
|
||||
if (!d.isNull()) {
|
||||
int s = QDateTime::currentDateTime().secsTo(d);
|
||||
|
||||
if (s < 30) {
|
||||
s = 30; // max frequency 30s
|
||||
}
|
||||
|
||||
m_reregistrationTimer.start(s * 1000, true);
|
||||
} else {
|
||||
m_reregistrationTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
void KInetD::reregistrationTimer()
|
||||
{
|
||||
PortListener *pl = m_portListeners.first();
|
||||
|
||||
while (pl) {
|
||||
pl->refreshRegistration();
|
||||
pl = m_portListeners.next();
|
||||
}
|
||||
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
void KInetD::setPortRetryTimer(bool retry)
|
||||
{
|
||||
int unmappedPorts = 0;
|
||||
|
||||
PortListener *pl = m_portListeners.first();
|
||||
|
||||
while (pl) {
|
||||
if (pl->isEnabled() && (pl->port() < 0))
|
||||
if (retry) {
|
||||
if (!pl->acquirePort()) {
|
||||
unmappedPorts++;
|
||||
}
|
||||
} else if (pl->port() < 0) {
|
||||
unmappedPorts++;
|
||||
}
|
||||
|
||||
pl = m_portListeners.next();
|
||||
}
|
||||
|
||||
if (unmappedPorts > 0) {
|
||||
m_portRetryTimer.start(30000, false);
|
||||
} else {
|
||||
m_portRetryTimer.stop();
|
||||
}
|
||||
}
|
||||
|
||||
PortListener *KInetD::getListenerByName(QString name)
|
||||
{
|
||||
PortListener *pl = m_portListeners.first();
|
||||
|
||||
while (pl) {
|
||||
if (pl->name() == name) {
|
||||
return pl;
|
||||
}
|
||||
|
||||
pl = m_portListeners.next();
|
||||
}
|
||||
|
||||
return pl;
|
||||
}
|
||||
|
||||
// gets next expiration timer, SIDEEFFECT: disables expired portlisteners while doing this
|
||||
QDateTime KInetD::getNextExpirationTime()
|
||||
{
|
||||
PortListener *pl = m_portListeners.first();
|
||||
QDateTime d;
|
||||
|
||||
while (pl) {
|
||||
QDateTime d2 = pl->expiration();
|
||||
|
||||
if (!d2.isNull()) {
|
||||
if (d2 < QDateTime::currentDateTime()) {
|
||||
pl->setEnabled(false);
|
||||
} else if (d.isNull() || (d2 < d)) {
|
||||
d = d2;
|
||||
}
|
||||
}
|
||||
|
||||
pl = m_portListeners.next();
|
||||
}
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
QStringList KInetD::services()
|
||||
{
|
||||
QStringList list;
|
||||
PortListener *pl = m_portListeners.first();
|
||||
|
||||
while (pl) {
|
||||
list.append(pl->name());
|
||||
pl = m_portListeners.next();
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
bool KInetD::isEnabled(QString service)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return pl->isEnabled();
|
||||
}
|
||||
|
||||
int KInetD::port(QString service)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return pl->port();
|
||||
}
|
||||
|
||||
bool KInetD::setPort(QString service, int port, int autoPortRange)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool s = pl->setPort(port, autoPortRange);
|
||||
setPortRetryTimer(false);
|
||||
setReregistrationTimer();
|
||||
return s;
|
||||
}
|
||||
|
||||
bool KInetD::isInstalled(QString service)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
return (pl != 0);
|
||||
}
|
||||
|
||||
void KInetD::setEnabled(QString service, bool enable)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl->setEnabled(enable);
|
||||
setExpirationTimer();
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
void KInetD::setEnabled(QString service, QDateTime expiration)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl->setEnabled(expiration);
|
||||
setExpirationTimer();
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
void KInetD::setServiceRegistrationEnabled(QString service, bool enable)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return;
|
||||
}
|
||||
|
||||
pl->setServiceRegistrationEnabled(enable);
|
||||
setReregistrationTimer();
|
||||
}
|
||||
|
||||
bool KInetD::isServiceRegistrationEnabled(QString service)
|
||||
{
|
||||
PortListener *pl = getListenerByName(service);
|
||||
|
||||
if (!pl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return pl->isServiceRegistrationEnabled();
|
||||
}
|
||||
|
||||
KInetD::~KInetD()
|
||||
{
|
||||
m_portListeners.clear();
|
||||
delete m_config;
|
||||
delete m_srvreg;
|
||||
}
|
||||
157
kinetd/kinetd.desktop
Normal file
157
kinetd/kinetd.desktop
Normal file
@@ -0,0 +1,157 @@
|
||||
[Desktop Entry]
|
||||
Type=Service
|
||||
|
||||
X-KDE-ServiceTypes=KDEDModule
|
||||
X-KDE-ModuleType=Library
|
||||
X-KDE-Library=kinetd
|
||||
X-KDE-Kded-autoload=true
|
||||
|
||||
Name=KDE Internet Daemon
|
||||
Name[af]=Kde Internet Bediener
|
||||
Name[ar]=كيدي إنترنت مراقب
|
||||
Name[ast]=Degorriu d'Internet de KDE
|
||||
Name[bg]=Интернет демон (KDE)
|
||||
Name[bn]=কে-ডি-ই ইন্টারনেট ডিমন
|
||||
Name[br]=Diaoul kenrouedad KDE
|
||||
Name[bs]=KDE-ov Internet Demon
|
||||
Name[ca]=Dimoni d'Internet per al KDE
|
||||
Name[ca@valencia]=Dimoni d'Internet per al KDE
|
||||
Name[cs]=KDE Internet démon
|
||||
Name[cy]=Daemon Rhyngrwyd KDE
|
||||
Name[da]=KDE Internet-dæmon
|
||||
Name[de]=Internet-Dienst
|
||||
Name[el]=Δαίμονας διαδικτύου για το KDE
|
||||
Name[en_GB]=KDE Internet Dæmon
|
||||
Name[eo]=KDE interreta demono
|
||||
Name[es]=Demonio de Internet de KDE
|
||||
Name[et]=KDE internetideemon
|
||||
Name[eu]=KDEren interneteko daemona
|
||||
Name[fa]=شبح اینترنتی KDE
|
||||
Name[fi]=KDE:n Internet-palvelin
|
||||
Name[fr]=Démon Internet de KDE
|
||||
Name[ga]=Deamhan Idirlín KDE
|
||||
Name[gl]=Daemon de internet de KDE
|
||||
Name[he]=תהליך הרקע האינטרנטי של KDE
|
||||
Name[hi]=केडीई इंटरनेट डेमन
|
||||
Name[hne]=केडीई इंटरनेट डेमन
|
||||
Name[hr]=KDE Internet Daemon
|
||||
Name[hu]=KDE internetes szolgáltatás
|
||||
Name[ia]=Demone Internet de KDE
|
||||
Name[is]=KDE Internetþjónn
|
||||
Name[it]=Demone Internet di KDE
|
||||
Name[ja]=KDE インターネットデーモン
|
||||
Name[kk]=KDE Интернет қызметі
|
||||
Name[km]=ដេមិនអ៊ីនធឺណិតរបស់ KDE
|
||||
Name[ko]=KDE 인터넷 데몬
|
||||
Name[lt]=KDE interneto tarnyba
|
||||
Name[lv]=KDE Interneta dēmons
|
||||
Name[mk]=Даемон за Интернет на KDE
|
||||
Name[ml]=കെഡിഈ ഇന്റര്നെറ്റ് സഹായി
|
||||
Name[ms]=Daemon Internet KDE
|
||||
Name[nb]=KDEs Internett-nisse
|
||||
Name[nds]=KDE-Internetdämoon
|
||||
Name[ne]=केडीई इन्टरनेट डेइमोन
|
||||
Name[nl]=KDE Internet Daemon
|
||||
Name[nn]=KDE-Internett-teneste
|
||||
Name[pa]=KDE ਇੰਟਰਨੈੱਟ ਡੈਮਨ
|
||||
Name[pl]=Demon internetowy dla KDE
|
||||
Name[pt]=Servidor de Internet do KDE
|
||||
Name[pt_BR]=Servidor de Internet do KDE
|
||||
Name[ro]=Demon de Internet KDE
|
||||
Name[ru]=Доступ к Интернету
|
||||
Name[se]=KDE-Interneahtta-duogášprográmma
|
||||
Name[si]=KDE ජාල ඩීමනය
|
||||
Name[sk]=KDE Internet démon
|
||||
Name[sl]=Internetni strežnik za KDE
|
||||
Name[sq]=KDE Internet Daemon
|
||||
Name[sr]=КДЕ‑ов интернет демон
|
||||
Name[sr@ijekavian]=КДЕ‑ов интернет демон
|
||||
Name[sr@ijekavianlatin]=KDE‑ov internet demon
|
||||
Name[sr@latin]=KDE‑ov internet demon
|
||||
Name[sv]=KDE:s Internetdemon
|
||||
Name[ta]=கேடிஇ இணைய டேமொன்
|
||||
Name[tg]=KDE Азозили Интернет
|
||||
Name[th]=ดีมอนอินเทอร์เน็ตของ KDE
|
||||
Name[tr]=KDE İnternet Programı
|
||||
Name[uk]=Фонова служба Інтернет KDE
|
||||
Name[uz]=KDE Internet demoni
|
||||
Name[uz@cyrillic]=KDE Интернет демони
|
||||
Name[vi]=Trình nền Mạng KDE
|
||||
Name[xh]=KDE Internet Daemon
|
||||
Name[x-test]=xxKDE Internet Daemonxx
|
||||
Name[zh_CN]=KDE Internet 守护进程
|
||||
Name[zh_HK]=KDE 互聯網系統程式
|
||||
Name[zh_TW]=KDE Internet 伺服程式
|
||||
Comment=An Internet daemon that starts network services on demand
|
||||
Comment[ar]=رقيب الإنترنت بدأ خدمة الشبكة على الرقيب
|
||||
Comment[ast]=Un degorriu d'Internet qu'entama los servicios de rede baxo demanda
|
||||
Comment[bg]=Интернет демон, който зарежда мрежови услуги при поискване
|
||||
Comment[bn]=একটি ইন্টারনেট ডিমন যে চাহিদা ভিত্তিক নেটওয়ার্ক সার্ভিস আরম্ভ করে
|
||||
Comment[bs]=Internet daemon koji pokreće mrežne servise po zahtijevu
|
||||
Comment[ca]=Un dimoni d'Internet que arrenca els serveis de xarxa sota demanda
|
||||
Comment[ca@valencia]=Un dimoni d'Internet que arrenca els serveis de xarxa sota demanda
|
||||
Comment[cs]=Internetový démon spouštějící síťové služby na požádání
|
||||
Comment[cy]=Daemon Rhyngrwyd sy'n cychwyn gwasanaethau rhwydwaith ar alw
|
||||
Comment[da]=En internet-dæmon der starter netværkstjenester efter forespørgsel
|
||||
Comment[de]=Startet Netzwerkdienste bei Bedarf
|
||||
Comment[el]=Ένας δαίμονας για το διαδίκτυο ο οποίος ξεκινάει τις υπηρεσίες δικτύου όταν απαιτείται
|
||||
Comment[en_GB]=An Internet dæmon that starts network services on demand
|
||||
Comment[eo]=Interreta demono kiu lanĉas retajn servojn laŭ bezono
|
||||
Comment[es]=Un demonio de Internet que inicia los servicios de red a demanda
|
||||
Comment[et]=Internetideemon, mis käivitab nõudmisel võrguteenused
|
||||
Comment[eu]=Sareko zerbitzuak eskatzean abiarazten dituen Interneteko daemona
|
||||
Comment[fa]=یک شبح اینترنتی که خدمات شبکه را بر اساس تقاضا آغاز میکند
|
||||
Comment[fi]=Internet-palvelin, joka käynnistää verkkopalveluita
|
||||
Comment[fr]=Un démon Internet qui démarre le service réseau à la demande
|
||||
Comment[ga]=Deamhan Idirlín a thosaíonn seirbhísí líonra ar éileamh
|
||||
Comment[gl]=Un daemon de Internet que inicia servizos de rede baixo demanda
|
||||
Comment[he]=תהליך רקע של אינטרנט שמתחיל שירותי רשת לפי דרישה
|
||||
Comment[hi]=एक इंटरनेट डेमन जो मांग पर नेटवर्क सेवा प्रारंभ करता है
|
||||
Comment[hne]=एक इंटरनेट डेमन जऊन मांग मं नेटवर्क सेवा चालू करथे
|
||||
Comment[hr]=Internet daemon koji pokreće mrežne usluge kada su zatražene
|
||||
Comment[hu]=A hálózati szolgáltatások vezérlését biztosító program
|
||||
Comment[ia]=Un demone internet que starta servicios de rete sur requesta
|
||||
Comment[is]=Internetþjónn sem ræsir tengingar við Internetið eftir þörfum
|
||||
Comment[it]=Un demone Internet che avvia i servizi di rete a richiesta
|
||||
Comment[ja]=要求時にネットワークサービスを起動するインターネットデーモン
|
||||
Comment[kk]=Талап етілгенде керек желі қызметтерді жегетін қызмет
|
||||
Comment[km]=ដេមិនអ៊ីនធឺណិតដែលចាប់ផ្ដើមសេវាបណ្ដាញនៅពេលត្រូវការ
|
||||
Comment[ko]=요청에 따라 네트워크 서비스를 시작하는 인터넷 데몬
|
||||
Comment[lt]=Interneto tarnyba, paleidžianti tinklo tarnybas esant poreikiui
|
||||
Comment[lv]=Interneta dēmons pēc vajadzības palaiž tīkla servisus
|
||||
Comment[mk]=Даемон за Интернет кој ги вклучува мрежните сервиси на барање
|
||||
Comment[ml]=ആവശ്യപ്പെടുമ്പോള് ശൃംഖലാസേവനം തുടങ്ങുന്ന ഒരു ഇന്റര്നെറ്റ് സഹായി
|
||||
Comment[ms]=Daemon Internet yang memulakan servis jaringan di atas permintaan
|
||||
Comment[nb]=Internett-nisse som starter nettverkstjenester ved behov
|
||||
Comment[nds]=En Internet-Dämoon, wat Nettwarkdeensten op Anfraag start
|
||||
Comment[ne]=एउटा इन्टरनेट डेइमोन जसले मागमा सञ्जाल सेवा सुरु गर्दछ
|
||||
Comment[nl]=Een internetdaemon die netwerkdiensten op afroep start
|
||||
Comment[nn]=Internett-teneste som startar nettverkstenester når dei trengst
|
||||
Comment[pa]=ਇੱਕ ਇੰਟਰਨੈੱਟ ਡੈਮਨ, ਜੋ ਕਿ ਲੋੜ ਪੈਣ ਉੱਤੇ ਨੈੱਟਵਰਕ ਸਰਵਿਸਾਂ ਸ਼ੁਰੂ ਕਰਦੀ ਹੈ।
|
||||
Comment[pl]=Demon internetowy, który uruchamia usługi sieciowe na żądanie
|
||||
Comment[pt]=Um servidor da Internet que inicia os serviços de rede a pedido
|
||||
Comment[pt_BR]=Um servidor Internet que inicia os serviços de rede por demanda
|
||||
Comment[ro]=Un demon de Internet ce pornește serviciile de rețea la cerere
|
||||
Comment[ru]=Служба установления подключения при запросе сетевых ресурсов
|
||||
Comment[se]=Interneahtta-duogášprográmma mii álggaha fierpmádatbálvalusaid go dárbbašuvvo
|
||||
Comment[si]=ඉල්ලුම පරිදි ජාල සේවා ආරම්භ කරන අන්තර්ජාල ඩීමනය
|
||||
Comment[sk]=Internetový démon, ktorý spúšťa sieťové služby na požiadanie
|
||||
Comment[sl]=Internetni strežnik, ki zažene omrežne storitve na zahtevo
|
||||
Comment[sr]=Интернет демон који покреће мрежне сервисе по захтеву
|
||||
Comment[sr@ijekavian]=Интернет демон који покреће мрежне сервисе по захтјеву
|
||||
Comment[sr@ijekavianlatin]=Internet demon koji pokreće mrežne servise po zahtjevu
|
||||
Comment[sr@latin]=Internet demon koji pokreće mrežne servise po zahtevu
|
||||
Comment[sv]=Internetdemon som startar nätverkstjänster vid behov
|
||||
Comment[ta]=ஒரு இணைய டேமொன், டேமொன் பிணைய சேவையை ஆரம்பிக்கிறது
|
||||
Comment[tg]=Азозили шабакавие, ки хидматрасони шабакавиро бо дархост сар медиҳад
|
||||
Comment[th]=ดมอนอินเทอร์เน็ตซึ่งจะเริ่มทำงานบริการเครือข่ายเมื่อมีความต้องการใช้
|
||||
Comment[tr]=Başlangıçta ağ servisleri tarafından istenen Internet hayalet programı
|
||||
Comment[uk]=Фонова служба Інтернет, що запускає служби мережі при запиті
|
||||
Comment[uz]=Talab qilinganda tarmoq xizmatlarini ishga tushuruvchi Internet demoni
|
||||
Comment[uz@cyrillic]=Талаб қилинганда тармоқ хизматларини ишга тушурувчи Интернет демони
|
||||
Comment[vi]=Một trình nền Mạng mà chạy các dịch vụ mạng theo nhu cầu
|
||||
Comment[xh]=Internet daemon eqala iinkonzo zomsebenzi wonatha xa zifunwa
|
||||
Comment[x-test]=xxAn Internet daemon that starts network services on demandxx
|
||||
Comment[zh_CN]=按需启动网络服务的守护进程
|
||||
Comment[zh_HK]=自動依需求起動網絡服務的互聯網系統程式
|
||||
Comment[zh_TW]=依要求起動網路服務的 Internet 伺服程式
|
||||
201
kinetd/kinetd.h
Normal file
201
kinetd/kinetd.h
Normal file
@@ -0,0 +1,201 @@
|
||||
|
||||
/***************************************************************************
|
||||
kinetd.h
|
||||
------------
|
||||
begin : Mon Feb 11 2002
|
||||
copyright : (C) 2002 by Tim Jansen
|
||||
email : tim@tjansen.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef _KINETD_H_
|
||||
#define _KINETD_H_
|
||||
|
||||
#include <kdedmodule.h>
|
||||
#include <kservice.h>
|
||||
#include <k3process.h>
|
||||
#include <qstringlist.h>
|
||||
#include <qstring.h>
|
||||
#include <qdatetime.h>
|
||||
#include <qtimer.h>
|
||||
#include <kserversocket.h>
|
||||
#include <dnssd/publicservice.h>
|
||||
#include <q3ptrlist.h>
|
||||
#include "kserviceregistry.h"
|
||||
|
||||
class PortListener : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
bool m_valid;
|
||||
QString m_serviceName;
|
||||
QString m_serviceURL, m_serviceAttributes;
|
||||
QStringList m_registeredServiceURLs;
|
||||
QString m_dnssdName, m_dnssdType;
|
||||
QMap<QString, QString> m_dnssdData;
|
||||
int m_serviceLifetime;
|
||||
int m_port;
|
||||
int m_portBase, m_autoPortRange;
|
||||
int m_defaultPortBase, m_defaultAutoPortRange;
|
||||
bool m_multiInstance;
|
||||
QString m_execPath;
|
||||
QString m_argument;
|
||||
bool m_enabled;
|
||||
bool m_serviceRegistered, m_registerService;
|
||||
bool m_dnssdRegister, m_dnssdRegistered;
|
||||
QDateTime m_expirationTime;
|
||||
QDateTime m_slpLifetimeEnd;
|
||||
QString m_uuid;
|
||||
|
||||
KNetwork::KServerSocket *m_socket;
|
||||
K3Process m_process;
|
||||
|
||||
KConfig *m_config;
|
||||
KServiceRegistry *m_srvreg;
|
||||
DNSSD::PublicService *m_dnssdreg;
|
||||
|
||||
void freePort();
|
||||
void loadConfig(KService::Ptr s);
|
||||
void setEnabledInternal(bool e, const QDateTime &ex);
|
||||
void dnssdRegister(bool enabled);
|
||||
void setServiceRegistrationEnabledInternal(bool enabled);
|
||||
|
||||
public:
|
||||
PortListener(KService::Ptr s, KConfig *c, KServiceRegistry *srvreg);
|
||||
~PortListener();
|
||||
|
||||
bool acquirePort();
|
||||
bool isValid();
|
||||
QString name();
|
||||
void setEnabled(bool enabled);
|
||||
void setEnabled(const QDateTime &expiration);
|
||||
void setServiceRegistrationEnabled(bool enabled);
|
||||
bool isServiceRegistrationEnabled();
|
||||
QDateTime expiration();
|
||||
QDateTime serviceLifetimeEnd();
|
||||
bool isEnabled();
|
||||
int port();
|
||||
QStringList processServiceTemplate(const QString &a);
|
||||
bool setPort(int port = -1, int autoProbeRange = 1);
|
||||
void refreshRegistration();
|
||||
|
||||
private slots:
|
||||
void accepted(KSocket *);
|
||||
};
|
||||
|
||||
class KInetD : public KDEDModule
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
/**
|
||||
* Returns a list of all registered services in KInetd.
|
||||
* To add a service you need to add a .desktop file with
|
||||
* the servicetype "KInetDModule" into the services director
|
||||
* (see kinetdmodule.desktop in servicetypes dir).
|
||||
* @return a list with the names of all services
|
||||
*/
|
||||
QStringList services();
|
||||
|
||||
/**
|
||||
* Returns true if the service exists and is available.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @return true if a service with the given name exists and is enabled
|
||||
*/
|
||||
bool isEnabled(QString service);
|
||||
|
||||
/**
|
||||
* Enables or disabled the given service. Ignored if the given service
|
||||
* does not exist.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @param enable true to enable, false to disable.
|
||||
*/
|
||||
void setEnabled(QString service, bool enable);
|
||||
|
||||
/**
|
||||
* Enables the given service until the given time. Ignored if the given
|
||||
* service does not exist.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @param expiration the time the service will be disabled at
|
||||
*/
|
||||
void setEnabled(QString service, QDateTime expiration);
|
||||
|
||||
/**
|
||||
* Returns the port of the service, or -1 if not listening.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @return the port or -1 if no port used or service does not exist
|
||||
*/
|
||||
int port(QString service);
|
||||
|
||||
/**
|
||||
* Sets the port of the service, and possibly a range of ports to try.
|
||||
* It will return true if a port could be found. If it did not find one
|
||||
* but is enabled it will start a timer that probes that port every 30s.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @param port the first port number to try or -1 to restore defaults
|
||||
* @param autoPortRange the number of ports to try
|
||||
* @return true if a port could be found or service is disabled, false
|
||||
* otherwise.
|
||||
*/
|
||||
bool setPort(QString service, int port = -1, int autoPortRange = 1);
|
||||
|
||||
/**
|
||||
* Tests whether the given service is installed..
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @return true if installed, false otherwise
|
||||
*/
|
||||
bool isInstalled(QString service);
|
||||
|
||||
/**
|
||||
* Enables or disables the SLP registration. Ignored if the service does
|
||||
* not have a service URL. If the service is disabled the service will
|
||||
* registered as soon as it is enabled.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @param enable true to enable, false to disable.
|
||||
*/
|
||||
void setServiceRegistrationEnabled(QString service, bool enabled);
|
||||
|
||||
/**
|
||||
* Returns true if service registration for the given service is enabled.
|
||||
* Note that this does not mean that the service is currently registered,
|
||||
* because the service may be disabled.
|
||||
* @param service name of a service as specified in its .desktop file
|
||||
* @return true if service registration is enabled
|
||||
*/
|
||||
bool isServiceRegistrationEnabled(QString service);
|
||||
|
||||
private:
|
||||
QDateTime getNextExpirationTime();
|
||||
void setPortRetryTimer(bool retry);
|
||||
void setReregistrationTimer();
|
||||
|
||||
KConfig *m_config;
|
||||
KServiceRegistry *m_srvreg;
|
||||
Q3PtrList<PortListener> m_portListeners;
|
||||
QTimer m_expirationTimer;
|
||||
QTimer m_portRetryTimer;
|
||||
QTimer m_reregistrationTimer;
|
||||
|
||||
private slots:
|
||||
void setExpirationTimer();
|
||||
void expirationTimer();
|
||||
void portRetryTimer();
|
||||
void reregistrationTimer();
|
||||
|
||||
public:
|
||||
KInetD(QObject *parent, const QList<QVariant>&);
|
||||
virtual ~KInetD();
|
||||
void loadServiceList();
|
||||
PortListener *getListenerByName(QString name);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
344
kinetd/kinetd.notifyrc
Normal file
344
kinetd/kinetd.notifyrc
Normal file
@@ -0,0 +1,344 @@
|
||||
[Global]
|
||||
IconName=kinetd
|
||||
Comment=KInetD
|
||||
Comment[ar]=KInetD
|
||||
Comment[ast]=KInetD
|
||||
Comment[bg]=KInetD
|
||||
Comment[bn]=কে-আইনেট-ডি
|
||||
Comment[br]=KInetD
|
||||
Comment[bs]=KInetD
|
||||
Comment[ca]=KInetD
|
||||
Comment[ca@valencia]=KInetD
|
||||
Comment[cs]=KInetD
|
||||
Comment[cy]=KInetD
|
||||
Comment[da]=KInetD
|
||||
Comment[de]=KInetD
|
||||
Comment[el]=KInetD
|
||||
Comment[en_GB]=KInetD
|
||||
Comment[eo]=KInetD
|
||||
Comment[es]=KInetD
|
||||
Comment[et]=KInetD
|
||||
Comment[eu]=KInetD
|
||||
Comment[fi]=KInetD
|
||||
Comment[fr]=KInetD
|
||||
Comment[ga]=KInetD
|
||||
Comment[gl]=KInetD
|
||||
Comment[he]=KInetD
|
||||
Comment[hi]=के-इनिट-डी
|
||||
Comment[hne]=के-इनिट-डी
|
||||
Comment[hr]=KInetD
|
||||
Comment[hu]=KInetD
|
||||
Comment[ia]=KInetD
|
||||
Comment[is]=KInetD
|
||||
Comment[it]=KInetD
|
||||
Comment[ja]=KInetD
|
||||
Comment[kk]=KInetD
|
||||
Comment[km]=KInetD
|
||||
Comment[ko]=KInetD
|
||||
Comment[lt]=KInetD
|
||||
Comment[lv]=KInetD
|
||||
Comment[mk]=KInetD
|
||||
Comment[ml]=കെഐനെറ്റ്ഡി
|
||||
Comment[ms]=KInetD
|
||||
Comment[nb]=KInetD
|
||||
Comment[nds]=KInetD
|
||||
Comment[nl]=KInetD
|
||||
Comment[nn]=KInetD
|
||||
Comment[pa]=KInetD
|
||||
Comment[pl]=KInetD
|
||||
Comment[pt]=KInetD
|
||||
Comment[pt_BR]=KInetD
|
||||
Comment[ro]=KInetD
|
||||
Comment[ru]=KInetD
|
||||
Comment[si]=KInetD
|
||||
Comment[sk]=KInetD
|
||||
Comment[sl]=KInetD
|
||||
Comment[sq]=KInetD
|
||||
Comment[sr]=КинетД
|
||||
Comment[sr@ijekavian]=КинетД
|
||||
Comment[sr@ijekavianlatin]=KInetD
|
||||
Comment[sr@latin]=KInetD
|
||||
Comment[sv]=Kinetd
|
||||
Comment[ta]=KInetD
|
||||
Comment[tg]=KInetD
|
||||
Comment[tr]=KInetD
|
||||
Comment[uk]=KInetD
|
||||
Comment[wa]=KInetD
|
||||
Comment[xh]=KInetD
|
||||
Comment[x-test]=xxKInetDxx
|
||||
Comment[zh_CN]=KInetD
|
||||
Comment[zh_HK]=KInetD
|
||||
Comment[zh_TW]=KInetD
|
||||
|
||||
[Event/IncomingConnection]
|
||||
Name=IncomingConnection
|
||||
Name[ar]=اتصال وارد
|
||||
Name[ast]=Conexón entrante
|
||||
Name[bg]=Входяща връзка
|
||||
Name[bn]=অন্তর্মুখী সংযোগ
|
||||
Name[br]=Kevreadenn resev
|
||||
Name[bs]=Dolazna veza
|
||||
Name[ca]=Connexió entrant
|
||||
Name[ca@valencia]=Connexió entrant
|
||||
Name[cs]=Příchozí spojení
|
||||
Name[cy]=CysylltiadCyrraedd
|
||||
Name[da]=IndkommendeForbindelse
|
||||
Name[de]=Eingehende Verbindung
|
||||
Name[el]=Εισερχόμενη σύνδεση
|
||||
Name[en_GB]=IncomingConnection
|
||||
Name[eo]=Envenanta konekto
|
||||
Name[es]=Conexión entrante
|
||||
Name[et]=Sissetulev ühendus
|
||||
Name[eu]=Sarrerako konexioa
|
||||
Name[fi]=Saapuva yhteys
|
||||
Name[fr]=Connexion entrante
|
||||
Name[ga]=Ceangal Isteach
|
||||
Name[gl]=Conexión entrante
|
||||
Name[he]=חיבור נכנס
|
||||
Name[hi]=आवक-कनेक्शन
|
||||
Name[hne]=आवक-कनेक्सन
|
||||
Name[hr]=DolaznaVeza
|
||||
Name[hu]=Bejövő kapcsolat
|
||||
Name[ia]=Connexion in arrivata
|
||||
Name[is]=IncomingConnection
|
||||
Name[it]=Connessioni in entrata
|
||||
Name[ja]=外部からの接続
|
||||
Name[kk]=Кіріс қосылым
|
||||
Name[km]=ការតភ្ជាប់ចូល
|
||||
Name[ko]=IncomingConnection
|
||||
Name[lt]=Gautas kvietimas ryšiui
|
||||
Name[lv]=IenākošaisSavienojums
|
||||
Name[mk]=Дојдовно поврзување
|
||||
Name[ml]=ആഗമനബന്ധം
|
||||
Name[ms]=Sambungan Masuk
|
||||
Name[nb]=Innkommende tilkobling
|
||||
Name[nds]=RinkamenVerbinnen
|
||||
Name[nl]=Inkomende_verbinding
|
||||
Name[nn]=Innkommande tilkopling
|
||||
Name[pa]=ਆ ਰਹੇ ਕੁਨੈਕਸ਼ਨ
|
||||
Name[pl]=Połączenia przychodzące
|
||||
Name[pt]=IncomingConnection
|
||||
Name[pt_BR]=Conexões de entrada
|
||||
Name[ro]=ConexiuneDeIntrare
|
||||
Name[ru]=Входящее соединение
|
||||
Name[si]=පැමිණෙන සබැඳිය
|
||||
Name[sk]=Prichádzajúce pripojenie
|
||||
Name[sl]=Prejeta povezava
|
||||
Name[sr]=Долазна веза
|
||||
Name[sr@ijekavian]=Долазна веза
|
||||
Name[sr@ijekavianlatin]=Dolazna veza
|
||||
Name[sr@latin]=Dolazna veza
|
||||
Name[sv]=Inkommande anslutning
|
||||
Name[ta]=உள்வரும் இணைப்புகள்
|
||||
Name[tg]=Пайвастшавии Воридшаванда
|
||||
Name[th]=มีการเชื่อมต่อเข้ามา
|
||||
Name[tr]=Gelen Bağlantı
|
||||
Name[uk]=IncomingConnection
|
||||
Name[xh]=Uxhumaniso Olungenayo
|
||||
Name[x-test]=xxIncomingConnectionxx
|
||||
Name[zh_CN]=进入的连接
|
||||
Name[zh_HK]=進入連線
|
||||
Name[zh_TW]=進來的連線
|
||||
Comment=Received incoming connection
|
||||
Comment[af]=Ontvang inkomende verbinding
|
||||
Comment[ar]=تلقي اتصال وارد
|
||||
Comment[ast]=Recibida conexón entrante
|
||||
Comment[bg]=Получана е входяща връзка
|
||||
Comment[bn]=অন্তর্মুখী সংযোগ গ্রহণ করল
|
||||
Comment[bs]=Primljena dolazeća veza
|
||||
Comment[ca]=Rebuda connexió entrant
|
||||
Comment[ca@valencia]=Rebuda connexió entrant
|
||||
Comment[cs]=Obdrženo příchozí spojení
|
||||
Comment[cy]=Derbynwyd cysylltiad a gyrhaeddodd
|
||||
Comment[da]=Modtog indkommende forbindelse
|
||||
Comment[de]=Verbindungsanfrage eingegangen
|
||||
Comment[el]=Λήφθηκε μια εισερχόμενη σύνδεση
|
||||
Comment[en_GB]=Received incoming connection
|
||||
Comment[eo]=Ricevis envenantan konekton
|
||||
Comment[es]=Recibida conexión entrante
|
||||
Comment[et]=Saadi sissetulev ühendus
|
||||
Comment[eu]=Sarrerako konexio bat jaso da
|
||||
Comment[fi]=Vastaanotettiin saapuva yhteys
|
||||
Comment[fr]=Reçu une connexion entrante
|
||||
Comment[ga]=Fuarthas ceangal isteach
|
||||
Comment[gl]=Recibiuse unha conexión entrante
|
||||
Comment[he]=נתקבל חיבור נכנס
|
||||
Comment[hi]=आवक कनेक्शन प्राप्त
|
||||
Comment[hne]=आवक कनेक्सन प्राप्त
|
||||
Comment[hr]=Primio dolaznu vezu
|
||||
Comment[hu]=Csatlakozási kérés érkezett
|
||||
Comment[ia]=Connexion in arrivata recipite
|
||||
Comment[is]=Tók á móti uppkalli
|
||||
Comment[it]=Ricevuta connessione in entrata
|
||||
Comment[ja]=外部からの接続がありました
|
||||
Comment[kk]=Кіріс қосылым ұсынылды
|
||||
Comment[km]=បានទទួលការតភ្ជាប់ចូល
|
||||
Comment[ko]=들어오는 연결을 받았습니다
|
||||
Comment[lt]=Gautas kvietimas ryšiui
|
||||
Comment[lv]=Saņemts ienākošs savienojums
|
||||
Comment[mk]=Примено е дојдовно поврзување
|
||||
Comment[ml]=ആഗമനബന്ധം ലഭിച്ചു
|
||||
Comment[ms]=Menerima sambungan masuk
|
||||
Comment[nb]=Mottok innkommende tilkobling
|
||||
Comment[nds]=Tokoppelanfraag kregen
|
||||
Comment[nl]=Inkomende verbinding ontvangen
|
||||
Comment[nn]=Fekk ei innkommande tilkopling
|
||||
Comment[pa]=ਮਿਲੇ ਆ ਰਹੇ ਕੁਨੈਕਸ਼ਨ
|
||||
Comment[pl]=Otrzymano połączenie przychodzące
|
||||
Comment[pt]=Foi recebida uma ligação
|
||||
Comment[pt_BR]=Recebendo conexão de entrada
|
||||
Comment[ro]=Conexiune de intrare recepționată
|
||||
Comment[ru]=Входящее соединение завершилось успешно
|
||||
Comment[si]=ලැබුනු පැමිණෙන සබැඳිය
|
||||
Comment[sk]=Prijaté prichádzajúce pripojenie
|
||||
Comment[sl]=Prejeta je prihajajoča povezava
|
||||
Comment[sr]=Примљена је долазна веза
|
||||
Comment[sr@ijekavian]=Примљена је долазна веза
|
||||
Comment[sr@ijekavianlatin]=Primljena je dolazna veza
|
||||
Comment[sr@latin]=Primljena je dolazna veza
|
||||
Comment[sv]=Tar emot inkommande anslutning
|
||||
Comment[tg]=Пайвастшавии воридшаванда қабул гардид
|
||||
Comment[th]=ได้รับการเชื่อมต่อเข้ามา
|
||||
Comment[tr]=Gelen bağlantı alınıyor
|
||||
Comment[uk]=Отримано вхідне з’єднання
|
||||
Comment[xh]=Uxhulumano olungenayo olufunyenweyo
|
||||
Comment[x-test]=xxReceived incoming connectionxx
|
||||
Comment[zh_CN]=收到进入的连接
|
||||
Comment[zh_HK]=已接收的進入連線
|
||||
Comment[zh_TW]=接收到進來的連線
|
||||
Action=None
|
||||
|
||||
[Event/ProcessFailed]
|
||||
Name=ProcessFailed
|
||||
Name[ar]=فشلت العملية
|
||||
Name[ast]=Procesu fallíu
|
||||
Name[bn]=প্রসেস ব্যর্থ
|
||||
Name[bs]=Neuspio proces
|
||||
Name[ca]=Procés erroni
|
||||
Name[ca@valencia]=Procés erroni
|
||||
Name[cs]=Proces selhal
|
||||
Name[cy]=MethoddProses
|
||||
Name[da]=ProcesMislykkedes
|
||||
Name[de]=Prozess fehlgeschlagen
|
||||
Name[el]=Η διεργασία απέτυχε
|
||||
Name[en_GB]=ProcessFailed
|
||||
Name[eo]=Procezo fiaskis
|
||||
Name[es]=Proceso fallido
|
||||
Name[et]=Protsess nurjus
|
||||
Name[eu]=Prozesuak huts egin du
|
||||
Name[fi]=Prosessi epäonnistui
|
||||
Name[fr]=Échec du processus
|
||||
Name[ga]=PróiseasTeipthe
|
||||
Name[gl]=Fallou o proceso
|
||||
Name[he]=תהליך נכשל
|
||||
Name[hi]=प्रक्रिया-असफल
|
||||
Name[hne]=काम-फेल
|
||||
Name[hr]=ProcesNeuspješan
|
||||
Name[hu]=Hibás folyamat
|
||||
Name[ia]=Processo falleva
|
||||
Name[is]=ProcessFailed
|
||||
Name[it]=Processo non riuscito
|
||||
Name[ja]=プロセス失敗
|
||||
Name[kk]=Процес жаңылысы
|
||||
Name[km]=ដំណើរការបានបរាជ័យ
|
||||
Name[ko]=ProcessFailed
|
||||
Name[lt]=Procesas nepavyko
|
||||
Name[lv]=ProcessNeveiksmīgs
|
||||
Name[mk]=Процесот не успеа
|
||||
Name[ml]=പ്രക്രിയ പരാജയപ്പെട്ടു
|
||||
Name[ms]=Proses Gagal
|
||||
Name[nb]=Prosessen mislyktes
|
||||
Name[nds]=PerzessFehlslaan
|
||||
Name[nl]=Proces_mislukt
|
||||
Name[nn]=Prosessen feila
|
||||
Name[pa]=ਪਰੋਸੈਸ ਫੇਲ੍ਹ
|
||||
Name[pl]=Błąd procesu
|
||||
Name[pt]=ProcessFailed
|
||||
Name[pt_BR]=Falha de processo
|
||||
Name[ro]=ProcesEșuat
|
||||
Name[ru]=Ошибка процесса
|
||||
Name[si]=සැකසුම අසාර්ථකයි
|
||||
Name[sk]=Proces zlyhal
|
||||
Name[sl]=Proces ni uspel
|
||||
Name[sr]=Процес није успео
|
||||
Name[sr@ijekavian]=Процес није успио
|
||||
Name[sr@ijekavianlatin]=Proces nije uspio
|
||||
Name[sr@latin]=Proces nije uspeo
|
||||
Name[sv]=Process misslyckades
|
||||
Name[ta]=செயல் தோல்வியுற்றது
|
||||
Name[tg]=Ҷараён бо Нокомӣ анҷомид
|
||||
Name[th]=โพรเซสล้มเหลว
|
||||
Name[tr]=Başarısız İşlemler
|
||||
Name[uk]=ProcessFailed
|
||||
Name[xh]=Inkqubo Yahlulekile
|
||||
Name[x-test]=xxProcessFailedxx
|
||||
Name[zh_CN]=处理失败
|
||||
Name[zh_HK]=程序失敗
|
||||
Name[zh_TW]=行程失敗
|
||||
Comment=Could not call process to handle connection
|
||||
Comment[af]=Kon nie roep proses na handvatsel verbinding
|
||||
Comment[ar]= لا يمكن نداء الإجراء إلى مؤشر الاتصال
|
||||
Comment[ast]=Nun puede llamase a un procesu pa remanar la conexón
|
||||
Comment[bn]=সংযোগ পরিচালনা করতে প্রসেস শুরু করতে পারল না
|
||||
Comment[bs]=Nisam mogao da pozovem proces da opsluži vezu
|
||||
Comment[ca]=No es pot cridar al procés per a manejar la connexió
|
||||
Comment[ca@valencia]=No es pot cridar al procés per a manejar la connexió
|
||||
Comment[cs]=Nelze spustit proces k obsluze spojení
|
||||
Comment[cy]=Methu galw proses i drin y cysylltiad
|
||||
Comment[da]=Kunne ikke kalde proces til at håndtere forbindelse
|
||||
Comment[de]=Der Prozess zur Bearbeitung der Verbindungsanfrage kann nicht gestartet werden
|
||||
Comment[el]=Αδύνατη η κλήση της διεργασίας για τη διαχείριση της σύνδεσης
|
||||
Comment[en_GB]=Could not call process to handle connection
|
||||
Comment[eo]=Ne eblis lanĉi la procezon por trakti la konekton
|
||||
Comment[es]=No se puede llamar un proceso para manejar la conexión
|
||||
Comment[et]=Ei suuda käivitada protsessi ühenduse käsitsemiseks
|
||||
Comment[eu]=Ezin izan da konexioa kudeatzeko prozesua deitu
|
||||
Comment[fi]=Ei voitu kutsua prosessia yhteyden hoitamiseksi
|
||||
Comment[fr]=Impossible d'appeler le processus pour gérer la connexion
|
||||
Comment[ga]=Níorbh fhéidir próiseas a thosú chun an ceangal a láimhseáil
|
||||
Comment[gl]=Non foi posíbel chamar ao proceso que xestiona a conexión
|
||||
Comment[he]=אין אפשרות לקרוא לתהליך על מנת לטפל בחיבור
|
||||
Comment[hi]=कनेक्शन हैंडल करने के लिए प्रक्रिया काल नहीं कर सका
|
||||
Comment[hne]=कनेक्सन हेंडल करे बर काम काल नइ कर सकिस
|
||||
Comment[hr]=Nisam mogao pozvati proces za kontrolu veze
|
||||
Comment[hu]=A kapcsolat kezelése nem sikerült
|
||||
Comment[ia]=Il non pote appellar processo pro manear connexion
|
||||
Comment[is]=Gat ekki kallað á forrit til að höndla tengingu
|
||||
Comment[it]=Impossibile richiamare il processo per gestire la connessione
|
||||
Comment[ja]=接続を扱うプロセスを呼び出せません
|
||||
Comment[kk]=Қосылыммен айналысатын процесс шақырылмады
|
||||
Comment[km]=មិនអាចហៅដំណើរការ ដើម្បីដោះស្រាយការតភ្ជាប់បានឡើយ
|
||||
Comment[ko]=연결을 처리하기 위한 프로세스를 부를 수 없습니다
|
||||
Comment[lt]=Nepavyko iškviesti proceso apdoroti prisijungimui
|
||||
Comment[lv]=Neizdevās izsaukt procesu savienojuma apstrādei
|
||||
Comment[mk]=Не може да се повика процесот за ракување со поврзувањето
|
||||
Comment[ml]=ബന്ധം കൈകാര്യം ചെയ്യാന് പ്രക്രിയയെ വിളിക്കാന് കഴിഞ്ഞില്ല
|
||||
Comment[ms]=Tidak dapat memanggil proses untuk mengendalikan sambungan
|
||||
Comment[nb]=Klarte ikke kalle på prosess for å håndtere tilkobling
|
||||
Comment[nds]=Perzess för't Verarbeiden vun Tokoppelanfragen lett sik nich opropen
|
||||
Comment[nl]=Kon geen proces aanroepen om de verbinding af te handelen
|
||||
Comment[nn]=Klarte ikkje kalla på prosessen som skulle handtera tilkoplinga
|
||||
Comment[pl]=Nie można było uruchomić procesu obsługi połączenia
|
||||
Comment[pt]=Não foi possível invocar o processo para lidar com as ligações
|
||||
Comment[pt_BR]=Não foi possível chamar o processo de controle da conexão
|
||||
Comment[ro]=Procesul ce manipulează conexiunea nu a putut fi apelat
|
||||
Comment[ru]=Не удаётся запустить процесс обработки соединения
|
||||
Comment[si]=සබඳතාව හැසිරවීම සඳහා සැකසීම නොකැඳවන්න
|
||||
Comment[sk]=Nepodarilo sa spustiť proces na spracovanie pripojenia
|
||||
Comment[sl]=Ni možno poklicati procesa za upravljanje s povezavo
|
||||
Comment[sr]=Нисам могао да позовем процес да опслужи везу
|
||||
Comment[sr@ijekavian]=Нисам могао да позовем процес да опслужи везу
|
||||
Comment[sr@ijekavianlatin]=Nisam mogao da pozovem proces da opsluži vezu
|
||||
Comment[sr@latin]=Nisam mogao da pozovem proces da opsluži vezu
|
||||
Comment[sv]=Kunde inte anropa process för att hantera anslutning
|
||||
Comment[ta]=இணைப்பை கையாள செயற்பாட்டை அழைக்க முடியவில்லை
|
||||
Comment[tg]=Барои даскории пайвастшавӣ ҷараён бозхонда нашуд
|
||||
Comment[th]=ไม่สามารถเรียกโพรเซสเพื่อจัดการรับการเชื่อมต่อได้
|
||||
Comment[tr]=Elle bağlantıda başarısız çağrı işlemleri
|
||||
Comment[uk]=Не вдалося викликати процес для з’єднання
|
||||
Comment[xh]=Ayikwazanga ukubiza inkqubo ezakuphatha uxhulumano
|
||||
Comment[x-test]=xxCould not call process to handle connectionxx
|
||||
Comment[zh_CN]=无法调用进程处理连接
|
||||
Comment[zh_HK]=無法呼叫處理連線的程序
|
||||
Comment[zh_TW]=無法呼叫行程來處理此連線
|
||||
Action=None
|
||||
154
kinetd/kinetdmodule.desktop
Normal file
154
kinetd/kinetdmodule.desktop
Normal file
@@ -0,0 +1,154 @@
|
||||
# describes the servicetype that you need to implement in order to use
|
||||
# kinetd.
|
||||
[Desktop Entry]
|
||||
Type=ServiceType
|
||||
X-KDE-ServiceType=KInetDModule
|
||||
Name=KInetD Module Type
|
||||
Name[ar]=KInetD نوع الوحدة
|
||||
Name[ast]=Triba de módulu KInetD
|
||||
Name[bg]=Модул на KInetD
|
||||
Name[bn]=কে-আইনেট-ডি মডিউল ধরন
|
||||
Name[br]=Seurt ar mollad KInetD
|
||||
Name[bs]=Vrsta modula KInetD-a
|
||||
Name[ca]=Tipus de mòdul del KInetD
|
||||
Name[ca@valencia]=Tipus de mòdul del KInetD
|
||||
Name[cs]=Typ modulu KInetD
|
||||
Name[cy]=Math Modiwl KInetD
|
||||
Name[da]=KInetD-modultype
|
||||
Name[de]=KInetD-Modultyp
|
||||
Name[el]=Τύπος αρθρώματος KInetD
|
||||
Name[en_GB]=KInetD Module Type
|
||||
Name[eo]=KInetD modulotipo
|
||||
Name[es]=Tipo de módulo KInetD
|
||||
Name[et]=KInetD mooduli tüüp
|
||||
Name[eu]=KInetD modulu mota
|
||||
Name[fa]=نوع پیمانه KInetD
|
||||
Name[fi]=KInetD-moduulityyppi
|
||||
Name[fr]=Type de module de KInetD
|
||||
Name[ga]=Cineál Modúil KInetD
|
||||
Name[gl]=Tipo de módulo KInetD
|
||||
Name[he]=סוג מודול של KInetD
|
||||
Name[hi]=के-इनिट-डी मॉड्यूल प्रकार
|
||||
Name[hne]=के-इनिट-डी माड्यूल किसम
|
||||
Name[hr]=Tip KInetD Modula
|
||||
Name[hu]=KInetD modultípus
|
||||
Name[ia]=Typo de modulo KInetD
|
||||
Name[is]=KInetD Module tegund
|
||||
Name[it]=Tipo di modulo KInetD
|
||||
Name[ja]=KInetD モジュールタイプ
|
||||
Name[kk]=KInetD модулі
|
||||
Name[km]=ប្រភេទម៉ូលឌុល KInetD
|
||||
Name[ko]=KInetD 모듈 종류
|
||||
Name[lt]=KInetD modulio tipas
|
||||
Name[lv]=KInetD moduļa tips
|
||||
Name[mk]=Тип на модул за KInetD
|
||||
Name[ml]=കെഐനെറ്റ് ഘടക രീതി
|
||||
Name[ms]=Jenis Modul KInetD
|
||||
Name[nb]=KInetd-programtillegstype
|
||||
Name[nds]=KInetD-Moduultyp
|
||||
Name[ne]=KInetD मोड्युल प्रकार
|
||||
Name[nl]=KInetD-moduletype
|
||||
Name[nn]=KInetD-programtilleggstype
|
||||
Name[pa]=KInetD ਮੋਡੀਊਲ ਟਾਈਪ
|
||||
Name[pl]=Typ modułu KInetD
|
||||
Name[pt]=Tipo de Módulo do KInetD
|
||||
Name[pt_BR]=Módulo KInetD
|
||||
Name[ro]=Tip modul KInetD
|
||||
Name[ru]=Модуль KInetD
|
||||
Name[se]=KInetD-moduvlašládja
|
||||
Name[si]=KInetD මොඩියුල වර්ගය
|
||||
Name[sk]=Typ modulu KInetD
|
||||
Name[sl]=Vrsta modula KInetD
|
||||
Name[sr]=Врста модула КинетД‑а
|
||||
Name[sr@ijekavian]=Врста модула КинетД‑а
|
||||
Name[sr@ijekavianlatin]=Vrsta modula KInetD‑a
|
||||
Name[sr@latin]=Vrsta modula KInetD‑a
|
||||
Name[sv]=Kinetd-modultyp
|
||||
Name[ta]=KInetD கூறு வகை
|
||||
Name[tg]=Навъи Модули KInetD
|
||||
Name[tr]=KInetD Modül Türü
|
||||
Name[uk]=Тип модулю KinetD
|
||||
Name[vi]=Kiểu môđun KInetD
|
||||
Name[xh]=Udidi Lomqongo womlinganiselo we KInetD
|
||||
Name[x-test]=xxKInetD Module Typexx
|
||||
Name[zh_CN]=KInetD 模块类型
|
||||
Name[zh_HK]=KInetD 模組類型
|
||||
Name[zh_TW]=KInetD 模組類型
|
||||
|
||||
# id to manipulate the service
|
||||
[PropertyDef::X-KDE-KINETD-id]
|
||||
Type=QString
|
||||
|
||||
# describes the TCP port kinetd should listen to
|
||||
[PropertyDef::X-KDE-KINETD-port]
|
||||
Type=int
|
||||
|
||||
# if set and >0, the number of ports kinetd should probe if the port is in use
|
||||
[PropertyDef::X-KDE-KINETD-autoPortRange]
|
||||
Type=int
|
||||
|
||||
# if enabled, kinetd will listen on the port. Can be overridden using the
|
||||
# dcop interface.
|
||||
[PropertyDef::X-KDE-KINETD-enabled]
|
||||
Type=bool
|
||||
|
||||
# if set, this argument is given to the app to start, followed by the number
|
||||
# of the socket's fd
|
||||
[PropertyDef::X-KDE-KINETD-argument]
|
||||
Type=QString
|
||||
|
||||
# if true, kinetd can accepts several connections at the same time. Otherwise
|
||||
# it will block the port when a connection has been established.
|
||||
[PropertyDef::X-KDE-KINETD-multiInstance]
|
||||
Type=bool
|
||||
|
||||
# if set, kinetd will register the given URL at the local SLP SA while
|
||||
# the port is open. It will register one URL for each IP address of the
|
||||
# host.
|
||||
# The following strings will be substituted:
|
||||
# %h with the local IP address
|
||||
# %p with the port number
|
||||
# %u with the user's login name
|
||||
# %f with the user's full name
|
||||
# %i with a UUID thats identical in all URLs of this service
|
||||
[PropertyDef::X-KDE-KINETD-serviceURL]
|
||||
Type=QString
|
||||
|
||||
# if kinetd registers a service URL, this string will be used for its attributes.
|
||||
# The following strings will be substituted:
|
||||
# %h with the local IP address
|
||||
# %p with the port number
|
||||
# %u with the user's login name
|
||||
# %f with the user's full name
|
||||
# %i with a UUID thats identical in all URLs of this service
|
||||
[PropertyDef::X-KDE-KINETD-serviceAttributes]
|
||||
Type=QString
|
||||
|
||||
# the lifetime of a service in seconds. kinets will renew the service
|
||||
# automatically. Max 65535, never use anything under 2 min. Something like
|
||||
# 5-20 minutes is a sane value for most desktop applications.
|
||||
[PropertyDef::X-KDE-KINETD-serviceLifetime]
|
||||
Type=int
|
||||
|
||||
# if set, kinetd will announce service with given name on local network while
|
||||
# the port is open.
|
||||
# The following strings will be substituted:
|
||||
# %h with the local IP address
|
||||
# %f with the user's full name
|
||||
# %p with the port number
|
||||
|
||||
[PropertyDef::X-KDE-KINETD-DNSSD-Name]
|
||||
Type=QString
|
||||
|
||||
# if kinetd announces service on network using DNS-SD, this string will be used as service
|
||||
# type. It must be in form _yourservice._udp or _yourservice._tcp
|
||||
# it uses the same substitution rules as X-KDE-KINETD-DNSSD-Name
|
||||
|
||||
[PropertyDef::X-KDE-KINETD-DNSSD-Type]
|
||||
Type=QString
|
||||
|
||||
# defines list of text properties for service announced via DNS-SD
|
||||
# it uses the same substitution rules as X-KDE-KINETD-DNSSD-Name
|
||||
[PropertyDef::X-KDE-KINETD-DNSSD-Properties]
|
||||
Type=QStringList
|
||||
|
||||
@@ -20,7 +20,6 @@ target_link_libraries (krfbprivate
|
||||
${QT_QTCORE_LIBRARY}
|
||||
${QT_QTGUI_LIBRARY}
|
||||
${X11_X11_LIB}
|
||||
${LIBVNCSERVER_LIBRARIES}
|
||||
)
|
||||
|
||||
set_target_properties (krfbprivate PROPERTIES
|
||||
@@ -47,17 +46,16 @@ if(TelepathyQt4_FOUND)
|
||||
include_directories(${TELEPATHY_QT4_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
if(KTP_FOUND)
|
||||
add_definitions(-DKRFB_WITH_KDE_TELEPATHY)
|
||||
include_directories(${KTP_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set (krfb_SRCS
|
||||
connectiondialog.cpp
|
||||
events.cpp
|
||||
framebuffermanager.cpp
|
||||
invitation.cpp
|
||||
invitedialog.cpp
|
||||
invitationmanager.cpp
|
||||
main.cpp
|
||||
mainwindow.cpp
|
||||
manageinvitationsdialog.cpp
|
||||
personalinvitedialog.cpp
|
||||
sockethelpers.cpp
|
||||
trayicon.cpp
|
||||
rfbservermanager.cpp
|
||||
@@ -83,7 +81,9 @@ kde4_add_ui_files (krfb_SRCS
|
||||
ui/configtcp.ui
|
||||
ui/configsecurity.ui
|
||||
ui/connectionwidget.ui
|
||||
ui/mainwidget.ui
|
||||
ui/invitewidget.ui
|
||||
ui/manageinvitations.ui
|
||||
ui/personalinvitewidget.ui
|
||||
)
|
||||
|
||||
if(TelepathyQt4_FOUND)
|
||||
@@ -104,7 +104,6 @@ target_link_libraries (krfb
|
||||
${QT_QTNETWORK_LIBRARY}
|
||||
${KDE4_KDNSSD_LIBS}
|
||||
${KDE4_KDEUI_LIBS}
|
||||
${LIBVNCSERVER_LIBRARIES}
|
||||
)
|
||||
|
||||
if(TelepathyQt4_FOUND)
|
||||
@@ -113,14 +112,6 @@ if(TelepathyQt4_FOUND)
|
||||
)
|
||||
endif()
|
||||
|
||||
if(KTP_FOUND)
|
||||
target_link_libraries(krfb
|
||||
${KTP_LIBRARIES}
|
||||
${KTP_MODELS_LIBRARIES}
|
||||
${KTP_WIDGETS_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
|
||||
if (X11_XTest_FOUND)
|
||||
target_link_libraries (krfb
|
||||
${X11_XTest_LIB}
|
||||
|
||||
120
krfb/invitation.cpp
Normal file
120
krfb/invitation.cpp
Normal file
@@ -0,0 +1,120 @@
|
||||
/***************************************************************************
|
||||
Copyright 2002 Tim Jansen <tim@tjansen.de>
|
||||
Copyright 2002 Stefan Taferner <taferner@kde.org>
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "invitation.h"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KDebug>
|
||||
#include <KRandom>
|
||||
#include <KStringHandler>
|
||||
|
||||
// a random string that doesn't contain i, I, o, O, 1, 0
|
||||
// based on KRandom::randomString()
|
||||
static QString readableRandomString(int length)
|
||||
{
|
||||
QString str;
|
||||
|
||||
while (length) {
|
||||
int r = KRandom::random() % 62;
|
||||
r += 48;
|
||||
|
||||
if (r > 57) {
|
||||
r += 7;
|
||||
}
|
||||
|
||||
if (r > 90) {
|
||||
r += 6;
|
||||
}
|
||||
|
||||
char c = char(r);
|
||||
|
||||
if ((c == 'i') ||
|
||||
(c == 'I') ||
|
||||
(c == '1') ||
|
||||
(c == 'o') ||
|
||||
(c == 'O') ||
|
||||
(c == '0')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
str += c;
|
||||
length--;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
Invitation::Invitation()
|
||||
{
|
||||
m_password = readableRandomString(4) + '-' + readableRandomString(3);
|
||||
m_creationTime = QDateTime::currentDateTime();
|
||||
m_expirationTime = QDateTime::currentDateTime().addSecs(INVITATION_DURATION);
|
||||
}
|
||||
|
||||
Invitation::Invitation(const Invitation &x)
|
||||
: m_password(x.m_password), m_creationTime(x.m_creationTime), m_expirationTime(x.m_expirationTime)
|
||||
{
|
||||
}
|
||||
|
||||
Invitation::Invitation(const KConfigGroup &config)
|
||||
{
|
||||
m_password = KStringHandler::obscure(config.readEntry("password", QString()));
|
||||
kDebug() << "read: " << config.readEntry("password", QString()) << " = " << m_password;
|
||||
m_creationTime = config.readEntry("creation", QDateTime());
|
||||
m_expirationTime = config.readEntry("expiration", QDateTime());
|
||||
}
|
||||
|
||||
Invitation::~Invitation()
|
||||
{
|
||||
}
|
||||
|
||||
Invitation &Invitation::operator= (const Invitation &x)
|
||||
{
|
||||
m_password = x.m_password;
|
||||
m_creationTime = x.m_creationTime;
|
||||
m_expirationTime = x.m_expirationTime;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Invitation::save(KConfigGroup &config) const
|
||||
{
|
||||
config.writeEntry("password", KStringHandler::obscure(m_password));
|
||||
config.writeEntry("creation", m_creationTime);
|
||||
config.writeEntry("expiration", m_expirationTime);
|
||||
}
|
||||
|
||||
QString Invitation::password() const
|
||||
{
|
||||
return m_password;
|
||||
}
|
||||
|
||||
QDateTime Invitation::expirationTime() const
|
||||
{
|
||||
return m_expirationTime;
|
||||
}
|
||||
|
||||
QDateTime Invitation::creationTime() const
|
||||
{
|
||||
return m_creationTime;
|
||||
}
|
||||
|
||||
bool Invitation::isValid() const
|
||||
{
|
||||
return m_expirationTime > QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
bool Invitation::operator ==(const Invitation &ot)
|
||||
{
|
||||
return m_creationTime == ot.m_creationTime && m_password == ot.m_password;
|
||||
}
|
||||
53
krfb/invitation.h
Normal file
53
krfb/invitation.h
Normal file
@@ -0,0 +1,53 @@
|
||||
/***************************************************************************
|
||||
invitation.h
|
||||
-------------------
|
||||
begin : Sat Mar 30 2002
|
||||
copyright : (C) 2002 by Tim Jansen
|
||||
email : tim@tjansen.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef INVITATION_H
|
||||
#define INVITATION_H
|
||||
|
||||
#include <KApplication>
|
||||
#include <KConfig>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
const int INVITATION_DURATION = 60 * 60;
|
||||
|
||||
class Invitation
|
||||
{
|
||||
public:
|
||||
Invitation();
|
||||
~Invitation();
|
||||
Invitation(const KConfigGroup &config);
|
||||
Invitation(const Invitation &x);
|
||||
Invitation &operator= (const Invitation &x);
|
||||
|
||||
bool operator == (const Invitation &ot);
|
||||
|
||||
QString password() const;
|
||||
QDateTime expirationTime() const;
|
||||
QDateTime creationTime() const;
|
||||
bool isValid() const;
|
||||
|
||||
void save(KConfigGroup &config) const;
|
||||
private:
|
||||
QString m_password;
|
||||
QDateTime m_creationTime;
|
||||
QDateTime m_expirationTime;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
130
krfb/invitationmanager.cpp
Normal file
130
krfb/invitationmanager.cpp
Normal file
@@ -0,0 +1,130 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#include "invitationmanager.h"
|
||||
#include "invitationmanager.moc"
|
||||
|
||||
#include <KConfigGroup>
|
||||
#include <KConfig>
|
||||
#include <KGlobal>
|
||||
|
||||
#include <QtCore/QTimer>
|
||||
|
||||
class InvitationManagerPrivate
|
||||
{
|
||||
public:
|
||||
InvitationManager instance;
|
||||
};
|
||||
|
||||
K_GLOBAL_STATIC(InvitationManagerPrivate, invitationManagerPrivate)
|
||||
|
||||
InvitationManager *InvitationManager::self()
|
||||
{
|
||||
return &invitationManagerPrivate->instance;
|
||||
}
|
||||
|
||||
InvitationManager::InvitationManager()
|
||||
{
|
||||
loadInvitations();
|
||||
|
||||
QTimer *refreshTimer = new QTimer(this);
|
||||
connect(refreshTimer, SIGNAL(timeout()), SLOT(loadInvitations()));
|
||||
refreshTimer->start(1000 * 60);
|
||||
}
|
||||
|
||||
|
||||
InvitationManager::~InvitationManager()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void InvitationManager::invalidateOldInvitations()
|
||||
{
|
||||
int invNum = invitationList.size();
|
||||
|
||||
while (invNum--) {
|
||||
if (!invitationList[invNum].isValid()) {
|
||||
invitationList.removeAt(invNum);
|
||||
}
|
||||
}
|
||||
|
||||
saveInvitations();
|
||||
}
|
||||
|
||||
|
||||
void InvitationManager::loadInvitations()
|
||||
{
|
||||
int invNum = invitationList.size();
|
||||
|
||||
KSharedConfigPtr conf = KGlobal::config();
|
||||
KConfigGroup invitationConfig(conf, "Invitations");
|
||||
int numInv = invitationConfig.readEntry("invitation_num", 0);
|
||||
|
||||
invitationList.clear();
|
||||
|
||||
for (int i = 0; i < numInv; i++) {
|
||||
KConfigGroup ic(conf, QString("Invitation_%1").arg(i));
|
||||
invitationList.append(Invitation(ic));
|
||||
}
|
||||
|
||||
invalidateOldInvitations();
|
||||
|
||||
if (numInv != invNum) {
|
||||
emit invitationNumChanged(invitationList.size());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Invitation InvitationManager::addInvitation()
|
||||
{
|
||||
Invitation i;
|
||||
invitationList.append(i);
|
||||
emit invitationNumChanged(invitationList.size());
|
||||
saveInvitations();
|
||||
return i;
|
||||
}
|
||||
|
||||
const QList< Invitation > & InvitationManager::invitations()
|
||||
{
|
||||
return invitationList;
|
||||
}
|
||||
|
||||
void InvitationManager::saveInvitations()
|
||||
{
|
||||
KSharedConfigPtr conf = KGlobal::config();
|
||||
KConfigGroup invitationConfig(conf, "Invitations");
|
||||
int invNum = invitationList.size();
|
||||
invitationConfig.writeEntry("invitation_num", invNum);
|
||||
|
||||
for (int i = 0; i < invNum; i++) {
|
||||
KConfigGroup ic(conf, QString("Invitation_%1").arg(i));
|
||||
invitationList[i].save(ic);
|
||||
}
|
||||
|
||||
conf->sync();
|
||||
}
|
||||
|
||||
int InvitationManager::activeInvitations()
|
||||
{
|
||||
invalidateOldInvitations();
|
||||
return invitationList.size();
|
||||
}
|
||||
|
||||
void InvitationManager::removeInvitation(const Invitation &inv)
|
||||
{
|
||||
invitationList.removeAll(inv);
|
||||
saveInvitations();
|
||||
emit invitationNumChanged(invitationList.size());
|
||||
}
|
||||
|
||||
void InvitationManager::removeAllInvitations()
|
||||
{
|
||||
invitationList.clear();
|
||||
saveInvitations();
|
||||
emit invitationNumChanged(invitationList.size());
|
||||
}
|
||||
58
krfb/invitationmanager.h
Normal file
58
krfb/invitationmanager.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#ifndef INVITATIONMANAGER_H
|
||||
#define INVITATIONMANAGER_H
|
||||
|
||||
#include "invitation.h"
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class InvitationManagerPrivate;
|
||||
/**
|
||||
@author Alessandro Praduroux <pradu@pradu.it>
|
||||
*/
|
||||
class InvitationManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
friend class InvitationManagerPrivate;
|
||||
public:
|
||||
static InvitationManager *self();
|
||||
|
||||
~InvitationManager();
|
||||
|
||||
Invitation addInvitation();
|
||||
|
||||
int activeInvitations();
|
||||
|
||||
void removeInvitation(const Invitation &inv);
|
||||
void removeAllInvitations();
|
||||
|
||||
const QList<Invitation> &invitations();
|
||||
|
||||
signals:
|
||||
void invitationNumChanged(int);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
void loadInvitations();
|
||||
void saveInvitations();
|
||||
|
||||
private:
|
||||
|
||||
void invalidateOldInvitations();
|
||||
InvitationManager();
|
||||
static InvitationManager *_self;
|
||||
|
||||
QList<Invitation> invitationList;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -18,59 +18,72 @@
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "rfb.h"
|
||||
#include "invitationsrfbclient.h"
|
||||
#include "invitationsrfbserver.h"
|
||||
#include "invitationmanager.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "sockethelpers.h"
|
||||
#include "connectiondialog.h"
|
||||
#include <KNotification>
|
||||
#include <KLocale>
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include <poll.h>
|
||||
|
||||
struct PendingInvitationsRfbClient::Private
|
||||
bool InvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
Private(rfbClientPtr client) :
|
||||
client(client),
|
||||
askOnConnect(true)
|
||||
{}
|
||||
bool allowUninvited = KrfbConfig::allowUninvitedConnections();
|
||||
QByteArray password = KrfbConfig::uninvitedConnectionPassword().toLocal8Bit();
|
||||
|
||||
rfbClientPtr client;
|
||||
QSocketNotifier *notifier;
|
||||
bool askOnConnect;
|
||||
};
|
||||
bool authd = false;
|
||||
kDebug() << "about to start autentication";
|
||||
|
||||
static void clientGoneHookNoop(rfbClientPtr cl) { Q_UNUSED(cl); }
|
||||
if (allowUninvited) {
|
||||
authd = vncAuthCheckPassword(password, encryptedPassword);
|
||||
}
|
||||
|
||||
PendingInvitationsRfbClient::PendingInvitationsRfbClient(rfbClientPtr client, QObject *parent) :
|
||||
PendingRfbClient(client, parent),
|
||||
d(new Private(client))
|
||||
{
|
||||
d->client->clientGoneHook = clientGoneHookNoop;
|
||||
d->notifier = new QSocketNotifier(client->sock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, SIGNAL(activated(int)),
|
||||
this, SLOT(onSocketActivated()));
|
||||
if (!authd) {
|
||||
QList<Invitation> invlist = InvitationManager::self()->invitations();
|
||||
|
||||
foreach(const Invitation & it, invlist) {
|
||||
kDebug() << "checking password";
|
||||
|
||||
if (vncAuthCheckPassword(it.password().toLocal8Bit(), encryptedPassword)
|
||||
&& it.isValid())
|
||||
{
|
||||
authd = true;
|
||||
InvitationManager::self()->removeInvitation(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!authd) {
|
||||
if (InvitationManager::self()->invitations().size() > 0) {
|
||||
KNotification::event("InvalidPasswordInvitations",
|
||||
i18n("Failed login attempt from %1: wrong password", name()));
|
||||
} else {
|
||||
KNotification::event("InvalidPassword",
|
||||
i18n("Failed login attempt from %1: wrong password", name()));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PendingInvitationsRfbClient::~PendingInvitationsRfbClient()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void PendingInvitationsRfbClient::processNewClient()
|
||||
{
|
||||
QString host = peerAddress(m_rfbClient->sock) + ":" + QString::number(peerPort(m_rfbClient->sock));
|
||||
bool allowUninvited = KrfbConfig::allowUninvitedConnections();
|
||||
|
||||
if (d->askOnConnect == false) {
|
||||
|
||||
if (!allowUninvited && InvitationManager::self()->activeInvitations() == 0) {
|
||||
KNotification::event("UnexpectedConnection",
|
||||
i18n("Refused uninvited connection attempt from %1", host));
|
||||
reject();
|
||||
} else if (!KrfbConfig::askOnConnect()) {
|
||||
KNotification::event("NewConnectionAutoAccepted",
|
||||
i18n("Accepted connection from %1", host));
|
||||
accept(new InvitationsRfbClient(m_rfbClient, parent()));
|
||||
|
||||
} else {
|
||||
|
||||
KNotification::event("NewConnectionOnHold",
|
||||
i18n("Received connection from %1, on hold (waiting for confirmation)",
|
||||
host));
|
||||
@@ -86,56 +99,6 @@ void PendingInvitationsRfbClient::processNewClient()
|
||||
}
|
||||
}
|
||||
|
||||
void PendingInvitationsRfbClient::onSocketActivated()
|
||||
{
|
||||
//Process not only one, but all pending messages.
|
||||
//poll() idea/code copied from vino:
|
||||
// Copyright (C) 2003 Sun Microsystems, Inc.
|
||||
// License: GPL v2 or later
|
||||
struct pollfd pollfd = { d->client->sock, POLLIN|POLLPRI, 0 };
|
||||
|
||||
while(poll(&pollfd, 1, 0) == 1) {
|
||||
|
||||
if(d->client->state == rfbClientRec::RFB_INITIALISATION) {
|
||||
d->notifier->setEnabled(false);
|
||||
//Client is Authenticated
|
||||
processNewClient();
|
||||
break;
|
||||
}
|
||||
rfbProcessClientMessage(d->client);
|
||||
|
||||
//This is how we handle disconnection.
|
||||
//if rfbProcessClientMessage() finds out that it can't read the socket,
|
||||
//it closes it and sets it to -1. So, we just have to check this here
|
||||
//and call rfbClientConnectionGone() if necessary. This will call
|
||||
//the clientGoneHook which in turn will remove this RfbClient instance
|
||||
//from the server manager and will call deleteLater() to delete it
|
||||
if (d->client->sock == -1) {
|
||||
kDebug() << "disconnected from socket signal";
|
||||
d->notifier->setEnabled(false);
|
||||
rfbClientConnectionGone(d->client);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool PendingInvitationsRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
QByteArray password ;
|
||||
kDebug() << "about to start autentication";
|
||||
|
||||
if(InvitationsRfbServer::instance->allowUnattendedAccess() && vncAuthCheckPassword(
|
||||
InvitationsRfbServer::instance->unattendedPassword().toLocal8Bit(),
|
||||
encryptedPassword) ) {
|
||||
d->askOnConnect = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
return vncAuthCheckPassword(
|
||||
InvitationsRfbServer::instance->desktopPassword().toLocal8Bit(),
|
||||
encryptedPassword);
|
||||
}
|
||||
|
||||
void PendingInvitationsRfbClient::dialogAccepted()
|
||||
{
|
||||
InvitationsConnectionDialog *dialog = qobject_cast<InvitationsConnectionDialog *>(sender());
|
||||
|
||||
@@ -25,6 +25,9 @@ class InvitationsRfbClient : public RfbClient
|
||||
public:
|
||||
InvitationsRfbClient(rfbClientPtr client, QObject* parent = 0)
|
||||
: RfbClient(client, parent) {}
|
||||
|
||||
protected:
|
||||
virtual bool checkPassword(const QByteArray & encryptedPassword);
|
||||
};
|
||||
|
||||
|
||||
@@ -32,20 +35,14 @@ class PendingInvitationsRfbClient : public PendingRfbClient
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PendingInvitationsRfbClient(rfbClientPtr client, QObject *parent = 0);
|
||||
virtual ~PendingInvitationsRfbClient();
|
||||
PendingInvitationsRfbClient(rfbClientPtr client, QObject *parent = 0)
|
||||
: PendingRfbClient(client, parent) {}
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void processNewClient();
|
||||
virtual void onSocketActivated();
|
||||
virtual bool checkPassword(const QByteArray & encryptedPassword);
|
||||
|
||||
private Q_SLOTS:
|
||||
void dialogAccepted();
|
||||
|
||||
private:
|
||||
struct Private;
|
||||
Private* const d;
|
||||
};
|
||||
|
||||
#endif // INVITATIONSRFBCLIENT_H
|
||||
|
||||
@@ -29,118 +29,16 @@
|
||||
#include <KLocale>
|
||||
#include <KMessageBox>
|
||||
#include <KUser>
|
||||
#include <KRandom>
|
||||
#include <KStringHandler>
|
||||
#include <KWallet/Wallet>
|
||||
#include <DNSSD/PublicService>
|
||||
using KWallet::Wallet;
|
||||
|
||||
//static
|
||||
InvitationsRfbServer *InvitationsRfbServer::instance;
|
||||
|
||||
//static
|
||||
void InvitationsRfbServer::init()
|
||||
{
|
||||
instance = new InvitationsRfbServer;
|
||||
instance->m_publicService = new DNSSD::PublicService(
|
||||
i18n("%1@%2 (shared desktop)",
|
||||
KUser().loginName(),
|
||||
QHostInfo::localHostName()),
|
||||
"_rfb._tcp",
|
||||
KrfbConfig::port());
|
||||
instance->setListeningAddress("0.0.0.0");
|
||||
instance->setListeningPort(KrfbConfig::port());
|
||||
instance->setPasswordRequired(true);
|
||||
|
||||
instance->m_wallet = Wallet::openWallet(
|
||||
Wallet::NetworkWallet(), 0, Wallet::Asynchronous);
|
||||
if(instance->m_wallet) {
|
||||
connect(instance->m_wallet, SIGNAL(walletOpened(bool)),
|
||||
instance, SLOT(walletOpened(bool)));
|
||||
}
|
||||
}
|
||||
|
||||
const QString& InvitationsRfbServer::desktopPassword() const
|
||||
{
|
||||
return m_desktopPassword;
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::setDesktopPassword(const QString& password)
|
||||
{
|
||||
m_desktopPassword = password;
|
||||
}
|
||||
|
||||
const QString& InvitationsRfbServer::unattendedPassword() const
|
||||
{
|
||||
return m_unattendedPassword;
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::setUnattendedPassword(const QString& password)
|
||||
{
|
||||
m_unattendedPassword = password;
|
||||
}
|
||||
|
||||
bool InvitationsRfbServer::allowUnattendedAccess() const
|
||||
{
|
||||
return m_allowUnattendedAccess;
|
||||
}
|
||||
|
||||
bool InvitationsRfbServer::start()
|
||||
{
|
||||
if(RfbServer::start()) {
|
||||
if(KrfbConfig::publishService())
|
||||
m_publicService->publishAsync();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::stop(bool disconnectClients)
|
||||
{
|
||||
if(m_publicService->isPublished())
|
||||
m_publicService->stop();
|
||||
RfbServer::stop(disconnectClients);
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::toggleUnattendedAccess(bool allow)
|
||||
{
|
||||
m_allowUnattendedAccess = allow;
|
||||
}
|
||||
|
||||
InvitationsRfbServer::InvitationsRfbServer()
|
||||
{
|
||||
m_desktopPassword = readableRandomString(4)+"-"+readableRandomString(3);
|
||||
m_unattendedPassword = readableRandomString(4)+"-"+readableRandomString(3);
|
||||
KSharedConfigPtr config = KGlobal::config();
|
||||
KConfigGroup krfbConfig(config,"Security");
|
||||
m_allowUnattendedAccess = krfbConfig.readEntry(
|
||||
"allowUnattendedAccess", QVariant(false)).toBool();
|
||||
}
|
||||
|
||||
InvitationsRfbServer::~InvitationsRfbServer()
|
||||
{
|
||||
stop();
|
||||
KSharedConfigPtr config = KGlobal::config();
|
||||
KConfigGroup krfbConfig(config,"Security");
|
||||
krfbConfig.writeEntry("allowUnattendedAccess",m_allowUnattendedAccess);
|
||||
if(m_wallet && m_wallet->isOpen()) {
|
||||
|
||||
if( (m_wallet->currentFolder()=="krfb") ||
|
||||
((m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb")) &&
|
||||
m_wallet->setFolder("krfb")) ) {
|
||||
|
||||
m_wallet->writePassword("desktopSharingPassword",m_desktopPassword);
|
||||
m_wallet->writePassword("unattendedAccessPassword",m_unattendedPassword);
|
||||
}
|
||||
|
||||
} else {
|
||||
krfbConfig.writeEntry("desktopPassword",
|
||||
KStringHandler::obscure(m_desktopPassword));
|
||||
krfbConfig.writeEntry("unattendedPassword",
|
||||
KStringHandler::obscure(m_unattendedPassword));
|
||||
krfbConfig.writeEntry("allowUnattendedAccess",
|
||||
m_allowUnattendedAccess);
|
||||
}
|
||||
InvitationsRfbServer *server;
|
||||
server = new InvitationsRfbServer;
|
||||
server->setListeningPort(KrfbConfig::port());
|
||||
server->setListeningAddress("0.0.0.0"); // Listen on all available network addresses
|
||||
server->setPasswordRequired(true);
|
||||
QTimer::singleShot(0, server, SLOT(startAndCheck()));
|
||||
}
|
||||
|
||||
PendingRfbClient* InvitationsRfbServer::newClient(rfbClientPtr client)
|
||||
@@ -148,76 +46,26 @@ PendingRfbClient* InvitationsRfbServer::newClient(rfbClientPtr client)
|
||||
return new PendingInvitationsRfbClient(client, this);
|
||||
}
|
||||
|
||||
void InvitationsRfbServer::walletOpened(bool opened)
|
||||
void InvitationsRfbServer::startAndCheck()
|
||||
{
|
||||
QString desktopPassword;
|
||||
QString unattendedPassword;
|
||||
Q_ASSERT(m_wallet);
|
||||
if( opened &&
|
||||
( m_wallet->hasFolder("krfb") || m_wallet->createFolder("krfb") ) &&
|
||||
m_wallet->setFolder("krfb") ) {
|
||||
|
||||
if(m_wallet->readPassword("desktopSharingPassword", desktopPassword)==0 &&
|
||||
!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
emit passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
if(m_wallet->readPassword("unattendedAccessPassword", unattendedPassword)==0 &&
|
||||
!unattendedPassword.isEmpty()) {
|
||||
m_unattendedPassword = unattendedPassword;
|
||||
}
|
||||
|
||||
if (!start()) {
|
||||
KMessageBox::error(0, i18n("Failed to start the krfb server. Invitation-based sharing "
|
||||
"will not work. Try setting another port in the settings and "
|
||||
"restart krfb."));
|
||||
} else {
|
||||
|
||||
kDebug() << "Could not open KWallet, Falling back to config file";
|
||||
KSharedConfigPtr config = KGlobal::config();
|
||||
KConfigGroup krfbConfig(config,"Security");
|
||||
|
||||
desktopPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
"desktopPassword", QString()));
|
||||
if(!desktopPassword.isEmpty()) {
|
||||
m_desktopPassword = desktopPassword;
|
||||
emit passwordChanged(m_desktopPassword);
|
||||
}
|
||||
|
||||
unattendedPassword = KStringHandler::obscure(krfbConfig.readEntry(
|
||||
"unattendedPassword", QString()));
|
||||
if(!unattendedPassword.isEmpty()) {
|
||||
m_unattendedPassword = unattendedPassword;
|
||||
//publish service
|
||||
if (KrfbConfig::publishService()) {
|
||||
DNSSD::PublicService *service = new DNSSD::PublicService(i18n("%1@%2 (shared desktop)",
|
||||
KUser().loginName(),
|
||||
QHostInfo::localHostName()),
|
||||
"_rfb._tcp",
|
||||
listeningPort());
|
||||
service->publishAsync();
|
||||
}
|
||||
|
||||
//disconnect when qApp quits
|
||||
connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(stop()));
|
||||
}
|
||||
}
|
||||
|
||||
// a random string that doesn't contain i, I, o, O, 1, l, 0
|
||||
// based on KRandom::randomString()
|
||||
QString InvitationsRfbServer::readableRandomString(int length)
|
||||
{
|
||||
QString str;
|
||||
while (length) {
|
||||
int r = KRandom::random() % 62;
|
||||
r += 48;
|
||||
if (r > 57) {
|
||||
r += 7;
|
||||
}
|
||||
if (r > 90) {
|
||||
r += 6;
|
||||
}
|
||||
char c = char(r);
|
||||
if ((c == 'i') ||
|
||||
(c == 'I') ||
|
||||
(c == '1') ||
|
||||
(c == 'l') ||
|
||||
(c == 'o') ||
|
||||
(c == 'O') ||
|
||||
(c == '0')) {
|
||||
continue;
|
||||
}
|
||||
str += c;
|
||||
length--;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
#include "invitationsrfbserver.moc"
|
||||
|
||||
@@ -22,51 +22,21 @@
|
||||
|
||||
#include "rfbserver.h"
|
||||
|
||||
namespace KWallet {
|
||||
class Wallet;
|
||||
}
|
||||
|
||||
namespace DNSSD {
|
||||
class PublicService;
|
||||
}
|
||||
|
||||
class InvitationsRfbServer : public RfbServer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static InvitationsRfbServer *instance;
|
||||
static void init();
|
||||
|
||||
const QString& desktopPassword() const;
|
||||
void setDesktopPassword(const QString&);
|
||||
const QString& unattendedPassword() const;
|
||||
void setUnattendedPassword(const QString&);
|
||||
bool allowUnattendedAccess() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void passwordChanged(const QString&);
|
||||
|
||||
public Q_SLOTS:
|
||||
bool start();
|
||||
void stop(bool disconnectClients=true);
|
||||
void toggleUnattendedAccess(bool allow=true);
|
||||
|
||||
protected:
|
||||
InvitationsRfbServer();
|
||||
virtual ~InvitationsRfbServer();
|
||||
InvitationsRfbServer() : RfbServer(0) {}
|
||||
|
||||
virtual PendingRfbClient* newClient(rfbClientPtr client);
|
||||
|
||||
private Q_SLOTS:
|
||||
void walletOpened(bool);
|
||||
void startAndCheck();
|
||||
|
||||
private:
|
||||
DNSSD::PublicService *m_publicService;
|
||||
bool m_allowUnattendedAccess;
|
||||
QString m_desktopPassword;
|
||||
QString m_unattendedPassword;
|
||||
KWallet::Wallet *m_wallet;
|
||||
|
||||
QString readableRandomString(int);
|
||||
Q_DISABLE_COPY(InvitationsRfbServer)
|
||||
};
|
||||
|
||||
|
||||
87
krfb/invitedialog.cpp
Normal file
87
krfb/invitedialog.cpp
Normal file
@@ -0,0 +1,87 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "invitedialog.h"
|
||||
|
||||
#include <KIconLoader>
|
||||
#include <KLocale>
|
||||
#include <KStandardGuiItem>
|
||||
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QPushButton>
|
||||
#include <QtGui/QToolTip>
|
||||
|
||||
InviteDialog::InviteDialog(QWidget *parent)
|
||||
: KDialog(parent)
|
||||
{
|
||||
setCaption(i18n("Invitation"));
|
||||
setButtons(User1 | Close | Help);
|
||||
setHelp(QString(), "krfb");
|
||||
setDefaultButton(NoDefault);
|
||||
|
||||
setMinimumSize(500, 300);
|
||||
|
||||
m_inviteWidget = new QWidget(this);
|
||||
setupUi(m_inviteWidget);
|
||||
|
||||
pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
|
||||
setMainWidget(m_inviteWidget);
|
||||
|
||||
setButtonGuiItem(User1, KStandardGuiItem::configure());
|
||||
|
||||
connect(btnCreateInvite, SIGNAL(clicked()),
|
||||
SIGNAL(createInviteClicked()));
|
||||
connect(btnEmailInvite, SIGNAL(clicked()),
|
||||
SIGNAL(emailInviteClicked()));
|
||||
connect(btnManageInvite, SIGNAL(clicked()),
|
||||
SIGNAL(manageInviteClicked()));
|
||||
connect(helpLabel, SIGNAL(linkActivated(QString)),
|
||||
SLOT(showWhatsthis()));
|
||||
}
|
||||
|
||||
void InviteDialog::slotUser1()
|
||||
{
|
||||
emit configureClicked();
|
||||
}
|
||||
|
||||
void InviteDialog::enableInviteButton(bool enable)
|
||||
{
|
||||
btnCreateInvite->setEnabled(enable);
|
||||
}
|
||||
|
||||
void InviteDialog::setInviteCount(int count)
|
||||
{
|
||||
btnManageInvite->setText(
|
||||
i18n("&Manage Invitations (%1)...", count));
|
||||
}
|
||||
|
||||
void InviteDialog::showWhatsthis()
|
||||
{
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
i18n("An invitation creates a one-time password that allows the receiver to connect to your desktop.\n"
|
||||
"It is valid for only one successful connection and will expire after an hour if it has not been used. \n"
|
||||
"When somebody connects to your computer a dialog will appear and ask you for permission.\n "
|
||||
"The connection will not be established before you accept it. In this dialog you can also\n restrict "
|
||||
"the other person to view your desktop only, without the ability to move your\n mouse pointer or press "
|
||||
"keys.\nIf you want to create a permanent password for Desktop Sharing, allow 'Uninvited Connections' \n"
|
||||
"in the configuration."));
|
||||
}
|
||||
|
||||
#include "invitedialog.moc"
|
||||
57
krfb/invitedialog.h
Normal file
57
krfb/invitedialog.h
Normal file
@@ -0,0 +1,57 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef INVITEDIALOG_H
|
||||
#define INVITEDIALOG_H
|
||||
|
||||
#include "ui_invitewidget.h"
|
||||
|
||||
#include <KDialog>
|
||||
|
||||
class QWidget;
|
||||
|
||||
class InviteDialog : public KDialog, public Ui::InviteWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InviteDialog(QWidget *parent);
|
||||
~InviteDialog() {}
|
||||
|
||||
void enableInviteButton(bool enable);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setInviteCount(int count);
|
||||
void showWhatsthis();
|
||||
|
||||
signals:
|
||||
void createInviteClicked();
|
||||
void emailInviteClicked();
|
||||
void manageInviteClicked();
|
||||
void configureClicked();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void slotUser1();
|
||||
|
||||
protected:
|
||||
QWidget *m_inviteWidget;
|
||||
};
|
||||
|
||||
#endif // INVITEDIALOG_H
|
||||
|
||||
@@ -4,7 +4,6 @@ X-KDE-ServiceType=krfb/framebuffer
|
||||
|
||||
Comment=Frame Buffer plugins for KRfb
|
||||
Comment[ast]=Complementu de buffer pa KRfb
|
||||
Comment[bg]=Приставки за фреймбуфер за KRfb
|
||||
Comment[bs]=Priključci framebafera za KRfb
|
||||
Comment[ca]=Connectors de «framebuffer» per al KRfb.
|
||||
Comment[ca@valencia]=Connectors de «framebuffer» per al KRfb.
|
||||
@@ -17,7 +16,7 @@ Comment[es]=Complementos de memoria intermedia de vídeo para KRfb
|
||||
Comment[et]=KRfb kaadripuhvri plugin
|
||||
Comment[eu]=Irteerako bideoaren pluginak KRfb-rentzako
|
||||
Comment[fi]=Kehyspuskuriliitännäinen kohteelle KRfb
|
||||
Comment[fr]=Modules externes de sortie vidéo pour Krfb
|
||||
Comment[fr]=Modules de sortie vidéo pour Krfb
|
||||
Comment[ga]=Breiseáin Mhaoláin Fráma le haghaidh KRfb
|
||||
Comment[gl]=Engadido de frame buffer para KRfb
|
||||
Comment[hr]=Priključci za međuspremnike okvira za KRfb
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# KDE Config File
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Exec=krfb -caption %c %i
|
||||
Exec=krfb -caption "%c" %i
|
||||
Icon=krfb
|
||||
X-DBUS-StartupType=Unique
|
||||
X-DocPath=krfb/index.html
|
||||
Terminal=false
|
||||
Name=Krfb
|
||||
@@ -43,7 +42,6 @@ Name[ko]=Krfb
|
||||
Name[lt]=Krfb
|
||||
Name[lv]=Krfb
|
||||
Name[ml]=കെആര്എഫ്ബി
|
||||
Name[mr]=के-आर-एफ-बी
|
||||
Name[nb]=Krfb
|
||||
Name[nds]=KRfb
|
||||
Name[ne]=Krfb
|
||||
@@ -85,7 +83,7 @@ GenericName[ca]=Compartició de l'escriptori
|
||||
GenericName[ca@valencia]=Compartició de l'escriptori
|
||||
GenericName[cs]=Sdílení pracovní plochy
|
||||
GenericName[cy]=Rhannu Penbwrdd
|
||||
GenericName[da]=Skrivebordsdeling
|
||||
GenericName[da]=Desktopdeling
|
||||
GenericName[de]=Arbeitsfläche freigeben
|
||||
GenericName[el]=Κοινή χρήση επιφάνειας εργασίας
|
||||
GenericName[en_GB]=Desktop Sharing
|
||||
@@ -95,7 +93,7 @@ GenericName[et]=Töölaua jagamine
|
||||
GenericName[eu]=Mahaigaina partekatzea
|
||||
GenericName[fa]=اشتراک رومیزی
|
||||
GenericName[fi]=Työpöydän jakaminen
|
||||
GenericName[fr]=Partage de bureaux
|
||||
GenericName[fr]=Partage de bureau
|
||||
GenericName[ga]=Roinnt Deisce
|
||||
GenericName[gl]=Compartimento de escritorio
|
||||
GenericName[he]=שיתוף שולחנות עבודה
|
||||
@@ -113,7 +111,6 @@ GenericName[ko]=데스크톱 공유
|
||||
GenericName[lt]=Dalinimasis darbastaliu
|
||||
GenericName[lv]=Darbvirsmas koplietošana
|
||||
GenericName[ml]=പണിയിടം പങ്കുവെക്കല്
|
||||
GenericName[mr]=डेस्कटॉप शेअरींग
|
||||
GenericName[nb]=Delte skrivebord
|
||||
GenericName[nds]=Schriefdisch-Freegaav
|
||||
GenericName[ne]=डेस्कटप साझेदारी
|
||||
@@ -127,7 +124,7 @@ GenericName[ro]=Partajare birou
|
||||
GenericName[ru]=Общий рабочий стол
|
||||
GenericName[si]=වැඩතල හවුල්
|
||||
GenericName[sk]=Zdieľanie pracovnej plochy
|
||||
GenericName[sl]=Souporaba namizja
|
||||
GenericName[sl]=Deljenje namizja
|
||||
GenericName[sr]=Дељење површи
|
||||
GenericName[sr@ijekavian]=Дијељење површи
|
||||
GenericName[sr@ijekavianlatin]=Dijeljenje površi
|
||||
|
||||
@@ -22,14 +22,15 @@
|
||||
<label>Allow remote connections to manage the desktop.</label>
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="allowUnattendedAccess" type="Bool">
|
||||
<entry name="askOnConnect" type="Bool">
|
||||
<label>Ask before allowing a remote connection.</label>
|
||||
<default>true</default>
|
||||
</entry>
|
||||
<entry name="allowUninvitedConnections" type="Bool">
|
||||
<label>Allow connections without an invitation.</label>
|
||||
<default>false</default>
|
||||
</entry>
|
||||
<entry name="unattendedAccessPassword" type="String">
|
||||
<label>Password for uninvited connections.</label>
|
||||
</entry>
|
||||
<entry name="desktopSharingPassword" type="String">
|
||||
<entry name="uninvitedConnectionPassword" type="String">
|
||||
<label>Password for uninvited connections.</label>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
@@ -12,7 +12,7 @@ Comment[ca]=Compartició de l'escriptori
|
||||
Comment[ca@valencia]=Compartició de l'escriptori
|
||||
Comment[cs]=Sdílení pracovní plochy
|
||||
Comment[cy]=Rhannu Penbwrdd
|
||||
Comment[da]=Skrivebordsdeling
|
||||
Comment[da]=Desktopdeling
|
||||
Comment[de]=Arbeitsflächen-Freigabe
|
||||
Comment[el]=Κοινή χρήση επιφάνειας εργασίας
|
||||
Comment[en_GB]=Desktop Sharing
|
||||
@@ -21,7 +21,7 @@ Comment[es]=Escritorio compartido
|
||||
Comment[et]=Töölaua jagamine
|
||||
Comment[eu]=Mahaigaina partekatzea
|
||||
Comment[fi]=Työpöydän jakaminen
|
||||
Comment[fr]=Partage de bureaux
|
||||
Comment[fr]=Partage du bureau
|
||||
Comment[ga]=Roinnt Deisce
|
||||
Comment[gl]=Compartición do escritorio
|
||||
Comment[he]=שיתוף שולחנות עבודה
|
||||
@@ -40,7 +40,6 @@ Comment[lt]=Dalinimasis darbastaliu
|
||||
Comment[lv]=Darbvirsmas koplietošana
|
||||
Comment[mk]=Делење на работната површина
|
||||
Comment[ml]=പണിയിടം പങ്കുവെക്കല്
|
||||
Comment[mr]=डेस्कटॉप शेअरींग
|
||||
Comment[ms]=Perkongsian Ruang Kerja
|
||||
Comment[nb]=Delte skrivebord
|
||||
Comment[nds]=Schriefdisch-Freegaav
|
||||
@@ -54,7 +53,7 @@ Comment[ro]=Partajare birou
|
||||
Comment[ru]=Параметры общего рабочего стола
|
||||
Comment[si]=වැඩතල හවුල්
|
||||
Comment[sk]=Zdieľanie pracovnej plochy
|
||||
Comment[sl]=Souporaba namizja
|
||||
Comment[sl]=Deljenje namizja
|
||||
Comment[sr]=Дељење површи
|
||||
Comment[sr@ijekavian]=Дијељење површи
|
||||
Comment[sr@ijekavianlatin]=Dijeljenje površi
|
||||
@@ -107,7 +106,6 @@ Name[ko]=사용자가 연결을 수락함
|
||||
Name[lt]=Naudotojas priėmė kvietimą
|
||||
Name[lv]=Lietotājs atļauj savienojumu
|
||||
Name[ml]=ഉപയോക്താവ് ബന്ധം സ്വീകരിക്കുന്നു
|
||||
Name[mr]=वापरकर्ता जुळवणी स्वीकारतो
|
||||
Name[nb]=Bruker godtar tilkobling
|
||||
Name[nds]=Bruker lett tokoppeln to
|
||||
Name[nl]=Gebruiker accepteert de verbinding
|
||||
@@ -120,7 +118,7 @@ Name[ro]=Utilizatorul acceptă conexiunea
|
||||
Name[ru]=Пользователь принимает соединения
|
||||
Name[si]=සබැඳිය පරිශීලකයා තහවුරු කරයි
|
||||
Name[sk]=Užívateľ akceptuje pripojenie
|
||||
Name[sl]=Uporabnik sprejema povezavo
|
||||
Name[sl]=Uporabnik sprejel povezavo
|
||||
Name[sr]=Корисник прихвата везу
|
||||
Name[sr@ijekavian]=Корисник прихвата везу
|
||||
Name[sr@ijekavianlatin]=Korisnik prihvata vezu
|
||||
@@ -128,7 +126,6 @@ Name[sr@latin]=Korisnik prihvata vezu
|
||||
Name[sv]=Användaren accepterar anslutning
|
||||
Name[th]=ผู้ใช้ยอมรับการเชื่อมต่อ
|
||||
Name[tr]=Kullanıcı Bağlantıyı Kabul Etti
|
||||
Name[ug]=ئىشلەتكۈچى باغلىنىشقا قوشۇلدى
|
||||
Name[uk]=Користувач приймає з’єднання
|
||||
Name[x-test]=xxUser Accepts Connectionxx
|
||||
Name[zh_CN]=用户接受连接
|
||||
@@ -172,7 +169,6 @@ Comment[lt]=Naudotojas priėmė kvietimą
|
||||
Comment[lv]=Lietotājs atļauj savienojumu
|
||||
Comment[mk]=Корисникот прифаќа поврзување
|
||||
Comment[ml]=ഉപയോക്താവ് ബന്ധം സ്വീകരിക്കുന്നു
|
||||
Comment[mr]=वापरकर्ता जुळवणी स्वीकारतो
|
||||
Comment[ms]= Pengguna menerima sambungan
|
||||
Comment[nb]=Bruker godtar tilkobling
|
||||
Comment[nds]=Bruker nimmt Tokoppelanfraag an
|
||||
@@ -186,7 +182,7 @@ Comment[ro]=Utilizatorul acceptă conexiunea
|
||||
Comment[ru]=Пользователь принимает соединения
|
||||
Comment[si]=සබැඳිය පරිශීලකයා තහවුරු කරයි
|
||||
Comment[sk]=Užívateľ akceptuje pripojenie
|
||||
Comment[sl]=Uporabnik sprejema povezavo
|
||||
Comment[sl]=Uporabnik sprejel povezavo
|
||||
Comment[sr]=Корисник прихвата везу
|
||||
Comment[sr@ijekavian]=Корисник прихвата везу
|
||||
Comment[sr@ijekavianlatin]=Korisnik prihvata vezu
|
||||
@@ -196,7 +192,6 @@ Comment[ta]=பயனர் இணைப்பு ஏற்றுக்கொள
|
||||
Comment[tg]=Корванд пайвастшавиро қабул мекунад
|
||||
Comment[th]=ผู้ใช้ยอมรับการเชื่อมต่อ
|
||||
Comment[tr]=Kullanıcı bağlantıyı kabul etti
|
||||
Comment[ug]=ئىشلەتكۈچى باغلىنىشقا قوشۇلدى
|
||||
Comment[uk]=Користувач приймає з’єднання
|
||||
Comment[xh]=Umsebenzisi wamkela uxhulumaniso
|
||||
Comment[x-test]=xxUser accepts connectionxx
|
||||
@@ -240,7 +235,6 @@ Name[ko]=사용자가 연결을 거부함
|
||||
Name[lt]=Naudotojas atmetė kvietimą
|
||||
Name[lv]=Lietotājs noraida savienojumu
|
||||
Name[ml]=ഉപയോക്താവ് ബന്ധം തിരസ്കരിക്കുന്നു
|
||||
Name[mr]=वापरकर्ता जुळवणी अस्वीकारतो
|
||||
Name[nb]=Bruker nekter tilkobling
|
||||
Name[nds]=Bruker wiest tokoppeln af
|
||||
Name[nl]=Gebruiker weigert de verbinding
|
||||
@@ -253,7 +247,7 @@ Name[ro]=Utilizatorul refuză conexiunea
|
||||
Name[ru]=Пользователь отклоняет соединения
|
||||
Name[si]=සබැඳිය පරිශීලකයා තහවුරු නොකරයි
|
||||
Name[sk]=Užívateľ odmieta pripojenie
|
||||
Name[sl]=Uporabnik zavrača povezavo
|
||||
Name[sl]=Uporabnik zavrnil povezavo
|
||||
Name[sr]=Корисник одбија везу
|
||||
Name[sr@ijekavian]=Корисник одбија везу
|
||||
Name[sr@ijekavianlatin]=Korisnik odbija vezu
|
||||
@@ -261,7 +255,6 @@ Name[sr@latin]=Korisnik odbija vezu
|
||||
Name[sv]=Användaren vägrar anslutning
|
||||
Name[th]=ผู้ใช้ปฏิเสธการเชื่อมต่อ
|
||||
Name[tr]=Kullanıcı Bağlantıyı Reddetti
|
||||
Name[ug]=ئىشلەتكۈچى باغلىنىشنى رەت قىلدى
|
||||
Name[uk]=Користувач не приймає з’єднання
|
||||
Name[x-test]=xxUser Refuses Connectionxx
|
||||
Name[zh_CN]=用户拒绝连接
|
||||
@@ -288,7 +281,7 @@ Comment[eu]=Erabiltzaileak konexioa ukatu du
|
||||
Comment[fi]=Käyttäjä hylkää yhteyden
|
||||
Comment[fr]=L'utilisateur refuse la connexion
|
||||
Comment[ga]=Diúltaíonn úsáideoir ceangal
|
||||
Comment[gl]=O usuario rexeita a conexión
|
||||
Comment[gl]=O usuario non acepta a conexión
|
||||
Comment[he]=המשתמש מסרב לחיבור
|
||||
Comment[hi]=उपयोक्ता ने कनेक्शन अस्वीकारा
|
||||
Comment[hne]=कमइया हर कनेक्सन अस्वीकारा
|
||||
@@ -305,7 +298,6 @@ Comment[lt]=Naudotojas atmetė kvietimą
|
||||
Comment[lv]=Lietotājs noraida savienojumu
|
||||
Comment[mk]=Корисникот одбива поврзување
|
||||
Comment[ml]=ഉപയോക്താവ് ബന്ധം തിരസ്കരിക്കുന്നു
|
||||
Comment[mr]=वापरकर्ता जुळवणी अस्वीकारतो
|
||||
Comment[ms]=Pengguna menolak sambungan
|
||||
Comment[nb]=Bruker nekter tilkobling
|
||||
Comment[nds]=Bruker wiest Tokoppelanfraag af
|
||||
@@ -319,7 +311,7 @@ Comment[ro]=Utilizatorul refuză conexiunea
|
||||
Comment[ru]=Пользователь отклоняет соединения
|
||||
Comment[si]=සබැඳිය පරිශීලකයා තහවුරු නොකරයි
|
||||
Comment[sk]=Užívateľ odmieta pripojenie
|
||||
Comment[sl]=Uporabnik zavrača povezavo
|
||||
Comment[sl]=Uporabnik zavrnil povezavo
|
||||
Comment[sr]=Корисник одбија везу
|
||||
Comment[sr@ijekavian]=Корисник одбија везу
|
||||
Comment[sr@ijekavianlatin]=Korisnik odbija vezu
|
||||
@@ -329,7 +321,6 @@ Comment[ta]=பயனர் இணைப்பு ஏற்க மறுக்
|
||||
Comment[tg]=Корванд пайвастшавиро рад мекунад
|
||||
Comment[th]=ผู้ใช้ปฏิเสธการเชื่อมต่อ
|
||||
Comment[tr]=Kullanıcı bağlantıyı reddetti
|
||||
Comment[ug]=ئىشلەتكۈچى باغلىنىشنى رەت قىلدى
|
||||
Comment[uk]=Користувач не приймає з’єднання
|
||||
Comment[xh]=Umsebenzisi wala uxhulumaniso
|
||||
Comment[x-test]=xxUser refuses connectionxx
|
||||
@@ -374,7 +365,6 @@ Name[lt]=Ryšys baigtas
|
||||
Name[lv]=Savienojums slēgts
|
||||
Name[mai]=संबंधन बन्न भ' गेल
|
||||
Name[ml]=ബന്ധം അടച്ചു
|
||||
Name[mr]=जुळवणी बंद केली
|
||||
Name[nb]=Forbindelsen lukket
|
||||
Name[nds]=Afkoppelt
|
||||
Name[nl]=Verbinding gesloten
|
||||
@@ -396,7 +386,6 @@ Name[sr@latin]=Veza zatvorena
|
||||
Name[sv]=Anslutning stängd
|
||||
Name[th]=การเชื่อมต่อยุติ
|
||||
Name[tr]=Bağlantı Kapatıldı
|
||||
Name[ug]=باغلىنىش يېپىلدى
|
||||
Name[uk]=З'єднання закрито
|
||||
Name[x-test]=xxConnection Closedxx
|
||||
Name[zh_CN]=连接关闭
|
||||
@@ -422,7 +411,7 @@ Comment[es]=Conexión cerrada
|
||||
Comment[et]=Ühendus suletud
|
||||
Comment[eu]=Konexioa itxi da
|
||||
Comment[fi]=Yhteys suljettu
|
||||
Comment[fr]=Connexion fermée
|
||||
Comment[fr]=Connexion coupée
|
||||
Comment[ga]=Ceangal dúnta
|
||||
Comment[gl]=A conexión está fechada
|
||||
Comment[he]=החיבור נסגר
|
||||
@@ -441,11 +430,10 @@ Comment[lt]=Ryšys baigtas
|
||||
Comment[lv]=Savienojums tika slēgts
|
||||
Comment[mk]=Поврзувањето е затворено
|
||||
Comment[ml]=ബന്ധം അടച്ചു
|
||||
Comment[mr]=जुळवणी बंद केली
|
||||
Comment[ms]=Sambungan ditutup
|
||||
Comment[nb]=Forbindelsen lukket
|
||||
Comment[nds]=Afkoppelt
|
||||
Comment[nl]=Verbinding gesloten
|
||||
Comment[nl]=Verbinding verbroken
|
||||
Comment[nn]=Tilkoplinga vart avslutta
|
||||
Comment[pa]=ਕੁਨੈਕਸ਼ਨ ਬੰਦ ਕੀਤਾ
|
||||
Comment[pl]=Połączenie zakończone
|
||||
@@ -512,7 +500,6 @@ Name[ko]=잘못된 암호
|
||||
Name[lt]=Neteisingas slaptažodžis
|
||||
Name[lv]=Nederīga parole
|
||||
Name[ml]=അസാധുവായ അടയാളവാക്ക്
|
||||
Name[mr]=अवैध गुप्तशब्द
|
||||
Name[nb]=Ugyldig passord
|
||||
Name[nds]=Leeg Passwoort
|
||||
Name[nl]=Ongeldig wachtwoord
|
||||
@@ -581,7 +568,6 @@ Comment[lv]=Parole nav derīga
|
||||
Comment[mai]=अवैध कूटशब्द
|
||||
Comment[mk]=Невалидна лозинка
|
||||
Comment[ml]=അസാധുവായ അടയാളവാക്ക്
|
||||
Comment[mr]=अवैध गुप्तशब्द
|
||||
Comment[ms]=Kata laluan tidak sah
|
||||
Comment[nb]=Ugyldig passord
|
||||
Comment[nds]=Leeg Passwoort
|
||||
@@ -637,7 +623,7 @@ Name[es]=Contraseñas de invitaciones incorrectas
|
||||
Name[et]=Kutsutu vale parool
|
||||
Name[eu]=Gonbitearen pasahitza baliogabea
|
||||
Name[fi]=Virheellinen salasana kutsuun
|
||||
Name[fr]=Invitations de mots de passe non valables
|
||||
Name[fr]=Invitations de mot de passe non valables
|
||||
Name[ga]=Cuirí Neamhbhailí Focal Faire
|
||||
Name[gl]=O contrasinal de convidado non válido
|
||||
Name[hi]=अवैध पासवर्ड निमंत्रण
|
||||
@@ -654,7 +640,6 @@ Name[ko]=잘못된 암호 초대장
|
||||
Name[lt]=Neteisingas kvietimo slaptažodis
|
||||
Name[lv]=Nepareiza parole ar ielūgumu
|
||||
Name[ml]=അസാധുവായ അടയാളവാക്ക് ക്ഷണങ്ങള്
|
||||
Name[mr]=अवैध गुप्तशब्द निमंत्रण
|
||||
Name[nb]=Ugyldig invitasjonspassord
|
||||
Name[nds]=Leeg Passwoort bi Inladen
|
||||
Name[nl]=Ongeldig wachtwoord uitnodiging
|
||||
@@ -675,7 +660,6 @@ Name[sr@latin]=Neispravna lozinka pozivnice
|
||||
Name[sv]=Ogiltigt lösenord vid inbjudan
|
||||
Name[th]=รหัสผ่านของการเชื้อเชิญไม่ถูกต้อง
|
||||
Name[tr]=Geçersiz Parola Daveti
|
||||
Name[ug]=ئىناۋەتسىز ئىم تەكلىپلىرى
|
||||
Name[uk]=Запрошення з некоректними паролями
|
||||
Name[x-test]=xxInvalid Password Invitationsxx
|
||||
Name[zh_CN]=无效密码邀请
|
||||
@@ -741,7 +725,6 @@ Comment[ta]=அழைத்த நபர் தவறான கடவுச்
|
||||
Comment[tg]=Корванди дурдаст гузарвожаи нодурустро фиристод. Пайвастшавӣ манъ шудааст.
|
||||
Comment[th]=ผู้เข้าร่วมการเชิญชวนส่งรหัสผ่านมาไม่ถูกต้อง ทำการปฏิเสธการเชื่อมต่อ
|
||||
Comment[tr]=Davet edilenden gönderilmiş geçersiz parola. Bağlantı reddedildi.
|
||||
Comment[ug]=تەكلىپ قىلغۇچى ئەۋەتكەن ئىم ئىناۋەتسىز. باغلىنىش رەت قىلىندى.
|
||||
Comment[uk]=Запрошений учасник надіслав некоректний пароль. У з’єднанні відмовлено.
|
||||
Comment[xh]=Umhlangano omenyiweyo uthumele igama lokugqitha elisebenzayo. Uxhulumano lwa liwe.
|
||||
Comment[x-test]=xxThe invited party sent an invalid password. Connection refused.xx
|
||||
@@ -785,7 +768,6 @@ Name[ko]=새 연결 대기 중
|
||||
Name[lt]=Naujas kvietimas ryšiui sulaikytas
|
||||
Name[lv]=Jauns savienojums gaida
|
||||
Name[ml]=പുതിയ ബന്ധം തത്കാലം നിര്ത്തിയിരിയ്ക്കുന്നു
|
||||
Name[mr]=नवीन जुळवणी थांबविलेली आहे
|
||||
Name[nb]=Ny tilkobling venter
|
||||
Name[nds]=Nieg Verbinnen töövt
|
||||
Name[nl]=Nieuwe verbinding in de wacht
|
||||
@@ -830,7 +812,7 @@ Comment[es]=Conexión solicitada, el usuario debe aceptarla
|
||||
Comment[et]=Nõutakse ühendust, kasutaja peab seda lubama
|
||||
Comment[eu]=Konexioa eskatuta, erabiltzaileak onartu behar du
|
||||
Comment[fi]=Pyydettiin yhteyttä, käyttäjän tulee hyväksyä
|
||||
Comment[fr]=Connexion demandée. L'utilisateur doit accepter
|
||||
Comment[fr]=Connexion demandée, l'utilisateur doit accepter
|
||||
Comment[ga]=Ceangal iarrtha; ní mór don úsáideoir glacadh leis
|
||||
Comment[gl]=Pediuse a conexión; o usuario debe aceptar
|
||||
Comment[he]=נתבקש חיבור, על המשתמש לקבלו
|
||||
@@ -872,7 +854,6 @@ Comment[ta]=இணைப்பு கோரப்பட்டது, பயன
|
||||
Comment[tg]=Пайвастшавӣ дархоста шудааст, корванд бояд қабул кунад
|
||||
Comment[th]=มีการร้องขอเชื่อมต่อมา ผู้ใช้ต้องทำการยอมรับก่อน
|
||||
Comment[tr]=Bağlantı isteği, kullanıcı kabul etmeli
|
||||
Comment[ug]=باغلىنىش ئىلتىماس قىلىندى، ئىشلەتكۈچى قوشۇلۇشى كېرەك
|
||||
Comment[uk]=Отримано запит на з’єднання, користувач має його прийняти
|
||||
Comment[xh]=Uxhulumaniso luceliwe, umsebenzisi kufanele amkele
|
||||
Comment[x-test]=xxConnection requested, user must acceptxx
|
||||
@@ -899,7 +880,7 @@ Name[es]=Conexión nueva aceptada automáticamente
|
||||
Name[et]=Uue ühendusega automaatselt nõus
|
||||
Name[eu]=Konexio berria automatikoki onartuta
|
||||
Name[fi]=Uusi yhteys hyväksyttiin automaattisesti
|
||||
Name[fr]=Nouvelle connexion acceptée automatiquement
|
||||
Name[fr]=Nouvelle connexion auto-acceptée
|
||||
Name[ga]=Ceangal nua bunaithe go huathoibríoch
|
||||
Name[gl]=Nova conexión aceptada automaticamente
|
||||
Name[hi]=नय कनेक्शन स्वचालित स्वीकारा
|
||||
@@ -936,7 +917,6 @@ Name[sr@latin]=Nova veza je automatski prihvaćena
|
||||
Name[sv]=Ny anslutning accepterades automatiskt
|
||||
Name[th]=รับการเชื่อมต่อใหม่โดยอัตโนมัติ
|
||||
Name[tr]=Yeni Bağlantı Otomatik olarak Kabul Edildi
|
||||
Name[ug]=يېڭى باغلىنىش ئۆزلۈكىدىن قوشۇلدى
|
||||
Name[uk]=Нове з’єднання автоматично прийнято
|
||||
Name[x-test]=xxNew Connection Auto Acceptedxx
|
||||
Name[zh_CN]=新连接自动接受
|
||||
@@ -1003,7 +983,6 @@ Comment[ta]=இணைப்புகள் தானாக உருவாக்
|
||||
Comment[tg]=Пайвастшавии нав ба таври худкор барпо мегардад
|
||||
Comment[th]=การเชื่อมต่อใหม่จะถูกทำการเชื่อมต่อโดยอัตโนมัติ
|
||||
Comment[tr]=Yeni bağlantı otomatik olarak kuruldu
|
||||
Comment[ug]=يېڭى باغلىنىش ئۆزلۈكىدىن قۇرۇلدى
|
||||
Comment[uk]=Автоматично встановлено нове з’єднання
|
||||
Comment[xh]=Uxhulumaniso olutsha lufunyenwe ngokuzenzekelayo
|
||||
Comment[x-test]=xxNew connection automatically establishedxx
|
||||
@@ -1067,7 +1046,6 @@ Name[sr@latin]=Isuviše veza
|
||||
Name[sv]=För många anslutningar
|
||||
Name[th]=มีการเชื่อมต่อมากเกินไป
|
||||
Name[tr]=Çok Fazla Bağlantı
|
||||
Name[ug]=باغلىنىش بەك كۆپ
|
||||
Name[uk]=Забагато з’єднань
|
||||
Name[x-test]=xxToo Many Connectionsxx
|
||||
Name[zh_CN]=连接过多
|
||||
@@ -1081,7 +1059,7 @@ Comment[bn]=ব্যস্ত, সংযোগ অস্বীকার কর
|
||||
Comment[br]=Dalc'het, kevreadenn disteuleret
|
||||
Comment[bs]=Zauzeto, veza je odbijena
|
||||
Comment[ca]=Ocupat, connexió rebutjada
|
||||
Comment[ca@valencia]=Ocupat, connexió rebutjada
|
||||
Comment[ca@valencia]=Ocupat, connexió refusada
|
||||
Comment[cs]=Zaneprázdněn, spojení odmítnuto
|
||||
Comment[cy]=Prysur, gwrthodwyd y cysylltiad
|
||||
Comment[da]=Optaget, forbindelse afslået
|
||||
@@ -1093,7 +1071,7 @@ Comment[es]=Ocupado, conexión rechazada
|
||||
Comment[et]=Hõivatud, ühendusest keelduti
|
||||
Comment[eu]=Lanpetuta, konexioa ukatu da
|
||||
Comment[fi]=Varattu, yhteys hylättiin
|
||||
Comment[fr]=Occupé. Connexion refusée
|
||||
Comment[fr]=Occupé, connexion refusée
|
||||
Comment[ga]=Gnóthach; ceangal diúltaithe
|
||||
Comment[gl]=Ocupado; a conexión foi rexeitada
|
||||
Comment[he]=תפוס, החיבור נדחה
|
||||
@@ -1135,7 +1113,6 @@ Comment[ta]=வேலையில் உள்ளது, இணைப்பு
|
||||
Comment[tg]=Банд, пайвастшавӣ рад гардидааст
|
||||
Comment[th]=ยังไม่ว่าง ทำการปฏิเสธการเชื่อมต่อ
|
||||
Comment[tr]=Meşgul, bağlantı reddedildi
|
||||
Comment[ug]=ئالدىراش، باغلىنىش رەت قىلىندى
|
||||
Comment[uk]=Зайнято, у з’єднанні відмовлено
|
||||
Comment[uz]=Band, aloqa rad etildi
|
||||
Comment[uz@cyrillic]=Банд, алоқа рад этилди
|
||||
@@ -1227,7 +1204,7 @@ Comment[es]=Recibida conexión inesperada, interrumpir
|
||||
Comment[et]=Saadi ootamatu ühendus, loobuti
|
||||
Comment[eu]=Ustekabeko konexioa jaso da, abortatzen
|
||||
Comment[fi]=Vastaanotettiin odottamaton yhteys, lopeta
|
||||
Comment[fr]=Connexion inattendue reçue. Annulation
|
||||
Comment[fr]=Reçu une connexion inattendue, interruption
|
||||
Comment[ga]=Fuarthas ceangal gan choinne, á thobscor
|
||||
Comment[gl]=Recibiuse unha conexión non agardada; cancélase
|
||||
Comment[he]=נתקבל חיבור בלתי צפוי, בוטל
|
||||
@@ -1268,7 +1245,6 @@ Comment[ta]=எதிர்பாராத இணைப்பு, நிறு
|
||||
Comment[tg]=Пайвастшавии ғайричашмдош қабул гардид, кандашавӣ
|
||||
Comment[th]=ได้รับการเชื่อมต่อมาอย่างไม่คาดคิด ทำการยกเลิก
|
||||
Comment[tr]=Beklenmeyen bir bağlantı alındı, vazgeçiliyor
|
||||
Comment[ug]=ئويلاشمىغان باغلىنىشنى تاپشۇرۇۋالدى، توختات
|
||||
Comment[uk]=Отримано з’єднання, яке не очікувалось, припиняється
|
||||
Comment[xh]=Ufumene uxhulumaniso olungalindelekanga, lahla
|
||||
Comment[x-test]=xxReceived unexpected connection, abortxx
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
* *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "manageinvitationsdialog.h"
|
||||
#include "trayicon.h"
|
||||
#include "invitationsrfbserver.h"
|
||||
|
||||
#include <KAboutApplicationDialog>
|
||||
#include <KAboutData>
|
||||
#include <KAction>
|
||||
#include <KUniqueApplication>
|
||||
#include <KApplication>
|
||||
#include <KCmdLineArgs>
|
||||
#include <KDebug>
|
||||
#include <KLocale>
|
||||
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
||||
options.add("nodialog", ki18n("Do not show the invitations management dialog at startup"));
|
||||
KCmdLineArgs::addCmdLineOptions(options);
|
||||
|
||||
KUniqueApplication app;
|
||||
KApplication app;
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
|
||||
if (!checkX11Capabilities()) {
|
||||
@@ -108,13 +108,13 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
//init the GUI
|
||||
MainWindow mainWindow;
|
||||
TrayIcon trayicon(&mainWindow);
|
||||
ManageInvitationsDialog invitationsDialog;
|
||||
TrayIcon trayicon(&invitationsDialog);
|
||||
|
||||
if (app.isSessionRestored() && KMainWindow::canBeRestored(1)) {
|
||||
mainWindow.restore(1, false);
|
||||
invitationsDialog.restore(1, false);
|
||||
} else if (KCmdLineArgs::parsedArgs()->isSet("dialog")) {
|
||||
mainWindow.show();
|
||||
invitationsDialog.show();
|
||||
}
|
||||
|
||||
sigset_t sigs;
|
||||
|
||||
@@ -1,264 +0,0 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
Copyright (C) 2013 Amandeep Singh <aman.dedman@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#include "mainwindow.h"
|
||||
#include "invitationsrfbserver.h"
|
||||
|
||||
#include "krfbconfig.h"
|
||||
#include "ui_configtcp.h"
|
||||
#include "ui_configsecurity.h"
|
||||
|
||||
#include <KConfigDialog>
|
||||
#include <KIcon>
|
||||
#include <KLocale>
|
||||
#include <KMessageBox>
|
||||
#include <KStandardGuiItem>
|
||||
#include <KSystemTimeZone>
|
||||
#include <KToolInvocation>
|
||||
#include <KStandardAction>
|
||||
#include <KActionCollection>
|
||||
#include <KLineEdit>
|
||||
#include <KNewPasswordDialog>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QSizePolicy>
|
||||
#include <QtNetwork/QNetworkInterface>
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
#include "tubesrfbserver.h"
|
||||
#include <TelepathyQt/PendingReady>
|
||||
#include <TelepathyQt/PendingChannelRequest>
|
||||
#include <KTp/actions.h>
|
||||
#include <KTp/Widgets/contact-view-widget.h>
|
||||
#include <KTp/Models/contacts-list-model.h>
|
||||
#include <KTp/Models/contacts-filter-model.h>
|
||||
#endif
|
||||
|
||||
class TCP: public QWidget, public Ui::TCP
|
||||
{
|
||||
public:
|
||||
TCP(QWidget *parent = 0) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
class Security: public QWidget, public Ui::Security
|
||||
{
|
||||
public:
|
||||
Security(QWidget *parent = 0) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
MainWindow::MainWindow(QWidget *parent)
|
||||
: KXmlGuiWindow(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
||||
m_passwordEditable = false;
|
||||
m_passwordLineEdit = new KLineEdit(this);
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_passwordLineEdit->setAlignment(Qt::AlignHCenter);
|
||||
|
||||
QWidget *mainWidget = new QWidget;
|
||||
m_ui.setupUi(mainWidget);
|
||||
m_ui.krfbIconLabel->setPixmap(KIcon("krfb").pixmap(128));
|
||||
m_ui.enableUnattendedCheckBox->setChecked(
|
||||
InvitationsRfbServer::instance->allowUnattendedAccess());
|
||||
|
||||
setCentralWidget(mainWidget);
|
||||
|
||||
connect(m_ui.passwordEditButton,SIGNAL(clicked()),
|
||||
this,SLOT(editPassword()));
|
||||
connect(m_ui.enableSharingCheckBox,SIGNAL(toggled(bool)),
|
||||
this, SLOT(toggleDesktopSharing(bool)));
|
||||
connect(m_ui.enableUnattendedCheckBox, SIGNAL(toggled(bool)),
|
||||
InvitationsRfbServer::instance, SLOT(toggleUnattendedAccess(bool)));
|
||||
connect(m_ui.unattendedPasswordButton, SIGNAL(clicked()),
|
||||
this, SLOT(editUnattendedPassword()));
|
||||
connect(m_ui.addressAboutButton, SIGNAL(clicked()),
|
||||
this, SLOT(aboutConnectionAddress()));
|
||||
connect(m_ui.unattendedAboutButton, SIGNAL(clicked()),
|
||||
this, SLOT(aboutUnattendedMode()));
|
||||
connect(InvitationsRfbServer::instance, SIGNAL(passwordChanged(const QString&)),
|
||||
this, SLOT(passwordChanged(const QString&)));
|
||||
|
||||
// Figure out the address
|
||||
int port = KrfbConfig::port();
|
||||
QList<QNetworkInterface> interfaceList = QNetworkInterface::allInterfaces();
|
||||
foreach(const QNetworkInterface & interface, interfaceList) {
|
||||
if(interface.flags() & QNetworkInterface::IsLoopBack)
|
||||
continue;
|
||||
|
||||
if(interface.flags() & QNetworkInterface::IsRunning &&
|
||||
!interface.addressEntries().isEmpty())
|
||||
m_ui.addressDisplayLabel->setText(QString("%1 : %2")
|
||||
.arg(interface.addressEntries().first().ip().toString())
|
||||
.arg(port));
|
||||
}
|
||||
|
||||
//Figure out the password
|
||||
m_ui.passwordDisplayLabel->setText(
|
||||
InvitationsRfbServer::instance->desktopPassword());
|
||||
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
|
||||
m_contactViewWidget = new KTp::ContactViewWidget(
|
||||
TubesRfbServer::instance->contactsListModel(), this);
|
||||
|
||||
m_contactViewWidget->setEnabled(false);
|
||||
connect(m_ui.enableSharingCheckBox, SIGNAL(toggled(bool)),
|
||||
m_contactViewWidget, SLOT(setEnabled(bool)));
|
||||
m_contactViewWidget->setIconSize(QSize(32,32));
|
||||
m_contactViewWidget->setMinimumWidth(120);
|
||||
m_contactViewWidget->setMaximumWidth(360);
|
||||
m_contactViewWidget->setMinimumHeight(300);
|
||||
m_contactViewWidget->contactFilterLineEdit()->setClickMessage(i18n("Search in Contacts..."));
|
||||
m_contactViewWidget->filter()->setPresenceTypeFilterFlags(KTp::ContactsFilterModel::ShowOnlyConnected);
|
||||
m_contactViewWidget->filter()->setTubesFilterStrings(QStringList("rfb"));
|
||||
m_contactViewWidget->filter()->setCapabilityFilterFlags(KTp::ContactsFilterModel::FilterByTubes);
|
||||
|
||||
m_contactViewWidget->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
|
||||
m_ui.tpContactsLayout->addWidget(m_contactViewWidget);
|
||||
connect(m_contactViewWidget, SIGNAL(contactDoubleClicked(const Tp::AccountPtr &, const KTp::ContactPtr &)),
|
||||
this, SLOT(onContactDoubleClicked(const Tp::AccountPtr &, const KTp::ContactPtr &)));
|
||||
#endif
|
||||
|
||||
|
||||
KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection());
|
||||
KStandardAction::preferences(this, SLOT(showConfiguration()), actionCollection());
|
||||
|
||||
setupGUI();
|
||||
|
||||
setAutoSaveSettings();
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
}
|
||||
|
||||
void MainWindow::editPassword()
|
||||
{
|
||||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_ui.passwordEditButton->setIcon(KIcon("document-properties"));
|
||||
m_ui.passwordGridLayout->removeWidget(m_passwordLineEdit);
|
||||
InvitationsRfbServer::instance->setDesktopPassword(
|
||||
m_passwordLineEdit->text());
|
||||
m_ui.passwordDisplayLabel->setText(
|
||||
InvitationsRfbServer::instance->desktopPassword());
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
} else {
|
||||
m_passwordEditable = true;
|
||||
m_ui.passwordEditButton->setIcon(KIcon("document-save"));
|
||||
m_ui.passwordGridLayout->addWidget(m_passwordLineEdit,0,0);
|
||||
m_passwordLineEdit->setText(
|
||||
InvitationsRfbServer::instance->desktopPassword());
|
||||
m_passwordLineEdit->setVisible(true);
|
||||
m_passwordLineEdit->setFocus(Qt::MouseFocusReason);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::editUnattendedPassword()
|
||||
{
|
||||
KNewPasswordDialog dialog(this);
|
||||
dialog.setPrompt(i18n("Enter a new password for Unattended Access"));
|
||||
if(dialog.exec()) {
|
||||
InvitationsRfbServer::instance->setUnattendedPassword(dialog.password());
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::toggleDesktopSharing(bool enable)
|
||||
{
|
||||
if(enable) {
|
||||
if(!InvitationsRfbServer::instance->start()) {
|
||||
KMessageBox::error(this,
|
||||
i18n("Failed to start the krfb server. Desktop sharing "
|
||||
"will not work. Try setting another port in the settings "
|
||||
"and restart krfb."));
|
||||
}
|
||||
} else {
|
||||
InvitationsRfbServer::instance->stop();
|
||||
if(m_passwordEditable) {
|
||||
m_passwordEditable = false;
|
||||
m_passwordLineEdit->setVisible(false);
|
||||
m_ui.passwordEditButton->setIcon(KIcon("document-properties"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::passwordChanged(const QString& password)
|
||||
{
|
||||
m_passwordLineEdit->setText(password);
|
||||
m_ui.passwordDisplayLabel->setText(password);
|
||||
}
|
||||
|
||||
void MainWindow::aboutConnectionAddress()
|
||||
{
|
||||
KMessageBox::about(this,
|
||||
i18n("This field contains the address of your computer and the port number, separated by a colon.\n\nThe address is just a hint - you can use any address that can reach your computer.\n\nDesktop Sharing tries to guess your address from your network configuration, but does not always succeed in doing so.\n\nIf your computer is behind a firewall it may have a different address or be unreachable for other computers."),
|
||||
i18n("KDE Desktop Sharing"));
|
||||
}
|
||||
|
||||
void MainWindow::aboutUnattendedMode()
|
||||
{
|
||||
KMessageBox::about(this,
|
||||
i18n("Any remote user with normal desktop sharing password will have to be authenticated.\n\nIf unattended access is on, and the remote user provides unattended mode password, desktop sharing access will be granted without explicit confirmation."),
|
||||
i18n("KDE Desktop Sharing"));
|
||||
}
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
|
||||
void MainWindow::onContactDoubleClicked(const Tp::AccountPtr &account, const KTp::ContactPtr &contact)
|
||||
{
|
||||
Tp::PendingOperation *op = KTp::Actions::startDesktopSharing(account, contact);
|
||||
connect(op, SIGNAL(finished(Tp::PendingOperation*)),
|
||||
this, SLOT(pendingDesktopShareFinished(Tp::PendingOperation*)));
|
||||
}
|
||||
|
||||
void MainWindow::pendingDesktopShareFinished(Tp::PendingOperation *operation)
|
||||
{
|
||||
if(operation->isError()) {
|
||||
KMessageBox::error(this,
|
||||
operation->errorName() + ": " + operation->errorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void MainWindow::showConfiguration()
|
||||
{
|
||||
if (KConfigDialog::showDialog("settings")) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), "network-workgroup");
|
||||
dialog->addPage(new Security, i18n("Security"), "security-high");
|
||||
dialog->setHelp(QString(), "krfb");
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void MainWindow::readProperties(const KConfigGroup& group)
|
||||
{
|
||||
if (group.readEntry("Visible", true)) {
|
||||
show();
|
||||
}
|
||||
KMainWindow::readProperties(group);
|
||||
}
|
||||
|
||||
void MainWindow::saveProperties(KConfigGroup& group)
|
||||
{
|
||||
group.writeEntry("Visible", isVisible());
|
||||
KMainWindow::saveProperties(group);
|
||||
}
|
||||
|
||||
#include "mainwindow.moc"
|
||||
@@ -1,68 +0,0 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
Copyright (C) 2013 Amandeep Singh <aman.dedman@gmail.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MANAGEINVITATIONSDIALOG_H
|
||||
#define MANAGEINVITATIONSDIALOG_H
|
||||
|
||||
#include "ui_mainwidget.h"
|
||||
|
||||
#include <KXmlGuiWindow>
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
#include <KTp/contact.h>
|
||||
#include <TelepathyQt/PendingReady>
|
||||
namespace KTp {
|
||||
class ContactViewWidget;
|
||||
}
|
||||
namespace Tp {
|
||||
class PendingOperation;
|
||||
}
|
||||
#endif
|
||||
|
||||
class KLineEdit;
|
||||
|
||||
class MainWindow : public KXmlGuiWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
|
||||
public Q_SLOTS:
|
||||
void showConfiguration();
|
||||
|
||||
protected:
|
||||
virtual void readProperties(const KConfigGroup & group);
|
||||
virtual void saveProperties(KConfigGroup & group);
|
||||
|
||||
private Q_SLOTS:
|
||||
void editPassword();
|
||||
void editUnattendedPassword();
|
||||
void toggleDesktopSharing(bool enable);
|
||||
void passwordChanged(const QString&);
|
||||
void aboutConnectionAddress();
|
||||
void aboutUnattendedMode();
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
void onContactDoubleClicked(const Tp::AccountPtr &, const KTp::ContactPtr &);
|
||||
void pendingDesktopShareFinished(Tp::PendingOperation*);
|
||||
#endif
|
||||
|
||||
private:
|
||||
Ui::MainWidget m_ui;
|
||||
bool m_passwordEditable;
|
||||
KLineEdit *m_passwordLineEdit;
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
KTp::ContactViewWidget *m_contactViewWidget;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
253
krfb/manageinvitationsdialog.cpp
Normal file
253
krfb/manageinvitationsdialog.cpp
Normal file
@@ -0,0 +1,253 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
#include "manageinvitationsdialog.h"
|
||||
|
||||
#include "invitationmanager.h"
|
||||
#include "invitation.h"
|
||||
#include "krfbconfig.h"
|
||||
#include "personalinvitedialog.h"
|
||||
#include "ui_configtcp.h"
|
||||
#include "ui_configsecurity.h"
|
||||
|
||||
#include <KConfigDialog>
|
||||
#include <KGlobal>
|
||||
#include <KIconLoader>
|
||||
#include <KLocale>
|
||||
#include <KMessageBox>
|
||||
#include <KStandardGuiItem>
|
||||
#include <KSystemTimeZone>
|
||||
#include <KToolInvocation>
|
||||
#include <KStandardAction>
|
||||
#include <KActionCollection>
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include <QtGui/QToolTip>
|
||||
#include <QtGui/QCursor>
|
||||
#include <QtCore/QDateTime>
|
||||
#include <QtNetwork/QNetworkInterface>
|
||||
|
||||
class TCP: public QWidget, public Ui::TCP
|
||||
{
|
||||
public:
|
||||
TCP(QWidget *parent = 0) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
class Security: public QWidget, public Ui::Security
|
||||
{
|
||||
public:
|
||||
Security(QWidget *parent = 0) : QWidget(parent) {
|
||||
setupUi(this);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
ManageInvitationsDialog::ManageInvitationsDialog(QWidget *parent)
|
||||
: KXmlGuiWindow(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose, false);
|
||||
|
||||
QWidget *mainWidget = new QWidget;
|
||||
m_ui.setupUi(mainWidget);
|
||||
m_ui.pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
|
||||
setCentralWidget(mainWidget);
|
||||
|
||||
connect(m_ui.helpLabel, SIGNAL(linkActivated(QString)), SLOT(showWhatsthis()));
|
||||
connect(m_ui.newPersonalInvitationButton, SIGNAL(clicked()), SLOT(inviteManually()));
|
||||
connect(m_ui.newEmailInvitationButton, SIGNAL(clicked()), SLOT(inviteByMail()));
|
||||
connect(InvitationManager::self(), SIGNAL(invitationNumChanged(int)), SLOT(reloadInvitations()));
|
||||
connect(m_ui.deleteAllButton, SIGNAL(clicked()), SLOT(deleteAll()));
|
||||
connect(m_ui.deleteOneButton, SIGNAL(clicked()), SLOT(deleteCurrent()));
|
||||
connect(m_ui.invitationWidget, SIGNAL(itemSelectionChanged()), SLOT(selectionChanged()));
|
||||
|
||||
KStandardAction::quit(QCoreApplication::instance(), SLOT(quit()), actionCollection());
|
||||
KStandardAction::preferences(this, SLOT(showConfiguration()), actionCollection());
|
||||
|
||||
setupGUI(QSize(550, 330));
|
||||
setAutoSaveSettings();
|
||||
|
||||
reloadInvitations();
|
||||
}
|
||||
|
||||
ManageInvitationsDialog::~ManageInvitationsDialog()
|
||||
{
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::showWhatsthis()
|
||||
{
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
i18n("An invitation creates a one-time password that allows the receiver to connect to your desktop.\n"
|
||||
"It is valid for only one successful connection and will expire after an hour if it has not been used. \n"
|
||||
"When somebody connects to your computer a dialog will appear and ask you for permission.\n"
|
||||
"The connection will not be established before you accept it. In this dialog you can also\nrestrict "
|
||||
"the other person to view your desktop only, without the ability to move your\nmouse pointer or press "
|
||||
"keys.\nIf you want to create a permanent password for Desktop Sharing, allow 'Uninvited Connections' \n"
|
||||
"in the configuration."));
|
||||
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::inviteManually()
|
||||
{
|
||||
Invitation inv = InvitationManager::self()->addInvitation();
|
||||
PersonalInviteDialog *pid = new PersonalInviteDialog(this);
|
||||
pid->setPassword(inv.password());
|
||||
pid->setExpiration(inv.expirationTime());
|
||||
pid->show();
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::inviteByMail()
|
||||
{
|
||||
int r = KMessageBox::warningContinueCancel(this,
|
||||
i18n("When sending an invitation by email, note that everybody who reads this email "
|
||||
"will be able to connect to your computer for one hour, or until the first "
|
||||
"successful connection took place, whichever comes first. \n"
|
||||
"You should either encrypt the email or at least send it only in a "
|
||||
"secure network, but not over the Internet."),
|
||||
i18n("Send Invitation via Email"),
|
||||
KStandardGuiItem::cont(),
|
||||
KStandardGuiItem::cancel(),
|
||||
"showEmailInvitationWarning");
|
||||
|
||||
if (r == KMessageBox::Cancel) {
|
||||
return;
|
||||
}
|
||||
|
||||
QList<QNetworkInterface> ifl = QNetworkInterface::allInterfaces();
|
||||
QString host;
|
||||
int port = KrfbConfig::port();
|
||||
foreach(const QNetworkInterface & nif, ifl) {
|
||||
if (nif.flags() & QNetworkInterface::IsLoopBack) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nif.flags() & QNetworkInterface::IsRunning) {
|
||||
if (!nif.addressEntries().isEmpty()) {
|
||||
host = nif.addressEntries()[0].ip().toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Invitation inv = InvitationManager::self()->addInvitation();
|
||||
KUrl invUrl(QString("vnc://invitation:%1@%2:%3").arg(inv.password()).arg(host).arg(port));
|
||||
KToolInvocation::invokeMailer(QString(), QString(), QString(),
|
||||
i18n("Desktop Sharing (VNC) invitation"),
|
||||
ki18n("You have been invited to a VNC session. If you have the KDE Remote "
|
||||
"Desktop Connection installed, just click on the link below.\n\n"
|
||||
"%1\n\n"
|
||||
"Otherwise you can use any VNC client with the following parameters:\n\n"
|
||||
"Host: %2:%3\n"
|
||||
"Password: %4\n\n"
|
||||
"For security reasons this invitation will expire at %5 (%6).")
|
||||
.subs(invUrl.url())
|
||||
.subs(host)
|
||||
.subs(QString::number(port))
|
||||
.subs(inv.password())
|
||||
.subs(KGlobal::locale()->formatDateTime(inv.expirationTime()))
|
||||
.subs(KSystemTimeZones::local().name())
|
||||
.toString());
|
||||
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::reloadInvitations()
|
||||
{
|
||||
m_ui.invitationWidget->clear();
|
||||
KLocale *loc = KGlobal::locale();
|
||||
foreach(const Invitation & inv, InvitationManager::self()->invitations()) {
|
||||
QStringList strs;
|
||||
strs << loc->formatDateTime(inv.creationTime()) << loc->formatDateTime(inv.expirationTime());
|
||||
QTreeWidgetItem *it = new QTreeWidgetItem(strs);
|
||||
m_ui.invitationWidget->addTopLevelItem(it);
|
||||
it->setData(0, Qt::UserRole + 1, inv.creationTime());
|
||||
}
|
||||
m_ui.invitationWidget->resizeColumnToContents(0);
|
||||
m_ui.deleteAllButton->setEnabled(InvitationManager::self()->activeInvitations() > 0);
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::showConfiguration()
|
||||
{
|
||||
if (KConfigDialog::showDialog("settings")) {
|
||||
return;
|
||||
}
|
||||
|
||||
KConfigDialog *dialog = new KConfigDialog(this, "settings", KrfbConfig::self());
|
||||
dialog->addPage(new TCP, i18n("Network"), "network-workgroup");
|
||||
dialog->addPage(new Security, i18n("Security"), "security-high");
|
||||
dialog->setHelp(QString(), "krfb");
|
||||
dialog->show();
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::deleteAll()
|
||||
{
|
||||
if (KMessageBox::warningContinueCancel(this,
|
||||
i18n("<qt>Are you sure you want to delete all invitations?</qt>"),
|
||||
i18n("Confirm delete Invitations"),
|
||||
KStandardGuiItem::ok(),
|
||||
KStandardGuiItem::cancel(),
|
||||
QString("krfbdeleteallinv")) !=
|
||||
KMessageBox::Continue) {
|
||||
return;
|
||||
}
|
||||
|
||||
InvitationManager::self()->removeAllInvitations();
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::deleteCurrent()
|
||||
{
|
||||
if (KMessageBox::warningContinueCancel(this,
|
||||
i18n("<qt>Are you sure you want to delete this invitation?</qt>"),
|
||||
i18n("Confirm delete Invitations"),
|
||||
KStandardGuiItem::ok(),
|
||||
KStandardGuiItem::cancel(),
|
||||
QString("krfbdeleteoneinv")) !=
|
||||
KMessageBox::Continue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// disable updates while deleting items, otherwise the list would invalidate itself
|
||||
disconnect(InvitationManager::self(), SIGNAL(invitationNumChanged(int)),
|
||||
this, SLOT(reloadInvitations()));
|
||||
|
||||
QList<QTreeWidgetItem *> itl = m_ui.invitationWidget->selectedItems();
|
||||
foreach(QTreeWidgetItem * itm, itl) {
|
||||
foreach(const Invitation & inv, InvitationManager::self()->invitations()) {
|
||||
if (inv.creationTime() == itm->data(0, Qt::UserRole + 1)) {
|
||||
InvitationManager::self()->removeInvitation(inv);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update it manually
|
||||
reloadInvitations();
|
||||
|
||||
connect(InvitationManager::self(), SIGNAL(invitationNumChanged(int)),
|
||||
SLOT(reloadInvitations()));
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::selectionChanged()
|
||||
{
|
||||
m_ui.deleteOneButton->setEnabled(m_ui.invitationWidget->selectedItems().size() > 0);
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::readProperties(const KConfigGroup& group)
|
||||
{
|
||||
if (group.readEntry("Visible", true)) {
|
||||
show();
|
||||
}
|
||||
KMainWindow::readProperties(group);
|
||||
}
|
||||
|
||||
void ManageInvitationsDialog::saveProperties(KConfigGroup& group)
|
||||
{
|
||||
group.writeEntry("Visible", isVisible());
|
||||
KMainWindow::saveProperties(group);
|
||||
}
|
||||
|
||||
#include "manageinvitationsdialog.moc"
|
||||
|
||||
46
krfb/manageinvitationsdialog.h
Normal file
46
krfb/manageinvitationsdialog.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Alessandro Praduroux <pradu@pradu.it>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef MANAGEINVITATIONSDIALOG_H
|
||||
#define MANAGEINVITATIONSDIALOG_H
|
||||
|
||||
#include "ui_manageinvitations.h"
|
||||
|
||||
#include <KXmlGuiWindow>
|
||||
|
||||
/**
|
||||
@author Alessandro Praduroux <pradu@pradu.it>
|
||||
*/
|
||||
class ManageInvitationsDialog : public KXmlGuiWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ManageInvitationsDialog(QWidget *parent = 0);
|
||||
|
||||
~ManageInvitationsDialog();
|
||||
|
||||
public Q_SLOTS:
|
||||
void showWhatsthis();
|
||||
void inviteManually();
|
||||
void inviteByMail();
|
||||
void reloadInvitations();
|
||||
void showConfiguration();
|
||||
void deleteAll();
|
||||
void deleteCurrent();
|
||||
void selectionChanged();
|
||||
|
||||
protected:
|
||||
virtual void readProperties(const KConfigGroup & group);
|
||||
virtual void saveProperties(KConfigGroup & group);
|
||||
|
||||
private:
|
||||
Ui::ManageInvitationsDialog m_ui;
|
||||
};
|
||||
|
||||
#endif
|
||||
86
krfb/pendingrfbclient.cpp
Normal file
86
krfb/pendingrfbclient.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
Copyright (C) 2010 Collabora Ltd. <info@collabora.co.uk>
|
||||
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "pendingrfbclient.h"
|
||||
#include "connectiondialog.h"
|
||||
#include "krfbconfig.h"
|
||||
#include <KDebug>
|
||||
#include <KNotification>
|
||||
|
||||
PendingRfbClient::PendingRfbClient(rfbClientPtr client, QObject *parent)
|
||||
: QObject(parent), m_client(0), m_rfbClient(client)
|
||||
{
|
||||
QMetaObject::invokeMethod(this, "processNewClient", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void PendingRfbClient::accept()
|
||||
{
|
||||
kDebug() << "accepted connection";
|
||||
|
||||
Q_ASSERT(m_client);
|
||||
m_client->setOnHold(false);
|
||||
Q_EMIT finished(m_client);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void PendingRfbClient::reject()
|
||||
{
|
||||
kDebug() << "refused connection";
|
||||
|
||||
rfbCloseClient(m_rfbClient);
|
||||
rfbClientConnectionGone(m_rfbClient);
|
||||
Q_EMIT finished(NULL);
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void PendingRfbClient::showUserConfirmationDialog()
|
||||
{
|
||||
kDebug();
|
||||
Q_ASSERT(m_client);
|
||||
|
||||
if (!KrfbConfig::askOnConnect()) {
|
||||
KNotification::event("NewConnectionAutoAccepted",
|
||||
i18n("Accepted connection from %1", m_client->name()));
|
||||
accept();
|
||||
} else {
|
||||
KNotification::event("NewConnectionOnHold",
|
||||
i18n("Received connection from %1, on hold (waiting for confirmation)",
|
||||
m_client->name()));
|
||||
|
||||
ConnectionDialog *dialog = new ConnectionDialog(0);
|
||||
dialog->setRemoteHost(m_client->name());
|
||||
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
|
||||
|
||||
connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
|
||||
connect(dialog, SIGNAL(cancelClicked()), SLOT(dialogRejected()));
|
||||
|
||||
dialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void PendingRfbClient::dialogAccepted()
|
||||
{
|
||||
ConnectionDialog *dialog = qobject_cast<ConnectionDialog *>(sender());
|
||||
Q_ASSERT(dialog);
|
||||
m_client->setControlEnabled(dialog->cbAllowRemoteControl->isChecked());
|
||||
accept();
|
||||
}
|
||||
|
||||
void PendingRfbClient::dialogRejected()
|
||||
{
|
||||
reject();
|
||||
}
|
||||
46
krfb/pendingrfbclient.h
Normal file
46
krfb/pendingrfbclient.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright (C) 2010 Collabora Ltd. <info@collabora.co.uk>
|
||||
@author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
|
||||
|
||||
This library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published
|
||||
by the Free Software Foundation; either version 2.1 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef PENDINGRFBCLIENT_H
|
||||
#define PENDINGRFBCLIENT_H
|
||||
|
||||
#include "rfbclient.h"
|
||||
#include <QtCore/QObject>
|
||||
|
||||
class PendingRfbClient : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PendingRfbClient(rfbClientPtr client, QObject* parent = 0);
|
||||
|
||||
Q_SIGNALS:
|
||||
void finished(RfbClient *client);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void processNewClient() = 0;
|
||||
|
||||
void showUserConfirmationDialog();
|
||||
|
||||
void accept();
|
||||
void reject();
|
||||
|
||||
protected:
|
||||
RfbClient *m_client;
|
||||
rfbClientPtr m_rfbClient;
|
||||
};
|
||||
|
||||
#endif // PENDINGRFBCLIENT_H
|
||||
105
krfb/personalinvitedialog.cpp
Normal file
105
krfb/personalinvitedialog.cpp
Normal file
@@ -0,0 +1,105 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "personalinvitedialog.h"
|
||||
|
||||
#include "krfbconfig.h"
|
||||
|
||||
#include <KIconLoader>
|
||||
#include <KLocale>
|
||||
|
||||
#include <QtGui/QLabel>
|
||||
#include <QtGui/QToolTip>
|
||||
|
||||
#include <QtNetwork/QNetworkInterface>
|
||||
|
||||
PersonalInviteDialog::PersonalInviteDialog(QWidget *parent)
|
||||
: KDialog(parent)
|
||||
{
|
||||
setCaption(i18n("Personal Invitation"));
|
||||
setButtons(Close);
|
||||
setDefaultButton(Close);
|
||||
setModal(true);
|
||||
|
||||
setMinimumSize(500, 250);
|
||||
|
||||
int port = KrfbConfig::port();
|
||||
|
||||
m_inviteWidget = new QWidget(this);
|
||||
setupUi(m_inviteWidget);
|
||||
pixmapLabel->setPixmap(KIcon("krfb").pixmap(128));
|
||||
|
||||
QList<QNetworkInterface> ifl = QNetworkInterface::allInterfaces();
|
||||
|
||||
foreach(const QNetworkInterface & nif, ifl) {
|
||||
if (nif.flags() & QNetworkInterface::IsLoopBack) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (nif.flags() & QNetworkInterface::IsRunning && !nif.addressEntries().isEmpty()) {
|
||||
hostLabel->setText(QString("%1:%2").arg(nif.addressEntries().first().ip().toString()).arg(port));
|
||||
}
|
||||
}
|
||||
|
||||
connect(mainTextLabel, SIGNAL(linkActivated(QString)),
|
||||
SLOT(showWhatsthis(QString)));
|
||||
|
||||
connect(hostHelpLabel, SIGNAL(linkActivated(QString)),
|
||||
SLOT(showWhatsthis(QString)));
|
||||
|
||||
setMainWidget(m_inviteWidget);
|
||||
}
|
||||
|
||||
|
||||
void PersonalInviteDialog::setHost(const QString &host, uint port)
|
||||
{
|
||||
hostLabel->setText(QString("%1:%2")
|
||||
.arg(host).arg(port));
|
||||
}
|
||||
|
||||
void PersonalInviteDialog::setPassword(const QString &passwd)
|
||||
{
|
||||
passwordLabel->setText(passwd);
|
||||
}
|
||||
|
||||
void PersonalInviteDialog::setExpiration(const QDateTime &expire)
|
||||
{
|
||||
expirationLabel->setText(expire.toString(Qt::LocalDate));
|
||||
}
|
||||
|
||||
void PersonalInviteDialog::showWhatsthis(const QString &link)
|
||||
{
|
||||
if (link == "htc") {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
i18n("Desktop Sharing uses the VNC protocol. You can use any VNC client to connect. \n"
|
||||
"In KDE the client is called 'Remote Desktop Connection'. Enter the host information\n"
|
||||
"into the client and it will connect.."));
|
||||
} else if (link == "help") {
|
||||
QToolTip::showText(QCursor::pos(),
|
||||
i18n("This field contains the address of your computer and the display number, separated by a colon.\n"
|
||||
"The address is just a hint - you can use any address that can reach your computer. \n"
|
||||
"Desktop Sharing tries to guess your address from your network configuration, but does\n"
|
||||
"not always succeed in doing so. If your computer is behind a firewall it may have a\n"
|
||||
"different address or be unreachable for other computers."));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#include "personalinvitedialog.moc"
|
||||
|
||||
49
krfb/personalinvitedialog.h
Normal file
49
krfb/personalinvitedialog.h
Normal file
@@ -0,0 +1,49 @@
|
||||
/* This file is part of the KDE project
|
||||
Copyright (C) 2004 Nadeem Hasan <nhasan@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef PERSONALINVITEDIALOG_H
|
||||
#define PERSONALINVITEDIALOG_H
|
||||
|
||||
#include "ui_personalinvitewidget.h"
|
||||
|
||||
#include <KDialog>
|
||||
|
||||
#include <QtCore/QDateTime>
|
||||
|
||||
class QWidget;
|
||||
class PersonalInviteDialog : public KDialog, public Ui::PersonalInviteWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PersonalInviteDialog(QWidget *parent);
|
||||
virtual ~PersonalInviteDialog() {}
|
||||
|
||||
void setHost(const QString &host, uint port);
|
||||
void setPassword(const QString &passwd);
|
||||
void setExpiration(const QDateTime &expire);
|
||||
|
||||
public Q_SLOTS:
|
||||
void showWhatsthis(const QString &);
|
||||
|
||||
protected:
|
||||
QWidget *m_inviteWidget;
|
||||
};
|
||||
|
||||
#endif // PERSONALINVITEDIALOG_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#ifndef KRFB_RFB_H
|
||||
#define KRFB_RFB_H
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
#include "../libvncserver/rfb/rfb.h"
|
||||
|
||||
#undef TRUE
|
||||
#undef FALSE
|
||||
|
||||
@@ -103,11 +103,6 @@ void RfbClient::closeConnection()
|
||||
rfbClientConnectionGone(d->client);
|
||||
}
|
||||
|
||||
rfbClientPtr RfbClient::getRfbClientPtr()
|
||||
{
|
||||
return d->client;
|
||||
}
|
||||
|
||||
void RfbClient::handleKeyboardEvent(bool down, rfbKeySym keySym)
|
||||
{
|
||||
if (d->controlEnabled) {
|
||||
@@ -122,6 +117,34 @@ void RfbClient::handleMouseEvent(int buttonMask, int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
bool RfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
Q_UNUSED(encryptedPassword);
|
||||
|
||||
return d->client->screen->authPasswdData == (void*)0;
|
||||
}
|
||||
|
||||
bool RfbClient::vncAuthCheckPassword(const QByteArray& password, const QByteArray& encryptedPassword) const
|
||||
{
|
||||
if (password.isEmpty() && encryptedPassword.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char passwd[MAXPWLEN];
|
||||
unsigned char challenge[CHALLENGESIZE];
|
||||
|
||||
memcpy(challenge, d->client->authChallenge, CHALLENGESIZE);
|
||||
bzero(passwd, MAXPWLEN);
|
||||
|
||||
if (!password.isEmpty()) {
|
||||
strncpy(passwd, password,
|
||||
(MAXPWLEN <= password.size()) ? MAXPWLEN : password.size());
|
||||
}
|
||||
|
||||
rfbEncryptBytes(challenge, passwd);
|
||||
return memcmp(challenge, encryptedPassword, encryptedPassword.size()) == 0;
|
||||
}
|
||||
|
||||
void RfbClient::onSocketActivated()
|
||||
{
|
||||
//Process not only one, but all pending messages.
|
||||
@@ -170,11 +193,14 @@ void RfbClient::update()
|
||||
PendingRfbClient::PendingRfbClient(rfbClientPtr client, QObject *parent)
|
||||
: QObject(parent), m_rfbClient(client)
|
||||
{
|
||||
m_rfbClient->clientData = this;
|
||||
kDebug();
|
||||
QMetaObject::invokeMethod(this, "processNewClient", Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
PendingRfbClient::~PendingRfbClient()
|
||||
{}
|
||||
{
|
||||
kDebug();
|
||||
}
|
||||
|
||||
void PendingRfbClient::accept(RfbClient *newClient)
|
||||
{
|
||||
@@ -202,32 +228,5 @@ void PendingRfbClient::reject()
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
bool PendingRfbClient::checkPassword(const QByteArray & encryptedPassword)
|
||||
{
|
||||
Q_UNUSED(encryptedPassword);
|
||||
|
||||
return m_rfbClient->screen->authPasswdData == (void*)0;
|
||||
}
|
||||
|
||||
bool PendingRfbClient::vncAuthCheckPassword(const QByteArray& password, const QByteArray& encryptedPassword) const
|
||||
{
|
||||
if (password.isEmpty() && encryptedPassword.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char passwd[MAXPWLEN];
|
||||
unsigned char challenge[CHALLENGESIZE];
|
||||
|
||||
memcpy(challenge, m_rfbClient->authChallenge, CHALLENGESIZE);
|
||||
bzero(passwd, MAXPWLEN);
|
||||
|
||||
if (!password.isEmpty()) {
|
||||
strncpy(passwd, password,
|
||||
(MAXPWLEN <= password.size()) ? MAXPWLEN : password.size());
|
||||
}
|
||||
|
||||
rfbEncryptBytes(challenge, passwd);
|
||||
return memcmp(challenge, encryptedPassword, encryptedPassword.size()) == 0;
|
||||
}
|
||||
|
||||
#include "rfbclient.moc"
|
||||
|
||||
@@ -51,10 +51,23 @@ Q_SIGNALS:
|
||||
protected:
|
||||
friend class RfbServer; //the following event handling methods are called by RfbServer
|
||||
|
||||
rfbClientPtr getRfbClientPtr();
|
||||
virtual void handleKeyboardEvent(bool down, rfbKeySym keySym);
|
||||
virtual void handleMouseEvent(int buttonMask, int x, int y);
|
||||
|
||||
/** This method is supposed to check if the provided \a encryptedPassword
|
||||
* matches the criteria for authenticating the client.
|
||||
* The default implementation returns false if a password is required.
|
||||
* Reimplement to do more useful stuff.
|
||||
*/
|
||||
virtual bool checkPassword(const QByteArray & encryptedPassword);
|
||||
|
||||
/** This method checks if the \a encryptedPassword that was sent from the remote
|
||||
* user matches the \a password that you have specified localy to be the password
|
||||
* for this connection. This assumes that the standard VNC authentication mechanism
|
||||
* is used. Returns true if the password matches or false otherwise.
|
||||
*/
|
||||
bool vncAuthCheckPassword(const QByteArray & password, const QByteArray & encryptedPassword) const;
|
||||
|
||||
private Q_SLOTS:
|
||||
void onSocketActivated();
|
||||
|
||||
@@ -86,23 +99,6 @@ protected Q_SLOTS:
|
||||
void reject();
|
||||
|
||||
protected:
|
||||
|
||||
friend class RfbServer; //Following two methods are handled by RfbServer
|
||||
|
||||
/** This method is supposed to check if the provided \a encryptedPassword
|
||||
* matches the criteria for authenticating the client.
|
||||
* The default implementation returns false if a password is required.
|
||||
* Reimplement to do more useful stuff.
|
||||
*/
|
||||
virtual bool checkPassword(const QByteArray & encryptedPassword);
|
||||
|
||||
/** This method checks if the \a encryptedPassword that was sent from the remote
|
||||
* user matches the \a password that you have specified localy to be the password
|
||||
* for this connection. This assumes that the standard VNC authentication mechanism
|
||||
* is used. Returns true if the password matches or false otherwise.
|
||||
*/
|
||||
bool vncAuthCheckPassword(const QByteArray & password, const QByteArray & encryptedPassword) const;
|
||||
|
||||
rfbClientPtr m_rfbClient;
|
||||
};
|
||||
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include "rfbserver.h"
|
||||
#include "rfbservermanager.h"
|
||||
#include <QtCore/QSocketNotifier>
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <KDebug>
|
||||
|
||||
struct RfbServer::Private
|
||||
@@ -47,6 +45,7 @@ RfbServer::RfbServer(QObject *parent)
|
||||
|
||||
RfbServer::~RfbServer()
|
||||
{
|
||||
stop();
|
||||
if (d->screen) {
|
||||
rfbScreenCleanup(d->screen);
|
||||
}
|
||||
@@ -137,8 +136,6 @@ bool RfbServer::start()
|
||||
d->notifier = new QSocketNotifier(d->screen->listenSock, QSocketNotifier::Read, this);
|
||||
d->notifier->setEnabled(true);
|
||||
connect(d->notifier, SIGNAL(activated(int)), this, SLOT(onListenSocketActivated()));
|
||||
connect(QApplication::clipboard(), SIGNAL(dataChanged()),
|
||||
this, SLOT(krfbSendServerCutText()));
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -204,15 +201,6 @@ void RfbServer::updateCursorPosition(const QPoint & position)
|
||||
}
|
||||
}
|
||||
|
||||
void RfbServer::krfbSendServerCutText()
|
||||
{
|
||||
if(d->screen) {
|
||||
QString text = QApplication::clipboard()->text();
|
||||
rfbSendServerCutText(d->screen,
|
||||
text.toLocal8Bit().data(),text.length());
|
||||
}
|
||||
}
|
||||
|
||||
void RfbServer::onListenSocketActivated()
|
||||
{
|
||||
rfbProcessNewConnection(d->screen);
|
||||
@@ -223,7 +211,6 @@ void RfbServer::pendingClientFinished(RfbClient *client)
|
||||
kDebug();
|
||||
if (client) {
|
||||
RfbServerManager::instance()->addClient(client);
|
||||
client->getRfbClientPtr()->clientGoneHook = clientGoneHook;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,6 +224,7 @@ rfbNewClientAction RfbServer::newClientHook(rfbClientPtr cl)
|
||||
connect(pendingClient, SIGNAL(finished(RfbClient*)),
|
||||
server, SLOT(pendingClientFinished(RfbClient*)));
|
||||
|
||||
cl->clientGoneHook = clientGoneHook;
|
||||
return RFB_CLIENT_ON_HOLD;
|
||||
}
|
||||
|
||||
@@ -253,8 +241,7 @@ void RfbServer::clientGoneHook(rfbClientPtr cl)
|
||||
//static
|
||||
rfbBool RfbServer::passwordCheck(rfbClientPtr cl, const char *encryptedPassword, int len)
|
||||
{
|
||||
PendingRfbClient *client = static_cast<PendingRfbClient*>(cl->clientData);
|
||||
Q_ASSERT(client);
|
||||
RfbClient *client = static_cast<RfbClient*>(cl->clientData);
|
||||
return client->checkPassword(QByteArray::fromRawData(encryptedPassword, len));
|
||||
}
|
||||
|
||||
@@ -275,7 +262,7 @@ void RfbServer::pointerHook(int bm, int x, int y, rfbClientPtr cl)
|
||||
//static
|
||||
void RfbServer::clipboardHook(char *str, int len, rfbClientPtr cl)
|
||||
{
|
||||
QApplication::clipboard()->setText(QString::fromLocal8Bit(str,len));
|
||||
//TODO implement me
|
||||
}
|
||||
|
||||
#include "rfbserver.moc"
|
||||
|
||||
@@ -40,14 +40,13 @@ public:
|
||||
void setPasswordRequired(bool passwordRequired);
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual bool start();
|
||||
virtual void stop(bool disconnectClients = true);
|
||||
bool start();
|
||||
void stop(bool disconnectClients = true);
|
||||
|
||||
void updateScreen(const QList<QRect> & modifiedTiles);
|
||||
void updateCursorPosition(const QPoint & position);
|
||||
|
||||
private Q_SLOTS:
|
||||
void krfbSendServerCutText();
|
||||
void onListenSocketActivated();
|
||||
void pendingClientFinished(RfbClient *client);
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@
|
||||
*/
|
||||
#include "trayicon.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "invitedialog.h"
|
||||
#include "manageinvitationsdialog.h"
|
||||
#include "rfbservermanager.h"
|
||||
#include "rfbclient.h"
|
||||
|
||||
|
||||
@@ -27,14 +27,6 @@ QString TubesRfbClient::name() const
|
||||
return m_contact->alias();
|
||||
}
|
||||
|
||||
//********
|
||||
|
||||
PendingTubesRfbClient::PendingTubesRfbClient(rfbClientPtr client, QObject* parent) :
|
||||
PendingRfbClient(client, parent),
|
||||
m_processNewClientCalled(false)
|
||||
{
|
||||
processNewClient();
|
||||
}
|
||||
|
||||
void PendingTubesRfbClient::setContact(const Tp::ContactPtr & contact)
|
||||
{
|
||||
@@ -60,18 +52,24 @@ void PendingTubesRfbClient::showConfirmationDialog()
|
||||
{
|
||||
QString name = m_contact->alias();
|
||||
|
||||
KNotification::event("NewConnectionOnHold",
|
||||
i18n("Received connection from %1, on hold (waiting for confirmation)",
|
||||
name));
|
||||
if (!KrfbConfig::askOnConnect()) {
|
||||
KNotification::event("NewConnectionAutoAccepted",
|
||||
i18n("Accepted connection from %1", name));
|
||||
accept(new TubesRfbClient(m_rfbClient, m_contact, parent()));
|
||||
} else {
|
||||
KNotification::event("NewConnectionOnHold",
|
||||
i18n("Received connection from %1, on hold (waiting for confirmation)",
|
||||
name));
|
||||
|
||||
TubesConnectionDialog *dialog = new TubesConnectionDialog(0);
|
||||
dialog->setContactName(name);
|
||||
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
|
||||
TubesConnectionDialog *dialog = new TubesConnectionDialog(0);
|
||||
dialog->setContactName(name);
|
||||
dialog->setAllowRemoteControl(KrfbConfig::allowDesktopControl());
|
||||
|
||||
connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
|
||||
connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
|
||||
connect(dialog, SIGNAL(okClicked()), SLOT(dialogAccepted()));
|
||||
connect(dialog, SIGNAL(cancelClicked()), SLOT(reject()));
|
||||
|
||||
dialog->show();
|
||||
dialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void PendingTubesRfbClient::dialogAccepted()
|
||||
|
||||
@@ -24,10 +24,8 @@
|
||||
class TubesRfbClient : public RfbClient
|
||||
{
|
||||
public:
|
||||
TubesRfbClient(rfbClientPtr client,
|
||||
const Tp::ContactPtr &contact, QObject *parent=0)
|
||||
: RfbClient(client, parent), m_contact(contact)
|
||||
{}
|
||||
TubesRfbClient(rfbClientPtr client, const Tp::ContactPtr & contact, QObject* parent = 0)
|
||||
: RfbClient(client, parent), m_contact(contact) {}
|
||||
|
||||
virtual QString name() const;
|
||||
|
||||
@@ -35,13 +33,13 @@ private:
|
||||
Tp::ContactPtr m_contact;
|
||||
};
|
||||
|
||||
//*********
|
||||
|
||||
class PendingTubesRfbClient : public PendingRfbClient
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PendingTubesRfbClient(rfbClientPtr client, QObject* parent = 0);
|
||||
PendingTubesRfbClient(rfbClientPtr client, QObject* parent = 0)
|
||||
: PendingRfbClient(client, parent), m_processNewClientCalled(false) {}
|
||||
|
||||
void setContact(const Tp::ContactPtr & contact);
|
||||
|
||||
|
||||
@@ -32,13 +32,6 @@
|
||||
#include <TelepathyQt/OutgoingStreamTubeChannel>
|
||||
#include <TelepathyQt/StreamTubeServer>
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
#include <TelepathyQt/AccountSet>
|
||||
#include <TelepathyQt/AccountManager>
|
||||
#include <TelepathyQt/PendingReady>
|
||||
#include <KTp/Models/contacts-list-model.h>
|
||||
#include <KTp/contact-factory.h>
|
||||
#endif
|
||||
|
||||
struct TubesRfbServer::Private
|
||||
{
|
||||
@@ -47,16 +40,10 @@ struct TubesRfbServer::Private
|
||||
QHash<quint16, PendingTubesRfbClient*> clientsPerPort;
|
||||
};
|
||||
|
||||
//static
|
||||
TubesRfbServer *TubesRfbServer::instance;
|
||||
|
||||
//static
|
||||
void TubesRfbServer::init()
|
||||
{
|
||||
instance = new TubesRfbServer;
|
||||
new TubesRfbServer();
|
||||
//RfbServerManager takes care of deletion
|
||||
|
||||
instance->startAndCheck();
|
||||
}
|
||||
|
||||
TubesRfbServer::TubesRfbServer(QObject *parent)
|
||||
@@ -69,51 +56,14 @@ TubesRfbServer::TubesRfbServer(QObject *parent)
|
||||
Tp::registerTypes();
|
||||
|
||||
Tp::AccountFactoryPtr accountFactory = Tp::AccountFactory::create(
|
||||
QDBusConnection::sessionBus(),
|
||||
Tp::Features() << Tp::Account::FeatureCore
|
||||
<< Tp::Account::FeatureAvatar
|
||||
<< Tp::Account::FeatureCapabilities
|
||||
<< Tp::Account::FeatureProtocolInfo
|
||||
<< Tp::Account::FeatureProfile);
|
||||
QDBusConnection::sessionBus(), Tp::Account::FeatureCore);
|
||||
|
||||
Tp::ConnectionFactoryPtr connectionFactory = Tp::ConnectionFactory::create(
|
||||
QDBusConnection::sessionBus(),
|
||||
Tp::Features() << Tp::Connection::FeatureCore
|
||||
<< Tp::Connection::FeatureSelfContact);
|
||||
QDBusConnection::sessionBus(), Tp::Connection::FeatureCore);
|
||||
|
||||
Tp::ChannelFactoryPtr channelFactory = Tp::ChannelFactory::create(
|
||||
QDBusConnection::sessionBus());
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
Tp::ContactFactoryPtr contactFactory = KTp::ContactFactory::create(
|
||||
Tp::Features() << Tp::Contact::FeatureAlias
|
||||
<<Tp::Contact::FeatureAvatarToken
|
||||
<<Tp::Contact::FeatureAvatarData
|
||||
<<Tp::Contact::FeatureSimplePresence
|
||||
<<Tp::Contact::FeatureCapabilities
|
||||
<<Tp::Contact::FeatureClientTypes);
|
||||
|
||||
m_accountManager = Tp::AccountManager::create(
|
||||
QDBusConnection::sessionBus(),
|
||||
accountFactory,
|
||||
connectionFactory,
|
||||
channelFactory,
|
||||
contactFactory);
|
||||
|
||||
d->stubeServer = Tp::StreamTubeServer::create(
|
||||
m_accountManager,
|
||||
QStringList() << QLatin1String("rfb"),
|
||||
QStringList(),
|
||||
QLatin1String("krfb_rfb_handler"),
|
||||
true);
|
||||
|
||||
connect(m_accountManager->becomeReady(),
|
||||
SIGNAL(finished(Tp::PendingOperation*)),
|
||||
this,
|
||||
SLOT(onAccountManagerReady()));
|
||||
|
||||
m_contactsListModel = new KTp::ContactsListModel(this);
|
||||
#else
|
||||
Tp::ContactFactoryPtr contactFactory = Tp::ContactFactory::create(
|
||||
Tp::Contact::FeatureAlias);
|
||||
|
||||
@@ -126,7 +76,6 @@ TubesRfbServer::TubesRfbServer(QObject *parent)
|
||||
connectionFactory,
|
||||
channelFactory,
|
||||
contactFactory);
|
||||
#endif //KRFB_WITH_KDE_TELEPATHY
|
||||
|
||||
connect(d->stubeServer.data(),
|
||||
SIGNAL(tubeRequested(Tp::AccountPtr,Tp::OutgoingStreamTubeChannelPtr,
|
||||
@@ -152,22 +101,16 @@ TubesRfbServer::TubesRfbServer(QObject *parent)
|
||||
// Listen only on the loopback network interface
|
||||
setListeningAddress("127.0.0.1");
|
||||
setPasswordRequired(false);
|
||||
|
||||
QTimer::singleShot(0, this, SLOT(startAndCheck()));
|
||||
}
|
||||
|
||||
TubesRfbServer::~TubesRfbServer()
|
||||
{
|
||||
kDebug();
|
||||
stop();
|
||||
delete d;
|
||||
}
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
KTp::ContactsListModel *TubesRfbServer::contactsListModel()
|
||||
{
|
||||
return m_contactsListModel;
|
||||
}
|
||||
#endif
|
||||
|
||||
void TubesRfbServer::startAndCheck()
|
||||
{
|
||||
if (!start()) {
|
||||
@@ -252,11 +195,4 @@ PendingRfbClient* TubesRfbServer::newClient(rfbClientPtr client)
|
||||
return c;
|
||||
}
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
void TubesRfbServer::onAccountManagerReady()
|
||||
{
|
||||
m_contactsListModel->setAccountManager(m_accountManager);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "tubesrfbserver.moc"
|
||||
|
||||
@@ -23,23 +23,13 @@
|
||||
#include <QtNetwork/QHostAddress>
|
||||
#include <TelepathyQt/Types>
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
namespace KTp {
|
||||
class ContactsListModel;
|
||||
}
|
||||
#endif
|
||||
|
||||
class TubesRfbServer : public RfbServer
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
static TubesRfbServer *instance;
|
||||
static void init();
|
||||
|
||||
virtual ~TubesRfbServer();
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
KTp::ContactsListModel *contactsListModel();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
TubesRfbServer(QObject *parent = 0);
|
||||
@@ -68,19 +58,9 @@ private Q_SLOTS:
|
||||
const QString &message,
|
||||
const Tp::OutgoingStreamTubeChannelPtr &tube);
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
void onAccountManagerReady();
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct Private;
|
||||
Private *const d;
|
||||
|
||||
#ifdef KRFB_WITH_KDE_TELEPATHY
|
||||
KTp::ContactsListModel *m_contactsListModel;
|
||||
Tp::AccountManagerPtr m_accountManager;
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
#endif // TUBESRFBSERVER_H
|
||||
|
||||
@@ -11,6 +11,19 @@
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_askOnConnect">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ask before accepting connections</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_allowDesktopControl">
|
||||
<property name="text">
|
||||
@@ -21,6 +34,36 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="kcfg_allowUninvitedConnections">
|
||||
<property name="text">
|
||||
<string>Allow uninvited connections</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Uninvited connections password:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>kcfg_uninvitedConnectionPassword</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KLineEdit" name="kcfg_uninvitedConnectionPassword">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
@@ -36,6 +79,46 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>klineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>kcfg_allowUninvitedConnections</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>kcfg_uninvitedConnectionPassword</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>98</x>
|
||||
<y>21</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>192</x>
|
||||
<y>137</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>kcfg_allowUninvitedConnections</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>label</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>117</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>120</x>
|
||||
<y>94</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
|
||||
@@ -1,537 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWidget</class>
|
||||
<widget class="QWidget" name="MainWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>340</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>340</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="krfbIconLabel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="rightLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="titleLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>KDE Desktop Sharing</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KDE Desktop Sharing</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="aboutLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>KDE Desktop Sharing</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>KDE Desktop Sharing allows you to grant permission to someone at a remote location for viewing and possibly controlling your desktop.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableSharingCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>400</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Starts/Stops Remote Desktop Sharing</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Enable Desktop Sharing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="detailsGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Connection Details</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="addressFormLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="addressLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Address</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>addressAboutButton</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="addressGridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="addressAboutButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>More about this address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="help-about">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="addressDisplayLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Address required by remote users to connect to your desktop. Click about button on the right for more info.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>127.0.0.1 : 5900</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="passwordFormLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::ExpandingFieldsGrow</enum>
|
||||
</property>
|
||||
<property name="formAlignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="passwordLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Password</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>passwordEditButton</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<layout class="QGridLayout" name="passwordGridLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMaximumSize</enum>
|
||||
</property>
|
||||
<item row="0" column="1">
|
||||
<widget class="QToolButton" name="passwordEditButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Edit/Save Desktop Sharing Password</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="document-edit">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="passwordDisplayLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Password required by remote users to connect to your desktop. Click the edit button on the right to change password.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TemporaryPassword</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="unattendedGroupBox">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Unattended Access allows a remote user with the password to gain control to your desktop without your explicit confirmation.</string>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Unattended Access</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="unattendedDetailsLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="unattendedAboutLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Unattended Access allows a remote user with the password to gain control to your desktop without your explicit confirmation. Click "About" button on right to know more.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Unattended Access allows a remote user with the password to gain control to your desktop without your explicit confirmation.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="unattendedAboutButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Know more about Unattended Access</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset theme="help-about">
|
||||
<normaloff/>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="unattendedSettingsLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableUnattendedCheckBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Starts/Stops unattended access to your desktop. Click on button on right to change password, and "About" button to know more.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable &Unattended Access</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="KPushButton" name="unattendedPasswordButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>320</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>Change password for Unattended Access</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Change Unattended Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="tpContactsLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>KPushButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header>kpushbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>enableSharingCheckBox</tabstop>
|
||||
<tabstop>addressAboutButton</tabstop>
|
||||
<tabstop>passwordEditButton</tabstop>
|
||||
<tabstop>enableUnattendedCheckBox</tabstop>
|
||||
<tabstop>unattendedPasswordButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>enableSharingCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>detailsGroupBox</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>382</x>
|
||||
<y>87</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>245</x>
|
||||
<y>140</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>enableSharingCheckBox</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>unattendedGroupBox</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>320</x>
|
||||
<y>76</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>325</x>
|
||||
<y>214</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
190
krfb/ui/manageinvitations.ui
Normal file
190
krfb/ui/manageinvitations.ui
Normal file
@@ -0,0 +1,190 @@
|
||||
<ui version="4.0" >
|
||||
<class>ManageInvitationsDialog</class>
|
||||
<widget class="QWidget" name="ManageInvitationsDialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>550</width>
|
||||
<height>337</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Manage Invitations - Desktop Sharing</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="1" colspan="2" >
|
||||
<widget class="QLabel" name="TextLabel2" >
|
||||
<property name="font" >
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Welcome to KDE Desktop Sharing</string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" colspan="2" >
|
||||
<widget class="QLabel" name="helpLabel" >
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">KDE Desktop Sharing allows you to invite somebody at a remote location to watch and possibly control your desktop. <a href="whatsthis">More about invitations...</a></p></body></html></string>
|
||||
</property>
|
||||
<property name="textFormat" >
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="3" row="2" column="0" >
|
||||
<widget class="QLabel" name="pixmapLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Maximum" hsizetype="Maximum" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize" >
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item rowspan="5" row="2" column="1" >
|
||||
<widget class="QTreeWidget" name="invitationWidget" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
|
||||
<horstretch>2</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="alternatingRowColors" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="rootIsDecorated" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Creation Time</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text" >
|
||||
<string>Expire Time</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2" >
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>155</width>
|
||||
<height>62</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="2" >
|
||||
<widget class="QPushButton" name="newPersonalInvitationButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Create a new personal invitation...</string>
|
||||
</property>
|
||||
<property name="whatsThis" >
|
||||
<string>Click this button to create a new personal invitation.</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>New &Personal Invitation...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" >
|
||||
<widget class="QPushButton" name="newEmailInvitationButton" >
|
||||
<property name="toolTip" >
|
||||
<string>Send a new invitation via email...</string>
|
||||
</property>
|
||||
<property name="whatsThis" >
|
||||
<string>Click this button to send a new invitation via email.</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&New Email Invitation...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2" >
|
||||
<widget class="QPushButton" name="deleteAllButton" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Delete all invitations</string>
|
||||
</property>
|
||||
<property name="whatsThis" >
|
||||
<string>Deletes all open invitations.</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Delete All</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2" >
|
||||
<widget class="QPushButton" name="deleteOneButton" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip" >
|
||||
<string>Delete the selected invitation</string>
|
||||
</property>
|
||||
<property name="whatsThis" >
|
||||
<string>Delete the selected invitation. The invited person will not be able to connect using this invitation anymore.</string>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>invitationWidget</tabstop>
|
||||
<tabstop>newPersonalInvitationButton</tabstop>
|
||||
<tabstop>newEmailInvitationButton</tabstop>
|
||||
<tabstop>deleteAllButton</tabstop>
|
||||
<tabstop>deleteOneButton</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
205
krfb/ui/personalinvitewidget.ui
Normal file
205
krfb/ui/personalinvitewidget.ui
Normal file
@@ -0,0 +1,205 @@
|
||||
<ui version="4.0" >
|
||||
<class>PersonalInviteWidget</class>
|
||||
<widget class="QWidget" name="PersonalInviteWidget" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>567</width>
|
||||
<height>324</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="pixmapLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize" >
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="mainTextLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Personal Invitation</span></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Give the information below to the person that you want to invite (<a href="htc">how to connect</a>). Note that everybody who gets the password can connect, so be careful.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>21</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" >
|
||||
<item row="0" column="0" >
|
||||
<widget class="QLabel" name="kActiveLabel5" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><b>Host:</b></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" >
|
||||
<widget class="QLabel" name="hostLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2" >
|
||||
<widget class="QLabel" name="hostHelpLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="help">Help</a></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" >
|
||||
<widget class="QLabel" name="kActiveLabel6" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><b>Password:</b></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1" >
|
||||
<widget class="QLabel" name="passwordLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="textInteractionFlags" >
|
||||
<set>Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextBrowserInteraction|Qt::TextEditable|Qt::TextEditorInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" >
|
||||
<widget class="QLabel" name="kActiveLabel7" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string><b>Expiration time:</b></string>
|
||||
</property>
|
||||
<property name="wordWrap" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1" >
|
||||
<widget class="QLabel" name="expirationLabel" >
|
||||
<property name="sizePolicy" >
|
||||
<sizepolicy vsizetype="Minimum" hsizetype="MinimumExpanding" >
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="focusPolicy" >
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType" >
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>65</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
132
libvncserver/CMakeLists.txt
Normal file
132
libvncserver/CMakeLists.txt
Normal file
@@ -0,0 +1,132 @@
|
||||
# Striped down version of libvncserver's original CMakeLists.txt
|
||||
|
||||
project(LibVNCServer)
|
||||
include(CheckFunctionExists)
|
||||
include(CheckIncludeFile)
|
||||
include(CheckTypeSize)
|
||||
include(TestBigEndian)
|
||||
include(MacroBoolTo01)
|
||||
|
||||
set(FULL_PACKAGE_NAME "Krfb LibVNCServer")
|
||||
set(PACKAGE_VERSION "0.9.8-10-g17ce0c5")
|
||||
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
macro_optional_find_package(ZLIB)
|
||||
macro_log_feature(ZLIB_FOUND "ZLib" "The Zlib compression library" "http://www.zlib.net" FALSE "" "Used by the vncserver library.")
|
||||
|
||||
macro_optional_find_package(JPEG)
|
||||
macro_log_feature(JPEG_FOUND "LibJPEG" "The JPEG library" "" FALSE "" "Used by the vncserver library")
|
||||
|
||||
macro_bool_to_01(ZLIB_FOUND LIBVNCSERVER_HAVE_LIBZ)
|
||||
macro_bool_to_01(JPEG_FOUND LIBVNCSERVER_HAVE_LIBJPEG)
|
||||
option(LIBVNCSERVER_ALLOW24BPP "Allow 24 bpp" ON)
|
||||
# if(GNUTLS_FOUND)
|
||||
# set(LIBVNCSERVER_WITH_CLIENT_TLS 1)
|
||||
# endif(GNUTLS_FOUND)
|
||||
# if(LIBGCRYPT_LIBRARIES)
|
||||
# message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}")
|
||||
# set(LIBVNCSERVER_WITH_CLIENT_GCRYPT 1)
|
||||
# endif(LIBGCRYPT_LIBRARIES)
|
||||
|
||||
|
||||
check_include_file("fcntl.h" LIBVNCSERVER_HAVE_FCNTL_H)
|
||||
check_include_file("netinet/in.h" LIBVNCSERVER_HAVE_NETINET_IN_H)
|
||||
check_include_file("sys/socket.h" LIBVNCSERVER_HAVE_SYS_SOCKET_H)
|
||||
check_include_file("sys/stat.h" LIBVNCSERVER_HAVE_SYS_STAT_H)
|
||||
check_include_file("sys/time.h" LIBVNCSERVER_HAVE_SYS_TIME_H)
|
||||
check_include_file("sys/types.h" LIBVNCSERVER_HAVE_SYS_TYPES_H)
|
||||
check_include_file("sys/wait.h" LIBVNCSERVER_HAVE_SYS_WAIT_H)
|
||||
check_include_file("unistd.h" LIBVNCSERVER_HAVE_UNISTD_H)
|
||||
|
||||
# headers needed for check_type_size()
|
||||
check_include_file("arpa/inet.h" HAVE_ARPA_INET_H)
|
||||
check_include_file("stdint.h" HAVE_STDINT_H)
|
||||
check_include_file("stddef.h" HAVE_STDDEF_H)
|
||||
check_include_file("sys/types.h" HAVE_SYS_TYPES_H)
|
||||
|
||||
check_function_exists(gettimeofday LIBVNCSERVER_HAVE_GETTIMEOFDAY)
|
||||
|
||||
macro_bool_to_01(CMAKE_USE_PTHREADS_INIT LIBVNCSERVER_HAVE_LIBPTHREAD)
|
||||
if(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
|
||||
# socklen_t
|
||||
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "sys/socket.h")
|
||||
endif(LIBVNCSERVER_HAVE_SYS_SOCKET_H)
|
||||
if(HAVE_ARPA_INET_H)
|
||||
# in_addr_t
|
||||
list(APPEND CMAKE_EXTRA_INCLUDE_FILES "arpa/inet.h")
|
||||
endif(HAVE_ARPA_INET_H)
|
||||
|
||||
check_type_size(pid_t LIBVNCSERVER_PID_T)
|
||||
check_type_size(size_t LIBVNCSERVER_SIZE_T)
|
||||
check_type_size(socklen_t LIBVNCSERVER_SOCKLEN_T)
|
||||
check_type_size(in_addr_t LIBVNCSERVER_IN_ADDR_T)
|
||||
if(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
|
||||
set(LIBVNCSERVER_NEED_INADDR_T 1)
|
||||
endif(NOT HAVE_LIBVNCSERVER_IN_ADDR_T)
|
||||
|
||||
test_big_endian(LIBVNCSERVER_WORDS_BIGENDIAN)
|
||||
|
||||
|
||||
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/libvncserver-config.h.cmake
|
||||
${CMAKE_CURRENT_BINARY_DIR}/libvncserver-config.h
|
||||
)
|
||||
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
main.c
|
||||
rfbserver.c
|
||||
rfbregion.c
|
||||
auth.c
|
||||
sockets.c
|
||||
stats.c
|
||||
corre.c
|
||||
hextile.c
|
||||
rre.c
|
||||
translate.c
|
||||
cutpaste.c
|
||||
httpd.c
|
||||
cursor.c
|
||||
font.c
|
||||
draw.c
|
||||
selbox.c
|
||||
d3des.c
|
||||
vncauth.c
|
||||
cargs.c
|
||||
minilzo.c
|
||||
ultra.c
|
||||
scale.c
|
||||
)
|
||||
|
||||
if(ZLIB_FOUND)
|
||||
add_definitions(-DLIBVNCSERVER_HAVE_LIBZ)
|
||||
include_directories(${ZLIB_INCLUDE_DIR})
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
${LIBVNCSERVER_SOURCES}
|
||||
zlib.c
|
||||
zrle.c
|
||||
zrleoutstream.c
|
||||
zrlepalettehelper.c
|
||||
)
|
||||
endif(ZLIB_FOUND)
|
||||
|
||||
if(JPEG_FOUND)
|
||||
add_definitions(-DLIBVNCSERVER_HAVE_LIBJPEG)
|
||||
include_directories(${JPEG_INCLUDE_DIR})
|
||||
set(LIBVNCSERVER_SOURCES
|
||||
${LIBVNCSERVER_SOURCES}
|
||||
tight.c
|
||||
)
|
||||
endif(JPEG_FOUND)
|
||||
|
||||
|
||||
add_library(vncserver STATIC ${LIBVNCSERVER_SOURCES})
|
||||
|
||||
if(WIN32)
|
||||
set(ADDITIONAL_LIBS ws2_32)
|
||||
endif(WIN32)
|
||||
|
||||
target_link_libraries(vncserver
|
||||
${ADDITIONAL_LIBS}
|
||||
${ZLIB_LIBRARIES}
|
||||
${JPEG_LIBRARIES}
|
||||
)
|
||||
375
libvncserver/auth.c
Normal file
375
libvncserver/auth.c
Normal file
@@ -0,0 +1,375 @@
|
||||
/*
|
||||
* auth.c - deal with authentication.
|
||||
*
|
||||
* This file implements the VNC authentication protocol when setting up an RFB
|
||||
* connection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
/* RFB 3.8 clients are well informed */
|
||||
void rfbClientSendString(rfbClientPtr cl, const char *reason);
|
||||
|
||||
|
||||
/*
|
||||
* Handle security types
|
||||
*/
|
||||
|
||||
static rfbSecurityHandler* securityHandlers = NULL;
|
||||
|
||||
/*
|
||||
* This method registers a list of new security types.
|
||||
* It avoids same security type getting registered multiple times.
|
||||
* The order is not preserved if multiple security types are
|
||||
* registered at one-go.
|
||||
*/
|
||||
void
|
||||
rfbRegisterSecurityHandler(rfbSecurityHandler* handler)
|
||||
{
|
||||
rfbSecurityHandler *head = securityHandlers, *next = NULL;
|
||||
|
||||
if(handler == NULL)
|
||||
return;
|
||||
|
||||
next = handler->next;
|
||||
|
||||
while(head != NULL) {
|
||||
if(head == handler) {
|
||||
rfbRegisterSecurityHandler(next);
|
||||
return;
|
||||
}
|
||||
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
handler->next = securityHandlers;
|
||||
securityHandlers = handler;
|
||||
|
||||
rfbRegisterSecurityHandler(next);
|
||||
}
|
||||
|
||||
/*
|
||||
* This method unregisters a list of security types.
|
||||
* These security types won't be available for any new
|
||||
* client connection.
|
||||
*/
|
||||
void
|
||||
rfbUnregisterSecurityHandler(rfbSecurityHandler* handler)
|
||||
{
|
||||
rfbSecurityHandler *cur = NULL, *pre = NULL;
|
||||
|
||||
if(handler == NULL)
|
||||
return;
|
||||
|
||||
if(securityHandlers == handler) {
|
||||
securityHandlers = securityHandlers->next;
|
||||
rfbUnregisterSecurityHandler(handler->next);
|
||||
return;
|
||||
}
|
||||
|
||||
cur = pre = securityHandlers;
|
||||
|
||||
while(cur) {
|
||||
if(cur == handler) {
|
||||
pre->next = cur->next;
|
||||
break;
|
||||
}
|
||||
pre = cur;
|
||||
cur = cur->next;
|
||||
}
|
||||
rfbUnregisterSecurityHandler(handler->next);
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the authentication challenge.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbVncAuthSendChallenge(rfbClientPtr cl)
|
||||
{
|
||||
|
||||
/* 4 byte header is alreay sent. Which is rfbSecTypeVncAuth
|
||||
(same as rfbVncAuth). Just send the challenge. */
|
||||
rfbRandomBytes(cl->authChallenge);
|
||||
if (rfbWriteExact(cl, (char *)cl->authChallenge, CHALLENGESIZE) < 0) {
|
||||
rfbLogPerror("rfbAuthNewClient: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Dispatch client input to rfbVncAuthProcessResponse. */
|
||||
cl->state = RFB_AUTHENTICATION;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the NO AUTHENTICATION. SCARR
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbVncAuthNone(rfbClientPtr cl)
|
||||
{
|
||||
uint32_t authResult;
|
||||
|
||||
if (cl->protocolMajorVersion==3 && cl->protocolMinorVersion > 7) {
|
||||
rfbLog("rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8\n");
|
||||
authResult = Swap32IfLE(rfbVncAuthOK);
|
||||
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
cl->state = RFB_INITIALISATION;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Advertise the supported security types (protocol 3.7). Here before sending
|
||||
* the list of security types to the client one more security type is added
|
||||
* to the list if primaryType is not set to rfbSecTypeInvalid. This security
|
||||
* type is the standard vnc security type which does the vnc authentication
|
||||
* or it will be security type for no authentication.
|
||||
* Different security types will be added by applications using this library.
|
||||
*/
|
||||
|
||||
static rfbSecurityHandler VncSecurityHandlerVncAuth = {
|
||||
rfbSecTypeVncAuth,
|
||||
rfbVncAuthSendChallenge,
|
||||
NULL
|
||||
};
|
||||
|
||||
static rfbSecurityHandler VncSecurityHandlerNone = {
|
||||
rfbSecTypeNone,
|
||||
rfbVncAuthNone,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static void
|
||||
rfbSendSecurityTypeList(rfbClientPtr cl, int primaryType)
|
||||
{
|
||||
/* The size of the message is the count of security types +1,
|
||||
* since the first byte is the number of types. */
|
||||
int size = 1;
|
||||
rfbSecurityHandler* handler;
|
||||
#define MAX_SECURITY_TYPES 255
|
||||
uint8_t buffer[MAX_SECURITY_TYPES+1];
|
||||
|
||||
|
||||
/* Fill in the list of security types in the client structure. (NOTE: Not really in the client structure) */
|
||||
switch (primaryType) {
|
||||
case rfbSecTypeNone:
|
||||
rfbRegisterSecurityHandler(&VncSecurityHandlerNone);
|
||||
break;
|
||||
case rfbSecTypeVncAuth:
|
||||
rfbRegisterSecurityHandler(&VncSecurityHandlerVncAuth);
|
||||
break;
|
||||
}
|
||||
|
||||
for (handler = securityHandlers;
|
||||
handler && size<MAX_SECURITY_TYPES; handler = handler->next) {
|
||||
buffer[size] = handler->type;
|
||||
size++;
|
||||
}
|
||||
buffer[0] = (unsigned char)size-1;
|
||||
|
||||
/* Send the list. */
|
||||
if (rfbWriteExact(cl, (char *)buffer, size) < 0) {
|
||||
rfbLogPerror("rfbSendSecurityTypeList: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* if count is 0, we need to send the reason and close the connection.
|
||||
*/
|
||||
if(size <= 1) {
|
||||
/* This means total count is Zero and so reason msg should be sent */
|
||||
/* The execution should never reach here */
|
||||
char* reason = "No authentication mode is registered!";
|
||||
|
||||
rfbClientSendString(cl, reason);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Dispatch client input to rfbProcessClientSecurityType. */
|
||||
cl->state = RFB_SECURITY_TYPE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Tell the client what security type will be used (protocol 3.3).
|
||||
*/
|
||||
static void
|
||||
rfbSendSecurityType(rfbClientPtr cl, int32_t securityType)
|
||||
{
|
||||
uint32_t value32;
|
||||
|
||||
/* Send the value. */
|
||||
value32 = Swap32IfLE(securityType);
|
||||
if (rfbWriteExact(cl, (char *)&value32, 4) < 0) {
|
||||
rfbLogPerror("rfbSendSecurityType: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Decide what to do next. */
|
||||
switch (securityType) {
|
||||
case rfbSecTypeNone:
|
||||
/* Dispatch client input to rfbProcessClientInitMessage. */
|
||||
cl->state = RFB_INITIALISATION;
|
||||
break;
|
||||
case rfbSecTypeVncAuth:
|
||||
/* Begin the standard VNC authentication procedure. */
|
||||
rfbVncAuthSendChallenge(cl);
|
||||
break;
|
||||
default:
|
||||
/* Impossible case (hopefully). */
|
||||
rfbLogPerror("rfbSendSecurityType: assertion failed");
|
||||
rfbCloseClient(cl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* rfbAuthNewClient is called right after negotiating the protocol
|
||||
* version. Depending on the protocol version, we send either a code
|
||||
* for authentication scheme to be used (protocol 3.3), or a list of
|
||||
* possible "security types" (protocol 3.7).
|
||||
*/
|
||||
|
||||
void
|
||||
rfbAuthNewClient(rfbClientPtr cl)
|
||||
{
|
||||
int32_t securityType = rfbSecTypeInvalid;
|
||||
|
||||
if (!cl->screen->authPasswdData || cl->reverseConnection) {
|
||||
/* chk if this condition is valid or not. */
|
||||
securityType = rfbSecTypeNone;
|
||||
} else if (cl->screen->authPasswdData) {
|
||||
securityType = rfbSecTypeVncAuth;
|
||||
}
|
||||
|
||||
if (cl->protocolMajorVersion==3 && cl->protocolMinorVersion < 7)
|
||||
{
|
||||
/* Make sure we use only RFB 3.3 compatible security types. */
|
||||
if (securityType == rfbSecTypeInvalid) {
|
||||
rfbLog("VNC authentication disabled - RFB 3.3 client rejected\n");
|
||||
rfbClientConnFailed(cl, "Your viewer cannot handle required "
|
||||
"authentication methods");
|
||||
return;
|
||||
}
|
||||
rfbSendSecurityType(cl, securityType);
|
||||
} else {
|
||||
/* Here it's ok when securityType is set to rfbSecTypeInvalid. */
|
||||
rfbSendSecurityTypeList(cl, securityType);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Read the security type chosen by the client (protocol 3.7).
|
||||
*/
|
||||
|
||||
void
|
||||
rfbProcessClientSecurityType(rfbClientPtr cl)
|
||||
{
|
||||
int n;
|
||||
uint8_t chosenType;
|
||||
rfbSecurityHandler* handler;
|
||||
|
||||
/* Read the security type. */
|
||||
n = rfbReadExact(cl, (char *)&chosenType, 1);
|
||||
if (n <= 0) {
|
||||
if (n == 0)
|
||||
rfbLog("rfbProcessClientSecurityType: client gone\n");
|
||||
else
|
||||
rfbLogPerror("rfbProcessClientSecurityType: read");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure it was present in the list sent by the server. */
|
||||
for (handler = securityHandlers; handler; handler = handler->next) {
|
||||
if (chosenType == handler->type) {
|
||||
rfbLog("rfbProcessClientSecurityType: executing handler for type %d\n", chosenType);
|
||||
handler->handler(cl);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
rfbLog("rfbProcessClientSecurityType: wrong security type (%d) requested\n", chosenType);
|
||||
rfbCloseClient(cl);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* rfbAuthProcessClientMessage is called when the client sends its
|
||||
* authentication response.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbAuthProcessClientMessage(rfbClientPtr cl)
|
||||
{
|
||||
int n;
|
||||
uint8_t response[CHALLENGESIZE];
|
||||
uint32_t authResult;
|
||||
|
||||
if ((n = rfbReadExact(cl, (char *)response, CHALLENGESIZE)) <= 0) {
|
||||
if (n != 0)
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: read");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
if(!cl->screen->passwordCheck(cl,(const char*)response,CHALLENGESIZE)) {
|
||||
rfbErr("rfbAuthProcessClientMessage: password check failed\n");
|
||||
authResult = Swap32IfLE(rfbVncAuthFailed);
|
||||
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: write");
|
||||
}
|
||||
/* support RFB 3.8 clients, they expect a reason *why* it was disconnected */
|
||||
if (cl->protocolMinorVersion > 7) {
|
||||
rfbClientSendString(cl, "password check failed!");
|
||||
}
|
||||
else
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
authResult = Swap32IfLE(rfbVncAuthOK);
|
||||
|
||||
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
|
||||
rfbLogPerror("rfbAuthProcessClientMessage: write");
|
||||
rfbCloseClient(cl);
|
||||
return;
|
||||
}
|
||||
|
||||
cl->state = RFB_INITIALISATION;
|
||||
}
|
||||
213
libvncserver/cargs.c
Normal file
213
libvncserver/cargs.c
Normal file
@@ -0,0 +1,213 @@
|
||||
/*
|
||||
* This parses the command line arguments. It was seperated from main.c by
|
||||
* Justin Dearing <jdeari01@longisland.poly.edu>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* LibVNCServer (C) 2001 Johannes E. Schindelin <Johannes.Schindelin@gmx.de>
|
||||
* Original OSXvnc (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* see GPL (latest version) for full details
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
extern int rfbStringToAddr(char *str, in_addr_t *iface);
|
||||
|
||||
void
|
||||
rfbUsage(void)
|
||||
{
|
||||
rfbProtocolExtension* extension;
|
||||
|
||||
fprintf(stderr, "-rfbport port TCP port for RFB protocol\n");
|
||||
fprintf(stderr, "-rfbwait time max time in ms to wait for RFB client\n");
|
||||
fprintf(stderr, "-rfbauth passwd-file use authentication on RFB protocol\n"
|
||||
" (use 'storepasswd' to create a password file)\n");
|
||||
fprintf(stderr, "-rfbversion 3.x Set the version of the RFB we choose to advertise\n");
|
||||
fprintf(stderr, "-permitfiletransfer permit file transfer support\n");
|
||||
fprintf(stderr, "-passwd plain-password use authentication \n"
|
||||
" (use plain-password as password, USE AT YOUR RISK)\n");
|
||||
fprintf(stderr, "-deferupdate time time in ms to defer updates "
|
||||
"(default 40)\n");
|
||||
fprintf(stderr, "-deferptrupdate time time in ms to defer pointer updates"
|
||||
" (default none)\n");
|
||||
fprintf(stderr, "-desktop name VNC desktop name (default \"LibVNCServer\")\n");
|
||||
fprintf(stderr, "-alwaysshared always treat new clients as shared\n");
|
||||
fprintf(stderr, "-nevershared never treat new clients as shared\n");
|
||||
fprintf(stderr, "-dontdisconnect don't disconnect existing clients when a "
|
||||
"new non-shared\n"
|
||||
" connection comes in (refuse new connection "
|
||||
"instead)\n");
|
||||
fprintf(stderr, "-httpdir dir-path enable http server using dir-path home\n");
|
||||
fprintf(stderr, "-httpport portnum use portnum for http connection\n");
|
||||
fprintf(stderr, "-enablehttpproxy enable http proxy support\n");
|
||||
fprintf(stderr, "-progressive height enable progressive updating for slow links\n");
|
||||
fprintf(stderr, "-listen ipaddr listen for connections only on network interface with\n");
|
||||
fprintf(stderr, " addr ipaddr. '-listen localhost' and hostname work too.\n");
|
||||
|
||||
for(extension=rfbGetExtensionIterator();extension;extension=extension->next)
|
||||
if(extension->usage)
|
||||
extension->usage();
|
||||
rfbReleaseExtensionIterator();
|
||||
}
|
||||
|
||||
/* purges COUNT arguments from ARGV at POSITION and decrements ARGC.
|
||||
POSITION points to the first non purged argument afterwards. */
|
||||
void rfbPurgeArguments(int* argc,int* position,int count,char *argv[])
|
||||
{
|
||||
int amount=(*argc)-(*position)-count;
|
||||
if(amount)
|
||||
memmove(argv+(*position),argv+(*position)+count,sizeof(char*)*amount);
|
||||
(*argc)-=count;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
rfbProcessArguments(rfbScreenInfoPtr rfbScreen,int* argc, char *argv[])
|
||||
{
|
||||
int i,i1;
|
||||
|
||||
if(!argc) return TRUE;
|
||||
|
||||
for (i = i1 = 1; i < *argc;) {
|
||||
if (strcmp(argv[i], "-help") == 0) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
} else if (strcmp(argv[i], "-rfbport") == 0) { /* -rfbport port */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->port = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-rfbwait") == 0) { /* -rfbwait ms */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->maxClientWait = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-rfbauth") == 0) { /* -rfbauth passwd-file */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->authPasswdData = argv[++i];
|
||||
|
||||
} else if (strcmp(argv[i], "-permitfiletransfer") == 0) { /* -permitfiletransfer */
|
||||
rfbScreen->permitFileTransfer = TRUE;
|
||||
} else if (strcmp(argv[i], "-rfbversion") == 0) { /* -rfbversion 3.6 */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
sscanf(argv[++i],"%d.%d", &rfbScreen->protocolMajorVersion, &rfbScreen->protocolMinorVersion);
|
||||
} else if (strcmp(argv[i], "-passwd") == 0) { /* -passwd password */
|
||||
char **passwds = malloc(sizeof(char**)*2);
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
passwds[0] = argv[++i];
|
||||
passwds[1] = NULL;
|
||||
rfbScreen->authPasswdData = (void*)passwds;
|
||||
rfbScreen->passwordCheck = rfbCheckPasswordByList;
|
||||
} else if (strcmp(argv[i], "-deferupdate") == 0) { /* -deferupdate milliseconds */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->deferUpdateTime = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-deferptrupdate") == 0) { /* -deferptrupdate milliseconds */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->deferPtrUpdateTime = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-desktop") == 0) { /* -desktop desktop-name */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->desktopName = argv[++i];
|
||||
} else if (strcmp(argv[i], "-alwaysshared") == 0) {
|
||||
rfbScreen->alwaysShared = TRUE;
|
||||
} else if (strcmp(argv[i], "-nevershared") == 0) {
|
||||
rfbScreen->neverShared = TRUE;
|
||||
} else if (strcmp(argv[i], "-dontdisconnect") == 0) {
|
||||
rfbScreen->dontDisconnect = TRUE;
|
||||
} else if (strcmp(argv[i], "-httpdir") == 0) { /* -httpdir directory-path */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->httpDir = argv[++i];
|
||||
} else if (strcmp(argv[i], "-httpport") == 0) { /* -httpport portnum */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->httpPort = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-enablehttpproxy") == 0) {
|
||||
rfbScreen->httpEnableProxyConnect = TRUE;
|
||||
} else if (strcmp(argv[i], "-progressive") == 0) { /* -httpport portnum */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
rfbScreen->progressiveSliceHeight = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-listen") == 0) { /* -listen ipaddr */
|
||||
if (i + 1 >= *argc) {
|
||||
rfbUsage();
|
||||
return FALSE;
|
||||
}
|
||||
if (! rfbStringToAddr(argv[++i], &(rfbScreen->listenInterface))) {
|
||||
return FALSE;
|
||||
}
|
||||
} else {
|
||||
rfbProtocolExtension* extension;
|
||||
int handled=0;
|
||||
|
||||
for(extension=rfbGetExtensionIterator();handled==0 && extension;
|
||||
extension=extension->next)
|
||||
if(extension->processArgument)
|
||||
handled = extension->processArgument(*argc - i, argv + i);
|
||||
rfbReleaseExtensionIterator();
|
||||
|
||||
if(handled==0) {
|
||||
i++;
|
||||
i1=i;
|
||||
continue;
|
||||
}
|
||||
i+=handled-1;
|
||||
}
|
||||
/* we just remove the processed arguments from the list */
|
||||
rfbPurgeArguments(argc,&i1,i-i1+1,argv);
|
||||
i=i1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
rfbProcessSizeArguments(int* width,int* height,int* bpp,int* argc, char *argv[])
|
||||
{
|
||||
int i,i1;
|
||||
|
||||
if(!argc) return TRUE;
|
||||
for (i = i1 = 1; i < *argc-1;) {
|
||||
if (strcmp(argv[i], "-bpp") == 0) {
|
||||
*bpp = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-width") == 0) {
|
||||
*width = atoi(argv[++i]);
|
||||
} else if (strcmp(argv[i], "-height") == 0) {
|
||||
*height = atoi(argv[++i]);
|
||||
} else {
|
||||
i++;
|
||||
i1=i;
|
||||
continue;
|
||||
}
|
||||
rfbPurgeArguments(argc,&i1,i-i1,argv);
|
||||
i=i1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
342
libvncserver/corre.c
Normal file
342
libvncserver/corre.c
Normal file
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
* corre.c
|
||||
*
|
||||
* Routines to implement Compact Rise-and-Run-length Encoding (CoRRE). This
|
||||
* code is based on krw's original javatel rfbserver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 RealVNC Ltd.
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
/*
|
||||
* cl->beforeEncBuf contains pixel data in the client's format.
|
||||
* cl->afterEncBuf contains the RRE encoded version. If the RRE encoded version is
|
||||
* larger than the raw data or if it exceeds cl->afterEncBufSize then
|
||||
* raw encoding is used instead.
|
||||
*/
|
||||
|
||||
static int subrectEncode8(rfbClientPtr cl, uint8_t *data, int w, int h);
|
||||
static int subrectEncode16(rfbClientPtr cl, uint16_t *data, int w, int h);
|
||||
static int subrectEncode32(rfbClientPtr cl, uint32_t *data, int w, int h);
|
||||
static uint32_t getBgColour(char *data, int size, int bpp);
|
||||
static rfbBool rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl, int x, int y,
|
||||
int w, int h);
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendRectEncodingCoRRE - send an arbitrary size rectangle using CoRRE
|
||||
* encoding.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendRectEncodingCoRRE(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
if (h > cl->correMaxHeight) {
|
||||
return (rfbSendRectEncodingCoRRE(cl, x, y, w, cl->correMaxHeight) &&
|
||||
rfbSendRectEncodingCoRRE(cl, x, y + cl->correMaxHeight, w,
|
||||
h - cl->correMaxHeight));
|
||||
}
|
||||
|
||||
if (w > cl->correMaxWidth) {
|
||||
return (rfbSendRectEncodingCoRRE(cl, x, y, cl->correMaxWidth, h) &&
|
||||
rfbSendRectEncodingCoRRE(cl, x + cl->correMaxWidth, y,
|
||||
w - cl->correMaxWidth, h));
|
||||
}
|
||||
|
||||
rfbSendSmallRectEncodingCoRRE(cl, x, y, w, h);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendSmallRectEncodingCoRRE - send a small (guaranteed < 256x256)
|
||||
* rectangle using CoRRE encoding.
|
||||
*/
|
||||
|
||||
static rfbBool
|
||||
rfbSendSmallRectEncodingCoRRE(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
rfbRREHeader hdr;
|
||||
int nSubrects;
|
||||
int i;
|
||||
char *fbptr = (cl->scaledScreen->frameBuffer + (cl->scaledScreen->paddedWidthInBytes * y)
|
||||
+ (x * (cl->scaledScreen->bitsPerPixel / 8)));
|
||||
|
||||
int maxRawSize = (cl->scaledScreen->width * cl->scaledScreen->height
|
||||
* (cl->format.bitsPerPixel / 8));
|
||||
|
||||
if (cl->beforeEncBufSize < maxRawSize) {
|
||||
cl->beforeEncBufSize = maxRawSize;
|
||||
if (cl->beforeEncBuf == NULL)
|
||||
cl->beforeEncBuf = (char *)malloc(cl->beforeEncBufSize);
|
||||
else
|
||||
cl->beforeEncBuf = (char *)realloc(cl->beforeEncBuf, cl->beforeEncBufSize);
|
||||
}
|
||||
|
||||
if (cl->afterEncBufSize < maxRawSize) {
|
||||
cl->afterEncBufSize = maxRawSize;
|
||||
if (cl->afterEncBuf == NULL)
|
||||
cl->afterEncBuf = (char *)malloc(cl->afterEncBufSize);
|
||||
else
|
||||
cl->afterEncBuf = (char *)realloc(cl->afterEncBuf, cl->afterEncBufSize);
|
||||
}
|
||||
|
||||
(*cl->translateFn)(cl->translateLookupTable,&(cl->screen->serverFormat),
|
||||
&cl->format, fbptr, cl->beforeEncBuf,
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h);
|
||||
|
||||
switch (cl->format.bitsPerPixel) {
|
||||
case 8:
|
||||
nSubrects = subrectEncode8(cl, (uint8_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
case 16:
|
||||
nSubrects = subrectEncode16(cl, (uint16_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
case 32:
|
||||
nSubrects = subrectEncode32(cl, (uint32_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
default:
|
||||
rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nSubrects < 0) {
|
||||
|
||||
/* RRE encoding was too large, use raw */
|
||||
|
||||
return rfbSendRectEncodingRaw(cl, x, y, w, h);
|
||||
}
|
||||
|
||||
rfbStatRecordEncodingSent(cl,rfbEncodingCoRRE,
|
||||
sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + cl->afterEncBufLen,
|
||||
sz_rfbFramebufferUpdateRectHeader + w * h * (cl->format.bitsPerPixel / 8));
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader
|
||||
> UPDATE_BUF_SIZE)
|
||||
{
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.r.x = Swap16IfLE(x);
|
||||
rect.r.y = Swap16IfLE(y);
|
||||
rect.r.w = Swap16IfLE(w);
|
||||
rect.r.h = Swap16IfLE(h);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingCoRRE);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
hdr.nSubrects = Swap32IfLE(nSubrects);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&hdr, sz_rfbRREHeader);
|
||||
cl->ublen += sz_rfbRREHeader;
|
||||
|
||||
for (i = 0; i < cl->afterEncBufLen;) {
|
||||
|
||||
int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen;
|
||||
|
||||
if (i + bytesToCopy > cl->afterEncBufLen) {
|
||||
bytesToCopy = cl->afterEncBufLen - i;
|
||||
}
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], &cl->afterEncBuf[i], bytesToCopy);
|
||||
|
||||
cl->ublen += bytesToCopy;
|
||||
i += bytesToCopy;
|
||||
|
||||
if (cl->ublen == UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* subrectEncode() encodes the given multicoloured rectangle as a background
|
||||
* colour overwritten by single-coloured rectangles. It returns the number
|
||||
* of subrectangles in the encoded buffer, or -1 if subrect encoding won't
|
||||
* fit in the buffer. It puts the encoded rectangles in cl->afterEncBuf. The
|
||||
* single-colour rectangle partition is not optimal, but does find the biggest
|
||||
* horizontal or vertical rectangle top-left anchored to each consecutive
|
||||
* coordinate position.
|
||||
*
|
||||
* The coding scheme is simply [<bgcolour><subrect><subrect>...] where each
|
||||
* <subrect> is [<colour><x><y><w><h>].
|
||||
*/
|
||||
|
||||
#define DEFINE_SUBRECT_ENCODE(bpp) \
|
||||
static int \
|
||||
subrectEncode##bpp(rfbClientPtr client, uint##bpp##_t *data, int w, int h) { \
|
||||
uint##bpp##_t cl; \
|
||||
rfbCoRRERectangle subrect; \
|
||||
int x,y; \
|
||||
int i,j; \
|
||||
int hx=0,hy,vx=0,vy; \
|
||||
int hyflag; \
|
||||
uint##bpp##_t *seg; \
|
||||
uint##bpp##_t *line; \
|
||||
int hw,hh,vw,vh; \
|
||||
int thex,they,thew,theh; \
|
||||
int numsubs = 0; \
|
||||
int newLen; \
|
||||
uint##bpp##_t bg = (uint##bpp##_t)getBgColour((char*)data,w*h,bpp); \
|
||||
\
|
||||
*((uint##bpp##_t*)client->afterEncBuf) = bg; \
|
||||
\
|
||||
client->afterEncBufLen = (bpp/8); \
|
||||
\
|
||||
for (y=0; y<h; y++) { \
|
||||
line = data+(y*w); \
|
||||
for (x=0; x<w; x++) { \
|
||||
if (line[x] != bg) { \
|
||||
cl = line[x]; \
|
||||
hy = y-1; \
|
||||
hyflag = 1; \
|
||||
for (j=y; j<h; j++) { \
|
||||
seg = data+(j*w); \
|
||||
if (seg[x] != cl) {break;} \
|
||||
i = x; \
|
||||
while ((seg[i] == cl) && (i < w)) i += 1; \
|
||||
i -= 1; \
|
||||
if (j == y) vx = hx = i; \
|
||||
if (i < vx) vx = i; \
|
||||
if ((hyflag > 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \
|
||||
} \
|
||||
vy = j-1; \
|
||||
\
|
||||
/* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \
|
||||
* We'll choose the bigger of the two. \
|
||||
*/ \
|
||||
hw = hx-x+1; \
|
||||
hh = hy-y+1; \
|
||||
vw = vx-x+1; \
|
||||
vh = vy-y+1; \
|
||||
\
|
||||
thex = x; \
|
||||
they = y; \
|
||||
\
|
||||
if ((hw*hh) > (vw*vh)) { \
|
||||
thew = hw; \
|
||||
theh = hh; \
|
||||
} else { \
|
||||
thew = vw; \
|
||||
theh = vh; \
|
||||
} \
|
||||
\
|
||||
subrect.x = thex; \
|
||||
subrect.y = they; \
|
||||
subrect.w = thew; \
|
||||
subrect.h = theh; \
|
||||
\
|
||||
newLen = client->afterEncBufLen + (bpp/8) + sz_rfbCoRRERectangle; \
|
||||
if ((newLen > (w * h * (bpp/8))) || (newLen > client->afterEncBufSize)) \
|
||||
return -1; \
|
||||
\
|
||||
numsubs += 1; \
|
||||
*((uint##bpp##_t*)(client->afterEncBuf + client->afterEncBufLen)) = cl; \
|
||||
client->afterEncBufLen += (bpp/8); \
|
||||
memcpy(&client->afterEncBuf[client->afterEncBufLen],&subrect,sz_rfbCoRRERectangle); \
|
||||
client->afterEncBufLen += sz_rfbCoRRERectangle; \
|
||||
\
|
||||
/* \
|
||||
* Now mark the subrect as done. \
|
||||
*/ \
|
||||
for (j=they; j < (they+theh); j++) { \
|
||||
for (i=thex; i < (thex+thew); i++) { \
|
||||
data[j*w+i] = bg; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return numsubs; \
|
||||
}
|
||||
|
||||
DEFINE_SUBRECT_ENCODE(8)
|
||||
DEFINE_SUBRECT_ENCODE(16)
|
||||
DEFINE_SUBRECT_ENCODE(32)
|
||||
|
||||
|
||||
/*
|
||||
* getBgColour() gets the most prevalent colour in a byte array.
|
||||
*/
|
||||
static uint32_t
|
||||
getBgColour(char *data, int size, int bpp)
|
||||
{
|
||||
|
||||
#define NUMCLRS 256
|
||||
|
||||
static int counts[NUMCLRS];
|
||||
int i,j,k;
|
||||
|
||||
int maxcount = 0;
|
||||
uint8_t maxclr = 0;
|
||||
|
||||
if (bpp != 8) {
|
||||
if (bpp == 16) {
|
||||
return ((uint16_t *)data)[0];
|
||||
} else if (bpp == 32) {
|
||||
return ((uint32_t *)data)[0];
|
||||
} else {
|
||||
rfbLog("getBgColour: bpp %d?\n",bpp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<NUMCLRS; i++) {
|
||||
counts[i] = 0;
|
||||
}
|
||||
|
||||
for (j=0; j<size; j++) {
|
||||
k = (int)(((uint8_t *)data)[j]);
|
||||
if (k >= NUMCLRS) {
|
||||
rfbLog("getBgColour: unusual colour = %d\n", k);
|
||||
return 0;
|
||||
}
|
||||
counts[k] += 1;
|
||||
if (counts[k] > maxcount) {
|
||||
maxcount = counts[k];
|
||||
maxclr = ((uint8_t *)data)[j];
|
||||
}
|
||||
}
|
||||
|
||||
return maxclr;
|
||||
}
|
||||
756
libvncserver/cursor.c
Normal file
756
libvncserver/cursor.c
Normal file
@@ -0,0 +1,756 @@
|
||||
/*
|
||||
* cursor.c - support for cursor shape updates.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
#include "rfb/rfbregion.h"
|
||||
#include "private.h"
|
||||
|
||||
void rfbScaledScreenUpdate(rfbScreenInfoPtr screen, int x1, int y1, int x2, int y2);
|
||||
|
||||
/*
|
||||
* Send cursor shape either in X-style format or in client pixel format.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendCursorShape(rfbClientPtr cl)
|
||||
{
|
||||
rfbCursorPtr pCursor;
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
rfbXCursorColors colors;
|
||||
int saved_ublen;
|
||||
int bitmapRowBytes, maskBytes, dataBytes;
|
||||
int i, j;
|
||||
uint8_t *bitmapData;
|
||||
uint8_t bitmapByte;
|
||||
|
||||
/* TODO: scale the cursor data to the correct size */
|
||||
|
||||
pCursor = cl->screen->getCursorPtr(cl);
|
||||
/*if(!pCursor) return TRUE;*/
|
||||
|
||||
if (cl->useRichCursorEncoding) {
|
||||
if(pCursor && !pCursor->richSource)
|
||||
rfbMakeRichCursorFromXCursor(cl->screen,pCursor);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingRichCursor);
|
||||
} else {
|
||||
if(pCursor && !pCursor->source)
|
||||
rfbMakeXCursorFromRichCursor(cl->screen,pCursor);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingXCursor);
|
||||
}
|
||||
|
||||
/* If there is no cursor, send update with empty cursor data. */
|
||||
|
||||
if ( pCursor && pCursor->width == 1 &&
|
||||
pCursor->height == 1 &&
|
||||
pCursor->mask[0] == 0 ) {
|
||||
pCursor = NULL;
|
||||
}
|
||||
|
||||
if (pCursor == NULL) {
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE ) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
rect.r.x = rect.r.y = 0;
|
||||
rect.r.w = rect.r.h = 0;
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Calculate data sizes. */
|
||||
|
||||
bitmapRowBytes = (pCursor->width + 7) / 8;
|
||||
maskBytes = bitmapRowBytes * pCursor->height;
|
||||
dataBytes = (cl->useRichCursorEncoding) ?
|
||||
(pCursor->width * pCursor->height *
|
||||
(cl->format.bitsPerPixel / 8)) : maskBytes;
|
||||
|
||||
/* Send buffer contents if needed. */
|
||||
|
||||
if ( cl->ublen + sz_rfbFramebufferUpdateRectHeader +
|
||||
sz_rfbXCursorColors + maskBytes + dataBytes > UPDATE_BUF_SIZE ) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ( cl->ublen + sz_rfbFramebufferUpdateRectHeader +
|
||||
sz_rfbXCursorColors + maskBytes + dataBytes > UPDATE_BUF_SIZE ) {
|
||||
return FALSE; /* FIXME. */
|
||||
}
|
||||
|
||||
saved_ublen = cl->ublen;
|
||||
|
||||
/* Prepare rectangle header. */
|
||||
|
||||
rect.r.x = Swap16IfLE(pCursor->xhot);
|
||||
rect.r.y = Swap16IfLE(pCursor->yhot);
|
||||
rect.r.w = Swap16IfLE(pCursor->width);
|
||||
rect.r.h = Swap16IfLE(pCursor->height);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
/* Prepare actual cursor data (depends on encoding used). */
|
||||
|
||||
if (!cl->useRichCursorEncoding) {
|
||||
/* XCursor encoding. */
|
||||
colors.foreRed = (char)(pCursor->foreRed >> 8);
|
||||
colors.foreGreen = (char)(pCursor->foreGreen >> 8);
|
||||
colors.foreBlue = (char)(pCursor->foreBlue >> 8);
|
||||
colors.backRed = (char)(pCursor->backRed >> 8);
|
||||
colors.backGreen = (char)(pCursor->backGreen >> 8);
|
||||
colors.backBlue = (char)(pCursor->backBlue >> 8);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&colors, sz_rfbXCursorColors);
|
||||
cl->ublen += sz_rfbXCursorColors;
|
||||
|
||||
bitmapData = (uint8_t *)pCursor->source;
|
||||
|
||||
for (i = 0; i < pCursor->height; i++) {
|
||||
for (j = 0; j < bitmapRowBytes; j++) {
|
||||
bitmapByte = bitmapData[i * bitmapRowBytes + j];
|
||||
cl->updateBuf[cl->ublen++] = (char)bitmapByte;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* RichCursor encoding. */
|
||||
int bpp1=cl->screen->serverFormat.bitsPerPixel/8,
|
||||
bpp2=cl->format.bitsPerPixel/8;
|
||||
(*cl->translateFn)(cl->translateLookupTable,
|
||||
&(cl->screen->serverFormat),
|
||||
&cl->format, (char*)pCursor->richSource,
|
||||
&cl->updateBuf[cl->ublen],
|
||||
pCursor->width*bpp1, pCursor->width, pCursor->height);
|
||||
|
||||
cl->ublen += pCursor->width*bpp2*pCursor->height;
|
||||
}
|
||||
|
||||
/* Prepare transparency mask. */
|
||||
|
||||
bitmapData = (uint8_t *)pCursor->mask;
|
||||
|
||||
for (i = 0; i < pCursor->height; i++) {
|
||||
for (j = 0; j < bitmapRowBytes; j++) {
|
||||
bitmapByte = bitmapData[i * bitmapRowBytes + j];
|
||||
cl->updateBuf[cl->ublen++] = (char)bitmapByte;
|
||||
}
|
||||
}
|
||||
|
||||
/* Send everything we have prepared in the cl->updateBuf[]. */
|
||||
rfbStatRecordEncodingSent(cl, (cl->useRichCursorEncoding ? rfbEncodingRichCursor : rfbEncodingXCursor),
|
||||
sz_rfbFramebufferUpdateRectHeader + (cl->ublen - saved_ublen), sz_rfbFramebufferUpdateRectHeader + (cl->ublen - saved_ublen));
|
||||
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Send cursor position (PointerPos pseudo-encoding).
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendCursorPos(rfbClientPtr cl)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.encoding = Swap32IfLE(rfbEncodingPointerPos);
|
||||
rect.r.x = Swap16IfLE(cl->screen->cursorX);
|
||||
rect.r.y = Swap16IfLE(cl->screen->cursorY);
|
||||
rect.r.w = 0;
|
||||
rect.r.h = 0;
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
rfbStatRecordEncodingSent(cl, rfbEncodingPointerPos, sz_rfbFramebufferUpdateRectHeader, sz_rfbFramebufferUpdateRectHeader);
|
||||
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* conversion routine for predefined cursors in LSB order */
|
||||
unsigned char rfbReverseByte[0x100] = {
|
||||
/* copied from Xvnc/lib/font/util/utilbitmap.c */
|
||||
0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
|
||||
0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
|
||||
0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
|
||||
0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
|
||||
0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
|
||||
0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
|
||||
0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
|
||||
0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
|
||||
0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
|
||||
0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
|
||||
0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
|
||||
0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
|
||||
0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
|
||||
0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
|
||||
0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
|
||||
0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
|
||||
0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
|
||||
0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
|
||||
0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
|
||||
0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
|
||||
0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
|
||||
0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
|
||||
0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
|
||||
0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
|
||||
0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
|
||||
0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
|
||||
0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
|
||||
0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
|
||||
0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
|
||||
0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
|
||||
0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
|
||||
0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
|
||||
};
|
||||
|
||||
void rfbConvertLSBCursorBitmapOrMask(int width,int height,unsigned char* bitmap)
|
||||
{
|
||||
int i,t=(width+7)/8*height;
|
||||
for(i=0;i<t;i++)
|
||||
bitmap[i]=rfbReverseByte[(int)bitmap[i]];
|
||||
}
|
||||
|
||||
/* Cursor creation. You "paint" a cursor and let these routines do the work */
|
||||
|
||||
rfbCursorPtr rfbMakeXCursor(int width,int height,char* cursorString,char* maskString)
|
||||
{
|
||||
int i,j,w=(width+7)/8;
|
||||
rfbCursorPtr cursor = (rfbCursorPtr)calloc(1,sizeof(rfbCursor));
|
||||
char* cp;
|
||||
unsigned char bit;
|
||||
|
||||
cursor->cleanup=TRUE;
|
||||
cursor->width=width;
|
||||
cursor->height=height;
|
||||
/*cursor->backRed=cursor->backGreen=cursor->backBlue=0xffff;*/
|
||||
cursor->foreRed=cursor->foreGreen=cursor->foreBlue=0xffff;
|
||||
|
||||
cursor->source = (unsigned char*)calloc(w,height);
|
||||
cursor->cleanupSource = TRUE;
|
||||
for(j=0,cp=cursorString;j<height;j++)
|
||||
for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++)
|
||||
if(*cp!=' ') cursor->source[j*w+i/8]|=bit;
|
||||
|
||||
if(maskString) {
|
||||
cursor->mask = (unsigned char*)calloc(w,height);
|
||||
for(j=0,cp=maskString;j<height;j++)
|
||||
for(i=0,bit=0x80;i<width;i++,bit=(bit&1)?0x80:bit>>1,cp++)
|
||||
if(*cp!=' ') cursor->mask[j*w+i/8]|=bit;
|
||||
} else
|
||||
cursor->mask = (unsigned char*)rfbMakeMaskForXCursor(width,height,(char*)cursor->source);
|
||||
cursor->cleanupMask = TRUE;
|
||||
|
||||
return(cursor);
|
||||
}
|
||||
|
||||
char* rfbMakeMaskForXCursor(int width,int height,char* source)
|
||||
{
|
||||
int i,j,w=(width+7)/8;
|
||||
char* mask=(char*)calloc(w,height);
|
||||
unsigned char c;
|
||||
|
||||
for(j=0;j<height;j++)
|
||||
for(i=w-1;i>=0;i--) {
|
||||
c=source[j*w+i];
|
||||
if(j>0) c|=source[(j-1)*w+i];
|
||||
if(j<height-1) c|=source[(j+1)*w+i];
|
||||
|
||||
if(i>0 && (c&0x80))
|
||||
mask[j*w+i-1]|=0x01;
|
||||
if(i<w-1 && (c&0x01))
|
||||
mask[j*w+i+1]|=0x80;
|
||||
|
||||
mask[j*w+i]|=(c<<1)|c|(c>>1);
|
||||
}
|
||||
|
||||
return(mask);
|
||||
}
|
||||
|
||||
/* this function dithers the alpha using Floyd-Steinberg */
|
||||
|
||||
char* rfbMakeMaskFromAlphaSource(int width,int height,unsigned char* alphaSource)
|
||||
{
|
||||
int* error=(int*)calloc(sizeof(int),width);
|
||||
int i,j,currentError=0,maskStride=(width+7)/8;
|
||||
unsigned char* result=(unsigned char*)calloc(maskStride,height);
|
||||
|
||||
for(j=0;j<height;j++)
|
||||
for(i=0;i<width;i++) {
|
||||
int right,middle,left;
|
||||
currentError+=alphaSource[i+width*j]+error[i];
|
||||
|
||||
if(currentError<0x80) {
|
||||
/* set to transparent */
|
||||
/* alpha was treated as 0 */
|
||||
} else {
|
||||
/* set to solid */
|
||||
result[i/8+j*maskStride]|=(0x100>>(i&7));
|
||||
/* alpha was treated as 0xff */
|
||||
currentError-=0xff;
|
||||
}
|
||||
/* propagate to next row */
|
||||
right=currentError/16;
|
||||
middle=currentError*5/16;
|
||||
left=currentError*3/16;
|
||||
currentError-=right+middle+left;
|
||||
error[i]=right;
|
||||
if(i>0) {
|
||||
error[i-1]=middle;
|
||||
if(i>1)
|
||||
error[i-2]=left;
|
||||
}
|
||||
}
|
||||
free(error);
|
||||
return (char *) result;
|
||||
}
|
||||
|
||||
void rfbFreeCursor(rfbCursorPtr cursor)
|
||||
{
|
||||
if(cursor) {
|
||||
if(cursor->cleanupRichSource && cursor->richSource)
|
||||
free(cursor->richSource);
|
||||
if(cursor->cleanupRichSource && cursor->alphaSource)
|
||||
free(cursor->alphaSource);
|
||||
if(cursor->cleanupSource && cursor->source)
|
||||
free(cursor->source);
|
||||
if(cursor->cleanupMask && cursor->mask)
|
||||
free(cursor->mask);
|
||||
if(cursor->cleanup)
|
||||
free(cursor);
|
||||
else {
|
||||
cursor->cleanup=cursor->cleanupSource=cursor->cleanupMask
|
||||
=cursor->cleanupRichSource=FALSE;
|
||||
cursor->source=cursor->mask=cursor->richSource=NULL;
|
||||
cursor->alphaSource=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* background and foregroud colour have to be set beforehand */
|
||||
void rfbMakeXCursorFromRichCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
|
||||
{
|
||||
rfbPixelFormat* format=&rfbScreen->serverFormat;
|
||||
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8,
|
||||
width=cursor->width*bpp;
|
||||
uint32_t background;
|
||||
char *back=(char*)&background;
|
||||
unsigned char bit;
|
||||
int interp = 0, db = 0;
|
||||
|
||||
if(cursor->source && cursor->cleanupSource)
|
||||
free(cursor->source);
|
||||
cursor->source=(unsigned char*)calloc(w,cursor->height);
|
||||
cursor->cleanupSource=TRUE;
|
||||
|
||||
if(format->bigEndian) {
|
||||
back+=4-bpp;
|
||||
}
|
||||
|
||||
/* all zeros means we should interpolate to black+white ourselves */
|
||||
if (!cursor->backRed && !cursor->backGreen && !cursor->backBlue &&
|
||||
!cursor->foreRed && !cursor->foreGreen && !cursor->foreBlue) {
|
||||
if (format->trueColour && (bpp == 1 || bpp == 2 || bpp == 4)) {
|
||||
interp = 1;
|
||||
cursor->foreRed = cursor->foreGreen = cursor->foreBlue = 0xffff;
|
||||
}
|
||||
}
|
||||
|
||||
background = ((format->redMax * cursor->backRed) / 0xffff) << format->redShift |
|
||||
((format->greenMax * cursor->backGreen) / 0xffff) << format->greenShift |
|
||||
((format->blueMax * cursor->backBlue) / 0xffff) << format->blueShift;
|
||||
|
||||
#define SETRGB(u) \
|
||||
r = (255 * (((format->redMax << format->redShift) & (*u)) >> format->redShift)) / format->redMax; \
|
||||
g = (255 * (((format->greenMax << format->greenShift) & (*u)) >> format->greenShift)) / format->greenMax; \
|
||||
b = (255 * (((format->blueMax << format->blueShift) & (*u)) >> format->blueShift)) / format->blueMax;
|
||||
|
||||
if (db) fprintf(stderr, "interp: %d\n", interp);
|
||||
|
||||
for(j=0;j<cursor->height;j++) {
|
||||
for(i=0,bit=0x80;i<cursor->width;i++,bit=(bit&1)?0x80:bit>>1) {
|
||||
if (interp) {
|
||||
int r = 0, g = 0, b = 0, grey;
|
||||
unsigned char *p = cursor->richSource+j*width+i*bpp;
|
||||
if (bpp == 1) {
|
||||
unsigned char* uc = (unsigned char*) p;
|
||||
SETRGB(uc);
|
||||
} else if (bpp == 2) {
|
||||
unsigned short* us = (unsigned short*) p;
|
||||
SETRGB(us);
|
||||
} else if (bpp == 4) {
|
||||
unsigned int* ui = (unsigned int*) p;
|
||||
SETRGB(ui);
|
||||
}
|
||||
grey = (r + g + b) / 3;
|
||||
if (grey >= 128) {
|
||||
cursor->source[j*w+i/8]|=bit;
|
||||
if (db) fprintf(stderr, "1");
|
||||
} else {
|
||||
if (db) fprintf(stderr, "0");
|
||||
}
|
||||
|
||||
} else if(memcmp(cursor->richSource+j*width+i*bpp, back, bpp)) {
|
||||
cursor->source[j*w+i/8]|=bit;
|
||||
}
|
||||
}
|
||||
if (db) fprintf(stderr, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
void rfbMakeRichCursorFromXCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr cursor)
|
||||
{
|
||||
rfbPixelFormat* format=&rfbScreen->serverFormat;
|
||||
int i,j,w=(cursor->width+7)/8,bpp=format->bitsPerPixel/8;
|
||||
uint32_t background,foreground;
|
||||
char *back=(char*)&background,*fore=(char*)&foreground;
|
||||
unsigned char *cp;
|
||||
unsigned char bit;
|
||||
|
||||
if(cursor->richSource && cursor->cleanupRichSource)
|
||||
free(cursor->richSource);
|
||||
cp=cursor->richSource=(unsigned char*)calloc(cursor->width*bpp,cursor->height);
|
||||
cursor->cleanupRichSource=TRUE;
|
||||
|
||||
if(format->bigEndian) {
|
||||
back+=4-bpp;
|
||||
fore+=4-bpp;
|
||||
}
|
||||
|
||||
background=cursor->backRed<<format->redShift|
|
||||
cursor->backGreen<<format->greenShift|cursor->backBlue<<format->blueShift;
|
||||
foreground=cursor->foreRed<<format->redShift|
|
||||
cursor->foreGreen<<format->greenShift|cursor->foreBlue<<format->blueShift;
|
||||
|
||||
for(j=0;j<cursor->height;j++)
|
||||
for(i=0,bit=0x80;i<cursor->width;i++,bit=(bit&1)?0x80:bit>>1,cp+=bpp)
|
||||
if(cursor->source[j*w+i/8]&bit) memcpy(cp,fore,bpp);
|
||||
else memcpy(cp,back,bpp);
|
||||
}
|
||||
|
||||
/* functions to draw/hide cursor directly in the frame buffer */
|
||||
|
||||
void rfbHideCursor(rfbClientPtr cl)
|
||||
{
|
||||
rfbScreenInfoPtr s=cl->screen;
|
||||
rfbCursorPtr c=s->cursor;
|
||||
int j,x1,x2,y1,y2,bpp=s->serverFormat.bitsPerPixel/8,
|
||||
rowstride=s->paddedWidthInBytes;
|
||||
LOCK(s->cursorMutex);
|
||||
if(!c) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return;
|
||||
}
|
||||
|
||||
/* restore what is under the cursor */
|
||||
x1=cl->cursorX-c->xhot;
|
||||
x2=x1+c->width;
|
||||
if(x1<0) x1=0;
|
||||
if(x2>=s->width) x2=s->width-1;
|
||||
x2-=x1; if(x2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return;
|
||||
}
|
||||
y1=cl->cursorY-c->yhot;
|
||||
y2=y1+c->height;
|
||||
if(y1<0) y1=0;
|
||||
if(y2>=s->height) y2=s->height-1;
|
||||
y2-=y1; if(y2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get saved data */
|
||||
for(j=0;j<y2;j++)
|
||||
memcpy(s->frameBuffer+(y1+j)*rowstride+x1*bpp,
|
||||
s->underCursorBuffer+j*x2*bpp,
|
||||
x2*bpp);
|
||||
|
||||
/* Copy to all scaled versions */
|
||||
rfbScaledScreenUpdate(s, x1, y1, x1+x2, y1+y2);
|
||||
|
||||
UNLOCK(s->cursorMutex);
|
||||
}
|
||||
|
||||
void rfbShowCursor(rfbClientPtr cl)
|
||||
{
|
||||
rfbScreenInfoPtr s=cl->screen;
|
||||
rfbCursorPtr c=s->cursor;
|
||||
int i,j,x1,x2,y1,y2,i1,j1,bpp=s->serverFormat.bitsPerPixel/8,
|
||||
rowstride=s->paddedWidthInBytes,
|
||||
bufSize,w;
|
||||
rfbBool wasChanged=FALSE;
|
||||
|
||||
if(!c) return;
|
||||
LOCK(s->cursorMutex);
|
||||
|
||||
bufSize=c->width*c->height*bpp;
|
||||
w=(c->width+7)/8;
|
||||
if(s->underCursorBufferLen<bufSize) {
|
||||
if(s->underCursorBuffer!=NULL)
|
||||
free(s->underCursorBuffer);
|
||||
s->underCursorBuffer=malloc(bufSize);
|
||||
s->underCursorBufferLen=bufSize;
|
||||
}
|
||||
|
||||
/* save what is under the cursor */
|
||||
i1=j1=0; /* offset in cursor */
|
||||
x1=cl->cursorX-c->xhot;
|
||||
x2=x1+c->width;
|
||||
if(x1<0) { i1=-x1; x1=0; }
|
||||
if(x2>=s->width) x2=s->width-1;
|
||||
x2-=x1; if(x2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return; /* nothing to do */
|
||||
}
|
||||
|
||||
y1=cl->cursorY-c->yhot;
|
||||
y2=y1+c->height;
|
||||
if(y1<0) { j1=-y1; y1=0; }
|
||||
if(y2>=s->height) y2=s->height-1;
|
||||
y2-=y1; if(y2<=0) {
|
||||
UNLOCK(s->cursorMutex);
|
||||
return; /* nothing to do */
|
||||
}
|
||||
|
||||
/* save data */
|
||||
for(j=0;j<y2;j++) {
|
||||
char* dest=s->underCursorBuffer+j*x2*bpp;
|
||||
const char* src=s->frameBuffer+(y1+j)*rowstride+x1*bpp;
|
||||
unsigned int count=x2*bpp;
|
||||
if(wasChanged || memcmp(dest,src,count)) {
|
||||
wasChanged=TRUE;
|
||||
memcpy(dest,src,count);
|
||||
}
|
||||
}
|
||||
|
||||
if(!c->richSource)
|
||||
rfbMakeRichCursorFromXCursor(s,c);
|
||||
|
||||
if (c->alphaSource) {
|
||||
int rmax, rshift;
|
||||
int gmax, gshift;
|
||||
int bmax, bshift;
|
||||
int amax = 255; /* alphaSource is always 8bits of info per pixel */
|
||||
unsigned int rmask, gmask, bmask;
|
||||
|
||||
rmax = s->serverFormat.redMax;
|
||||
gmax = s->serverFormat.greenMax;
|
||||
bmax = s->serverFormat.blueMax;
|
||||
rshift = s->serverFormat.redShift;
|
||||
gshift = s->serverFormat.greenShift;
|
||||
bshift = s->serverFormat.blueShift;
|
||||
|
||||
rmask = (rmax << rshift);
|
||||
gmask = (gmax << gshift);
|
||||
bmask = (bmax << bshift);
|
||||
|
||||
for(j=0;j<y2;j++) {
|
||||
for(i=0;i<x2;i++) {
|
||||
/*
|
||||
* we loop over the whole cursor ignoring c->mask[],
|
||||
* using the extracted alpha value instead.
|
||||
*/
|
||||
char *dest;
|
||||
unsigned char *src, *aptr;
|
||||
unsigned int val, dval, sval;
|
||||
int rdst, gdst, bdst; /* fb RGB */
|
||||
int asrc, rsrc, gsrc, bsrc; /* rich source ARGB */
|
||||
|
||||
dest = s->frameBuffer + (j+y1)*rowstride + (i+x1)*bpp;
|
||||
src = c->richSource + (j+j1)*c->width*bpp + (i+i1)*bpp;
|
||||
aptr = c->alphaSource + (j+j1)*c->width + (i+i1);
|
||||
|
||||
asrc = *aptr;
|
||||
if (!asrc) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bpp == 1) {
|
||||
dval = *((unsigned char*) dest);
|
||||
sval = *((unsigned char*) src);
|
||||
} else if (bpp == 2) {
|
||||
dval = *((unsigned short*) dest);
|
||||
sval = *((unsigned short*) src);
|
||||
} else if (bpp == 3) {
|
||||
unsigned char *dst = (unsigned char *) dest;
|
||||
dval = 0;
|
||||
dval |= ((*(dst+0)) << 0);
|
||||
dval |= ((*(dst+1)) << 8);
|
||||
dval |= ((*(dst+2)) << 16);
|
||||
sval = 0;
|
||||
sval |= ((*(src+0)) << 0);
|
||||
sval |= ((*(src+1)) << 8);
|
||||
sval |= ((*(src+2)) << 16);
|
||||
} else if (bpp == 4) {
|
||||
dval = *((unsigned int*) dest);
|
||||
sval = *((unsigned int*) src);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* extract dest and src RGB */
|
||||
rdst = (dval & rmask) >> rshift; /* fb */
|
||||
gdst = (dval & gmask) >> gshift;
|
||||
bdst = (dval & bmask) >> bshift;
|
||||
|
||||
rsrc = (sval & rmask) >> rshift; /* richcursor */
|
||||
gsrc = (sval & gmask) >> gshift;
|
||||
bsrc = (sval & bmask) >> bshift;
|
||||
|
||||
/* blend in fb data. */
|
||||
if (! c->alphaPreMultiplied) {
|
||||
rsrc = (asrc * rsrc)/amax;
|
||||
gsrc = (asrc * gsrc)/amax;
|
||||
bsrc = (asrc * bsrc)/amax;
|
||||
}
|
||||
rdst = rsrc + ((amax - asrc) * rdst)/amax;
|
||||
gdst = gsrc + ((amax - asrc) * gdst)/amax;
|
||||
bdst = bsrc + ((amax - asrc) * bdst)/amax;
|
||||
|
||||
val = 0;
|
||||
val |= (rdst << rshift);
|
||||
val |= (gdst << gshift);
|
||||
val |= (bdst << bshift);
|
||||
|
||||
/* insert the cooked pixel into the fb */
|
||||
memcpy(dest, &val, bpp);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* now the cursor has to be drawn */
|
||||
for(j=0;j<y2;j++)
|
||||
for(i=0;i<x2;i++)
|
||||
if((c->mask[(j+j1)*w+(i+i1)/8]<<((i+i1)&7))&0x80)
|
||||
memcpy(s->frameBuffer+(j+y1)*rowstride+(i+x1)*bpp,
|
||||
c->richSource+(j+j1)*c->width*bpp+(i+i1)*bpp,bpp);
|
||||
}
|
||||
|
||||
/* Copy to all scaled versions */
|
||||
rfbScaledScreenUpdate(s, x1, y1, x1+x2, y1+y2);
|
||||
|
||||
UNLOCK(s->cursorMutex);
|
||||
}
|
||||
|
||||
/*
|
||||
* If enableCursorShapeUpdates is FALSE, and the cursor is hidden, make sure
|
||||
* that if the frameBuffer was transmitted with a cursor drawn, then that
|
||||
* region gets redrawn.
|
||||
*/
|
||||
|
||||
void rfbRedrawAfterHideCursor(rfbClientPtr cl,sraRegionPtr updateRegion)
|
||||
{
|
||||
rfbScreenInfoPtr s = cl->screen;
|
||||
rfbCursorPtr c = s->cursor;
|
||||
|
||||
if(c) {
|
||||
int x,y,x2,y2;
|
||||
|
||||
x = cl->cursorX-c->xhot;
|
||||
y = cl->cursorY-c->yhot;
|
||||
x2 = x+c->width;
|
||||
y2 = y+c->height;
|
||||
|
||||
if(sraClipRect2(&x,&y,&x2,&y2,0,0,s->width,s->height)) {
|
||||
sraRegionPtr rect;
|
||||
rect = sraRgnCreateRect(x,y,x2,y2);
|
||||
if(updateRegion) {
|
||||
sraRgnOr(updateRegion,rect);
|
||||
} else {
|
||||
LOCK(cl->updateMutex);
|
||||
sraRgnOr(cl->modifiedRegion,rect);
|
||||
UNLOCK(cl->updateMutex);
|
||||
}
|
||||
sraRgnDestroy(rect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
static void rfbPrintXCursor(rfbCursorPtr cursor)
|
||||
{
|
||||
int i,i1,j,w=(cursor->width+7)/8;
|
||||
unsigned char bit;
|
||||
for(j=0;j<cursor->height;j++) {
|
||||
for(i=0,i1=0,bit=0x80;i1<cursor->width;i1++,i+=(bit&1)?1:0,bit=(bit&1)?0x80:bit>>1)
|
||||
if(cursor->source[j*w+i]&bit) putchar('#'); else putchar(' ');
|
||||
putchar(':');
|
||||
for(i=0,i1=0,bit=0x80;i1<cursor->width;i1++,i+=(bit&1)?1:0,bit=(bit&1)?0x80:bit>>1)
|
||||
if(cursor->mask[j*w+i]&bit) putchar('#'); else putchar(' ');
|
||||
putchar('\n');
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void rfbSetCursor(rfbScreenInfoPtr rfbScreen,rfbCursorPtr c)
|
||||
{
|
||||
rfbClientIteratorPtr iterator;
|
||||
rfbClientPtr cl;
|
||||
|
||||
LOCK(rfbScreen->cursorMutex);
|
||||
|
||||
if(rfbScreen->cursor) {
|
||||
iterator=rfbGetClientIterator(rfbScreen);
|
||||
while((cl=rfbClientIteratorNext(iterator)))
|
||||
if(!cl->enableCursorShapeUpdates)
|
||||
rfbRedrawAfterHideCursor(cl,NULL);
|
||||
rfbReleaseClientIterator(iterator);
|
||||
|
||||
if(rfbScreen->cursor->cleanup)
|
||||
rfbFreeCursor(rfbScreen->cursor);
|
||||
}
|
||||
|
||||
rfbScreen->cursor = c;
|
||||
|
||||
iterator=rfbGetClientIterator(rfbScreen);
|
||||
while((cl=rfbClientIteratorNext(iterator))) {
|
||||
cl->cursorWasChanged = TRUE;
|
||||
if(!cl->enableCursorShapeUpdates)
|
||||
rfbRedrawAfterHideCursor(cl,NULL);
|
||||
}
|
||||
rfbReleaseClientIterator(iterator);
|
||||
|
||||
UNLOCK(rfbScreen->cursorMutex);
|
||||
}
|
||||
|
||||
38
libvncserver/cutpaste.c
Normal file
38
libvncserver/cutpaste.c
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* cutpaste.c - routines to deal with cut & paste buffers / selection.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
|
||||
/*
|
||||
* rfbSetXCutText sets the cut buffer to be the given string. We also clear
|
||||
* the primary selection. Ideally we'd like to set it to the same thing, but I
|
||||
* can't work out how to do that without some kind of helper X client.
|
||||
*/
|
||||
|
||||
void rfbGotXCutText(rfbScreenInfoPtr rfbScreen, char *str, int len)
|
||||
{
|
||||
rfbSendServerCutText(rfbScreen, str, len);
|
||||
}
|
||||
436
libvncserver/d3des.c
Normal file
436
libvncserver/d3des.c
Normal file
@@ -0,0 +1,436 @@
|
||||
/*
|
||||
* This is D3DES (V5.09) by Richard Outerbridge with the double and
|
||||
* triple-length support removed for use in VNC. Also the bytebit[] array
|
||||
* has been reversed so that the most significant bit in each byte of the
|
||||
* key is ignored, not the least significant.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* D3DES (V5.09) -
|
||||
*
|
||||
* A portable, public domain, version of the Data Encryption Standard.
|
||||
*
|
||||
* Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
|
||||
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
|
||||
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
|
||||
* Ferguson, Eric Young and Dana How for comparing notes; and Ray Lau,
|
||||
* for humouring me on.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge.
|
||||
* (GEnie : OUTER; CIS : [71755,204]) Graven Imagery, 1992.
|
||||
*/
|
||||
|
||||
#include "d3des.h"
|
||||
|
||||
static void scrunch(unsigned char *, unsigned long *);
|
||||
static void unscrun(unsigned long *, unsigned char *);
|
||||
static void desfunc(unsigned long *, unsigned long *);
|
||||
static void cookey(unsigned long *);
|
||||
|
||||
static unsigned long KnL[32] = { 0L };
|
||||
/*
|
||||
static unsigned long KnR[32] = { 0L };
|
||||
static unsigned long Kn3[32] = { 0L };
|
||||
static unsigned char Df_Key[24] = {
|
||||
0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
|
||||
0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10,
|
||||
0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 };
|
||||
*/
|
||||
|
||||
static unsigned short bytebit[8] = {
|
||||
01, 02, 04, 010, 020, 040, 0100, 0200 };
|
||||
|
||||
static unsigned long bigbyte[24] = {
|
||||
0x800000L, 0x400000L, 0x200000L, 0x100000L,
|
||||
0x80000L, 0x40000L, 0x20000L, 0x10000L,
|
||||
0x8000L, 0x4000L, 0x2000L, 0x1000L,
|
||||
0x800L, 0x400L, 0x200L, 0x100L,
|
||||
0x80L, 0x40L, 0x20L, 0x10L,
|
||||
0x8L, 0x4L, 0x2L, 0x1L };
|
||||
|
||||
/* Use the key schedule specified in the Standard (ANSI X3.92-1981). */
|
||||
|
||||
static unsigned char pc1[56] = {
|
||||
56, 48, 40, 32, 24, 16, 8, 0, 57, 49, 41, 33, 25, 17,
|
||||
9, 1, 58, 50, 42, 34, 26, 18, 10, 2, 59, 51, 43, 35,
|
||||
62, 54, 46, 38, 30, 22, 14, 6, 61, 53, 45, 37, 29, 21,
|
||||
13, 5, 60, 52, 44, 36, 28, 20, 12, 4, 27, 19, 11, 3 };
|
||||
|
||||
static unsigned char totrot[16] = {
|
||||
1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28 };
|
||||
|
||||
static unsigned char pc2[48] = {
|
||||
13, 16, 10, 23, 0, 4, 2, 27, 14, 5, 20, 9,
|
||||
22, 18, 11, 3, 25, 7, 15, 6, 26, 19, 12, 1,
|
||||
40, 51, 30, 36, 46, 54, 29, 39, 50, 44, 32, 47,
|
||||
43, 48, 38, 55, 33, 52, 45, 41, 49, 35, 28, 31 };
|
||||
|
||||
void rfbDesKey(unsigned char *key,
|
||||
int edf)
|
||||
{
|
||||
register int i, j, l, m, n;
|
||||
unsigned char pc1m[56], pcr[56];
|
||||
unsigned long kn[32];
|
||||
|
||||
for ( j = 0; j < 56; j++ ) {
|
||||
l = pc1[j];
|
||||
m = l & 07;
|
||||
pc1m[j] = (key[l >> 3] & bytebit[m]) ? 1 : 0;
|
||||
}
|
||||
for( i = 0; i < 16; i++ ) {
|
||||
if( edf == DE1 ) m = (15 - i) << 1;
|
||||
else m = i << 1;
|
||||
n = m + 1;
|
||||
kn[m] = kn[n] = 0L;
|
||||
for( j = 0; j < 28; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 28 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 28; j < 56; j++ ) {
|
||||
l = j + totrot[i];
|
||||
if( l < 56 ) pcr[j] = pc1m[l];
|
||||
else pcr[j] = pc1m[l - 28];
|
||||
}
|
||||
for( j = 0; j < 24; j++ ) {
|
||||
if( pcr[pc2[j]] ) kn[m] |= bigbyte[j];
|
||||
if( pcr[pc2[j+24]] ) kn[n] |= bigbyte[j];
|
||||
}
|
||||
}
|
||||
cookey(kn);
|
||||
return;
|
||||
}
|
||||
|
||||
static void cookey(register unsigned long *raw1)
|
||||
{
|
||||
register unsigned long *cook, *raw0;
|
||||
unsigned long dough[32];
|
||||
register int i;
|
||||
|
||||
cook = dough;
|
||||
for( i = 0; i < 16; i++, raw1++ ) {
|
||||
raw0 = raw1++;
|
||||
*cook = (*raw0 & 0x00fc0000L) << 6;
|
||||
*cook |= (*raw0 & 0x00000fc0L) << 10;
|
||||
*cook |= (*raw1 & 0x00fc0000L) >> 10;
|
||||
*cook++ |= (*raw1 & 0x00000fc0L) >> 6;
|
||||
*cook = (*raw0 & 0x0003f000L) << 12;
|
||||
*cook |= (*raw0 & 0x0000003fL) << 16;
|
||||
*cook |= (*raw1 & 0x0003f000L) >> 4;
|
||||
*cook++ |= (*raw1 & 0x0000003fL);
|
||||
}
|
||||
rfbUseKey(dough);
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbCPKey(register unsigned long *into)
|
||||
{
|
||||
register unsigned long *from, *endp;
|
||||
|
||||
from = KnL, endp = &KnL[32];
|
||||
while( from < endp ) *into++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbUseKey(register unsigned long *from)
|
||||
{
|
||||
register unsigned long *to, *endp;
|
||||
|
||||
to = KnL, endp = &KnL[32];
|
||||
while( to < endp ) *to++ = *from++;
|
||||
return;
|
||||
}
|
||||
|
||||
void rfbDes(unsigned char *inblock,
|
||||
unsigned char *outblock)
|
||||
{
|
||||
unsigned long work[2];
|
||||
|
||||
scrunch(inblock, work);
|
||||
desfunc(work, KnL);
|
||||
unscrun(work, outblock);
|
||||
return;
|
||||
}
|
||||
|
||||
static void scrunch(register unsigned char *outof,
|
||||
register unsigned long *into)
|
||||
{
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into++ |= (*outof++ & 0xffL);
|
||||
*into = (*outof++ & 0xffL) << 24;
|
||||
*into |= (*outof++ & 0xffL) << 16;
|
||||
*into |= (*outof++ & 0xffL) << 8;
|
||||
*into |= (*outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static void unscrun(register unsigned long *outof,
|
||||
register unsigned char *into)
|
||||
{
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into++ = (unsigned char)( *outof++ & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 24) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 16) & 0xffL);
|
||||
*into++ = (unsigned char)((*outof >> 8) & 0xffL);
|
||||
*into = (unsigned char)( *outof & 0xffL);
|
||||
return;
|
||||
}
|
||||
|
||||
static unsigned long SP1[64] = {
|
||||
0x01010400L, 0x00000000L, 0x00010000L, 0x01010404L,
|
||||
0x01010004L, 0x00010404L, 0x00000004L, 0x00010000L,
|
||||
0x00000400L, 0x01010400L, 0x01010404L, 0x00000400L,
|
||||
0x01000404L, 0x01010004L, 0x01000000L, 0x00000004L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00010400L,
|
||||
0x00010400L, 0x01010000L, 0x01010000L, 0x01000404L,
|
||||
0x00010004L, 0x01000004L, 0x01000004L, 0x00010004L,
|
||||
0x00000000L, 0x00000404L, 0x00010404L, 0x01000000L,
|
||||
0x00010000L, 0x01010404L, 0x00000004L, 0x01010000L,
|
||||
0x01010400L, 0x01000000L, 0x01000000L, 0x00000400L,
|
||||
0x01010004L, 0x00010000L, 0x00010400L, 0x01000004L,
|
||||
0x00000400L, 0x00000004L, 0x01000404L, 0x00010404L,
|
||||
0x01010404L, 0x00010004L, 0x01010000L, 0x01000404L,
|
||||
0x01000004L, 0x00000404L, 0x00010404L, 0x01010400L,
|
||||
0x00000404L, 0x01000400L, 0x01000400L, 0x00000000L,
|
||||
0x00010004L, 0x00010400L, 0x00000000L, 0x01010004L };
|
||||
|
||||
static unsigned long SP2[64] = {
|
||||
0x80108020L, 0x80008000L, 0x00008000L, 0x00108020L,
|
||||
0x00100000L, 0x00000020L, 0x80100020L, 0x80008020L,
|
||||
0x80000020L, 0x80108020L, 0x80108000L, 0x80000000L,
|
||||
0x80008000L, 0x00100000L, 0x00000020L, 0x80100020L,
|
||||
0x00108000L, 0x00100020L, 0x80008020L, 0x00000000L,
|
||||
0x80000000L, 0x00008000L, 0x00108020L, 0x80100000L,
|
||||
0x00100020L, 0x80000020L, 0x00000000L, 0x00108000L,
|
||||
0x00008020L, 0x80108000L, 0x80100000L, 0x00008020L,
|
||||
0x00000000L, 0x00108020L, 0x80100020L, 0x00100000L,
|
||||
0x80008020L, 0x80100000L, 0x80108000L, 0x00008000L,
|
||||
0x80100000L, 0x80008000L, 0x00000020L, 0x80108020L,
|
||||
0x00108020L, 0x00000020L, 0x00008000L, 0x80000000L,
|
||||
0x00008020L, 0x80108000L, 0x00100000L, 0x80000020L,
|
||||
0x00100020L, 0x80008020L, 0x80000020L, 0x00100020L,
|
||||
0x00108000L, 0x00000000L, 0x80008000L, 0x00008020L,
|
||||
0x80000000L, 0x80100020L, 0x80108020L, 0x00108000L };
|
||||
|
||||
static unsigned long SP3[64] = {
|
||||
0x00000208L, 0x08020200L, 0x00000000L, 0x08020008L,
|
||||
0x08000200L, 0x00000000L, 0x00020208L, 0x08000200L,
|
||||
0x00020008L, 0x08000008L, 0x08000008L, 0x00020000L,
|
||||
0x08020208L, 0x00020008L, 0x08020000L, 0x00000208L,
|
||||
0x08000000L, 0x00000008L, 0x08020200L, 0x00000200L,
|
||||
0x00020200L, 0x08020000L, 0x08020008L, 0x00020208L,
|
||||
0x08000208L, 0x00020200L, 0x00020000L, 0x08000208L,
|
||||
0x00000008L, 0x08020208L, 0x00000200L, 0x08000000L,
|
||||
0x08020200L, 0x08000000L, 0x00020008L, 0x00000208L,
|
||||
0x00020000L, 0x08020200L, 0x08000200L, 0x00000000L,
|
||||
0x00000200L, 0x00020008L, 0x08020208L, 0x08000200L,
|
||||
0x08000008L, 0x00000200L, 0x00000000L, 0x08020008L,
|
||||
0x08000208L, 0x00020000L, 0x08000000L, 0x08020208L,
|
||||
0x00000008L, 0x00020208L, 0x00020200L, 0x08000008L,
|
||||
0x08020000L, 0x08000208L, 0x00000208L, 0x08020000L,
|
||||
0x00020208L, 0x00000008L, 0x08020008L, 0x00020200L };
|
||||
|
||||
static unsigned long SP4[64] = {
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802080L, 0x00800081L, 0x00800001L, 0x00002001L,
|
||||
0x00000000L, 0x00802000L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00800080L, 0x00800001L,
|
||||
0x00000001L, 0x00002000L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002001L, 0x00002080L,
|
||||
0x00800081L, 0x00000001L, 0x00002080L, 0x00800080L,
|
||||
0x00002000L, 0x00802080L, 0x00802081L, 0x00000081L,
|
||||
0x00800080L, 0x00800001L, 0x00802000L, 0x00802081L,
|
||||
0x00000081L, 0x00000000L, 0x00000000L, 0x00802000L,
|
||||
0x00002080L, 0x00800080L, 0x00800081L, 0x00000001L,
|
||||
0x00802001L, 0x00002081L, 0x00002081L, 0x00000080L,
|
||||
0x00802081L, 0x00000081L, 0x00000001L, 0x00002000L,
|
||||
0x00800001L, 0x00002001L, 0x00802080L, 0x00800081L,
|
||||
0x00002001L, 0x00002080L, 0x00800000L, 0x00802001L,
|
||||
0x00000080L, 0x00800000L, 0x00002000L, 0x00802080L };
|
||||
|
||||
static unsigned long SP5[64] = {
|
||||
0x00000100L, 0x02080100L, 0x02080000L, 0x42000100L,
|
||||
0x00080000L, 0x00000100L, 0x40000000L, 0x02080000L,
|
||||
0x40080100L, 0x00080000L, 0x02000100L, 0x40080100L,
|
||||
0x42000100L, 0x42080000L, 0x00080100L, 0x40000000L,
|
||||
0x02000000L, 0x40080000L, 0x40080000L, 0x00000000L,
|
||||
0x40000100L, 0x42080100L, 0x42080100L, 0x02000100L,
|
||||
0x42080000L, 0x40000100L, 0x00000000L, 0x42000000L,
|
||||
0x02080100L, 0x02000000L, 0x42000000L, 0x00080100L,
|
||||
0x00080000L, 0x42000100L, 0x00000100L, 0x02000000L,
|
||||
0x40000000L, 0x02080000L, 0x42000100L, 0x40080100L,
|
||||
0x02000100L, 0x40000000L, 0x42080000L, 0x02080100L,
|
||||
0x40080100L, 0x00000100L, 0x02000000L, 0x42080000L,
|
||||
0x42080100L, 0x00080100L, 0x42000000L, 0x42080100L,
|
||||
0x02080000L, 0x00000000L, 0x40080000L, 0x42000000L,
|
||||
0x00080100L, 0x02000100L, 0x40000100L, 0x00080000L,
|
||||
0x00000000L, 0x40080000L, 0x02080100L, 0x40000100L };
|
||||
|
||||
static unsigned long SP6[64] = {
|
||||
0x20000010L, 0x20400000L, 0x00004000L, 0x20404010L,
|
||||
0x20400000L, 0x00000010L, 0x20404010L, 0x00400000L,
|
||||
0x20004000L, 0x00404010L, 0x00400000L, 0x20000010L,
|
||||
0x00400010L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x00000000L, 0x00400010L, 0x20004010L, 0x00004000L,
|
||||
0x00404000L, 0x20004010L, 0x00000010L, 0x20400010L,
|
||||
0x20400010L, 0x00000000L, 0x00404010L, 0x20404000L,
|
||||
0x00004010L, 0x00404000L, 0x20404000L, 0x20000000L,
|
||||
0x20004000L, 0x00000010L, 0x20400010L, 0x00404000L,
|
||||
0x20404010L, 0x00400000L, 0x00004010L, 0x20000010L,
|
||||
0x00400000L, 0x20004000L, 0x20000000L, 0x00004010L,
|
||||
0x20000010L, 0x20404010L, 0x00404000L, 0x20400000L,
|
||||
0x00404010L, 0x20404000L, 0x00000000L, 0x20400010L,
|
||||
0x00000010L, 0x00004000L, 0x20400000L, 0x00404010L,
|
||||
0x00004000L, 0x00400010L, 0x20004010L, 0x00000000L,
|
||||
0x20404000L, 0x20000000L, 0x00400010L, 0x20004010L };
|
||||
|
||||
static unsigned long SP7[64] = {
|
||||
0x00200000L, 0x04200002L, 0x04000802L, 0x00000000L,
|
||||
0x00000800L, 0x04000802L, 0x00200802L, 0x04200800L,
|
||||
0x04200802L, 0x00200000L, 0x00000000L, 0x04000002L,
|
||||
0x00000002L, 0x04000000L, 0x04200002L, 0x00000802L,
|
||||
0x04000800L, 0x00200802L, 0x00200002L, 0x04000800L,
|
||||
0x04000002L, 0x04200000L, 0x04200800L, 0x00200002L,
|
||||
0x04200000L, 0x00000800L, 0x00000802L, 0x04200802L,
|
||||
0x00200800L, 0x00000002L, 0x04000000L, 0x00200800L,
|
||||
0x04000000L, 0x00200800L, 0x00200000L, 0x04000802L,
|
||||
0x04000802L, 0x04200002L, 0x04200002L, 0x00000002L,
|
||||
0x00200002L, 0x04000000L, 0x04000800L, 0x00200000L,
|
||||
0x04200800L, 0x00000802L, 0x00200802L, 0x04200800L,
|
||||
0x00000802L, 0x04000002L, 0x04200802L, 0x04200000L,
|
||||
0x00200800L, 0x00000000L, 0x00000002L, 0x04200802L,
|
||||
0x00000000L, 0x00200802L, 0x04200000L, 0x00000800L,
|
||||
0x04000002L, 0x04000800L, 0x00000800L, 0x00200002L };
|
||||
|
||||
static unsigned long SP8[64] = {
|
||||
0x10001040L, 0x00001000L, 0x00040000L, 0x10041040L,
|
||||
0x10000000L, 0x10001040L, 0x00000040L, 0x10000000L,
|
||||
0x00040040L, 0x10040000L, 0x10041040L, 0x00041000L,
|
||||
0x10041000L, 0x00041040L, 0x00001000L, 0x00000040L,
|
||||
0x10040000L, 0x10000040L, 0x10001000L, 0x00001040L,
|
||||
0x00041000L, 0x00040040L, 0x10040040L, 0x10041000L,
|
||||
0x00001040L, 0x00000000L, 0x00000000L, 0x10040040L,
|
||||
0x10000040L, 0x10001000L, 0x00041040L, 0x00040000L,
|
||||
0x00041040L, 0x00040000L, 0x10041000L, 0x00001000L,
|
||||
0x00000040L, 0x10040040L, 0x00001000L, 0x00041040L,
|
||||
0x10001000L, 0x00000040L, 0x10000040L, 0x10040000L,
|
||||
0x10040040L, 0x10000000L, 0x00040000L, 0x10001040L,
|
||||
0x00000000L, 0x10041040L, 0x00040040L, 0x10000040L,
|
||||
0x10040000L, 0x10001000L, 0x10001040L, 0x00000000L,
|
||||
0x10041040L, 0x00041000L, 0x00041000L, 0x00001040L,
|
||||
0x00001040L, 0x00040040L, 0x10000000L, 0x10041000L };
|
||||
|
||||
static void desfunc(register unsigned long *block,
|
||||
register unsigned long *keys)
|
||||
{
|
||||
register unsigned long fval, work, right, leftt;
|
||||
register int round;
|
||||
|
||||
leftt = block[0];
|
||||
right = block[1];
|
||||
work = ((leftt >> 4) ^ right) & 0x0f0f0f0fL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 4);
|
||||
work = ((leftt >> 16) ^ right) & 0x0000ffffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 16);
|
||||
work = ((right >> 2) ^ leftt) & 0x33333333L;
|
||||
leftt ^= work;
|
||||
right ^= (work << 2);
|
||||
work = ((right >> 8) ^ leftt) & 0x00ff00ffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 8);
|
||||
right = ((right << 1) | ((right >> 31) & 1L)) & 0xffffffffL;
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = ((leftt << 1) | ((leftt >> 31) & 1L)) & 0xffffffffL;
|
||||
|
||||
for( round = 0; round < 8; round++ ) {
|
||||
work = (right << 28) | (right >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = right ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
leftt ^= fval;
|
||||
work = (leftt << 28) | (leftt >> 4);
|
||||
work ^= *keys++;
|
||||
fval = SP7[ work & 0x3fL];
|
||||
fval |= SP5[(work >> 8) & 0x3fL];
|
||||
fval |= SP3[(work >> 16) & 0x3fL];
|
||||
fval |= SP1[(work >> 24) & 0x3fL];
|
||||
work = leftt ^ *keys++;
|
||||
fval |= SP8[ work & 0x3fL];
|
||||
fval |= SP6[(work >> 8) & 0x3fL];
|
||||
fval |= SP4[(work >> 16) & 0x3fL];
|
||||
fval |= SP2[(work >> 24) & 0x3fL];
|
||||
right ^= fval;
|
||||
}
|
||||
|
||||
right = (right << 31) | (right >> 1);
|
||||
work = (leftt ^ right) & 0xaaaaaaaaL;
|
||||
leftt ^= work;
|
||||
right ^= work;
|
||||
leftt = (leftt << 31) | (leftt >> 1);
|
||||
work = ((leftt >> 8) ^ right) & 0x00ff00ffL;
|
||||
right ^= work;
|
||||
leftt ^= (work << 8);
|
||||
work = ((leftt >> 2) ^ right) & 0x33333333L;
|
||||
right ^= work;
|
||||
leftt ^= (work << 2);
|
||||
work = ((right >> 16) ^ leftt) & 0x0000ffffL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 16);
|
||||
work = ((right >> 4) ^ leftt) & 0x0f0f0f0fL;
|
||||
leftt ^= work;
|
||||
right ^= (work << 4);
|
||||
*block++ = right;
|
||||
*block = leftt;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Validation sets:
|
||||
*
|
||||
* Single-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : c957 4425 6a5e d31d
|
||||
*
|
||||
* Double-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : 7f1d 0a77 826b 8aff
|
||||
*
|
||||
* Double-length key, double-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210
|
||||
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
|
||||
* Cipher : 27a0 8440 406a df60 278f 47cf 42d6 15d7
|
||||
*
|
||||
* Triple-length key, single-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
|
||||
* Plain : 0123 4567 89ab cde7
|
||||
* Cipher : de0b 7c06 ae5e 0ed5
|
||||
*
|
||||
* Triple-length key, double-length plaintext -
|
||||
* Key : 0123 4567 89ab cdef fedc ba98 7654 3210 89ab cdef 0123 4567
|
||||
* Plain : 0123 4567 89ab cdef 0123 4567 89ab cdff
|
||||
* Cipher : ad0d 1b30 ac17 cf07 0ed1 1c63 81e4 4de5
|
||||
*
|
||||
* d3des V5.0a rwo 9208.07 18:44 Graven Imagery
|
||||
**********************************************************************/
|
||||
56
libvncserver/d3des.h
Normal file
56
libvncserver/d3des.h
Normal file
@@ -0,0 +1,56 @@
|
||||
#ifndef D3DES_H
|
||||
#define D3DES_H
|
||||
|
||||
/*
|
||||
* This is D3DES (V5.09) by Richard Outerbridge with the double and
|
||||
* triple-length support removed for use in VNC.
|
||||
*
|
||||
* These changes are:
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
/* d3des.h -
|
||||
*
|
||||
* Headers and defines for d3des.c
|
||||
* Graven Imagery, 1992.
|
||||
*
|
||||
* Copyright (c) 1988,1989,1990,1991,1992 by Richard Outerbridge
|
||||
* (GEnie : OUTER; CIS : [71755,204])
|
||||
*/
|
||||
|
||||
#define EN0 0 /* MODE == encrypt */
|
||||
#define DE1 1 /* MODE == decrypt */
|
||||
|
||||
extern void rfbDesKey(unsigned char *, int);
|
||||
/* hexkey[8] MODE
|
||||
* Sets the internal key register according to the hexadecimal
|
||||
* key contained in the 8 bytes of hexkey, according to the DES,
|
||||
* for encryption or decryption according to MODE.
|
||||
*/
|
||||
|
||||
extern void rfbUseKey(unsigned long *);
|
||||
/* cookedkey[32]
|
||||
* Loads the internal key register with the data in cookedkey.
|
||||
*/
|
||||
|
||||
extern void rfbCPKey(unsigned long *);
|
||||
/* cookedkey[32]
|
||||
* Copies the contents of the internal key register into the storage
|
||||
* located at &cookedkey[0].
|
||||
*/
|
||||
|
||||
extern void rfbDes(unsigned char *, unsigned char *);
|
||||
/* from[8] to[8]
|
||||
* Encrypts/Decrypts (according to the key currently loaded in the
|
||||
* internal key register) one block of eight bytes at address 'from'
|
||||
* into the block at address 'to'. They can be the same.
|
||||
*/
|
||||
|
||||
/* d3des.h V5.09 rwo 9208.04 15:06 Graven Imagery
|
||||
********************************************************************/
|
||||
|
||||
#endif
|
||||
61
libvncserver/draw.c
Normal file
61
libvncserver/draw.c
Normal file
@@ -0,0 +1,61 @@
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
void rfbFillRect(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col)
|
||||
{
|
||||
int rowstride = s->paddedWidthInBytes, bpp = s->bitsPerPixel>>3;
|
||||
int i,j;
|
||||
char* colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
for(j=y1;j<y2;j++)
|
||||
for(i=x1;i<x2;i++)
|
||||
memcpy(s->frameBuffer+j*rowstride+i*bpp,colour,bpp);
|
||||
rfbMarkRectAsModified(s,x1,y1,x2,y2);
|
||||
}
|
||||
|
||||
#define SETPIXEL(x,y) \
|
||||
memcpy(s->frameBuffer+(y)*rowstride+(x)*bpp,colour,bpp)
|
||||
|
||||
void rfbDrawPixel(rfbScreenInfoPtr s,int x,int y,rfbPixel col)
|
||||
{
|
||||
int rowstride = s->paddedWidthInBytes, bpp = s->bitsPerPixel>>3;
|
||||
char* colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
SETPIXEL(x,y);
|
||||
rfbMarkRectAsModified(s,x,y,x+1,y+1);
|
||||
}
|
||||
|
||||
void rfbDrawLine(rfbScreenInfoPtr s,int x1,int y1,int x2,int y2,rfbPixel col)
|
||||
{
|
||||
int rowstride = s->paddedWidthInBytes, bpp = s->bitsPerPixel>>3;
|
||||
int i;
|
||||
char* colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
|
||||
#define SWAPPOINTS { i=x1; x1=x2; x2=i; i=y1; y1=y2; y2=i; }
|
||||
if(abs(x1-x2)<abs(y1-y2)) {
|
||||
if(y1>y2)
|
||||
SWAPPOINTS
|
||||
for(i=y1;i<=y2;i++)
|
||||
SETPIXEL(x1+(i-y1)*(x2-x1)/(y2-y1),i);
|
||||
/* TODO: Maybe make this more intelligently? */
|
||||
if(x2<x1) { i=x1; x1=x2; x2=i; }
|
||||
rfbMarkRectAsModified(s,x1,y1,x2+1,y2+1);
|
||||
} else {
|
||||
if(x1>x2)
|
||||
SWAPPOINTS
|
||||
else if(x1==x2) {
|
||||
rfbDrawPixel(s,x1,y1,col);
|
||||
return;
|
||||
}
|
||||
for(i=x1;i<=x2;i++)
|
||||
SETPIXEL(i,y1+(i-x1)*(y2-y1)/(x2-x1));
|
||||
if(y2<y1) { i=y1; y1=y2; y2=i; }
|
||||
rfbMarkRectAsModified(s,x1,y1,x2+1,y2+1);
|
||||
}
|
||||
}
|
||||
196
libvncserver/font.c
Normal file
196
libvncserver/font.c
Normal file
@@ -0,0 +1,196 @@
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
int rfbDrawChar(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,unsigned char c,rfbPixel col)
|
||||
{
|
||||
int i,j,width,height;
|
||||
unsigned char* data=font->data+font->metaData[c*5];
|
||||
unsigned char d=*data;
|
||||
int rowstride=rfbScreen->paddedWidthInBytes;
|
||||
int bpp=rfbScreen->serverFormat.bitsPerPixel/8;
|
||||
char *colour=(char*)&col;
|
||||
|
||||
if(!rfbEndianTest)
|
||||
colour += 4-bpp;
|
||||
|
||||
width=font->metaData[c*5+1];
|
||||
height=font->metaData[c*5+2];
|
||||
x+=font->metaData[c*5+3];
|
||||
y+=-font->metaData[c*5+4]-height+1;
|
||||
|
||||
for(j=0;j<height;j++) {
|
||||
for(i=0;i<width;i++) {
|
||||
if((i&7)==0) {
|
||||
d=*data;
|
||||
data++;
|
||||
}
|
||||
if(d&0x80 && y+j >= 0 && y+j < rfbScreen->height &&
|
||||
x+i >= 0 && x+i < rfbScreen->width)
|
||||
memcpy(rfbScreen->frameBuffer+(y+j)*rowstride+(x+i)*bpp,colour,bpp);
|
||||
d<<=1;
|
||||
}
|
||||
/* if((i&7)!=0) data++; */
|
||||
}
|
||||
return(width);
|
||||
}
|
||||
|
||||
void rfbDrawString(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,const char* string,rfbPixel colour)
|
||||
{
|
||||
while(*string) {
|
||||
x+=rfbDrawChar(rfbScreen,font,x,y,*string,colour);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
/* TODO: these two functions need to be more efficient */
|
||||
/* if col==bcol, assume transparent background */
|
||||
int rfbDrawCharWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,unsigned char c,
|
||||
int x1,int y1,int x2,int y2,
|
||||
rfbPixel col,rfbPixel bcol)
|
||||
{
|
||||
int i,j,width,height;
|
||||
unsigned char* data=font->data+font->metaData[c*5];
|
||||
unsigned char d;
|
||||
int rowstride=rfbScreen->paddedWidthInBytes;
|
||||
int bpp=rfbScreen->serverFormat.bitsPerPixel/8,extra_bytes=0;
|
||||
char* colour=(char*)&col;
|
||||
char* bcolour=(char*)&bcol;
|
||||
|
||||
if(!rfbEndianTest) {
|
||||
colour+=4-bpp;
|
||||
bcolour+=4-bpp;
|
||||
}
|
||||
|
||||
width=font->metaData[c*5+1];
|
||||
height=font->metaData[c*5+2];
|
||||
x+=font->metaData[c*5+3];
|
||||
y+=-font->metaData[c*5+4]-height+1;
|
||||
|
||||
/* after clipping, x2 will be count of bytes between rows,
|
||||
* x1 start of i, y1 start of j, width and height will be adjusted. */
|
||||
if(y1>y) { y1-=y; data+=(width+7)/8; height-=y1; y+=y1; } else y1=0;
|
||||
if(x1>x) { x1-=x; data+=x1; width-=x1; x+=x1; extra_bytes+=x1/8; } else x1=0;
|
||||
if(y2<y+height) height-=y+height-y2;
|
||||
if(x2<x+width) { extra_bytes+=(x1+width)/8-(x+width-x2+7)/8; width-=x+width-x2; }
|
||||
|
||||
d=*data;
|
||||
for(j=y1;j<height;j++) {
|
||||
if((x1&7)!=0)
|
||||
d=data[-1]; /* TODO: check if in this case extra_bytes is correct! */
|
||||
for(i=x1;i<width;i++) {
|
||||
if((i&7)==0) {
|
||||
d=*data;
|
||||
data++;
|
||||
}
|
||||
/* if(x+i>=x1 && x+i<x2 && y+j>=y1 && y+j<y2) */ {
|
||||
if(d&0x80) {
|
||||
memcpy(rfbScreen->frameBuffer+(y+j)*rowstride+(x+i)*bpp,
|
||||
colour,bpp);
|
||||
} else if(bcol!=col) {
|
||||
memcpy(rfbScreen->frameBuffer+(y+j)*rowstride+(x+i)*bpp,
|
||||
bcolour,bpp);
|
||||
}
|
||||
}
|
||||
d<<=1;
|
||||
}
|
||||
/* if((i&7)==0) data++; */
|
||||
data += extra_bytes;
|
||||
}
|
||||
return(width);
|
||||
}
|
||||
|
||||
void rfbDrawStringWithClip(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
int x,int y,const char* string,
|
||||
int x1,int y1,int x2,int y2,
|
||||
rfbPixel colour,rfbPixel backColour)
|
||||
{
|
||||
while(*string) {
|
||||
x+=rfbDrawCharWithClip(rfbScreen,font,x,y,*string,x1,y1,x2,y2,
|
||||
colour,backColour);
|
||||
string++;
|
||||
}
|
||||
}
|
||||
|
||||
int rfbWidthOfString(rfbFontDataPtr font,const char* string)
|
||||
{
|
||||
int i=0;
|
||||
while(*string) {
|
||||
i+=font->metaData[*string*5+1];
|
||||
string++;
|
||||
}
|
||||
return(i);
|
||||
}
|
||||
|
||||
int rfbWidthOfChar(rfbFontDataPtr font,unsigned char c)
|
||||
{
|
||||
return(font->metaData[c*5+1]+font->metaData[c*5+3]);
|
||||
}
|
||||
|
||||
void rfbFontBBox(rfbFontDataPtr font,unsigned char c,int* x1,int* y1,int* x2,int* y2)
|
||||
{
|
||||
*x1+=font->metaData[c*5+3];
|
||||
*y1+=-font->metaData[c*5+4]-font->metaData[c*5+2]+1;
|
||||
*x2=*x1+font->metaData[c*5+1]+1;
|
||||
*y2=*y1+font->metaData[c*5+2]+1;
|
||||
}
|
||||
|
||||
#ifndef INT_MAX
|
||||
#define INT_MAX 0x7fffffff
|
||||
#endif
|
||||
|
||||
void rfbWholeFontBBox(rfbFontDataPtr font,
|
||||
int *x1, int *y1, int *x2, int *y2)
|
||||
{
|
||||
int i;
|
||||
int* m=font->metaData;
|
||||
|
||||
(*x1)=(*y1)=INT_MAX; (*x2)=(*y2)=1-(INT_MAX);
|
||||
for(i=0;i<256;i++) {
|
||||
if(m[i*5+1]-m[i*5+3]>(*x2))
|
||||
(*x2)=m[i*5+1]-m[i*5+3];
|
||||
if(-m[i*5+2]+m[i*5+4]<(*y1))
|
||||
(*y1)=-m[i*5+2]+m[i*5+4];
|
||||
if(m[i*5+3]<(*x1))
|
||||
(*x1)=m[i*5+3];
|
||||
if(-m[i*5+4]>(*y2))
|
||||
(*y2)=-m[i*5+4];
|
||||
}
|
||||
(*x2)++;
|
||||
(*y2)++;
|
||||
}
|
||||
|
||||
rfbFontDataPtr rfbLoadConsoleFont(char *filename)
|
||||
{
|
||||
FILE *f=fopen(filename,"rb");
|
||||
rfbFontDataPtr p;
|
||||
int i;
|
||||
|
||||
if(!f) return NULL;
|
||||
|
||||
p=(rfbFontDataPtr)malloc(sizeof(rfbFontData));
|
||||
p->data=(unsigned char*)malloc(4096);
|
||||
if(1!=fread(p->data,4096,1,f)) {
|
||||
free(p->data);
|
||||
free(p);
|
||||
return NULL;
|
||||
}
|
||||
fclose(f);
|
||||
p->metaData=(int*)malloc(256*5*sizeof(int));
|
||||
for(i=0;i<256;i++) {
|
||||
p->metaData[i*5+0]=i*16; /* offset */
|
||||
p->metaData[i*5+1]=8; /* width */
|
||||
p->metaData[i*5+2]=16; /* height */
|
||||
p->metaData[i*5+3]=0; /* xhot */
|
||||
p->metaData[i*5+4]=0; /* yhot */
|
||||
}
|
||||
return(p);
|
||||
}
|
||||
|
||||
void rfbFreeFont(rfbFontDataPtr f)
|
||||
{
|
||||
free(f->data);
|
||||
free(f->metaData);
|
||||
free(f);
|
||||
}
|
||||
342
libvncserver/hextile.c
Normal file
342
libvncserver/hextile.c
Normal file
@@ -0,0 +1,342 @@
|
||||
/*
|
||||
* hextile.c
|
||||
*
|
||||
* Routines to implement Hextile Encoding
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
static rfbBool sendHextiles8(rfbClientPtr cl, int x, int y, int w, int h);
|
||||
static rfbBool sendHextiles16(rfbClientPtr cl, int x, int y, int w, int h);
|
||||
static rfbBool sendHextiles32(rfbClientPtr cl, int x, int y, int w, int h);
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendRectEncodingHextile - send a rectangle using hextile encoding.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendRectEncodingHextile(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.r.x = Swap16IfLE(x);
|
||||
rect.r.y = Swap16IfLE(y);
|
||||
rect.r.w = Swap16IfLE(w);
|
||||
rect.r.h = Swap16IfLE(h);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingHextile);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
rfbStatRecordEncodingSent(cl, rfbEncodingHextile,
|
||||
sz_rfbFramebufferUpdateRectHeader,
|
||||
sz_rfbFramebufferUpdateRectHeader + w * (cl->format.bitsPerPixel / 8) * h);
|
||||
|
||||
switch (cl->format.bitsPerPixel) {
|
||||
case 8:
|
||||
return sendHextiles8(cl, x, y, w, h);
|
||||
case 16:
|
||||
return sendHextiles16(cl, x, y, w, h);
|
||||
case 32:
|
||||
return sendHextiles32(cl, x, y, w, h);
|
||||
}
|
||||
|
||||
rfbLog("rfbSendRectEncodingHextile: bpp %d?\n", cl->format.bitsPerPixel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
#define PUT_PIXEL8(pix) (cl->updateBuf[cl->ublen++] = (pix))
|
||||
|
||||
#define PUT_PIXEL16(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1])
|
||||
|
||||
#define PUT_PIXEL32(pix) (cl->updateBuf[cl->ublen++] = ((char*)&(pix))[0], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[1], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[2], \
|
||||
cl->updateBuf[cl->ublen++] = ((char*)&(pix))[3])
|
||||
|
||||
|
||||
#define DEFINE_SEND_HEXTILES(bpp) \
|
||||
\
|
||||
\
|
||||
static rfbBool subrectEncode##bpp(rfbClientPtr cli, uint##bpp##_t *data, \
|
||||
int w, int h, uint##bpp##_t bg, uint##bpp##_t fg, rfbBool mono);\
|
||||
static void testColours##bpp(uint##bpp##_t *data, int size, rfbBool *mono, \
|
||||
rfbBool *solid, uint##bpp##_t *bg, uint##bpp##_t *fg); \
|
||||
\
|
||||
\
|
||||
/* \
|
||||
* rfbSendHextiles \
|
||||
*/ \
|
||||
\
|
||||
static rfbBool \
|
||||
sendHextiles##bpp(rfbClientPtr cl, int rx, int ry, int rw, int rh) { \
|
||||
int x, y, w, h; \
|
||||
int startUblen; \
|
||||
char *fbptr; \
|
||||
uint##bpp##_t bg = 0, fg = 0, newBg, newFg; \
|
||||
rfbBool mono, solid; \
|
||||
rfbBool validBg = FALSE; \
|
||||
rfbBool validFg = FALSE; \
|
||||
uint##bpp##_t clientPixelData[16*16*(bpp/8)]; \
|
||||
\
|
||||
for (y = ry; y < ry+rh; y += 16) { \
|
||||
for (x = rx; x < rx+rw; x += 16) { \
|
||||
w = h = 16; \
|
||||
if (rx+rw - x < 16) \
|
||||
w = rx+rw - x; \
|
||||
if (ry+rh - y < 16) \
|
||||
h = ry+rh - y; \
|
||||
\
|
||||
if ((cl->ublen + 1 + (2 + 16 * 16) * (bpp/8)) > \
|
||||
UPDATE_BUF_SIZE) { \
|
||||
if (!rfbSendUpdateBuf(cl)) \
|
||||
return FALSE; \
|
||||
} \
|
||||
\
|
||||
fbptr = (cl->scaledScreen->frameBuffer + (cl->scaledScreen->paddedWidthInBytes * y) \
|
||||
+ (x * (cl->scaledScreen->bitsPerPixel / 8))); \
|
||||
\
|
||||
(*cl->translateFn)(cl->translateLookupTable, &(cl->screen->serverFormat), \
|
||||
&cl->format, fbptr, (char *)clientPixelData, \
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h); \
|
||||
\
|
||||
startUblen = cl->ublen; \
|
||||
cl->updateBuf[startUblen] = 0; \
|
||||
cl->ublen++; \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, 1); \
|
||||
\
|
||||
testColours##bpp(clientPixelData, w * h, \
|
||||
&mono, &solid, &newBg, &newFg); \
|
||||
\
|
||||
if (!validBg || (newBg != bg)) { \
|
||||
validBg = TRUE; \
|
||||
bg = newBg; \
|
||||
cl->updateBuf[startUblen] |= rfbHextileBackgroundSpecified; \
|
||||
PUT_PIXEL##bpp(bg); \
|
||||
} \
|
||||
\
|
||||
if (solid) { \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
cl->updateBuf[startUblen] |= rfbHextileAnySubrects; \
|
||||
\
|
||||
if (mono) { \
|
||||
if (!validFg || (newFg != fg)) { \
|
||||
validFg = TRUE; \
|
||||
fg = newFg; \
|
||||
cl->updateBuf[startUblen] |= rfbHextileForegroundSpecified; \
|
||||
PUT_PIXEL##bpp(fg); \
|
||||
} \
|
||||
} else { \
|
||||
validFg = FALSE; \
|
||||
cl->updateBuf[startUblen] |= rfbHextileSubrectsColoured; \
|
||||
} \
|
||||
\
|
||||
if (!subrectEncode##bpp(cl, clientPixelData, w, h, bg, fg, mono)) { \
|
||||
/* encoding was too large, use raw */ \
|
||||
validBg = FALSE; \
|
||||
validFg = FALSE; \
|
||||
cl->ublen = startUblen; \
|
||||
cl->updateBuf[cl->ublen++] = rfbHextileRaw; \
|
||||
(*cl->translateFn)(cl->translateLookupTable, \
|
||||
&(cl->screen->serverFormat), &cl->format, fbptr, \
|
||||
(char *)clientPixelData, \
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h); \
|
||||
\
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)clientPixelData, \
|
||||
w * h * (bpp/8)); \
|
||||
\
|
||||
cl->ublen += w * h * (bpp/8); \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, \
|
||||
w * h * (bpp/8)); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
static rfbBool \
|
||||
subrectEncode##bpp(rfbClientPtr cl, uint##bpp##_t *data, int w, int h, \
|
||||
uint##bpp##_t bg, uint##bpp##_t fg, rfbBool mono) \
|
||||
{ \
|
||||
uint##bpp##_t cl2; \
|
||||
int x,y; \
|
||||
int i,j; \
|
||||
int hx=0,hy,vx=0,vy; \
|
||||
int hyflag; \
|
||||
uint##bpp##_t *seg; \
|
||||
uint##bpp##_t *line; \
|
||||
int hw,hh,vw,vh; \
|
||||
int thex,they,thew,theh; \
|
||||
int numsubs = 0; \
|
||||
int newLen; \
|
||||
int nSubrectsUblen; \
|
||||
\
|
||||
nSubrectsUblen = cl->ublen; \
|
||||
cl->ublen++; \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, 1); \
|
||||
\
|
||||
for (y=0; y<h; y++) { \
|
||||
line = data+(y*w); \
|
||||
for (x=0; x<w; x++) { \
|
||||
if (line[x] != bg) { \
|
||||
cl2 = line[x]; \
|
||||
hy = y-1; \
|
||||
hyflag = 1; \
|
||||
for (j=y; j<h; j++) { \
|
||||
seg = data+(j*w); \
|
||||
if (seg[x] != cl2) {break;} \
|
||||
i = x; \
|
||||
while ((seg[i] == cl2) && (i < w)) i += 1; \
|
||||
i -= 1; \
|
||||
if (j == y) vx = hx = i; \
|
||||
if (i < vx) vx = i; \
|
||||
if ((hyflag > 0) && (i >= hx)) { \
|
||||
hy += 1; \
|
||||
} else { \
|
||||
hyflag = 0; \
|
||||
} \
|
||||
} \
|
||||
vy = j-1; \
|
||||
\
|
||||
/* We now have two possible subrects: (x,y,hx,hy) and \
|
||||
* (x,y,vx,vy). We'll choose the bigger of the two. \
|
||||
*/ \
|
||||
hw = hx-x+1; \
|
||||
hh = hy-y+1; \
|
||||
vw = vx-x+1; \
|
||||
vh = vy-y+1; \
|
||||
\
|
||||
thex = x; \
|
||||
they = y; \
|
||||
\
|
||||
if ((hw*hh) > (vw*vh)) { \
|
||||
thew = hw; \
|
||||
theh = hh; \
|
||||
} else { \
|
||||
thew = vw; \
|
||||
theh = vh; \
|
||||
} \
|
||||
\
|
||||
if (mono) { \
|
||||
newLen = cl->ublen - nSubrectsUblen + 2; \
|
||||
} else { \
|
||||
newLen = cl->ublen - nSubrectsUblen + bpp/8 + 2; \
|
||||
} \
|
||||
\
|
||||
if (newLen > (w * h * (bpp/8))) \
|
||||
return FALSE; \
|
||||
\
|
||||
numsubs += 1; \
|
||||
\
|
||||
if (!mono) PUT_PIXEL##bpp(cl2); \
|
||||
\
|
||||
cl->updateBuf[cl->ublen++] = rfbHextilePackXY(thex,they); \
|
||||
cl->updateBuf[cl->ublen++] = rfbHextilePackWH(thew,theh); \
|
||||
rfbStatRecordEncodingSentAdd(cl, rfbEncodingHextile, 1); \
|
||||
\
|
||||
/* \
|
||||
* Now mark the subrect as done. \
|
||||
*/ \
|
||||
for (j=they; j < (they+theh); j++) { \
|
||||
for (i=thex; i < (thex+thew); i++) { \
|
||||
data[j*w+i] = bg; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
cl->updateBuf[nSubrectsUblen] = numsubs; \
|
||||
\
|
||||
return TRUE; \
|
||||
} \
|
||||
\
|
||||
\
|
||||
/* \
|
||||
* testColours() tests if there are one (solid), two (mono) or more \
|
||||
* colours in a tile and gets a reasonable guess at the best background \
|
||||
* pixel, and the foreground pixel for mono. \
|
||||
*/ \
|
||||
\
|
||||
static void \
|
||||
testColours##bpp(uint##bpp##_t *data, int size, rfbBool *mono, rfbBool *solid, \
|
||||
uint##bpp##_t *bg, uint##bpp##_t *fg) { \
|
||||
uint##bpp##_t colour1 = 0, colour2 = 0; \
|
||||
int n1 = 0, n2 = 0; \
|
||||
*mono = TRUE; \
|
||||
*solid = TRUE; \
|
||||
\
|
||||
for (; size > 0; size--, data++) { \
|
||||
\
|
||||
if (n1 == 0) \
|
||||
colour1 = *data; \
|
||||
\
|
||||
if (*data == colour1) { \
|
||||
n1++; \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
if (n2 == 0) { \
|
||||
*solid = FALSE; \
|
||||
colour2 = *data; \
|
||||
} \
|
||||
\
|
||||
if (*data == colour2) { \
|
||||
n2++; \
|
||||
continue; \
|
||||
} \
|
||||
\
|
||||
*mono = FALSE; \
|
||||
break; \
|
||||
} \
|
||||
\
|
||||
if (n1 > n2) { \
|
||||
*bg = colour1; \
|
||||
*fg = colour2; \
|
||||
} else { \
|
||||
*bg = colour2; \
|
||||
*fg = colour1; \
|
||||
} \
|
||||
}
|
||||
|
||||
DEFINE_SEND_HEXTILES(8)
|
||||
DEFINE_SEND_HEXTILES(16)
|
||||
DEFINE_SEND_HEXTILES(32)
|
||||
600
libvncserver/httpd.c
Normal file
600
libvncserver/httpd.c
Normal file
@@ -0,0 +1,600 @@
|
||||
/*
|
||||
* httpd.c - a simple HTTP server
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 RealVNC Ltd.
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
#include <ctype.h>
|
||||
#ifdef LIBVNCSERVER_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <winsock.h>
|
||||
#define close closesocket
|
||||
#else
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#include <pwd.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_LIBWRAP
|
||||
#include <tcpd.h>
|
||||
#endif
|
||||
|
||||
#define connection_close
|
||||
#ifndef connection_close
|
||||
|
||||
#define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\n\r\n" \
|
||||
"<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
|
||||
"<BODY><H1>File Not Found</H1></BODY>\n"
|
||||
|
||||
#define INVALID_REQUEST_STR "HTTP/1.0 400 Invalid Request\r\n\r\n" \
|
||||
"<HEAD><TITLE>Invalid Request</TITLE></HEAD>\n" \
|
||||
"<BODY><H1>Invalid request</H1></BODY>\n"
|
||||
|
||||
#define OK_STR "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"
|
||||
|
||||
#else
|
||||
|
||||
#define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\nConnection: close\r\n\r\n" \
|
||||
"<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
|
||||
"<BODY><H1>File Not Found</H1></BODY>\n"
|
||||
|
||||
#define INVALID_REQUEST_STR "HTTP/1.0 400 Invalid Request\r\nConnection: close\r\n\r\n" \
|
||||
"<HEAD><TITLE>Invalid Request</TITLE></HEAD>\n" \
|
||||
"<BODY><H1>Invalid request</H1></BODY>\n"
|
||||
|
||||
#define OK_STR "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n"
|
||||
|
||||
#endif
|
||||
|
||||
static void httpProcessInput(rfbScreenInfoPtr screen);
|
||||
static rfbBool compareAndSkip(char **ptr, const char *str);
|
||||
static rfbBool parseParams(const char *request, char *result, int max_bytes);
|
||||
static rfbBool validateString(char *str);
|
||||
|
||||
#define BUF_SIZE 32768
|
||||
|
||||
static char buf[BUF_SIZE];
|
||||
static size_t buf_filled=0;
|
||||
|
||||
/*
|
||||
* httpInitSockets sets up the TCP socket to listen for HTTP connections.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbHttpInitSockets(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
if (rfbScreen->httpInitDone)
|
||||
return;
|
||||
|
||||
rfbScreen->httpInitDone = TRUE;
|
||||
|
||||
if (!rfbScreen->httpDir)
|
||||
return;
|
||||
|
||||
if (rfbScreen->httpPort == 0) {
|
||||
rfbScreen->httpPort = rfbScreen->port-100;
|
||||
}
|
||||
|
||||
rfbLog("Listening for HTTP connections on TCP port %d\n", rfbScreen->httpPort);
|
||||
|
||||
rfbLog(" URL http://%s:%d\n",rfbScreen->thisHost,rfbScreen->httpPort);
|
||||
|
||||
if ((rfbScreen->httpListenSock =
|
||||
rfbListenOnTCPPort(rfbScreen->httpPort, rfbScreen->listenInterface)) < 0) {
|
||||
rfbLogPerror("ListenOnTCPPort");
|
||||
return;
|
||||
}
|
||||
|
||||
/*AddEnabledDevice(httpListenSock);*/
|
||||
}
|
||||
|
||||
void rfbHttpShutdownSockets(rfbScreenInfoPtr rfbScreen) {
|
||||
if(rfbScreen->httpSock>-1) {
|
||||
close(rfbScreen->httpSock);
|
||||
FD_CLR(rfbScreen->httpSock,&rfbScreen->allFds);
|
||||
rfbScreen->httpSock=-1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* httpCheckFds is called from ProcessInputEvents to check for input on the
|
||||
* HTTP socket(s). If there is input to process, httpProcessInput is called.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
int nfds;
|
||||
fd_set fds;
|
||||
struct timeval tv;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
|
||||
if (!rfbScreen->httpDir)
|
||||
return;
|
||||
|
||||
if (rfbScreen->httpListenSock < 0)
|
||||
return;
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(rfbScreen->httpListenSock, &fds);
|
||||
if (rfbScreen->httpSock >= 0) {
|
||||
FD_SET(rfbScreen->httpSock, &fds);
|
||||
}
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = 0;
|
||||
nfds = select(max(rfbScreen->httpSock,rfbScreen->httpListenSock) + 1, &fds, NULL, NULL, &tv);
|
||||
if (nfds == 0) {
|
||||
return;
|
||||
}
|
||||
if (nfds < 0) {
|
||||
#ifdef WIN32
|
||||
errno = WSAGetLastError();
|
||||
#endif
|
||||
if (errno != EINTR)
|
||||
rfbLogPerror("httpCheckFds: select");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((rfbScreen->httpSock >= 0) && FD_ISSET(rfbScreen->httpSock, &fds)) {
|
||||
httpProcessInput(rfbScreen);
|
||||
}
|
||||
|
||||
if (FD_ISSET(rfbScreen->httpListenSock, &fds)) {
|
||||
if (rfbScreen->httpSock >= 0) close(rfbScreen->httpSock);
|
||||
|
||||
if ((rfbScreen->httpSock = accept(rfbScreen->httpListenSock,
|
||||
(struct sockaddr *)&addr, &addrlen)) < 0) {
|
||||
rfbLogPerror("httpCheckFds: accept");
|
||||
return;
|
||||
}
|
||||
#ifdef USE_LIBWRAP
|
||||
if(!hosts_ctl("vnc",STRING_UNKNOWN,inet_ntoa(addr.sin_addr),
|
||||
STRING_UNKNOWN)) {
|
||||
rfbLog("Rejected HTTP connection from client %s\n",
|
||||
inet_ntoa(addr.sin_addr));
|
||||
close(rfbScreen->httpSock);
|
||||
rfbScreen->httpSock=-1;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if(!rfbSetNonBlocking(rfbScreen->httpSock)) {
|
||||
close(rfbScreen->httpSock);
|
||||
rfbScreen->httpSock=-1;
|
||||
return;
|
||||
}
|
||||
/*AddEnabledDevice(httpSock);*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
httpCloseSock(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
close(rfbScreen->httpSock);
|
||||
rfbScreen->httpSock = -1;
|
||||
buf_filled = 0;
|
||||
}
|
||||
|
||||
static rfbClientRec cl;
|
||||
|
||||
/*
|
||||
* httpProcessInput is called when input is received on the HTTP socket.
|
||||
*/
|
||||
|
||||
static void
|
||||
httpProcessInput(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
char fullFname[512];
|
||||
char params[1024];
|
||||
char *ptr;
|
||||
char *fname;
|
||||
unsigned int maxFnameLen;
|
||||
FILE* fd;
|
||||
rfbBool performSubstitutions = FALSE;
|
||||
char str[256+32];
|
||||
#ifndef WIN32
|
||||
char* user=getenv("USER");
|
||||
#endif
|
||||
|
||||
cl.sock=rfbScreen->httpSock;
|
||||
|
||||
if (strlen(rfbScreen->httpDir) > 255) {
|
||||
rfbErr("-httpd directory too long\n");
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
strcpy(fullFname, rfbScreen->httpDir);
|
||||
fname = &fullFname[strlen(fullFname)];
|
||||
maxFnameLen = 511 - strlen(fullFname);
|
||||
|
||||
buf_filled=0;
|
||||
|
||||
/* Read data from the HTTP client until we get a complete request. */
|
||||
while (1) {
|
||||
ssize_t got;
|
||||
|
||||
if (buf_filled > sizeof (buf)) {
|
||||
rfbErr("httpProcessInput: HTTP request is too long\n");
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
got = read (rfbScreen->httpSock, buf + buf_filled,
|
||||
sizeof (buf) - buf_filled - 1);
|
||||
|
||||
if (got <= 0) {
|
||||
if (got == 0) {
|
||||
rfbErr("httpd: premature connection close\n");
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
if (errno == EAGAIN) {
|
||||
return;
|
||||
}
|
||||
rfbLogPerror("httpProcessInput: read");
|
||||
}
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
buf_filled += got;
|
||||
buf[buf_filled] = '\0';
|
||||
|
||||
/* Is it complete yet (is there a blank line)? */
|
||||
if (strstr (buf, "\r\r") || strstr (buf, "\n\n") ||
|
||||
strstr (buf, "\r\n\r\n") || strstr (buf, "\n\r\n\r"))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* Process the request. */
|
||||
if(rfbScreen->httpEnableProxyConnect) {
|
||||
const static char* PROXY_OK_STR = "HTTP/1.0 200 OK\r\nContent-Type: octet-stream\r\nPragma: no-cache\r\n\r\n";
|
||||
if(!strncmp(buf, "CONNECT ", 8)) {
|
||||
if(atoi(strchr(buf, ':')+1)!=rfbScreen->port) {
|
||||
rfbErr("httpd: CONNECT format invalid.\n");
|
||||
rfbWriteExact(&cl,INVALID_REQUEST_STR, strlen(INVALID_REQUEST_STR));
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
/* proxy connection */
|
||||
rfbLog("httpd: client asked for CONNECT\n");
|
||||
rfbWriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR));
|
||||
rfbNewClientConnection(rfbScreen,rfbScreen->httpSock);
|
||||
rfbScreen->httpSock = -1;
|
||||
return;
|
||||
}
|
||||
if (!strncmp(buf, "GET ",4) && !strncmp(strchr(buf,'/'),"/proxied.connection HTTP/1.", 27)) {
|
||||
/* proxy connection */
|
||||
rfbLog("httpd: client asked for /proxied.connection\n");
|
||||
rfbWriteExact(&cl,PROXY_OK_STR,strlen(PROXY_OK_STR));
|
||||
rfbNewClientConnection(rfbScreen,rfbScreen->httpSock);
|
||||
rfbScreen->httpSock = -1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (strncmp(buf, "GET ", 4)) {
|
||||
rfbErr("httpd: no GET line\n");
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
} else {
|
||||
/* Only use the first line. */
|
||||
buf[strcspn(buf, "\n\r")] = '\0';
|
||||
}
|
||||
|
||||
if (strlen(buf) > maxFnameLen) {
|
||||
rfbErr("httpd: GET line too long\n");
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sscanf(buf, "GET %s HTTP/1.", fname) != 1) {
|
||||
rfbErr("httpd: couldn't parse GET line\n");
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
if (fname[0] != '/') {
|
||||
rfbErr("httpd: filename didn't begin with '/'\n");
|
||||
rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
if (strchr(fname+1, '/') != NULL) {
|
||||
rfbErr("httpd: asking for file in other directory\n");
|
||||
rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
getpeername(rfbScreen->httpSock, (struct sockaddr *)&addr, &addrlen);
|
||||
rfbLog("httpd: get '%s' for %s\n", fname+1,
|
||||
inet_ntoa(addr.sin_addr));
|
||||
|
||||
/* Extract parameters from the URL string if necessary */
|
||||
|
||||
params[0] = '\0';
|
||||
ptr = strchr(fname, '?');
|
||||
if (ptr != NULL) {
|
||||
*ptr = '\0';
|
||||
if (!parseParams(&ptr[1], params, 1024)) {
|
||||
params[0] = '\0';
|
||||
rfbErr("httpd: bad parameters in the URL\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* If we were asked for '/', actually read the file index.vnc */
|
||||
|
||||
if (strcmp(fname, "/") == 0) {
|
||||
strcpy(fname, "/index.vnc");
|
||||
rfbLog("httpd: defaulting to '%s'\n", fname+1);
|
||||
}
|
||||
|
||||
/* Substitutions are performed on files ending .vnc */
|
||||
|
||||
if (strlen(fname) >= 4 && strcmp(&fname[strlen(fname)-4], ".vnc") == 0) {
|
||||
performSubstitutions = TRUE;
|
||||
}
|
||||
|
||||
/* Open the file */
|
||||
|
||||
if ((fd = fopen(fullFname, "r")) == 0) {
|
||||
rfbLogPerror("httpProcessInput: open");
|
||||
rfbWriteExact(&cl, NOT_FOUND_STR, strlen(NOT_FOUND_STR));
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
rfbWriteExact(&cl, OK_STR, strlen(OK_STR));
|
||||
|
||||
while (1) {
|
||||
int n = fread(buf, 1, BUF_SIZE-1, fd);
|
||||
if (n < 0) {
|
||||
rfbLogPerror("httpProcessInput: read");
|
||||
fclose(fd);
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
|
||||
if (n == 0)
|
||||
break;
|
||||
|
||||
if (performSubstitutions) {
|
||||
|
||||
/* Substitute $WIDTH, $HEIGHT, etc with the appropriate values.
|
||||
This won't quite work properly if the .vnc file is longer than
|
||||
BUF_SIZE, but it's reasonable to assume that .vnc files will
|
||||
always be short. */
|
||||
|
||||
char *ptr = buf;
|
||||
char *dollar;
|
||||
buf[n] = 0; /* make sure it's null-terminated */
|
||||
|
||||
while ((dollar = strchr(ptr, '$'))!=NULL) {
|
||||
rfbWriteExact(&cl, ptr, (dollar - ptr));
|
||||
|
||||
ptr = dollar;
|
||||
|
||||
if (compareAndSkip(&ptr, "$WIDTH")) {
|
||||
|
||||
sprintf(str, "%d", rfbScreen->width);
|
||||
rfbWriteExact(&cl, str, strlen(str));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$HEIGHT")) {
|
||||
|
||||
sprintf(str, "%d", rfbScreen->height);
|
||||
rfbWriteExact(&cl, str, strlen(str));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$APPLETWIDTH")) {
|
||||
|
||||
sprintf(str, "%d", rfbScreen->width);
|
||||
rfbWriteExact(&cl, str, strlen(str));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$APPLETHEIGHT")) {
|
||||
|
||||
sprintf(str, "%d", rfbScreen->height + 32);
|
||||
rfbWriteExact(&cl, str, strlen(str));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$PORT")) {
|
||||
|
||||
sprintf(str, "%d", rfbScreen->port);
|
||||
rfbWriteExact(&cl, str, strlen(str));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$DESKTOP")) {
|
||||
|
||||
rfbWriteExact(&cl, rfbScreen->desktopName, strlen(rfbScreen->desktopName));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$DISPLAY")) {
|
||||
|
||||
sprintf(str, "%s:%d", rfbScreen->thisHost, rfbScreen->port-5900);
|
||||
rfbWriteExact(&cl, str, strlen(str));
|
||||
|
||||
} else if (compareAndSkip(&ptr, "$USER")) {
|
||||
#ifndef WIN32
|
||||
if (user) {
|
||||
rfbWriteExact(&cl, user,
|
||||
strlen(user));
|
||||
} else
|
||||
#endif
|
||||
rfbWriteExact(&cl, "?", 1);
|
||||
} else if (compareAndSkip(&ptr, "$PARAMS")) {
|
||||
if (params[0] != '\0')
|
||||
rfbWriteExact(&cl, params, strlen(params));
|
||||
} else {
|
||||
if (!compareAndSkip(&ptr, "$$"))
|
||||
ptr++;
|
||||
|
||||
if (rfbWriteExact(&cl, "$", 1) < 0) {
|
||||
fclose(fd);
|
||||
httpCloseSock(rfbScreen);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rfbWriteExact(&cl, ptr, (&buf[n] - ptr)) < 0)
|
||||
break;
|
||||
|
||||
} else {
|
||||
|
||||
/* For files not ending .vnc, just write out the buffer */
|
||||
|
||||
if (rfbWriteExact(&cl, buf, n) < 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(fd);
|
||||
httpCloseSock(rfbScreen);
|
||||
}
|
||||
|
||||
|
||||
static rfbBool
|
||||
compareAndSkip(char **ptr, const char *str)
|
||||
{
|
||||
if (strncmp(*ptr, str, strlen(str)) == 0) {
|
||||
*ptr += strlen(str);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Parse the request tail after the '?' character, and format a sequence
|
||||
* of <param> tags for inclusion into an HTML page with embedded applet.
|
||||
*/
|
||||
|
||||
static rfbBool
|
||||
parseParams(const char *request, char *result, int max_bytes)
|
||||
{
|
||||
char param_request[128];
|
||||
char param_formatted[196];
|
||||
const char *tail;
|
||||
char *delim_ptr;
|
||||
char *value_str;
|
||||
int cur_bytes, len;
|
||||
|
||||
result[0] = '\0';
|
||||
cur_bytes = 0;
|
||||
|
||||
tail = request;
|
||||
for (;;) {
|
||||
/* Copy individual "name=value" string into a buffer */
|
||||
delim_ptr = strchr((char *)tail, '&');
|
||||
if (delim_ptr == NULL) {
|
||||
if (strlen(tail) >= sizeof(param_request)) {
|
||||
return FALSE;
|
||||
}
|
||||
strcpy(param_request, tail);
|
||||
} else {
|
||||
len = delim_ptr - tail;
|
||||
if (len >= sizeof(param_request)) {
|
||||
return FALSE;
|
||||
}
|
||||
memcpy(param_request, tail, len);
|
||||
param_request[len] = '\0';
|
||||
}
|
||||
|
||||
/* Split the request into parameter name and value */
|
||||
value_str = strchr(¶m_request[1], '=');
|
||||
if (value_str == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
*value_str++ = '\0';
|
||||
if (strlen(value_str) == 0) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Validate both parameter name and value */
|
||||
if (!validateString(param_request) || !validateString(value_str)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Prepare HTML-formatted representation of the name=value pair */
|
||||
len = sprintf(param_formatted,
|
||||
"<PARAM NAME=\"%s\" VALUE=\"%s\">\n",
|
||||
param_request, value_str);
|
||||
if (cur_bytes + len + 1 > max_bytes) {
|
||||
return FALSE;
|
||||
}
|
||||
strcat(result, param_formatted);
|
||||
cur_bytes += len;
|
||||
|
||||
/* Go to the next parameter */
|
||||
if (delim_ptr == NULL) {
|
||||
break;
|
||||
}
|
||||
tail = delim_ptr + 1;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check if the string consists only of alphanumeric characters, '+'
|
||||
* signs, underscores, and dots. Replace all '+' signs with spaces.
|
||||
*/
|
||||
|
||||
static rfbBool
|
||||
validateString(char *str)
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
for (ptr = str; *ptr != '\0'; ptr++) {
|
||||
if (!isalnum(*ptr) && *ptr != '_' && *ptr != '.') {
|
||||
if (*ptr == '+') {
|
||||
*ptr = ' ';
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
95
libvncserver/libvncserver-config.h.cmake
Normal file
95
libvncserver/libvncserver-config.h.cmake
Normal file
@@ -0,0 +1,95 @@
|
||||
#ifndef _RFB_RFBCONFIG_H
|
||||
#define _RFB_RFBCONFIG_H
|
||||
|
||||
/* rfb/rfbconfig.h. Generated automatically by cmake. */
|
||||
|
||||
/* Enable 24 bit per pixel in native framebuffer */
|
||||
#cmakedefine LIBVNCSERVER_ALLOW24BPP 1
|
||||
|
||||
/* work around when write() returns ENOENT but does not mean it */
|
||||
#cmakedefine LIBVNCSERVER_ENOENT_WORKAROUND 1
|
||||
|
||||
/* Define to 1 if you have the <fcntl.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_FCNTL_H 1
|
||||
|
||||
/* Define to 1 if you have the `gettimeofday' function. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_GETTIMEOFDAY 1
|
||||
|
||||
/* Define to 1 if you have the `jpeg' library (-ljpeg). */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_LIBJPEG 1
|
||||
|
||||
/* Define to 1 if you have the `pthread' library (-lpthread). */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_LIBPTHREAD 1
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_LIBZ 1
|
||||
|
||||
/* Define to 1 if you have the <netinet/in.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_NETINET_IN_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/socket.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_SYS_SOCKET_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_SYS_TIME_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_SYS_WAIT_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine LIBVNCSERVER_HAVE_UNISTD_H 1
|
||||
|
||||
/* Need a typedef for in_addr_t */
|
||||
#cmakedefine LIBVNCSERVER_NEED_INADDR_T 1
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define LIBVNCSERVER_PACKAGE_STRING "@FULL_PACKAGE_NAME@ @PACKAGE_VERSION@"
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define LIBVNCSERVER_PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||
|
||||
/* Define to 1 if libgcrypt is present */
|
||||
#cmakedefine LIBVNCSERVER_WITH_CLIENT_GCRYPT 1
|
||||
|
||||
/* Define to 1 if GnuTLS is present */
|
||||
#cmakedefine LIBVNCSERVER_WITH_CLIENT_TLS 1
|
||||
|
||||
/* Define to 1 if your processor stores words with the most significant byte
|
||||
first (like Motorola and SPARC, unlike Intel and VAX). */
|
||||
#cmakedefine LIBVNCSERVER_WORDS_BIGENDIAN 1
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#cmakedefine const @CMAKE_CONST@
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
#cmakedefine inline @CMAKE_INLINE@
|
||||
#endif
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#cmakedefine HAVE_LIBVNCSERVER_PID_T 1
|
||||
#ifndef HAVE_LIBVNCSERVER_PID_T
|
||||
typedef int pid_t;
|
||||
#endif
|
||||
|
||||
/* The type for size_t */
|
||||
#cmakedefine HAVE_LIBVNCSERVER_SIZE_T 1
|
||||
#ifndef HAVE_LIBVNCSERVER_SIZE_T
|
||||
typedef int size_t;
|
||||
#endif
|
||||
|
||||
/* The type for socklen */
|
||||
#cmakedefine HAVE_LIBVNCSERVER_SOCKLEN_T 1
|
||||
#ifndef HAVE_LIBVNCSERVER_SOCKLEN_T
|
||||
typedef int socklen_t;
|
||||
#endif
|
||||
|
||||
/* once: _RFB_RFBCONFIG_H */
|
||||
#endif
|
||||
419
libvncserver/lzoconf.h
Normal file
419
libvncserver/lzoconf.h
Normal file
@@ -0,0 +1,419 @@
|
||||
/* lzoconf.h -- configuration for the LZO real-time data compression library
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LZOCONF_H_INCLUDED
|
||||
#define __LZOCONF_H_INCLUDED 1
|
||||
|
||||
#define LZO_VERSION 0x2040
|
||||
#define LZO_VERSION_STRING "2.04"
|
||||
#define LZO_VERSION_DATE "Oct 31 2010"
|
||||
|
||||
/* internal Autoconf configuration file - only used when building LZO */
|
||||
#if defined(LZO_HAVE_CONFIG_H)
|
||||
# include <config.h>
|
||||
#endif
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// LZO requires a conforming <limits.h>
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(CHAR_BIT) || (CHAR_BIT != 8)
|
||||
# error "invalid CHAR_BIT"
|
||||
#endif
|
||||
#if !defined(UCHAR_MAX) || !defined(UINT_MAX) || !defined(ULONG_MAX)
|
||||
# error "check your compiler installation"
|
||||
#endif
|
||||
#if (USHRT_MAX < 1) || (UINT_MAX < 1) || (ULONG_MAX < 1)
|
||||
# error "your limits.h macros are broken"
|
||||
#endif
|
||||
|
||||
/* get OS and architecture defines */
|
||||
#ifndef __LZODEFS_H_INCLUDED
|
||||
#include "lzodefs.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// some core defines
|
||||
************************************************************************/
|
||||
|
||||
#if !defined(LZO_UINT32_C)
|
||||
# if (UINT_MAX < LZO_0xffffffffL)
|
||||
# define LZO_UINT32_C(c) c ## UL
|
||||
# else
|
||||
# define LZO_UINT32_C(c) ((c) + 0U)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* memory checkers */
|
||||
#if !defined(__LZO_CHECKER)
|
||||
# if defined(__BOUNDS_CHECKING_ON)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__CHECKER__)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__INSURE__)
|
||||
# define __LZO_CHECKER 1
|
||||
# elif defined(__PURIFY__)
|
||||
# define __LZO_CHECKER 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// integral and pointer types
|
||||
************************************************************************/
|
||||
|
||||
/* lzo_uint should match size_t */
|
||||
#if !defined(LZO_UINT_MAX)
|
||||
# if defined(LZO_ABI_LLP64) /* WIN64 */
|
||||
# if defined(LZO_OS_WIN64)
|
||||
typedef unsigned __int64 lzo_uint;
|
||||
typedef __int64 lzo_int;
|
||||
# else
|
||||
typedef unsigned long long lzo_uint;
|
||||
typedef long long lzo_int;
|
||||
# endif
|
||||
# define LZO_UINT_MAX 0xffffffffffffffffull
|
||||
# define LZO_INT_MAX 9223372036854775807LL
|
||||
# define LZO_INT_MIN (-1LL - LZO_INT_MAX)
|
||||
# elif defined(LZO_ABI_IP32L64) /* MIPS R5900 */
|
||||
typedef unsigned int lzo_uint;
|
||||
typedef int lzo_int;
|
||||
# define LZO_UINT_MAX UINT_MAX
|
||||
# define LZO_INT_MAX INT_MAX
|
||||
# define LZO_INT_MIN INT_MIN
|
||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned long lzo_uint;
|
||||
typedef long lzo_int;
|
||||
# define LZO_UINT_MAX ULONG_MAX
|
||||
# define LZO_INT_MAX LONG_MAX
|
||||
# define LZO_INT_MIN LONG_MIN
|
||||
# else
|
||||
# error "lzo_uint"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Integral types with 32 bits or more. */
|
||||
#if !defined(LZO_UINT32_MAX)
|
||||
# if (UINT_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned int lzo_uint32;
|
||||
typedef int lzo_int32;
|
||||
# define LZO_UINT32_MAX UINT_MAX
|
||||
# define LZO_INT32_MAX INT_MAX
|
||||
# define LZO_INT32_MIN INT_MIN
|
||||
# elif (ULONG_MAX >= LZO_0xffffffffL)
|
||||
typedef unsigned long lzo_uint32;
|
||||
typedef long lzo_int32;
|
||||
# define LZO_UINT32_MAX ULONG_MAX
|
||||
# define LZO_INT32_MAX LONG_MAX
|
||||
# define LZO_INT32_MIN LONG_MIN
|
||||
# else
|
||||
# error "lzo_uint32"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The larger type of lzo_uint and lzo_uint32. */
|
||||
#if (LZO_UINT_MAX >= LZO_UINT32_MAX)
|
||||
# define lzo_xint lzo_uint
|
||||
#else
|
||||
# define lzo_xint lzo_uint32
|
||||
#endif
|
||||
|
||||
/* Memory model that allows to access memory at offsets of lzo_uint. */
|
||||
#if !defined(__LZO_MMODEL)
|
||||
# if (LZO_UINT_MAX <= UINT_MAX)
|
||||
# define __LZO_MMODEL /*empty*/
|
||||
# elif defined(LZO_HAVE_MM_HUGE_PTR)
|
||||
# define __LZO_MMODEL_HUGE 1
|
||||
# define __LZO_MMODEL __huge
|
||||
# else
|
||||
# define __LZO_MMODEL /*empty*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* no typedef here because of const-pointer issues */
|
||||
#define lzo_bytep unsigned char __LZO_MMODEL *
|
||||
#define lzo_charp char __LZO_MMODEL *
|
||||
#define lzo_voidp void __LZO_MMODEL *
|
||||
#define lzo_shortp short __LZO_MMODEL *
|
||||
#define lzo_ushortp unsigned short __LZO_MMODEL *
|
||||
#define lzo_uint32p lzo_uint32 __LZO_MMODEL *
|
||||
#define lzo_int32p lzo_int32 __LZO_MMODEL *
|
||||
#define lzo_uintp lzo_uint __LZO_MMODEL *
|
||||
#define lzo_intp lzo_int __LZO_MMODEL *
|
||||
#define lzo_xintp lzo_xint __LZO_MMODEL *
|
||||
#define lzo_voidpp lzo_voidp __LZO_MMODEL *
|
||||
#define lzo_bytepp lzo_bytep __LZO_MMODEL *
|
||||
/* deprecated - use 'lzo_bytep' instead of 'lzo_byte *' */
|
||||
#define lzo_byte unsigned char __LZO_MMODEL
|
||||
|
||||
typedef int lzo_bool;
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// function types
|
||||
************************************************************************/
|
||||
|
||||
/* name mangling */
|
||||
#if !defined(__LZO_EXTERN_C)
|
||||
# ifdef __cplusplus
|
||||
# define __LZO_EXTERN_C extern "C"
|
||||
# else
|
||||
# define __LZO_EXTERN_C extern
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* calling convention */
|
||||
#if !defined(__LZO_CDECL)
|
||||
# define __LZO_CDECL __lzo_cdecl
|
||||
#endif
|
||||
|
||||
/* DLL export information */
|
||||
#if !defined(__LZO_EXPORT1)
|
||||
# define __LZO_EXPORT1 /*empty*/
|
||||
#endif
|
||||
#if !defined(__LZO_EXPORT2)
|
||||
# define __LZO_EXPORT2 /*empty*/
|
||||
#endif
|
||||
|
||||
/* __cdecl calling convention for public C and assembly functions */
|
||||
#if !defined(LZO_PUBLIC)
|
||||
# define LZO_PUBLIC(_rettype) __LZO_EXPORT1 _rettype __LZO_EXPORT2 __LZO_CDECL
|
||||
#endif
|
||||
#if !defined(LZO_EXTERN)
|
||||
# define LZO_EXTERN(_rettype) __LZO_EXTERN_C LZO_PUBLIC(_rettype)
|
||||
#endif
|
||||
#if !defined(LZO_PRIVATE)
|
||||
# define LZO_PRIVATE(_rettype) static _rettype __LZO_CDECL
|
||||
#endif
|
||||
|
||||
/* function types */
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_t) ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_optimize_t) ( lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_compress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
typedef int
|
||||
(__LZO_CDECL *lzo_decompress_dict_t)(const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem,
|
||||
const lzo_bytep dict, lzo_uint dict_len );
|
||||
|
||||
|
||||
/* Callback interface. Currently only the progress indicator ("nprogress")
|
||||
* is used, but this may change in a future release. */
|
||||
|
||||
struct lzo_callback_t;
|
||||
typedef struct lzo_callback_t lzo_callback_t;
|
||||
#define lzo_callback_p lzo_callback_t __LZO_MMODEL *
|
||||
|
||||
/* malloc & free function types */
|
||||
typedef lzo_voidp (__LZO_CDECL *lzo_alloc_func_t)
|
||||
(lzo_callback_p self, lzo_uint items, lzo_uint size);
|
||||
typedef void (__LZO_CDECL *lzo_free_func_t)
|
||||
(lzo_callback_p self, lzo_voidp ptr);
|
||||
|
||||
/* a progress indicator callback function */
|
||||
typedef void (__LZO_CDECL *lzo_progress_func_t)
|
||||
(lzo_callback_p, lzo_uint, lzo_uint, int);
|
||||
|
||||
struct lzo_callback_t
|
||||
{
|
||||
/* custom allocators (set to 0 to disable) */
|
||||
lzo_alloc_func_t nalloc; /* [not used right now] */
|
||||
lzo_free_func_t nfree; /* [not used right now] */
|
||||
|
||||
/* a progress indicator callback function (set to 0 to disable) */
|
||||
lzo_progress_func_t nprogress;
|
||||
|
||||
/* NOTE: the first parameter "self" of the nalloc/nfree/nprogress
|
||||
* callbacks points back to this struct, so you are free to store
|
||||
* some extra info in the following variables. */
|
||||
lzo_voidp user1;
|
||||
lzo_xint user2;
|
||||
lzo_xint user3;
|
||||
};
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// error codes and prototypes
|
||||
************************************************************************/
|
||||
|
||||
/* Error codes for the compression/decompression functions. Negative
|
||||
* values are errors, positive values will be used for special but
|
||||
* normal events.
|
||||
*/
|
||||
#define LZO_E_OK 0
|
||||
#define LZO_E_ERROR (-1)
|
||||
#define LZO_E_OUT_OF_MEMORY (-2) /* [not used right now] */
|
||||
#define LZO_E_NOT_COMPRESSIBLE (-3) /* [not used right now] */
|
||||
#define LZO_E_INPUT_OVERRUN (-4)
|
||||
#define LZO_E_OUTPUT_OVERRUN (-5)
|
||||
#define LZO_E_LOOKBEHIND_OVERRUN (-6)
|
||||
#define LZO_E_EOF_NOT_FOUND (-7)
|
||||
#define LZO_E_INPUT_NOT_CONSUMED (-8)
|
||||
#define LZO_E_NOT_YET_IMPLEMENTED (-9) /* [not used right now] */
|
||||
|
||||
|
||||
#ifndef lzo_sizeof_dict_t
|
||||
# define lzo_sizeof_dict_t ((unsigned)sizeof(lzo_bytep))
|
||||
#endif
|
||||
|
||||
/* lzo_init() should be the first function you call.
|
||||
* Check the return code !
|
||||
*
|
||||
* lzo_init() is a macro to allow checking that the library and the
|
||||
* compiler's view of various types are consistent.
|
||||
*/
|
||||
#define lzo_init() __lzo_init_v2(LZO_VERSION,(int)sizeof(short),(int)sizeof(int),\
|
||||
(int)sizeof(long),(int)sizeof(lzo_uint32),(int)sizeof(lzo_uint),\
|
||||
(int)lzo_sizeof_dict_t,(int)sizeof(char *),(int)sizeof(lzo_voidp),\
|
||||
(int)sizeof(lzo_callback_t))
|
||||
LZO_EXTERN(int) __lzo_init_v2(unsigned,int,int,int,int,int,int,int,int,int);
|
||||
|
||||
/* version functions (useful for shared libraries) */
|
||||
LZO_EXTERN(unsigned) lzo_version(void);
|
||||
LZO_EXTERN(const char *) lzo_version_string(void);
|
||||
LZO_EXTERN(const char *) lzo_version_date(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
|
||||
LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
|
||||
|
||||
/* string functions */
|
||||
LZO_EXTERN(int)
|
||||
lzo_memcmp(const lzo_voidp a, const lzo_voidp b, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memcpy(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memmove(lzo_voidp dst, const lzo_voidp src, lzo_uint len);
|
||||
LZO_EXTERN(lzo_voidp)
|
||||
lzo_memset(lzo_voidp buf, int c, lzo_uint len);
|
||||
|
||||
/* checksum functions */
|
||||
LZO_EXTERN(lzo_uint32)
|
||||
lzo_adler32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(lzo_uint32)
|
||||
lzo_crc32(lzo_uint32 c, const lzo_bytep buf, lzo_uint len);
|
||||
LZO_EXTERN(const lzo_uint32p)
|
||||
lzo_get_crc32_table(void);
|
||||
|
||||
/* misc. */
|
||||
LZO_EXTERN(int) _lzo_config_check(void);
|
||||
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
|
||||
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
|
||||
typedef union { void *vp; lzo_bytep bp; lzo_uint u; lzo_uint32 u32; unsigned long l; } lzo_align_t;
|
||||
|
||||
/* align a char pointer on a boundary that is a multiple of 'size' */
|
||||
LZO_EXTERN(unsigned) __lzo_align_gap(const lzo_voidp p, lzo_uint size);
|
||||
#define LZO_PTR_ALIGN_UP(p,size) \
|
||||
((p) + (lzo_uint) __lzo_align_gap((const lzo_voidp)(p),(lzo_uint)(size)))
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
// deprecated macros - only for backward compatibility with LZO v1.xx
|
||||
************************************************************************/
|
||||
|
||||
#if defined(LZO_CFG_COMPAT)
|
||||
|
||||
#define __LZOCONF_H 1
|
||||
|
||||
#if defined(LZO_ARCH_I086)
|
||||
# define __LZO_i386 1
|
||||
#elif defined(LZO_ARCH_I386)
|
||||
# define __LZO_i386 1
|
||||
#endif
|
||||
|
||||
#if defined(LZO_OS_DOS16)
|
||||
# define __LZO_DOS 1
|
||||
# define __LZO_DOS16 1
|
||||
#elif defined(LZO_OS_DOS32)
|
||||
# define __LZO_DOS 1
|
||||
#elif defined(LZO_OS_WIN16)
|
||||
# define __LZO_WIN 1
|
||||
# define __LZO_WIN16 1
|
||||
#elif defined(LZO_OS_WIN32)
|
||||
# define __LZO_WIN 1
|
||||
#endif
|
||||
|
||||
#define __LZO_CMODEL /*empty*/
|
||||
#define __LZO_DMODEL /*empty*/
|
||||
#define __LZO_ENTRY __LZO_CDECL
|
||||
#define LZO_EXTERN_CDECL LZO_EXTERN
|
||||
#define LZO_ALIGN LZO_PTR_ALIGN_UP
|
||||
|
||||
#define lzo_compress_asm_t lzo_compress_t
|
||||
#define lzo_decompress_asm_t lzo_decompress_t
|
||||
|
||||
#endif /* LZO_CFG_COMPAT */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
|
||||
/* vim:set ts=4 et: */
|
||||
1851
libvncserver/lzodefs.h
Normal file
1851
libvncserver/lzodefs.h
Normal file
File diff suppressed because it is too large
Load Diff
1177
libvncserver/main.c
Normal file
1177
libvncserver/main.c
Normal file
File diff suppressed because it is too large
Load Diff
4192
libvncserver/minilzo.c
Normal file
4192
libvncserver/minilzo.c
Normal file
File diff suppressed because it is too large
Load Diff
108
libvncserver/minilzo.h
Normal file
108
libvncserver/minilzo.h
Normal file
@@ -0,0 +1,108 @@
|
||||
/* minilzo.h -- mini subset of the LZO real-time data compression library
|
||||
|
||||
This file is part of the LZO real-time data compression library.
|
||||
|
||||
Copyright (C) 2010 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2009 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2008 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2007 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2006 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2005 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2004 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2003 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2002 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2001 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 2000 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1999 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1998 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1997 Markus Franz Xaver Johannes Oberhumer
|
||||
Copyright (C) 1996 Markus Franz Xaver Johannes Oberhumer
|
||||
All Rights Reserved.
|
||||
|
||||
The LZO library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
The LZO library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with the LZO library; see the file COPYING.
|
||||
If not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Markus F.X.J. Oberhumer
|
||||
<markus@oberhumer.com>
|
||||
http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
/*
|
||||
* NOTE:
|
||||
* the full LZO package can be found at
|
||||
* http://www.oberhumer.com/opensource/lzo/
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __MINILZO_H
|
||||
#define __MINILZO_H 1
|
||||
|
||||
#define MINILZO_VERSION 0x2040
|
||||
|
||||
#ifdef __LZOCONF_H
|
||||
# error "you cannot use both LZO and miniLZO"
|
||||
#endif
|
||||
|
||||
#undef LZO_HAVE_CONFIG_H
|
||||
#include "lzoconf.h"
|
||||
|
||||
#if !defined(LZO_VERSION) || (LZO_VERSION != MINILZO_VERSION)
|
||||
# error "version mismatch in header files"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
//
|
||||
************************************************************************/
|
||||
|
||||
/* Memory required for the wrkmem parameter.
|
||||
* When the required size is 0, you can also pass a NULL pointer.
|
||||
*/
|
||||
|
||||
#define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS
|
||||
#define LZO1X_1_MEM_COMPRESS ((lzo_uint32) (16384L * lzo_sizeof_dict_t))
|
||||
#define LZO1X_MEM_DECOMPRESS (0)
|
||||
|
||||
|
||||
/* compression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_1_compress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem );
|
||||
|
||||
/* decompression */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
|
||||
/* safe decompression with overrun testing */
|
||||
LZO_EXTERN(int)
|
||||
lzo1x_decompress_safe ( const lzo_bytep src, lzo_uint src_len,
|
||||
lzo_bytep dst, lzo_uintp dst_len,
|
||||
lzo_voidp wrkmem /* NOT USED */ );
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* already included */
|
||||
|
||||
35
libvncserver/private.h
Normal file
35
libvncserver/private.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef RFB_PRIVATE_H
|
||||
#define RFB_PRIVATE_H
|
||||
|
||||
/* from cursor.c */
|
||||
|
||||
void rfbShowCursor(rfbClientPtr cl);
|
||||
void rfbHideCursor(rfbClientPtr cl);
|
||||
void rfbRedrawAfterHideCursor(rfbClientPtr cl,sraRegionPtr updateRegion);
|
||||
|
||||
/* from main.c */
|
||||
|
||||
rfbClientPtr rfbClientIteratorHead(rfbClientIteratorPtr i);
|
||||
|
||||
/* from tight.c */
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
|
||||
extern void rfbTightCleanup(rfbScreenInfoPtr screen);
|
||||
#endif
|
||||
|
||||
/* from zlib.c */
|
||||
extern void rfbZlibCleanup(rfbScreenInfoPtr screen);
|
||||
|
||||
/* from zrle.c */
|
||||
void rfbFreeZrleData(rfbClientPtr cl);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* from ultra.c */
|
||||
|
||||
extern void rfbFreeUltraData(rfbClientPtr cl);
|
||||
|
||||
#endif
|
||||
|
||||
261
libvncserver/rfb/default8x16.h
Normal file
261
libvncserver/rfb/default8x16.h
Normal file
@@ -0,0 +1,261 @@
|
||||
static unsigned char default8x16FontData[4096+1]={
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7e,0x81,0xa5,0x81,0x81,0xbd,0x99,0x81,0x81,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7e,0xff,0xdb,0xff,0xff,0xc3,0xe7,0xff,0xff,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x6c,0xfe,0xfe,0xfe,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x7c,0xfe,0x7c,0x38,0x10,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x18,0x3c,0x3c,0xe7,0xe7,0xe7,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x18,0x3c,0x7e,0xff,0xff,0x7e,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xe7,0xc3,0xc3,0xe7,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0x00,0x00,0x00,0x00,0x00,0x3c,0x66,0x42,0x42,0x66,0x3c,0x00,0x00,0x00,0x00,0x00,
|
||||
0xff,0xff,0xff,0xff,0xff,0xc3,0x99,0xbd,0xbd,0x99,0xc3,0xff,0xff,0xff,0xff,0xff,
|
||||
0x00,0x00,0x1e,0x0e,0x1a,0x32,0x78,0xcc,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x66,0x66,0x66,0x66,0x3c,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3f,0x33,0x3f,0x30,0x30,0x30,0x30,0x70,0xf0,0xe0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7f,0x63,0x7f,0x63,0x63,0x63,0x63,0x67,0xe7,0xe6,0xc0,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x18,0x18,0xdb,0x3c,0xe7,0x3c,0xdb,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x80,0xc0,0xe0,0xf0,0xf8,0xfe,0xf8,0xf0,0xe0,0xc0,0x80,0x00,0x00,0x00,0x00,
|
||||
0x00,0x02,0x06,0x0e,0x1e,0x3e,0xfe,0x3e,0x1e,0x0e,0x06,0x02,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x66,0x66,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7f,0xdb,0xdb,0xdb,0x7b,0x1b,0x1b,0x1b,0x1b,0x1b,0x00,0x00,0x00,0x00,
|
||||
0x00,0x7c,0xc6,0x60,0x38,0x6c,0xc6,0xc6,0x6c,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xfe,0xfe,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x7e,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x3c,0x7e,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x3c,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x18,0x0c,0xfe,0x0c,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x30,0x60,0xfe,0x60,0x30,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xc0,0xc0,0xc0,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x24,0x66,0xff,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x7c,0x7c,0xfe,0xfe,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0xfe,0xfe,0x7c,0x7c,0x38,0x38,0x10,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x3c,0x3c,0x3c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x66,0x66,0x66,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x6c,0x6c,0xfe,0x6c,0x6c,0x6c,0xfe,0x6c,0x6c,0x00,0x00,0x00,0x00,
|
||||
0x18,0x18,0x7c,0xc6,0xc2,0xc0,0x7c,0x06,0x06,0x86,0xc6,0x7c,0x18,0x18,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0xc2,0xc6,0x0c,0x18,0x30,0x60,0xc6,0x86,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x38,0x6c,0x6c,0x38,0x76,0xdc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x30,0x30,0x30,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x0c,0x18,0x30,0x30,0x30,0x30,0x30,0x30,0x18,0x0c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x30,0x18,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x18,0x30,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x66,0x3c,0xff,0x3c,0x66,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x18,0x30,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x02,0x06,0x0c,0x18,0x30,0x60,0xc0,0x80,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0xce,0xde,0xf6,0xe6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x38,0x78,0x18,0x18,0x18,0x18,0x18,0x18,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0x06,0x0c,0x18,0x30,0x60,0xc0,0xc6,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0x06,0x06,0x3c,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x0c,0x1c,0x3c,0x6c,0xcc,0xfe,0x0c,0x0c,0x0c,0x1e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xfc,0x06,0x06,0x06,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x38,0x60,0xc0,0xc0,0xfc,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfe,0xc6,0x06,0x06,0x0c,0x18,0x30,0x30,0x30,0x30,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7c,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0x7e,0x06,0x06,0x06,0x0c,0x78,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x18,0x18,0x30,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x06,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x06,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7e,0x00,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x60,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x60,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0x0c,0x18,0x18,0x18,0x00,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xde,0xde,0xde,0xdc,0xc0,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x66,0x66,0x66,0x66,0xfc,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xf8,0x6c,0x66,0x66,0x66,0x66,0x66,0x66,0x6c,0xf8,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfe,0x66,0x62,0x68,0x78,0x68,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xde,0xc6,0xc6,0x66,0x3a,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x1e,0x0c,0x0c,0x0c,0x0c,0x0c,0xcc,0xcc,0xcc,0x78,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xe6,0x66,0x66,0x6c,0x78,0x78,0x6c,0x66,0x66,0xe6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xf0,0x60,0x60,0x60,0x60,0x60,0x60,0x62,0x66,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc3,0xe7,0xff,0xff,0xdb,0xc3,0xc3,0xc3,0xc3,0xc3,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xd6,0xde,0x7c,0x0c,0x0e,0x00,0x00,
|
||||
0x00,0x00,0xfc,0x66,0x66,0x66,0x7c,0x6c,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x7c,0xc6,0xc6,0x60,0x38,0x0c,0x06,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xff,0xdb,0x99,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc3,0xc3,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x66,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x3c,0x66,0xc3,0xc3,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xff,0xc3,0x86,0x0c,0x18,0x30,0x60,0xc1,0xc3,0xff,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x80,0xc0,0xe0,0x70,0x38,0x1c,0x0e,0x06,0x02,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x10,0x38,0x6c,0xc6,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,
|
||||
0x30,0x30,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xe0,0x60,0x60,0x78,0x6c,0x66,0x66,0x66,0x66,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc0,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x1c,0x0c,0x0c,0x3c,0x6c,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0xcc,0x78,0x00,
|
||||
0x00,0x00,0xe0,0x60,0x60,0x6c,0x76,0x66,0x66,0x66,0x66,0xe6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x06,0x06,0x00,0x0e,0x06,0x06,0x06,0x06,0x06,0x06,0x66,0x66,0x3c,0x00,
|
||||
0x00,0x00,0xe0,0x60,0x60,0x66,0x6c,0x78,0x78,0x6c,0x66,0xe6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xe6,0xff,0xdb,0xdb,0xdb,0xdb,0xdb,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xf0,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xcc,0xcc,0xcc,0xcc,0xcc,0x7c,0x0c,0x0c,0x1e,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xdc,0x76,0x66,0x60,0x60,0x60,0xf0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7c,0xc6,0x60,0x38,0x0c,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x10,0x30,0x30,0xfc,0x30,0x30,0x30,0x30,0x36,0x1c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xc3,0x66,0x3c,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xc3,0xc3,0xc3,0xdb,0xdb,0xff,0x66,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xc3,0x66,0x3c,0x18,0x3c,0x66,0xc3,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0xf8,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xfe,0xcc,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x0e,0x18,0x18,0x18,0x70,0x18,0x18,0x18,0x18,0x0e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x18,0x18,0x18,0x18,0x00,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x70,0x18,0x18,0x18,0x0e,0x18,0x18,0x18,0x18,0x70,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xc6,0xfe,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3c,0x66,0xc2,0xc0,0xc0,0xc0,0xc2,0x66,0x3c,0x0c,0x06,0x7c,0x00,0x00,
|
||||
0x00,0x00,0xcc,0x00,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0c,0x18,0x30,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x10,0x38,0x6c,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xcc,0x00,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x60,0x30,0x18,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x38,0x6c,0x38,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x3c,0x66,0x60,0x60,0x66,0x3c,0x0c,0x06,0x3c,0x00,0x00,0x00,
|
||||
0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xfe,0xc0,0xc0,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x66,0x00,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x18,0x3c,0x66,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x60,0x30,0x18,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0xc6,0x00,0x10,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x38,0x6c,0x38,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x18,0x30,0x60,0x00,0xfe,0x66,0x60,0x7c,0x60,0x60,0x66,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x6e,0x3b,0x1b,0x7e,0xd8,0xdc,0x77,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x3e,0x6c,0xcc,0xcc,0xfe,0xcc,0xcc,0xcc,0xcc,0xce,0x00,0x00,0x00,0x00,
|
||||
0x00,0x10,0x38,0x6c,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc6,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x60,0x30,0x18,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x30,0x78,0xcc,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x60,0x30,0x18,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc6,0x00,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7e,0x06,0x0c,0x78,0x00,
|
||||
0x00,0xc6,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0xc6,0x00,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x18,0x18,0x7e,0xc3,0xc0,0xc0,0xc0,0xc3,0x7e,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x38,0x6c,0x64,0x60,0xf0,0x60,0x60,0x60,0x60,0xe6,0xfc,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xc3,0x66,0x3c,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0xfc,0x66,0x66,0x7c,0x62,0x66,0x6f,0x66,0x66,0x66,0xf3,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0e,0x1b,0x18,0x18,0x18,0x7e,0x18,0x18,0x18,0x18,0x18,0xd8,0x70,0x00,0x00,
|
||||
0x00,0x18,0x30,0x60,0x00,0x78,0x0c,0x7c,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0c,0x18,0x30,0x00,0x38,0x18,0x18,0x18,0x18,0x18,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x18,0x30,0x60,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x18,0x30,0x60,0x00,0xcc,0xcc,0xcc,0xcc,0xcc,0xcc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x76,0xdc,0x00,0xdc,0x66,0x66,0x66,0x66,0x66,0x66,0x00,0x00,0x00,0x00,
|
||||
0x76,0xdc,0x00,0xc6,0xe6,0xf6,0xfe,0xde,0xce,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x3c,0x6c,0x6c,0x3e,0x00,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x38,0x6c,0x6c,0x38,0x00,0x7c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x30,0x30,0x00,0x30,0x30,0x60,0xc0,0xc6,0xc6,0x7c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0x06,0x06,0x06,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x60,0xce,0x9b,0x06,0x0c,0x1f,0x00,0x00,
|
||||
0x00,0xc0,0xc0,0xc2,0xc6,0xcc,0x18,0x30,0x66,0xce,0x96,0x3e,0x06,0x06,0x00,0x00,
|
||||
0x00,0x00,0x18,0x18,0x00,0x18,0x18,0x18,0x3c,0x3c,0x3c,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x36,0x6c,0xd8,0x6c,0x36,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xd8,0x6c,0x36,0x6c,0xd8,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,0x11,0x44,
|
||||
0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,
|
||||
0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,0xdd,0x77,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfe,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x00,0x00,0x00,0x00,0x00,0xfe,0x06,0xf6,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0xf6,0x06,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xfe,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x18,0x18,0x18,0x18,0x18,0xf8,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x3f,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0x37,0x30,0x37,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x36,0x36,0x36,0x36,0x36,0xf7,0x00,0xf7,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x18,0x18,0x18,0x18,0x18,0xff,0x00,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0xff,0x00,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x18,0x18,0x18,0x18,0x18,0x1f,0x18,0x1f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x36,0x36,0x36,0x36,0x36,0x36,0x36,0xff,0x36,0x36,0x36,0x36,0x36,0x36,0x36,0x36,
|
||||
0x18,0x18,0x18,0x18,0x18,0xff,0x18,0xff,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1f,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
|
||||
0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,
|
||||
0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,0x0f,
|
||||
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0xd8,0xd8,0xd8,0xdc,0x76,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x78,0xcc,0xcc,0xcc,0xd8,0xcc,0xc6,0xc6,0xc6,0xcc,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0xfe,0xc6,0xc6,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0xfe,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0xfe,0xc6,0x60,0x30,0x18,0x30,0x60,0xc6,0xfe,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7e,0xd8,0xd8,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x66,0x66,0x66,0x66,0x66,0x7c,0x60,0x60,0xc0,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x76,0xdc,0x18,0x18,0x18,0x18,0x18,0x18,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7e,0x18,0x3c,0x66,0x66,0x66,0x3c,0x18,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x38,0x6c,0xc6,0xc6,0xfe,0xc6,0xc6,0x6c,0x38,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x38,0x6c,0xc6,0xc6,0xc6,0x6c,0x6c,0x6c,0x6c,0xee,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x1e,0x30,0x18,0x0c,0x3e,0x66,0x66,0x66,0x66,0x3c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x7e,0xdb,0xdb,0xdb,0x7e,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x03,0x06,0x7e,0xdb,0xdb,0xf3,0x7e,0x60,0xc0,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x1c,0x30,0x60,0x60,0x7c,0x60,0x60,0x60,0x30,0x1c,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x7c,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0xc6,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0xfe,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x7e,0x18,0x18,0x00,0x00,0xff,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x30,0x18,0x0c,0x06,0x0c,0x18,0x30,0x00,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0c,0x18,0x30,0x60,0x30,0x18,0x0c,0x00,0x7e,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x0e,0x1b,0x1b,0x1b,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,
|
||||
0x18,0x18,0x18,0x18,0x18,0x18,0x18,0x18,0xd8,0xd8,0xd8,0x70,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x7e,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x76,0xdc,0x00,0x76,0xdc,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x38,0x6c,0x6c,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0f,0x0c,0x0c,0x0c,0x0c,0x0c,0xec,0x6c,0x6c,0x3c,0x1c,0x00,0x00,0x00,0x00,
|
||||
0x00,0xd8,0x6c,0x6c,0x6c,0x6c,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x70,0xd8,0x30,0x60,0xc8,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x7c,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
};
|
||||
static int default8x16FontMetaData[256*5+1]={
|
||||
0,8,16,0,0,16,8,16,0,0,32,8,16,0,0,48,8,16,0,0,64,8,16,0,0,80,8,16,0,0,96,8,16,0,0,112,8,16,0,0,128,8,16,0,0,144,8,16,0,0,160,8,16,0,0,176,8,16,0,0,192,8,16,0,0,208,8,16,0,0,224,8,16,0,0,240,8,16,0,0,256,8,16,0,0,272,8,16,0,0,288,8,16,0,0,304,8,16,0,0,320,8,16,0,0,336,8,16,0,0,352,8,16,0,0,368,8,16,0,0,384,8,16,0,0,400,8,16,0,0,416,8,16,0,0,432,8,16,0,0,448,8,16,0,0,464,8,16,0,0,480,8,16,0,0,496,8,16,0,0,512,8,16,0,0,528,8,16,0,0,544,8,16,0,0,560,8,16,0,0,576,8,16,0,0,592,8,16,0,0,608,8,16,0,0,624,8,16,0,0,640,8,16,0,0,656,8,16,0,0,672,8,16,0,0,688,8,16,0,0,704,8,16,0,0,720,8,16,0,0,736,8,16,0,0,752,8,16,0,0,768,8,16,0,0,784,8,16,0,0,800,8,16,0,0,816,8,16,0,0,832,8,16,0,0,848,8,16,0,0,864,8,16,0,0,880,8,16,0,0,896,8,16,0,0,912,8,16,0,0,928,8,16,0,0,944,8,16,0,0,960,8,16,0,0,976,8,16,0,0,992,8,16,0,0,1008,8,16,0,0,1024,8,16,0,0,1040,8,16,0,0,1056,8,16,0,0,1072,8,16,0,0,1088,8,16,0,0,1104,8,16,0,0,1120,8,16,0,0,1136,8,16,0,0,1152,8,16,0,0,1168,8,16,0,0,1184,8,16,0,0,1200,8,16,0,0,1216,8,16,0,0,1232,8,16,0,0,1248,8,16,0,0,1264,8,16,0,0,1280,8,16,0,0,1296,8,16,0,0,1312,8,16,0,0,1328,8,16,0,0,1344,8,16,0,0,1360,8,16,0,0,1376,8,16,0,0,1392,8,16,0,0,1408,8,16,0,0,1424,8,16,0,0,1440,8,16,0,0,1456,8,16,0,0,1472,8,16,0,0,1488,8,16,0,0,1504,8,16,0,0,1520,8,16,0,0,1536,8,16,0,0,1552,8,16,0,0,1568,8,16,0,0,1584,8,16,0,0,1600,8,16,0,0,1616,8,16,0,0,1632,8,16,0,0,1648,8,16,0,0,1664,8,16,0,0,1680,8,16,0,0,1696,8,16,0,0,1712,8,16,0,0,1728,8,16,0,0,1744,8,16,0,0,1760,8,16,0,0,1776,8,16,0,0,1792,8,16,0,0,1808,8,16,0,0,1824,8,16,0,0,1840,8,16,0,0,1856,8,16,0,0,1872,8,16,0,0,1888,8,16,0,0,1904,8,16,0,0,1920,8,16,0,0,1936,8,16,0,0,1952,8,16,0,0,1968,8,16,0,0,1984,8,16,0,0,2000,8,16,0,0,2016,8,16,0,0,2032,8,16,0,0,2048,8,16,0,0,2064,8,16,0,0,2080,8,16,0,0,2096,8,16,0,0,2112,8,16,0,0,2128,8,16,0,0,2144,8,16,0,0,2160,8,16,0,0,2176,8,16,0,0,2192,8,16,0,0,2208,8,16,0,0,2224,8,16,0,0,2240,8,16,0,0,2256,8,16,0,0,2272,8,16,0,0,2288,8,16,0,0,2304,8,16,0,0,2320,8,16,0,0,2336,8,16,0,0,2352,8,16,0,0,2368,8,16,0,0,2384,8,16,0,0,2400,8,16,0,0,2416,8,16,0,0,2432,8,16,0,0,2448,8,16,0,0,2464,8,16,0,0,2480,8,16,0,0,2496,8,16,0,0,2512,8,16,0,0,2528,8,16,0,0,2544,8,16,0,0,2560,8,16,0,0,2576,8,16,0,0,2592,8,16,0,0,2608,8,16,0,0,2624,8,16,0,0,2640,8,16,0,0,2656,8,16,0,0,2672,8,16,0,0,2688,8,16,0,0,2704,8,16,0,0,2720,8,16,0,0,2736,8,16,0,0,2752,8,16,0,0,2768,8,16,0,0,2784,8,16,0,0,2800,8,16,0,0,2816,8,16,0,0,2832,8,16,0,0,2848,8,16,0,0,2864,8,16,0,0,2880,8,16,0,0,2896,8,16,0,0,2912,8,16,0,0,2928,8,16,0,0,2944,8,16,0,0,2960,8,16,0,0,2976,8,16,0,0,2992,8,16,0,0,3008,8,16,0,0,3024,8,16,0,0,3040,8,16,0,0,3056,8,16,0,0,3072,8,16,0,0,3088,8,16,0,0,3104,8,16,0,0,3120,8,16,0,0,3136,8,16,0,0,3152,8,16,0,0,3168,8,16,0,0,3184,8,16,0,0,3200,8,16,0,0,3216,8,16,0,0,3232,8,16,0,0,3248,8,16,0,0,3264,8,16,0,0,3280,8,16,0,0,3296,8,16,0,0,3312,8,16,0,0,3328,8,16,0,0,3344,8,16,0,0,3360,8,16,0,0,3376,8,16,0,0,3392,8,16,0,0,3408,8,16,0,0,3424,8,16,0,0,3440,8,16,0,0,3456,8,16,0,0,3472,8,16,0,0,3488,8,16,0,0,3504,8,16,0,0,3520,8,16,0,0,3536,8,16,0,0,3552,8,16,0,0,3568,8,16,0,0,3584,8,16,0,0,3600,8,16,0,0,3616,8,16,0,0,3632,8,16,0,0,3648,8,16,0,0,3664,8,16,0,0,3680,8,16,0,0,3696,8,16,0,0,3712,8,16,0,0,3728,8,16,0,0,3744,8,16,0,0,3760,8,16,0,0,3776,8,16,0,0,3792,8,16,0,0,3808,8,16,0,0,3824,8,16,0,0,3840,8,16,0,0,3856,8,16,0,0,3872,8,16,0,0,3888,8,16,0,0,3904,8,16,0,0,3920,8,16,0,0,3936,8,16,0,0,3952,8,16,0,0,3968,8,16,0,0,3984,8,16,0,0,4000,8,16,0,0,4016,8,16,0,0,4032,8,16,0,0,4048,8,16,0,0,4064,8,16,0,0,4080,8,16,0,0,};
|
||||
static rfbFontData default8x16Font = { default8x16FontData, default8x16FontMetaData };
|
||||
1638
libvncserver/rfb/keysym.h
Normal file
1638
libvncserver/rfb/keysym.h
Normal file
File diff suppressed because it is too large
Load Diff
1188
libvncserver/rfb/rfb.h
Normal file
1188
libvncserver/rfb/rfb.h
Normal file
File diff suppressed because it is too large
Load Diff
430
libvncserver/rfb/rfbclient.h
Normal file
430
libvncserver/rfb/rfbclient.h
Normal file
@@ -0,0 +1,430 @@
|
||||
#ifndef RFBCLIENT_H
|
||||
#define RFBCLIENT_H
|
||||
|
||||
/**
|
||||
* @defgroup libvncclient_api LibVNCClient API Reference
|
||||
* @{
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2000, 2001 Const Kaplinsky. All Rights Reserved.
|
||||
* Copyright (C) 2000 Tridia Corporation. All Rights Reserved.
|
||||
* Copyright (C) 1999 AT&T Laboratories Cambridge. All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file rfbclient.h
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include "rfbproto.h"
|
||||
#include "keysym.h"
|
||||
#ifdef LIBVNCSERVER_WITH_CLIENT_TLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
|
||||
#define rfbClientSwap16IfLE(s) \
|
||||
(*(char *)&client->endianTest ? ((((s) & 0xff) << 8) | (((s) >> 8) & 0xff)) : (s))
|
||||
|
||||
#define rfbClientSwap32IfLE(l) \
|
||||
(*(char *)&client->endianTest ? ((((l) & 0xff000000) >> 24) | \
|
||||
(((l) & 0x00ff0000) >> 8) | \
|
||||
(((l) & 0x0000ff00) << 8) | \
|
||||
(((l) & 0x000000ff) << 24)) : (l))
|
||||
|
||||
#define rfbClientSwap64IfLE(l) \
|
||||
(*(char *)&client->endianTest ? ((((l) & 0xff00000000000000ULL) >> 56) | \
|
||||
(((l) & 0x00ff000000000000ULL) >> 40) | \
|
||||
(((l) & 0x0000ff0000000000ULL) >> 24) | \
|
||||
(((l) & 0x000000ff00000000ULL) >> 8) | \
|
||||
(((l) & 0x00000000ff000000ULL) << 8) | \
|
||||
(((l) & 0x0000000000ff0000ULL) << 24) | \
|
||||
(((l) & 0x000000000000ff00ULL) << 40) | \
|
||||
(((l) & 0x00000000000000ffULL) << 56)) : (l))
|
||||
|
||||
#define FLASH_PORT_OFFSET 5400
|
||||
#define LISTEN_PORT_OFFSET 5500
|
||||
#define TUNNEL_PORT_OFFSET 5500
|
||||
#define SERVER_PORT_OFFSET 5900
|
||||
|
||||
#define DEFAULT_SSH_CMD "/usr/bin/ssh"
|
||||
#define DEFAULT_TUNNEL_CMD \
|
||||
(DEFAULT_SSH_CMD " -f -L %L:localhost:%R %H sleep 20")
|
||||
#define DEFAULT_VIA_CMD \
|
||||
(DEFAULT_SSH_CMD " -f -L %L:%H:%R %G sleep 20")
|
||||
|
||||
#if(defined __cplusplus)
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/** vncrec */
|
||||
|
||||
typedef struct {
|
||||
FILE* file;
|
||||
struct timeval tv;
|
||||
rfbBool readTimestamp;
|
||||
rfbBool doNotSleep;
|
||||
} rfbVNCRec;
|
||||
|
||||
/** client data */
|
||||
|
||||
typedef struct rfbClientData {
|
||||
void* tag;
|
||||
void* data;
|
||||
struct rfbClientData* next;
|
||||
} rfbClientData;
|
||||
|
||||
/** app data (belongs into rfbClient?) */
|
||||
|
||||
typedef struct {
|
||||
rfbBool shareDesktop;
|
||||
rfbBool viewOnly;
|
||||
|
||||
const char* encodingsString;
|
||||
|
||||
rfbBool useBGR233;
|
||||
int nColours;
|
||||
rfbBool forceOwnCmap;
|
||||
rfbBool forceTrueColour;
|
||||
int requestedDepth;
|
||||
|
||||
int compressLevel;
|
||||
int qualityLevel;
|
||||
rfbBool enableJPEG;
|
||||
rfbBool useRemoteCursor;
|
||||
rfbBool palmVNC; /**< use palmvnc specific SetScale (vs ultravnc) */
|
||||
int scaleSetting; /**< 0 means no scale set, else 1/scaleSetting */
|
||||
} AppData;
|
||||
|
||||
/** For GetCredentialProc callback function to return */
|
||||
typedef union _rfbCredential
|
||||
{
|
||||
/** X509 (VeNCrypt) */
|
||||
struct
|
||||
{
|
||||
char *x509CACertFile;
|
||||
char *x509CACrlFile;
|
||||
char *x509ClientCertFile;
|
||||
char *x509ClientKeyFile;
|
||||
} x509Credential;
|
||||
/** Plain (VeNCrypt), MSLogon (UltraVNC) */
|
||||
struct
|
||||
{
|
||||
char *username;
|
||||
char *password;
|
||||
} userCredential;
|
||||
} rfbCredential;
|
||||
|
||||
#define rfbCredentialTypeX509 1
|
||||
#define rfbCredentialTypeUser 2
|
||||
|
||||
struct _rfbClient;
|
||||
|
||||
typedef void (*HandleTextChatProc)(struct _rfbClient* client, int value, char *text);
|
||||
typedef void (*HandleXvpMsgProc)(struct _rfbClient* client, uint8_t version, uint8_t opcode);
|
||||
typedef void (*HandleKeyboardLedStateProc)(struct _rfbClient* client, int value, int pad);
|
||||
typedef rfbBool (*HandleCursorPosProc)(struct _rfbClient* client, int x, int y);
|
||||
typedef void (*SoftCursorLockAreaProc)(struct _rfbClient* client, int x, int y, int w, int h);
|
||||
typedef void (*SoftCursorUnlockScreenProc)(struct _rfbClient* client);
|
||||
typedef void (*GotFrameBufferUpdateProc)(struct _rfbClient* client, int x, int y, int w, int h);
|
||||
typedef void (*FinishedFrameBufferUpdateProc)(struct _rfbClient* client);
|
||||
typedef char* (*GetPasswordProc)(struct _rfbClient* client);
|
||||
typedef rfbCredential* (*GetCredentialProc)(struct _rfbClient* client, int credentialType);
|
||||
typedef rfbBool (*MallocFrameBufferProc)(struct _rfbClient* client);
|
||||
typedef void (*GotXCutTextProc)(struct _rfbClient* client, const char *text, int textlen);
|
||||
typedef void (*BellProc)(struct _rfbClient* client);
|
||||
|
||||
typedef void (*GotCursorShapeProc)(struct _rfbClient* client, int xhot, int yhot, int width, int height, int bytesPerPixel);
|
||||
typedef void (*GotCopyRectProc)(struct _rfbClient* client, int src_x, int src_y, int w, int h, int dest_x, int dest_y);
|
||||
|
||||
typedef struct _rfbClient {
|
||||
uint8_t* frameBuffer;
|
||||
int width, height;
|
||||
|
||||
int endianTest;
|
||||
|
||||
AppData appData;
|
||||
|
||||
const char* programName;
|
||||
char* serverHost;
|
||||
int serverPort; /**< if -1, then use file recorded by vncrec */
|
||||
rfbBool listenSpecified;
|
||||
int listenPort, flashPort;
|
||||
|
||||
struct {
|
||||
int x, y, w, h;
|
||||
} updateRect;
|
||||
|
||||
/** Note that the CoRRE encoding uses this buffer and assumes it is big enough
|
||||
to hold 255 * 255 * 32 bits -> 260100 bytes. 640*480 = 307200 bytes.
|
||||
Hextile also assumes it is big enough to hold 16 * 16 * 32 bits.
|
||||
Tight encoding assumes BUFFER_SIZE is at least 16384 bytes. */
|
||||
|
||||
#define RFB_BUFFER_SIZE (640*480)
|
||||
char buffer[RFB_BUFFER_SIZE];
|
||||
|
||||
/* rfbproto.c */
|
||||
|
||||
int sock;
|
||||
rfbBool canUseCoRRE;
|
||||
rfbBool canUseHextile;
|
||||
char *desktopName;
|
||||
rfbPixelFormat format;
|
||||
rfbServerInitMsg si;
|
||||
|
||||
/* listen.c */
|
||||
int listenSock;
|
||||
|
||||
/* sockets.c */
|
||||
#define RFB_BUF_SIZE 8192
|
||||
char buf[RFB_BUF_SIZE];
|
||||
char *bufoutptr;
|
||||
int buffered;
|
||||
|
||||
/* The zlib encoding requires expansion/decompression/deflation of the
|
||||
compressed data in the "buffer" above into another, result buffer.
|
||||
However, the size of the result buffer can be determined precisely
|
||||
based on the bitsPerPixel, height and width of the rectangle. We
|
||||
allocate this buffer one time to be the full size of the buffer. */
|
||||
|
||||
/* Ultra Encoding uses this buffer too */
|
||||
|
||||
int ultra_buffer_size;
|
||||
char *ultra_buffer;
|
||||
|
||||
int raw_buffer_size;
|
||||
char *raw_buffer;
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
z_stream decompStream;
|
||||
rfbBool decompStreamInited;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBZ
|
||||
/*
|
||||
* Variables for the ``tight'' encoding implementation.
|
||||
*/
|
||||
|
||||
/** Separate buffer for compressed data. */
|
||||
#define ZLIB_BUFFER_SIZE 30000
|
||||
char zlib_buffer[ZLIB_BUFFER_SIZE];
|
||||
|
||||
/* Four independent compression streams for zlib library. */
|
||||
z_stream zlibStream[4];
|
||||
rfbBool zlibStreamActive[4];
|
||||
|
||||
/* Filter stuff. Should be initialized by filter initialization code. */
|
||||
rfbBool cutZeros;
|
||||
int rectWidth, rectColors;
|
||||
char tightPalette[256*4];
|
||||
uint8_t tightPrevRow[2048*3*sizeof(uint16_t)];
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBJPEG
|
||||
/** JPEG decoder state. */
|
||||
rfbBool jpegError;
|
||||
|
||||
struct jpeg_source_mgr* jpegSrcManager;
|
||||
void* jpegBufferPtr;
|
||||
size_t jpegBufferLen;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* cursor.c */
|
||||
uint8_t *rcSource, *rcMask;
|
||||
|
||||
/** private data pointer */
|
||||
rfbClientData* clientData;
|
||||
|
||||
rfbVNCRec* vncRec;
|
||||
|
||||
/* Keyboard State support (is 'Caps Lock' set on the remote display???) */
|
||||
int KeyboardLedStateEnabled;
|
||||
int CurrentKeyboardLedState;
|
||||
|
||||
int canHandleNewFBSize;
|
||||
|
||||
/* hooks */
|
||||
HandleTextChatProc HandleTextChat;
|
||||
HandleKeyboardLedStateProc HandleKeyboardLedState;
|
||||
HandleCursorPosProc HandleCursorPos;
|
||||
SoftCursorLockAreaProc SoftCursorLockArea;
|
||||
SoftCursorUnlockScreenProc SoftCursorUnlockScreen;
|
||||
GotFrameBufferUpdateProc GotFrameBufferUpdate;
|
||||
FinishedFrameBufferUpdateProc FinishedFrameBufferUpdate;
|
||||
/** the pointer returned by GetPassword will be freed after use! */
|
||||
GetPasswordProc GetPassword;
|
||||
MallocFrameBufferProc MallocFrameBuffer;
|
||||
GotXCutTextProc GotXCutText;
|
||||
BellProc Bell;
|
||||
|
||||
GotCursorShapeProc GotCursorShape;
|
||||
GotCopyRectProc GotCopyRect;
|
||||
|
||||
/** Which messages are supported by the server
|
||||
* This is a *guess* for most servers.
|
||||
* (If we can even detect the type of server)
|
||||
*
|
||||
* If the server supports the "rfbEncodingSupportedMessages"
|
||||
* then this will be updated when the encoding is received to
|
||||
* accurately reflect the servers capabilities.
|
||||
*/
|
||||
rfbSupportedMessages supportedMessages;
|
||||
|
||||
/** negotiated protocol version */
|
||||
int major, minor;
|
||||
|
||||
/** The selected security types */
|
||||
uint32_t authScheme, subAuthScheme;
|
||||
|
||||
#ifdef LIBVNCSERVER_WITH_CLIENT_TLS
|
||||
/** The TLS session for Anonymous TLS and VeNCrypt */
|
||||
gnutls_session_t tlsSession;
|
||||
#endif
|
||||
|
||||
/** To support security types that requires user input (except VNC password
|
||||
* authentication), for example VeNCrypt and MSLogon, this callback function
|
||||
* must be set before the authentication. Otherwise, it implicates that the
|
||||
* caller application does not support it and related security types should
|
||||
* be bypassed.
|
||||
*/
|
||||
GetCredentialProc GetCredential;
|
||||
|
||||
/** The 0-terminated security types supported by the client.
|
||||
* Set by function SetClientAuthSchemes() */
|
||||
uint32_t *clientAuthSchemes;
|
||||
|
||||
/** When the server is a repeater, this specifies the final destination */
|
||||
char *destHost;
|
||||
int destPort;
|
||||
|
||||
/** the QoS IP DSCP for this client */
|
||||
int QoS_DSCP;
|
||||
|
||||
/** hook to handle xvp server messages */
|
||||
HandleXvpMsgProc HandleXvpMsg;
|
||||
} rfbClient;
|
||||
|
||||
/* cursor.c */
|
||||
|
||||
extern rfbBool HandleCursorShape(rfbClient* client,int xhot, int yhot, int width, int height, uint32_t enc);
|
||||
|
||||
/* listen.c */
|
||||
|
||||
extern void listenForIncomingConnections(rfbClient* viewer);
|
||||
extern int listenForIncomingConnectionsNoFork(rfbClient* viewer, int usec_timeout);
|
||||
|
||||
/* rfbproto.c */
|
||||
|
||||
extern rfbBool rfbEnableClientLogging;
|
||||
typedef void (*rfbClientLogProc)(const char *format, ...);
|
||||
extern rfbClientLogProc rfbClientLog,rfbClientErr;
|
||||
extern rfbBool ConnectToRFBServer(rfbClient* client,const char *hostname, int port);
|
||||
extern rfbBool ConnectToRFBRepeater(rfbClient* client,const char *repeaterHost, int repeaterPort, const char *destHost, int destPort);
|
||||
extern void SetClientAuthSchemes(rfbClient* client,const uint32_t *authSchemes, int size);
|
||||
extern rfbBool InitialiseRFBConnection(rfbClient* client);
|
||||
extern rfbBool SetFormatAndEncodings(rfbClient* client);
|
||||
extern rfbBool SendIncrementalFramebufferUpdateRequest(rfbClient* client);
|
||||
extern rfbBool SendFramebufferUpdateRequest(rfbClient* client,
|
||||
int x, int y, int w, int h,
|
||||
rfbBool incremental);
|
||||
extern rfbBool SendScaleSetting(rfbClient* client,int scaleSetting);
|
||||
extern rfbBool SendPointerEvent(rfbClient* client,int x, int y, int buttonMask);
|
||||
extern rfbBool SendKeyEvent(rfbClient* client,uint32_t key, rfbBool down);
|
||||
extern rfbBool SendClientCutText(rfbClient* client,char *str, int len);
|
||||
extern rfbBool HandleRFBServerMessage(rfbClient* client);
|
||||
|
||||
extern rfbBool TextChatSend(rfbClient* client, char *text);
|
||||
extern rfbBool TextChatOpen(rfbClient* client);
|
||||
extern rfbBool TextChatClose(rfbClient* client);
|
||||
extern rfbBool TextChatFinish(rfbClient* client);
|
||||
extern rfbBool PermitServerInput(rfbClient* client, int enabled);
|
||||
extern rfbBool SendXvpMsg(rfbClient* client, uint8_t version, uint8_t code);
|
||||
|
||||
extern void PrintPixelFormat(rfbPixelFormat *format);
|
||||
|
||||
extern rfbBool SupportsClient2Server(rfbClient* client, int messageType);
|
||||
extern rfbBool SupportsServer2Client(rfbClient* client, int messageType);
|
||||
|
||||
/* client data */
|
||||
|
||||
void rfbClientSetClientData(rfbClient* client, void* tag, void* data);
|
||||
void* rfbClientGetClientData(rfbClient* client, void* tag);
|
||||
|
||||
/* protocol extensions */
|
||||
|
||||
typedef struct _rfbClientProtocolExtension {
|
||||
int* encodings;
|
||||
/** returns TRUE if the encoding was handled */
|
||||
rfbBool (*handleEncoding)(rfbClient* cl,
|
||||
rfbFramebufferUpdateRectHeader* rect);
|
||||
/** returns TRUE if it handled the message */
|
||||
rfbBool (*handleMessage)(rfbClient* cl,
|
||||
rfbServerToClientMsg* message);
|
||||
struct _rfbClientProtocolExtension* next;
|
||||
} rfbClientProtocolExtension;
|
||||
|
||||
void rfbClientRegisterExtension(rfbClientProtocolExtension* e);
|
||||
|
||||
/* sockets.c */
|
||||
|
||||
extern rfbBool errorMessageOnReadFailure;
|
||||
|
||||
extern rfbBool ReadFromRFBServer(rfbClient* client, char *out, unsigned int n);
|
||||
extern rfbBool WriteToRFBServer(rfbClient* client, char *buf, int n);
|
||||
extern int FindFreeTcpPort(void);
|
||||
extern int ListenAtTcpPort(int port);
|
||||
extern int ConnectClientToTcpAddr(unsigned int host, int port);
|
||||
extern int ConnectClientToTcpAddr6(const char *hostname, int port);
|
||||
extern int ConnectClientToUnixSock(const char *sockFile);
|
||||
extern int AcceptTcpConnection(int listenSock);
|
||||
extern rfbBool SetNonBlocking(int sock);
|
||||
extern rfbBool SetDSCP(int sock, int dscp);
|
||||
|
||||
extern rfbBool StringToIPAddr(const char *str, unsigned int *addr);
|
||||
extern rfbBool SameMachine(int sock);
|
||||
extern int WaitForMessage(rfbClient* client,unsigned int usecs);
|
||||
|
||||
/* vncviewer.c */
|
||||
rfbClient* rfbGetClient(int bitsPerSample,int samplesPerPixel,int bytesPerPixel);
|
||||
rfbBool rfbInitClient(rfbClient* client,int* argc,char** argv);
|
||||
/** rfbClientCleanup() does not touch client->frameBuffer */
|
||||
void rfbClientCleanup(rfbClient* client);
|
||||
|
||||
#if(defined __cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
/**
|
||||
@page libvncclient_doc LibVNCClient Documentation
|
||||
@section example_code Example Code
|
||||
See SDLvncviewer.c for a rather complete client example.
|
||||
*/
|
||||
|
||||
#endif
|
||||
1431
libvncserver/rfb/rfbproto.h
Normal file
1431
libvncserver/rfb/rfbproto.h
Normal file
File diff suppressed because it is too large
Load Diff
65
libvncserver/rfb/rfbregion.h
Normal file
65
libvncserver/rfb/rfbregion.h
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef SRAREGION_H
|
||||
#define SRAREGION_H
|
||||
|
||||
/* -=- SRA - Simple Region Algorithm
|
||||
* A simple rectangular region implementation.
|
||||
* Copyright (c) 2001 James "Wez" Weatherall, Johannes E. Schindelin
|
||||
*/
|
||||
|
||||
/* -=- sraRect */
|
||||
|
||||
typedef struct _rect {
|
||||
int x1;
|
||||
int y1;
|
||||
int x2;
|
||||
int y2;
|
||||
} sraRect;
|
||||
|
||||
typedef struct sraRegion sraRegion;
|
||||
|
||||
/* -=- Region manipulation functions */
|
||||
|
||||
extern sraRegion *sraRgnCreate();
|
||||
extern sraRegion *sraRgnCreateRect(int x1, int y1, int x2, int y2);
|
||||
extern sraRegion *sraRgnCreateRgn(const sraRegion *src);
|
||||
|
||||
extern void sraRgnDestroy(sraRegion *rgn);
|
||||
extern void sraRgnMakeEmpty(sraRegion *rgn);
|
||||
extern rfbBool sraRgnAnd(sraRegion *dst, const sraRegion *src);
|
||||
extern void sraRgnOr(sraRegion *dst, const sraRegion *src);
|
||||
extern rfbBool sraRgnSubtract(sraRegion *dst, const sraRegion *src);
|
||||
|
||||
extern void sraRgnOffset(sraRegion *dst, int dx, int dy);
|
||||
|
||||
extern rfbBool sraRgnPopRect(sraRegion *region, sraRect *rect,
|
||||
unsigned long flags);
|
||||
|
||||
extern unsigned long sraRgnCountRects(const sraRegion *rgn);
|
||||
extern rfbBool sraRgnEmpty(const sraRegion *rgn);
|
||||
|
||||
extern sraRegion *sraRgnBBox(const sraRegion *src);
|
||||
|
||||
/* -=- rectangle iterator */
|
||||
|
||||
typedef struct sraRectangleIterator {
|
||||
rfbBool reverseX,reverseY;
|
||||
int ptrSize,ptrPos;
|
||||
struct sraSpan** sPtrs;
|
||||
} sraRectangleIterator;
|
||||
|
||||
extern sraRectangleIterator *sraRgnGetIterator(sraRegion *s);
|
||||
extern sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfbBool reverseY);
|
||||
extern rfbBool sraRgnIteratorNext(sraRectangleIterator *i,sraRect *r);
|
||||
extern void sraRgnReleaseIterator(sraRectangleIterator *i);
|
||||
|
||||
void sraRgnPrint(const sraRegion *s);
|
||||
|
||||
/* -=- Rectangle clipper (for speed) */
|
||||
|
||||
extern rfbBool sraClipRect(int *x, int *y, int *w, int *h,
|
||||
int cx, int cy, int cw, int ch);
|
||||
|
||||
extern rfbBool sraClipRect2(int *x, int *y, int *x2, int *y2,
|
||||
int cx, int cy, int cx2, int cy2);
|
||||
|
||||
#endif
|
||||
886
libvncserver/rfbregion.c
Normal file
886
libvncserver/rfbregion.c
Normal file
@@ -0,0 +1,886 @@
|
||||
/* -=- sraRegion.c
|
||||
* Copyright (c) 2001 James "Wez" Weatherall, Johannes E. Schindelin
|
||||
*
|
||||
* A general purpose region clipping library
|
||||
* Only deals with rectangular regions, though.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
#include "rfb/rfbregion.h"
|
||||
|
||||
/* -=- Internal Span structure */
|
||||
|
||||
struct sraRegion;
|
||||
|
||||
typedef struct sraSpan {
|
||||
struct sraSpan *_next;
|
||||
struct sraSpan *_prev;
|
||||
int start;
|
||||
int end;
|
||||
struct sraRegion *subspan;
|
||||
} sraSpan;
|
||||
|
||||
typedef struct sraRegion {
|
||||
sraSpan front;
|
||||
sraSpan back;
|
||||
} sraSpanList;
|
||||
|
||||
/* -=- Span routines */
|
||||
|
||||
sraSpanList *sraSpanListDup(const sraSpanList *src);
|
||||
void sraSpanListDestroy(sraSpanList *list);
|
||||
|
||||
static sraSpan *
|
||||
sraSpanCreate(int start, int end, const sraSpanList *subspan) {
|
||||
sraSpan *item = (sraSpan*)malloc(sizeof(sraSpan));
|
||||
item->_next = item->_prev = NULL;
|
||||
item->start = start;
|
||||
item->end = end;
|
||||
item->subspan = sraSpanListDup(subspan);
|
||||
return item;
|
||||
}
|
||||
|
||||
static sraSpan *
|
||||
sraSpanDup(const sraSpan *src) {
|
||||
sraSpan *span;
|
||||
if (!src) return NULL;
|
||||
span = sraSpanCreate(src->start, src->end, src->subspan);
|
||||
return span;
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanInsertAfter(sraSpan *newspan, sraSpan *after) {
|
||||
newspan->_next = after->_next;
|
||||
newspan->_prev = after;
|
||||
after->_next->_prev = newspan;
|
||||
after->_next = newspan;
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanInsertBefore(sraSpan *newspan, sraSpan *before) {
|
||||
newspan->_next = before;
|
||||
newspan->_prev = before->_prev;
|
||||
before->_prev->_next = newspan;
|
||||
before->_prev = newspan;
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanRemove(sraSpan *span) {
|
||||
span->_prev->_next = span->_next;
|
||||
span->_next->_prev = span->_prev;
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanDestroy(sraSpan *span) {
|
||||
if (span->subspan) sraSpanListDestroy(span->subspan);
|
||||
free(span);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
sraSpanCheck(const sraSpan *span, const char *text) {
|
||||
/* Check the span is valid! */
|
||||
if (span->start == span->end) {
|
||||
printf(text);
|
||||
printf(":%d-%d\n", span->start, span->end);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -=- SpanList routines */
|
||||
|
||||
static void sraSpanPrint(const sraSpan *s);
|
||||
|
||||
static void
|
||||
sraSpanListPrint(const sraSpanList *l) {
|
||||
sraSpan *curr;
|
||||
if (!l) {
|
||||
printf("NULL");
|
||||
return;
|
||||
}
|
||||
curr = l->front._next;
|
||||
printf("[");
|
||||
while (curr != &(l->back)) {
|
||||
sraSpanPrint(curr);
|
||||
curr = curr->_next;
|
||||
}
|
||||
printf("]");
|
||||
}
|
||||
|
||||
void
|
||||
sraSpanPrint(const sraSpan *s) {
|
||||
printf("(%d-%d)", (s->start), (s->end));
|
||||
if (s->subspan)
|
||||
sraSpanListPrint(s->subspan);
|
||||
}
|
||||
|
||||
static sraSpanList *
|
||||
sraSpanListCreate(void) {
|
||||
sraSpanList *item = (sraSpanList*)malloc(sizeof(sraSpanList));
|
||||
item->front._next = &(item->back);
|
||||
item->front._prev = NULL;
|
||||
item->back._prev = &(item->front);
|
||||
item->back._next = NULL;
|
||||
return item;
|
||||
}
|
||||
|
||||
sraSpanList *
|
||||
sraSpanListDup(const sraSpanList *src) {
|
||||
sraSpanList *newlist;
|
||||
sraSpan *newspan, *curr;
|
||||
|
||||
if (!src) return NULL;
|
||||
newlist = sraSpanListCreate();
|
||||
curr = src->front._next;
|
||||
while (curr != &(src->back)) {
|
||||
newspan = sraSpanDup(curr);
|
||||
sraSpanInsertBefore(newspan, &(newlist->back));
|
||||
curr = curr->_next;
|
||||
}
|
||||
|
||||
return newlist;
|
||||
}
|
||||
|
||||
void
|
||||
sraSpanListDestroy(sraSpanList *list) {
|
||||
sraSpan *curr, *next;
|
||||
while (list->front._next != &(list->back)) {
|
||||
curr = list->front._next;
|
||||
next = curr->_next;
|
||||
sraSpanRemove(curr);
|
||||
sraSpanDestroy(curr);
|
||||
curr = next;
|
||||
}
|
||||
free(list);
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanListMakeEmpty(sraSpanList *list) {
|
||||
sraSpan *curr, *next;
|
||||
while (list->front._next != &(list->back)) {
|
||||
curr = list->front._next;
|
||||
next = curr->_next;
|
||||
sraSpanRemove(curr);
|
||||
sraSpanDestroy(curr);
|
||||
curr = next;
|
||||
}
|
||||
list->front._next = &(list->back);
|
||||
list->front._prev = NULL;
|
||||
list->back._prev = &(list->front);
|
||||
list->back._next = NULL;
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
sraSpanListEqual(const sraSpanList *s1, const sraSpanList *s2) {
|
||||
sraSpan *sp1, *sp2;
|
||||
|
||||
if (!s1) {
|
||||
if (!s2) {
|
||||
return 1;
|
||||
} else {
|
||||
rfbErr("sraSpanListEqual:incompatible spans (only one NULL!)\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
sp1 = s1->front._next;
|
||||
sp2 = s2->front._next;
|
||||
while ((sp1 != &(s1->back)) &&
|
||||
(sp2 != &(s2->back))) {
|
||||
if ((sp1->start != sp2->start) ||
|
||||
(sp1->end != sp2->end) ||
|
||||
(!sraSpanListEqual(sp1->subspan, sp2->subspan))) {
|
||||
return 0;
|
||||
}
|
||||
sp1 = sp1->_next;
|
||||
sp2 = sp2->_next;
|
||||
}
|
||||
|
||||
if ((sp1 == &(s1->back)) && (sp2 == &(s2->back))) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
sraSpanListEmpty(const sraSpanList *list) {
|
||||
return (list->front._next == &(list->back));
|
||||
}
|
||||
|
||||
static unsigned long
|
||||
sraSpanListCount(const sraSpanList *list) {
|
||||
sraSpan *curr = list->front._next;
|
||||
unsigned long count = 0;
|
||||
while (curr != &(list->back)) {
|
||||
if (curr->subspan) {
|
||||
count += sraSpanListCount(curr->subspan);
|
||||
} else {
|
||||
count += 1;
|
||||
}
|
||||
curr = curr->_next;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanMergePrevious(sraSpan *dest) {
|
||||
sraSpan *prev = dest->_prev;
|
||||
|
||||
while ((prev->_prev) &&
|
||||
(prev->end == dest->start) &&
|
||||
(sraSpanListEqual(prev->subspan, dest->subspan))) {
|
||||
/*
|
||||
printf("merge_prev:");
|
||||
sraSpanPrint(prev);
|
||||
printf(" & ");
|
||||
sraSpanPrint(dest);
|
||||
printf("\n");
|
||||
*/
|
||||
dest->start = prev->start;
|
||||
sraSpanRemove(prev);
|
||||
sraSpanDestroy(prev);
|
||||
prev = dest->_prev;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanMergeNext(sraSpan *dest) {
|
||||
sraSpan *next = dest->_next;
|
||||
while ((next->_next) &&
|
||||
(next->start == dest->end) &&
|
||||
(sraSpanListEqual(next->subspan, dest->subspan))) {
|
||||
/*
|
||||
printf("merge_next:");
|
||||
sraSpanPrint(dest);
|
||||
printf(" & ");
|
||||
sraSpanPrint(next);
|
||||
printf("\n");
|
||||
*/
|
||||
dest->end = next->end;
|
||||
sraSpanRemove(next);
|
||||
sraSpanDestroy(next);
|
||||
next = dest->_next;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sraSpanListOr(sraSpanList *dest, const sraSpanList *src) {
|
||||
sraSpan *d_curr, *s_curr;
|
||||
int s_start, s_end;
|
||||
|
||||
if (!dest) {
|
||||
if (!src) {
|
||||
return;
|
||||
} else {
|
||||
rfbErr("sraSpanListOr:incompatible spans (only one NULL!)\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
d_curr = dest->front._next;
|
||||
s_curr = src->front._next;
|
||||
s_start = s_curr->start;
|
||||
s_end = s_curr->end;
|
||||
while (s_curr != &(src->back)) {
|
||||
|
||||
/* - If we are at end of destination list OR
|
||||
If the new span comes before the next destination one */
|
||||
if ((d_curr == &(dest->back)) ||
|
||||
(d_curr->start >= s_end)) {
|
||||
/* - Add the span */
|
||||
sraSpanInsertBefore(sraSpanCreate(s_start, s_end,
|
||||
s_curr->subspan),
|
||||
d_curr);
|
||||
if (d_curr != &(dest->back))
|
||||
sraSpanMergePrevious(d_curr);
|
||||
s_curr = s_curr->_next;
|
||||
s_start = s_curr->start;
|
||||
s_end = s_curr->end;
|
||||
} else {
|
||||
|
||||
/* - If the new span overlaps the existing one */
|
||||
if ((s_start < d_curr->end) &&
|
||||
(s_end > d_curr->start)) {
|
||||
|
||||
/* - Insert new span before the existing destination one? */
|
||||
if (s_start < d_curr->start) {
|
||||
sraSpanInsertBefore(sraSpanCreate(s_start,
|
||||
d_curr->start,
|
||||
s_curr->subspan),
|
||||
d_curr);
|
||||
sraSpanMergePrevious(d_curr);
|
||||
}
|
||||
|
||||
/* Split the existing span if necessary */
|
||||
if (s_end < d_curr->end) {
|
||||
sraSpanInsertAfter(sraSpanCreate(s_end,
|
||||
d_curr->end,
|
||||
d_curr->subspan),
|
||||
d_curr);
|
||||
d_curr->end = s_end;
|
||||
}
|
||||
if (s_start > d_curr->start) {
|
||||
sraSpanInsertBefore(sraSpanCreate(d_curr->start,
|
||||
s_start,
|
||||
d_curr->subspan),
|
||||
d_curr);
|
||||
d_curr->start = s_start;
|
||||
}
|
||||
|
||||
/* Recursively OR subspans */
|
||||
sraSpanListOr(d_curr->subspan, s_curr->subspan);
|
||||
|
||||
/* Merge this span with previous or next? */
|
||||
if (d_curr->_prev != &(dest->front))
|
||||
sraSpanMergePrevious(d_curr);
|
||||
if (d_curr->_next != &(dest->back))
|
||||
sraSpanMergeNext(d_curr);
|
||||
|
||||
/* Move onto the next pair to compare */
|
||||
if (s_end > d_curr->end) {
|
||||
s_start = d_curr->end;
|
||||
d_curr = d_curr->_next;
|
||||
} else {
|
||||
s_curr = s_curr->_next;
|
||||
s_start = s_curr->start;
|
||||
s_end = s_curr->end;
|
||||
}
|
||||
} else {
|
||||
/* - No overlap. Move to the next destination span */
|
||||
d_curr = d_curr->_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
sraSpanListAnd(sraSpanList *dest, const sraSpanList *src) {
|
||||
sraSpan *d_curr, *s_curr, *d_next;
|
||||
|
||||
if (!dest) {
|
||||
if (!src) {
|
||||
return 1;
|
||||
} else {
|
||||
rfbErr("sraSpanListAnd:incompatible spans (only one NULL!)\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
d_curr = dest->front._next;
|
||||
s_curr = src->front._next;
|
||||
while ((s_curr != &(src->back)) && (d_curr != &(dest->back))) {
|
||||
|
||||
/* - If we haven't reached a destination span yet then move on */
|
||||
if (d_curr->start >= s_curr->end) {
|
||||
s_curr = s_curr->_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* - If we are beyond the current destination span then remove it */
|
||||
if (d_curr->end <= s_curr->start) {
|
||||
sraSpan *next = d_curr->_next;
|
||||
sraSpanRemove(d_curr);
|
||||
sraSpanDestroy(d_curr);
|
||||
d_curr = next;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* - If we partially overlap a span then split it up or remove bits */
|
||||
if (s_curr->start > d_curr->start) {
|
||||
/* - The top bit of the span does not match */
|
||||
d_curr->start = s_curr->start;
|
||||
}
|
||||
if (s_curr->end < d_curr->end) {
|
||||
/* - The end of the span does not match */
|
||||
sraSpanInsertAfter(sraSpanCreate(s_curr->end,
|
||||
d_curr->end,
|
||||
d_curr->subspan),
|
||||
d_curr);
|
||||
d_curr->end = s_curr->end;
|
||||
}
|
||||
|
||||
/* - Now recursively process the affected span */
|
||||
if (!sraSpanListAnd(d_curr->subspan, s_curr->subspan)) {
|
||||
/* - The destination subspan is now empty, so we should remove it */
|
||||
sraSpan *next = d_curr->_next;
|
||||
sraSpanRemove(d_curr);
|
||||
sraSpanDestroy(d_curr);
|
||||
d_curr = next;
|
||||
} else {
|
||||
/* Merge this span with previous or next? */
|
||||
if (d_curr->_prev != &(dest->front))
|
||||
sraSpanMergePrevious(d_curr);
|
||||
|
||||
/* - Move on to the next span */
|
||||
d_next = d_curr;
|
||||
if (s_curr->end >= d_curr->end) {
|
||||
d_next = d_curr->_next;
|
||||
}
|
||||
if (s_curr->end <= d_curr->end) {
|
||||
s_curr = s_curr->_next;
|
||||
}
|
||||
d_curr = d_next;
|
||||
}
|
||||
}
|
||||
|
||||
while (d_curr != &(dest->back)) {
|
||||
sraSpan *next = d_curr->_next;
|
||||
sraSpanRemove(d_curr);
|
||||
sraSpanDestroy(d_curr);
|
||||
d_curr=next;
|
||||
}
|
||||
|
||||
return !sraSpanListEmpty(dest);
|
||||
}
|
||||
|
||||
static rfbBool
|
||||
sraSpanListSubtract(sraSpanList *dest, const sraSpanList *src) {
|
||||
sraSpan *d_curr, *s_curr;
|
||||
|
||||
if (!dest) {
|
||||
if (!src) {
|
||||
return 1;
|
||||
} else {
|
||||
rfbErr("sraSpanListSubtract:incompatible spans (only one NULL!)\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
d_curr = dest->front._next;
|
||||
s_curr = src->front._next;
|
||||
while ((s_curr != &(src->back)) && (d_curr != &(dest->back))) {
|
||||
|
||||
/* - If we haven't reached a destination span yet then move on */
|
||||
if (d_curr->start >= s_curr->end) {
|
||||
s_curr = s_curr->_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* - If we are beyond the current destination span then skip it */
|
||||
if (d_curr->end <= s_curr->start) {
|
||||
d_curr = d_curr->_next;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* - If we partially overlap the current span then split it up */
|
||||
if (s_curr->start > d_curr->start) {
|
||||
sraSpanInsertBefore(sraSpanCreate(d_curr->start,
|
||||
s_curr->start,
|
||||
d_curr->subspan),
|
||||
d_curr);
|
||||
d_curr->start = s_curr->start;
|
||||
}
|
||||
if (s_curr->end < d_curr->end) {
|
||||
sraSpanInsertAfter(sraSpanCreate(s_curr->end,
|
||||
d_curr->end,
|
||||
d_curr->subspan),
|
||||
d_curr);
|
||||
d_curr->end = s_curr->end;
|
||||
}
|
||||
|
||||
/* - Now recursively process the affected span */
|
||||
if ((!d_curr->subspan) || !sraSpanListSubtract(d_curr->subspan, s_curr->subspan)) {
|
||||
/* - The destination subspan is now empty, so we should remove it */
|
||||
sraSpan *next = d_curr->_next;
|
||||
sraSpanRemove(d_curr);
|
||||
sraSpanDestroy(d_curr);
|
||||
d_curr = next;
|
||||
} else {
|
||||
/* Merge this span with previous or next? */
|
||||
if (d_curr->_prev != &(dest->front))
|
||||
sraSpanMergePrevious(d_curr);
|
||||
if (d_curr->_next != &(dest->back))
|
||||
sraSpanMergeNext(d_curr);
|
||||
|
||||
/* - Move on to the next span */
|
||||
if (s_curr->end > d_curr->end) {
|
||||
d_curr = d_curr->_next;
|
||||
} else {
|
||||
s_curr = s_curr->_next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return !sraSpanListEmpty(dest);
|
||||
}
|
||||
|
||||
/* -=- Region routines */
|
||||
|
||||
sraRegion *
|
||||
sraRgnCreate(void) {
|
||||
return (sraRegion*)sraSpanListCreate();
|
||||
}
|
||||
|
||||
sraRegion *
|
||||
sraRgnCreateRect(int x1, int y1, int x2, int y2) {
|
||||
sraSpanList *vlist, *hlist;
|
||||
sraSpan *vspan, *hspan;
|
||||
|
||||
/* - Build the horizontal portion of the span */
|
||||
hlist = sraSpanListCreate();
|
||||
hspan = sraSpanCreate(x1, x2, NULL);
|
||||
sraSpanInsertAfter(hspan, &(hlist->front));
|
||||
|
||||
/* - Build the vertical portion of the span */
|
||||
vlist = sraSpanListCreate();
|
||||
vspan = sraSpanCreate(y1, y2, hlist);
|
||||
sraSpanInsertAfter(vspan, &(vlist->front));
|
||||
|
||||
sraSpanListDestroy(hlist);
|
||||
|
||||
return (sraRegion*)vlist;
|
||||
}
|
||||
|
||||
sraRegion *
|
||||
sraRgnCreateRgn(const sraRegion *src) {
|
||||
return (sraRegion*)sraSpanListDup((sraSpanList*)src);
|
||||
}
|
||||
|
||||
void
|
||||
sraRgnDestroy(sraRegion *rgn) {
|
||||
sraSpanListDestroy((sraSpanList*)rgn);
|
||||
}
|
||||
|
||||
void
|
||||
sraRgnMakeEmpty(sraRegion *rgn) {
|
||||
sraSpanListMakeEmpty((sraSpanList*)rgn);
|
||||
}
|
||||
|
||||
/* -=- Boolean Region ops */
|
||||
|
||||
rfbBool
|
||||
sraRgnAnd(sraRegion *dst, const sraRegion *src) {
|
||||
return sraSpanListAnd((sraSpanList*)dst, (sraSpanList*)src);
|
||||
}
|
||||
|
||||
void
|
||||
sraRgnOr(sraRegion *dst, const sraRegion *src) {
|
||||
sraSpanListOr((sraSpanList*)dst, (sraSpanList*)src);
|
||||
}
|
||||
|
||||
rfbBool
|
||||
sraRgnSubtract(sraRegion *dst, const sraRegion *src) {
|
||||
return sraSpanListSubtract((sraSpanList*)dst, (sraSpanList*)src);
|
||||
}
|
||||
|
||||
void
|
||||
sraRgnOffset(sraRegion *dst, int dx, int dy) {
|
||||
sraSpan *vcurr, *hcurr;
|
||||
|
||||
vcurr = ((sraSpanList*)dst)->front._next;
|
||||
while (vcurr != &(((sraSpanList*)dst)->back)) {
|
||||
vcurr->start += dy;
|
||||
vcurr->end += dy;
|
||||
|
||||
hcurr = vcurr->subspan->front._next;
|
||||
while (hcurr != &(vcurr->subspan->back)) {
|
||||
hcurr->start += dx;
|
||||
hcurr->end += dx;
|
||||
hcurr = hcurr->_next;
|
||||
}
|
||||
|
||||
vcurr = vcurr->_next;
|
||||
}
|
||||
}
|
||||
|
||||
sraRegion *sraRgnBBox(const sraRegion *src) {
|
||||
int xmin=((unsigned int)(int)-1)>>1,ymin=xmin,xmax=1-xmin,ymax=xmax;
|
||||
sraSpan *vcurr, *hcurr;
|
||||
|
||||
if(!src)
|
||||
return sraRgnCreate();
|
||||
|
||||
vcurr = ((sraSpanList*)src)->front._next;
|
||||
while (vcurr != &(((sraSpanList*)src)->back)) {
|
||||
if(vcurr->start<ymin)
|
||||
ymin=vcurr->start;
|
||||
if(vcurr->end>ymax)
|
||||
ymax=vcurr->end;
|
||||
|
||||
hcurr = vcurr->subspan->front._next;
|
||||
while (hcurr != &(vcurr->subspan->back)) {
|
||||
if(hcurr->start<xmin)
|
||||
xmin=hcurr->start;
|
||||
if(hcurr->end>xmax)
|
||||
xmax=hcurr->end;
|
||||
hcurr = hcurr->_next;
|
||||
}
|
||||
|
||||
vcurr = vcurr->_next;
|
||||
}
|
||||
|
||||
if(xmax<xmin || ymax<ymin)
|
||||
return sraRgnCreate();
|
||||
|
||||
return sraRgnCreateRect(xmin,ymin,xmax,ymax);
|
||||
}
|
||||
|
||||
rfbBool
|
||||
sraRgnPopRect(sraRegion *rgn, sraRect *rect, unsigned long flags) {
|
||||
sraSpan *vcurr, *hcurr;
|
||||
sraSpan *vend, *hend;
|
||||
rfbBool right2left = (flags & 2) == 2;
|
||||
rfbBool bottom2top = (flags & 1) == 1;
|
||||
|
||||
/* - Pick correct order */
|
||||
if (bottom2top) {
|
||||
vcurr = ((sraSpanList*)rgn)->back._prev;
|
||||
vend = &(((sraSpanList*)rgn)->front);
|
||||
} else {
|
||||
vcurr = ((sraSpanList*)rgn)->front._next;
|
||||
vend = &(((sraSpanList*)rgn)->back);
|
||||
}
|
||||
|
||||
if (vcurr != vend) {
|
||||
rect->y1 = vcurr->start;
|
||||
rect->y2 = vcurr->end;
|
||||
|
||||
/* - Pick correct order */
|
||||
if (right2left) {
|
||||
hcurr = vcurr->subspan->back._prev;
|
||||
hend = &(vcurr->subspan->front);
|
||||
} else {
|
||||
hcurr = vcurr->subspan->front._next;
|
||||
hend = &(vcurr->subspan->back);
|
||||
}
|
||||
|
||||
if (hcurr != hend) {
|
||||
rect->x1 = hcurr->start;
|
||||
rect->x2 = hcurr->end;
|
||||
|
||||
sraSpanRemove(hcurr);
|
||||
sraSpanDestroy(hcurr);
|
||||
|
||||
if (sraSpanListEmpty(vcurr->subspan)) {
|
||||
sraSpanRemove(vcurr);
|
||||
sraSpanDestroy(vcurr);
|
||||
}
|
||||
|
||||
#if 0
|
||||
printf("poprect:(%dx%d)-(%dx%d)\n",
|
||||
rect->x1, rect->y1, rect->x2, rect->y2);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned long
|
||||
sraRgnCountRects(const sraRegion *rgn) {
|
||||
unsigned long count = sraSpanListCount((sraSpanList*)rgn);
|
||||
return count;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
sraRgnEmpty(const sraRegion *rgn) {
|
||||
return sraSpanListEmpty((sraSpanList*)rgn);
|
||||
}
|
||||
|
||||
/* iterator stuff */
|
||||
sraRectangleIterator *sraRgnGetIterator(sraRegion *s)
|
||||
{
|
||||
/* these values have to be multiples of 4 */
|
||||
#define DEFSIZE 4
|
||||
#define DEFSTEP 8
|
||||
sraRectangleIterator *i =
|
||||
(sraRectangleIterator*)malloc(sizeof(sraRectangleIterator));
|
||||
if(!i)
|
||||
return NULL;
|
||||
|
||||
/* we have to recurse eventually. So, the first sPtr is the pointer to
|
||||
the sraSpan in the first level. the second sPtr is the pointer to
|
||||
the sraRegion.back. The third and fourth sPtr are for the second
|
||||
recursion level and so on. */
|
||||
i->sPtrs = (sraSpan**)malloc(sizeof(sraSpan*)*DEFSIZE);
|
||||
if(!i->sPtrs) {
|
||||
free(i);
|
||||
return NULL;
|
||||
}
|
||||
i->ptrSize = DEFSIZE;
|
||||
i->sPtrs[0] = &(s->front);
|
||||
i->sPtrs[1] = &(s->back);
|
||||
i->ptrPos = 0;
|
||||
i->reverseX = 0;
|
||||
i->reverseY = 0;
|
||||
return i;
|
||||
}
|
||||
|
||||
sraRectangleIterator *sraRgnGetReverseIterator(sraRegion *s,rfbBool reverseX,rfbBool reverseY)
|
||||
{
|
||||
sraRectangleIterator *i = sraRgnGetIterator(s);
|
||||
if(reverseY) {
|
||||
i->sPtrs[1] = &(s->front);
|
||||
i->sPtrs[0] = &(s->back);
|
||||
}
|
||||
i->reverseX = reverseX;
|
||||
i->reverseY = reverseY;
|
||||
return(i);
|
||||
}
|
||||
|
||||
static rfbBool sraReverse(sraRectangleIterator *i)
|
||||
{
|
||||
return( ((i->ptrPos&2) && i->reverseX) ||
|
||||
(!(i->ptrPos&2) && i->reverseY));
|
||||
}
|
||||
|
||||
static sraSpan* sraNextSpan(sraRectangleIterator *i)
|
||||
{
|
||||
if(sraReverse(i))
|
||||
return(i->sPtrs[i->ptrPos]->_prev);
|
||||
else
|
||||
return(i->sPtrs[i->ptrPos]->_next);
|
||||
}
|
||||
|
||||
rfbBool sraRgnIteratorNext(sraRectangleIterator* i,sraRect* r)
|
||||
{
|
||||
/* is the subspan finished? */
|
||||
while(sraNextSpan(i) == i->sPtrs[i->ptrPos+1]) {
|
||||
i->ptrPos -= 2;
|
||||
if(i->ptrPos < 0) /* the end */
|
||||
return(0);
|
||||
}
|
||||
|
||||
i->sPtrs[i->ptrPos] = sraNextSpan(i);
|
||||
|
||||
/* is this a new subspan? */
|
||||
while(i->sPtrs[i->ptrPos]->subspan) {
|
||||
if(i->ptrPos+2 > i->ptrSize) { /* array is too small */
|
||||
i->ptrSize += DEFSTEP;
|
||||
i->sPtrs = (sraSpan**)realloc(i->sPtrs, sizeof(sraSpan*)*i->ptrSize);
|
||||
}
|
||||
i->ptrPos =+ 2;
|
||||
if(sraReverse(i)) {
|
||||
i->sPtrs[i->ptrPos] = i->sPtrs[i->ptrPos-2]->subspan->back._prev;
|
||||
i->sPtrs[i->ptrPos+1] = &(i->sPtrs[i->ptrPos-2]->subspan->front);
|
||||
} else {
|
||||
i->sPtrs[i->ptrPos] = i->sPtrs[i->ptrPos-2]->subspan->front._next;
|
||||
i->sPtrs[i->ptrPos+1] = &(i->sPtrs[i->ptrPos-2]->subspan->back);
|
||||
}
|
||||
}
|
||||
|
||||
if((i->ptrPos%4)!=2) {
|
||||
rfbErr("sraRgnIteratorNext: offset is wrong (%d%%4!=2)\n",i->ptrPos);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
r->y1 = i->sPtrs[i->ptrPos-2]->start;
|
||||
r->y2 = i->sPtrs[i->ptrPos-2]->end;
|
||||
r->x1 = i->sPtrs[i->ptrPos]->start;
|
||||
r->x2 = i->sPtrs[i->ptrPos]->end;
|
||||
|
||||
return(-1);
|
||||
}
|
||||
|
||||
void sraRgnReleaseIterator(sraRectangleIterator* i)
|
||||
{
|
||||
free(i->sPtrs);
|
||||
free(i);
|
||||
}
|
||||
|
||||
void
|
||||
sraRgnPrint(const sraRegion *rgn) {
|
||||
sraSpanListPrint((sraSpanList*)rgn);
|
||||
}
|
||||
|
||||
rfbBool
|
||||
sraClipRect(int *x, int *y, int *w, int *h,
|
||||
int cx, int cy, int cw, int ch) {
|
||||
if (*x < cx) {
|
||||
*w -= (cx-*x);
|
||||
*x = cx;
|
||||
}
|
||||
if (*y < cy) {
|
||||
*h -= (cy-*y);
|
||||
*y = cy;
|
||||
}
|
||||
if (*x+*w > cx+cw) {
|
||||
*w = (cx+cw)-*x;
|
||||
}
|
||||
if (*y+*h > cy+ch) {
|
||||
*h = (cy+ch)-*y;
|
||||
}
|
||||
return (*w>0) && (*h>0);
|
||||
}
|
||||
|
||||
rfbBool
|
||||
sraClipRect2(int *x, int *y, int *x2, int *y2,
|
||||
int cx, int cy, int cx2, int cy2) {
|
||||
if (*x < cx)
|
||||
*x = cx;
|
||||
if (*y < cy)
|
||||
*y = cy;
|
||||
if (*x >= cx2)
|
||||
*x = cx2-1;
|
||||
if (*y >= cy2)
|
||||
*y = cy2-1;
|
||||
if (*x2 <= cx)
|
||||
*x2 = cx+1;
|
||||
if (*y2 <= cy)
|
||||
*y2 = cy+1;
|
||||
if (*x2 > cx2)
|
||||
*x2 = cx2;
|
||||
if (*y2 > cy2)
|
||||
*y2 = cy2;
|
||||
return (*x2>*x) && (*y2>*y);
|
||||
}
|
||||
|
||||
/* test */
|
||||
|
||||
#ifdef SRA_TEST
|
||||
/* pipe the output to sort|uniq -u and you'll get the errors. */
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
sraRegionPtr region, region1, region2;
|
||||
sraRectangleIterator* i;
|
||||
sraRect rect;
|
||||
rfbBool b;
|
||||
|
||||
region = sraRgnCreateRect(10, 10, 600, 300);
|
||||
region1 = sraRgnCreateRect(40, 50, 350, 200);
|
||||
region2 = sraRgnCreateRect(0, 0, 20, 40);
|
||||
|
||||
sraRgnPrint(region);
|
||||
printf("\n[(10-300)[(10-600)]]\n\n");
|
||||
|
||||
b = sraRgnSubtract(region, region1);
|
||||
printf("%s ",b?"true":"false");
|
||||
sraRgnPrint(region);
|
||||
printf("\ntrue [(10-50)[(10-600)](50-200)[(10-40)(350-600)](200-300)[(10-600)]]\n\n");
|
||||
|
||||
sraRgnOr(region, region2);
|
||||
printf("%ld\n6\n\n", sraRgnCountRects(region));
|
||||
|
||||
i = sraRgnGetIterator(region);
|
||||
while(sraRgnIteratorNext(i, &rect))
|
||||
printf("%dx%d+%d+%d ",
|
||||
rect.x2-rect.x1,rect.y2-rect.y1,
|
||||
rect.x1,rect.y1);
|
||||
sraRgnReleaseIterator(i);
|
||||
printf("\n20x10+0+0 600x30+0+10 590x10+10+40 30x150+10+50 250x150+350+50 590x100+10+200 \n\n");
|
||||
|
||||
i = sraRgnGetReverseIterator(region,1,0);
|
||||
while(sraRgnIteratorNext(i, &rect))
|
||||
printf("%dx%d+%d+%d ",
|
||||
rect.x2-rect.x1,rect.y2-rect.y1,
|
||||
rect.x1,rect.y1);
|
||||
sraRgnReleaseIterator(i);
|
||||
printf("\n20x10+0+0 600x30+0+10 590x10+10+40 250x150+350+50 30x150+10+50 590x100+10+200 \n\n");
|
||||
|
||||
i = sraRgnGetReverseIterator(region,1,1);
|
||||
while(sraRgnIteratorNext(i, &rect))
|
||||
printf("%dx%d+%d+%d ",
|
||||
rect.x2-rect.x1,rect.y2-rect.y1,
|
||||
rect.x1,rect.y1);
|
||||
sraRgnReleaseIterator(i);
|
||||
printf("\n590x100+10+200 250x150+350+50 30x150+10+50 590x10+10+40 600x30+0+10 20x10+0+0 \n\n");
|
||||
|
||||
sraRgnDestroy(region);
|
||||
sraRgnDestroy(region1);
|
||||
sraRgnDestroy(region2);
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
3326
libvncserver/rfbserver.c
Normal file
3326
libvncserver/rfbserver.c
Normal file
File diff suppressed because it is too large
Load Diff
309
libvncserver/rre.c
Normal file
309
libvncserver/rre.c
Normal file
@@ -0,0 +1,309 @@
|
||||
/*
|
||||
* rre.c
|
||||
*
|
||||
* Routines to implement Rise-and-Run-length Encoding (RRE). This
|
||||
* code is based on krw's original javatel rfbserver.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
/*
|
||||
* cl->beforeEncBuf contains pixel data in the client's format.
|
||||
* cl->afterEncBuf contains the RRE encoded version. If the RRE encoded version is
|
||||
* larger than the raw data or if it exceeds cl->afterEncBufSize then
|
||||
* raw encoding is used instead.
|
||||
*/
|
||||
|
||||
static int subrectEncode8(rfbClientPtr cl, uint8_t *data, int w, int h);
|
||||
static int subrectEncode16(rfbClientPtr cl, uint16_t *data, int w, int h);
|
||||
static int subrectEncode32(rfbClientPtr cl, uint32_t *data, int w, int h);
|
||||
static uint32_t getBgColour(char *data, int size, int bpp);
|
||||
|
||||
|
||||
/*
|
||||
* rfbSendRectEncodingRRE - send a given rectangle using RRE encoding.
|
||||
*/
|
||||
|
||||
rfbBool
|
||||
rfbSendRectEncodingRRE(rfbClientPtr cl,
|
||||
int x,
|
||||
int y,
|
||||
int w,
|
||||
int h)
|
||||
{
|
||||
rfbFramebufferUpdateRectHeader rect;
|
||||
rfbRREHeader hdr;
|
||||
int nSubrects;
|
||||
int i;
|
||||
char *fbptr = (cl->scaledScreen->frameBuffer + (cl->scaledScreen->paddedWidthInBytes * y)
|
||||
+ (x * (cl->scaledScreen->bitsPerPixel / 8)));
|
||||
|
||||
int maxRawSize = (cl->scaledScreen->width * cl->scaledScreen->height
|
||||
* (cl->format.bitsPerPixel / 8));
|
||||
|
||||
if (cl->beforeEncBufSize < maxRawSize) {
|
||||
cl->beforeEncBufSize = maxRawSize;
|
||||
if (cl->beforeEncBuf == NULL)
|
||||
cl->beforeEncBuf = (char *)malloc(cl->beforeEncBufSize);
|
||||
else
|
||||
cl->beforeEncBuf = (char *)realloc(cl->beforeEncBuf, cl->beforeEncBufSize);
|
||||
}
|
||||
|
||||
if (cl->afterEncBufSize < maxRawSize) {
|
||||
cl->afterEncBufSize = maxRawSize;
|
||||
if (cl->afterEncBuf == NULL)
|
||||
cl->afterEncBuf = (char *)malloc(cl->afterEncBufSize);
|
||||
else
|
||||
cl->afterEncBuf = (char *)realloc(cl->afterEncBuf, cl->afterEncBufSize);
|
||||
}
|
||||
|
||||
(*cl->translateFn)(cl->translateLookupTable,
|
||||
&(cl->screen->serverFormat),
|
||||
&cl->format, fbptr, cl->beforeEncBuf,
|
||||
cl->scaledScreen->paddedWidthInBytes, w, h);
|
||||
|
||||
switch (cl->format.bitsPerPixel) {
|
||||
case 8:
|
||||
nSubrects = subrectEncode8(cl, (uint8_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
case 16:
|
||||
nSubrects = subrectEncode16(cl, (uint16_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
case 32:
|
||||
nSubrects = subrectEncode32(cl, (uint32_t *)cl->beforeEncBuf, w, h);
|
||||
break;
|
||||
default:
|
||||
rfbLog("getBgColour: bpp %d?\n",cl->format.bitsPerPixel);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (nSubrects < 0) {
|
||||
|
||||
/* RRE encoding was too large, use raw */
|
||||
|
||||
return rfbSendRectEncodingRaw(cl, x, y, w, h);
|
||||
}
|
||||
|
||||
rfbStatRecordEncodingSent(cl, rfbEncodingRRE,
|
||||
sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader + cl->afterEncBufLen,
|
||||
sz_rfbFramebufferUpdateRectHeader + w * h * (cl->format.bitsPerPixel / 8));
|
||||
|
||||
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader + sz_rfbRREHeader
|
||||
> UPDATE_BUF_SIZE)
|
||||
{
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
rect.r.x = Swap16IfLE(x);
|
||||
rect.r.y = Swap16IfLE(y);
|
||||
rect.r.w = Swap16IfLE(w);
|
||||
rect.r.h = Swap16IfLE(h);
|
||||
rect.encoding = Swap32IfLE(rfbEncodingRRE);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
|
||||
sz_rfbFramebufferUpdateRectHeader);
|
||||
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
|
||||
|
||||
hdr.nSubrects = Swap32IfLE(nSubrects);
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], (char *)&hdr, sz_rfbRREHeader);
|
||||
cl->ublen += sz_rfbRREHeader;
|
||||
|
||||
for (i = 0; i < cl->afterEncBufLen;) {
|
||||
|
||||
int bytesToCopy = UPDATE_BUF_SIZE - cl->ublen;
|
||||
|
||||
if (i + bytesToCopy > cl->afterEncBufLen) {
|
||||
bytesToCopy = cl->afterEncBufLen - i;
|
||||
}
|
||||
|
||||
memcpy(&cl->updateBuf[cl->ublen], &cl->afterEncBuf[i], bytesToCopy);
|
||||
|
||||
cl->ublen += bytesToCopy;
|
||||
i += bytesToCopy;
|
||||
|
||||
if (cl->ublen == UPDATE_BUF_SIZE) {
|
||||
if (!rfbSendUpdateBuf(cl))
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* subrectEncode() encodes the given multicoloured rectangle as a background
|
||||
* colour overwritten by single-coloured rectangles. It returns the number
|
||||
* of subrectangles in the encoded buffer, or -1 if subrect encoding won't
|
||||
* fit in the buffer. It puts the encoded rectangles in cl->afterEncBuf. The
|
||||
* single-colour rectangle partition is not optimal, but does find the biggest
|
||||
* horizontal or vertical rectangle top-left anchored to each consecutive
|
||||
* coordinate position.
|
||||
*
|
||||
* The coding scheme is simply [<bgcolour><subrect><subrect>...] where each
|
||||
* <subrect> is [<colour><x><y><w><h>].
|
||||
*/
|
||||
|
||||
#define DEFINE_SUBRECT_ENCODE(bpp) \
|
||||
static int \
|
||||
subrectEncode##bpp(rfbClientPtr client, uint##bpp##_t *data, int w, int h) { \
|
||||
uint##bpp##_t cl; \
|
||||
rfbRectangle subrect; \
|
||||
int x,y; \
|
||||
int i,j; \
|
||||
int hx=0,hy,vx=0,vy; \
|
||||
int hyflag; \
|
||||
uint##bpp##_t *seg; \
|
||||
uint##bpp##_t *line; \
|
||||
int hw,hh,vw,vh; \
|
||||
int thex,they,thew,theh; \
|
||||
int numsubs = 0; \
|
||||
int newLen; \
|
||||
uint##bpp##_t bg = (uint##bpp##_t)getBgColour((char*)data,w*h,bpp); \
|
||||
\
|
||||
*((uint##bpp##_t*)client->afterEncBuf) = bg; \
|
||||
\
|
||||
client->afterEncBufLen = (bpp/8); \
|
||||
\
|
||||
for (y=0; y<h; y++) { \
|
||||
line = data+(y*w); \
|
||||
for (x=0; x<w; x++) { \
|
||||
if (line[x] != bg) { \
|
||||
cl = line[x]; \
|
||||
hy = y-1; \
|
||||
hyflag = 1; \
|
||||
for (j=y; j<h; j++) { \
|
||||
seg = data+(j*w); \
|
||||
if (seg[x] != cl) {break;} \
|
||||
i = x; \
|
||||
while ((seg[i] == cl) && (i < w)) i += 1; \
|
||||
i -= 1; \
|
||||
if (j == y) vx = hx = i; \
|
||||
if (i < vx) vx = i; \
|
||||
if ((hyflag > 0) && (i >= hx)) {hy += 1;} else {hyflag = 0;} \
|
||||
} \
|
||||
vy = j-1; \
|
||||
\
|
||||
/* We now have two possible subrects: (x,y,hx,hy) and (x,y,vx,vy) \
|
||||
* We'll choose the bigger of the two. \
|
||||
*/ \
|
||||
hw = hx-x+1; \
|
||||
hh = hy-y+1; \
|
||||
vw = vx-x+1; \
|
||||
vh = vy-y+1; \
|
||||
\
|
||||
thex = x; \
|
||||
they = y; \
|
||||
\
|
||||
if ((hw*hh) > (vw*vh)) { \
|
||||
thew = hw; \
|
||||
theh = hh; \
|
||||
} else { \
|
||||
thew = vw; \
|
||||
theh = vh; \
|
||||
} \
|
||||
\
|
||||
subrect.x = Swap16IfLE(thex); \
|
||||
subrect.y = Swap16IfLE(they); \
|
||||
subrect.w = Swap16IfLE(thew); \
|
||||
subrect.h = Swap16IfLE(theh); \
|
||||
\
|
||||
newLen = client->afterEncBufLen + (bpp/8) + sz_rfbRectangle; \
|
||||
if ((newLen > (w * h * (bpp/8))) || (newLen > client->afterEncBufSize)) \
|
||||
return -1; \
|
||||
\
|
||||
numsubs += 1; \
|
||||
*((uint##bpp##_t*)(client->afterEncBuf + client->afterEncBufLen)) = cl; \
|
||||
client->afterEncBufLen += (bpp/8); \
|
||||
memcpy(&client->afterEncBuf[client->afterEncBufLen],&subrect,sz_rfbRectangle); \
|
||||
client->afterEncBufLen += sz_rfbRectangle; \
|
||||
\
|
||||
/* \
|
||||
* Now mark the subrect as done. \
|
||||
*/ \
|
||||
for (j=they; j < (they+theh); j++) { \
|
||||
for (i=thex; i < (thex+thew); i++) { \
|
||||
data[j*w+i] = bg; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
return numsubs; \
|
||||
}
|
||||
|
||||
DEFINE_SUBRECT_ENCODE(8)
|
||||
DEFINE_SUBRECT_ENCODE(16)
|
||||
DEFINE_SUBRECT_ENCODE(32)
|
||||
|
||||
|
||||
/*
|
||||
* getBgColour() gets the most prevalent colour in a byte array.
|
||||
*/
|
||||
static uint32_t
|
||||
getBgColour(char *data, int size, int bpp)
|
||||
{
|
||||
|
||||
#define NUMCLRS 256
|
||||
|
||||
static int counts[NUMCLRS];
|
||||
int i,j,k;
|
||||
|
||||
int maxcount = 0;
|
||||
uint8_t maxclr = 0;
|
||||
|
||||
if (bpp != 8) {
|
||||
if (bpp == 16) {
|
||||
return ((uint16_t *)data)[0];
|
||||
} else if (bpp == 32) {
|
||||
return ((uint32_t *)data)[0];
|
||||
} else {
|
||||
rfbLog("getBgColour: bpp %d?\n",bpp);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<NUMCLRS; i++) {
|
||||
counts[i] = 0;
|
||||
}
|
||||
|
||||
for (j=0; j<size; j++) {
|
||||
k = (int)(((uint8_t *)data)[j]);
|
||||
if (k >= NUMCLRS) {
|
||||
rfbErr("getBgColour: unusual colour = %d\n", k);
|
||||
return 0;
|
||||
}
|
||||
counts[k] += 1;
|
||||
if (counts[k] > maxcount) {
|
||||
maxcount = counts[k];
|
||||
maxclr = ((uint8_t *)data)[j];
|
||||
}
|
||||
}
|
||||
|
||||
return maxclr;
|
||||
}
|
||||
416
libvncserver/scale.c
Normal file
416
libvncserver/scale.c
Normal file
@@ -0,0 +1,416 @@
|
||||
/*
|
||||
* scale.c - deal with server-side scaling.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
|
||||
* Copyright (C) 2002 RealVNC Ltd.
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#ifdef __STRICT_ANSI__
|
||||
#define _BSD_SOURCE
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "rfb/rfb.h"
|
||||
#include "rfb/rfbregion.h"
|
||||
#include "private.h"
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define write(sock,buf,len) send(sock,buf,len,0)
|
||||
#else
|
||||
#ifdef LIBVNCSERVER_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <pwd.h>
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGPROTO
|
||||
#undef DEBUGPROTO
|
||||
#define DEBUGPROTO(x) x
|
||||
#else
|
||||
#define DEBUGPROTO(x)
|
||||
#endif
|
||||
|
||||
/****************************/
|
||||
#define CEIL(x) ( (double) ((int) (x)) == (x) ? \
|
||||
(double) ((int) (x)) : (double) ((int) (x) + 1) )
|
||||
#define FLOOR(x) ( (double) ((int) (x)) )
|
||||
|
||||
|
||||
int ScaleX(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int x)
|
||||
{
|
||||
if ((from==to) || (from==NULL) || (to==NULL)) return x;
|
||||
return ((int)(((double) x / (double)from->width) * (double)to->width ));
|
||||
}
|
||||
|
||||
int ScaleY(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int y)
|
||||
{
|
||||
if ((from==to) || (from==NULL) || (to==NULL)) return y;
|
||||
return ((int)(((double) y / (double)from->height) * (double)to->height ));
|
||||
}
|
||||
|
||||
/* So, all of the encodings point to the ->screen->frameBuffer,
|
||||
* We need to change this!
|
||||
*/
|
||||
void rfbScaledCorrection(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int *x, int *y, int *w, int *h, const char *function)
|
||||
{
|
||||
double x1,y1,w1,h1, x2, y2, w2, h2;
|
||||
double scaleW = ((double) to->width) / ((double) from->width);
|
||||
double scaleH = ((double) to->height) / ((double) from->height);
|
||||
|
||||
|
||||
/*
|
||||
* rfbLog("rfbScaledCorrection(%p -> %p, %dx%d->%dx%d (%dXx%dY-%dWx%dH)\n",
|
||||
* from, to, from->width, from->height, to->width, to->height, *x, *y, *w, *h);
|
||||
*/
|
||||
|
||||
/* If it's the original framebuffer... */
|
||||
if (from==to) return;
|
||||
|
||||
x1 = ((double) *x) * scaleW;
|
||||
y1 = ((double) *y) * scaleH;
|
||||
w1 = ((double) *w) * scaleW;
|
||||
h1 = ((double) *h) * scaleH;
|
||||
|
||||
|
||||
/*cast from double to int is same as "*x = floor(x1);" */
|
||||
x2 = FLOOR(x1);
|
||||
y2 = FLOOR(y1);
|
||||
|
||||
/* include into W and H the jitter of scaling X and Y */
|
||||
w2 = CEIL(w1 + ( x1 - x2 ));
|
||||
h2 = CEIL(h1 + ( y1 - y2 ));
|
||||
|
||||
/*
|
||||
* rfbLog("%s (%dXx%dY-%dWx%dH -> %fXx%fY-%fWx%fH) {%dWx%dH -> %dWx%dH}\n",
|
||||
* function, *x, *y, *w, *h, x2, y2, w2, h2,
|
||||
* from->width, from->height, to->width, to->height);
|
||||
*/
|
||||
|
||||
/* simulate ceil() without math library */
|
||||
*x = (int)x2;
|
||||
*y = (int)y2;
|
||||
*w = (int)w2;
|
||||
*h = (int)h2;
|
||||
|
||||
/* Small changes for a thumbnail may be scaled to zero */
|
||||
if (*w==0) (*w)++;
|
||||
if (*h==0) (*h)++;
|
||||
/* scaling from small to big may overstep the size a bit */
|
||||
if (*x+*w > to->width) *w=to->width - *x;
|
||||
if (*y+*h > to->height) *h=to->height - *y;
|
||||
}
|
||||
|
||||
void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0)
|
||||
{
|
||||
int x,y,w,v,z;
|
||||
int x1, y1, w1, h1;
|
||||
int bitsPerPixel, bytesPerPixel, bytesPerLine, areaX, areaY, area2;
|
||||
unsigned char *srcptr, *dstptr;
|
||||
|
||||
/* Nothing to do!!! */
|
||||
if (screen==ptr) return;
|
||||
|
||||
x1 = x0;
|
||||
y1 = y0;
|
||||
w1 = w0;
|
||||
h1 = h0;
|
||||
|
||||
rfbScaledCorrection(screen, ptr, &x1, &y1, &w1, &h1, "rfbScaledScreenUpdateRect");
|
||||
x0 = ScaleX(ptr, screen, x1);
|
||||
y0 = ScaleY(ptr, screen, y1);
|
||||
w0 = ScaleX(ptr, screen, w1);
|
||||
h0 = ScaleY(ptr, screen, h1);
|
||||
|
||||
bitsPerPixel = screen->bitsPerPixel;
|
||||
bytesPerPixel = bitsPerPixel / 8;
|
||||
bytesPerLine = w1 * bytesPerPixel;
|
||||
srcptr = (unsigned char *)(screen->frameBuffer +
|
||||
(y0 * screen->paddedWidthInBytes + x0 * bytesPerPixel));
|
||||
dstptr = (unsigned char *)(ptr->frameBuffer +
|
||||
( y1 * ptr->paddedWidthInBytes + x1 * bytesPerPixel));
|
||||
/* The area of the source framebuffer for each destination pixel */
|
||||
areaX = ScaleX(ptr,screen,1);
|
||||
areaY = ScaleY(ptr,screen,1);
|
||||
area2 = areaX*areaY;
|
||||
|
||||
|
||||
/* Ensure that we do not go out of bounds */
|
||||
if ((x1+w1) > (ptr->width))
|
||||
{
|
||||
if (x1==0) w1=ptr->width; else x1 = ptr->width - w1;
|
||||
}
|
||||
if ((y1+h1) > (ptr->height))
|
||||
{
|
||||
if (y1==0) h1=ptr->height; else y1 = ptr->height - h1;
|
||||
}
|
||||
/*
|
||||
* rfbLog("rfbScaledScreenUpdateRect(%dXx%dY-%dWx%dH -> %dXx%dY-%dWx%dH <%dx%d>) {%dWx%dH -> %dWx%dH} 0x%p\n",
|
||||
* x0, y0, w0, h0, x1, y1, w1, h1, areaX, areaY,
|
||||
* screen->width, screen->height, ptr->width, ptr->height, ptr->frameBuffer);
|
||||
*/
|
||||
|
||||
if (screen->serverFormat.trueColour) { /* Blend neighbouring pixels together */
|
||||
unsigned char *srcptr2;
|
||||
unsigned long pixel_value, red, green, blue;
|
||||
unsigned int redShift = screen->serverFormat.redShift;
|
||||
unsigned int greenShift = screen->serverFormat.greenShift;
|
||||
unsigned int blueShift = screen->serverFormat.blueShift;
|
||||
unsigned long redMax = screen->serverFormat.redMax;
|
||||
unsigned long greenMax = screen->serverFormat.greenMax;
|
||||
unsigned long blueMax = screen->serverFormat.blueMax;
|
||||
|
||||
/* for each *destination* pixel... */
|
||||
for (y = 0; y < h1; y++) {
|
||||
for (x = 0; x < w1; x++) {
|
||||
red = green = blue = 0;
|
||||
/* Get the totals for rgb from the source grid... */
|
||||
for (w = 0; w < areaX; w++) {
|
||||
for (v = 0; v < areaY; v++) {
|
||||
srcptr2 = &srcptr[(((x * areaX) + w) * bytesPerPixel) +
|
||||
(v * screen->paddedWidthInBytes)];
|
||||
pixel_value = 0;
|
||||
|
||||
|
||||
switch (bytesPerPixel) {
|
||||
case 4: pixel_value = *((unsigned int *)srcptr2); break;
|
||||
case 2: pixel_value = *((unsigned short *)srcptr2); break;
|
||||
case 1: pixel_value = *((unsigned char *)srcptr2); break;
|
||||
default:
|
||||
/* fixme: endianess problem? */
|
||||
for (z = 0; z < bytesPerPixel; z++)
|
||||
pixel_value += (srcptr2[z] << (8 * z));
|
||||
break;
|
||||
}
|
||||
/*
|
||||
srcptr2 += bytesPerPixel;
|
||||
*/
|
||||
|
||||
red += ((pixel_value >> redShift) & redMax);
|
||||
green += ((pixel_value >> greenShift) & greenMax);
|
||||
blue += ((pixel_value >> blueShift) & blueMax);
|
||||
|
||||
}
|
||||
}
|
||||
/* We now have a total for all of the colors, find the average! */
|
||||
red /= area2;
|
||||
green /= area2;
|
||||
blue /= area2;
|
||||
/* Stuff the new value back into memory */
|
||||
pixel_value = ((red & redMax) << redShift) | ((green & greenMax) << greenShift) | ((blue & blueMax) << blueShift);
|
||||
|
||||
switch (bytesPerPixel) {
|
||||
case 4: *((unsigned int *)dstptr) = (unsigned int) pixel_value; break;
|
||||
case 2: *((unsigned short *)dstptr) = (unsigned short) pixel_value; break;
|
||||
case 1: *((unsigned char *)dstptr) = (unsigned char) pixel_value; break;
|
||||
default:
|
||||
/* fixme: endianess problem? */
|
||||
for (z = 0; z < bytesPerPixel; z++)
|
||||
dstptr[z]=(pixel_value >> (8 * z)) & 0xff;
|
||||
break;
|
||||
}
|
||||
dstptr += bytesPerPixel;
|
||||
}
|
||||
srcptr += (screen->paddedWidthInBytes * areaY);
|
||||
dstptr += (ptr->paddedWidthInBytes - bytesPerLine);
|
||||
}
|
||||
} else
|
||||
{ /* Not truecolour, so we can't blend. Just use the top-left pixel instead */
|
||||
for (y = y1; y < (y1+h1); y++) {
|
||||
for (x = x1; x < (x1+w1); x++)
|
||||
memcpy (&ptr->frameBuffer[(y *ptr->paddedWidthInBytes) + (x * bytesPerPixel)],
|
||||
&screen->frameBuffer[(y * areaY * screen->paddedWidthInBytes) + (x *areaX * bytesPerPixel)], bytesPerPixel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rfbScaledScreenUpdate(rfbScreenInfoPtr screen, int x1, int y1, int x2, int y2)
|
||||
{
|
||||
/* ok, now the task is to update each and every scaled version of the framebuffer
|
||||
* and we only have to do this for this specific changed rectangle!
|
||||
*/
|
||||
rfbScreenInfoPtr ptr;
|
||||
int count=0;
|
||||
|
||||
/* We don't point to cl->screen as it is the original */
|
||||
for (ptr=screen->scaledScreenNext;ptr!=NULL;ptr=ptr->scaledScreenNext)
|
||||
{
|
||||
/* Only update if it has active clients... */
|
||||
if (ptr->scaledScreenRefCount>0)
|
||||
{
|
||||
rfbScaledScreenUpdateRect(screen, ptr, x1, y1, x2-x1, y2-y1);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Create a new scaled version of the framebuffer */
|
||||
rfbScreenInfoPtr rfbScaledScreenAllocate(rfbClientPtr cl, int width, int height)
|
||||
{
|
||||
rfbScreenInfoPtr ptr;
|
||||
ptr = malloc(sizeof(rfbScreenInfo));
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
/* copy *everything* (we don't use most of it, but just in case) */
|
||||
memcpy(ptr, cl->screen, sizeof(rfbScreenInfo));
|
||||
ptr->width = width;
|
||||
ptr->height = height;
|
||||
ptr->paddedWidthInBytes = (ptr->bitsPerPixel/8)*ptr->width;
|
||||
|
||||
/* Need to by multiples of 4 for Sparc systems */
|
||||
ptr->paddedWidthInBytes += (ptr->paddedWidthInBytes % 4);
|
||||
|
||||
/* Reset the reference count to 0! */
|
||||
ptr->scaledScreenRefCount = 0;
|
||||
|
||||
ptr->sizeInBytes = ptr->paddedWidthInBytes * ptr->height;
|
||||
ptr->serverFormat = cl->screen->serverFormat;
|
||||
|
||||
ptr->frameBuffer = malloc(ptr->sizeInBytes);
|
||||
if (ptr->frameBuffer!=NULL)
|
||||
{
|
||||
/* Reset to a known condition: scale the entire framebuffer */
|
||||
rfbScaledScreenUpdateRect(cl->screen, ptr, 0, 0, cl->screen->width, cl->screen->height);
|
||||
/* Now, insert into the chain */
|
||||
LOCK(cl->updateMutex);
|
||||
ptr->scaledScreenNext = cl->screen->scaledScreenNext;
|
||||
cl->screen->scaledScreenNext = ptr;
|
||||
UNLOCK(cl->updateMutex);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Failed to malloc the new frameBuffer, cleanup */
|
||||
free(ptr);
|
||||
ptr=NULL;
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Find an active scaled version of the framebuffer
|
||||
* TODO: implement a refcount per scaled screen to prevent
|
||||
* unreferenced scaled screens from hanging around
|
||||
*/
|
||||
rfbScreenInfoPtr rfbScalingFind(rfbClientPtr cl, int width, int height)
|
||||
{
|
||||
rfbScreenInfoPtr ptr;
|
||||
/* include the original in the search (ie: fine 1:1 scaled version of the frameBuffer) */
|
||||
for (ptr=cl->screen; ptr!=NULL; ptr=ptr->scaledScreenNext)
|
||||
{
|
||||
if ((ptr->width==width) && (ptr->height==height))
|
||||
return ptr;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Future needs "scale to 320x240, as that's the client's screen size */
|
||||
void rfbScalingSetup(rfbClientPtr cl, int width, int height)
|
||||
{
|
||||
rfbScreenInfoPtr ptr;
|
||||
|
||||
ptr = rfbScalingFind(cl,width,height);
|
||||
if (ptr==NULL)
|
||||
ptr = rfbScaledScreenAllocate(cl,width,height);
|
||||
/* Now, there is a new screen available (if ptr is not NULL) */
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
/* Update it! */
|
||||
if (ptr->scaledScreenRefCount<1)
|
||||
rfbScaledScreenUpdateRect(cl->screen, ptr, 0, 0, cl->screen->width, cl->screen->height);
|
||||
/*
|
||||
* rfbLog("Taking one from %dx%d-%d and adding it to %dx%d-%d\n",
|
||||
* cl->scaledScreen->width, cl->scaledScreen->height,
|
||||
* cl->scaledScreen->scaledScreenRefCount,
|
||||
* ptr->width, ptr->height, ptr->scaledScreenRefCount);
|
||||
*/
|
||||
|
||||
LOCK(cl->updateMutex);
|
||||
cl->scaledScreen->scaledScreenRefCount--;
|
||||
ptr->scaledScreenRefCount++;
|
||||
cl->scaledScreen=ptr;
|
||||
cl->newFBSizePending = TRUE;
|
||||
UNLOCK(cl->updateMutex);
|
||||
|
||||
rfbLog("Scaling to %dx%d (refcount=%d)\n",width,height,ptr->scaledScreenRefCount);
|
||||
}
|
||||
else
|
||||
rfbLog("Scaling to %dx%d failed, leaving things alone\n",width,height);
|
||||
}
|
||||
|
||||
int rfbSendNewScaleSize(rfbClientPtr cl)
|
||||
{
|
||||
/* if the client supports newFBsize Encoding, use it */
|
||||
if (cl->useNewFBSize && cl->newFBSizePending)
|
||||
return FALSE;
|
||||
|
||||
LOCK(cl->updateMutex);
|
||||
cl->newFBSizePending = FALSE;
|
||||
UNLOCK(cl->updateMutex);
|
||||
|
||||
if (cl->PalmVNC==TRUE)
|
||||
{
|
||||
rfbPalmVNCReSizeFrameBufferMsg pmsg;
|
||||
pmsg.type = rfbPalmVNCReSizeFrameBuffer;
|
||||
pmsg.pad1 = 0;
|
||||
pmsg.desktop_w = Swap16IfLE(cl->screen->width);
|
||||
pmsg.desktop_h = Swap16IfLE(cl->screen->height);
|
||||
pmsg.buffer_w = Swap16IfLE(cl->scaledScreen->width);
|
||||
pmsg.buffer_h = Swap16IfLE(cl->scaledScreen->height);
|
||||
pmsg.pad2 = 0;
|
||||
|
||||
rfbLog("Sending a response to a PalmVNC style frameuffer resize event (%dx%d)\n", cl->scaledScreen->width, cl->scaledScreen->height);
|
||||
if (rfbWriteExact(cl, (char *)&pmsg, sz_rfbPalmVNCReSizeFrameBufferMsg) < 0) {
|
||||
rfbLogPerror("rfbNewClient: write");
|
||||
rfbCloseClient(cl);
|
||||
rfbClientConnectionGone(cl);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rfbResizeFrameBufferMsg rmsg;
|
||||
rmsg.type = rfbResizeFrameBuffer;
|
||||
rmsg.pad1=0;
|
||||
rmsg.framebufferWidth = Swap16IfLE(cl->scaledScreen->width);
|
||||
rmsg.framebufferHeigth = Swap16IfLE(cl->scaledScreen->height);
|
||||
rfbLog("Sending a response to a UltraVNC style frameuffer resize event (%dx%d)\n", cl->scaledScreen->width, cl->scaledScreen->height);
|
||||
if (rfbWriteExact(cl, (char *)&rmsg, sz_rfbResizeFrameBufferMsg) < 0) {
|
||||
rfbLogPerror("rfbNewClient: write");
|
||||
rfbCloseClient(cl);
|
||||
rfbClientConnectionGone(cl);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
/****************************/
|
||||
10
libvncserver/scale.h
Normal file
10
libvncserver/scale.h
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
int ScaleX(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int x);
|
||||
int ScaleY(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int y);
|
||||
void rfbScaledCorrection(rfbScreenInfoPtr from, rfbScreenInfoPtr to, int *x, int *y, int *w, int *h, const char *function);
|
||||
void rfbScaledScreenUpdateRect(rfbScreenInfoPtr screen, rfbScreenInfoPtr ptr, int x0, int y0, int w0, int h0);
|
||||
void rfbScaledScreenUpdate(rfbScreenInfoPtr screen, int x1, int y1, int x2, int y2);
|
||||
rfbScreenInfoPtr rfbScaledScreenAllocate(rfbClientPtr cl, int width, int height);
|
||||
rfbScreenInfoPtr rfbScalingFind(rfbClientPtr cl, int width, int height);
|
||||
void rfbScalingSetup(rfbClientPtr cl, int width, int height);
|
||||
int rfbSendNewScaleSize(rfbClientPtr cl);
|
||||
300
libvncserver/selbox.c
Normal file
300
libvncserver/selbox.c
Normal file
@@ -0,0 +1,300 @@
|
||||
#include <ctype.h>
|
||||
#include "rfb/rfb.h"
|
||||
#include "rfb/keysym.h"
|
||||
|
||||
typedef struct {
|
||||
rfbScreenInfoPtr screen;
|
||||
rfbFontDataPtr font;
|
||||
char** list;
|
||||
int listSize;
|
||||
int selected;
|
||||
int displayStart;
|
||||
int x1,y1,x2,y2,textH,pageH;
|
||||
int xhot,yhot;
|
||||
int buttonWidth,okBX,cancelBX,okX,cancelX,okY;
|
||||
rfbBool okInverted,cancelInverted;
|
||||
int lastButtons;
|
||||
rfbPixel colour,backColour;
|
||||
SelectionChangedHookPtr selChangedHook;
|
||||
enum { SELECTING, OK, CANCEL } state;
|
||||
} rfbSelectData;
|
||||
|
||||
static const char* okStr="OK";
|
||||
static const char* cancelStr="Cancel";
|
||||
|
||||
static void selPaintButtons(rfbSelectData* m,rfbBool invertOk,rfbBool invertCancel)
|
||||
{
|
||||
rfbScreenInfoPtr s = m->screen;
|
||||
rfbPixel bcolour = m->backColour;
|
||||
rfbPixel colour = m->colour;
|
||||
|
||||
rfbFillRect(s,m->x1,m->okY-m->textH,m->x2,m->okY,bcolour);
|
||||
|
||||
if(invertOk) {
|
||||
rfbFillRect(s,m->okBX,m->okY-m->textH,m->okBX+m->buttonWidth,m->okY,colour);
|
||||
rfbDrawStringWithClip(s,m->font,m->okX+m->xhot,m->okY-1+m->yhot,okStr,
|
||||
m->x1,m->okY-m->textH,m->x2,m->okY,
|
||||
bcolour,colour);
|
||||
} else
|
||||
rfbDrawString(s,m->font,m->okX+m->xhot,m->okY-1+m->yhot,okStr,colour);
|
||||
|
||||
if(invertCancel) {
|
||||
rfbFillRect(s,m->cancelBX,m->okY-m->textH,
|
||||
m->cancelBX+m->buttonWidth,m->okY,colour);
|
||||
rfbDrawStringWithClip(s,m->font,m->cancelX+m->xhot,m->okY-1+m->yhot,
|
||||
cancelStr,m->x1,m->okY-m->textH,m->x2,m->okY,
|
||||
bcolour,colour);
|
||||
} else
|
||||
rfbDrawString(s,m->font,m->cancelX+m->xhot,m->okY-1+m->yhot,cancelStr,colour);
|
||||
|
||||
m->okInverted = invertOk;
|
||||
m->cancelInverted = invertCancel;
|
||||
}
|
||||
|
||||
/* line is relative to displayStart */
|
||||
static void selPaintLine(rfbSelectData* m,int line,rfbBool invert)
|
||||
{
|
||||
int y1 = m->y1+line*m->textH, y2 = y1+m->textH;
|
||||
if(y2>m->y2)
|
||||
y2=m->y2;
|
||||
rfbFillRect(m->screen,m->x1,y1,m->x2,y2,invert?m->colour:m->backColour);
|
||||
if(m->displayStart+line<m->listSize)
|
||||
rfbDrawStringWithClip(m->screen,m->font,m->x1+m->xhot,y2-1+m->yhot,
|
||||
m->list[m->displayStart+line],
|
||||
m->x1,y1,m->x2,y2,
|
||||
invert?m->backColour:m->colour,
|
||||
invert?m->backColour:m->colour);
|
||||
}
|
||||
|
||||
static void selSelect(rfbSelectData* m,int _index)
|
||||
{
|
||||
int delta;
|
||||
|
||||
if(_index==m->selected || _index<0 || _index>=m->listSize)
|
||||
return;
|
||||
|
||||
if(m->selected>=0)
|
||||
selPaintLine(m,m->selected-m->displayStart,FALSE);
|
||||
|
||||
if(_index<m->displayStart || _index>=m->displayStart+m->pageH) {
|
||||
/* targetLine is the screen line in which the selected line will
|
||||
be displayed.
|
||||
targetLine = m->pageH/2 doesn't look so nice */
|
||||
int targetLine = m->selected-m->displayStart;
|
||||
int lineStart,lineEnd;
|
||||
|
||||
/* scroll */
|
||||
if(_index<targetLine)
|
||||
targetLine = _index;
|
||||
else if(_index+m->pageH-targetLine>=m->listSize)
|
||||
targetLine = _index+m->pageH-m->listSize;
|
||||
delta = _index-(m->displayStart+targetLine);
|
||||
|
||||
if(delta>-m->pageH && delta<m->pageH) {
|
||||
if(delta>0) {
|
||||
lineStart = m->pageH-delta;
|
||||
lineEnd = m->pageH;
|
||||
rfbDoCopyRect(m->screen,m->x1,m->y1,m->x2,m->y1+lineStart*m->textH,
|
||||
0,-delta*m->textH);
|
||||
} else {
|
||||
lineStart = 0;
|
||||
lineEnd = -delta;
|
||||
rfbDoCopyRect(m->screen,
|
||||
m->x1,m->y1+lineEnd*m->textH,m->x2,m->y2,
|
||||
0,-delta*m->textH);
|
||||
}
|
||||
} else {
|
||||
lineStart = 0;
|
||||
lineEnd = m->pageH;
|
||||
}
|
||||
m->displayStart += delta;
|
||||
for(delta=lineStart;delta<lineEnd;delta++)
|
||||
if(delta!=_index)
|
||||
selPaintLine(m,delta,FALSE);
|
||||
}
|
||||
|
||||
m->selected = _index;
|
||||
selPaintLine(m,m->selected-m->displayStart,TRUE);
|
||||
|
||||
if(m->selChangedHook)
|
||||
m->selChangedHook(_index);
|
||||
|
||||
/* todo: scrollbars */
|
||||
}
|
||||
|
||||
static void selKbdAddEvent(rfbBool down,rfbKeySym keySym,rfbClientPtr cl)
|
||||
{
|
||||
if(down) {
|
||||
if(keySym>' ' && keySym<0xff) {
|
||||
int i;
|
||||
rfbSelectData* m = (rfbSelectData*)cl->screen->screenData;
|
||||
char c = tolower(keySym);
|
||||
|
||||
for(i=m->selected+1;m->list[i] && tolower(m->list[i][0])!=c;i++);
|
||||
if(!m->list[i])
|
||||
for(i=0;i<m->selected && tolower(m->list[i][0])!=c;i++);
|
||||
selSelect(m,i);
|
||||
} else if(keySym==XK_Escape) {
|
||||
rfbSelectData* m = (rfbSelectData*)cl->screen->screenData;
|
||||
m->state = CANCEL;
|
||||
} else if(keySym==XK_Return) {
|
||||
rfbSelectData* m = (rfbSelectData*)cl->screen->screenData;
|
||||
m->state = OK;
|
||||
} else {
|
||||
rfbSelectData* m = (rfbSelectData*)cl->screen->screenData;
|
||||
int curSel=m->selected;
|
||||
if(keySym==XK_Up) {
|
||||
if(curSel>0)
|
||||
selSelect(m,curSel-1);
|
||||
} else if(keySym==XK_Down) {
|
||||
if(curSel+1<m->listSize)
|
||||
selSelect(m,curSel+1);
|
||||
} else {
|
||||
if(keySym==XK_Page_Down) {
|
||||
if(curSel+m->pageH<m->listSize)
|
||||
selSelect(m,curSel+m->pageH);
|
||||
else
|
||||
selSelect(m,m->listSize-1);
|
||||
} else if(keySym==XK_Page_Up) {
|
||||
if(curSel-m->pageH>=0)
|
||||
selSelect(m,curSel-m->pageH);
|
||||
else
|
||||
selSelect(m,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void selPtrAddEvent(int buttonMask,int x,int y,rfbClientPtr cl)
|
||||
{
|
||||
rfbSelectData* m = (rfbSelectData*)cl->screen->screenData;
|
||||
if(y<m->okY && y>=m->okY-m->textH) {
|
||||
if(x>=m->okBX && x<m->okBX+m->buttonWidth) {
|
||||
if(!m->okInverted)
|
||||
selPaintButtons(m,TRUE,FALSE);
|
||||
if(buttonMask)
|
||||
m->state = OK;
|
||||
} else if(x>=m->cancelBX && x<m->cancelBX+m->buttonWidth) {
|
||||
if(!m->cancelInverted)
|
||||
selPaintButtons(m,FALSE,TRUE);
|
||||
if(buttonMask)
|
||||
m->state = CANCEL;
|
||||
} else if(m->okInverted || m->cancelInverted)
|
||||
selPaintButtons(m,FALSE,FALSE);
|
||||
} else {
|
||||
if(m->okInverted || m->cancelInverted)
|
||||
selPaintButtons(m,FALSE,FALSE);
|
||||
if(!m->lastButtons && buttonMask) {
|
||||
if(x>=m->x1 && x<m->x2 && y>=m->y1 && y<m->y2)
|
||||
selSelect(m,m->displayStart+(y-m->y1)/m->textH);
|
||||
}
|
||||
}
|
||||
m->lastButtons = buttonMask;
|
||||
|
||||
/* todo: scrollbars */
|
||||
}
|
||||
|
||||
static rfbCursorPtr selGetCursorPtr(rfbClientPtr cl)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int rfbSelectBox(rfbScreenInfoPtr rfbScreen,rfbFontDataPtr font,
|
||||
char** list,
|
||||
int x1,int y1,int x2,int y2,
|
||||
rfbPixel colour,rfbPixel backColour,
|
||||
int border,SelectionChangedHookPtr selChangedHook)
|
||||
{
|
||||
int bpp = rfbScreen->bitsPerPixel/8;
|
||||
char* frameBufferBackup;
|
||||
void* screenDataBackup = rfbScreen->screenData;
|
||||
rfbKbdAddEventProcPtr kbdAddEventBackup = rfbScreen->kbdAddEvent;
|
||||
rfbPtrAddEventProcPtr ptrAddEventBackup = rfbScreen->ptrAddEvent;
|
||||
rfbGetCursorProcPtr getCursorPtrBackup = rfbScreen->getCursorPtr;
|
||||
rfbDisplayHookPtr displayHookBackup = rfbScreen->displayHook;
|
||||
rfbSelectData selData;
|
||||
int i,j,k;
|
||||
int fx1,fy1,fx2,fy2; /* for font bbox */
|
||||
|
||||
if(list==0 || *list==0)
|
||||
return(-1);
|
||||
|
||||
rfbWholeFontBBox(font, &fx1, &fy1, &fx2, &fy2);
|
||||
selData.textH = fy2-fy1;
|
||||
/* I need at least one line for the choice and one for the buttons */
|
||||
if(y2-y1<selData.textH*2+3*border)
|
||||
return(-1);
|
||||
selData.xhot = -fx1;
|
||||
selData.yhot = -fy2;
|
||||
selData.x1 = x1+border;
|
||||
selData.y1 = y1+border;
|
||||
selData.y2 = y2-selData.textH-3*border;
|
||||
selData.x2 = x2-2*border;
|
||||
selData.pageH = (selData.y2-selData.y1)/selData.textH;
|
||||
|
||||
i = rfbWidthOfString(font,okStr);
|
||||
j = rfbWidthOfString(font,cancelStr);
|
||||
selData.buttonWidth= k = 4*border+(i<j)?j:i;
|
||||
selData.okBX = x1+(x2-x1-2*k)/3;
|
||||
if(selData.okBX<x1+border) /* too narrow! */
|
||||
return(-1);
|
||||
selData.cancelBX = x1+k+(x2-x1-2*k)*2/3;
|
||||
selData.okX = selData.okBX+(k-i)/2;
|
||||
selData.cancelX = selData.cancelBX+(k-j)/2;
|
||||
selData.okY = y2-border;
|
||||
|
||||
frameBufferBackup = (char*)malloc(bpp*(x2-x1)*(y2-y1));
|
||||
|
||||
selData.state = SELECTING;
|
||||
selData.screen = rfbScreen;
|
||||
selData.font = font;
|
||||
selData.list = list;
|
||||
selData.colour = colour;
|
||||
selData.backColour = backColour;
|
||||
for(i=0;list[i];i++);
|
||||
selData.selected = i;
|
||||
selData.listSize = i;
|
||||
selData.displayStart = i;
|
||||
selData.lastButtons = 0;
|
||||
selData.selChangedHook = selChangedHook;
|
||||
|
||||
rfbScreen->screenData = &selData;
|
||||
rfbScreen->kbdAddEvent = selKbdAddEvent;
|
||||
rfbScreen->ptrAddEvent = selPtrAddEvent;
|
||||
rfbScreen->getCursorPtr = selGetCursorPtr;
|
||||
rfbScreen->displayHook = NULL;
|
||||
|
||||
/* backup screen */
|
||||
for(j=0;j<y2-y1;j++)
|
||||
memcpy(frameBufferBackup+j*(x2-x1)*bpp,
|
||||
rfbScreen->frameBuffer+j*rfbScreen->paddedWidthInBytes+x1*bpp,
|
||||
(x2-x1)*bpp);
|
||||
|
||||
/* paint list and buttons */
|
||||
rfbFillRect(rfbScreen,x1,y1,x2,y2,colour);
|
||||
selPaintButtons(&selData,FALSE,FALSE);
|
||||
selSelect(&selData,0);
|
||||
|
||||
/* modal loop */
|
||||
while(selData.state == SELECTING)
|
||||
rfbProcessEvents(rfbScreen,20000);
|
||||
|
||||
/* copy back screen data */
|
||||
for(j=0;j<y2-y1;j++)
|
||||
memcpy(rfbScreen->frameBuffer+j*rfbScreen->paddedWidthInBytes+x1*bpp,
|
||||
frameBufferBackup+j*(x2-x1)*bpp,
|
||||
(x2-x1)*bpp);
|
||||
free(frameBufferBackup);
|
||||
rfbMarkRectAsModified(rfbScreen,x1,y1,x2,y2);
|
||||
rfbScreen->screenData = screenDataBackup;
|
||||
rfbScreen->kbdAddEvent = kbdAddEventBackup;
|
||||
rfbScreen->ptrAddEvent = ptrAddEventBackup;
|
||||
rfbScreen->getCursorPtr = getCursorPtrBackup;
|
||||
rfbScreen->displayHook = displayHookBackup;
|
||||
|
||||
if(selData.state==CANCEL)
|
||||
selData.selected=-1;
|
||||
return(selData.selected);
|
||||
}
|
||||
|
||||
737
libvncserver/sockets.c
Normal file
737
libvncserver/sockets.c
Normal file
@@ -0,0 +1,737 @@
|
||||
/*
|
||||
* sockets.c - deal with TCP & UDP sockets.
|
||||
*
|
||||
* This code should be independent of any changes in the RFB protocol. It just
|
||||
* deals with the X server scheduling stuff, calling rfbNewClientConnection and
|
||||
* rfbProcessClientMessage to actually deal with the protocol. If a socket
|
||||
* needs to be closed for any reason then rfbCloseClient should be called, and
|
||||
* this in turn will call rfbClientConnectionGone. To make an active
|
||||
* connection out, call rfbConnect - note that this does _not_ call
|
||||
* rfbNewClientConnection.
|
||||
*
|
||||
* This file is divided into two types of function. Those beginning with
|
||||
* "rfb" are specific to sockets using the RFB protocol. Those without the
|
||||
* "rfb" prefix are more general socket routines (which are used by the http
|
||||
* code).
|
||||
*
|
||||
* Thanks to Karl Hakimian for pointing out that some platforms return EAGAIN
|
||||
* not EWOULDBLOCK.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2005 Rohit Kumar, Johannes E. Schindelin
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_SYS_SOCKET_H
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_NETINET_IN_H
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
#endif
|
||||
#ifdef LIBVNCSERVER_HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(__linux__) && defined(NEED_TIMEVAL)
|
||||
struct timeval
|
||||
{
|
||||
long int tv_sec,tv_usec;
|
||||
}
|
||||
;
|
||||
#endif
|
||||
|
||||
#ifdef LIBVNCSERVER_HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef USE_LIBWRAP
|
||||
#include <syslog.h>
|
||||
#include <tcpd.h>
|
||||
int allow_severity=LOG_INFO;
|
||||
int deny_severity=LOG_WARNING;
|
||||
#endif
|
||||
|
||||
#if defined(WIN32)
|
||||
#ifndef __MINGW32__
|
||||
#pragma warning (disable: 4018 4761)
|
||||
#endif
|
||||
#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
|
||||
#define closesocket close
|
||||
#endif
|
||||
|
||||
int rfbMaxClientWait = 20000; /* time (ms) after which we decide client has
|
||||
gone away - needed to stop us hanging */
|
||||
|
||||
/*
|
||||
* rfbInitSockets sets up the TCP and UDP sockets to listen for RFB
|
||||
* connections. It does nothing if called again.
|
||||
*/
|
||||
|
||||
void
|
||||
rfbInitSockets(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
in_addr_t iface = rfbScreen->listenInterface;
|
||||
|
||||
if (rfbScreen->socketState!=RFB_SOCKET_INIT)
|
||||
return;
|
||||
|
||||
rfbScreen->socketState = RFB_SOCKET_READY;
|
||||
|
||||
if (rfbScreen->inetdSock != -1) {
|
||||
const int one = 1;
|
||||
|
||||
if(!rfbSetNonBlocking(rfbScreen->inetdSock))
|
||||
return;
|
||||
|
||||
if (setsockopt(rfbScreen->inetdSock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
rfbLogPerror("setsockopt");
|
||||
return;
|
||||
}
|
||||
|
||||
FD_ZERO(&(rfbScreen->allFds));
|
||||
FD_SET(rfbScreen->inetdSock, &(rfbScreen->allFds));
|
||||
rfbScreen->maxFd = rfbScreen->inetdSock;
|
||||
return;
|
||||
}
|
||||
|
||||
if(rfbScreen->autoPort) {
|
||||
int i;
|
||||
rfbLog("Autoprobing TCP port \n");
|
||||
for (i = 5900; i < 6000; i++) {
|
||||
if ((rfbScreen->listenSock = rfbListenOnTCPPort(i, iface)) >= 0) {
|
||||
rfbScreen->port = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 6000) {
|
||||
rfbLogPerror("Failure autoprobing");
|
||||
return;
|
||||
}
|
||||
|
||||
rfbLog("Autoprobing selected port %d\n", rfbScreen->port);
|
||||
FD_ZERO(&(rfbScreen->allFds));
|
||||
FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds));
|
||||
rfbScreen->maxFd = rfbScreen->listenSock;
|
||||
}
|
||||
else if(rfbScreen->port>0) {
|
||||
rfbLog("Listening for VNC connections on TCP port %d\n", rfbScreen->port);
|
||||
|
||||
if ((rfbScreen->listenSock = rfbListenOnTCPPort(rfbScreen->port, iface)) < 0) {
|
||||
rfbLogPerror("ListenOnTCPPort");
|
||||
return;
|
||||
}
|
||||
|
||||
FD_ZERO(&(rfbScreen->allFds));
|
||||
FD_SET(rfbScreen->listenSock, &(rfbScreen->allFds));
|
||||
rfbScreen->maxFd = rfbScreen->listenSock;
|
||||
}
|
||||
|
||||
if (rfbScreen->udpPort != 0) {
|
||||
rfbLog("rfbInitSockets: listening for input on UDP port %d\n",rfbScreen->udpPort);
|
||||
|
||||
if ((rfbScreen->udpSock = rfbListenOnUDPPort(rfbScreen->udpPort, iface)) < 0) {
|
||||
rfbLogPerror("ListenOnUDPPort");
|
||||
return;
|
||||
}
|
||||
FD_SET(rfbScreen->udpSock, &(rfbScreen->allFds));
|
||||
rfbScreen->maxFd = max((int)rfbScreen->udpSock,rfbScreen->maxFd);
|
||||
}
|
||||
}
|
||||
|
||||
void rfbShutdownSockets(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
if (rfbScreen->socketState!=RFB_SOCKET_READY)
|
||||
return;
|
||||
|
||||
rfbScreen->socketState = RFB_SOCKET_SHUTDOWN;
|
||||
|
||||
if(rfbScreen->inetdSock>-1) {
|
||||
closesocket(rfbScreen->inetdSock);
|
||||
FD_CLR(rfbScreen->inetdSock,&rfbScreen->allFds);
|
||||
rfbScreen->inetdSock=-1;
|
||||
}
|
||||
|
||||
if(rfbScreen->listenSock>-1) {
|
||||
closesocket(rfbScreen->listenSock);
|
||||
FD_CLR(rfbScreen->listenSock,&rfbScreen->allFds);
|
||||
rfbScreen->listenSock=-1;
|
||||
}
|
||||
|
||||
if(rfbScreen->udpSock>-1) {
|
||||
closesocket(rfbScreen->udpSock);
|
||||
FD_CLR(rfbScreen->udpSock,&rfbScreen->allFds);
|
||||
rfbScreen->udpSock=-1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* rfbCheckFds is called from ProcessInputEvents to check for input on the RFB
|
||||
* socket(s). If there is input to process, the appropriate function in the
|
||||
* RFB server code will be called (rfbNewClientConnection,
|
||||
* rfbProcessClientMessage, etc).
|
||||
*/
|
||||
|
||||
int
|
||||
rfbCheckFds(rfbScreenInfoPtr rfbScreen,long usec)
|
||||
{
|
||||
int nfds;
|
||||
fd_set fds;
|
||||
struct timeval tv;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
char buf[6];
|
||||
rfbClientIteratorPtr i;
|
||||
rfbClientPtr cl;
|
||||
int result = 0;
|
||||
|
||||
if (!rfbScreen->inetdInitDone && rfbScreen->inetdSock != -1) {
|
||||
rfbNewClientConnection(rfbScreen,rfbScreen->inetdSock);
|
||||
rfbScreen->inetdInitDone = TRUE;
|
||||
}
|
||||
|
||||
do {
|
||||
memcpy((char *)&fds, (char *)&(rfbScreen->allFds), sizeof(fd_set));
|
||||
tv.tv_sec = 0;
|
||||
tv.tv_usec = usec;
|
||||
nfds = select(rfbScreen->maxFd + 1, &fds, NULL, NULL /* &fds */, &tv);
|
||||
if (nfds == 0) {
|
||||
/* timed out, check for async events */
|
||||
i = rfbGetClientIterator(rfbScreen);
|
||||
while((cl = rfbClientIteratorNext(i))) {
|
||||
if (cl->onHold)
|
||||
continue;
|
||||
if (FD_ISSET(cl->sock, &(rfbScreen->allFds)))
|
||||
rfbSendFileTransferChunk(cl);
|
||||
}
|
||||
rfbReleaseClientIterator(i);
|
||||
return result;
|
||||
}
|
||||
|
||||
if (nfds < 0) {
|
||||
#ifdef WIN32
|
||||
errno = WSAGetLastError();
|
||||
#endif
|
||||
if (errno != EINTR)
|
||||
rfbLogPerror("rfbCheckFds: select");
|
||||
return -1;
|
||||
}
|
||||
|
||||
result += nfds;
|
||||
|
||||
if (rfbScreen->listenSock != -1 && FD_ISSET(rfbScreen->listenSock, &fds)) {
|
||||
|
||||
if (!rfbProcessNewConnection(rfbScreen))
|
||||
return -1;
|
||||
|
||||
FD_CLR(rfbScreen->listenSock, &fds);
|
||||
if (--nfds == 0)
|
||||
return result;
|
||||
}
|
||||
|
||||
if ((rfbScreen->udpSock != -1) && FD_ISSET(rfbScreen->udpSock, &fds)) {
|
||||
if(!rfbScreen->udpClient)
|
||||
rfbNewUDPClient(rfbScreen);
|
||||
if (recvfrom(rfbScreen->udpSock, buf, 1, MSG_PEEK,
|
||||
(struct sockaddr *)&addr, &addrlen) < 0) {
|
||||
rfbLogPerror("rfbCheckFds: UDP: recvfrom");
|
||||
rfbDisconnectUDPSock(rfbScreen);
|
||||
rfbScreen->udpSockConnected = FALSE;
|
||||
} else {
|
||||
if (!rfbScreen->udpSockConnected ||
|
||||
(memcmp(&addr, &rfbScreen->udpRemoteAddr, addrlen) != 0))
|
||||
{
|
||||
/* new remote end */
|
||||
rfbLog("rfbCheckFds: UDP: got connection\n");
|
||||
|
||||
memcpy(&rfbScreen->udpRemoteAddr, &addr, addrlen);
|
||||
rfbScreen->udpSockConnected = TRUE;
|
||||
|
||||
if (connect(rfbScreen->udpSock,
|
||||
(struct sockaddr *)&addr, addrlen) < 0) {
|
||||
rfbLogPerror("rfbCheckFds: UDP: connect");
|
||||
rfbDisconnectUDPSock(rfbScreen);
|
||||
return -1;
|
||||
}
|
||||
|
||||
rfbNewUDPConnection(rfbScreen,rfbScreen->udpSock);
|
||||
}
|
||||
|
||||
rfbProcessUDPInput(rfbScreen);
|
||||
}
|
||||
|
||||
FD_CLR(rfbScreen->udpSock, &fds);
|
||||
if (--nfds == 0)
|
||||
return result;
|
||||
}
|
||||
|
||||
i = rfbGetClientIterator(rfbScreen);
|
||||
while((cl = rfbClientIteratorNext(i))) {
|
||||
|
||||
if (cl->onHold)
|
||||
continue;
|
||||
|
||||
if (FD_ISSET(cl->sock, &(rfbScreen->allFds)))
|
||||
{
|
||||
if (FD_ISSET(cl->sock, &fds))
|
||||
rfbProcessClientMessage(cl);
|
||||
else
|
||||
rfbSendFileTransferChunk(cl);
|
||||
}
|
||||
}
|
||||
rfbReleaseClientIterator(i);
|
||||
} while(rfbScreen->handleEventsEagerly);
|
||||
return result;
|
||||
}
|
||||
|
||||
rfbBool
|
||||
rfbProcessNewConnection(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
const int one = 1;
|
||||
int sock = -1;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen = sizeof(addr);
|
||||
|
||||
if ((sock = accept(rfbScreen->listenSock,
|
||||
(struct sockaddr *)&addr, &addrlen)) < 0) {
|
||||
rfbLogPerror("rfbCheckFds: accept");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!rfbSetNonBlocking(sock)) {
|
||||
closesocket(sock);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
rfbLogPerror("rfbCheckFds: setsockopt");
|
||||
closesocket(sock);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifdef USE_LIBWRAP
|
||||
if(!hosts_ctl("vnc",STRING_UNKNOWN,inet_ntoa(addr.sin_addr),
|
||||
STRING_UNKNOWN)) {
|
||||
rfbLog("Rejected connection from client %s\n",
|
||||
inet_ntoa(addr.sin_addr));
|
||||
closesocket(sock);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
rfbLog("Got connection from client %s\n", inet_ntoa(addr.sin_addr));
|
||||
|
||||
rfbNewClient(rfbScreen,sock);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
rfbDisconnectUDPSock(rfbScreenInfoPtr rfbScreen)
|
||||
{
|
||||
rfbScreen->udpSockConnected = FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
rfbCloseClient(rfbClientPtr cl)
|
||||
{
|
||||
rfbExtensionData* extension;
|
||||
|
||||
for(extension=cl->extensions; extension; extension=extension->next)
|
||||
if(extension->extension->close)
|
||||
extension->extension->close(cl, extension->data);
|
||||
|
||||
LOCK(cl->updateMutex);
|
||||
#ifdef LIBVNCSERVER_HAVE_LIBPTHREAD
|
||||
if (cl->sock != -1)
|
||||
#endif
|
||||
{
|
||||
FD_CLR(cl->sock,&(cl->screen->allFds));
|
||||
if(cl->sock==cl->screen->maxFd)
|
||||
while(cl->screen->maxFd>0
|
||||
&& !FD_ISSET(cl->screen->maxFd,&(cl->screen->allFds)))
|
||||
cl->screen->maxFd--;
|
||||
#ifndef __MINGW32__
|
||||
shutdown(cl->sock,SHUT_RDWR);
|
||||
#endif
|
||||
closesocket(cl->sock);
|
||||
cl->sock = -1;
|
||||
}
|
||||
TSIGNAL(cl->updateCond);
|
||||
UNLOCK(cl->updateMutex);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rfbConnect is called to make a connection out to a given TCP address.
|
||||
*/
|
||||
|
||||
int
|
||||
rfbConnect(rfbScreenInfoPtr rfbScreen,
|
||||
char *host,
|
||||
int port)
|
||||
{
|
||||
int sock;
|
||||
int one = 1;
|
||||
|
||||
rfbLog("Making connection to client on host %s port %d\n",
|
||||
host,port);
|
||||
|
||||
if ((sock = rfbConnectToTcpAddr(host, port)) < 0) {
|
||||
rfbLogPerror("connection failed");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(!rfbSetNonBlocking(sock)) {
|
||||
closesocket(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
rfbLogPerror("setsockopt failed");
|
||||
closesocket(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* AddEnabledDevice(sock); */
|
||||
FD_SET(sock, &rfbScreen->allFds);
|
||||
rfbScreen->maxFd = max(sock,rfbScreen->maxFd);
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
/*
|
||||
* ReadExact reads an exact number of bytes from a client. Returns 1 if
|
||||
* those bytes have been read, 0 if the other end has closed, or -1 if an error
|
||||
* occurred (errno is set to ETIMEDOUT if it timed out).
|
||||
*/
|
||||
|
||||
int
|
||||
rfbReadExactTimeout(rfbClientPtr cl, char* buf, int len, int timeout)
|
||||
{
|
||||
int sock = cl->sock;
|
||||
int n;
|
||||
fd_set fds;
|
||||
struct timeval tv;
|
||||
|
||||
while (len > 0) {
|
||||
n = read(sock, buf, len);
|
||||
|
||||
if (n > 0) {
|
||||
|
||||
buf += n;
|
||||
len -= n;
|
||||
|
||||
} else if (n == 0) {
|
||||
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
errno = WSAGetLastError();
|
||||
#endif
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
|
||||
#ifdef LIBVNCSERVER_ENOENT_WORKAROUND
|
||||
if (errno != ENOENT)
|
||||
#endif
|
||||
if (errno != EWOULDBLOCK && errno != EAGAIN) {
|
||||
return n;
|
||||
}
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(sock, &fds);
|
||||
tv.tv_sec = timeout / 1000;
|
||||
tv.tv_usec = (timeout % 1000) * 1000;
|
||||
n = select(sock+1, &fds, NULL, &fds, &tv);
|
||||
if (n < 0) {
|
||||
rfbLogPerror("ReadExact: select");
|
||||
return n;
|
||||
}
|
||||
if (n == 0) {
|
||||
errno = ETIMEDOUT;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
#undef DEBUG_READ_EXACT
|
||||
#ifdef DEBUG_READ_EXACT
|
||||
rfbLog("ReadExact %d bytes\n",len);
|
||||
for(n=0;n<len;n++)
|
||||
fprintf(stderr,"%02x ",(unsigned char)buf[n]);
|
||||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
int rfbReadExact(rfbClientPtr cl,char* buf,int len)
|
||||
{
|
||||
/* favor the per-screen value if set */
|
||||
if(cl->screen && cl->screen->maxClientWait)
|
||||
return(rfbReadExactTimeout(cl,buf,len,cl->screen->maxClientWait));
|
||||
else
|
||||
return(rfbReadExactTimeout(cl,buf,len,rfbMaxClientWait));
|
||||
}
|
||||
|
||||
/*
|
||||
* WriteExact writes an exact number of bytes to a client. Returns 1 if
|
||||
* those bytes have been written, or -1 if an error occurred (errno is set to
|
||||
* ETIMEDOUT if it timed out).
|
||||
*/
|
||||
|
||||
int
|
||||
rfbWriteExact(rfbClientPtr cl,
|
||||
const char *buf,
|
||||
int len)
|
||||
{
|
||||
int sock = cl->sock;
|
||||
int n;
|
||||
fd_set fds;
|
||||
struct timeval tv;
|
||||
int totalTimeWaited = 0;
|
||||
const int timeout = (cl->screen && cl->screen->maxClientWait) ? cl->screen->maxClientWait : rfbMaxClientWait;
|
||||
|
||||
#undef DEBUG_WRITE_EXACT
|
||||
#ifdef DEBUG_WRITE_EXACT
|
||||
rfbLog("WriteExact %d bytes\n",len);
|
||||
for(n=0;n<len;n++)
|
||||
fprintf(stderr,"%02x ",(unsigned char)buf[n]);
|
||||
fprintf(stderr,"\n");
|
||||
#endif
|
||||
|
||||
LOCK(cl->outputMutex);
|
||||
while (len > 0) {
|
||||
n = write(sock, buf, len);
|
||||
|
||||
if (n > 0) {
|
||||
|
||||
buf += n;
|
||||
len -= n;
|
||||
|
||||
} else if (n == 0) {
|
||||
|
||||
rfbErr("WriteExact: write returned 0?\n");
|
||||
return 0;
|
||||
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
errno = WSAGetLastError();
|
||||
#endif
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
|
||||
if (errno != EWOULDBLOCK && errno != EAGAIN) {
|
||||
UNLOCK(cl->outputMutex);
|
||||
return n;
|
||||
}
|
||||
|
||||
/* Retry every 5 seconds until we exceed timeout. We
|
||||
need to do this because select doesn't necessarily return
|
||||
immediately when the other end has gone away */
|
||||
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(sock, &fds);
|
||||
tv.tv_sec = 5;
|
||||
tv.tv_usec = 0;
|
||||
n = select(sock+1, NULL, &fds, NULL /* &fds */, &tv);
|
||||
if (n < 0) {
|
||||
#ifdef WIN32
|
||||
errno=WSAGetLastError();
|
||||
#endif
|
||||
if(errno==EINTR)
|
||||
continue;
|
||||
rfbLogPerror("WriteExact: select");
|
||||
UNLOCK(cl->outputMutex);
|
||||
return n;
|
||||
}
|
||||
if (n == 0) {
|
||||
totalTimeWaited += 5000;
|
||||
if (totalTimeWaited >= timeout) {
|
||||
errno = ETIMEDOUT;
|
||||
UNLOCK(cl->outputMutex);
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
totalTimeWaited = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
UNLOCK(cl->outputMutex);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* currently private, called by rfbProcessArguments() */
|
||||
int
|
||||
rfbStringToAddr(char *str, in_addr_t *addr) {
|
||||
if (str == NULL || *str == '\0' || strcmp(str, "any") == 0) {
|
||||
*addr = htonl(INADDR_ANY);
|
||||
} else if (strcmp(str, "localhost") == 0) {
|
||||
*addr = htonl(INADDR_LOOPBACK);
|
||||
} else {
|
||||
struct hostent *hp;
|
||||
if ((*addr = inet_addr(str)) == htonl(INADDR_NONE)) {
|
||||
if (!(hp = gethostbyname(str))) {
|
||||
return 0;
|
||||
}
|
||||
*addr = *(unsigned long *)hp->h_addr;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int
|
||||
rfbListenOnTCPPort(int port,
|
||||
in_addr_t iface)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
int sock;
|
||||
int one = 1;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_addr.s_addr = iface;
|
||||
|
||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
closesocket(sock);
|
||||
return -1;
|
||||
}
|
||||
if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
closesocket(sock);
|
||||
return -1;
|
||||
}
|
||||
if (listen(sock, 32) < 0) {
|
||||
closesocket(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
int
|
||||
rfbConnectToTcpAddr(char *host,
|
||||
int port)
|
||||
{
|
||||
struct hostent *hp;
|
||||
int sock;
|
||||
struct sockaddr_in addr;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
|
||||
if ((addr.sin_addr.s_addr = inet_addr(host)) == htonl(INADDR_NONE))
|
||||
{
|
||||
if (!(hp = gethostbyname(host))) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
}
|
||||
addr.sin_addr.s_addr = *(unsigned long *)hp->h_addr;
|
||||
}
|
||||
|
||||
if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (connect(sock, (struct sockaddr *)&addr, (sizeof(addr))) < 0) {
|
||||
closesocket(sock);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
int
|
||||
rfbListenOnUDPPort(int port,
|
||||
in_addr_t iface)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
int sock;
|
||||
int one = 1;
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_family = AF_INET;
|
||||
addr.sin_port = htons(port);
|
||||
addr.sin_addr.s_addr = iface;
|
||||
|
||||
if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char *)&one, sizeof(one)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (bind(sock, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
/*
|
||||
* rfbSetNonBlocking sets a socket into non-blocking mode.
|
||||
*/
|
||||
rfbBool
|
||||
rfbSetNonBlocking(int sock)
|
||||
{
|
||||
#ifdef WIN32
|
||||
unsigned long block=1;
|
||||
if(ioctlsocket(sock, FIONBIO, &block) == SOCKET_ERROR) {
|
||||
errno=WSAGetLastError();
|
||||
#else
|
||||
int flags = fcntl(sock, F_GETFL);
|
||||
if(flags < 0 || fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
#endif
|
||||
rfbLogPerror("Setting socket to non-blocking failed");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
478
libvncserver/stats.c
Normal file
478
libvncserver/stats.c
Normal file
@@ -0,0 +1,478 @@
|
||||
/*
|
||||
* stats.c
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (C) 2002 RealVNC Ltd.
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#include "rfb/rfb.h"
|
||||
|
||||
char *messageNameServer2Client(uint32_t type, char *buf, int len);
|
||||
char *messageNameClient2Server(uint32_t type, char *buf, int len);
|
||||
char *encodingName(uint32_t enc, char *buf, int len);
|
||||
|
||||
rfbStatList *rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type);
|
||||
rfbStatList *rfbStatLookupMessage(rfbClientPtr cl, uint32_t type);
|
||||
|
||||
void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
|
||||
void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
|
||||
void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
|
||||
void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw);
|
||||
void rfbResetStats(rfbClientPtr cl);
|
||||
void rfbPrintStats(rfbClientPtr cl);
|
||||
|
||||
|
||||
|
||||
|
||||
char *messageNameServer2Client(uint32_t type, char *buf, int len) {
|
||||
if (buf==NULL) return "error";
|
||||
switch (type) {
|
||||
case rfbFramebufferUpdate: snprintf(buf, len, "FramebufferUpdate"); break;
|
||||
case rfbSetColourMapEntries: snprintf(buf, len, "SetColourMapEntries"); break;
|
||||
case rfbBell: snprintf(buf, len, "Bell"); break;
|
||||
case rfbServerCutText: snprintf(buf, len, "ServerCutText"); break;
|
||||
case rfbResizeFrameBuffer: snprintf(buf, len, "ResizeFrameBuffer"); break;
|
||||
case rfbFileTransfer: snprintf(buf, len, "FileTransfer"); break;
|
||||
case rfbTextChat: snprintf(buf, len, "TextChat"); break;
|
||||
case rfbPalmVNCReSizeFrameBuffer: snprintf(buf, len, "PalmVNCReSize"); break;
|
||||
case rfbXvp: snprintf(buf, len, "XvpServerMessage"); break;
|
||||
default:
|
||||
snprintf(buf, len, "svr2cli-0x%08X", 0xFF);
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
char *messageNameClient2Server(uint32_t type, char *buf, int len) {
|
||||
if (buf==NULL) return "error";
|
||||
switch (type) {
|
||||
case rfbSetPixelFormat: snprintf(buf, len, "SetPixelFormat"); break;
|
||||
case rfbFixColourMapEntries: snprintf(buf, len, "FixColourMapEntries"); break;
|
||||
case rfbSetEncodings: snprintf(buf, len, "SetEncodings"); break;
|
||||
case rfbFramebufferUpdateRequest: snprintf(buf, len, "FramebufferUpdate"); break;
|
||||
case rfbKeyEvent: snprintf(buf, len, "KeyEvent"); break;
|
||||
case rfbPointerEvent: snprintf(buf, len, "PointerEvent"); break;
|
||||
case rfbClientCutText: snprintf(buf, len, "ClientCutText"); break;
|
||||
case rfbFileTransfer: snprintf(buf, len, "FileTransfer"); break;
|
||||
case rfbSetScale: snprintf(buf, len, "SetScale"); break;
|
||||
case rfbSetServerInput: snprintf(buf, len, "SetServerInput"); break;
|
||||
case rfbSetSW: snprintf(buf, len, "SetSingleWindow"); break;
|
||||
case rfbTextChat: snprintf(buf, len, "TextChat"); break;
|
||||
case rfbPalmVNCSetScaleFactor: snprintf(buf, len, "PalmVNCSetScale"); break;
|
||||
case rfbXvp: snprintf(buf, len, "XvpClientMessage"); break;
|
||||
default:
|
||||
snprintf(buf, len, "cli2svr-0x%08X", type);
|
||||
|
||||
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Encoding name must be <=16 characters to fit nicely on the status output in
|
||||
* an 80 column terminal window
|
||||
*/
|
||||
char *encodingName(uint32_t type, char *buf, int len) {
|
||||
if (buf==NULL) return "error";
|
||||
|
||||
switch (type) {
|
||||
case rfbEncodingRaw: snprintf(buf, len, "raw"); break;
|
||||
case rfbEncodingCopyRect: snprintf(buf, len, "copyRect"); break;
|
||||
case rfbEncodingRRE: snprintf(buf, len, "RRE"); break;
|
||||
case rfbEncodingCoRRE: snprintf(buf, len, "CoRRE"); break;
|
||||
case rfbEncodingHextile: snprintf(buf, len, "hextile"); break;
|
||||
case rfbEncodingZlib: snprintf(buf, len, "zlib"); break;
|
||||
case rfbEncodingTight: snprintf(buf, len, "tight"); break;
|
||||
case rfbEncodingZlibHex: snprintf(buf, len, "zlibhex"); break;
|
||||
case rfbEncodingUltra: snprintf(buf, len, "ultra"); break;
|
||||
case rfbEncodingZRLE: snprintf(buf, len, "ZRLE"); break;
|
||||
case rfbEncodingZYWRLE: snprintf(buf, len, "ZYWRLE"); break;
|
||||
case rfbEncodingCache: snprintf(buf, len, "cache"); break;
|
||||
case rfbEncodingCacheEnable: snprintf(buf, len, "cacheEnable"); break;
|
||||
case rfbEncodingXOR_Zlib: snprintf(buf, len, "xorZlib"); break;
|
||||
case rfbEncodingXORMonoColor_Zlib: snprintf(buf, len, "xorMonoZlib"); break;
|
||||
case rfbEncodingXORMultiColor_Zlib: snprintf(buf, len, "xorColorZlib"); break;
|
||||
case rfbEncodingSolidColor: snprintf(buf, len, "solidColor"); break;
|
||||
case rfbEncodingXOREnable: snprintf(buf, len, "xorEnable"); break;
|
||||
case rfbEncodingCacheZip: snprintf(buf, len, "cacheZip"); break;
|
||||
case rfbEncodingSolMonoZip: snprintf(buf, len, "monoZip"); break;
|
||||
case rfbEncodingUltraZip: snprintf(buf, len, "ultraZip"); break;
|
||||
|
||||
case rfbEncodingXCursor: snprintf(buf, len, "Xcursor"); break;
|
||||
case rfbEncodingRichCursor: snprintf(buf, len, "RichCursor"); break;
|
||||
case rfbEncodingPointerPos: snprintf(buf, len, "PointerPos"); break;
|
||||
|
||||
case rfbEncodingLastRect: snprintf(buf, len, "LastRect"); break;
|
||||
case rfbEncodingNewFBSize: snprintf(buf, len, "NewFBSize"); break;
|
||||
case rfbEncodingKeyboardLedState: snprintf(buf, len, "LedState"); break;
|
||||
case rfbEncodingSupportedMessages: snprintf(buf, len, "SupportedMessage"); break;
|
||||
case rfbEncodingSupportedEncodings: snprintf(buf, len, "SupportedEncoding"); break;
|
||||
case rfbEncodingServerIdentity: snprintf(buf, len, "ServerIdentify"); break;
|
||||
|
||||
/* The following lookups do not report in stats */
|
||||
case rfbEncodingCompressLevel0: snprintf(buf, len, "CompressLevel0"); break;
|
||||
case rfbEncodingCompressLevel1: snprintf(buf, len, "CompressLevel1"); break;
|
||||
case rfbEncodingCompressLevel2: snprintf(buf, len, "CompressLevel2"); break;
|
||||
case rfbEncodingCompressLevel3: snprintf(buf, len, "CompressLevel3"); break;
|
||||
case rfbEncodingCompressLevel4: snprintf(buf, len, "CompressLevel4"); break;
|
||||
case rfbEncodingCompressLevel5: snprintf(buf, len, "CompressLevel5"); break;
|
||||
case rfbEncodingCompressLevel6: snprintf(buf, len, "CompressLevel6"); break;
|
||||
case rfbEncodingCompressLevel7: snprintf(buf, len, "CompressLevel7"); break;
|
||||
case rfbEncodingCompressLevel8: snprintf(buf, len, "CompressLevel8"); break;
|
||||
case rfbEncodingCompressLevel9: snprintf(buf, len, "CompressLevel9"); break;
|
||||
|
||||
case rfbEncodingQualityLevel0: snprintf(buf, len, "QualityLevel0"); break;
|
||||
case rfbEncodingQualityLevel1: snprintf(buf, len, "QualityLevel1"); break;
|
||||
case rfbEncodingQualityLevel2: snprintf(buf, len, "QualityLevel2"); break;
|
||||
case rfbEncodingQualityLevel3: snprintf(buf, len, "QualityLevel3"); break;
|
||||
case rfbEncodingQualityLevel4: snprintf(buf, len, "QualityLevel4"); break;
|
||||
case rfbEncodingQualityLevel5: snprintf(buf, len, "QualityLevel5"); break;
|
||||
case rfbEncodingQualityLevel6: snprintf(buf, len, "QualityLevel6"); break;
|
||||
case rfbEncodingQualityLevel7: snprintf(buf, len, "QualityLevel7"); break;
|
||||
case rfbEncodingQualityLevel8: snprintf(buf, len, "QualityLevel8"); break;
|
||||
case rfbEncodingQualityLevel9: snprintf(buf, len, "QualityLevel9"); break;
|
||||
|
||||
|
||||
default:
|
||||
snprintf(buf, len, "Enc(0x%08X)", type);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
rfbStatList *rfbStatLookupEncoding(rfbClientPtr cl, uint32_t type)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
if (cl==NULL) return NULL;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
{
|
||||
if (ptr->type==type) return ptr;
|
||||
}
|
||||
/* Well, we are here... need to *CREATE* an entry */
|
||||
ptr = (rfbStatList *)malloc(sizeof(rfbStatList));
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
memset((char *)ptr, 0, sizeof(rfbStatList));
|
||||
ptr->type = type;
|
||||
/* add to the top of the list */
|
||||
ptr->Next = cl->statEncList;
|
||||
cl->statEncList = ptr;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
rfbStatList *rfbStatLookupMessage(rfbClientPtr cl, uint32_t type)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
if (cl==NULL) return NULL;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
{
|
||||
if (ptr->type==type) return ptr;
|
||||
}
|
||||
/* Well, we are here... need to *CREATE* an entry */
|
||||
ptr = (rfbStatList *)malloc(sizeof(rfbStatList));
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
memset((char *)ptr, 0, sizeof(rfbStatList));
|
||||
ptr->type = type;
|
||||
/* add to the top of the list */
|
||||
ptr->Next = cl->statMsgList;
|
||||
cl->statMsgList = ptr;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void rfbStatRecordEncodingSentAdd(rfbClientPtr cl, uint32_t type, int byteCount) /* Specifically for tight encoding */
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
|
||||
ptr = rfbStatLookupEncoding(cl, type);
|
||||
if (ptr!=NULL)
|
||||
ptr->bytesSent += byteCount;
|
||||
}
|
||||
|
||||
|
||||
void rfbStatRecordEncodingSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
|
||||
ptr = rfbStatLookupEncoding(cl, type);
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
ptr->sentCount++;
|
||||
ptr->bytesSent += byteCount;
|
||||
ptr->bytesSentIfRaw += byteIfRaw;
|
||||
}
|
||||
}
|
||||
|
||||
void rfbStatRecordEncodingRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
|
||||
ptr = rfbStatLookupEncoding(cl, type);
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
ptr->rcvdCount++;
|
||||
ptr->bytesRcvd += byteCount;
|
||||
ptr->bytesRcvdIfRaw += byteIfRaw;
|
||||
}
|
||||
}
|
||||
|
||||
void rfbStatRecordMessageSent(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
|
||||
ptr = rfbStatLookupMessage(cl, type);
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
ptr->sentCount++;
|
||||
ptr->bytesSent += byteCount;
|
||||
ptr->bytesSentIfRaw += byteIfRaw;
|
||||
}
|
||||
}
|
||||
|
||||
void rfbStatRecordMessageRcvd(rfbClientPtr cl, uint32_t type, int byteCount, int byteIfRaw)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
|
||||
ptr = rfbStatLookupMessage(cl, type);
|
||||
if (ptr!=NULL)
|
||||
{
|
||||
ptr->rcvdCount++;
|
||||
ptr->bytesRcvd += byteCount;
|
||||
ptr->bytesRcvdIfRaw += byteIfRaw;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int rfbStatGetSentBytes(rfbClientPtr cl)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
int bytes=0;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesSent;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesSent;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int rfbStatGetSentBytesIfRaw(rfbClientPtr cl)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
int bytes=0;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesSentIfRaw;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesSentIfRaw;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int rfbStatGetRcvdBytes(rfbClientPtr cl)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
int bytes=0;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesRcvd;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesRcvd;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int rfbStatGetRcvdBytesIfRaw(rfbClientPtr cl)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
int bytes=0;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesRcvdIfRaw;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
bytes += ptr->bytesRcvdIfRaw;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
int rfbStatGetMessageCountSent(rfbClientPtr cl, uint32_t type)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
if (ptr->type==type) return ptr->sentCount;
|
||||
return 0;
|
||||
}
|
||||
int rfbStatGetMessageCountRcvd(rfbClientPtr cl, uint32_t type)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
if (ptr->type==type) return ptr->rcvdCount;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int rfbStatGetEncodingCountSent(rfbClientPtr cl, uint32_t type)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
if (ptr->type==type) return ptr->sentCount;
|
||||
return 0;
|
||||
}
|
||||
int rfbStatGetEncodingCountRcvd(rfbClientPtr cl, uint32_t type)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
if (cl==NULL) return 0;
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
if (ptr->type==type) return ptr->rcvdCount;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void rfbResetStats(rfbClientPtr cl)
|
||||
{
|
||||
rfbStatList *ptr;
|
||||
if (cl==NULL) return;
|
||||
while (cl->statEncList!=NULL)
|
||||
{
|
||||
ptr = cl->statEncList;
|
||||
cl->statEncList = ptr->Next;
|
||||
free(ptr);
|
||||
}
|
||||
while (cl->statMsgList!=NULL)
|
||||
{
|
||||
ptr = cl->statMsgList;
|
||||
cl->statMsgList = ptr->Next;
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rfbPrintStats(rfbClientPtr cl)
|
||||
{
|
||||
rfbStatList *ptr=NULL;
|
||||
char encBuf[64];
|
||||
double savings=0.0;
|
||||
int totalRects=0;
|
||||
double totalBytes=0.0;
|
||||
double totalBytesIfRaw=0.0;
|
||||
|
||||
char *name=NULL;
|
||||
int bytes=0;
|
||||
int bytesIfRaw=0;
|
||||
int count=0;
|
||||
|
||||
if (cl==NULL) return;
|
||||
|
||||
rfbLog("%-21.21s %-6.6s %9.9s/%9.9s (%6.6s)\n", "Statistics", "events", "Transmit","RawEquiv","saved");
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
{
|
||||
name = messageNameServer2Client(ptr->type, encBuf, sizeof(encBuf));
|
||||
count = ptr->sentCount;
|
||||
bytes = ptr->bytesSent;
|
||||
bytesIfRaw = ptr->bytesSentIfRaw;
|
||||
|
||||
savings = 0.0;
|
||||
if (bytesIfRaw>0.0)
|
||||
savings = 100.0 - (((double)bytes / (double)bytesIfRaw) * 100.0);
|
||||
if ((bytes>0) || (count>0) || (bytesIfRaw>0))
|
||||
rfbLog(" %-20.20s: %6d | %9d/%9d (%5.1f%%)\n",
|
||||
name, count, bytes, bytesIfRaw, savings);
|
||||
totalRects += count;
|
||||
totalBytes += bytes;
|
||||
totalBytesIfRaw += bytesIfRaw;
|
||||
}
|
||||
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
{
|
||||
name = encodingName(ptr->type, encBuf, sizeof(encBuf));
|
||||
count = ptr->sentCount;
|
||||
bytes = ptr->bytesSent;
|
||||
bytesIfRaw = ptr->bytesSentIfRaw;
|
||||
savings = 0.0;
|
||||
|
||||
if (bytesIfRaw>0.0)
|
||||
savings = 100.0 - (((double)bytes / (double)bytesIfRaw) * 100.0);
|
||||
if ((bytes>0) || (count>0) || (bytesIfRaw>0))
|
||||
rfbLog(" %-20.20s: %6d | %9d/%9d (%5.1f%%)\n",
|
||||
name, count, bytes, bytesIfRaw, savings);
|
||||
totalRects += count;
|
||||
totalBytes += bytes;
|
||||
totalBytesIfRaw += bytesIfRaw;
|
||||
}
|
||||
savings=0.0;
|
||||
if (totalBytesIfRaw>0.0)
|
||||
savings = 100.0 - ((totalBytes/totalBytesIfRaw)*100.0);
|
||||
rfbLog(" %-20.20s: %6d | %9.0f/%9.0f (%5.1f%%)\n",
|
||||
"TOTALS", totalRects, totalBytes,totalBytesIfRaw, savings);
|
||||
|
||||
totalRects=0.0;
|
||||
totalBytes=0.0;
|
||||
totalBytesIfRaw=0.0;
|
||||
|
||||
rfbLog("%-21.21s %-6.6s %9.9s/%9.9s (%6.6s)\n", "Statistics", "events", "Received","RawEquiv","saved");
|
||||
for (ptr = cl->statMsgList; ptr!=NULL; ptr=ptr->Next)
|
||||
{
|
||||
name = messageNameClient2Server(ptr->type, encBuf, sizeof(encBuf));
|
||||
count = ptr->rcvdCount;
|
||||
bytes = ptr->bytesRcvd;
|
||||
bytesIfRaw = ptr->bytesRcvdIfRaw;
|
||||
savings = 0.0;
|
||||
|
||||
if (bytesIfRaw>0.0)
|
||||
savings = 100.0 - (((double)bytes / (double)bytesIfRaw) * 100.0);
|
||||
if ((bytes>0) || (count>0) || (bytesIfRaw>0))
|
||||
rfbLog(" %-20.20s: %6d | %9d/%9d (%5.1f%%)\n",
|
||||
name, count, bytes, bytesIfRaw, savings);
|
||||
totalRects += count;
|
||||
totalBytes += bytes;
|
||||
totalBytesIfRaw += bytesIfRaw;
|
||||
}
|
||||
for (ptr = cl->statEncList; ptr!=NULL; ptr=ptr->Next)
|
||||
{
|
||||
name = encodingName(ptr->type, encBuf, sizeof(encBuf));
|
||||
count = ptr->rcvdCount;
|
||||
bytes = ptr->bytesRcvd;
|
||||
bytesIfRaw = ptr->bytesRcvdIfRaw;
|
||||
savings = 0.0;
|
||||
|
||||
if (bytesIfRaw>0.0)
|
||||
savings = 100.0 - (((double)bytes / (double)bytesIfRaw) * 100.0);
|
||||
if ((bytes>0) || (count>0) || (bytesIfRaw>0))
|
||||
rfbLog(" %-20.20s: %6d | %9d/%9d (%5.1f%%)\n",
|
||||
name, count, bytes, bytesIfRaw, savings);
|
||||
totalRects += count;
|
||||
totalBytes += bytes;
|
||||
totalBytesIfRaw += bytesIfRaw;
|
||||
}
|
||||
savings=0.0;
|
||||
if (totalBytesIfRaw>0.0)
|
||||
savings = 100.0 - ((totalBytes/totalBytesIfRaw)*100.0);
|
||||
rfbLog(" %-20.20s: %6d | %9.0f/%9.0f (%5.1f%%)\n",
|
||||
"TOTALS", totalRects, totalBytes,totalBytesIfRaw, savings);
|
||||
|
||||
}
|
||||
|
||||
157
libvncserver/tableinit24.c
Normal file
157
libvncserver/tableinit24.c
Normal file
@@ -0,0 +1,157 @@
|
||||
/*
|
||||
24 bit
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbInitOneRGBTable24 (uint8_t *table, int inMax, int outMax, int outShift,int swap);
|
||||
|
||||
|
||||
static void
|
||||
rfbInitColourMapSingleTable24(char **table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,rfbColourMap* colourMap)
|
||||
{
|
||||
uint32_t i, r, g, b, outValue;
|
||||
uint8_t *t;
|
||||
uint8_t c;
|
||||
unsigned int nEntries = 1 << in->bitsPerPixel;
|
||||
int shift = colourMap->is16?16:8;
|
||||
|
||||
if (*table) free(*table);
|
||||
*table = (char *)malloc(nEntries * 3 + 1);
|
||||
t = (uint8_t *)*table;
|
||||
|
||||
for (i = 0; i < nEntries; i++) {
|
||||
r = g = b = 0;
|
||||
if(i < colourMap->count) {
|
||||
if(colourMap->is16) {
|
||||
r = colourMap->data.shorts[3*i+0];
|
||||
g = colourMap->data.shorts[3*i+1];
|
||||
b = colourMap->data.shorts[3*i+2];
|
||||
} else {
|
||||
r = colourMap->data.bytes[3*i+0];
|
||||
g = colourMap->data.bytes[3*i+1];
|
||||
b = colourMap->data.bytes[3*i+2];
|
||||
}
|
||||
}
|
||||
outValue = ((((r * (1 + out->redMax)) >> shift) << out->redShift) |
|
||||
(((g * (1 + out->greenMax)) >> shift) << out->greenShift) |
|
||||
(((b * (1 + out->blueMax)) >> shift) << out->blueShift));
|
||||
*(uint32_t*)&t[3*i] = outValue;
|
||||
if(!rfbEndianTest)
|
||||
memmove(t+3*i,t+3*i+1,3);
|
||||
if (out->bigEndian != in->bigEndian) {
|
||||
c = t[3*i]; t[3*i] = t[3*i+2]; t[3*i+2] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* rfbInitTrueColourSingleTable sets up a single lookup table for truecolour
|
||||
* translation.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbInitTrueColourSingleTable24 (char **table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out)
|
||||
{
|
||||
int i,outValue;
|
||||
int inRed, inGreen, inBlue, outRed, outGreen, outBlue;
|
||||
uint8_t *t;
|
||||
uint8_t c;
|
||||
int nEntries = 1 << in->bitsPerPixel;
|
||||
|
||||
if (*table) free(*table);
|
||||
*table = (char *)malloc(nEntries * 3 + 1);
|
||||
t = (uint8_t *)*table;
|
||||
|
||||
for (i = 0; i < nEntries; i++) {
|
||||
inRed = (i >> in->redShift) & in->redMax;
|
||||
inGreen = (i >> in->greenShift) & in->greenMax;
|
||||
inBlue = (i >> in->blueShift) & in->blueMax;
|
||||
|
||||
outRed = (inRed * out->redMax + in->redMax / 2) / in->redMax;
|
||||
outGreen = (inGreen * out->greenMax + in->greenMax / 2) / in->greenMax;
|
||||
outBlue = (inBlue * out->blueMax + in->blueMax / 2) / in->blueMax;
|
||||
|
||||
outValue = ((outRed << out->redShift) |
|
||||
(outGreen << out->greenShift) |
|
||||
(outBlue << out->blueShift));
|
||||
*(uint32_t*)&t[3*i] = outValue;
|
||||
if(!rfbEndianTest)
|
||||
memmove(t+3*i,t+3*i+1,3);
|
||||
if (out->bigEndian != in->bigEndian) {
|
||||
c = t[3*i]; t[3*i] = t[3*i+2]; t[3*i+2] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rfbInitTrueColourRGBTables sets up three separate lookup tables for the
|
||||
* red, green and blue values.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbInitTrueColourRGBTables24 (char **table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out)
|
||||
{
|
||||
uint8_t *redTable;
|
||||
uint8_t *greenTable;
|
||||
uint8_t *blueTable;
|
||||
|
||||
if (*table) free(*table);
|
||||
*table = (char *)malloc((in->redMax + in->greenMax + in->blueMax + 3)
|
||||
* 3 + 1);
|
||||
redTable = (uint8_t *)*table;
|
||||
greenTable = redTable + 3*(in->redMax + 1);
|
||||
blueTable = greenTable + 3*(in->greenMax + 1);
|
||||
|
||||
rfbInitOneRGBTable24 (redTable, in->redMax, out->redMax,
|
||||
out->redShift, (out->bigEndian != in->bigEndian));
|
||||
rfbInitOneRGBTable24 (greenTable, in->greenMax, out->greenMax,
|
||||
out->greenShift, (out->bigEndian != in->bigEndian));
|
||||
rfbInitOneRGBTable24 (blueTable, in->blueMax, out->blueMax,
|
||||
out->blueShift, (out->bigEndian != in->bigEndian));
|
||||
}
|
||||
|
||||
static void
|
||||
rfbInitOneRGBTable24 (uint8_t *table, int inMax, int outMax, int outShift,
|
||||
int swap)
|
||||
{
|
||||
int i;
|
||||
int nEntries = inMax + 1;
|
||||
uint32_t outValue;
|
||||
uint8_t c;
|
||||
|
||||
for (i = 0; i < nEntries; i++) {
|
||||
outValue = ((i * outMax + inMax / 2) / inMax) << outShift;
|
||||
*(uint32_t *)&table[3*i] = outValue;
|
||||
if(!rfbEndianTest)
|
||||
memmove(table+3*i,table+3*i+1,3);
|
||||
if (swap) {
|
||||
c = table[3*i]; table[3*i] = table[3*i+2];
|
||||
table[3*i+2] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
84
libvncserver/tableinitcmtemplate.c
Normal file
84
libvncserver/tableinitcmtemplate.c
Normal file
@@ -0,0 +1,84 @@
|
||||
/*
|
||||
* tableinitcmtemplate.c - template for initialising lookup tables for
|
||||
* translation from a colour map to true colour.
|
||||
*
|
||||
* This file shouldn't be compiled. It is included multiple times by
|
||||
* translate.c, each time with a different definition of the macro OUT.
|
||||
* For each value of OUT, this file defines a function which allocates an
|
||||
* appropriately sized lookup table and initialises it.
|
||||
*
|
||||
* I know this code isn't nice to read because of all the macros, but
|
||||
* efficiency is important here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#if !defined(OUT)
|
||||
#error "This file shouldn't be compiled."
|
||||
#error "It is included as part of translate.c"
|
||||
#endif
|
||||
|
||||
#define OUT_T CONCAT3E(uint,OUT,_t)
|
||||
#define SwapOUT(x) CONCAT2E(Swap,OUT(x))
|
||||
#define rfbInitColourMapSingleTableOUT \
|
||||
CONCAT2E(rfbInitColourMapSingleTable,OUT)
|
||||
|
||||
static void
|
||||
rfbInitColourMapSingleTableOUT(char **table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,rfbColourMap* colourMap)
|
||||
{
|
||||
uint32_t i, r, g, b;
|
||||
OUT_T *t;
|
||||
uint32_t nEntries = 1 << in->bitsPerPixel;
|
||||
int shift = colourMap->is16?16:8;
|
||||
|
||||
if (*table) free(*table);
|
||||
*table = (char *)malloc(nEntries * sizeof(OUT_T));
|
||||
t = (OUT_T *)*table;
|
||||
|
||||
for (i = 0; i < nEntries; i++) {
|
||||
r = g = b = 0;
|
||||
if(i < colourMap->count) {
|
||||
if(colourMap->is16) {
|
||||
r = colourMap->data.shorts[3*i+0];
|
||||
g = colourMap->data.shorts[3*i+1];
|
||||
b = colourMap->data.shorts[3*i+2];
|
||||
} else {
|
||||
r = colourMap->data.bytes[3*i+0];
|
||||
g = colourMap->data.bytes[3*i+1];
|
||||
b = colourMap->data.bytes[3*i+2];
|
||||
}
|
||||
}
|
||||
t[i] = ((((r * (1 + out->redMax)) >> shift) << out->redShift) |
|
||||
(((g * (1 + out->greenMax)) >> shift) << out->greenShift) |
|
||||
(((b * (1 + out->blueMax)) >> shift) << out->blueShift));
|
||||
#if (OUT != 8)
|
||||
if (out->bigEndian != in->bigEndian) {
|
||||
t[i] = SwapOUT(t[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#undef OUT_T
|
||||
#undef SwapOUT
|
||||
#undef rfbInitColourMapSingleTableOUT
|
||||
142
libvncserver/tableinittctemplate.c
Normal file
142
libvncserver/tableinittctemplate.c
Normal file
@@ -0,0 +1,142 @@
|
||||
/*
|
||||
* tableinittctemplate.c - template for initialising lookup tables for
|
||||
* truecolour to truecolour translation.
|
||||
*
|
||||
* This file shouldn't be compiled. It is included multiple times by
|
||||
* translate.c, each time with a different definition of the macro OUT.
|
||||
* For each value of OUT, this file defines two functions for initialising
|
||||
* lookup tables. One is for truecolour translation using a single lookup
|
||||
* table, the other is for truecolour translation using three separate
|
||||
* lookup tables for the red, green and blue values.
|
||||
*
|
||||
* I know this code isn't nice to read because of all the macros, but
|
||||
* efficiency is important here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#if !defined(OUT)
|
||||
#error "This file shouldn't be compiled."
|
||||
#error "It is included as part of translate.c"
|
||||
#endif
|
||||
|
||||
#define OUT_T CONCAT3E(uint,OUT,_t)
|
||||
#define SwapOUT(x) CONCAT2E(Swap,OUT(x))
|
||||
#define rfbInitTrueColourSingleTableOUT \
|
||||
CONCAT2E(rfbInitTrueColourSingleTable,OUT)
|
||||
#define rfbInitTrueColourRGBTablesOUT CONCAT2E(rfbInitTrueColourRGBTables,OUT)
|
||||
#define rfbInitOneRGBTableOUT CONCAT2E(rfbInitOneRGBTable,OUT)
|
||||
|
||||
static void
|
||||
rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift,
|
||||
int swap);
|
||||
|
||||
|
||||
/*
|
||||
* rfbInitTrueColourSingleTable sets up a single lookup table for truecolour
|
||||
* translation.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbInitTrueColourSingleTableOUT (char **table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out)
|
||||
{
|
||||
int i;
|
||||
int inRed, inGreen, inBlue, outRed, outGreen, outBlue;
|
||||
OUT_T *t;
|
||||
int nEntries = 1 << in->bitsPerPixel;
|
||||
|
||||
if (*table) free(*table);
|
||||
*table = (char *)malloc(nEntries * sizeof(OUT_T));
|
||||
t = (OUT_T *)*table;
|
||||
|
||||
for (i = 0; i < nEntries; i++) {
|
||||
inRed = (i >> in->redShift) & in->redMax;
|
||||
inGreen = (i >> in->greenShift) & in->greenMax;
|
||||
inBlue = (i >> in->blueShift) & in->blueMax;
|
||||
|
||||
outRed = (inRed * out->redMax + in->redMax / 2) / in->redMax;
|
||||
outGreen = (inGreen * out->greenMax + in->greenMax / 2) / in->greenMax;
|
||||
outBlue = (inBlue * out->blueMax + in->blueMax / 2) / in->blueMax;
|
||||
|
||||
t[i] = ((outRed << out->redShift) |
|
||||
(outGreen << out->greenShift) |
|
||||
(outBlue << out->blueShift));
|
||||
#if (OUT != 8)
|
||||
if (out->bigEndian != in->bigEndian) {
|
||||
t[i] = SwapOUT(t[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rfbInitTrueColourRGBTables sets up three separate lookup tables for the
|
||||
* red, green and blue values.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbInitTrueColourRGBTablesOUT (char **table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out)
|
||||
{
|
||||
OUT_T *redTable;
|
||||
OUT_T *greenTable;
|
||||
OUT_T *blueTable;
|
||||
|
||||
if (*table) free(*table);
|
||||
*table = (char *)malloc((in->redMax + in->greenMax + in->blueMax + 3)
|
||||
* sizeof(OUT_T));
|
||||
redTable = (OUT_T *)*table;
|
||||
greenTable = redTable + in->redMax + 1;
|
||||
blueTable = greenTable + in->greenMax + 1;
|
||||
|
||||
rfbInitOneRGBTableOUT (redTable, in->redMax, out->redMax,
|
||||
out->redShift, (out->bigEndian != in->bigEndian));
|
||||
rfbInitOneRGBTableOUT (greenTable, in->greenMax, out->greenMax,
|
||||
out->greenShift, (out->bigEndian != in->bigEndian));
|
||||
rfbInitOneRGBTableOUT (blueTable, in->blueMax, out->blueMax,
|
||||
out->blueShift, (out->bigEndian != in->bigEndian));
|
||||
}
|
||||
|
||||
static void
|
||||
rfbInitOneRGBTableOUT (OUT_T *table, int inMax, int outMax, int outShift,
|
||||
int swap)
|
||||
{
|
||||
int i;
|
||||
int nEntries = inMax + 1;
|
||||
|
||||
for (i = 0; i < nEntries; i++) {
|
||||
table[i] = ((i * outMax + inMax / 2) / inMax) << outShift;
|
||||
#if (OUT != 8)
|
||||
if (swap) {
|
||||
table[i] = SwapOUT(table[i]);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#undef OUT_T
|
||||
#undef SwapOUT
|
||||
#undef rfbInitTrueColourSingleTableOUT
|
||||
#undef rfbInitTrueColourRGBTablesOUT
|
||||
#undef rfbInitOneRGBTableOUT
|
||||
281
libvncserver/tabletrans24template.c
Normal file
281
libvncserver/tabletrans24template.c
Normal file
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* tabletranstemplate.c - template for translation using lookup tables.
|
||||
*
|
||||
* This file shouldn't be compiled. It is included multiple times by
|
||||
* translate.c, each time with different definitions of the macros IN and OUT.
|
||||
*
|
||||
* For each pair of values IN and OUT, this file defines two functions for
|
||||
* translating a given rectangle of pixel data. One uses a single lookup
|
||||
* table, and the other uses three separate lookup tables for the red, green
|
||||
* and blue values.
|
||||
*
|
||||
* I know this code isn't nice to read because of all the macros, but
|
||||
* efficiency is important here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#if !defined(BPP)
|
||||
#error "This file shouldn't be compiled."
|
||||
#error "It is included as part of translate.c"
|
||||
#endif
|
||||
|
||||
#if BPP == 24
|
||||
|
||||
/*
|
||||
* rfbTranslateWithSingleTableINtoOUT translates a rectangle of pixel data
|
||||
* using a single lookup table.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithSingleTable24to24 (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
uint8_t *ip = (uint8_t *)iptr;
|
||||
uint8_t *op = (uint8_t *)optr;
|
||||
int ipextra = bytesBetweenInputLines - width * 3;
|
||||
uint8_t *opLineEnd;
|
||||
uint8_t *t = (uint8_t *)table;
|
||||
int shift = rfbEndianTest?0:8;
|
||||
uint8_t c;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = op + width*3;
|
||||
|
||||
while (op < opLineEnd) {
|
||||
*(uint32_t*)op = t[((*(uint32_t *)ip)>>shift)&0x00ffffff];
|
||||
if(!rfbEndianTest)
|
||||
memmove(op,op+1,3);
|
||||
if (out->bigEndian != in->bigEndian) {
|
||||
c = op[0]; op[0] = op[2]; op[2] = c;
|
||||
}
|
||||
op += 3;
|
||||
ip += 3;
|
||||
}
|
||||
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* rfbTranslateWithRGBTablesINtoOUT translates a rectangle of pixel data
|
||||
* using three separate lookup tables for the red, green and blue values.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithRGBTables24to24 (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
uint8_t *ip = (uint8_t *)iptr;
|
||||
uint8_t *op = (uint8_t *)optr;
|
||||
int ipextra = bytesBetweenInputLines - width*3;
|
||||
uint8_t *opLineEnd;
|
||||
uint8_t *redTable = (uint8_t *)table;
|
||||
uint8_t *greenTable = redTable + 3*(in->redMax + 1);
|
||||
uint8_t *blueTable = greenTable + 3*(in->greenMax + 1);
|
||||
uint32_t outValue,inValue;
|
||||
int shift = rfbEndianTest?0:8;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = op+3*width;
|
||||
|
||||
while (op < opLineEnd) {
|
||||
inValue = ((*(uint32_t *)ip)>>shift)&0x00ffffff;
|
||||
outValue = (redTable[(inValue >> in->redShift) & in->redMax] |
|
||||
greenTable[(inValue >> in->greenShift) & in->greenMax] |
|
||||
blueTable[(inValue >> in->blueShift) & in->blueMax]);
|
||||
memcpy(op,&outValue,3);
|
||||
op += 3;
|
||||
ip+=3;
|
||||
}
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#define IN_T CONCAT3E(uint,BPP,_t)
|
||||
#define OUT_T CONCAT3E(uint,BPP,_t)
|
||||
#define rfbTranslateWithSingleTable24toOUT \
|
||||
CONCAT4E(rfbTranslateWithSingleTable,24,to,BPP)
|
||||
#define rfbTranslateWithSingleTableINto24 \
|
||||
CONCAT4E(rfbTranslateWithSingleTable,BPP,to,24)
|
||||
#define rfbTranslateWithRGBTables24toOUT \
|
||||
CONCAT4E(rfbTranslateWithRGBTables,24,to,BPP)
|
||||
#define rfbTranslateWithRGBTablesINto24 \
|
||||
CONCAT4E(rfbTranslateWithRGBTables,BPP,to,24)
|
||||
|
||||
/*
|
||||
* rfbTranslateWithSingleTableINtoOUT translates a rectangle of pixel data
|
||||
* using a single lookup table.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithSingleTable24toOUT (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
uint8_t *ip = (uint8_t *)iptr;
|
||||
OUT_T *op = (OUT_T *)optr;
|
||||
int ipextra = bytesBetweenInputLines - width*3;
|
||||
OUT_T *opLineEnd;
|
||||
OUT_T *t = (OUT_T *)table;
|
||||
int shift = rfbEndianTest?0:8;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = op + width;
|
||||
|
||||
while (op < opLineEnd) {
|
||||
*(op++) = t[((*(uint32_t *)ip)>>shift)&0x00ffffff];
|
||||
ip+=3;
|
||||
}
|
||||
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rfbTranslateWithRGBTablesINtoOUT translates a rectangle of pixel data
|
||||
* using three separate lookup tables for the red, green and blue values.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithRGBTables24toOUT (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
uint8_t *ip = (uint8_t *)iptr;
|
||||
OUT_T *op = (OUT_T *)optr;
|
||||
int ipextra = bytesBetweenInputLines - width*3;
|
||||
OUT_T *opLineEnd;
|
||||
OUT_T *redTable = (OUT_T *)table;
|
||||
OUT_T *greenTable = redTable + in->redMax + 1;
|
||||
OUT_T *blueTable = greenTable + in->greenMax + 1;
|
||||
uint32_t inValue;
|
||||
int shift = rfbEndianTest?0:8;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = &op[width];
|
||||
|
||||
while (op < opLineEnd) {
|
||||
inValue = ((*(uint32_t *)ip)>>shift)&0x00ffffff;
|
||||
*(op++) = (redTable[(inValue >> in->redShift) & in->redMax] |
|
||||
greenTable[(inValue >> in->greenShift) & in->greenMax] |
|
||||
blueTable[(inValue >> in->blueShift) & in->blueMax]);
|
||||
ip+=3;
|
||||
}
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* rfbTranslateWithSingleTableINto24 translates a rectangle of pixel data
|
||||
* using a single lookup table.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithSingleTableINto24 (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
IN_T *ip = (IN_T *)iptr;
|
||||
uint8_t *op = (uint8_t *)optr;
|
||||
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
|
||||
uint8_t *opLineEnd;
|
||||
uint8_t *t = (uint8_t *)table;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = op + width * 3;
|
||||
|
||||
while (op < opLineEnd) {
|
||||
memcpy(op,&t[3*(*(ip++))],3);
|
||||
op += 3;
|
||||
}
|
||||
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rfbTranslateWithRGBTablesINto24 translates a rectangle of pixel data
|
||||
* using three separate lookup tables for the red, green and blue values.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithRGBTablesINto24 (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
IN_T *ip = (IN_T *)iptr;
|
||||
uint8_t *op = (uint8_t *)optr;
|
||||
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
|
||||
uint8_t *opLineEnd;
|
||||
uint8_t *redTable = (uint8_t *)table;
|
||||
uint8_t *greenTable = redTable + 3*(in->redMax + 1);
|
||||
uint8_t *blueTable = greenTable + 3*(in->greenMax + 1);
|
||||
uint32_t outValue;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = op+3*width;
|
||||
|
||||
while (op < opLineEnd) {
|
||||
outValue = (redTable[(*ip >> in->redShift) & in->redMax] |
|
||||
greenTable[(*ip >> in->greenShift) & in->greenMax] |
|
||||
blueTable[(*ip >> in->blueShift) & in->blueMax]);
|
||||
memcpy(op,&outValue,3);
|
||||
op += 3;
|
||||
ip++;
|
||||
}
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
#undef IN_T
|
||||
#undef OUT_T
|
||||
#undef rfbTranslateWithSingleTable24toOUT
|
||||
#undef rfbTranslateWithRGBTables24toOUT
|
||||
#undef rfbTranslateWithSingleTableINto24
|
||||
#undef rfbTranslateWithRGBTablesINto24
|
||||
|
||||
#endif
|
||||
117
libvncserver/tabletranstemplate.c
Normal file
117
libvncserver/tabletranstemplate.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/*
|
||||
* tabletranstemplate.c - template for translation using lookup tables.
|
||||
*
|
||||
* This file shouldn't be compiled. It is included multiple times by
|
||||
* translate.c, each time with different definitions of the macros IN and OUT.
|
||||
*
|
||||
* For each pair of values IN and OUT, this file defines two functions for
|
||||
* translating a given rectangle of pixel data. One uses a single lookup
|
||||
* table, and the other uses three separate lookup tables for the red, green
|
||||
* and blue values.
|
||||
*
|
||||
* I know this code isn't nice to read because of all the macros, but
|
||||
* efficiency is important here.
|
||||
*/
|
||||
|
||||
/*
|
||||
* OSXvnc Copyright (C) 2001 Dan McGuirk <mcguirk@incompleteness.net>.
|
||||
* Original Xvnc code Copyright (C) 1999 AT&T Laboratories Cambridge.
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* This is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This software is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
|
||||
* USA.
|
||||
*/
|
||||
|
||||
#if !defined(IN) || !defined(OUT)
|
||||
#error "This file shouldn't be compiled."
|
||||
#error "It is included as part of translate.c"
|
||||
#endif
|
||||
|
||||
#define IN_T CONCAT3E(uint,IN,_t)
|
||||
#define OUT_T CONCAT3E(uint,OUT,_t)
|
||||
#define rfbTranslateWithSingleTableINtoOUT \
|
||||
CONCAT4E(rfbTranslateWithSingleTable,IN,to,OUT)
|
||||
#define rfbTranslateWithRGBTablesINtoOUT \
|
||||
CONCAT4E(rfbTranslateWithRGBTables,IN,to,OUT)
|
||||
|
||||
/*
|
||||
* rfbTranslateWithSingleTableINtoOUT translates a rectangle of pixel data
|
||||
* using a single lookup table.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithSingleTableINtoOUT (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
IN_T *ip = (IN_T *)iptr;
|
||||
OUT_T *op = (OUT_T *)optr;
|
||||
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
|
||||
OUT_T *opLineEnd;
|
||||
OUT_T *t = (OUT_T *)table;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = op + width;
|
||||
|
||||
while (op < opLineEnd) {
|
||||
*(op++) = t[*(ip++)];
|
||||
}
|
||||
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* rfbTranslateWithRGBTablesINtoOUT translates a rectangle of pixel data
|
||||
* using three separate lookup tables for the red, green and blue values.
|
||||
*/
|
||||
|
||||
static void
|
||||
rfbTranslateWithRGBTablesINtoOUT (char *table, rfbPixelFormat *in,
|
||||
rfbPixelFormat *out,
|
||||
char *iptr, char *optr,
|
||||
int bytesBetweenInputLines,
|
||||
int width, int height)
|
||||
{
|
||||
IN_T *ip = (IN_T *)iptr;
|
||||
OUT_T *op = (OUT_T *)optr;
|
||||
int ipextra = bytesBetweenInputLines / sizeof(IN_T) - width;
|
||||
OUT_T *opLineEnd;
|
||||
OUT_T *redTable = (OUT_T *)table;
|
||||
OUT_T *greenTable = redTable + in->redMax + 1;
|
||||
OUT_T *blueTable = greenTable + in->greenMax + 1;
|
||||
|
||||
while (height > 0) {
|
||||
opLineEnd = &op[width];
|
||||
|
||||
while (op < opLineEnd) {
|
||||
*(op++) = (redTable[(*ip >> in->redShift) & in->redMax] |
|
||||
greenTable[(*ip >> in->greenShift) & in->greenMax] |
|
||||
blueTable[(*ip >> in->blueShift) & in->blueMax]);
|
||||
ip++;
|
||||
}
|
||||
ip += ipextra;
|
||||
height--;
|
||||
}
|
||||
}
|
||||
|
||||
#undef IN_T
|
||||
#undef OUT_T
|
||||
#undef rfbTranslateWithSingleTableINtoOUT
|
||||
#undef rfbTranslateWithRGBTablesINtoOUT
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user