[-]
[+]
|
Changed |
libguac.changes
|
|
[-]
[+]
|
Changed |
libguac.spec
^
|
|
[-]
[+]
|
Deleted |
libguac-0.6.3.tar.bz2/tests/test_protocol.c
^
|
@@ -1,58 +0,0 @@
-
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is libguac.
- *
- * The Initial Developer of the Original Code is
- * Michael Jumper.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <CUnit/Basic.h>
-
-#include "protocol/suite.h"
-
-int main() {
-
- /* Init registry */
- if (CU_initialize_registry() != CUE_SUCCESS)
- return CU_get_error();
-
- /* Register suites */
- register_protocol_suite();
-
- /* Run tests */
- CU_basic_set_mode(CU_BRM_VERBOSE);
- CU_basic_run_tests();
- CU_cleanup_registry();
- return CU_get_error();
-
-}
-
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/ChangeLog
^
|
@@ -1,3 +1,18 @@
+2012-10-25 Michael Jumper <zhangmzike@users.sourceforge.net>
+
+ * Implement video instruction
+ * Implement chunked write versions of audio/video functions
+
+2012-10-24 Michael Jumper <zhangmzike@users.sourceforge.net>
+
+ * Implement audio instruction
+
+2012-10-22 Michael Jumper <zhangmzike@users.sourceforge.net>
+
+ * Implement protocol nesting (via "nest" instruction)
+ * Add size events
+ * Add guac_client_info structure to be populated during handshake
+
2012-07-23 Michael Jumper <zhangmaike@users.sourceforge.net>
* Add unit tests for Unicode in protocol
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/Makefile.in
^
|
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -51,6 +51,23 @@
#
# ***** END LICENSE BLOCK *****
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -95,6 +112,11 @@
install-pdf-recursive install-ps-recursive install-recursive \
installcheck-recursive installdirs-recursive pdf-recursive \
ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
@@ -477,13 +499,10 @@
done
@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- fi; \
- done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
- if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
$(am__relativize); \
new_distdir=$$reldir; \
@@ -569,7 +588,7 @@
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod a+w $(distdir)
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/aclocal.m4
^
|
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@@ -38,7 +38,7 @@
[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.3], [],
+m4_if([$1], [1.11.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -54,7 +54,7 @@
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.3])dnl
+[AM_AUTOMAKE_VERSION([1.11.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/config.guess
^
|
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2012-01-01'
+timestamp='2012-02-10'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -17,9 +17,7 @@
# 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.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -863,6 +861,13 @@
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ aarch64:Linux:*:*)
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
+ aarch64_be:Linux:*:*)
+ UNAME_MACHINE=aarch64_be
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
+ exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
@@ -1320,6 +1325,9 @@
i*86:AROS:*:*)
echo ${UNAME_MACHINE}-pc-aros
exit ;;
+ x86_64:VMkernel:*:*)
+ echo ${UNAME_MACHINE}-unknown-esx
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/config.sub
^
|
@@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc.
-timestamp='2012-01-01'
+timestamp='2012-02-10'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -21,9 +21,7 @@
# 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.
+# along with this program; if not, see <http://www.gnu.org/licenses/>.
#
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -132,6 +130,10 @@
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
+ android-linux)
+ os=-linux-android
+ basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
+ ;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -247,6 +249,7 @@
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
+ | aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
@@ -319,7 +322,7 @@
c6x)
basic_machine=tic6x-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12 | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip)
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -332,7 +335,10 @@
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
-
+ xgate)
+ basic_machine=$basic_machine-unknown
+ os=-none
+ ;;
xscaleeb)
basic_machine=armeb-unknown
;;
@@ -355,6 +361,7 @@
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
+ | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/configure
^
|
@@ -2688,7 +2688,7 @@
# Define the identity of the package.
PACKAGE=libguac
- VERSION=0.6.3
+ VERSION=0.7.0
cat >>confdefs.h <<_ACEOF
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/configure.in
^
|
@@ -35,7 +35,7 @@
# ***** END LICENSE BLOCK *****
AC_INIT(src/client.c)
-AM_INIT_AUTOMAKE(libguac, 0.6.3)
+AM_INIT_AUTOMAKE(libguac, 0.7.0)
AC_CONFIG_MACRO_DIR([m4])
# Checks for programs.
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/depcomp
^
|
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2011-12-04.11; # UTC
+scriptversion=2012-03-27.16; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2010,
-# 2011 Free Software Foundation, Inc.
+# 2011, 2012 Free Software Foundation, Inc.
# 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
@@ -28,7 +28,7 @@
case $1 in
'')
- echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
@@ -40,8 +40,8 @@
Environment variables:
depmode Dependency tracking mode.
- source Source file read by `PROGRAMS ARGS'.
- object Object file output by `PROGRAMS ARGS'.
+ source Source file read by 'PROGRAMS ARGS'.
+ object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputting dependencies.
@@ -57,6 +57,12 @@
;;
esac
+# A tabulation character.
+tab=' '
+# A newline character.
+nl='
+'
+
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
@@ -102,6 +108,12 @@
depmode=msvc7
fi
+if test "$depmode" = xlc; then
+ # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency informations.
+ gccflag=-qmakedep=gcc,-MF
+ depmode=gcc
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -156,15 +168,14 @@
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
+## This next piece of magic avoids the "deleted header file" problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
- tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'. On the theory
+ tr ' ' "$nl" < "$tmpdepfile" |
+## Some versions of gcc put a space before the ':'. On the theory
## that the space means something, we add a space to the output as
## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
@@ -203,18 +214,15 @@
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
- # the IRIX cc adds comments like `#:fec' to the end of the
+ # the IRIX cc adds comments like '#:fec' to the end of the
# dependency line.
- tr ' ' '
-' < "$tmpdepfile" \
+ tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
- tr '
-' ' ' >> "$depfile"
+ tr "$nl" ' ' >> "$depfile"
echo >> "$depfile"
# The second pass generates a dummy entry for each header file.
- tr ' ' '
-' < "$tmpdepfile" \
+ tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> "$depfile"
else
@@ -226,10 +234,17 @@
rm -f "$tmpdepfile"
;;
+xlc)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
- # current directory. Also, the AIX compiler puts `$object:' at the
+ # current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
@@ -259,12 +274,11 @@
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
- # Each line is of the form `foo.o: dependent.h'.
+ # Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -275,23 +289,26 @@
;;
icc)
- # Intel's C compiler understands `-MD -MF file'. However on
- # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # Intel's C compiler anf tcc (Tiny C Compiler) understand '-MD -MF file'.
+ # However on
+ # $CC -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
- # which is wrong. We want:
+ # which is wrong. We want
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
- # and will wrap long lines using \ :
+ # and will wrap long lines using '\':
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
-
+ # tcc 0.9.26 (FIXME still under development at the moment of writing)
+ # will emit a similar output, but also prepend the continuation lines
+ # with horizontal tabulation characters.
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
@@ -300,15 +317,21 @@
exit $stat
fi
rm -f "$depfile"
- # Each line is of the form `foo.o: dependent.h',
- # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Each line is of the form 'foo.o: dependent.h',
+ # or 'foo.o: dep1.h dep2.h \', or ' dep3.h dep4.h \'.
# Do two passes, one to just change these to
- # `$object: dependent.h' and one to simply `dependent.h:'.
- sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
- # Some versions of the HPUX 10.20 sed can't process this invocation
- # correctly. Breaking it into two sed invocations is a workaround.
- sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
- sed -e 's/$/ :/' >> "$depfile"
+ # '$object: dependent.h' and one to simply 'dependent.h:'.
+ sed -e "s/^[ $tab][ $tab]*/ /" -e "s,^[^:]*:,$object :," \
+ < "$tmpdepfile" > "$depfile"
+ sed '
+ s/[ '"$tab"'][ '"$tab"']*/ /g
+ s/^ *//
+ s/ *\\*$//
+ s/^[^:]*: *//
+ /^$/d
+ /:$/d
+ s/$/ :/
+ ' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile"
;;
@@ -344,7 +367,7 @@
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
- # Add `dependent.h:' lines.
+ # Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
s/ \\*$//
@@ -359,9 +382,9 @@
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
- # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
- # dependencies in `foo.d' instead, so we check for that too.
+ # dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
@@ -407,8 +430,7 @@
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- # That's a tab and a space in the [].
- sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@@ -443,11 +465,11 @@
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
-s/\(.*\)/ \1 \\/p
+s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
- s/.*/ /
+ s/.*/'"$tab"'/
G
p
}' >> "$depfile"
@@ -478,7 +500,7 @@
shift
fi
- # Remove `-o $object'.
+ # Remove '-o $object'.
IFS=" "
for arg
do
@@ -498,15 +520,14 @@
done
test -z "$dashmflag" && dashmflag=-M
- # Require at least two characters before searching for `:'
+ # Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames:
- # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag |
- sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ sed 's:^['"$tab"' ]*[^:'"$tab"' ][^:][^:]*\:['"$tab"' ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
- tr ' ' '
-' < "$tmpdepfile" | \
+ tr ' ' "$nl" < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -562,8 +583,7 @@
# makedepend may prepend the VPATH from the source file name to the object.
# No need to regex-escape $object, excess matching of '.' is harmless.
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
- sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
+ sed '1,2d' "$tmpdepfile" | tr ' ' "$nl" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
@@ -583,7 +603,7 @@
shift
fi
- # Remove `-o $object'.
+ # Remove '-o $object'.
IFS=" "
for arg
do
@@ -652,8 +672,8 @@
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
- echo " " >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
+ echo "$tab" >> "$depfile"
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/doc/Doxyfile
^
|
@@ -31,7 +31,7 @@
# This could be handy for archiving the generated documentation or
# if some version control system is used.
-PROJECT_NUMBER = 0.6.1
+PROJECT_NUMBER = 0.7.0
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
# base path where the generated documentation will be put.
@@ -384,7 +384,7 @@
# will put a list of the files that are included by a file in the documentation
# of that file.
-SHOW_INCLUDE_FILES = YES
+SHOW_INCLUDE_FILES = NO
# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
# will list include files with double quotes in the documentation
@@ -1171,7 +1171,7 @@
# generate an XML file that captures the structure of
# the code including all documentation.
-GENERATE_XML = NO
+GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/include/client-handlers.h
^
|
@@ -39,7 +39,7 @@
#define _GUAC_CLIENT_HANDLERS__H
#include "client.h"
-#include "protocol.h"
+#include "instruction.h"
/**
* Provides initial handler functions and a lookup structure for automatically
@@ -100,6 +100,13 @@
int __guac_handle_clipboard(guac_client* client, guac_instruction* instruction);
/**
+ * Internal initial handler for the size instruction. When a size instruction
+ * is received, this handler will be called. The client's size handler will
+ * be invoked if defined.
+ */
+int __guac_handle_size(guac_client* client, guac_instruction* instruction);
+
+/**
* Internal initial handler for the disconnect instruction. When a disconnect instruction
* is received, this handler will be called. Disconnect instructions are automatically
* handled, thus there is no client handler for disconnect instruction.
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/include/client.h
^
|
@@ -41,8 +41,12 @@
#include <stdarg.h>
+#include "instruction.h"
+#include "layer.h"
+#include "pool.h"
#include "socket.h"
-#include "protocol.h"
+#include "stream.h"
+#include "timestamp.h"
/**
* Provides functions and structures required for defining (and handling) a proxy client.
@@ -50,40 +54,7 @@
* @file client.h
*/
-/**
- * String prefix which begins the library filename of all client plugins.
- */
-#define GUAC_PROTOCOL_LIBRARY_PREFIX "libguac-client-"
-
-/**
- * String suffix which ends the library filename of all client plugins.
- */
-#define GUAC_PROTOCOL_LIBRARY_SUFFIX ".so"
-
-/**
- * The maximum number of characters (COUNTING NULL TERMINATOR) to allow
- * for protocol names within the library filename of client plugins.
- */
-#define GUAC_PROTOCOL_NAME_LIMIT 256
-
-/**
- * The maximum number of characters (INCLUDING NULL TERMINATOR) that a
- * character array containing the concatenation of the library prefix,
- * protocol name, and suffix can contain, assuming the protocol name is
- * limited to GUAC_PROTOCOL_NAME_LIMIT characters.
- */
-#define GUAC_PROTOCOL_LIBRARY_LIMIT ( \
- \
- sizeof(GUAC_PROTOCOL_LIBRARY_PREFIX) - 1 /* "libguac-client-" */ \
- + GUAC_PROTOCOL_NAME_LIMIT - 1 /* [up to 256 chars] */ \
- + sizeof(GUAC_PROTOCOL_LIBRARY_SUFFIX) - 1 /* ".so" */ \
- + 1 /* NULL terminator */ \
- \
-)
-
-
typedef struct guac_client guac_client;
-typedef struct guac_client_plugin guac_client_plugin;
/**
* Handler for server messages (where "server" refers to the server that
@@ -107,6 +78,22 @@
typedef int guac_client_clipboard_handler(guac_client* client, char* copied);
/**
+ * Handler for Guacamole screen size events.
+ */
+typedef int guac_client_size_handler(guac_client* client,
+ int width, int height);
+
+/**
+ * Handler for Guacamole audio format events.
+ */
+typedef int guac_client_audio_handler(guac_client* client, char* mimetype);
+
+/**
+ * Handler for Guacamole video format events.
+ */
+typedef int guac_client_video_handler(guac_client* client, char* mimetype);
+
+/**
* Handler for freeing up any extra data allocated by the client
* implementation.
*/
@@ -184,31 +171,40 @@
} guac_client_state;
/**
- * A handle to a client plugin, containing enough information about the
- * plugin to complete the initial protocol handshake and instantiate a new
- * client supporting the protocol provided by the client plugin.
+ * Information exposed by the remote client during the connection handshake
+ * which can be used by a client plugin.
*/
-struct guac_client_plugin {
+typedef struct guac_client_info {
/**
- * Reference to dlopen'd client plugin.
+ * The number of pixels the remote client requests for the display width.
+ * This need not be honored by a client plugin implementation, but if the
+ * underlying protocol of the client plugin supports dynamic sizing of the
+ * screen, honoring the display size request is recommended.
*/
- void* __client_plugin_handle;
+ int optimal_width;
/**
- * Reference to the init handler of this client plugin. This
- * function will be called when the client plugin is started.
+ * The number of pixels the remote client requests for the display height.
+ * This need not be honored by a client plugin implementation, but if the
+ * underlying protocol of the client plugin supports dynamic sizing of the
+ * screen, honoring the display size request is recommended.
*/
- guac_client_init_handler* init_handler;
+ int optimal_height;
/**
- * NULL-terminated array of all arguments accepted by this client
- * plugin, in order. The values of these arguments will be passed
- * to the init_handler if the client plugin is started.
+ * NULL-terminated array of client-supported audio mimetypes. If the client
+ * does not support audio at all, this will be NULL.
*/
- const char** args;
+ const char** audio_mimetypes;
-};
+ /**
+ * NULL-terminated array of client-supported video mimetypes. If the client
+ * does not support video at all, this will be NULL.
+ */
+ const char** video_mimetypes;
+
+} guac_client_info;
/**
* Guacamole proxy client.
@@ -248,6 +244,12 @@
guac_timestamp last_sent_timestamp;
/**
+ * Information structure containing properties exposed by the remote
+ * client during the initial handshake process.
+ */
+ guac_client_info info;
+
+ /**
* Arbitrary reference to proxy client-specific data. Implementors of a
* Guacamole proxy client can store any data they want here, which can then
* be retrieved as necessary in the message handlers.
@@ -337,6 +339,23 @@
guac_client_clipboard_handler* clipboard_handler;
/**
+ * Handler for size events sent by the Guacamole web-client.
+ *
+ * The handler takes an integer width and integer height, representing
+ * the current visible screen area of the client.
+ *
+ * Example:
+ * @code
+ * int size_handler(guac_client* client, int width, int height);
+ *
+ * int guac_client_init(guac_client* client, int argc, char** argv) {
+ * client->size_handler = size_handler;
+ * }
+ * @endcode
+ */
+ guac_client_size_handler* size_handler;
+
+ /**
* Handler for freeing data when the client is being unloaded.
*
* This handler will be called when the client needs to be unloaded
@@ -409,84 +428,33 @@
guac_client_log_handler* log_error_handler;
/**
- * The index of the next available buffer.
- */
- int __next_buffer_index;
-
- /**
- * The head pointer of the list of all available (allocated but not used)
- * buffers.
- */
- guac_layer* __available_buffers;
-
- /**
- * Pointer to the last buffer in the list of all available buffers.
+ * Pool of buffer indices. Buffers are simply layers with negative indices.
+ * Note that because guac_pool always gives non-negative indices starting
+ * at 0, the output of this guac_pool will be adjusted.
*/
- guac_layer* __last_available_buffer;
+ guac_pool* __buffer_pool;
/**
- * The index of the next available layer.
+ * Pool of layer indices. Note that because guac_pool always gives
+ * non-negative indices starting at 0, the output of this guac_pool will
+ * be adjusted.
*/
- int __next_layer_index;
+ guac_pool* __layer_pool;
/**
- * The head pointer of the list of all available (allocated but not used)
- * layers.
+ * Pool of stream indices.
*/
- guac_layer* __available_layers;
-
- /**
- * Pointer to the last layer in the list of all available layers.
- */
- guac_layer* __last_available_layer;
-
- /**
- * The head pointer of the list of all allocated layers, regardless of use
- * status.
- */
- guac_layer* __all_layers;
+ guac_pool* __stream_pool;
};
/**
- * Open the plugin which provides support for the given protocol, if it
- * exists.
- *
- * @param protocol The name of the protocol to retrieve the client plugin
- * for.
- * @return The client plugin supporting the given protocol, or NULL if
- * an error occurs or no such plugin exists.
- */
-guac_client_plugin* guac_client_plugin_open(const char* protocol);
-
-/**
- * Close the given plugin, releasing all associated resources. This function
- * must be called after use of a client plugin is finished.
+ * Returns a new, barebones guac_client. This new guac_client has no handlers
+ * set, but is otherwise usable.
*
- * @param plugin The client plugin to close.
- * @return Zero on success, non-zero if an error occurred while releasing
- * the resources associated with the plugin.
+ * @return A pointer to the new client.
*/
-int guac_client_plugin_close(guac_client_plugin* plugin);
-
-/**
- * Initialize and return a new guac_client. The pluggable client will be
- * initialized using the arguments provided.
- *
- * @param plugin The client plugin to use to create the new client.
- * @param socket The guac_socket the client should use for communication.
- * @param argc The number of arguments being passed to the client.
- * @param argv All arguments to be passed to the client.
- * @param log_info_handler Info logging handler to provide to the client before
- * initializing.
- * @param log_error_handler Error logging handler to provide to the client
- * before initializing.
- * @return A pointer to the newly initialized client.
- */
-guac_client* guac_client_plugin_get_client(guac_client_plugin* plugin,
- guac_socket* socket, int argc, char** argv,
- guac_client_log_handler* log_info_handler,
- guac_client_log_handler* log_error_handler);
+guac_client* guac_client_alloc();
/**
* Free all resources associated with the given client.
@@ -508,43 +476,6 @@
int guac_client_handle_instruction(guac_client* client, guac_instruction* instruction);
/**
- * Allocates a new buffer (invisible layer). An arbitrary index is
- * automatically assigned if no existing buffer is available for use.
- *
- * @param client The proxy client to allocate the buffer for.
- * @return The next available buffer, or a newly allocated buffer.
- */
-guac_layer* guac_client_alloc_buffer(guac_client* client);
-
-/**
- * Allocates a new layer. An arbitrary index is automatically assigned
- * if no existing layer is available for use.
- *
- * @param client The proxy client to allocate the layer buffer for.
- * @return The next available layer, or a newly allocated layer.
- */
-guac_layer* guac_client_alloc_layer(guac_client* client);
-
-/**
- * Returns the given buffer to the pool of available buffers, such that it
- * can be reused by any subsequent call to guac_client_allow_buffer().
- *
- * @param client The proxy client to return the buffer to.
- * @param layer The buffer to return to the pool of available buffers.
- */
-void guac_client_free_buffer(guac_client* client, guac_layer* layer);
-
-/**
- * Returns the given layer to the pool of available layers, such that it
- * can be reused by any subsequent call to guac_client_allow_layer().
- *
- * @param client The proxy client to return the layer to.
- * @param layer The buffer to return to the pool of available layer.
- */
-void guac_client_free_layer(guac_client* client, guac_layer* layer);
-
-
-/**
* Logs an informational message in the log used by the given client. The
* logger used will normally be defined by guacd (or whichever program loads
* the proxy client) by setting the logging handlers of the client when it is
@@ -604,6 +535,61 @@
void guac_client_stop(guac_client* client);
/**
+ * Allocates a new buffer (invisible layer). An arbitrary index is
+ * automatically assigned if no existing buffer is available for use.
+ *
+ * @param client The proxy client to allocate the buffer for.
+ * @return The next available buffer, or a newly allocated buffer.
+ */
+guac_layer* guac_client_alloc_buffer(guac_client* client);
+
+/**
+ * Allocates a new layer. An arbitrary index is automatically assigned
+ * if no existing layer is available for use.
+ *
+ * @param client The proxy client to allocate the layer buffer for.
+ * @return The next available layer, or a newly allocated layer.
+ */
+guac_layer* guac_client_alloc_layer(guac_client* client);
+
+/**
+ * Returns the given buffer to the pool of available buffers, such that it
+ * can be reused by any subsequent call to guac_client_allow_buffer().
+ *
+ * @param client The proxy client to return the buffer to.
+ * @param layer The buffer to return to the pool of available buffers.
+ */
+void guac_client_free_buffer(guac_client* client, guac_layer* layer);
+
+/**
+ * Returns the given layer to the pool of available layers, such that it
+ * can be reused by any subsequent call to guac_client_allow_layer().
+ *
+ * @param client The proxy client to return the layer to.
+ * @param layer The buffer to return to the pool of available layer.
+ */
+void guac_client_free_layer(guac_client* client, guac_layer* layer);
+
+/**
+ * Allocates a new stream. An arbitrary index is automatically assigned
+ * if no previously-allocated stream is available for use.
+ *
+ * @param client The proxy client to allocate the layer buffer for.
+ * @return The next available stream, or a newly allocated stream.
+ */
+guac_stream* guac_client_alloc_stream(guac_client* client);
+
+/**
+ * Returns the given stream to the pool of available streams, such that it
+ * can be reused by any subsequent call to guac_client_alloc_stream().
+ *
+ * @param client The proxy client to return the buffer to.
+ * @param stream The stream to return to the pool of available stream.
+ */
+void guac_client_free_stream(guac_client* client, guac_stream* stream);
+
+
+/**
* The default Guacamole client layer, layer 0.
*/
extern const guac_layer* GUAC_DEFAULT_LAYER;
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/hash.h
^
|
@@ -0,0 +1,76 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_HASH_H
+#define _GUAC_HASH_H
+
+#include <cairo/cairo.h>
+
+/**
+ * Provides functions and structures for producing likely-to-be-unique hash
+ * values for images.
+ *
+ * @file hash.h
+ */
+
+/**
+ * Produces a 24-bit hash value from all pixels of the given surface. The
+ * surface provided must be RGB or ARGB with each pixel stored in 32 bits.
+ * The hashing algorithm used is a variant of the cyclic polynomial rolling
+ * hash.
+ *
+ * @param surface The Cairo surface to hash.
+ * @return An arbitrary 24-bit unsigned integer value intended to be well
+ * distributed across different images.
+ */
+unsigned int guac_hash_surface(cairo_surface_t* surface);
+
+/**
+ * Given two Cairo surfaces, returns zero if the data contained within each
+ * is identical, and a positive or negative value if the value of the first
+ * is found to be lexically greater or less than the second respectively.
+ *
+ * @param a The first Cairo surface to compare.
+ * @param b The Cairo surface to compare the first surface against.
+ * @return Zero if the data contained within each is identical, and a positive
+ * or negative value if the value of the first is found to be lexically
+ * greater or less than the second respectively.
+ */
+int guac_surface_cmp(cairo_surface_t* a, cairo_surface_t* b);
+
+#endif
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/instruction.h
^
|
@@ -0,0 +1,133 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_INSTRUCTION_H
+#define _GUAC_INSTRUCTION_H
+
+#include "socket.h"
+
+/**
+ * Provides functions and structures for reading, writing, and manipulating
+ * Guacamole instructions.
+ *
+ * @file instruction.h
+ */
+
+/**
+ * Represents a single instruction within the Guacamole protocol.
+ */
+typedef struct guac_instruction {
+
+ /**
+ * The opcode of the instruction.
+ */
+ char* opcode;
+
+ /**
+ * The number of arguments passed to this instruction.
+ */
+ int argc;
+
+ /**
+ * Array of all arguments passed to this instruction.
+ */
+ char** argv;
+
+} guac_instruction;
+
+
+/**
+ * Frees all memory allocated to the given instruction.
+ *
+ * @param instruction The instruction to free.
+ */
+void guac_instruction_free(guac_instruction* instruction);
+
+/**
+ * Returns whether new instruction data is available on the given guac_socket
+ * connection for parsing.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param usec_timeout The maximum number of microseconds to wait before
+ * giving up.
+ * @return A positive value if data is available, negative on error, or
+ * zero if no data is currently available.
+ */
+int guac_instruction_waiting(guac_socket* socket, int usec_timeout);
+
+/**
+ * Reads a single instruction from the given guac_socket connection.
+ *
+ * If an error occurs reading the instruction, NULL is returned,
+ * and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param usec_timeout The maximum number of microseconds to wait before
+ * giving up.
+ * @return A new instruction if data was successfully read, NULL on
+ * error or if the instruction could not be read completely
+ * because the timeout elapsed, in which case guac_error will be
+ * set to GUAC_STATUS_INPUT_TIMEOUT and subsequent calls to
+ * guac_protocol_read_instruction() will return the parsed instruction
+ * once enough data is available.
+ */
+guac_instruction* guac_instruction_read(guac_socket* socket, int usec_timeout);
+
+/**
+ * Reads a single instruction with the given opcode from the given guac_socket
+ * connection.
+ *
+ * If an error occurs reading the instruction, NULL is returned,
+ * and guac_error is set appropriately.
+ *
+ * If the instruction read is not the expected instruction, NULL is returned,
+ * and guac_error is set to GUAC_STATUS_BAD_STATE.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param usec_timeout The maximum number of microseconds to wait before
+ * giving up.
+ * @param opcode The opcode of the instruction to read.
+ * @return A new instruction if an instruction with the given opcode was read,
+ * NULL otherwise. If an instruction was read, but the instruction had
+ * a different opcode, NULL is returned and guac_error is set to
+ * GUAC_STATUS_BAD_STATE.
+ */
+guac_instruction* guac_instruction_expect(guac_socket* socket,
+ int usec_timeout, const char* opcode);
+
+#endif
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/layer.h
^
|
@@ -0,0 +1,62 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_LAYER_H
+#define _GUAC_LAYER_H
+
+/**
+ * Provides functions and structures required for allocating and using layers.
+ *
+ * @file layer.h
+ */
+
+typedef struct guac_layer guac_layer;
+
+/**
+ * Represents a single layer within the Guacamole protocol.
+ */
+struct guac_layer {
+
+ /**
+ * The index of this layer.
+ */
+ int index;
+
+};
+
+#endif
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/plugin.h
^
|
@@ -0,0 +1,144 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+#ifndef _GUAC_PLUGIN_H
+#define _GUAC_PLUGIN_H
+
+#include "client.h"
+
+/**
+ * Provides functions and structures required for handling a client plugin.
+ *
+ * @file plugin.h
+ */
+
+/**
+ * String prefix which begins the library filename of all client plugins.
+ */
+#define GUAC_PROTOCOL_LIBRARY_PREFIX "libguac-client-"
+
+/**
+ * String suffix which ends the library filename of all client plugins.
+ */
+#define GUAC_PROTOCOL_LIBRARY_SUFFIX ".so"
+
+/**
+ * The maximum number of characters (COUNTING NULL TERMINATOR) to allow
+ * for protocol names within the library filename of client plugins.
+ */
+#define GUAC_PROTOCOL_NAME_LIMIT 256
+
+/**
+ * The maximum number of characters (INCLUDING NULL TERMINATOR) that a
+ * character array containing the concatenation of the library prefix,
+ * protocol name, and suffix can contain, assuming the protocol name is
+ * limited to GUAC_PROTOCOL_NAME_LIMIT characters.
+ */
+#define GUAC_PROTOCOL_LIBRARY_LIMIT ( \
+ \
+ sizeof(GUAC_PROTOCOL_LIBRARY_PREFIX) - 1 /* "libguac-client-" */ \
+ + GUAC_PROTOCOL_NAME_LIMIT - 1 /* [up to 256 chars] */ \
+ + sizeof(GUAC_PROTOCOL_LIBRARY_SUFFIX) - 1 /* ".so" */ \
+ + 1 /* NULL terminator */ \
+ \
+)
+
+typedef struct guac_client_plugin guac_client_plugin;
+
+/**
+ * A handle to a client plugin, containing enough information about the
+ * plugin to complete the initial protocol handshake and instantiate a new
+ * client supporting the protocol provided by the client plugin.
+ */
+struct guac_client_plugin {
+
+ /**
+ * Reference to dlopen'd client plugin.
+ */
+ void* __client_plugin_handle;
+
+ /**
+ * Reference to the init handler of this client plugin. This
+ * function will be called when the client plugin is started.
+ */
+ guac_client_init_handler* init_handler;
+
+ /**
+ * NULL-terminated array of all arguments accepted by this client
+ * plugin, in order. The values of these arguments will be passed
+ * to the init_handler if the client plugin is started.
+ */
+ const char** args;
+
+};
+
+/**
+ * Open the plugin which provides support for the given protocol, if it
+ * exists.
+ *
+ * @param protocol The name of the protocol to retrieve the client plugin
+ * for.
+ * @return The client plugin supporting the given protocol, or NULL if
+ * an error occurs or no such plugin exists.
+ */
+guac_client_plugin* guac_client_plugin_open(const char* protocol);
+
+/**
+ * Close the given plugin, releasing all associated resources. This function
+ * must be called after use of a client plugin is finished.
+ *
+ * @param plugin The client plugin to close.
+ * @return Zero on success, non-zero if an error occurred while releasing
+ * the resources associated with the plugin.
+ */
+int guac_client_plugin_close(guac_client_plugin* plugin);
+
+/**
+ * Initializes the given guac_client using the initialization routine provided
+ * by the given guac_client_plugin.
+ *
+ * @param plugin The client plugin to use to initialize the new client.
+ * @param client The guac_client to initialize.
+ * @param argc The number of arguments being passed to the client.
+ * @param argv All arguments to be passed to the client.
+ * @return Zero if initialization was successful, non-zero otherwise.
+ */
+int guac_client_plugin_init_client(guac_client_plugin* plugin,
+ guac_client* client, int argc, char** argv);
+
+#endif
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/pool.h
^
|
@@ -0,0 +1,140 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_POOL_H
+#define _GUAC_POOL_H
+
+/**
+ * Provides functions and structures for maintaining dynamically allocated and
+ * freed pools of integers.
+ *
+ * @file pool.h
+ */
+
+typedef struct guac_pool_int guac_pool_int;
+
+/**
+ * A pool of integers. Integers can be removed from and later free'd back
+ * into the pool. New integers are returned when the pool is exhausted,
+ * or when the pool has not met some minimum size. Old, free'd integers
+ * are returned otherwise.
+ */
+typedef struct guac_pool {
+
+ /**
+ * The minimum number of integers which must have been returned by
+ * guac_pool_next_int before previously-used and freed integers are
+ * allowed to be returned.
+ */
+ int min_size;
+
+ /**
+ * The next integer to be released (after no more integers remain in the
+ * pool.
+ */
+ int __next_value;
+
+ /**
+ * The first integer in the pool, if any.
+ */
+ guac_pool_int* __head;
+
+ /**
+ * The last integer in the pool, if any.
+ */
+ guac_pool_int* __tail;
+
+} guac_pool;
+
+/**
+ * Represents a single integer within a larger pool of integers.
+ */
+struct guac_pool_int {
+
+ /**
+ * The integer value of this pool entry.
+ */
+ int value;
+
+ /**
+ * The next available (unused) guac_pool_int in the list of
+ * allocated but free'd ints.
+ */
+ guac_pool_int* __next;
+
+};
+
+/**
+ * Allocates a new guac_pool having the given minimum size.
+ *
+ * @param size The minimum number of integers which must have been returned by
+ * guac_pool_next_int before freed integers (previously used integers)
+ * are allowed to be returned.
+ * @return A new, empty guac_pool, having the given minimum size.
+ */
+guac_pool* guac_pool_alloc(int size);
+
+/**
+ * Frees the given guac_pool.
+ *
+ * @param pool The guac_pool to free.
+ */
+void guac_pool_free(guac_pool* pool);
+
+/**
+ * Returns the next available integer from the given guac_pool. All integers returned are
+ * non-negative, and are returned in sequences, starting from 0.
+ *
+ * @param pool The guac_pool to retrieve an integer from.
+ * @return The next available integer, which may be either an integer not yet returned
+ * by a call to guac_pool_next_int, or an integer which was previosly returned,
+ * but has since been freed.
+ */
+int guac_pool_next_int(guac_pool* pool);
+
+/**
+ * Frees the given integer back into the given guac_pool. The integer given will be
+ * available for future calls to guac_pool_next_int.
+ *
+ * @param pool The guac_pool to free the given integer into.
+ * @param value The integer which should be readded to the given pool, such that it can
+ * be received by a future call to guac_pool_next_int.
+ */
+void guac_pool_free_int(guac_pool* pool, int value);
+
+#endif
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/include/protocol.h
^
|
@@ -40,7 +40,9 @@
#include <cairo/cairo.h>
+#include "layer.h"
#include "socket.h"
+#include "timestamp.h"
/**
* Provides functions and structures required for communicating using the
@@ -50,12 +52,6 @@
* @file protocol.h
*/
-
-/**
- * An arbitrary timestamp denoting a relative time value in milliseconds.
- */
-typedef int64_t guac_timestamp;
-
/**
* Composite modes used by Guacamole draw instructions. Each
* composite mode maps to a unique channel mask integer.
@@ -170,152 +166,254 @@
GUAC_LINE_JOIN_ROUND = 0x2
} guac_line_join_style;
-typedef struct guac_layer guac_layer;
+/* CONTROL INSTRUCTIONS */
/**
- * Represents a single layer within the Guacamole protocol.
+ * Sends an args instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param args The NULL-terminated array of argument names (strings).
+ * @return Zero on success, non-zero on error.
*/
-struct guac_layer {
-
- /**
- * The index of this layer.
- */
- int index;
-
- /**
- * The next allocated layer in the list of all layers.
- */
- guac_layer* __next;
+int guac_protocol_send_args(guac_socket* socket, const char** args);
- /**
- * The next available (unused) layer in the list of
- * allocated but free'd layers.
- */
- guac_layer* __next_available;
+/**
+ * Sends a connect instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param args The NULL-terminated array of argument values (strings).
+ * @return Zero on success, non-zero on error.
+ */
+int guac_protocol_send_connect(guac_socket* socket, const char** args);
-};
+/**
+ * Sends a disconnect instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @return Zero on success, non-zero on error.
+ */
+int guac_protocol_send_disconnect(guac_socket* socket);
/**
- * Represents a single instruction within the Guacamole protocol.
+ * Sends an error instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param error The description associated with the error.
+ * @return Zero on success, non-zero on error.
*/
-typedef struct guac_instruction {
+int guac_protocol_send_error(guac_socket* socket, const char* error);
- /**
- * The opcode of the instruction.
- */
- char* opcode;
+/**
+ * Sends a nest instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param index The integer index of the stram to send the protocol
+ * data over.
+ * @param data A string containing protocol data, which must be UTF-8
+ * encoded and null-terminated.
+ * @return Zero on success, non-zero on error.
+ */
+int guac_protocol_send_nest(guac_socket* socket, int index,
+ const char* data);
- /**
- * The number of arguments passed to this instruction.
- */
- int argc;
+/**
+ * Sends a set instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param layer The layer to set the parameter of.
+ * @param name The name of the parameter to set.
+ * @param value The value to set the parameter to.
+ * @return Zero on success, non-zero on error.
+ */
+int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer,
+ const char* name, const char* value);
- /**
- * Array of all arguments passed to this instruction.
- */
- char** argv;
+/**
+ * Sends a select instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param protocol The protocol to request.
+ * @return Zero on success, non-zero on error.
+ */
+int guac_protocol_send_select(guac_socket* socket, const char* protocol);
-} guac_instruction;
+/**
+ * Sends a sync instruction over the given guac_socket connection. The
+ * current time in milliseconds should be passed in as the timestamp.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param timestamp The current timestamp (in milliseconds).
+ * @return Zero on success, non-zero on error.
+ */
+int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
+/* MEDIA INSTRUCTIONS */
/**
- * Frees all memory allocated to the given instruction.
+ * Sends an audio instruction over the given guac_socket connection.
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
*
- * @param instruction The instruction to free.
+ * @param socket The guac_socket connection to use.
+ * @param channel The index of the audio channel the sound should play on.
+ * @param mimetype The mimetype of the data being sent.
+ * @param duration The duration of the sound being sent, in milliseconds.
+ * @param data The audio data to be sent.
+ * @param size The number of bytes of audio data to send.
+ * @return Zero on success, non-zero on error.
*/
-void guac_instruction_free(guac_instruction* instruction);
+int guac_protocol_send_audio(guac_socket* socket, int channel,
+ const char* mimetype, double duration, void* data, int size);
/**
- * Returns whether new instruction data is available on the given guac_socket
- * connection for parsing.
+ * Begins a audio instruction over the given guac_socket connection. Only the
+ * initial non-data part of the instruction and the length of the data part
+ * of the instruction are sent. The actual contents of the data must be
+ * sent with guac_protocol_send_audio_data(), and the instruction must be
+ * completed with guac_protocol_send_audio_end().
+ *
+ * Note that the size of the audio to be sent MUST be known ahead of time,
+ * even though the data of the audio may be sent in chunks.
+ *
+ * No further instruction data may be sent along the givven guac_socket
+ * except via guac_protocol_send_audio_data() until the audio instruction
+ * is completed with guac_protocol_send_audio_end().
+ *
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param usec_timeout The maximum number of microseconds to wait before
- * giving up.
- * @return A positive value if data is available, negative on error, or
- * zero if no data is currently available.
+ * @param channel The index of the audio channel the sound should play on.
+ * @param mimetype The mimetype of the data being sent.
+ * @param duration The duration of the audio being sent, in milliseconds.
+ * @param size The number of bytes of audio data to send.
+ * @return Zero on success, non-zero on error.
*/
-int guac_protocol_instructions_waiting(guac_socket* socket, int usec_timeout);
+int guac_protocol_send_audio_header(guac_socket* socket,
+ int channel, const char* mimetype, double duration, int size);
/**
- * Reads a single instruction from the given guac_socket connection.
+ * Writes a block of audio data to the currently in-progress audio instruction
+ * which was started with guac_protocol_send_audio_header(). Exactly the
+ * number of requested bytes are written unless an error occurs. This function
+ * may be called multiple times per audio instruction for each chunk of audio
+ * data being written, allowing the potentially huge audio instruction to be
+ * split across multiple writes.
*
- * If an error occurs reading the instruction, NULL is returned,
- * and guac_error is set appropriately.
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param usec_timeout The maximum number of microseconds to wait before
- * giving up.
- * @return A new instruction if data was successfully read, NULL on
- * error or if the instruction could not be read completely
- * because the timeout elapsed, in which case guac_error will be
- * set to GUAC_STATUS_INPUT_TIMEOUT and subsequent calls to
- * guac_protocol_read_instruction() will return the parsed instruction
- * once enough data is available.
+ * @param data The audio data to write.
+ * @param count The number of bytes within the given buffer of audio data
+ * that must be written.
+ * @return Zero on success, non-zero on error.
*/
-guac_instruction* guac_protocol_read_instruction(guac_socket* socket,
- int usec_timeout);
+int guac_protocol_send_audio_data(guac_socket* socket, void* data, int count);
/**
- * Reads a single instruction with the given opcode from the given guac_socket
- * connection.
- *
- * If an error occurs reading the instruction, NULL is returned,
- * and guac_error is set appropriately.
+ * Completes the audio instruction which was started with
+ * guac_protocol_send_audio_header(), and whose data has been written with
+ * guac_protocol_send_audio_data().
*
- * If the instruction read is not the expected instruction, NULL is returned,
- * and guac_error is set to GUAC_STATUS_BAD_STATE.
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param usec_timeout The maximum number of microseconds to wait before
- * giving up.
- * @param opcode The opcode of the instruction to read.
- * @return A new instruction if an instruction with the given opcode was read,
- * NULL otherwise. If an instruction was read, but the instruction had
- * a different opcode, NULL is returned and guac_error is set to
- * GUAC_STATUS_BAD_STATE.
+ * @return Zero on success, non-zero on error.
*/
-guac_instruction* guac_protocol_expect_instruction(guac_socket* socket,
- int usec_timeout, const char* opcode);
+int guac_protocol_send_audio_end(guac_socket* socket);
/**
- * Returns an arbitrary timestamp. The difference between return values of any
- * two calls is equal to the amount of time in milliseconds between those
- * calls. The return value from a single call will not have any useful
- * (or defined) meaning.
+ * Sends a file instruction over the given guac_socket connection.
*
- * @return An arbitrary millisecond timestamp.
+ * If an error occurs sending the instruction, a non-zero value is
+ * returned, and guac_error is set appropriately.
+ *
+ * @param socket The guac_socket connection to use.
+ * @param name A name describing the file being sent.
+ * @param mimetype The mimetype of the data being sent.
+ * @param data The file data to be sent.
+ * @param size The number of bytes of file data to send.
+ * @return Zero on success, non-zero on error.
*/
-guac_timestamp guac_protocol_get_timestamp();
-
-/* CONTROL INSTRUCTIONS */
+int guac_protocol_send_file(guac_socket* socket, const char* name,
+ const char* mimetype, void* data, int size);
/**
- * Sends an args instruction over the given guac_socket connection.
+ * Begins a file instruction over the given guac_socket connection. Only the
+ * initial non-data part of the instruction and the length of the data part
+ * of the instruction are sent. The actual contents of the data must be
+ * sent with guac_protocol_send_file_data(), and the instruction must be
+ * completed with guac_protocol_send_file_end().
+ *
+ * Note that the size of the file to be sent MUST be known ahead of time,
+ * even though the data of the file may be sent in chunks.
+ *
+ * No further instruction data may be sent along the givven guac_socket
+ * except via guac_protocol_send_file_data() until the file instruction
+ * is completed with guac_protocol_send_file_end().
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param args The NULL-terminated array of argument names (strings).
+ * @param name A name describing the file being sent.
+ * @param mimetype The mimetype of the data being sent.
+ * @param size The number of bytes of file data to send.
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_args(guac_socket* socket, const char** args);
+int guac_protocol_send_file_header(guac_socket* socket, const char* name,
+ const char* mimetype, int size);
/**
- * Sends a connect instruction over the given guac_socket connection.
+ * Writes a block of file data to the currently in-progress file instruction
+ * which was started with guac_protocol_send_file_header(). Exactly the
+ * number of requested bytes are written unless an error occurs. This function
+ * may be called multiple times per file instruction for each chunk of file
+ * data being written, allowing the potentially huge file instruction to be
+ * split across multiple writes.
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param args The NULL-terminated array of argument values (strings).
+ * @param data The file data to write.
+ * @param count The number of bytes within the given buffer of file data
+ * that must be written.
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_connect(guac_socket* socket, const char** args);
+int guac_protocol_send_file_data(guac_socket* socket, void* data, int count);
/**
- * Sends a disconnect instruction over the given guac_socket connection.
+ * Completes the file instruction which was started with
+ * guac_protocol_send_file_header(), and whose data has been written with
+ * guac_protocol_send_file_data().
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
@@ -323,59 +421,83 @@
* @param socket The guac_socket connection to use.
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_disconnect(guac_socket* socket);
+int guac_protocol_send_file_end(guac_socket* socket);
/**
- * Sends an error instruction over the given guac_socket connection.
+ * Sends a video instruction over the given guac_socket connection.
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param error The description associated with the error.
+ * @param layer The destination layer.
+ * @param mimetype The mimetype of the data being sent.
+ * @param duration The duration of the video being sent, in milliseconds.
+ * @param data The video data to be sent.
+ * @param size The number of bytes of video data to send.
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_error(guac_socket* socket, const char* error);
+int guac_protocol_send_video(guac_socket* socket, const guac_layer* layer,
+ const char* mimetype, double duration, void* data, int size);
/**
- * Sends a set instruction over the given guac_socket connection.
+ * Begins a video instruction over the given guac_socket connection. Only the
+ * initial non-data part of the instruction and the length of the data part
+ * of the instruction are sent. The actual contents of the data must be
+ * sent with guac_protocol_send_video_data(), and the instruction must be
+ * completed with guac_protocol_send_video_end().
+ *
+ * Note that the size of the video to be sent MUST be known ahead of time,
+ * even though the data of the video may be sent in chunks.
+ *
+ * No further instruction data may be sent along the givven guac_socket
+ * except via guac_protocol_send_video_data() until the video instruction
+ * is completed with guac_protocol_send_video_end().
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param layer The layer to set the parameter of.
- * @param name The name of the parameter to set.
- * @param value The value to set the parameter to.
+ * @param layer The destination layer.
+ * @param mimetype The mimetype of the data being sent.
+ * @param duration The duration of the video being sent, in milliseconds.
+ * @param size The number of bytes of video data to send.
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_set(guac_socket* socket, const guac_layer* layer,
- const char* name, const char* value);
+int guac_protocol_send_video_header(guac_socket* socket,
+ const guac_layer* layer, const char* mimetype, double duration, int size);
/**
- * Sends a select instruction over the given guac_socket connection.
+ * Writes a block of video data to the currently in-progress video instruction
+ * which was started with guac_protocol_send_video_header(). Exactly the
+ * number of requested bytes are written unless an error occurs. This function
+ * may be called multiple times per video instruction for each chunk of video
+ * data being written, allowing the potentially huge video instruction to be
+ * split across multiple writes.
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param protocol The protocol to request.
+ * @param data The video data to write.
+ * @param count The number of bytes within the given buffer of video data
+ * that must be written.
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_select(guac_socket* socket, const char* protocol);
+int guac_protocol_send_video_data(guac_socket* socket, void* data, int count);
/**
- * Sends a sync instruction over the given guac_socket connection. The
- * current time in milliseconds should be passed in as the timestamp.
+ * Completes the video instruction which was started with
+ * guac_protocol_send_video_header(), and whose data has been written with
+ * guac_protocol_send_video_data().
*
* If an error occurs sending the instruction, a non-zero value is
* returned, and guac_error is set appropriately.
*
* @param socket The guac_socket connection to use.
- * @param timestamp The current timestamp (in milliseconds).
* @return Zero on success, non-zero on error.
*/
-int guac_protocol_send_sync(guac_socket* socket, guac_timestamp timestamp);
+int guac_protocol_send_video_end(guac_socket* socket);
/* DRAWING INSTRUCTIONS */
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/include/socket.h
^
|
@@ -47,17 +47,90 @@
* @file socket.h
*/
+typedef struct guac_socket guac_socket;
+
+/**
+ * Generic read handler for socket read operations, modeled after the standard
+ * POSIX read() function. When set within a guac_socket, a handler of this type
+ * will be called when data needs to be read into the socket.
+ *
+ * @param socket The guac_socket being read from.
+ * @param buf The arbitrary buffer we must populate with data.
+ * @param count The maximum number of bytes to read into the buffer.
+ * @return The number of bytes read, or -1 if an error occurs.
+ */
+typedef ssize_t guac_socket_read_handler(guac_socket* socket,
+ void* buf, size_t count);
+
+/**
+ * Generic write handler for socket write operations, modeled after the standard
+ * POSIX write() function. When set within a guac_socket, a handler of this type
+ * will be called when data needs to be write into the socket.
+ *
+ * @param socket The guac_socket being written to.
+ * @param buf The arbitrary buffer containing data to be written.
+ * @param count The maximum number of bytes to write from the buffer.
+ * @return The number of bytes written, or -1 if an error occurs.
+ */
+typedef ssize_t guac_socket_write_handler(guac_socket* socket,
+ void* buf, size_t count);
+
+/**
+ * Generic handler for socket select operations, similar to the POSIX select()
+ * function. When guac_socket_select() is called on a guac_socket, its
+ * guac_socket_select_handler will be invoked, if defined.
+ *
+ * @param socket The guac_socket being selected.
+ * @param usec_timeout The maximum number of microseconds to wait for data, or
+ * -1 to potentially wait forever.
+ * @return Positive on success, zero if the timeout elapsed and no data is
+ * available, negative on error.
+ */
+typedef int guac_socket_select_handler(guac_socket* socket, int usec_timeout);
+
+/**
+ * Generic handler for the closing of a socket, modeled after the standard
+ * POSIX close() function. When set within a guac_socket, a handler of this type
+ * will be called when the socket is closed.
+ *
+ * @param socket The guac_socket being closed.
+ * @return Zero on success, or -1 if an error occurs.
+ */
+typedef int guac_socket_free_handler(guac_socket* socket);
/**
* The core I/O object of Guacamole. guac_socket provides buffered input and
* output as well as convenience methods for efficiently writing base64 data.
*/
-typedef struct guac_socket {
+struct guac_socket {
/**
- * The file descriptor to be read from / written to.
+ * Arbitrary socket-specific data.
*/
- int fd;
+ void* data;
+
+ /**
+ * Handler which will be called when data needs to be read from the socket.
+ */
+ guac_socket_read_handler* read_handler;
+
+ /**
+ * Handler which will be called whenever data is written to this socket.
+ * Note that because guac_socket automatically buffers written data, this
+ * handler might only get called when the socket is flushed.
+ */
+ guac_socket_write_handler* write_handler;
+
+ /**
+ * Handler which will be called whenever guac_socket_select is invoked
+ * on this socket.
+ */
+ guac_socket_select_handler* select_handler;
+
+ /**
+ * Handler which will be called when the socket is free'd (closed).
+ */
+ guac_socket_free_handler* free_handler;
/**
* The number of bytes present in the base64 "ready" buffer.
@@ -114,7 +187,23 @@
*/
char* __instructionbuf_elementv[64];
-} guac_socket;
+};
+
+/**
+ * Allocates a new, completely blank guac_socket. This guac_socket will do
+ * absolutely nothing when used unless its handlers are defined.
+ *
+ * @returns A newly-allocated guac_socket, or NULL if the guac_socket could
+ * not be allocated.
+ */
+guac_socket* guac_socket_alloc();
+
+/**
+ * Frees the given guac_socket and all associated resources.
+ *
+ * @param socket The guac_socket to free.
+ */
+void guac_socket_free(guac_socket* socket);
/**
* Allocates and initializes a new guac_socket object with the given open
@@ -131,6 +220,22 @@
guac_socket* guac_socket_open(int fd);
/**
+ * Allocates and initializes a new guac_socket which writes all data via
+ * nest instructions to the given existing, open guac_socket.
+ *
+ * If an error occurs while allocating the guac_socket object, NULL is returned,
+ * and guac_error is set appropriately.
+ *
+ * @param parent The guac_socket this new guac_socket should write nest
+ * instructions to.
+ * @param index The stream index to use for the written nest instructions.
+ * @return A newly allocated guac_socket object associated with the given
+ * guac_socket and stream index, or NULL if an error occurs while
+ * allocating the guac_socket object.
+ */
+guac_socket* guac_socket_nest(guac_socket* parent, int index);
+
+/**
* Writes the given unsigned int to the given guac_socket object. The data
* written may be buffered until the buffer is flushed automatically or
* manually.
@@ -161,11 +266,11 @@
ssize_t guac_socket_write_string(guac_socket* socket, const char* str);
/**
- * Writes the given binary data to the given guac_socket object as base64-encoded
- * data. The data written may be buffered until the buffer is flushed
+ * Writes the given binary data to the given guac_socket object as base64-
+ * encoded data. The data written may be buffered until the buffer is flushed
* automatically or manually. Beware that because base64 data is buffered
- * on top of the write buffer already used, a call to guac_socket_flush_base64() must
- * be made before non-base64 writes (or writes of an independent block of
+ * on top of the write buffer already used, a call to guac_socket_flush_base64()
+ * must be made before non-base64 writes (or writes of an independent block of
* base64 data) can be made.
*
* If an error occurs while writing, a non-zero value is returned, and
@@ -179,6 +284,35 @@
ssize_t guac_socket_write_base64(guac_socket* socket, const void* buf, size_t count);
/**
+ * Writes the given data to the specified socket. The data written may be
+ * buffered until the buffer is flushed automatically or manually.
+ *
+ * If an error occurs while writing, a non-zero value is returned, and
+ * guac_error is set appropriately.
+ *
+ * @param socket The guac_socket object to write to.
+ * @param buf A buffer containing the data to write.
+ * @param count The number of bytes to write.
+ * @return Zero on success, or non-zero if an error occurs while writing.
+ */
+ssize_t guac_socket_write(guac_socket* socket, const void* buf, size_t count);
+
+/**
+ * Attempts to read data from the socket, filling up to the specified number
+ * of bytes in the given buffer.
+ *
+ * If an error occurs while writing, a non-zero value is returned, and
+ * guac_error is set appropriately.
+ *
+ * @param socket The guac_socket to read from.
+ * @param buf The buffer to read bytes into.
+ * @param count The maximum number of bytes to read.
+ * @return The number of bytes read, or non-zero if an error occurs while
+ * reading.
+ */
+ssize_t guac_socket_read(guac_socket* socket, void* buf, size_t count);
+
+/**
* Flushes the base64 buffer, writing padding characters as necessary.
*
* If an error occurs while writing, a non-zero value is returned, and
@@ -219,14 +353,5 @@
*/
int guac_socket_select(guac_socket* socket, int usec_timeout);
-/**
- * Frees resources allocated to the given guac_socket object. Note that this
- * implicitly flush all buffers, but will NOT close the associated file
- * descriptor.
- *
- * @param socket The guac_socket object to close.
- */
-void guac_socket_close(guac_socket* socket);
-
#endif
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/stream.h
^
|
@@ -0,0 +1,68 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_STREAM_H
+#define _GUAC_STREAM_H
+
+/**
+ * Provides functions and structures required for allocating and using nested
+ * streams.
+ *
+ * @file stream.h
+ */
+
+typedef struct guac_stream guac_stream;
+
+/**
+ * Represents a single nested stream within the Guacamole protocol.
+ */
+struct guac_stream {
+
+ /**
+ * The index of this layer.
+ */
+ int index;
+
+ /**
+ * A guac_socket which writes to this stream.
+ */
+ guac_socket* socket;
+
+};
+
+#endif
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/include/timestamp.h
^
|
@@ -0,0 +1,65 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_TIME_H
+#define _GUAC_TIME_H
+
+#include <stdint.h>
+
+/**
+ * Provides functions and structures for creating timestamps.
+ *
+ * @file timestamp.h
+ */
+
+/**
+ * An arbitrary timestamp denoting a relative time value in milliseconds.
+ */
+typedef int64_t guac_timestamp;
+
+/**
+ * Returns an arbitrary timestamp. The difference between return values of any
+ * two calls is equal to the amount of time in milliseconds between those
+ * calls. The return value from a single call will not have any useful
+ * (or defined) meaning.
+ *
+ * @return An arbitrary millisecond timestamp.
+ */
+guac_timestamp guac_timestamp_current();
+
+#endif
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/include/unicode.h
^
|
@@ -41,6 +41,12 @@
#include <stddef.h>
/**
+ * Provides functions for manipulating Unicode strings.
+ *
+ * @file unicode.h
+ */
+
+/**
* Given the initial byte of a single UTF-8 character, returns the overall
* byte size of the entire character.
*
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/src/Makefile.am
^
|
@@ -39,26 +39,40 @@
AM_CFLAGS = -Werror -Wall -pedantic -I../include
libguacincdir = $(includedir)/guacamole
-libguacinc_HEADERS = \
- ../include/client.h \
- ../include/socket.h \
- ../include/protocol.h \
- ../include/error.h
+libguacinc_HEADERS = \
+ ../include/client.h \
+ ../include/error.h \
+ ../include/hash.h \
+ ../include/instruction.h \
+ ../include/layer.h \
+ ../include/plugin.h \
+ ../include/pool.h \
+ ../include/protocol.h \
+ ../include/socket.h \
+ ../include/stream.h \
+ ../include/timestamp.h
noinst_HEADERS = \
- ../include/palette.h \
../include/client-handlers.h \
+ ../include/palette.h \
../include/unicode.h
libguac_la_SOURCES = \
client.c \
- socket.c \
- protocol.c \
client-handlers.c \
error.c \
+ hash.c \
+ instruction.c \
palette.c \
+ plugin.c \
+ pool.c \
+ protocol.c \
+ socket.c \
+ socket-fd.c \
+ socket-nest.c \
+ timestamp.c \
unicode.c
lib_LTLIBRARIES = libguac.la
-libguac_la_LDFLAGS = -version-info 3:3:0
+libguac_la_LDFLAGS = -version-info 4:0:0
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/src/Makefile.in
^
|
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -53,6 +53,23 @@
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -114,8 +131,9 @@
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(libguacincdir)"
LTLIBRARIES = $(lib_LTLIBRARIES)
libguac_la_LIBADD =
-am_libguac_la_OBJECTS = client.lo socket.lo protocol.lo \
- client-handlers.lo error.lo palette.lo unicode.lo
+am_libguac_la_OBJECTS = client.lo client-handlers.lo error.lo hash.lo \
+ instruction.lo palette.lo plugin.lo pool.lo protocol.lo \
+ socket.lo socket-fd.lo socket-nest.lo timestamp.lo unicode.lo
libguac_la_OBJECTS = $(am_libguac_la_OBJECTS)
libguac_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -135,6 +153,11 @@
$(LDFLAGS) -o $@
SOURCES = $(libguac_la_SOURCES)
DIST_SOURCES = $(libguac_la_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
HEADERS = $(libguacinc_HEADERS) $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -258,27 +281,41 @@
AM_CFLAGS = -Werror -Wall -pedantic -I../include
libguacincdir = $(includedir)/guacamole
libguacinc_HEADERS = \
- ../include/client.h \
- ../include/socket.h \
- ../include/protocol.h \
- ../include/error.h
+ ../include/client.h \
+ ../include/error.h \
+ ../include/hash.h \
+ ../include/instruction.h \
+ ../include/layer.h \
+ ../include/plugin.h \
+ ../include/pool.h \
+ ../include/protocol.h \
+ ../include/socket.h \
+ ../include/stream.h \
+ ../include/timestamp.h
noinst_HEADERS = \
- ../include/palette.h \
../include/client-handlers.h \
+ ../include/palette.h \
../include/unicode.h
libguac_la_SOURCES = \
client.c \
- socket.c \
- protocol.c \
client-handlers.c \
error.c \
+ hash.c \
+ instruction.c \
palette.c \
+ plugin.c \
+ pool.c \
+ protocol.c \
+ socket.c \
+ socket-fd.c \
+ socket-nest.c \
+ timestamp.c \
unicode.c
lib_LTLIBRARIES = libguac.la
-libguac_la_LDFLAGS = -version-info 3:3:0
+libguac_la_LDFLAGS = -version-info 4:0:0
all: all-am
.SUFFIXES:
@@ -315,7 +352,6 @@
$(am__aclocal_m4_deps):
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
list2=; for p in $$list; do \
if test -f $$p; then \
@@ -323,6 +359,8 @@
else :; fi; \
done; \
test -z "$$list2" || { \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
}
@@ -356,9 +394,16 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client-handlers.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/error.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hash.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instruction.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/palette.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/plugin.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pool.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/protocol.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket-fd.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket-nest.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/timestamp.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unicode.Plo@am__quote@
.c.o:
@@ -389,8 +434,11 @@
-rm -rf .libs _libs
install-libguacincHEADERS: $(libguacinc_HEADERS)
@$(NORMAL_INSTALL)
- test -z "$(libguacincdir)" || $(MKDIR_P) "$(DESTDIR)$(libguacincdir)"
@list='$(libguacinc_HEADERS)'; test -n "$(libguacincdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(libguacincdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(libguacincdir)" || exit 1; \
+ fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/src/client-handlers.c
^
|
@@ -50,6 +50,7 @@
{"key", __guac_handle_key},
{"clipboard", __guac_handle_clipboard},
{"disconnect", __guac_handle_disconnect},
+ {"size", __guac_handle_size},
{NULL, NULL}
};
@@ -114,6 +115,16 @@
);
return 0;
}
+
+int __guac_handle_size(guac_client* client, guac_instruction* instruction) {
+ if (client->size_handler)
+ return client->size_handler(
+ client,
+ atoi(instruction->argv[0]), /* width */
+ atoi(instruction->argv[1]) /* height */
+ );
+ return 0;
+}
int __guac_handle_disconnect(guac_client* client, guac_instruction* instruction) {
/* Return error code to force disconnect */
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/src/client.c
^
|
@@ -35,57 +35,31 @@
*
* ***** END LICENSE BLOCK ***** */
-#include <stdlib.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <dlfcn.h>
-#include "socket.h"
-#include "protocol.h"
#include "client.h"
#include "client-handlers.h"
#include "error.h"
-
-#define MIN(a, b) (((a) < (b)) ? (a) : (b))
-#define MAX(a, b) (((a) > (b)) ? (a) : (b))
+#include "layer.h"
+#include "plugin.h"
+#include "pool.h"
+#include "protocol.h"
+#include "socket.h"
+#include "time.h"
guac_layer __GUAC_DEFAULT_LAYER = {
- .index = 0,
- .__next = NULL,
- .__next_available = NULL
+ .index = 0
};
const guac_layer* GUAC_DEFAULT_LAYER = &__GUAC_DEFAULT_LAYER;
guac_layer* guac_client_alloc_layer(guac_client* client) {
- guac_layer* allocd_layer;
-
- /* If available layers, pop off first available layer */
- if (client->__next_layer_index >= GUAC_BUFFER_POOL_INITIAL_SIZE &&
- client->__available_layers != NULL) {
-
- allocd_layer = client->__available_layers;
- client->__available_layers = client->__available_layers->__next_available;
-
- /* If last layer, reset last available layer pointer */
- if (allocd_layer == client->__last_available_layer)
- client->__last_available_layer = NULL;
-
- }
-
- /* If no available layer, allocate new layer, add to __all_layers list */
- else {
-
- /* Init new layer */
- allocd_layer = malloc(sizeof(guac_layer));
- allocd_layer->index = client->__next_layer_index++;
-
- /* Add to __all_layers list */
- allocd_layer->__next = client->__all_layers;
- client->__all_layers = allocd_layer;
-
- }
+ /* Init new layer */
+ guac_layer* allocd_layer = malloc(sizeof(guac_layer));
+ allocd_layer->index = guac_pool_next_int(client->__layer_pool)+1;
return allocd_layer;
@@ -93,33 +67,9 @@
guac_layer* guac_client_alloc_buffer(guac_client* client) {
- guac_layer* allocd_layer;
-
- /* If available layers, pop off first available buffer */
- if (client->__next_buffer_index <= -GUAC_BUFFER_POOL_INITIAL_SIZE &&
- client->__available_buffers != NULL) {
-
- allocd_layer = client->__available_buffers;
- client->__available_buffers = client->__available_buffers->__next_available;
-
- /* If last buffer, reset last available buffer pointer */
- if (allocd_layer == client->__last_available_buffer)
- client->__last_available_buffer = NULL;
-
- }
-
- /* If no available buffer, allocate new buffer, add to __all_layers list */
- else {
-
- /* Init new layer */
- allocd_layer = malloc(sizeof(guac_layer));
- allocd_layer->index = client->__next_buffer_index--;
-
- /* Add to __all_layers list */
- allocd_layer->__next = client->__all_layers;
- client->__all_layers = allocd_layer;
-
- }
+ /* Init new layer */
+ guac_layer* allocd_layer = malloc(sizeof(guac_layer));
+ allocd_layer->index = -guac_pool_next_int(client->__buffer_pool) - 1;
return allocd_layer;
@@ -127,120 +77,54 @@
void guac_client_free_buffer(guac_client* client, guac_layer* layer) {
- /* Add layer to tail of pool of available buffers */
- if (client->__last_available_buffer != NULL)
- client->__last_available_buffer->__next_available = layer;
-
- if (client->__available_buffers == NULL)
- client->__available_buffers = layer;
+ /* Release index to pool */
+ guac_pool_free_int(client->__buffer_pool, -layer->index - 1);
- client->__last_available_buffer = layer;
- layer->__next_available = NULL;
+ /* Free layer */
+ free(layer);
}
void guac_client_free_layer(guac_client* client, guac_layer* layer) {
- /* Add layer to tail of pool of available layers */
- if (client->__last_available_layer != NULL)
- client->__last_available_layer->__next_available = layer;
+ /* Release index to pool */
+ guac_pool_free_int(client->__layer_pool, layer->index);
- if (client->__available_layers == NULL)
- client->__available_layers = layer;
-
- client->__last_available_layer = layer;
- layer->__next_available = NULL;
+ /* Free layer */
+ free(layer);
}
-guac_client_plugin* guac_client_plugin_open(const char* protocol) {
-
- guac_client_plugin* plugin;
-
- /* Reference to dlopen()'d plugin */
- void* client_plugin_handle;
-
- /* Client args description */
- const char** client_args;
-
- /* Pluggable client */
- char protocol_lib[GUAC_PROTOCOL_LIBRARY_LIMIT] =
- GUAC_PROTOCOL_LIBRARY_PREFIX;
-
- union {
- guac_client_init_handler* client_init;
- void* obj;
- } alias;
-
- /* Add protocol and .so suffix to protocol_lib */
- strncat(protocol_lib, protocol, GUAC_PROTOCOL_NAME_LIMIT-1);
- strcat(protocol_lib, GUAC_PROTOCOL_LIBRARY_SUFFIX);
-
- /* Load client plugin */
- client_plugin_handle = dlopen(protocol_lib, RTLD_LAZY);
- if (!client_plugin_handle) {
- guac_error = GUAC_STATUS_BAD_ARGUMENT;
- guac_error_message = dlerror();
- return NULL;
- }
-
- dlerror(); /* Clear errors */
-
- /* Get init function */
- alias.obj = dlsym(client_plugin_handle, "guac_client_init");
-
- /* Fail if cannot find guac_client_init */
- if (dlerror() != NULL) {
- guac_error = GUAC_STATUS_BAD_ARGUMENT;
- guac_error_message = dlerror();
- return NULL;
- }
-
- /* Get usage strig */
- client_args = (const char**) dlsym(client_plugin_handle, "GUAC_CLIENT_ARGS");
+guac_stream* guac_client_alloc_stream(guac_client* client) {
- /* Fail if cannot find GUAC_CLIENT_ARGS */
- if (dlerror() != NULL) {
- guac_error = GUAC_STATUS_BAD_ARGUMENT;
- guac_error_message = dlerror();
- return NULL;
- }
+ /* Init new stream */
+ guac_stream* allocd_stream = malloc(sizeof(guac_stream));
+ allocd_stream->index = guac_pool_next_int(client->__stream_pool);
- /* Allocate plugin */
- plugin = malloc(sizeof(guac_client_plugin));
- if (plugin == NULL) {
- guac_error = GUAC_STATUS_NO_MEMORY;
- guac_error_message = "Could not allocate memory for client plugin";
- return NULL;
- }
+ /* Nest socket */
+ allocd_stream->socket = guac_socket_nest(
+ client->socket,
+ allocd_stream->index
+ );
- /* Init and return plugin */
- plugin->__client_plugin_handle = client_plugin_handle;
- plugin->init_handler = alias.client_init;
- plugin->args = client_args;
- return plugin;
+ return allocd_stream;
}
-int guac_client_plugin_close(guac_client_plugin* plugin) {
+void guac_client_free_stream(guac_client* client, guac_stream* stream) {
- /* Unload client plugin */
- if (dlclose(plugin->__client_plugin_handle)) {
- guac_error = GUAC_STATUS_BAD_STATE;
- guac_error_message = dlerror();
- return -1;
- }
+ /* Release index to pool */
+ guac_pool_free_int(client->__stream_pool, stream->index - 1);
+
+ /* Release socket */
+ guac_socket_free(stream->socket);
- /* Free plugin handle */
- free(plugin);
- return 0;
+ /* Free stream */
+ free(stream);
}
-guac_client* guac_client_plugin_get_client(guac_client_plugin* plugin,
- guac_socket* socket, int argc, char** argv,
- guac_client_log_handler* log_info_handler,
- guac_client_log_handler* log_error_handler) {
+guac_client* guac_client_alloc() {
/* Allocate new client */
guac_client* client = malloc(sizeof(guac_client));
@@ -253,27 +137,17 @@
/* Init new client */
memset(client, 0, sizeof(guac_client));
- client->socket = socket;
client->last_received_timestamp =
- client->last_sent_timestamp = guac_protocol_get_timestamp();
+ client->last_sent_timestamp = guac_timestamp_current();
client->state = GUAC_CLIENT_RUNNING;
- client->__all_layers = NULL;
- client->__available_buffers = client->__last_available_buffer = NULL;
- client->__available_layers = client->__last_available_layer = NULL;
-
- client->__next_buffer_index = -1;
- client->__next_layer_index = 1;
-
- /* Set up logging in client */
- client->log_info_handler = log_info_handler;
- client->log_error_handler = log_error_handler;
+ /* Allocate buffer and layer pools */
+ client->__buffer_pool = guac_pool_alloc(GUAC_BUFFER_POOL_INITIAL_SIZE);
+ client->__layer_pool = guac_pool_alloc(GUAC_BUFFER_POOL_INITIAL_SIZE);
- if (plugin->init_handler(client, argc, argv) != 0) {
- free(client);
- return NULL;
- }
+ /* Allocate stream pool */
+ client->__stream_pool = guac_pool_alloc(0);
return client;
@@ -288,17 +162,12 @@
}
- /* Free all layers */
- while (client->__all_layers != NULL) {
-
- /* Get layer, update layer pool head */
- guac_layer* layer = client->__all_layers;
- client->__all_layers = layer->__next;
+ /* Free layer pools */
+ guac_pool_free(client->__buffer_pool);
+ guac_pool_free(client->__layer_pool);
- /* Free layer */
- free(layer);
-
- }
+ /* Free stream pool */
+ guac_pool_free(client->__stream_pool);
free(client);
}
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/hash.c
^
|
@@ -0,0 +1,151 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+
+#include <stdint.h>
+#include <string.h>
+#include <cairo/cairo.h>
+
+/*
+ * Arbitrary hash function whhich maps ALL 32-bit numbers onto 24-bit numbers
+ * evenly, while guaranteeing that all 24-bit numbers are mapped onto
+ * themselves.
+ */
+unsigned int _guac_hash_32to24(unsigned int value) {
+
+ /* Grab highest-order byte */
+ unsigned int upper = value & 0xFF000000;
+
+ /* XOR upper with lower three bytes, truncate to 24-bit */
+ return
+ (value & 0xFFFFFF)
+ ^ (upper >> 8)
+ ^ (upper >> 16)
+ ^ (upper >> 24);
+
+}
+
+/**
+ * Rotates a given 32-bit integer by N bits.
+ *
+ * NOTE: We probably should check for available bitops.h macros first.
+ */
+unsigned int _guac_rotate(unsigned int value, int amount) {
+
+ /* amount = amount % 32 */
+ amount &= 0x1F;
+
+ /* Return rotated amount */
+ return (value >> amount) | (value << (32 - amount));
+
+}
+
+unsigned int guac_hash_surface(cairo_surface_t* surface) {
+
+ /* Init to zero */
+ unsigned int hash_value = 0;
+
+ int x, y;
+
+ /* Get image data and metrics */
+ unsigned char* data = cairo_image_surface_get_data(surface);
+ int width = cairo_image_surface_get_width(surface);
+ int height = cairo_image_surface_get_height(surface);
+ int stride = cairo_image_surface_get_stride(surface);
+
+ for (y=0; y<height; y++) {
+
+ /* Get current row */
+ uint32_t* row = (uint32_t*) data;
+ data += stride;
+
+ for (x=0; x<width; x++) {
+
+ /* Get color at current pixel */
+ unsigned int color = *row;
+ row++;
+
+ /* Compute next hash */
+ hash_value =
+ _guac_rotate(hash_value, 1) ^ color ^ 0x1B872E69;
+
+ }
+
+ } /* end for each row */
+
+ /* Done */
+ return _guac_hash_32to24(hash_value);
+
+}
+
+int guac_surface_cmp(cairo_surface_t* a, cairo_surface_t* b) {
+
+ /* Surface A metrics */
+ unsigned char* data_a = cairo_image_surface_get_data(a);
+ int width_a = cairo_image_surface_get_width(a);
+ int height_a = cairo_image_surface_get_height(a);
+ int stride_a = cairo_image_surface_get_stride(a);
+
+ /* Surface B metrics */
+ unsigned char* data_b = cairo_image_surface_get_data(b);
+ int width_b = cairo_image_surface_get_width(b);
+ int height_b = cairo_image_surface_get_height(b);
+ int stride_b = cairo_image_surface_get_stride(b);
+
+ int y;
+
+ /* If core dimensions differ, just compare those. Done. */
+ if (width_a != width_b) return width_a - width_b;
+ if (height_a != height_b) return height_a - height_b;
+
+ for (y=0; y<height_a; y++) {
+
+ /* Compare row. If different, use that result. */
+ int cmp_result = memcmp(data_a, data_b, width_a * 4);
+ if (cmp_result != 0)
+ return cmp_result;
+
+ /* Next row */
+ data_a += stride_a;
+ data_b += stride_b;
+
+ }
+
+ /* Otherwise, same. */
+ return 0;
+
+}
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/instruction.c
^
|
@@ -0,0 +1,334 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "error.h"
+#include "instruction.h"
+#include "protocol.h"
+#include "socket.h"
+#include "unicode.h"
+
+int __guac_fill_instructionbuf(guac_socket* socket) {
+
+ int retval;
+
+ /* Attempt to fill buffer */
+ retval = guac_socket_read(
+ socket,
+ socket->__instructionbuf + socket->__instructionbuf_used_length,
+ socket->__instructionbuf_size - socket->__instructionbuf_used_length
+ );
+
+ /* Set guac_error if recv() unsuccessful */
+ if (retval < 0) {
+ guac_error = GUAC_STATUS_SEE_ERRNO;
+ guac_error_message = "Error filling instruction buffer";
+ return retval;
+ }
+
+ socket->__instructionbuf_used_length += retval;
+
+ /* Expand buffer if necessary */
+ if (socket->__instructionbuf_used_length >
+ socket->__instructionbuf_size / 2) {
+
+ socket->__instructionbuf_size *= 2;
+ socket->__instructionbuf = realloc(socket->__instructionbuf,
+ socket->__instructionbuf_size);
+ }
+
+ return retval;
+
+}
+
+
+/* Returns new instruction if one exists, or NULL if no more instructions. */
+guac_instruction* guac_instruction_read(guac_socket* socket,
+ int usec_timeout) {
+
+ int retval;
+
+ /* Loop until a instruction is read */
+ for (;;) {
+
+ /* Length of element, in Unicode characters */
+ int element_length = 0;
+
+ /* Length of element, in bytes */
+ int element_byte_length = 0;
+
+ /* Current position within the element, in Unicode characters */
+ int current_unicode_length = 0;
+
+ /* Position within buffer */
+ int i = socket->__instructionbuf_parse_start;
+
+ /* Parse instruction in buffer */
+ while (i < socket->__instructionbuf_used_length) {
+
+ /* Read character from buffer */
+ char c = socket->__instructionbuf[i++];
+
+ /* If digit, calculate element length */
+ if (c >= '0' && c <= '9')
+ element_length = element_length * 10 + c - '0';
+
+ /* Otherwise, if end of length */
+ else if (c == '.') {
+
+ /* Calculate element byte length by walking buffer */
+ while (i + element_byte_length <
+ socket->__instructionbuf_used_length
+ && current_unicode_length < element_length) {
+
+ /* Get next byte */
+ c = socket->__instructionbuf[i + element_byte_length];
+
+ /* Update byte and character lengths */
+ element_byte_length += guac_utf8_charsize((unsigned) c);
+ current_unicode_length++;
+
+ }
+
+ /* Verify element is fully read */
+ if (current_unicode_length == element_length) {
+
+ /* Get element value */
+ char* elementv = &(socket->__instructionbuf[i]);
+
+ /* Get terminator, set null terminator of elementv */
+ char terminator = elementv[element_byte_length];
+ elementv[element_byte_length] = '\0';
+
+ /* Move to char after terminator of element */
+ i += element_byte_length+1;
+
+ /* Reset element length */
+ element_length =
+ element_byte_length =
+ current_unicode_length = 0;
+
+ /* As element has been read successfully, update
+ * parse start */
+ socket->__instructionbuf_parse_start = i;
+
+ /* Save element */
+ socket->__instructionbuf_elementv[socket->__instructionbuf_elementc++] = elementv;
+
+ /* Finish parse if terminator is a semicolon */
+ if (terminator == ';') {
+
+ guac_instruction* parsed_instruction;
+ int j;
+
+ /* Allocate instruction */
+ parsed_instruction = malloc(sizeof(guac_instruction));
+ if (parsed_instruction == NULL) {
+ guac_error = GUAC_STATUS_NO_MEMORY;
+ guac_error_message = "Could not allocate memory for parsed instruction";
+ return NULL;
+ }
+
+ /* Init parsed instruction */
+ parsed_instruction->argc = socket->__instructionbuf_elementc - 1;
+ parsed_instruction->argv = malloc(sizeof(char*) * parsed_instruction->argc);
+
+ /* Fail if memory could not be alloc'd for argv */
+ if (parsed_instruction->argv == NULL) {
+ guac_error = GUAC_STATUS_NO_MEMORY;
+ guac_error_message = "Could not allocate memory for arguments of parsed instruction";
+ free(parsed_instruction);
+ return NULL;
+ }
+
+ /* Set opcode */
+ parsed_instruction->opcode = strdup(socket->__instructionbuf_elementv[0]);
+
+ /* Fail if memory could not be alloc'd for opcode */
+ if (parsed_instruction->opcode == NULL) {
+ guac_error = GUAC_STATUS_NO_MEMORY;
+ guac_error_message = "Could not allocate memory for opcode of parsed instruction";
+ free(parsed_instruction->argv);
+ free(parsed_instruction);
+ return NULL;
+ }
+
+
+ /* Copy element values to parsed instruction */
+ for (j=0; j<parsed_instruction->argc; j++) {
+ parsed_instruction->argv[j] = strdup(socket->__instructionbuf_elementv[j+1]);
+
+ /* Free memory and fail if out of mem */
+ if (parsed_instruction->argv[j] == NULL) {
+ guac_error = GUAC_STATUS_NO_MEMORY;
+ guac_error_message = "Could not allocate memory for single argument of parsed instruction";
+
+ /* Free all alloc'd argv values */
+ while (--j >= 0)
+ free(parsed_instruction->argv[j]);
+
+ free(parsed_instruction->opcode);
+ free(parsed_instruction->argv);
+ free(parsed_instruction);
+ return NULL;
+ }
+
+ }
+
+ /* Reset buffer */
+ memmove(socket->__instructionbuf, socket->__instructionbuf + i, socket->__instructionbuf_used_length - i);
+ socket->__instructionbuf_used_length -= i;
+ socket->__instructionbuf_parse_start = 0;
+ socket->__instructionbuf_elementc = 0;
+
+ /* Done */
+ return parsed_instruction;
+
+ } /* end if terminator */
+
+ /* Error if expected comma is not present */
+ else if (terminator != ',') {
+ guac_error = GUAC_STATUS_BAD_ARGUMENT;
+ guac_error_message = "Element terminator of instruction was not ';' nor ','";
+ return NULL;
+ }
+
+ } /* end if element fully read */
+
+ /* Otherwise, read more data */
+ else
+ break;
+
+ }
+
+ /* Error if length is non-numeric or does not end in a period */
+ else {
+ guac_error = GUAC_STATUS_BAD_ARGUMENT;
+ guac_error_message = "Non-numeric character in element length";
+ return NULL;
+ }
+
+ }
+
+ /* No instruction yet? Get more data ... */
+ retval = guac_socket_select(socket, usec_timeout);
+ if (retval <= 0)
+ return NULL;
+
+ /* If more data is available, fill into buffer */
+ retval = __guac_fill_instructionbuf(socket);
+
+ /* Error, guac_error already set */
+ if (retval < 0)
+ return NULL;
+
+ /* EOF */
+ if (retval == 0) {
+ guac_error = GUAC_STATUS_NO_INPUT;
+ guac_error_message = "End of stream reached while reading instruction";
+ return NULL;
+ }
+
+ }
+
+}
+
+
+guac_instruction* guac_instruction_expect(guac_socket* socket, int usec_timeout,
+ const char* opcode) {
+
+ guac_instruction* instruction;
+
+ /* Wait for data until timeout */
+ if (guac_instruction_waiting(socket, usec_timeout) <= 0)
+ return NULL;
+
+ /* Read available instruction */
+ instruction = guac_instruction_read(socket, usec_timeout);
+ if (instruction == NULL)
+ return NULL;
+
+ /* Validate instruction */
+ if (strcmp(instruction->opcode, opcode) != 0) {
+ guac_error = GUAC_STATUS_BAD_STATE;
+ guac_error_message = "Instruction read did not have expected opcode";
+ guac_instruction_free(instruction);
+ return NULL;
+ }
+
+ /* Return instruction if valid */
+ return instruction;
+
+}
+
+
+void guac_instruction_free(guac_instruction* instruction) {
+
+ int argc = instruction->argc;
+
+ /* Free opcode */
+ free(instruction->opcode);
+
+ /* Free argv if set (may be NULL of argc is 0) */
+ if (instruction->argv) {
+
+ /* All argument values */
+ while (argc > 0)
+ free(instruction->argv[--argc]);
+
+ /* Free actual array */
+ free(instruction->argv);
+
+ }
+
+ /* Free instruction */
+ free(instruction);
+
+}
+
+
+int guac_instruction_waiting(guac_socket* socket, int usec_timeout) {
+
+ if (socket->__instructionbuf_used_length > 0)
+ return 1;
+
+ return guac_socket_select(socket, usec_timeout);
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/plugin.c
^
|
@@ -0,0 +1,141 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "client.h"
+#include "client-handlers.h"
+#include "error.h"
+#include "plugin.h"
+#include "protocol.h"
+#include "socket.h"
+#include "time.h"
+
+guac_client_plugin* guac_client_plugin_open(const char* protocol) {
+
+ guac_client_plugin* plugin;
+
+ /* Reference to dlopen()'d plugin */
+ void* client_plugin_handle;
+
+ /* Client args description */
+ const char** client_args;
+
+ /* Pluggable client */
+ char protocol_lib[GUAC_PROTOCOL_LIBRARY_LIMIT] =
+ GUAC_PROTOCOL_LIBRARY_PREFIX;
+
+ union {
+ guac_client_init_handler* client_init;
+ void* obj;
+ } alias;
+
+ /* Add protocol and .so suffix to protocol_lib */
+ strncat(protocol_lib, protocol, GUAC_PROTOCOL_NAME_LIMIT-1);
+ strcat(protocol_lib, GUAC_PROTOCOL_LIBRARY_SUFFIX);
+
+ /* Load client plugin */
+ client_plugin_handle = dlopen(protocol_lib, RTLD_LAZY);
+ if (!client_plugin_handle) {
+ guac_error = GUAC_STATUS_BAD_ARGUMENT;
+ guac_error_message = dlerror();
+ return NULL;
+ }
+
+ dlerror(); /* Clear errors */
+
+ /* Get init function */
+ alias.obj = dlsym(client_plugin_handle, "guac_client_init");
+
+ /* Fail if cannot find guac_client_init */
+ if (dlerror() != NULL) {
+ guac_error = GUAC_STATUS_BAD_ARGUMENT;
+ guac_error_message = dlerror();
+ return NULL;
+ }
+
+ /* Get usage strig */
+ client_args = (const char**) dlsym(client_plugin_handle, "GUAC_CLIENT_ARGS");
+
+ /* Fail if cannot find GUAC_CLIENT_ARGS */
+ if (dlerror() != NULL) {
+ guac_error = GUAC_STATUS_BAD_ARGUMENT;
+ guac_error_message = dlerror();
+ return NULL;
+ }
+
+ /* Allocate plugin */
+ plugin = malloc(sizeof(guac_client_plugin));
+ if (plugin == NULL) {
+ guac_error = GUAC_STATUS_NO_MEMORY;
+ guac_error_message = "Could not allocate memory for client plugin";
+ return NULL;
+ }
+
+ /* Init and return plugin */
+ plugin->__client_plugin_handle = client_plugin_handle;
+ plugin->init_handler = alias.client_init;
+ plugin->args = client_args;
+ return plugin;
+
+}
+
+int guac_client_plugin_close(guac_client_plugin* plugin) {
+
+ /* Unload client plugin */
+ if (dlclose(plugin->__client_plugin_handle)) {
+ guac_error = GUAC_STATUS_BAD_STATE;
+ guac_error_message = dlerror();
+ return -1;
+ }
+
+ /* Free plugin handle */
+ free(plugin);
+ return 0;
+
+}
+
+int guac_client_plugin_init_client(guac_client_plugin* plugin,
+ guac_client* client, int argc, char** argv) {
+
+ return plugin->init_handler(client, argc, argv);
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/pool.c
^
|
@@ -0,0 +1,125 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include "pool.h"
+
+guac_pool* guac_pool_alloc(int size) {
+
+ guac_pool* pool = malloc(sizeof(guac_pool));
+
+ /* If unable to allocate, just return NULL. */
+ if (pool == NULL)
+ return NULL;
+
+ /* Initialize empty pool */
+ pool->min_size = size;
+ pool->__next_value = 0;
+ pool->__head = NULL;
+ pool->__tail = NULL;
+
+ return pool;
+
+}
+
+void guac_pool_free(guac_pool* pool) {
+
+ /* Free all ints in pool */
+ guac_pool_int* current = pool->__head;
+ while (current != NULL) {
+
+ guac_pool_int* old = current;
+ current = current->__next;
+
+ free(old);
+ }
+
+ /* Free pool */
+ free(pool);
+
+}
+
+int guac_pool_next_int(guac_pool* pool) {
+
+ int value;
+
+ /* If more integers are needed, or we are out of integers, return a new one. */
+ if (pool->__head == NULL || pool->__next_value < pool->min_size)
+ return pool->__next_value++;
+
+ /* Otherwise, remove first integer. */
+ value = pool->__head->value;
+
+ /* If only one element exists, reset pool to empty. */
+ if (pool->__tail == pool->__head) {
+ free(pool->__head);
+ pool->__head = NULL;
+ pool->__tail = NULL;
+ }
+
+ /* Otherwise, advance head. */
+ else {
+ guac_pool_int* old_head = pool->__head;
+ pool->__head = old_head->__next;
+ free(old_head);
+ }
+
+ /* Return retrieved value. */
+ return value;
+}
+
+void guac_pool_free_int(guac_pool* pool, int value) {
+
+ /* Allocate and initialize new returned value */
+ guac_pool_int* pool_int = malloc(sizeof(guac_pool_int));
+ pool_int->value = value;
+ pool_int->__next = NULL;
+
+ /* If pool empty, store as sole entry. */
+ if (pool->__tail == NULL)
+ pool->__head = pool->__tail = pool_int;
+
+ /* Otherwise, append to end of pool. */
+ else {
+ pool->__tail->__next = pool_int;
+ pool->__tail = pool_int;
+ }
+
+}
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/src/protocol.c
^
|
@@ -35,14 +35,6 @@
*
* ***** END LICENSE BLOCK ***** */
-#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_NANOSLEEP)
-#include <time.h>
-#endif
-
-#ifndef HAVE_CLOCK_GETTIME
-#include <sys/time.h>
-#endif
-
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
@@ -60,16 +52,11 @@
#include <sys/types.h>
-#ifdef __MINGW32__
-#include <winsock2.h>
-#else
-#include <sys/socket.h>
-#endif
-
-#include "socket.h"
-#include "protocol.h"
#include "error.h"
+#include "layer.h"
#include "palette.h"
+#include "protocol.h"
+#include "socket.h"
#include "unicode.h"
/* Output formatting functions */
@@ -96,7 +83,7 @@
ssize_t __guac_socket_write_length_double(guac_socket* socket, double d) {
char buffer[128];
- snprintf(buffer, sizeof(buffer), "%g", d);
+ snprintf(buffer, sizeof(buffer), "%.16g", d);
return __guac_socket_write_length_string(socket, buffer);
}
@@ -366,323 +353,6 @@
}
-/* Instruction I/O */
-
-int __guac_fill_instructionbuf(guac_socket* socket) {
-
- int retval;
-
- /* Attempt to fill buffer */
- retval = read(
- socket->fd,
- socket->__instructionbuf + socket->__instructionbuf_used_length,
- socket->__instructionbuf_size - socket->__instructionbuf_used_length
- );
-
- /* Set guac_error if recv() unsuccessful */
- if (retval < 0) {
- guac_error = GUAC_STATUS_SEE_ERRNO;
- guac_error_message = "Error filling instruction buffer";
- return retval;
- }
-
- socket->__instructionbuf_used_length += retval;
-
- /* Expand buffer if necessary */
- if (socket->__instructionbuf_used_length >
- socket->__instructionbuf_size / 2) {
-
- socket->__instructionbuf_size *= 2;
- socket->__instructionbuf = realloc(socket->__instructionbuf,
- socket->__instructionbuf_size);
- }
-
- return retval;
-
-}
-
-
-/* Returns new instruction if one exists, or NULL if no more instructions. */
-guac_instruction* guac_protocol_read_instruction(guac_socket* socket,
- int usec_timeout) {
-
- int retval;
-
- /* Loop until a instruction is read */
- for (;;) {
-
- /* Length of element, in Unicode characters */
- int element_length = 0;
-
- /* Length of element, in bytes */
- int element_byte_length = 0;
-
- /* Current position within the element, in Unicode characters */
- int current_unicode_length = 0;
-
- /* Position within buffer */
- int i = socket->__instructionbuf_parse_start;
-
- /* Parse instruction in buffer */
- while (i < socket->__instructionbuf_used_length) {
-
- /* Read character from buffer */
- char c = socket->__instructionbuf[i++];
-
- /* If digit, calculate element length */
- if (c >= '0' && c <= '9')
- element_length = element_length * 10 + c - '0';
-
- /* Otherwise, if end of length */
- else if (c == '.') {
-
- /* Calculate element byte length by walking buffer */
- while (i + element_byte_length <
- socket->__instructionbuf_used_length
- && current_unicode_length < element_length) {
-
- /* Get next byte */
- c = socket->__instructionbuf[i + element_byte_length];
-
- /* Update byte and character lengths */
- element_byte_length += guac_utf8_charsize((unsigned) c);
- current_unicode_length++;
-
- }
-
- /* Verify element is fully read */
- if (current_unicode_length == element_length) {
-
- /* Get element value */
- char* elementv = &(socket->__instructionbuf[i]);
-
- /* Get terminator, set null terminator of elementv */
- char terminator = elementv[element_byte_length];
- elementv[element_byte_length] = '\0';
-
- /* Move to char after terminator of element */
- i += element_byte_length+1;
-
- /* Reset element length */
- element_length =
- element_byte_length =
- current_unicode_length = 0;
-
- /* As element has been read successfully, update
- * parse start */
- socket->__instructionbuf_parse_start = i;
-
- /* Save element */
- socket->__instructionbuf_elementv[socket->__instructionbuf_elementc++] = elementv;
-
- /* Finish parse if terminator is a semicolon */
- if (terminator == ';') {
-
- guac_instruction* parsed_instruction;
- int j;
-
- /* Allocate instruction */
- parsed_instruction = malloc(sizeof(guac_instruction));
- if (parsed_instruction == NULL) {
- guac_error = GUAC_STATUS_NO_MEMORY;
- guac_error_message = "Could not allocate memory for parsed instruction";
- return NULL;
- }
-
- /* Init parsed instruction */
- parsed_instruction->argc = socket->__instructionbuf_elementc - 1;
- parsed_instruction->argv = malloc(sizeof(char*) * parsed_instruction->argc);
-
- /* Fail if memory could not be alloc'd for argv */
- if (parsed_instruction->argv == NULL) {
- guac_error = GUAC_STATUS_NO_MEMORY;
- guac_error_message = "Could not allocate memory for arguments of parsed instruction";
- free(parsed_instruction);
- return NULL;
- }
-
- /* Set opcode */
- parsed_instruction->opcode = strdup(socket->__instructionbuf_elementv[0]);
-
- /* Fail if memory could not be alloc'd for opcode */
- if (parsed_instruction->opcode == NULL) {
- guac_error = GUAC_STATUS_NO_MEMORY;
- guac_error_message = "Could not allocate memory for opcode of parsed instruction";
- free(parsed_instruction->argv);
- free(parsed_instruction);
- return NULL;
- }
-
-
- /* Copy element values to parsed instruction */
- for (j=0; j<parsed_instruction->argc; j++) {
- parsed_instruction->argv[j] = strdup(socket->__instructionbuf_elementv[j+1]);
-
- /* Free memory and fail if out of mem */
- if (parsed_instruction->argv[j] == NULL) {
- guac_error = GUAC_STATUS_NO_MEMORY;
- guac_error_message = "Could not allocate memory for single argument of parsed instruction";
-
- /* Free all alloc'd argv values */
- while (--j >= 0)
- free(parsed_instruction->argv[j]);
-
- free(parsed_instruction->opcode);
- free(parsed_instruction->argv);
- free(parsed_instruction);
- return NULL;
- }
-
- }
-
- /* Reset buffer */
- memmove(socket->__instructionbuf, socket->__instructionbuf + i, socket->__instructionbuf_used_length - i);
- socket->__instructionbuf_used_length -= i;
- socket->__instructionbuf_parse_start = 0;
- socket->__instructionbuf_elementc = 0;
-
- /* Done */
- return parsed_instruction;
-
- } /* end if terminator */
-
- /* Error if expected comma is not present */
- else if (terminator != ',') {
- guac_error = GUAC_STATUS_BAD_ARGUMENT;
- guac_error_message = "Element terminator of instructioni was not ';' nor ','";
- return NULL;
- }
-
- } /* end if element fully read */
-
- /* Otherwise, read more data */
- else
- break;
-
- }
-
- /* Error if length is non-numeric or does not end in a period */
- else {
- guac_error = GUAC_STATUS_BAD_ARGUMENT;
- guac_error_message = "Non-numeric character in element length";
- return NULL;
- }
-
- }
-
- /* No instruction yet? Get more data ... */
- retval = guac_socket_select(socket, usec_timeout);
- if (retval <= 0)
- return NULL;
-
- /* If more data is available, fill into buffer */
- retval = __guac_fill_instructionbuf(socket);
-
- /* Error, guac_error already set */
- if (retval < 0)
- return NULL;
-
- /* EOF */
- if (retval == 0) {
- guac_error = GUAC_STATUS_NO_INPUT;
- guac_error_message = "End of stream reached while reading instruction";
- return NULL;
- }
-
- }
-
-}
-
-
-guac_instruction* guac_protocol_expect_instruction(guac_socket* socket, int usec_timeout,
- const char* opcode) {
-
- guac_instruction* instruction;
-
- /* Wait for data until timeout */
- if (guac_protocol_instructions_waiting(socket, usec_timeout) <= 0)
- return NULL;
-
- /* Read available instruction */
- instruction = guac_protocol_read_instruction(socket, usec_timeout);
- if (instruction == NULL)
- return NULL;
-
- /* Validate instruction */
- if (strcmp(instruction->opcode, opcode) != 0) {
- guac_error = GUAC_STATUS_BAD_STATE;
- guac_error_message = "Instruction read did not have expected opcode";
- guac_instruction_free(instruction);
- return NULL;
- }
-
- /* Return instruction if valid */
- return instruction;
-
-}
-
-
-void guac_instruction_free(guac_instruction* instruction) {
-
- int argc = instruction->argc;
-
- /* Free opcode */
- free(instruction->opcode);
-
- /* Free argv if set (may be NULL of argc is 0) */
- if (instruction->argv) {
-
- /* All argument values */
- while (argc > 0)
- free(instruction->argv[--argc]);
-
- /* Free actual array */
- free(instruction->argv);
-
- }
-
- /* Free instruction */
- free(instruction);
-
-}
-
-
-int guac_protocol_instructions_waiting(guac_socket* socket, int usec_timeout) {
-
- if (socket->__instructionbuf_used_length > 0)
- return 1;
-
- return guac_socket_select(socket, usec_timeout);
-}
-
-
-guac_timestamp guac_protocol_get_timestamp() {
-
-#ifdef HAVE_CLOCK_GETTIME
-
- struct timespec current;
-
- /* Get current time */
- clock_gettime(CLOCK_REALTIME, ¤t);
-
- /* Calculate milliseconds */
- return (guac_timestamp) current.tv_sec * 1000 + current.tv_nsec / 1000000;
-
-#else
-
- struct timeval current;
-
- /* Get current time */
- gettimeofday(¤t, NULL);
-
- /* Calculate milliseconds */
- return (guac_timestamp) current.tv_sec * 1000 + current.tv_usec / 1000;
-
-#endif
-
-}
-
-
/* Protocol functions */
int guac_protocol_send_args(guac_socket* socket, const char** args) {
@@ -729,6 +399,48 @@
}
+int guac_protocol_send_audio(guac_socket* socket, int channel,
+ const char* mimetype, double duration, void* data, int size) {
+
+ return
+ guac_protocol_send_audio_header(socket, channel,
+ mimetype, duration, size)
+ || guac_protocol_send_audio_data(socket, data, size)
+ || guac_protocol_send_audio_end(socket);
+
+}
+
+int guac_protocol_send_audio_header(guac_socket* socket,
+ int channel, const char* mimetype, double duration, int size) {
+
+ int base64_length = (size + 2) / 3 * 4;
+
+ return
+ guac_socket_write_string(socket, "5.audio,")
+ || __guac_socket_write_length_int(socket, channel)
+ || guac_socket_write_string(socket, ",")
+ || __guac_socket_write_length_string(socket, mimetype)
+ || guac_socket_write_string(socket, ",")
+ || __guac_socket_write_length_double(socket, duration)
+ || guac_socket_write_string(socket, ",")
+ || guac_socket_write_int(socket, base64_length)
+ || guac_socket_write_string(socket, ".");
+
+}
+
+int guac_protocol_send_audio_data(guac_socket* socket, void* data, int count) {
+
+ return guac_socket_write_base64(socket, data, count);
+
+}
+
+int guac_protocol_send_audio_end(guac_socket* socket) {
+
+ return
+ guac_socket_flush_base64(socket)
+ || guac_socket_write_string(socket, ";");
+
+}
int guac_protocol_send_cfill(guac_socket* socket,
guac_composite_mode mode, const guac_layer* layer,
@@ -953,6 +665,48 @@
}
+int guac_protocol_send_file(guac_socket* socket, const char* name,
+ const char* mimetype, void* data, int size) {
+
+ return
+ guac_protocol_send_file_header(socket, name,
+ mimetype, size)
+ || guac_protocol_send_file_data(socket, data, size)
+ || guac_protocol_send_file_end(socket);
+
+}
+
+int guac_protocol_send_file_header(guac_socket* socket, const char* name,
+ const char* mimetype, int size) {
+
+ int base64_length = (size + 2) / 3 * 4;
+
+ return
+ guac_socket_write_string(socket, "4.file,")
+ || __guac_socket_write_length_string(socket, name)
+ || guac_socket_write_string(socket, ",")
+ || __guac_socket_write_length_string(socket, mimetype)
+ || guac_socket_write_string(socket, ",")
+ || guac_socket_write_int(socket, base64_length)
+ || guac_socket_write_string(socket, ".");
+
+}
+
+int guac_protocol_send_file_data(guac_socket* socket, void* data, int count) {
+
+ return guac_socket_write_base64(socket, data, count);
+
+}
+
+int guac_protocol_send_file_end(guac_socket* socket) {
+
+ return
+ guac_socket_flush_base64(socket)
+ || guac_socket_write_string(socket, ";");
+
+}
+
+
int guac_protocol_send_identity(guac_socket* socket, const guac_layer* layer) {
return
@@ -1045,6 +799,17 @@
}
+int guac_protocol_send_nest(guac_socket* socket, int index,
+ const char* data) {
+
+ return
+ guac_socket_write_string(socket, "4.nest,")
+ || __guac_socket_write_length_int(socket, index)
+ || guac_socket_write_string(socket, ",")
+ || __guac_socket_write_length_string(socket, data)
+ || guac_socket_write_string(socket, ";");
+
+}
int guac_protocol_send_png(guac_socket* socket, guac_composite_mode mode,
const guac_layer* layer, int x, int y, cairo_surface_t* surface) {
@@ -1243,4 +1008,46 @@
}
+int guac_protocol_send_video(guac_socket* socket, const guac_layer* layer,
+ const char* mimetype, double duration, void* data, int size) {
+
+ return
+ guac_protocol_send_video_header(socket, layer,
+ mimetype, duration, size)
+ || guac_protocol_send_video_data(socket, data, size)
+ || guac_protocol_send_video_end(socket);
+
+}
+
+int guac_protocol_send_video_header(guac_socket* socket,
+ const guac_layer* layer, const char* mimetype, double duration, int size) {
+
+ int base64_length = (size + 2) / 3 * 4;
+
+ return
+ guac_socket_write_string(socket, "5.video,")
+ || __guac_socket_write_length_int(socket, layer->index)
+ || guac_socket_write_string(socket, ",")
+ || __guac_socket_write_length_string(socket, mimetype)
+ || guac_socket_write_string(socket, ",")
+ || __guac_socket_write_length_double(socket, duration)
+ || guac_socket_write_string(socket, ",")
+ || guac_socket_write_int(socket, base64_length)
+ || guac_socket_write_string(socket, ".");
+
+}
+
+int guac_protocol_send_video_data(guac_socket* socket, void* data, int count) {
+
+ return guac_socket_write_base64(socket, data, count);
+
+}
+
+int guac_protocol_send_video_end(guac_socket* socket) {
+
+ return
+ guac_socket_flush_base64(socket)
+ || guac_socket_write_string(socket, ";");
+
+}
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/socket-fd.c
^
|
@@ -0,0 +1,163 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * David PHAM-VAN <d.pham-van@ulteo.com> Ulteo SAS - http://www.ulteo.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+#ifdef __MINGW32__
+#include <winsock2.h>
+#else
+#include <sys/select.h>
+#endif
+
+#include <time.h>
+#include <sys/time.h>
+
+#include "socket.h"
+#include "error.h"
+
+typedef struct __guac_socket_fd_data {
+
+ int fd;
+
+} __guac_socket_fd_data;
+
+ssize_t __guac_socket_fd_read_handler(guac_socket* socket,
+ void* buf, size_t count) {
+
+ __guac_socket_fd_data* data = (__guac_socket_fd_data*) socket->data;
+
+ /* Read from socket */
+ int retval = read(data->fd, buf, count);
+
+ /* Record errors in guac_error */
+ if (retval < 0) {
+ guac_error = GUAC_STATUS_SEE_ERRNO;
+ guac_error_message = "Error reading data from socket";
+ }
+
+ return retval;
+
+}
+
+ssize_t __guac_socket_fd_write_handler(guac_socket* socket,
+ void* buf, size_t count) {
+
+ __guac_socket_fd_data* data = (__guac_socket_fd_data*) socket->data;
+ int retval;
+
+#ifdef __MINGW32__
+ /* MINGW32 WINSOCK only works with send() */
+ retval = send(data->fd, buf, count, 0);
+#else
+ /* Use write() for all other platforms */
+ retval = write(data->fd, buf, count);
+#endif
+
+ /* Record errors in guac_error */
+ if (retval < 0) {
+ guac_error = GUAC_STATUS_SEE_ERRNO;
+ guac_error_message = "Error writing data to socket";
+ }
+
+ return retval;
+}
+
+
+int __guac_socket_fd_select_handler(guac_socket* socket, int usec_timeout) {
+
+ __guac_socket_fd_data* data = (__guac_socket_fd_data*) socket->data;
+
+ fd_set fds;
+ struct timeval timeout;
+ int retval;
+
+ /* No timeout if usec_timeout is negative */
+ if (usec_timeout < 0)
+ retval = select(data->fd + 1, &fds, NULL, NULL, NULL);
+
+ /* Handle timeout if specified */
+ else {
+ timeout.tv_sec = usec_timeout/1000000;
+ timeout.tv_usec = usec_timeout%1000000;
+
+ FD_ZERO(&fds);
+ FD_SET(data->fd, &fds);
+
+ retval = select(data->fd + 1, &fds, NULL, NULL, &timeout);
+ }
+
+ /* Properly set guac_error */
+ if (retval < 0) {
+ guac_error = GUAC_STATUS_SEE_ERRNO;
+ guac_error_message = "Error while waiting for data on socket";
+ }
+
+ if (retval == 0) {
+ guac_error = GUAC_STATUS_INPUT_TIMEOUT;
+ guac_error_message = "Timeout while waiting for data on socket";
+ }
+
+ return retval;
+
+}
+
+guac_socket* guac_socket_open(int fd) {
+
+ /* Allocate socket and associated data */
+ guac_socket* socket = guac_socket_alloc();
+ __guac_socket_fd_data* data = malloc(sizeof(__guac_socket_fd_data));
+
+ /* Store file descriptor as socket data */
+ data->fd = fd;
+ socket->data = data;
+
+ /* Set read/write handlers */
+ socket->read_handler = __guac_socket_fd_read_handler;
+ socket->write_handler = __guac_socket_fd_write_handler;
+ socket->select_handler = __guac_socket_fd_select_handler;
+
+ return socket;
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/socket-nest.c
^
|
@@ -0,0 +1,152 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * David PHAM-VAN <d.pham-van@ulteo.com> Ulteo SAS - http://www.ulteo.com
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <inttypes.h>
+
+#ifdef __MINGW32__
+#include <winsock2.h>
+#else
+#include <sys/select.h>
+#endif
+
+#include <time.h>
+#include <sys/time.h>
+
+#include "socket.h"
+#include "protocol.h"
+#include "error.h"
+#include "unicode.h"
+
+#define GUAC_SOCKET_NEST_BUFFER_SIZE 8192
+
+typedef struct __guac_socket_nest_data {
+
+ guac_socket* parent;
+ char buffer[GUAC_SOCKET_NEST_BUFFER_SIZE];
+ int index;
+
+} __guac_socket_nest_data;
+
+ssize_t __guac_socket_nest_write_handler(guac_socket* socket,
+ void* buf, size_t count) {
+
+ __guac_socket_nest_data* data = (__guac_socket_nest_data*) socket->data;
+ unsigned char* source = (unsigned char*) buf;
+
+ /* Current location in destination buffer during copy */
+ char* current = data->buffer;
+
+ /* Number of bytes remaining in source buffer */
+ int remaining = count;
+
+ /* If we can't actually store that many bytes, reduce number of bytes
+ * expected to be written */
+ if (remaining > GUAC_SOCKET_NEST_BUFFER_SIZE)
+ remaining = GUAC_SOCKET_NEST_BUFFER_SIZE;
+
+ /* Current offset within destination buffer */
+ int offset;
+
+ /* Number of characters before start of next character */
+ int skip = 0;
+
+ /* Copy UTF-8 characters into buffer */
+ for (offset = 0; offset < GUAC_SOCKET_NEST_BUFFER_SIZE; offset++) {
+
+ /* Get next byte */
+ unsigned char c = *source;
+ remaining--;
+
+ /* If skipping, then skip */
+ if (skip > 0) skip--;
+
+ /* Otherwise, determine next skip value, and increment length */
+ else {
+
+ /* Determine skip value (size in bytes of rest of character) */
+ skip = guac_utf8_charsize(c) - 1;
+
+ /* If not enough bytes to complete character, break */
+ if (skip > remaining)
+ break;
+
+ }
+
+ /* Store byte */
+ *current = c;
+
+ /* Advance to next character */
+ source++;
+ current++;
+
+ }
+
+ /* Append null-terminator */
+ *current = 0;
+
+ /* Send nest instruction containing read UTF-8 segment */
+ guac_protocol_send_nest(data->parent, data->index, data->buffer);
+
+ /* Return number of bytes actually written */
+ return offset;
+
+}
+
+guac_socket* guac_socket_nest(guac_socket* parent, int index) {
+
+ /* Allocate socket and associated data */
+ guac_socket* socket = guac_socket_alloc();
+ __guac_socket_nest_data* data = malloc(sizeof(__guac_socket_nest_data));
+
+ /* Store file descriptor as socket data */
+ data->parent = parent;
+ socket->data = data;
+
+ /* Set write handler */
+ socket->write_handler = __guac_socket_nest_write_handler;
+
+ return socket;
+
+}
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/src/socket.c
^
|
@@ -57,13 +57,51 @@
#include "error.h"
char __guac_socket_BASE64_CHARACTERS[64] = {
- 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
- 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
- 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
- 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
+ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
+ 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd',
+ 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
+ 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', '+', '/'
};
-guac_socket* guac_socket_open(int fd) {
+ssize_t __guac_socket_write(guac_socket* socket,
+ void* buf, size_t count) {
+
+ /* If handler defined, call it. */
+ if (socket->write_handler)
+ return socket->write_handler(socket, buf, count);
+
+ /* Otherwise, pretend everything was written. */
+ return count;
+
+}
+
+/* TODO: Implement guac_socket_write (buffered write) */
+
+ssize_t guac_socket_read(guac_socket* socket, void* buf, size_t count) {
+
+ /* If handler defined, call it. */
+ if (socket->read_handler)
+ return socket->read_handler(socket, buf, count);
+
+ /* Otherwise, pretend nothing was read. */
+ return 0;
+
+}
+
+int guac_socket_select(guac_socket* socket, int usec_timeout) {
+
+ /* Call select handler if defined */
+ if (socket->select_handler)
+ return socket->select_handler(socket, usec_timeout);
+
+ /* Otherwise, assume ready. */
+ return 1;
+
+}
+
+
+guac_socket* guac_socket_alloc() {
guac_socket* socket = malloc(sizeof(guac_socket));
@@ -76,7 +114,7 @@
socket->__ready = 0;
socket->__written = 0;
- socket->fd = fd;
+ socket->data = NULL;
/* Allocate instruction buffer */
socket->__instructionbuf_size = 1024;
@@ -95,38 +133,27 @@
socket->__instructionbuf_parse_start = 0;
socket->__instructionbuf_elementc = 0;
+ /* No handlers yet */
+ socket->read_handler = NULL;
+ socket->write_handler = NULL;
+ socket->select_handler = NULL;
+ socket->free_handler = NULL;
+
return socket;
}
-void guac_socket_close(guac_socket* socket) {
+void guac_socket_free(guac_socket* socket) {
+
+ /* Call free handler if defined */
+ if (socket->free_handler)
+ socket->free_handler(socket);
+
guac_socket_flush(socket);
free(socket->__instructionbuf);
free(socket);
}
-/* Write bytes, limit rate */
-ssize_t __guac_socket_write(guac_socket* socket, const char* buf, int count) {
-
- int retval;
-
-#ifdef __MINGW32__
- /* MINGW32 WINSOCK only works with send() */
- retval = send(socket->fd, buf, count, 0);
-#else
- /* Use write() for all other platforms */
- retval = write(socket->fd, buf, count);
-#endif
-
- /* Record errors in guac_error */
- if (retval < 0) {
- guac_error = GUAC_STATUS_SEE_ERRNO;
- guac_error_message = "Error writing data to socket";
- }
-
- return retval;
-}
-
ssize_t guac_socket_write_int(guac_socket* socket, int64_t i) {
char buffer[128];
@@ -154,6 +181,7 @@
return retval;
socket->__written = 0;
+
}
}
@@ -255,7 +283,8 @@
/* Flush remaining bytes in buffer */
if (socket->__written > 0) {
- retval = __guac_socket_write(socket, socket->__out_buf, socket->__written);
+ retval = __guac_socket_write(socket,
+ socket->__out_buf, socket->__written);
if (retval < 0)
return retval;
@@ -281,40 +310,3 @@
}
-
-int guac_socket_select(guac_socket* socket, int usec_timeout) {
-
- fd_set fds;
- struct timeval timeout;
- int retval;
-
- /* No timeout if usec_timeout is negative */
- if (usec_timeout < 0)
- retval = select(socket->fd + 1, &fds, NULL, NULL, NULL);
-
- /* Handle timeout if specified */
- else {
- timeout.tv_sec = usec_timeout/1000000;
- timeout.tv_usec = usec_timeout%1000000;
-
- FD_ZERO(&fds);
- FD_SET(socket->fd, &fds);
-
- retval = select(socket->fd + 1, &fds, NULL, NULL, &timeout);
- }
-
- /* Properly set guac_error */
- if (retval < 0) {
- guac_error = GUAC_STATUS_SEE_ERRNO;
- guac_error_message = "Error while waiting for data on socket";
- }
-
- if (retval == 0) {
- guac_error = GUAC_STATUS_INPUT_TIMEOUT;
- guac_error_message = "Timeout while waiting for data on socket";
- }
-
- return retval;
-
-}
-
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/src/timestamp.c
^
|
@@ -0,0 +1,73 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#if defined(HAVE_CLOCK_GETTIME) || defined(HAVE_NANOSLEEP)
+#include <time.h>
+#endif
+
+#ifndef HAVE_CLOCK_GETTIME
+#include <sys/time.h>
+#endif
+
+#include "timestamp.h"
+
+guac_timestamp guac_timestamp_current() {
+
+#ifdef HAVE_CLOCK_GETTIME
+
+ struct timespec current;
+
+ /* Get current time */
+ clock_gettime(CLOCK_REALTIME, ¤t);
+
+ /* Calculate milliseconds */
+ return (guac_timestamp) current.tv_sec * 1000 + current.tv_nsec / 1000000;
+
+#else
+
+ struct timeval current;
+
+ /* Get current time */
+ gettimeofday(¤t, NULL);
+
+ /* Calculate milliseconds */
+ return (guac_timestamp) current.tv_sec * 1000 + current.tv_usec / 1000;
+
+#endif
+
+}
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/tests/Makefile.am
^
|
@@ -38,17 +38,25 @@
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Werror -Wall -pedantic -I../include
-TESTS = test_protocol
-check_PROGRAMS = test_protocol
+TESTS = test_libguac
+check_PROGRAMS = test_libguac
-test_protocol_SOURCES = \
- test_protocol.c \
+noinst_HEADERS = \
+ client/client_suite.h \
+ protocol/suite.h \
+ util/util_suite.h
+
+test_libguac_SOURCES = \
+ test_libguac.c \
+ client/client_suite.c \
+ client/buffer_pool.c \
+ client/layer_pool.c \
protocol/suite.c \
protocol/instruction_read.c \
- protocol/instruction_write.c
-
-noinst_HEADERS = \
- protocol/suite.h
+ protocol/instruction_write.c \
+ protocol/nest_write.c \
+ util/util_suite.c \
+ util/guac_pool.c
-test_protocol_LDADD = $(top_builddir)/src/libguac.la @CUNIT_LIBS@
+test_libguac_LDADD = $(top_builddir)/src/libguac.la @CUNIT_LIBS@
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/tests/Makefile.in
^
|
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
+# Makefile.in generated by automake 1.11.6 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -52,6 +52,23 @@
# ***** END LICENSE BLOCK *****
VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
pkgdatadir = $(datadir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -70,8 +87,8 @@
POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
-TESTS = test_protocol$(EXEEXT)
-check_PROGRAMS = test_protocol$(EXEEXT)
+TESTS = test_libguac$(EXEEXT)
+check_PROGRAMS = test_libguac$(EXEEXT)
subdir = tests
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
@@ -85,10 +102,13 @@
mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
-am_test_protocol_OBJECTS = test_protocol.$(OBJEXT) suite.$(OBJEXT) \
- instruction_read.$(OBJEXT) instruction_write.$(OBJEXT)
-test_protocol_OBJECTS = $(am_test_protocol_OBJECTS)
-test_protocol_DEPENDENCIES = $(top_builddir)/src/libguac.la
+am_test_libguac_OBJECTS = test_libguac.$(OBJEXT) \
+ client_suite.$(OBJEXT) buffer_pool.$(OBJEXT) \
+ layer_pool.$(OBJEXT) suite.$(OBJEXT) \
+ instruction_read.$(OBJEXT) instruction_write.$(OBJEXT) \
+ nest_write.$(OBJEXT) util_suite.$(OBJEXT) guac_pool.$(OBJEXT)
+test_libguac_OBJECTS = $(am_test_libguac_OBJECTS)
+test_libguac_DEPENDENCIES = $(top_builddir)/src/libguac.la
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@@ -102,8 +122,13 @@
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(test_protocol_SOURCES)
-DIST_SOURCES = $(test_protocol_SOURCES)
+SOURCES = $(test_libguac_SOURCES)
+DIST_SOURCES = $(test_libguac_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -227,16 +252,24 @@
AUTOMAKE_OPTIONS = foreign
ACLOCAL_AMFLAGS = -I m4
AM_CFLAGS = -Werror -Wall -pedantic -I../include
-test_protocol_SOURCES = \
- test_protocol.c \
+noinst_HEADERS = \
+ client/client_suite.h \
+ protocol/suite.h \
+ util/util_suite.h
+
+test_libguac_SOURCES = \
+ test_libguac.c \
+ client/client_suite.c \
+ client/buffer_pool.c \
+ client/layer_pool.c \
protocol/suite.c \
protocol/instruction_read.c \
- protocol/instruction_write.c
-
-noinst_HEADERS = \
- protocol/suite.h
+ protocol/instruction_write.c \
+ protocol/nest_write.c \
+ util/util_suite.c \
+ util/guac_pool.c
-test_protocol_LDADD = $(top_builddir)/src/libguac.la @CUNIT_LIBS@
+test_libguac_LDADD = $(top_builddir)/src/libguac.la @CUNIT_LIBS@
all: all-am
.SUFFIXES:
@@ -280,9 +313,9 @@
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-test_protocol$(EXEEXT): $(test_protocol_OBJECTS) $(test_protocol_DEPENDENCIES) $(EXTRA_test_protocol_DEPENDENCIES)
- @rm -f test_protocol$(EXEEXT)
- $(LINK) $(test_protocol_OBJECTS) $(test_protocol_LDADD) $(LIBS)
+test_libguac$(EXEEXT): $(test_libguac_OBJECTS) $(test_libguac_DEPENDENCIES) $(EXTRA_test_libguac_DEPENDENCIES)
+ @rm -f test_libguac$(EXEEXT)
+ $(LINK) $(test_libguac_OBJECTS) $(test_libguac_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -290,10 +323,16 @@
distclean-compile:
-rm -f *.tab.c
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/buffer_pool.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client_suite.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/guac_pool.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instruction_read.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/instruction_write.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/layer_pool.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nest_write.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/suite.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_protocol.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_libguac.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util_suite.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -316,6 +355,48 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+client_suite.o: client/client_suite.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT client_suite.o -MD -MP -MF $(DEPDIR)/client_suite.Tpo -c -o client_suite.o `test -f 'client/client_suite.c' || echo '$(srcdir)/'`client/client_suite.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/client_suite.Tpo $(DEPDIR)/client_suite.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client/client_suite.c' object='client_suite.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o client_suite.o `test -f 'client/client_suite.c' || echo '$(srcdir)/'`client/client_suite.c
+
+client_suite.obj: client/client_suite.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT client_suite.obj -MD -MP -MF $(DEPDIR)/client_suite.Tpo -c -o client_suite.obj `if test -f 'client/client_suite.c'; then $(CYGPATH_W) 'client/client_suite.c'; else $(CYGPATH_W) '$(srcdir)/client/client_suite.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/client_suite.Tpo $(DEPDIR)/client_suite.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client/client_suite.c' object='client_suite.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o client_suite.obj `if test -f 'client/client_suite.c'; then $(CYGPATH_W) 'client/client_suite.c'; else $(CYGPATH_W) '$(srcdir)/client/client_suite.c'; fi`
+
+buffer_pool.o: client/buffer_pool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT buffer_pool.o -MD -MP -MF $(DEPDIR)/buffer_pool.Tpo -c -o buffer_pool.o `test -f 'client/buffer_pool.c' || echo '$(srcdir)/'`client/buffer_pool.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/buffer_pool.Tpo $(DEPDIR)/buffer_pool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client/buffer_pool.c' object='buffer_pool.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o buffer_pool.o `test -f 'client/buffer_pool.c' || echo '$(srcdir)/'`client/buffer_pool.c
+
+buffer_pool.obj: client/buffer_pool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT buffer_pool.obj -MD -MP -MF $(DEPDIR)/buffer_pool.Tpo -c -o buffer_pool.obj `if test -f 'client/buffer_pool.c'; then $(CYGPATH_W) 'client/buffer_pool.c'; else $(CYGPATH_W) '$(srcdir)/client/buffer_pool.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/buffer_pool.Tpo $(DEPDIR)/buffer_pool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client/buffer_pool.c' object='buffer_pool.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o buffer_pool.obj `if test -f 'client/buffer_pool.c'; then $(CYGPATH_W) 'client/buffer_pool.c'; else $(CYGPATH_W) '$(srcdir)/client/buffer_pool.c'; fi`
+
+layer_pool.o: client/layer_pool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT layer_pool.o -MD -MP -MF $(DEPDIR)/layer_pool.Tpo -c -o layer_pool.o `test -f 'client/layer_pool.c' || echo '$(srcdir)/'`client/layer_pool.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/layer_pool.Tpo $(DEPDIR)/layer_pool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client/layer_pool.c' object='layer_pool.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o layer_pool.o `test -f 'client/layer_pool.c' || echo '$(srcdir)/'`client/layer_pool.c
+
+layer_pool.obj: client/layer_pool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT layer_pool.obj -MD -MP -MF $(DEPDIR)/layer_pool.Tpo -c -o layer_pool.obj `if test -f 'client/layer_pool.c'; then $(CYGPATH_W) 'client/layer_pool.c'; else $(CYGPATH_W) '$(srcdir)/client/layer_pool.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/layer_pool.Tpo $(DEPDIR)/layer_pool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='client/layer_pool.c' object='layer_pool.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o layer_pool.obj `if test -f 'client/layer_pool.c'; then $(CYGPATH_W) 'client/layer_pool.c'; else $(CYGPATH_W) '$(srcdir)/client/layer_pool.c'; fi`
+
suite.o: protocol/suite.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT suite.o -MD -MP -MF $(DEPDIR)/suite.Tpo -c -o suite.o `test -f 'protocol/suite.c' || echo '$(srcdir)/'`protocol/suite.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/suite.Tpo $(DEPDIR)/suite.Po
@@ -358,6 +439,48 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o instruction_write.obj `if test -f 'protocol/instruction_write.c'; then $(CYGPATH_W) 'protocol/instruction_write.c'; else $(CYGPATH_W) '$(srcdir)/protocol/instruction_write.c'; fi`
+nest_write.o: protocol/nest_write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nest_write.o -MD -MP -MF $(DEPDIR)/nest_write.Tpo -c -o nest_write.o `test -f 'protocol/nest_write.c' || echo '$(srcdir)/'`protocol/nest_write.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nest_write.Tpo $(DEPDIR)/nest_write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protocol/nest_write.c' object='nest_write.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nest_write.o `test -f 'protocol/nest_write.c' || echo '$(srcdir)/'`protocol/nest_write.c
+
+nest_write.obj: protocol/nest_write.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nest_write.obj -MD -MP -MF $(DEPDIR)/nest_write.Tpo -c -o nest_write.obj `if test -f 'protocol/nest_write.c'; then $(CYGPATH_W) 'protocol/nest_write.c'; else $(CYGPATH_W) '$(srcdir)/protocol/nest_write.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/nest_write.Tpo $(DEPDIR)/nest_write.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='protocol/nest_write.c' object='nest_write.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nest_write.obj `if test -f 'protocol/nest_write.c'; then $(CYGPATH_W) 'protocol/nest_write.c'; else $(CYGPATH_W) '$(srcdir)/protocol/nest_write.c'; fi`
+
+util_suite.o: util/util_suite.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT util_suite.o -MD -MP -MF $(DEPDIR)/util_suite.Tpo -c -o util_suite.o `test -f 'util/util_suite.c' || echo '$(srcdir)/'`util/util_suite.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/util_suite.Tpo $(DEPDIR)/util_suite.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util/util_suite.c' object='util_suite.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o util_suite.o `test -f 'util/util_suite.c' || echo '$(srcdir)/'`util/util_suite.c
+
+util_suite.obj: util/util_suite.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT util_suite.obj -MD -MP -MF $(DEPDIR)/util_suite.Tpo -c -o util_suite.obj `if test -f 'util/util_suite.c'; then $(CYGPATH_W) 'util/util_suite.c'; else $(CYGPATH_W) '$(srcdir)/util/util_suite.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/util_suite.Tpo $(DEPDIR)/util_suite.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util/util_suite.c' object='util_suite.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o util_suite.obj `if test -f 'util/util_suite.c'; then $(CYGPATH_W) 'util/util_suite.c'; else $(CYGPATH_W) '$(srcdir)/util/util_suite.c'; fi`
+
+guac_pool.o: util/guac_pool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT guac_pool.o -MD -MP -MF $(DEPDIR)/guac_pool.Tpo -c -o guac_pool.o `test -f 'util/guac_pool.c' || echo '$(srcdir)/'`util/guac_pool.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/guac_pool.Tpo $(DEPDIR)/guac_pool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util/guac_pool.c' object='guac_pool.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o guac_pool.o `test -f 'util/guac_pool.c' || echo '$(srcdir)/'`util/guac_pool.c
+
+guac_pool.obj: util/guac_pool.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT guac_pool.obj -MD -MP -MF $(DEPDIR)/guac_pool.Tpo -c -o guac_pool.obj `if test -f 'util/guac_pool.c'; then $(CYGPATH_W) 'util/guac_pool.c'; else $(CYGPATH_W) '$(srcdir)/util/guac_pool.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/guac_pool.Tpo $(DEPDIR)/guac_pool.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='util/guac_pool.c' object='guac_pool.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o guac_pool.obj `if test -f 'util/guac_pool.c'; then $(CYGPATH_W) 'util/guac_pool.c'; else $(CYGPATH_W) '$(srcdir)/util/guac_pool.c'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/client
^
|
+(directory)
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/client/buffer_pool.c
^
|
@@ -0,0 +1,88 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <CUnit/Basic.h>
+
+#include "client.h"
+#include "client_suite.h"
+
+void test_buffer_pool() {
+
+ guac_client* client;
+
+ int i;
+ int seen[GUAC_BUFFER_POOL_INITIAL_SIZE] = {0};
+
+ guac_layer* layer;
+
+ /* Get client */
+ client = guac_client_alloc();
+ CU_ASSERT_PTR_NOT_NULL_FATAL(client);
+
+ /* Fill pool */
+ for (i=0; i<GUAC_BUFFER_POOL_INITIAL_SIZE; i++) {
+
+ /* Allocate and throw away a layer (should not disturb buffer alloc) */
+ CU_ASSERT_PTR_NOT_NULL_FATAL(guac_client_alloc_layer(client));
+
+ layer = guac_client_alloc_buffer(client);
+
+ /* Index should be within pool size */
+ CU_ASSERT_PTR_NOT_NULL_FATAL(layer);
+ CU_ASSERT_FATAL(layer->index < 0);
+ CU_ASSERT_FATAL(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE);
+
+ /* This should be a layer we have not seen yet */
+ CU_ASSERT_FALSE(seen[-layer->index - 1]);
+ seen[-layer->index - 1] = 1;
+
+ guac_client_free_buffer(client, layer);
+
+ }
+
+ /* Now that pool is filled, we should get a previously seen layer */
+ layer = guac_client_alloc_buffer(client);
+
+ CU_ASSERT_FATAL(layer->index < 0);
+ CU_ASSERT_FATAL(layer->index >= -GUAC_BUFFER_POOL_INITIAL_SIZE);
+ CU_ASSERT_TRUE(seen[-layer->index - 1]);
+
+ /* Free client */
+ guac_client_free(client);
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/client/client_suite.c
^
|
@@ -0,0 +1,72 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <CUnit/Basic.h>
+
+#include "client_suite.h"
+
+int client_suite_init() {
+ return 0;
+}
+
+int client_suite_cleanup() {
+ return 0;
+}
+
+int register_client_suite() {
+
+ /* Add client test suite */
+ CU_pSuite suite = CU_add_suite("client",
+ client_suite_init, client_suite_cleanup);
+ if (suite == NULL) {
+ CU_cleanup_registry();
+ return CU_get_error();
+ }
+
+ /* Add tests */
+ if (
+ CU_add_test(suite, "layer-pool", test_layer_pool) == NULL
+ || CU_add_test(suite, "buffer-pool", test_buffer_pool) == NULL
+ ) {
+ CU_cleanup_registry();
+ return CU_get_error();
+ }
+
+ return 0;
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/client/client_suite.h
^
|
@@ -0,0 +1,47 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_TEST_CLIENT_SUITE_H
+#define _GUAC_TEST_CLIENT_SUITE_H
+
+int register_client_suite();
+
+void test_layer_pool();
+void test_buffer_pool();
+
+#endif
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/client/layer_pool.c
^
|
@@ -0,0 +1,88 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <CUnit/Basic.h>
+
+#include "client.h"
+#include "client_suite.h"
+
+void test_layer_pool() {
+
+ guac_client* client;
+
+ int i;
+ int seen[GUAC_BUFFER_POOL_INITIAL_SIZE] = {0};
+
+ guac_layer* layer;
+
+ /* Get client */
+ client = guac_client_alloc();
+ CU_ASSERT_PTR_NOT_NULL_FATAL(client);
+
+ /* Fill pool */
+ for (i=0; i<GUAC_BUFFER_POOL_INITIAL_SIZE; i++) {
+
+ /* Allocate and throw away a buffer (should not disturb layer alloc) */
+ CU_ASSERT_PTR_NOT_NULL_FATAL(guac_client_alloc_buffer(client));
+
+ layer = guac_client_alloc_layer(client);
+
+ /* Index should be within pool size */
+ CU_ASSERT_PTR_NOT_NULL_FATAL(layer);
+ CU_ASSERT_FATAL(layer->index > 0);
+ CU_ASSERT_FATAL(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE);
+
+ /* This should be a layer we have not seen yet */
+ CU_ASSERT_FALSE(seen[layer->index - 1]);
+ seen[layer->index - 1] = 1;
+
+ guac_client_free_layer(client, layer);
+
+ }
+
+ /* Now that pool is filled, we should get a previously seen layer */
+ layer = guac_client_alloc_layer(client);
+
+ CU_ASSERT_FATAL(layer->index > 0);
+ CU_ASSERT_FATAL(layer->index <= GUAC_BUFFER_POOL_INITIAL_SIZE);
+ CU_ASSERT_TRUE(seen[layer->index - 1]);
+
+ /* Free client */
+ guac_client_free(client);
+
+}
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/tests/protocol/instruction_read.c
^
|
@@ -40,9 +40,10 @@
#include <stdlib.h>
#include <CUnit/Basic.h>
-#include "socket.h"
-#include "protocol.h"
#include "error.h"
+#include "instruction.h"
+#include "protocol.h"
+#include "socket.h"
#include "suite.h"
@@ -92,7 +93,7 @@
CU_ASSERT_PTR_NOT_NULL_FATAL(socket);
/* Read instruction */
- instruction = guac_protocol_read_instruction(socket, 1000000);
+ instruction = guac_instruction_read(socket, 1000000);
CU_ASSERT_PTR_NOT_NULL_FATAL(instruction);
/* Validate contents */
@@ -104,7 +105,7 @@
/* Read another instruction */
guac_instruction_free(instruction);
- instruction = guac_protocol_read_instruction(socket, 1000000);
+ instruction = guac_instruction_read(socket, 1000000);
/* Validate contents */
CU_ASSERT_STRING_EQUAL(instruction->opcode, "test2");
@@ -113,7 +114,7 @@
CU_ASSERT_STRING_EQUAL(instruction->argv[1], "worldworldworld");
guac_instruction_free(instruction);
- guac_socket_close(socket);
+ guac_socket_free(socket);
}
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/tests/protocol/instruction_write.c
^
|
@@ -40,9 +40,10 @@
#include <stdlib.h>
#include <CUnit/Basic.h>
-#include "socket.h"
-#include "protocol.h"
#include "error.h"
+#include "instruction.h"
+#include "protocol.h"
+#include "socket.h"
#include "suite.h"
@@ -80,7 +81,7 @@
guac_protocol_send_sync(socket, 12345);
guac_socket_flush(socket);
- guac_socket_close(socket);
+ guac_socket_free(socket);
exit(0);
}
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/protocol/nest_write.c
^
|
@@ -0,0 +1,126 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <CUnit/Basic.h>
+
+#include "error.h"
+#include "instruction.h"
+#include "protocol.h"
+#include "socket.h"
+
+#include "suite.h"
+
+void test_nest_write() {
+
+ int rfd, wfd;
+ int fd[2], childpid;
+
+ /* Create pipe */
+ CU_ASSERT_EQUAL_FATAL(pipe(fd), 0);
+
+ /* File descriptors */
+ rfd = fd[0];
+ wfd = fd[1];
+
+ /* Fork */
+ if ((childpid = fork()) == -1) {
+ /* ERROR */
+ perror("fork");
+ return;
+ }
+
+ /* Child (pipe writer) */
+ if (childpid != 0) {
+
+ guac_socket* nested_socket;
+ guac_socket* socket;
+
+ close(rfd);
+
+ /* Open guac socket */
+ socket = guac_socket_open(wfd);
+
+ /* Nest socket */
+ nested_socket = guac_socket_nest(socket, 0);
+
+ /* Write instruction */
+ guac_protocol_send_clipboard(nested_socket, "a" UTF8_4 "b" UTF8_4 "c");
+ guac_protocol_send_sync(nested_socket, 12345);
+ guac_socket_flush(nested_socket);
+ guac_socket_flush(socket);
+
+ guac_socket_free(nested_socket);
+ guac_socket_free(socket);
+ exit(0);
+ }
+
+ /* Parent (unit test) */
+ else {
+
+ char expected[] =
+ "4.nest,1.0,42."
+ "9.clipboard,11.a" UTF8_4 "b" UTF8_4 "c;"
+ "4.sync,5.12345;"
+ ";";
+
+ int numread;
+ char buffer[1024];
+ int offset = 0;
+
+ close(wfd);
+
+ /* Read everything available into buffer */
+ while ((numread =
+ read(rfd,
+ &(buffer[offset]),
+ sizeof(buffer)-offset)) != 0) {
+ offset += numread;
+ }
+
+ /* Add NULL terminator */
+ buffer[offset] = '\0';
+
+ /* Read value should be equal to expected value */
+ CU_ASSERT_STRING_EQUAL(buffer, expected);
+
+ }
+
+}
+
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/tests/protocol/suite.c
^
|
@@ -61,6 +61,7 @@
if (
CU_add_test(suite, "instruction-read", test_instruction_read) == NULL
|| CU_add_test(suite, "instruction-write", test_instruction_write) == NULL
+ || CU_add_test(suite, "nest-write", test_nest_write) == NULL
) {
CU_cleanup_registry();
return CU_get_error();
|
[-]
[+]
|
Changed |
libguac-0.7.0.tar.bz2/tests/protocol/suite.h
^
|
@@ -50,6 +50,7 @@
void test_instruction_read();
void test_instruction_write();
+void test_nest_write();
#endif
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/test_libguac.c
^
|
@@ -0,0 +1,62 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <CUnit/Basic.h>
+
+#include "protocol/suite.h"
+#include "client/client_suite.h"
+#include "util/util_suite.h"
+
+int main() {
+
+ /* Init registry */
+ if (CU_initialize_registry() != CUE_SUCCESS)
+ return CU_get_error();
+
+ /* Register suites */
+ register_protocol_suite();
+ register_client_suite();
+ register_util_suite();
+
+ /* Run tests */
+ CU_basic_set_mode(CU_BRM_VERBOSE);
+ CU_basic_run_tests();
+ CU_cleanup_registry();
+ return CU_get_error();
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/util
^
|
+(directory)
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/util/guac_pool.c
^
|
@@ -0,0 +1,105 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <CUnit/Basic.h>
+
+#include "pool.h"
+#include "util_suite.h"
+
+#define UNSEEN 0
+#define SEEN_PHASE_1 1
+#define SEEN_PHASE_2 2
+
+#define POOL_SIZE 128
+
+void test_guac_pool() {
+
+ guac_pool* pool;
+
+ int i;
+ int seen[POOL_SIZE] = {0};
+ int value;
+
+ /* Get pool */
+ pool = guac_pool_alloc(POOL_SIZE);
+ CU_ASSERT_PTR_NOT_NULL_FATAL(pool);
+
+ /* Fill pool */
+ for (i=0; i<POOL_SIZE; i++) {
+
+ /* Get value from pool */
+ value = guac_pool_next_int(pool);
+
+ /* Value should be within pool size */
+ CU_ASSERT_FATAL(value >= 0);
+ CU_ASSERT_FATAL(value < POOL_SIZE);
+
+ /* This should be an integer we have not seen yet */
+ CU_ASSERT_EQUAL(UNSEEN, seen[value]);
+ seen[value] = SEEN_PHASE_1;
+
+ /* Return value to pool */
+ guac_pool_free_int(pool, value);
+
+ }
+
+ /* Now that pool is filled, we should get ONLY previously seen integers */
+ for (i=0; i<POOL_SIZE; i++) {
+
+ /* Get value from pool */
+ value = guac_pool_next_int(pool);
+
+ /* Value should be within pool size */
+ CU_ASSERT_FATAL(value >= 0);
+ CU_ASSERT_FATAL(value < POOL_SIZE);
+
+ /* This should be an integer we have seen already */
+ CU_ASSERT_EQUAL(SEEN_PHASE_1, seen[value]);
+ seen[value] = SEEN_PHASE_2;
+
+ }
+
+ /* Pool is filled to minimum now. Next value should be equal to size. */
+ value = guac_pool_next_int(pool);
+
+ CU_ASSERT_EQUAL(POOL_SIZE, value);
+
+ /* Free pool */
+ guac_pool_free(pool);
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/util/util_suite.c
^
|
@@ -0,0 +1,71 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include <CUnit/Basic.h>
+
+#include "util_suite.h"
+
+int util_suite_init() {
+ return 0;
+}
+
+int util_suite_cleanup() {
+ return 0;
+}
+
+int register_util_suite() {
+
+ /* Add util test suite */
+ CU_pSuite suite = CU_add_suite("util",
+ util_suite_init, util_suite_cleanup);
+ if (suite == NULL) {
+ CU_cleanup_registry();
+ return CU_get_error();
+ }
+
+ /* Add tests */
+ if (
+ CU_add_test(suite, "guac-pool", test_guac_pool) == NULL
+ ) {
+ CU_cleanup_registry();
+ return CU_get_error();
+ }
+
+ return 0;
+
+}
+
|
[-]
[+]
|
Added |
libguac-0.7.0.tar.bz2/tests/util/util_suite.h
^
|
@@ -0,0 +1,46 @@
+
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is libguac.
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jumper.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _GUAC_TEST_UTIL_SUITE_H
+#define _GUAC_TEST_UTIL_SUITE_H
+
+int register_util_suite();
+
+void test_guac_pool();
+
+#endif
+
|