obex-data-server-0.4.6/0000755000175000017500000000000011546317666011711 500000000000000obex-data-server-0.4.6/depcomp0000755000175000017500000004426711331674343013211 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2009-04-28.21; # UTC # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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 # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. 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 outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac 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 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u="sed s,\\\\\\\\,/,g" depmode=msvisualcpp fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## 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. ## 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 ## that the space means something, we add a space to the output as ## well. ## 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" rm -f "$tmpdepfile" ;; hp) # 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 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # 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 # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; 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 # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then # 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:'. 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" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -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: # 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 \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" 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 \'. # 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" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; 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'. # 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. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break 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" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # 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. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$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" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## 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" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | 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::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # 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 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: obex-data-server-0.4.6/AUTHORS0000644000175000017500000000004111524724173012663 00000000000000Tadas Dailyda obex-data-server-0.4.6/configure.ac0000644000175000017500000001120111546317424014102 00000000000000AC_PREREQ(2.60) AC_INIT(obex-data-server, 0.4.6) AM_INIT_AUTOMAKE([foreign subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AM_CONFIG_HEADER(config.h) AM_MAINTAINER_MODE AC_PREFIX_DEFAULT(/usr/local) if test "$sysconfdir" = "\${prefix}/etc" \ && { test "$prefix" = "NONE" || test "$prefix" = "/usr" \ || test "$prefix" = "/usr/" ; } ; then if test "$( (uname -s) )" = "Linux" ; then sysconfdir=/etc fi ( prefix=$ac_default_prefix sysconfdir=`eval echo "$sysconfdir"` AC_MSG_NOTICE([configuration directory is "$sysconfdir".]) AC_MSG_NOTICE([use --sysconfdir to override.]) ) fi AC_DEFINE_UNQUOTED(CONFIGDIR, "$sysconfdir", [Directory for the configuration files]) if test "${CFLAGS}" = ""; then CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2" fi AC_LANG_C AC_PROG_CC AC_PROG_INSTALL AC_PROG_SED PKG_PROG_PKG_CONFIG AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) AC_PATH_PROG([DBUS_BINDING_TOOL],[dbus-binding-tool]) GLIB_REQUIRED=2.10.0 DBUS_REQUIRED=0.70 BLUEZ_REQUIRED=3.34 OPENOBEX_REQUIRED=1.3 IMAGEMAGICK_REQUIRED=6.0.0 bip_found=no bip_type=disabled AC_ARG_ENABLE(bip, AC_HELP_STRING([--enable-bip=[gdk-pixbuf|magick|auto|no]], [Enable BIP support (disabling it will break some BIP functions)]), [bip_enable=${enableval}], [bip_enable=auto]) if test "$bip_enable" = "auto" || test "$bip_enable" = "magick"; then PKG_CHECK_MODULES(BIP, gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED, [bip_found=yes], [bip_found=no]) if test "$bip_found" = "yes" ; then AC_DEFINE(USE_IMAGEMAGICK, [], [We have ImageMagick support]) bip_type="ImageMagick" else if test "$bip_enable" = "magick"; then AC_MSG_ERROR([you requested BIP support using ImageMagick, but it is not available]) fi fi fi if test "$bip_enable" = "auto" -a "$bip_found" = "no" || test "$bip_enable" = "gdk-pixbuf" ; then PKG_CHECK_MODULES(BIP, gthread-2.0 gdk-pixbuf-2.0, [bip_found=yes], [bip_found=no]) if test "$bip_found" = "yes" ; then AC_DEFINE(USE_GDKPIXBUF, [], [We have ImageMagick support]) bip_type="gdk-pixbuf" else if test "$bip_enable" = "gdk-pixbuf"; then AC_MSG_ERROR([you requested BIP support using gdk-pixbuf, but it is not available]) fi fi fi AC_ARG_ENABLE(usb, AC_HELP_STRING([--disable-usb], [Disable USB support (breaks USB interface discovery functions)]),[usb_enable=no], [usb_enable=yes]) if test "${usb_enable}" = "yes"; then PKG_CHECK_MODULES(USB, libusb) AC_SUBST(USB_CFLAGS) AC_SUBST(USB_LIBS) AC_DEFINE(USE_USB, [], [We have USB support]) fi AC_ARG_ENABLE(system-config, AC_HELP_STRING([--enable-system-config], [install D-Bus system config file]), [ system_config_enable=${enableval} ]) AM_CONDITIONAL(SYSTEMCONFIG, test "${system_config_enable}" = "yes") AC_ARG_ENABLE([debug], AC_HELP_STRING([--enable-debug], [turn on debugging]), set_debug="$enableval",[ if test -d $srcdir/.svn; then set_debug=yes else set_debug=no fi ]) if test "$set_debug" != "no"; then CFLAGS="$CFLAGS -g -pg" LDFLAGS="$LDFLAGS -pg" fi AC_ARG_ENABLE(more-warnings, AC_HELP_STRING([--enable-more-warnings], [Maximum compiler warnings]), set_more_warnings="$enableval",[ if test -d $srcdir/.svn; then set_more_warnings=yes else set_more_warnings=no fi ]) AC_MSG_CHECKING(for more warnings) if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then AC_MSG_RESULT(yes) CFLAGS+=" -Werror -Wextra -Wcast-align" CFLAGS+=" -Wnested-externs -Wpointer-arith" CFLAGS+=" -Wno-unused-parameter -Wno-missing-field-initializers" CFLAGS+=" -Wredundant-decls" CFLAGS+=" -Wsign-compare -fno-strict-aliasing" else AC_MSG_RESULT(no) fi PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED gobject-2.0) AC_SUBST(GLIB_CFLAGS) AC_SUBST(GLIB_LIBS) PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED) AC_SUBST(DBUS_CFLAGS) AC_SUBST(DBUS_LIBS) PKG_CHECK_MODULES(BLUEZ, bluez >= $BLUEZ_REQUIRED) AC_SUBST(BLUEZ_CFLAGS) AC_SUBST(BLUEZ_LIBS) AC_CHECK_LIB(bluetooth, sdp_extract_seqtype_safe, AC_DEFINE(USE_BLUEZ3FUNCS, [], [We are using Bluez 3.x])) PKG_CHECK_MODULES(OPENOBEX, openobex >= $OPENOBEX_REQUIRED) AC_SUBST(OPENOBEX_CFLAGS) AC_SUBST(OPENOBEX_LIBS) AC_OUTPUT([Makefile]) dnl ========================================================================== echo " obex-data-server $VERSION ============================= prefix: ${prefix} compiler: ${CC} cflags: ${CFLAGS} BIP imaging support: $bip_type USB support: $usb_enable " obex-data-server-0.4.6/src/0000755000175000017500000000000011546317666012500 500000000000000obex-data-server-0.4.6/src/ods-marshal.h0000644000175000017500000000574611546317666015017 00000000000000 #ifndef __ods_marshal_MARSHAL_H__ #define __ods_marshal_MARSHAL_H__ #include G_BEGIN_DECLS /* NONE:STRING,STRING,UINT64 (src/ods-marshal.list:1) */ extern void ods_marshal_VOID__STRING_STRING_UINT64 (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); #define ods_marshal_NONE__STRING_STRING_UINT64 ods_marshal_VOID__STRING_STRING_UINT64 /* NONE:UINT64 (src/ods-marshal.list:2) */ extern void ods_marshal_VOID__UINT64 (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); #define ods_marshal_NONE__UINT64 ods_marshal_VOID__UINT64 /* NONE:STRING,STRING (src/ods-marshal.list:3) */ extern void ods_marshal_VOID__STRING_STRING (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); #define ods_marshal_NONE__STRING_STRING ods_marshal_VOID__STRING_STRING /* NONE:STRING,STRING,STRING (src/ods-marshal.list:4) */ extern void ods_marshal_VOID__STRING_STRING_STRING (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); #define ods_marshal_NONE__STRING_STRING_STRING ods_marshal_VOID__STRING_STRING_STRING /* NONE:STRING,BOOLEAN (src/ods-marshal.list:5) */ extern void ods_marshal_VOID__STRING_BOOLEAN (GClosure *closure, GValue *return_value, guint n_param_values, const GValue *param_values, gpointer invocation_hint, gpointer marshal_data); #define ods_marshal_NONE__STRING_BOOLEAN ods_marshal_VOID__STRING_BOOLEAN G_END_DECLS #endif /* __ods_marshal_MARSHAL_H__ */ obex-data-server-0.4.6/src/ods-session.xml0000644000175000017500000001366611524724173015413 00000000000000 obex-data-server-0.4.6/src/ods-capabilities.c0000644000175000017500000001164611524724173015777 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #define ODS_INS_BEGIN "{$" #define ODS_INS_BEGIN_LEN 2 #define ODS_INS_ARG '|' #define ODS_INS_END '}' #define ODS_INS_ODS_VER "ODS_VER" #define ODS_INS_MEM_FREE "MEM_FREE" #define ODS_INS_MEM_USED "MEM_USED" #define ODS_CAP "obex-data-server/capability.xml" #define ODS_IMAGING_CAP "obex-data-server/imaging_capabilities.xml" static gchar* ods_get_variable (const gchar *var, gssize var_len, const gchar *var_arg, gssize var_arg_len, const gchar *set_path) { gchar *arg = NULL; gchar *ret = NULL; struct statvfs sfs; gchar *new_path = NULL; if (var_arg_len > 0) arg = g_strndup (var_arg, var_arg_len); if (!strncmp (var, ODS_INS_ODS_VER, var_len)) { /* ODS_INS_ODS_VER {$ODS_VER} */ ret = g_strdup (VERSION); } else if (!strncmp (var, ODS_INS_MEM_FREE, var_len)) { /* ODS_INS_MEM_FREE {$MEM_FREE|} */ if (arg) new_path = g_build_filename (set_path, arg, NULL); if (statvfs (arg ? new_path : set_path, &sfs) == -1) ret = g_strdup ("0"); else ret = g_strdup_printf ("%" G_GUINT64_FORMAT, (guint64)sfs.f_frsize * sfs.f_bfree); } else if (!strncmp (var, ODS_INS_MEM_USED, var_len)) { /* ODS_INS_MEM_USED {$MEM_USED|} */ if (arg) new_path = g_build_filename (set_path, arg, NULL); if (statvfs (arg ? new_path : set_path, &sfs) == -1) ret = g_strdup ("0"); else ret = g_strdup_printf ("%" G_GUINT64_FORMAT, (guint64)sfs.f_frsize * (sfs.f_blocks-sfs.f_bfree)); } else { /* unknown variable name */ ret = g_strdup (""); } if (arg) g_free (arg); if (new_path) g_free (new_path); return ret; } static gchar* ods_insert_variables (const gchar *template, const gchar *set_path) { GString *output; const gchar *templ, *templ_pos; gchar *var = NULL; gssize var_len = -1; gssize var_arg_len = -1; gint i; g_assert (*template != '\0'); output = g_string_new (""); templ = template; /* search for variable to insert */ while ((templ_pos = strstr (templ, ODS_INS_BEGIN))) { /* append everything before var to output */ output = g_string_append_len (output, templ, templ_pos-templ); templ_pos += ODS_INS_BEGIN_LEN; for (i=1;;i++) { if (*(templ_pos+i) == '\0') break; if (*(templ_pos+i) == ODS_INS_ARG) { var_len = i; } else if (*(templ_pos+i) == ODS_INS_END) { if (var_len == -1) var_len = i; else var_arg_len = i-var_len-1; break; } } if (var_len == -1) { /* invalid var definition, strip it from output */ templ = templ_pos; break; } /* we got variable and argument now */ var = ods_get_variable (templ_pos, var_len, templ_pos+var_len+1, var_arg_len, set_path); output = g_string_append (output, var); g_free (var); /* change next search position */ templ = templ_pos+i+1; var_len = -1; var_arg_len = -1; } /* append what is left */ output = g_string_append (output, templ); return g_string_free (output, FALSE); } gchar* ods_get_capability (const gchar *root_path) { gchar *conf_file; gchar *contents = NULL; GError *error = NULL; gchar *capability = NULL; conf_file = g_build_filename (CONFIGDIR, ODS_CAP, NULL); if (!g_file_get_contents (conf_file, &contents, NULL, &error)) { g_warning ("Could not read configuration file %s (%s)", conf_file, error->message); g_clear_error (&error); } else { capability = ods_insert_variables (contents, root_path); } g_free (conf_file); if (contents) g_free (contents); return capability; } gchar* ods_get_imaging_capabilities () { gchar *conf_file; gchar *contents = NULL; GError *error = NULL; conf_file = g_build_filename (CONFIGDIR, ODS_IMAGING_CAP, NULL); if (!g_file_get_contents (conf_file, &contents, NULL, &error)) { g_warning ("Could not read configuration file %s (%s)", conf_file, error->message); g_clear_error (&error); } g_free (conf_file); return contents; } obex-data-server-0.4.6/src/ods-server.c0000644000175000017500000006535711524724173014664 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ods-common.h" #include "ods-error.h" #include "ods-marshal.h" #include "ods-server.h" #include "ods-server-dbus-glue.h" #include "ods-server-session.h" static GObject* ods_server_constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params); static void ods_server_finalize (GObject *object); static void ods_server_attach_callback(OdsServer* server); #define ODS_SERVER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ODS_TYPE_SERVER, OdsServerPrivate)) /* this is used for timed assignment of ServerSession fd */ #define SERVER_SESSION_INIT_TIMEOUT 250 /* timeout in milliseconds */ typedef struct OdsServerSessionCbData_ { gint fd; OdsServerSession *session; } OdsServerSessionCbData; /* this structure is used for ServerSession list */ typedef struct OdsServerSessionInfo_ { OdsServerSession *session; /* Bluetooth specific */ gchar *bluetooth_address; } OdsServerSessionInfo; struct OdsServerPrivate { /* viariables used when disposing/stopping */ gboolean is_disposing; gboolean is_stopping; guint open_sessions; gboolean socket_error; gboolean disposed; /* constructor properties */ gint fd; /* rfcomm device */ guint service; gchar *owner; /* D-Bus client, who initiated this server */ /* additional options (set via SetOption) */ guint limit; gboolean require_imaging_thumbnails; /* io channel */ GIOChannel *io_channel; guint io_watch; /* other */ gchar *tty_dev; gchar *dbus_path; /* D-Bus path for this object */ gboolean started; /* Whether server is started and accepts connections */ gchar *path; /* Server root path */ gboolean allow_write; /* Whether to allow changes in file system */ gboolean auto_accept;/* Whether incoming files should be auto-accepted */ GHashTable *session_list; /* Server client list */ }; enum { STARTED, STOPPED, CLOSED, SESSION_CREATED, SESSION_REMOVED, ERROR_OCCURRED, DISPOSED, LAST_SIGNAL }; #define OPT_REQ_IMG_THUMBNAILS "RequireImagingThumbnails" #define OPT_LIMIT "Limit" static guint signals [LAST_SIGNAL] = { 0, }; /* for numbering servers */ static guint iterator = 0; G_DEFINE_TYPE (OdsServer, ods_server, G_TYPE_OBJECT) static void ods_server_session_list_add (OdsServer *server, OdsServerSession *session, bdaddr_t *bdaddr, const gchar *dbus_path) { OdsServerSessionInfo *session_info; bdaddr_t bdaddr2; session_info = g_new0 (OdsServerSessionInfo, 1); session_info->session = session; if (bdaddr) { baswap (&bdaddr2, bdaddr); session_info->bluetooth_address = batostr (&bdaddr2); g_message ("Bluetooth address: %s", session_info->bluetooth_address); } g_hash_table_insert (server->priv->session_list, g_strdup (dbus_path), session_info); } static void ods_server_session_info_free (OdsServerSessionInfo *session_info) { g_free (session_info->bluetooth_address); g_free (session_info); } static void server_session_disconnected_cb (OdsServerSession *server_session, OdsServer *server) { gchar *session_object = NULL; g_message ("server session closed"); g_object_get (server_session, "dbus-path", &session_object, NULL); if (!server->priv->is_disposing && !server->priv->is_stopping) g_hash_table_remove (server->priv->session_list, session_object); else server->priv->open_sessions--; g_signal_emit (server, signals [SESSION_REMOVED], 0, session_object); g_object_unref (server_session); g_free (session_object); if (server->priv->open_sessions == 0) { if (server->priv->is_disposing) { g_message ("Server disposed"); server->priv->disposed = TRUE; g_signal_emit (server, signals [DISPOSED], 0); } else if (server->priv->is_stopping) { g_message ("Server stopped"); server->priv->is_stopping = FALSE; server->priv->started = FALSE; g_signal_emit (server, signals [STOPPED], 0); if (server->priv->socket_error) g_signal_emit (server, signals [CLOSED], 0); } else if (server->priv->tty_dev) { /* client disconnected from the socket, time to start listening for * a new connection (see connect_callback). */ ods_server_attach_callback(server); } } } static void server_session_cancelled_cb (OdsServerSession *server_session) { g_message ("server session cancelled"); ods_server_session_disconnect_internal (server_session); } static gboolean server_session_cancel (OdsServerSession *server_session) { ods_server_session_cancel_internal (server_session); return FALSE; } static gboolean server_session_finalize (gpointer key, OdsServerSessionInfo *session_info, OdsServer *server) { g_message ("attempting to close server session"); g_signal_connect (session_info->session, "cancelled", G_CALLBACK (server_session_cancelled_cb), NULL); g_idle_add ((GSourceFunc) server_session_cancel, session_info->session); /* Even if there was nothing to cancel, we will get * CANCELLED signal and disconnection will happen in * session_cancelled_cb */ return TRUE; } static gboolean server_session_fd_assign (OdsServerSessionCbData *data) { OdsServerSession *session = data->session; g_object_set (session, "fd", data->fd, NULL); g_free (data); return FALSE; } static gboolean connect_callback (GIOChannel *source, GIOCondition cond, gpointer data) { int cli_fd, srv_fd; socklen_t size; struct sockaddr_rc cli_addr; bdaddr_t *bdaddr = NULL; OdsServer *server; OdsServerSession *session; gchar *session_object; OdsServerSessionCbData *cb_data; GError *error = NULL; gboolean ret = TRUE; g_message ("Client connecting"); server = ODS_SERVER (data); srv_fd = g_io_channel_unix_get_fd (source); if (!(cond & G_IO_IN)) { g_warning ("Error on server socket"); g_set_error (&error, ODS_ERROR, ODS_ERROR_LINK_ERROR, "Error on server socket"); ret = FALSE; goto out; } if (server->priv->tty_dev) { /* A TTY file descriptor can't accept() connection, it is the * connection. We start out listening on it in ods-server; as soon as we * get some input, we "disconnect" the fd from the ods-server and hand * it off to the ods-server-session. When the session terminates * (SIGHUP, etc), server_session_disconnected_cb will re-connect it to * the ods-server to start waiting for the next session. */ if (!server->priv->started) return TRUE; /* ignore requests until server is started */ ods_safe_gsource_remove (&(server->priv->io_watch)); cli_fd = srv_fd; } else { size = sizeof (struct sockaddr_rc); cli_fd = accept (srv_fd, (struct sockaddr*) &cli_addr, &size); if (!server->priv->started) { shutdown (cli_fd, SHUT_RDWR); close (cli_fd); return TRUE; /* ignore requests until server is started */ } if (server->priv->limit > 0 && g_hash_table_size (server->priv->session_list) == server->priv->limit) { g_message ("ServerSession limit reached (%d), refusing connection", server->priv->limit); shutdown (cli_fd, SHUT_RDWR); close (cli_fd); return TRUE; } if (cli_fd < 0) { g_message ("Error while accepting connection: %s", g_strerror (errno)); ods_error_err2gerror (errno, &error); /* Ignore this error since we can just continue listening */ goto out; } } /* To avoid race condition when client application misses TransferStarted * signal from ServerSession object, we emit SessionCreated signal now, * but assign fd to ServerSession (and therefore start OBEX operations) * only after a timeout */ session = ods_server_session_new (-1, server->priv->service, server->priv->path, server->priv->allow_write, server->priv->auto_accept, server->priv->require_imaging_thumbnails, server->priv->owner); if (server->priv->tty_dev) g_object_set (session, "using-tty", TRUE, NULL); cb_data = g_new0 (OdsServerSessionCbData, 1); cb_data->fd = cli_fd; cb_data->session = session; g_timeout_add (SERVER_SESSION_INIT_TIMEOUT, (GSourceFunc) server_session_fd_assign, cb_data); /* deal with signals */ g_signal_connect (session, "disconnected", G_CALLBACK (server_session_disconnected_cb), server); g_object_get (session, "dbus-path", &session_object, NULL); g_signal_emit (server, signals [SESSION_CREATED], 0, session_object); if (!server->priv->tty_dev) { /* this is Bluetooth server */ bdaddr = &(cli_addr.rc_bdaddr); } ods_server_session_list_add (server, session, bdaddr, session_object); g_free (session_object); out: if (error) { gchar *error_name; /* Get D-Bus name for error */ error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred signal */ g_signal_emit (server, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); } if (!ret) { /* disconnect server sessions, cause there was error on server socket */ if (g_hash_table_size (server->priv->session_list) == 0) { server->priv->started = FALSE; g_signal_emit (server, signals [STOPPED], 0); g_signal_emit (server, signals [CLOSED], 0); } else { server->priv->socket_error = TRUE; server->priv->is_stopping = TRUE; g_hash_table_foreach_remove (server->priv->session_list, (GHRFunc) server_session_finalize, NULL); /* STOPPED and CLOSED signals will be emitted in server_session_disconnected_cb */ } g_hash_table_unref (server->priv->session_list); } return ret; } static void ods_server_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { OdsServer *self = (OdsServer *) object; switch (property_id) { case ODS_SERVER_FD: self->priv->fd = g_value_get_int (value); break; case ODS_SERVER_SERVICE: self->priv->service = g_value_get_int (value); break; case ODS_SERVER_OWNER: self->priv->owner = g_value_dup_string (value); break; case ODS_SERVER_TTY_DEV: self->priv->tty_dev = g_value_dup_string (value); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } static void ods_server_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { OdsServer *self = (OdsServer *) object; switch (property_id) { case ODS_SERVER_FD: g_value_set_int (value, self->priv->fd); break; case ODS_SERVER_SERVICE: g_value_set_int (value, self->priv->service); break; case ODS_SERVER_OWNER: g_value_set_string (value, self->priv->owner); break; case ODS_SERVER_DBUS_PATH: g_value_set_string (value, self->priv->dbus_path); break; case ODS_SERVER_PATH: g_value_set_string (value, self->priv->path); break; case ODS_SERVER_TTY_DEV: g_value_set_string (value, self->priv->tty_dev); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } } /** * ods_server_class_init: * @klass: The OdsServerClass **/ static void ods_server_class_init (OdsServerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->constructor = ods_server_constructor; object_class->finalize = ods_server_finalize; object_class->set_property = ods_server_set_property; object_class->get_property = ods_server_get_property; g_object_class_install_property (object_class, ODS_SERVER_FD, g_param_spec_int ("fd", "", "", 0, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SERVICE, g_param_spec_int ("service", "", "", 0, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_OWNER, g_param_spec_string ("owner", "", "", "" /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_DBUS_PATH, g_param_spec_string ("dbus-path", "", "", "" /* default value */, G_PARAM_READABLE)); g_object_class_install_property (object_class, ODS_SERVER_PATH, g_param_spec_string ("path", "", "", "" /* default value */, G_PARAM_READABLE)); g_object_class_install_property (object_class, ODS_SERVER_TTY_DEV, g_param_spec_string ("tty-dev", "", "", "" /* default value */, G_PARAM_READWRITE)); signals [STARTED] = g_signal_new ("started", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, started), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [STOPPED] = g_signal_new ("stopped", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, stopped), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [CLOSED] = g_signal_new ("closed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, closed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [SESSION_CREATED] = g_signal_new ("session-created", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, session_created), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, DBUS_TYPE_G_OBJECT_PATH); signals [SESSION_REMOVED] = g_signal_new ("session-removed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, session_removed), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, DBUS_TYPE_G_OBJECT_PATH); signals [ERROR_OCCURRED] = g_signal_new ("error-occurred", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, error_occurred), NULL, NULL, ods_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals [DISPOSED] = g_signal_new ("disposed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerClass, disposed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); g_type_class_add_private (klass, sizeof (OdsServerPrivate)); GError *error = NULL; /* Init the DBus connection, per-klass */ klass->connection = dbus_g_bus_get (ODS_DBUS_BUS, &error); if (klass->connection == NULL) { g_warning("Unable to connect to dbus: %s", error->message); g_clear_error (&error); return; } /* &dbus_glib_ods_server_object_info is provided in the * dbus/ods-server-dbus-glue.h file */ dbus_g_object_type_install_info (ODS_TYPE_SERVER, &dbus_glib_ods_server_object_info); } /** * ods_server_init: * @server This class instance **/ static void ods_server_init (OdsServer *server) { OdsServerClass *klass = ODS_SERVER_GET_CLASS (server); server->priv = ODS_SERVER_GET_PRIVATE (server); server->priv->session_list = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) ods_server_session_info_free); /* figure out DBus object path for this instance */ server->priv->dbus_path = g_strdup_printf (ODS_SERVER_DBUS_PATH_PATTERN, iterator); iterator++; dbus_g_connection_register_g_object (klass->connection, server->priv->dbus_path, G_OBJECT (server)); } /** * Common logic for ods_server_constructor and server_session_disconnected_cb: * hooks connect_callback to the server's io channel */ static void ods_server_attach_callback(OdsServer* server) { server->priv->io_watch = g_io_add_watch(server->priv->io_channel, G_IO_IN | G_IO_HUP | G_IO_ERR, connect_callback, server); } static GObject* ods_server_constructor (GType type, guint n_construct_params, GObjectConstructParam *construct_params) { GObject *object; OdsServer *server; object = G_OBJECT_CLASS (ods_server_parent_class)->constructor (type, n_construct_params, construct_params); server = ODS_SERVER (object); server->priv->io_channel = g_io_channel_unix_new (server->priv->fd); ods_server_attach_callback(server); return object; } /** * ods_server_finalize: * @object: The object to finalize * * Finalize the server **/ static void ods_server_finalize (GObject *object) { OdsServer *server; g_return_if_fail (object != NULL); g_return_if_fail (ODS_IS_SERVER (object)); server = ODS_SERVER (object); g_return_if_fail (server->priv != NULL); g_return_if_fail (server->priv->disposed); g_hash_table_unref (server->priv->session_list); /* close server socket */ ods_safe_gsource_remove (&(server->priv->io_watch)); g_io_channel_shutdown (server->priv->io_channel, TRUE, NULL); g_io_channel_unref(server->priv->io_channel); close (server->priv->fd); /* free other private variables */ g_free (server->priv->owner); g_free (server->priv->dbus_path); g_free (server->priv->path); g_free (server->priv->tty_dev); G_OBJECT_CLASS (ods_server_parent_class)->finalize (object); } /** * ods_server_new: * * Return value: a new OdsServer object. **/ OdsServer * ods_server_new (gint fd, gint service, const gchar *owner) { OdsServer *server; server = g_object_new (ODS_TYPE_SERVER, "fd", fd, "service", service, "owner", owner, NULL); return ODS_SERVER (server); } gboolean ods_server_start (OdsServer *server, const gchar *path, gboolean allow_write, gboolean auto_accept, DBusGMethodInvocation *context) { GError *error = NULL; /* Check caller */ if (!ods_check_caller (context, server->priv->owner)) return FALSE; /* check if started */ if (server->priv->started) { g_set_error (&error, ODS_ERROR, ODS_ERROR_STARTED, "Already started"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } if (server->priv->is_stopping || server->priv->is_disposing) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Currently stopping"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* make sure supplied path is valid */ if (!g_file_test (path, G_FILE_TEST_IS_DIR)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid path"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } g_free (server->priv->path); server->priv->path = g_strdup (path); server->priv->allow_write = allow_write; server->priv->auto_accept = auto_accept; g_warning ("Server path: %s", path); server->priv->started = TRUE; g_signal_emit (server, signals [STARTED], 0); dbus_g_method_return (context); return TRUE; } gboolean ods_server_stop (OdsServer *server, DBusGMethodInvocation *context) { GError *error = NULL; /* Check caller */ if (!ods_check_caller (context, server->priv->owner)) return FALSE; /* check if not started */ if (!server->priv->started) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_STARTED, "Not started"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* disconnect server sessions */ if (g_hash_table_size (server->priv->session_list) == 0) { server->priv->started = FALSE; g_signal_emit (server, signals [STOPPED], 0); } else { server->priv->is_stopping = TRUE; g_hash_table_foreach_remove (server->priv->session_list, (GHRFunc) server_session_finalize, NULL); /* STOPPED signal will be emitted in server_session_disconnected_cb */ } g_hash_table_unref (server->priv->session_list); server->priv->session_list = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) ods_server_session_info_free); dbus_g_method_return (context); return TRUE; } gboolean ods_server_close (OdsServer *server, DBusGMethodInvocation *context) { /* Check caller */ if (!ods_check_caller (context, server->priv->owner)) return FALSE; if (server->priv->started) g_signal_emit (server, signals [STOPPED], 0); g_signal_emit (server, signals [CLOSED], 0); /* server socket will be closed when this GObject is finalized */ dbus_g_method_return (context); return TRUE; } /* Not exposed through DBUS, used internally */ void ods_server_dispose (OdsServer *server) { g_return_if_fail (server != NULL); g_return_if_fail (ODS_IS_SERVER (server)); g_return_if_fail (server->priv != NULL); if (server->priv->disposed) return; g_message ("Disposing Server"); server->priv->is_disposing = TRUE; /* check if there is nothing to dispose */ if (g_hash_table_size (server->priv->session_list) == 0) { g_message ("Server disposed at once"); server->priv->disposed = TRUE; g_signal_emit (server, signals [DISPOSED], 0); } else { /* disconnect server sessions */ server->priv->open_sessions = g_hash_table_size (server->priv->session_list); g_hash_table_foreach_remove (server->priv->session_list, (GHRFunc) server_session_finalize, NULL); /* when session_list becomes empty in server_session_disconnected callback * "disposed" signal will be emitted */ } } gboolean ods_server_is_started (OdsServer *server) { return server->priv->started; } gboolean ods_server_set_option (OdsServer *server, const gchar *name, GValue *value, DBusGMethodInvocation *context) { GError *error = NULL; /* Check caller */ if (!ods_check_caller (context, server->priv->owner)) return FALSE; if (!g_ascii_strncasecmp (name, OPT_REQ_IMG_THUMBNAILS, strlen (name))) { /* require-imaging-thumbnails */ if (!G_VALUE_HOLDS_BOOLEAN (value)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid value for require-imaging-thumbnails"); goto out; } server->priv->require_imaging_thumbnails = g_value_get_boolean (value); } else if (!g_ascii_strncasecmp (name, OPT_LIMIT, strlen (name))) { /* limit */ if (!G_VALUE_HOLDS_UINT (value)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid value for limit"); goto out; } server->priv->limit = g_value_get_uint (value); } else { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Unknown option"); goto out; } out: if (error) { dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } dbus_g_method_return (context); return TRUE; } GHashTable * ods_server_get_server_session_info (OdsServer *server, gchar *session_object) { GHashTable *info; OdsServerSessionInfo *session_info; info = g_hash_table_new ((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal); session_info = g_hash_table_lookup (server->priv->session_list, session_object); if (session_info && session_info->bluetooth_address) { g_hash_table_insert (info, "BluetoothAddress", g_strdup (session_info->bluetooth_address)); } return info; } gchar** ods_server_get_server_session_list (OdsServer *server) { return ods_hash_table_keys2strv (server->priv->session_list); } obex-data-server-0.4.6/src/ods-usb.h0000644000175000017500000000164611524724173014143 00000000000000#include "config.h" #ifdef USE_USB #include #include /** USB-specific OBEX service information * provided by optional Service Identification Functional Descriptor * (CDC WMC specification section 6.5.2.5) */ typedef struct { /* Role bit mask: bit 0 is set if client, unset if server */ guint8 role; /* Service UUID */ guint8 uuid[16]; /** Service version */ guint16 version; /** Set if the service provides/expects * an OBEX Default Server (spec section 6.5.2.5.2) */ int is_default_uuid; } ods_usb_intf_service_t; struct ods_usb_info { char *manufacturer; char *product; char *serial; char *configuration; char *control_interface; char *data_interface_idle; char *data_interface_active; ods_usb_intf_service_t *service; char *path; }; typedef struct ods_usb_info ods_usb_info; void ods_usbobex_free_interfaces(GList *list); GList *ods_usbobex_find_interfaces(void); #endif /* USE_USB */ obex-data-server-0.4.6/src/ods-server-session.h0000644000175000017500000000770711524724173016345 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_SERVER_SESSION_H #define __ODS_SERVER_SESSION_H #include #include G_BEGIN_DECLS #define ODS_TYPE_SERVER_SESSION (ods_server_session_get_type ()) #define ODS_SERVER_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ODS_TYPE_SERVER_SESSION, OdsServerSession)) #define ODS_SERVER_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ODS_TYPE_SERVER_SESSION, OdsServerSessionClass)) #define ODS_IS_SERVER_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ODS_TYPE_SERVER_SESSION)) #define ODS_IS_SERVER_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ODS_TYPE_SERVER_SESSION)) #define ODS_SERVER_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ODS_TYPE_SERVER_SESSION, OdsServerSessionClass)) enum { ODS_SERVER_SESSION_FD = 1, ODS_SERVER_SESSION_SERVICE, ODS_SERVER_SESSION_PATH, ODS_SERVER_SESSION_ALLOW_WRITE, ODS_SERVER_SESSION_AUTO_ACCEPT, ODS_SERVER_SESSION_REQUIRE_IMAGING_THUMBNAILS, ODS_SERVER_SESSION_USING_TTY, ODS_SERVER_SESSION_OWNER, ODS_SERVER_SESSION_DBUS_PATH }; typedef struct OdsServerSessionPrivate OdsServerSessionPrivate; typedef struct { GObject parent; OdsServerSessionPrivate *priv; } OdsServerSession; typedef struct { GObjectClass parent_class; void (* cancelled) (OdsServerSession *server_session); void (* disconnected) (OdsServerSession *server_session); void (* transfer_started) (OdsServerSession *server_session, const gchar *filename, const gchar *local_path, guint64 total_bytes); void (* transfer_progress) (OdsServerSession *server_session, guint64 bytes_transferred); void (* transfer_completed) (OdsServerSession *server_session); void (* error_occurred) (OdsServerSession *server_session, const gchar *error_name, const gchar *error_message); void (* remote_display_requested) (OdsServerSession *server_session, const gchar *filename); DBusGConnection *connection; } OdsServerSessionClass; GType ods_server_session_get_type (void); OdsServerSession *ods_server_session_new (gint fd, gint service, const gchar *path, gboolean allow_write, gboolean auto_accept, gboolean require_imaging_thumbnails, const gchar *owner); gboolean ods_server_session_accept (OdsServerSession *server_session, DBusGMethodInvocation *context); gboolean ods_server_session_reject (OdsServerSession *server_session, DBusGMethodInvocation *context); void ods_server_session_disconnect_internal (OdsServerSession *server_session); gboolean ods_server_session_disconnect (OdsServerSession *server_session, DBusGMethodInvocation *context); GHashTable *ods_server_session_get_transfer_info (OdsServerSession *server_session); gboolean ods_server_session_cancel_internal (OdsServerSession *server_session); gboolean ods_server_session_cancel (OdsServerSession *server_session, DBusGMethodInvocation *context); G_END_DECLS #endif /* __ODS_SERVER_SESSION_H */ obex-data-server-0.4.6/src/ods-session.h0000644000175000017500000001702111524724173015027 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_SESSION_H #define __ODS_SESSION_H #include #include G_BEGIN_DECLS #define ODS_TYPE_SESSION (ods_session_get_type ()) #define ODS_SESSION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ODS_TYPE_SESSION, OdsSession)) #define ODS_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ODS_TYPE_SESSION, OdsSessionClass)) #define ODS_IS_SESSION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ODS_TYPE_SESSION)) #define ODS_IS_SESSION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ODS_TYPE_SESSION)) #define ODS_SESSION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ODS_TYPE_SESSION, OdsSessionClass)) enum { ODS_SESSION_FD = 1, ODS_SESSION_SERVICE, ODS_SESSION_OWNER, ODS_SESSION_DBUS_PATH, ODS_SESSION_IMAGING_FEATURE, ODS_SESSION_IMAGING_SDP_DATA, ODS_SESSION_TARGET_UUID, ODS_SESSION_USBINTFNUM }; typedef struct OdsSessionPrivate OdsSessionPrivate; typedef struct { GObject parent; OdsSessionPrivate *priv; } OdsSession; typedef struct { GObjectClass parent_class; void (* cancelled) (OdsSession *session); void (* connect_result_internal) (OdsSession *session, const gchar *error_name, const gchar *error_message); void (* disconnected) (OdsSession *session); void (* closed) (OdsSession *session); void (* transfer_started) (OdsSession *session, const gchar *filename, const gchar *local_path, guint64 total_bytes); void (* transfer_progress) (OdsSession *session, guint64 bytes_transferred); void (* transfer_completed) (OdsSession *session); void (* error_occurred) (OdsSession *session, const gchar *error_name, const gchar *error_message); void (* image_handle_received)(OdsSession *session, const gchar *image_handle, gboolean thumbnail_requested); DBusGConnection *connection; } OdsSessionClass; GType ods_session_get_type (void); OdsSession *ods_session_new (gint fd, gint usb_interface_number, gint service, const gchar *owner, const gchar *target_uuid); gint ods_session_disconnect_internal (OdsSession *session, GError **error); gboolean ods_session_disconnect (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_close (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_change_current_folder (OdsSession *session, const gchar *path, DBusGMethodInvocation *context); gboolean ods_session_change_current_folder_backward (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_change_current_folder_to_root (OdsSession *session, DBusGMethodInvocation *context); gchar *ods_session_get_current_path (OdsSession *session); gboolean ods_session_copy_remote_file (OdsSession *session, const gchar *remote_filename, const gchar *local_path, DBusGMethodInvocation *context); gboolean ods_session_copy_remote_file_by_type (OdsSession *session, const gchar *type, const gchar *local_path, DBusGMethodInvocation *context); gboolean ods_session_create_folder (OdsSession *session, const gchar *folder_name, DBusGMethodInvocation *context); gboolean ods_session_retrieve_folder_listing (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_get_capability (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_get_imaging_capabilities (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_send_file_ext (OdsSession *session, const gchar *local_path, const gchar *remote_filename, const gchar *type, DBusGMethodInvocation *context); gboolean ods_session_send_file (OdsSession *session, const gchar *local_path, DBusGMethodInvocation *context); gboolean ods_session_set_transfer_hints (OdsSession *session, const gchar *fifo, const gchar *remote_filename, const gchar *type, guint64 size, gint64 mtime, gint64 ctime, DBusGMethodInvocation *context); gboolean ods_session_delete_remote_file (OdsSession *session, const gchar *remote_filename, DBusGMethodInvocation *context); gboolean ods_session_remote_copy (OdsSession *session, const gchar *remote_source, const gchar *remote_destination, DBusGMethodInvocation *context); gboolean ods_session_remote_move (OdsSession *session, const gchar *remote_source, const gchar *remote_destination, DBusGMethodInvocation *context); gboolean ods_session_get_image_info (OdsSession *session, const gchar *local_path, DBusGMethodInvocation *context); gboolean ods_session_put_image (OdsSession *session, const gchar *local_path, DBusGMethodInvocation *context); gboolean ods_session_put_image_resized (OdsSession *session, const gchar *local_path, guint16 width, guint16 height, const gchar *encoding, const gchar *transformation, DBusGMethodInvocation *context); gboolean ods_session_put_linked_attachment (OdsSession *session, const gchar *image_handle, const gchar *local_path, const gchar *content_type, const gchar *charset, DBusGMethodInvocation *context); gboolean ods_session_remote_display_select_image (OdsSession *session, const gchar *image_handle, DBusGMethodInvocation *context); gboolean ods_session_remote_display_show_current_image (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_remote_display_show_next_image (OdsSession *session, DBusGMethodInvocation *context); gboolean ods_session_remote_display_show_previous_image (OdsSession *session, DBusGMethodInvocation *context); GHashTable *ods_session_get_transfer_info (OdsSession *session); gboolean ods_session_is_busy (OdsSession *session); gboolean ods_session_cancel_internal (OdsSession *session); gboolean ods_session_cancel (OdsSession *session, DBusGMethodInvocation *context); G_END_DECLS #endif /* __ODS_SESSION_H */ obex-data-server-0.4.6/src/ods-bluez.c0000644000175000017500000005223211524724173014463 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ods-bluez.h" #include "ods-common.h" #include "ods-error.h" static gboolean sdp_initiate_search (OdsBluezCancellable *ctxt); static GHashTable *sdp_session_list = NULL; typedef struct SdpSessionRecords_ { sdp_session_t *session; guint rec_count; } SdpSessionRecords; static void ods_bluez_cancellable_free (OdsBluezCancellable *cb_data) { g_io_channel_unref (cb_data->io_channel); sdp_close (cb_data->session); g_free (cb_data->imagingdata); g_free (cb_data); } static gboolean client_socket_connect_cb (GIOChannel *io_channel, GIOCondition cond, OdsBluezCancellable *cb_data) { OdsBluezFunc cb = cb_data->cb; gint fd; gint ret_fd = -1; GError *error = NULL; fd = g_io_channel_unix_get_fd (io_channel); /* Evaluate the connection condition */ if (cond == G_IO_OUT) { /* Connection successful */ ret_fd = fd; } else if (cond == (G_IO_OUT | G_IO_HUP)) { /* The connection timed out. */ g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_TIMEOUT, "Connection timed out"); } else if (cond == (G_IO_OUT | G_IO_HUP | G_IO_ERR)) { /* The connection was refused */ g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_REFUSED, "Connection refused"); } else { /* A generic unknown error occured during the connection attempt. */ g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Connection failed"); } if (ret_fd != -1) g_message ("Connected"); else { close (fd); g_message ("Failed to connect"); } cb (ret_fd, cb_data->channel, cb_data->imagingdata, error, cb_data->cb_data); ods_bluez_cancellable_free (cb_data); g_clear_error (&error); return FALSE; } static void rfcomm_connect (OdsBluezCancellable *cb_data, gint channel) { OdsBluezFunc cb = cb_data->cb; GError *error = NULL; struct sockaddr_rc addr; int fd = -1; GIOChannel *io_channel = NULL; /* Create socket and start connecting */ fd = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); if (fd < 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Could not create socket"); goto err; } memset (&addr, 0, sizeof(addr)); /* source address */ addr.rc_family = AF_BLUETOOTH; bacpy (&addr.rc_bdaddr, &cb_data->source_address); if (bind (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Binding to local device failed (errno: %d)", errno); goto err; } memset (&addr, 0, sizeof(addr)); /* destination address */ addr.rc_family = AF_BLUETOOTH; addr.rc_channel = channel; bacpy (&addr.rc_bdaddr, &cb_data->target_address); /* Use non-blocking connect */ fcntl (fd, F_SETFL, O_NONBLOCK); io_channel = g_io_channel_unix_new (fd); if (connect (fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) { /* BlueZ returns EAGAIN eventhough it should return EINPROGRESS */ if (!(errno == EAGAIN || errno == EINPROGRESS)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Connecting to remote device failed"); goto err; } g_message ("Connect in progress"); cb_data->io_watch = g_io_add_watch (io_channel, G_IO_OUT | G_IO_ERR | G_IO_NVAL | G_IO_HUP, (GIOFunc) client_socket_connect_cb, cb_data); cb_data->fd = fd; } else { /* Connect succeeded with first try */ g_message ("Connect on first try"); client_socket_connect_cb (io_channel, G_IO_OUT, cb_data); } g_io_channel_unref (io_channel); return; err: if (io_channel) g_io_channel_unref (io_channel); if (fd >= 0) close (fd); cb (-1, cb_data->channel, cb_data->imagingdata, error, cb_data->cb_data); ods_bluez_cancellable_free (cb_data); g_clear_error (&error); } static void sdp_get_channel (sdp_record_t *sdp_record, OdsBluezCancellable *cb_data) { OdsBluezFunc cb = cb_data->cb; GError *error = NULL; sdp_list_t *protos = NULL; gint channel = -1; g_message ("getting RFCOMM channel"); /* get channel for this service */ if (sdp_get_access_protos (sdp_record, &protos) != 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not get service channel"); goto err; } channel = sdp_get_proto_port (protos, RFCOMM_UUID); cb_data->channel = channel; if (cb_data->uuid.value.uuid16 == IMAGING_RESPONDER_SVCLASS_ID) { /* BIP only */ sdp_data_t *sdpdata; cb_data->imagingdata = g_new0 (ImagingSdpData, 1); sdpdata = sdp_data_get (sdp_record, SDP_ATTR_SUPPORTED_CAPABILITIES); cb_data->imagingdata->supp_capabilities = sdpdata->val.uint8; g_message ("supp_capabilities: %d", cb_data->imagingdata->supp_capabilities); sdpdata = sdp_data_get (sdp_record, SDP_ATTR_SUPPORTED_FEATURES); cb_data->imagingdata->supp_features = sdpdata->val.uint16; g_message ("supp_features: %d", cb_data->imagingdata->supp_features); sdpdata = sdp_data_get (sdp_record, SDP_ATTR_SUPPORTED_FUNCTIONS); cb_data->imagingdata->supp_functions = sdpdata->val.uint32; g_message ("supp_funcs: %d", cb_data->imagingdata->supp_functions); sdpdata = sdp_data_get (sdp_record, SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY); cb_data->imagingdata->data_capacity = sdpdata->val.uint64; g_message ("data_cap: %" G_GUINT64_FORMAT, cb_data->imagingdata->data_capacity); if (!(cb_data->imaging_feature & cb_data->imagingdata->supp_features)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Selected imaging feature not supported"); goto err; } } if (protos) { sdp_list_foreach (protos, (sdp_list_func_t)sdp_list_free, 0); sdp_list_free (protos, 0); } rfcomm_connect (cb_data, channel); return; err: cb (-1, cb_data->channel, cb_data->imagingdata, error, cb_data->cb_data); ods_bluez_cancellable_free (cb_data); g_clear_error (&error); } static void sdp_search_completed_cb (uint8_t type, uint16_t status, uint8_t *rsp, size_t size, void *user_data) { OdsBluezCancellable *ctxt = user_data; OdsBluezFunc cb = ctxt->cb; sdp_list_t *recs = NULL; guint scanned; int seqlen = 0, bytesleft = size; uint8_t dataType; GError *error = NULL; if (status || type != SDP_SVC_SEARCH_ATTR_RSP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Service search failed"); goto done; } g_message ("SDP search completed"); #ifdef USE_BLUEZ3FUNCS /* Using Bluez 3.x */ scanned = sdp_extract_seqtype_safe(rsp, bytesleft, &dataType, &seqlen); #else /* Using Bluez 4.x */ scanned = sdp_extract_seqtype(rsp, bytesleft, &dataType, &seqlen); #endif /* USE_BLUEZ3FUNCS */ if (!scanned) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Service search failed"); goto done; } rsp += scanned; bytesleft -= scanned; do { sdp_record_t *rec; int recsize; recsize = 0; #ifdef USE_BLUEZ3FUNCS /* Using Bluez 3.x */ rec = sdp_extract_pdu_safe(rsp, bytesleft, &recsize); #else /* Using Bluez 4.x */ rec = sdp_extract_pdu(rsp, bytesleft, &recsize); #endif /* USE_BLUEZ3FUNCS */ if (!rec) break; if (!recsize) { sdp_record_free(rec); break; } scanned += recsize; rsp += recsize; bytesleft -= recsize; recs = sdp_list_append(recs, rec); } while (scanned < size && bytesleft > 0); if (sdp_list_len (recs) == 0) { g_message ("no SDP records found"); if (!memcmp (&ctxt->uuid.value.uuid128, OBEX_NOKIAFTP_UUID, sizeof(uint128_t))) { g_message ("Using standard OBEX FTP uuid"); sdp_uuid16_create (&ctxt->uuid, OBEX_FILETRANS_SVCLASS_ID); if (!sdp_initiate_search (ctxt)) g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Service search failed"); } else { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Service not supported by remote device"); } } else { sdp_record_print (recs->data); sdp_get_channel (recs->data, ctxt); } done: if (error) { cb (-1, ctxt->channel, ctxt->imagingdata, error, ctxt->cb_data); ods_bluez_cancellable_free (ctxt); g_clear_error (&error); } if (recs) sdp_list_free(recs, (sdp_free_func_t) sdp_record_free); } static gboolean sdp_search_process_cb (GIOChannel *chan, GIOCondition cond, void *user_data) { OdsBluezCancellable *ctxt = user_data; OdsBluezFunc cb = ctxt->cb; GError *error = NULL; g_message ("SDP search process"); if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Service search failed"); cb (-1, ctxt->channel, ctxt->imagingdata, error, ctxt->cb_data); ods_bluez_cancellable_free (ctxt); g_clear_error (&error); return FALSE; } if (sdp_process(ctxt->session) < 0) { /* search finished and search_completed_cb was called */ return FALSE; } return TRUE; } static gboolean sdp_initiate_search (OdsBluezCancellable *ctxt) { sdp_list_t *search, *attrids; uint32_t range = 0x0000ffff; gboolean ret = TRUE; /* Set callback responsible for calling sdp_process */ ctxt->io_watch = g_io_add_watch(ctxt->io_channel, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, sdp_search_process_cb, ctxt); search = sdp_list_append(NULL, &ctxt->uuid); attrids = sdp_list_append(NULL, &range); if (sdp_service_search_attr_async(ctxt->session, search, SDP_ATTR_REQ_RANGE, attrids) < 0) { ods_safe_gsource_remove (&ctxt->io_watch); ret = FALSE; } sdp_list_free(attrids, NULL); sdp_list_free(search, NULL); return ret; } static gboolean sdp_connect_watch (GIOChannel *chan, GIOCondition cond, gpointer user_data) { OdsBluezCancellable *ctxt = user_data; socklen_t len; int sk, err = 0; GError *error = NULL; OdsBluezFunc cb = ctxt->cb; sk = g_io_channel_unix_get_fd(chan); len = sizeof(err); if (getsockopt(sk, SOL_SOCKET, SO_ERROR, &err, &len) < 0) goto failed; if (err != 0) goto failed; g_message ("Connected SDP session"); if (sdp_set_notify(ctxt->session, sdp_search_completed_cb, ctxt) < 0) goto failed; if (!sdp_initiate_search (ctxt)) goto failed; return FALSE; failed: g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Service search failed (%s)", err ? strerror(err) : "Could not start search"); cb (-1, ctxt->channel, ctxt->imagingdata, error, ctxt->cb_data); ods_bluez_cancellable_free (ctxt); g_clear_error (&error); return FALSE; } OdsBluezCancellable* ods_bluez_get_client_socket (const bdaddr_t *dst, const bdaddr_t *src, const uuid_t *uuid, guint imaging_feature, gint channel, OdsBluezFunc func, gpointer data) { OdsBluezCancellable *cb_data; cb_data = g_new0 (OdsBluezCancellable, 1); cb_data->cb = func; cb_data->cb_data = data; bacpy (&cb_data->target_address, dst); bacpy (&cb_data->source_address, src); cb_data->imaging_feature = imaging_feature; cb_data->channel = -1; cb_data->fd = -1; /* Discover channel for needed service only if we don't know it yet */ if (channel == 0) { cb_data->session = sdp_connect (src, dst, SDP_NON_BLOCKING); if (!cb_data->session) { ods_bluez_cancellable_free (cb_data); return NULL; } cb_data->io_channel = g_io_channel_unix_new ( sdp_get_socket (cb_data->session)); cb_data->io_watch = g_io_add_watch (cb_data->io_channel, G_IO_OUT | G_IO_HUP | G_IO_ERR | G_IO_NVAL, sdp_connect_watch, cb_data); /* From Johan Hedberg: * * some Nokia Symbian phones have two OBEX FTP services: one * identified with the normal UUID and another with a Nokia specific * 128 bit UUID. The service found behind the normal identifier is * very limited in features on these phones while the other one * supports full OBEX FTP (don't ask me why). */ /* if FTP was requested, use NOKIAFTP instead, * if it isn't found we retreat to FTP in get_remote_service_handles_cb */ if (uuid->value.uuid16 == OBEX_FILETRANS_SVCLASS_ID || !memcmp(&uuid->value.uuid128, OBEX_FTP_UUID, sizeof(uint128_t))) { g_message ("FTP uuid selected, first checking for Nokia OBEX PC Suite Services uuid"); sdp_uuid128_create (&cb_data->uuid, OBEX_NOKIAFTP_UUID); } else memcpy (&cb_data->uuid, uuid, sizeof (uuid_t)); } else { /* skip SDP requests and connect to specified RFCOMM channel */ cb_data->channel = channel; rfcomm_connect (cb_data, channel); } return cb_data; } void ods_bluez_cancel_get_client_socket (OdsBluezCancellable *cancel) { OdsBluezFunc cb = cancel->cb; GError *error = NULL; /* cancel connecting */ if (cancel->io_watch > 0) { if (cancel->fd >= 0) close (cancel->fd); ods_safe_gsource_remove (&cancel->io_watch); } /* callback */ g_set_error (&error, ODS_ERROR, ODS_ERROR_CANCELLED, "Cancelled by DBus client"); cb (-1, cancel->channel, cancel->imagingdata, error, cancel->cb_data); g_clear_error (&error); ods_bluez_cancellable_free (cancel); } gint ods_bluez_get_server_socket (const gchar *address, guint8 channel) { struct sockaddr_rc addr; gint fd = -1; fd = socket (AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM); if (fd < 0) goto err; memset (&addr, 0, sizeof(addr)); addr.rc_family = AF_BLUETOOTH; addr.rc_channel = channel; str2ba (address, &addr.rc_bdaddr); if (bind (fd, (struct sockaddr *) &addr, sizeof (addr)) < 0) { goto err; } if (listen (fd, 1) < 0) { goto err; } return fd; err: if (fd >= 0) close (fd); return -1; } static sdp_session_t* sdp_session_get (const gchar *device, gboolean create_new) { SdpSessionRecords *recs; sdp_session_t *session; bdaddr_t src; if (sdp_session_list && (recs = g_hash_table_lookup (sdp_session_list, device))) { return recs->session; } if (!create_new) return NULL; str2ba (device, &src); session = sdp_connect (&src, BDADDR_LOCAL, SDP_RETRY_IF_BUSY); if (!session) { g_warning ("Couldn't connect to SDP server"); return NULL; } return session; } static void sdp_session_list_add (const gchar *device, sdp_session_t *session) { SdpSessionRecords *recs; if (!sdp_session_list) { sdp_session_list = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } if (!(recs = g_hash_table_lookup (sdp_session_list, device))) { recs = g_new0 (SdpSessionRecords, 1); recs->session = session; recs->rec_count = 1; g_hash_table_insert (sdp_session_list, g_strdup (device), recs); } else { recs->rec_count++; } } static void sdp_session_list_remove (const gchar *device) { SdpSessionRecords *recs; if (!sdp_session_list) return; if (!(recs = g_hash_table_lookup (sdp_session_list, device))) return; recs->rec_count--; if (recs->rec_count < 1) { sdp_close (recs->session); g_hash_table_remove (sdp_session_list, device); } } static guint32 add_bin_service_record (const gchar *device, sdp_record_t *rec) { sdp_session_t *session; bdaddr_t src; gint ret; str2ba (device, &src); session = sdp_session_get (device, TRUE); if (!session) return 0; ret = sdp_device_record_register (session, &src, rec, 0); if (ret < 0) { g_warning("Failed to register sdp record, ret: %i", ret); return 0; } sdp_session_list_add (device, session); return rec->handle; } guint32 ods_bluez_add_service_record (const gchar *device, gint service, ImagingSdpData *imagingdata) { guint32 ret; /* vars that differ according to service */ guint8 chan; guint16 svclass_id_; guint16 profile_id_; gchar *desc; /* --- */ sdp_list_t *svclass_id, *pfseq, *apseq, *root; uuid_t root_uuid, svclass_uuid, l2cap_uuid, rfcomm_uuid, obex_uuid; sdp_profile_desc_t profile[1]; sdp_list_t *aproto, *proto[3]; sdp_data_t *channel; /* only for OPP */ uint8_t formats[] = { 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0xFF }; void *dtds[sizeof(formats)], *values[sizeof(formats)]; guint32 i; uint8_t dtd = SDP_UINT8; sdp_data_t *sflist; /* --- */ /* only for BIP */ sdp_data_t *supp_cap, *supp_feat, *supp_func, *data_cap; /* --- */ sdp_record_t rec; switch (service) { case ODS_SERVICE_OPP: chan = ODS_OPP_RFCOMM_CHANNEL; svclass_id_ = OBEX_OBJPUSH_SVCLASS_ID; profile_id_ = OBEX_OBJPUSH_PROFILE_ID; desc = "OBEX Object Push"; break; case ODS_SERVICE_FTP: chan = ODS_FTP_RFCOMM_CHANNEL; svclass_id_ = OBEX_FILETRANS_SVCLASS_ID; profile_id_ = OBEX_FILETRANS_PROFILE_ID; desc = "OBEX File Transfer"; break; case ODS_SERVICE_PBAP: chan = ODS_PBAP_RFCOMM_CHANNEL; svclass_id_ = PBAP_PSE_SVCLASS_ID; profile_id_ = PBAP_PSE_PROFILE_ID; desc = "OBEX Phonebook Access"; break; case ODS_SERVICE_BIP: chan = ODS_BIP_RFCOMM_CHANNEL; svclass_id_ = IMAGING_RESPONDER_SVCLASS_ID; profile_id_ = IMAGING_PROFILE_ID; desc = "Imaging"; break; default: return 0; } memset (&rec, 0, sizeof(sdp_record_t)); rec.handle = 0xffffffff; sdp_uuid16_create (&root_uuid, PUBLIC_BROWSE_GROUP); root = sdp_list_append (0, &root_uuid); sdp_set_browse_groups (&rec, root); sdp_uuid16_create (&svclass_uuid, svclass_id_); svclass_id = sdp_list_append (0, &svclass_uuid); sdp_set_service_classes (&rec, svclass_id); sdp_uuid16_create (&profile[0].uuid, profile_id_); profile[0].version = 0x0100; pfseq = sdp_list_append (0, profile); sdp_set_profile_descs (&rec, pfseq); sdp_uuid16_create (&l2cap_uuid, L2CAP_UUID); proto[0] = sdp_list_append (0, &l2cap_uuid); apseq = sdp_list_append (0, proto[0]); sdp_uuid16_create (&rfcomm_uuid, RFCOMM_UUID); proto[1] = sdp_list_append (0, &rfcomm_uuid); channel = sdp_data_alloc (SDP_UINT8, &chan); proto[1] = sdp_list_append (proto[1], channel); apseq = sdp_list_append (apseq, proto[1]); sdp_uuid16_create (&obex_uuid, OBEX_UUID); proto[2] = sdp_list_append (0, &obex_uuid); apseq = sdp_list_append (apseq, proto[2]); aproto = sdp_list_append (0, apseq); sdp_set_access_protos (&rec, aproto); if (service == ODS_SERVICE_OPP) { for (i = 0; i < sizeof(formats); i++) { dtds[i] = &dtd; values[i] = &formats[i]; } sflist = sdp_seq_alloc (dtds, values, sizeof(formats)); sdp_attr_add (&rec, SDP_ATTR_SUPPORTED_FORMATS_LIST, sflist); } else if (service == ODS_SERVICE_BIP) { g_assert (imagingdata != NULL); supp_cap = sdp_data_alloc (SDP_UINT8, &imagingdata->supp_capabilities); supp_feat = sdp_data_alloc (SDP_UINT16, &imagingdata->supp_features); supp_func = sdp_data_alloc (SDP_UINT32, &imagingdata->supp_functions); data_cap = sdp_data_alloc (SDP_UINT64, &imagingdata->data_capacity); sdp_attr_add (&rec, SDP_ATTR_SUPPORTED_CAPABILITIES, supp_cap); sdp_attr_add (&rec, SDP_ATTR_SUPPORTED_FEATURES, supp_feat); sdp_attr_add (&rec, SDP_ATTR_SUPPORTED_FUNCTIONS, supp_func); sdp_attr_add (&rec, SDP_ATTR_TOTAL_IMAGING_DATA_CAPACITY, data_cap); } sdp_set_info_attr (&rec, desc, 0, 0); ret = add_bin_service_record (device, &rec); sdp_list_free (root, NULL); sdp_list_free (svclass_id, NULL); sdp_list_free (pfseq, NULL); sdp_list_free (apseq, NULL); sdp_list_free (aproto, NULL); sdp_list_free (proto[0], NULL); sdp_list_free (proto[1], NULL); sdp_list_free (proto[2], NULL); sdp_data_free (channel); sdp_list_free (rec.attrlist, (sdp_free_func_t) sdp_data_free); sdp_list_free (rec.pattern, free); return ret; } void ods_bluez_remove_service_record (const gchar *device, guint32 record_handle) { sdp_session_t *session; bdaddr_t src; gint ret; str2ba (device, &src); session = sdp_session_get (device, FALSE); if (!session) { g_warning ("Couldn't get SDP session"); return; } ret = sdp_device_record_unregister_binary (session, &src, record_handle); if (ret) g_warning ("Failed to unregister service record"); else g_message ("SDP service unregistered"); sdp_session_list_remove (device); } void ods_bluez_finalize () { if (sdp_session_list) { g_hash_table_unref (sdp_session_list); sdp_session_list = NULL; } } obex-data-server-0.4.6/src/ods-server.h0000644000175000017500000000657111524724173014662 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_SERVER_H #define __ODS_SERVER_H #include #include G_BEGIN_DECLS #define ODS_SERVER_DBUS_PATH_PATTERN "/org/openobex/server%d" #define ODS_SERVER_DBUS_INTERFACE "org.openobex.Server" #define ODS_TYPE_SERVER (ods_server_get_type ()) #define ODS_SERVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ODS_TYPE_SERVER, OdsServer)) #define ODS_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ODS_TYPE_SERVER, OdsServerClass)) #define ODS_IS_SERVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ODS_TYPE_SERVER)) #define ODS_IS_SERVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ODS_TYPE_SERVER)) #define ODS_SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ODS_TYPE_SERVER, OdsServerClass)) enum { ODS_SERVER_FD = 1, ODS_SERVER_SERVICE, ODS_SERVER_OWNER, ODS_SERVER_DBUS_PATH, ODS_SERVER_PATH, ODS_SERVER_TTY_DEV }; typedef struct OdsServerPrivate OdsServerPrivate; typedef struct { GObject parent; OdsServerPrivate *priv; } OdsServer; typedef struct { GObjectClass parent_class; void (* started) (OdsServer *server); void (* stopped) (OdsServer *server); void (* closed) (OdsServer *server); void (* session_created) (OdsServer *server, const gchar *session_object); void (* session_removed) (OdsServer *server, const gchar *session_object); void (* error_occurred) (OdsServer *server, const gchar *error_name, const gchar *error_message); void (* disposed) (OdsServer *server); DBusGConnection *connection; } OdsServerClass; GType ods_server_get_type (void); OdsServer *ods_server_new (gint fd, gint service, const gchar *owner); gboolean ods_server_start (OdsServer *server, const gchar *path, gboolean allow_write, gboolean auto_accept, DBusGMethodInvocation *context); gboolean ods_server_stop (OdsServer *server, DBusGMethodInvocation *context); gboolean ods_server_close (OdsServer *server, DBusGMethodInvocation *context); void ods_server_dispose (OdsServer *server); gboolean ods_server_is_started (OdsServer *server); gboolean ods_server_set_option (OdsServer *server, const gchar *name, GValue *value, DBusGMethodInvocation *context); GHashTable *ods_server_get_server_session_info (OdsServer *server, gchar *session_object); gchar **ods_server_get_server_session_list (OdsServer *server); G_END_DECLS #endif /* __ODS_SERVER_H */ obex-data-server-0.4.6/src/ods-logging.h0000644000175000017500000000225511524724173014775 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_LOGGING_H_ #define __ODS_LOGGING_H_ #include void ods_log_init (const char *ident, gboolean enable_syslog, gboolean enable_debug); void ods_log_finalize (); void ods_log_obex (const char *prefix, int evt, int cmd, int rsp); #endif /*__ODS_LOGGING_H_*/ obex-data-server-0.4.6/src/ods-common.h0000644000175000017500000000713611524724173014642 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_COMMON_H_ #define __ODS_COMMON_H_ #include #include /* Reference to the type of BUS we are using */ extern DBusBusType ODS_DBUS_BUS; #define ODS_DBUS_SERVICE "org.openobex" /* ods API version (every incompatible version increases this number) */ #define ODS_API_VERSION 1 #define EOL_CHARS "\n" enum { ODS_SERVICE_GOEP = 1, ODS_SERVICE_OPP, ODS_SERVICE_FTP, ODS_SERVICE_PBAP, ODS_SERVICE_BIP }; /** Standard folder browsing service UUID */ #define OBEX_FTP_UUID \ "\xF9\xEC\x7B\xC4\x95\x3C\x11\xD2\x98\x4E\x52\x54\x00\xDC\x9E\x09" /** Nokia OBEX PC Suite Services (used instead of standard FTP for some devices) */ #define OBEX_NOKIAFTP_UUID \ "\x00\x00\x50\x05\x00\x00\x10\x00\x80\x00\x00\x02\xEE\x00\x00\x01" /** Phone Book Access Profile UUID */ #define OBEX_PBAP_UUID \ "\x79\x61\x35\xF0\xF0\xC5\x11\xD8\x09\x66\x08\x00\x20\x0C\x9A\x66" /** Basic Imaging Image Push */ #define OBEX_BIP_IPUSH_UUID \ "\xE3\x3D\x95\x45\x83\x74\x4A\xD7\x9E\xC5\xC1\x6B\xE3\x1E\xDE\x8E" /** Basic Imaging Image Pull */ #define OBEX_BIP_IPULL_UUID \ "\x8E\xE9\xB3\xD0\x46\x08\x11\xD5\x84\x1A\x00\x02\xA5\x32\x5B\x4E" /** Basic Imaging Advanced Image Printing */ #define OBEX_BIP_AIP_UUID \ "\x92\x35\x33\x50\x46\x08\x11\xD5\x84\x1A\x00\x02\xA5\x32\x5B\x4E" /** Basic Imaging Automatic Archive */ #define OBEX_BIP_AA_UUID \ "\x94\x01\x26\xC0\x46\x08\x11\xD5\x84\x1A\x00\x02\xA5\x32\x5B\x4E" /** Basic Imaging Remote Camera */ #define OBEX_BIP_RC_UUID \ "\x94\x7E\x74\x20\x46\x08\x11\xD5\x84\x1A\x00\x02\xA5\x32\x5B\x4E" /** Basic Imaging Remote Display */ #define OBEX_BIP_RD_UUID \ "\x94\xC7\xCD\x20\x46\x08\x11\xD5\x84\x1A\x00\x02\xA5\x32\x5B\x4E" /** Basic Imaging Referenced Objects */ #define OBEX_BIP_RO_UUID \ "\x8E\x61\xF9\x5D\x1A\x79\x11\xD4\x8E\xA4\x00\x80\x5F\x9B\x98\x34" /** Basic Imaging Archived Objects */ #define OBEX_BIP_AO_UUID \ "\x8E\x61\xF9\x5E\x1A\x79\x11\xD4\x8E\xA4\x00\x80\x5F\x9B\x98\x34" /** Length of UUIDs */ #define OBEX_UUID_LEN 16 #define ODS_OPP_RFCOMM_CHANNEL 9 #define ODS_FTP_RFCOMM_CHANNEL 10 #define ODS_BIP_RFCOMM_CHANNEL 11 #define ODS_PBAP_RFCOMM_CHANNEL 15 gboolean ods_check_bluetooth_address (const gchar *str); gboolean ods_check_caller (DBusGMethodInvocation *context, const gchar *owner); gsize ods_filename_to_utf16 (gchar **filename_utf16, const gchar *filename); gchar *ods_filename_from_utf16 (const gchar *filename_utf16, gssize len); gint ods_make_iso8601 (time_t time, gchar *str, gint len); time_t ods_parse_iso8601 (const gchar *str, gint len); GList *ods_hash_table_get_keys(GHashTable *table); gchar **ods_hash_table_keys2strv (GHashTable *list); gboolean ods_safe_gsource_remove (guint *tag); #endif /*__ODS_COMMON_H_*/ obex-data-server-0.4.6/src/ods-capabilities.h0000644000175000017500000000214511524724173015776 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_CAPABILITIES_H_ #define __ODS_CAPABILITIES_H_ #include gchar* ods_get_capability (const gchar *root_path); gchar* ods_get_imaging_capabilities (); #endif /*__ODS_CAPABILITIES_H_*/ obex-data-server-0.4.6/src/ods-common.c0000644000175000017500000001461411524724173014634 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include "ods-common.h" #include "ods-error.h" /* There shouldn't been a need to init this global variable, but let's do it * just in case */ DBusBusType ODS_DBUS_BUS=DBUS_BUS_SESSION; gboolean ods_check_caller (DBusGMethodInvocation *context, const gchar *owner) { gchar *caller; GError *error = NULL; gboolean ret = FALSE; /* check if caller matches owner of some object */ caller = dbus_g_method_get_sender (context); if (strcmp (caller, owner)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_AUTHORIZED, "Not authorized"); dbus_g_method_return_error (context, error); g_clear_error (&error); goto out; } ret = TRUE; out: g_free (caller); return ret; } gsize ods_filename_to_utf16 (gchar **filename_utf16, const gchar *filename) { gsize utf16_len; gchar *filename_utf8; GError *error = NULL; if (*filename == '\0') { *filename_utf16 = ""; return 0; } /* convert local filename to utf8 */ filename_utf8 = g_filename_to_utf8 (filename, -1, NULL, NULL, &error); if (filename_utf8 == NULL) { g_message ("ods_filename_to_utf16 error: %s", error->message); g_error_free (error); *filename_utf16 = NULL; return 0; } /* convert utf8 to utf16 (big endian) */ *filename_utf16 = g_convert (filename_utf8, -1, "UTF16BE", "UTF8", NULL, &utf16_len, &error); if (*filename_utf16 == NULL) { g_message ("ods_filename_to_utf16 error: %s", error->message); g_error_free (error); utf16_len = 0; } g_free (filename_utf8); (*filename_utf16)[utf16_len+1] = '\0';/* set trailing 0 */ return utf16_len+2;/* utf16_len does not include trailing 0 */ } gchar * ods_filename_from_utf16 (const gchar *filename_utf16, gssize len) { GError *error = NULL; gchar *filename_utf8; gchar *filename; /* convert utf16 (big endian) to utf8 */ filename_utf8 = g_convert (filename_utf16, len, "UTF8", "UTF16BE", NULL, NULL, &error); if (filename_utf8 == NULL) { g_message ("ods_filename_from_utf16 error: %s", error->message); g_error_free (error); return NULL; } /* convert to local filename */ filename = g_filename_from_utf8 (filename_utf8, -1, NULL, NULL, &error); if (filename == NULL) { g_message ("ods_filename_from_utf16 error: %s", error->message); g_error_free (error); } g_free (filename_utf8); return filename; } gint ods_make_iso8601 (time_t time, gchar *str, gint len) { struct tm tm; #if defined(HAVE_TIMEZONE) && defined(USE_LOCALTIME) time_t tz_offset = 0; tz_offset = -timezone; if (daylight > 0) tz_offset += 3600; time += tz_offset; #endif if (gmtime_r(&time, &tm) == NULL) return -1; tm.tm_year += 1900; tm.tm_mon++; return snprintf(str, len, #ifdef USE_LOCALTIME "%04u%02u%02uT%02u%02u%02u", #else "%04u%02u%02uT%02u%02u%02uZ", #endif tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec); } /* From Imendio's GnomeVFS OBEX module (om-utils.c) */ time_t ods_parse_iso8601 (const gchar *str, gint len) { gchar *tstr; struct tm tm; gint nr; gchar tz; time_t time; time_t tz_offset = 0; memset (&tm, 0, sizeof (struct tm)); /* According to spec the time doesn't have to be null terminated */ if (str[len - 1] != '\0') { tstr = g_malloc(len + 1); strncpy(tstr, str, len); tstr[len] = '\0'; } else { tstr = g_strdup(str); } nr = sscanf (tstr, "%04u%02u%02uT%02u%02u%02u%c", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &tz); g_free(tstr); /* Fixup the tm values */ tm.tm_year -= 1900; /* Year since 1900 */ tm.tm_mon--; /* Months since January, values 0-11 */ tm.tm_isdst = -1; /* Daylight savings information not avail */ if (nr < 6) { /* Invalid time format */ return -1; } time = mktime (&tm); #if defined(HAVE_TM_GMTOFF) tz_offset = tm.tm_gmtoff; #elif defined(HAVE_TIMEZONE) tz_offset = -timezone; if (tm.tm_isdst > 0) { tz_offset += 3600; } #endif if (nr == 7) { /* Date/Time was in localtime (to remote device) * already. Since we don't know anything about the * timezone on that one we won't try to apply UTC offset */ time += tz_offset; } return time; } static void prepend_key_to_list(gpointer key, gpointer value, GList **list_keys) { *list_keys = g_list_prepend (*list_keys, key); } /* Implemented for better portability */ GList * ods_hash_table_get_keys(GHashTable *table) { GList *list_keys = NULL; g_hash_table_foreach (table, (GHFunc) prepend_key_to_list, &list_keys); return list_keys; } gchar** ods_hash_table_keys2strv (GHashTable *list) { guint list_size, i = 0; GHashTableIter iter; gpointer key, value; gchar **list_keys = NULL; list_size = g_hash_table_size (list); if (list_size) { list_keys = malloc (sizeof(gchar*) * (list_size+1)); g_hash_table_iter_init (&iter, list); while (g_hash_table_iter_next (&iter, &key, &value)) { list_keys[i] = g_strdup (key); i++; } list_keys[i] = NULL; } return list_keys; } /* safely removes event source * (checks if source exists before calling g_source_remove * and resets tag value) */ gboolean ods_safe_gsource_remove (guint *tag) { GSource* source; gboolean ret = FALSE; if (!*tag) return FALSE; source = g_main_context_find_source_by_id (g_main_context_default(), *tag); if (source) { ret = g_source_remove (*tag); *tag = 0; } return ret; } obex-data-server-0.4.6/src/ods-server-session.c0000644000175000017500000012016611524724173016333 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ods-common.h" #include "ods-error.h" #include "ods-marshal.h" #include "ods-logging.h" #include "ods-obex.h" #include "ods-server-session.h" #include "ods-server-session-dbus-glue.h" static void ods_server_session_finalize (GObject *object); #define ODS_SERVER_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ODS_TYPE_SERVER_SESSION, OdsServerSessionPrivate)) #define ODS_SERVER_SESSION_LOCK(server_session) g_message ("LOCK %s", __FUNCTION__); g_static_mutex_lock (&(server_session)->priv->mutex) #define ODS_SERVER_SESSION_UNLOCK(server_session) g_message ("UNLOCK %s", __FUNCTION__); g_static_mutex_unlock (&(server_session)->priv->mutex) #define ODS_SERVER_SESSION_DBUS_PATH_PATTERN "/org/openobex/serversession%d" #define ODS_SERVER_SESSION_DBUS_INTERFACE "org.openobex.ServerSession" typedef enum { ODS_SERVER_SESSION_STATE_NOT_CONNECTED, ODS_SERVER_SESSION_STATE_OPEN, ODS_SERVER_SESSION_STATE_BUSY } OdsServerSessionState; struct OdsServerSessionPrivate { /* constructor properties */ gint fd; /* rfcomm device */ guint service; gchar *root_path; /* root folder (constructor "path" property) */ gchar *path; /* current path */ gchar *owner; /* D-Bus client, who initiated this session */ gboolean allow_write; /* Whether to allow changes in file system */ gboolean auto_accept; /* Whether incoming files should be auto-accepted */ gboolean require_imaging_thumbnails;/* whether to request thumbnail after PutImage is completed */ /* other properties */ gboolean using_tty;/* if we are using tty device */ /* state (open or busy) */ OdsServerSessionState state; /* ODS_SERVER_SESSION_STATE_OPEN by default */ /* OBEX connection */ OdsObexContext *obex_context; /* other */ GStaticMutex mutex; DBusGMethodInvocation *dbus_context; /* D-Bus context for async methods */ gchar *dbus_path; /* D-Bus path for this object */ /* BIP-specific */ GHashTable *img_handle_list;/* hash list associating image handles with real filenames */ guint selected_img;/* selected image handle (for RemoteDisplay functions) */ }; enum { CANCELLED, DISCONNECTED, TRANSFER_STARTED, TRANSFER_PROGRESS, TRANSFER_COMPLETED, ERROR_OCCURRED, REMOTE_DISPLAY_REQUESTED, LAST_SIGNAL }; static guint signals [LAST_SIGNAL] = { 0, }; /* for numbering established sessions */ static guint iterator = 0; G_DEFINE_TYPE (OdsServerSession, ods_server_session, G_TYPE_OBJECT) /* This is to be called from mainloop, not directly. It's to ensure * that we don't finalize this object from within itself. */ static gboolean emit_disconnected (OdsServerSession *server_session) { ods_obex_close_transport (server_session->priv->obex_context); g_signal_emit (server_session, signals [DISCONNECTED], 0); return FALSE; } /* adds uploaded image to list and returns it's image handle */ static const gchar* image_list_add (OdsServerSession *server_session, const gchar *filename) { gchar *img_handle; if (!server_session->priv->img_handle_list) { server_session->priv->img_handle_list = g_hash_table_new_full ( g_str_hash, g_str_equal, g_free, g_free); } img_handle = g_strdup_printf ("%07u", g_hash_table_size (server_session->priv->img_handle_list)+1); g_hash_table_insert (server_session->priv->img_handle_list, img_handle, g_strdup (filename)); return img_handle; } static void remote_display_action (OdsServerSession *server_session, guint8 action) { OdsServerSessionPrivate *priv; gchar *img_handle = NULL; gchar *filename; priv = server_session->priv; if (action == 0) return; switch (action) { case BIP_REMOTEDISPLAY_NEXTIMAGE: if (priv->selected_img < g_hash_table_size (priv->img_handle_list)) priv->selected_img++; break; case BIP_REMOTEDISPLAY_PREVIOUSIMAGE: if (priv->selected_img > 1) priv->selected_img--; break; case BIP_REMOTEDISPLAY_SELECTIMAGE: priv->selected_img = atoi (priv->obex_context->img_handle); if (priv->selected_img > g_hash_table_size (priv->img_handle_list) || priv->selected_img < 1) { /* resort to first */ priv->selected_img = 1; } else { /* valid value, use this img_handle */ img_handle = g_strdup (priv->obex_context->img_handle); } break; case BIP_REMOTEDISPLAY_CURRENTIMAGE: break; default: g_message ("Invalid RemoteDisplay action specified"); return; } if (!img_handle) { /* get img_handle from selected_img */ img_handle = g_strdup_printf ("%07u", priv->selected_img); } /* lookup filename for selected img_handle */ if (!(filename = g_hash_table_lookup (priv->img_handle_list, img_handle))) { /* should never happen since we did all bounds checking */ g_warning ("Selected img_handle not found in img_handle_list"); return; } /* finally emit RemoteDisplayRequested */ g_signal_emit (server_session, signals [REMOTE_DISPLAY_REQUESTED], 0, filename); g_free (img_handle); } static gboolean obex_io_callback (GIOChannel *io_channel, GIOCondition cond, gpointer data) { obex_t *obex_handle; OdsServerSession *server_session; GError *error = NULL; gboolean ret = TRUE; obex_handle = (obex_t *) data; server_session = ODS_SERVER_SESSION (OBEX_GetUserData (obex_handle)); g_message ("io callback"); if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_LINK_ERROR, "Connection error"); /* cleanup transfer data */ ods_obex_transfer_close (server_session->priv->obex_context); server_session->priv->state = ODS_SERVER_SESSION_STATE_NOT_CONNECTED; ret = FALSE; } else if (OBEX_HandleInput (obex_handle, 1) < 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_BAD_DATA, "Could not parse incoming data"); } if (error) { gchar *error_name; /* Get D-Bus name for error */ error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred signal */ g_signal_emit (server_session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); } if (!ret) { /* Also emit DISCONNECTED signal, since this session is now defunct */ g_idle_add ((GSourceFunc) emit_disconnected, server_session); } return ret; } static void obex_transfer_data_exchange_done (OdsServerSession *server_session, gint ret) { GError *error = NULL; gchar *error_name; OdsObexContext *obex_context; obex_context = server_session->priv->obex_context; if (ret < 0) { ods_error_err2gerror (ret, &error); /* Get D-Bus name for error */ error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred Signal */ g_signal_emit (server_session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); /* Reset state */ server_session->priv->state = ODS_SERVER_SESSION_STATE_OPEN; } else if (ret == 0 && !obex_context->transfer_started_signal_emitted && obex_context->report_progress && obex_context->local) { g_signal_emit (server_session, signals [TRANSFER_STARTED], 0, obex_context->remote, obex_context->local, obex_context->target_size); obex_context->transfer_started_signal_emitted = TRUE; g_message ("TransferStarted emitted at obex_transfer_data_exchange_done"); } } static void send_image_handle (OdsServerSession *server_session, OdsObexContext *obex_context, obex_object_t *object) { /* In the end of BIP PutImage request ImageHandle has to be sent * Make sure that we have transfer info (PUT request was received). * This might be called on last readstream but REQCHECK event * might not have happened yet (happens with small files). */ const gchar *img_handle; gchar *uhandle = NULL; gsize uhandle_len = 0; obex_headerdata_t hv; gint ret; if (server_session->priv->service == ODS_SERVICE_BIP && obex_context->obex_cmd == OBEX_CMD_PUT && obex_context->local && !g_ascii_strncasecmp (obex_context->type, BIP_IMG_TYPE, strlen (obex_context->type))) { img_handle = image_list_add (server_session, obex_context->local); uhandle_len = ods_filename_to_utf16 (&uhandle, img_handle); if (uhandle == NULL) { g_warning ("Failed to convert img_handle"); return; } hv.bs = (guchar *)uhandle; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_IMG_HANDLE, hv, uhandle_len, 0); g_free (uhandle); if (ret < 0) { g_warning ("Failed to add header"); return; } if (server_session->priv->require_imaging_thumbnails) OBEX_ObjectSetRsp (object, OBEX_RSP_PARTIAL_CONTENT, OBEX_RSP_PARTIAL_CONTENT); else OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); } } static void obex_request_cancelled (OdsServerSession *server_session, OdsObexContext *obex_context) { /* Cleanup transfer stuff and reset state */ /* If it was PUT operation, remove incomplete file */ if (obex_context->obex_cmd == OBEX_CMD_PUT && obex_context->stream_fd >= 0) g_unlink (obex_context->local); ods_obex_transfer_close (obex_context); server_session->priv->state = ODS_SERVER_SESSION_STATE_OPEN; /* emit CANCELLED signal */ g_signal_emit (server_session, signals [CANCELLED], 0); /* In case this was trigerred by Cancel method */ if (server_session->priv->dbus_context) { dbus_g_method_return (server_session->priv->dbus_context); server_session->priv->dbus_context = NULL; ODS_SERVER_SESSION_UNLOCK (server_session); } } static gint obex_suspend_request (OdsServerSession *server_session, OdsObexContext *obex_context) { /* only suspend if TransferStarted signal was already emitted */ if (!server_session->priv->auto_accept && obex_context->transfer_started_signal_emitted && !obex_context->suspend_result) { ods_obex_transfer_suspend (obex_context); if (obex_context->suspend_result == OBEX_SUSP_REJECTED) ods_server_session_cancel_internal (server_session); return obex_context->suspend_result; } return 0; } static void obex_request_put (OdsServerSession *server_session, OdsObexContext *obex_context, obex_object_t *object) { guint8 action = 0;/* only used for BIP RemoteDisplay*/ gint ret, suspend_ret; gboolean no_response_on_success = FALSE; gchar *img_filename; /* Check if we already have all transfer info * because both EV_REQCHECK and EV_REQ trigger this function */ if (obex_context->stream_fd >= 0) return; if (!server_session->priv->allow_write) { g_message ("CMD_PUT forbidden"); OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); return; } /* Check if we have write permissions for current path */ if (g_access (server_session->priv->path, W_OK) < 0) { g_message ("No write permissions for current path"); OBEX_ObjectSetRsp (object, OBEX_RSP_UNAUTHORIZED, OBEX_RSP_UNAUTHORIZED); return; } /* If auto_accept is False and transfer hasn't been suspended yet, * we will not send response until the transfer is accepted or rejected */ if (!server_session->priv->auto_accept && !obex_context->suspend_result) no_response_on_success = TRUE; ret = ods_obex_srv_put (obex_context, object, server_session->priv->path, &action, no_response_on_success); g_message ("ret=%d", ret); /* Add ImageFilename to ExtInfo according to ImageHandle (for BIP) */ if (ret == 0 && obex_context->img_handle) { img_filename = g_hash_table_lookup (server_session->priv->img_handle_list, obex_context->img_handle); if (!img_filename) g_message ("Invalid ImgHandle received"); else ods_obex_transfer_add_info (obex_context, "ImageFilename", g_strdup (img_filename)); } /* Process BIP RemoteDisplay info (if available) */ if (ret == 0) remote_display_action (server_session, action); /* also emit TransferStarted signal */ if (ret == 0 && !obex_context->transfer_started_signal_emitted && obex_context->report_progress && obex_context->local) { g_signal_emit (server_session, signals [TRANSFER_STARTED], 0, obex_context->remote, obex_context->local, obex_context->target_size); obex_context->transfer_started_signal_emitted = TRUE; g_message ("TransferStarted emitted at obex_request_put"); } /* In a rare situation when received file is smaller than MTU, * this function is called after all data is already received. * We have to suspend request if auto_accept is False; * For BIP, image handle has to be sent as well */ if (ret == 0) { suspend_ret = obex_suspend_request (server_session, obex_context); if (suspend_ret == OBEX_SUSP_REJECTED) { /* Transfer was rejected and no more data will be received so we * delete written file, emit Cancelled signal and send RSP_FORBIDDEN */ obex_request_cancelled (server_session, obex_context); OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); } else if (suspend_ret == OBEX_SUSP_ACCEPTED) { /* Transfer was accepted, send RSP_SUCCESS */ OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); } if (suspend_ret != OBEX_SUSP_REJECTED) { /* Transfer was accepted either now or earlier */ send_image_handle (server_session, obex_context, object); } } } static void obex_event (obex_t *handle, obex_object_t *object, int mode, int event, int command, int response) { OdsServerSession *server_session; OdsObexContext *obex_context; gchar *new_path; gint ret; server_session = ODS_SERVER_SESSION (OBEX_GetUserData (handle)); obex_context = server_session->priv->obex_context; ods_log_obex (server_session->priv->dbus_path, event, command, response); switch (event) { case OBEX_EV_PROGRESS: if (obex_context->report_progress) { g_signal_emit (server_session, signals [TRANSFER_PROGRESS], 0, obex_context->counter); } break; case OBEX_EV_LINKERR: /* we will get LINKERR when Cancel was called, but device didn't * send OBEX_RSP_SUCCESS response (might be OBEX_RSP_BAD_REQUEST). * When link error really happens, it is handled in io_callback */ g_warning ("EV_LINKERR"); case OBEX_EV_ABORT: obex_request_cancelled (server_session, obex_context); break; case OBEX_EV_REQDONE: switch (command) { case OBEX_CMD_DISCONNECT: ods_server_session_disconnect_internal (server_session); break; case OBEX_CMD_PUT: /* Transfer complete */ ods_obex_transfer_close (obex_context); server_session->priv->state = ODS_SERVER_SESSION_STATE_OPEN; if (obex_context->report_progress) g_signal_emit (server_session, signals [TRANSFER_COMPLETED], 0); break; case OBEX_CMD_GET: /* Transfer complete */ ods_obex_transfer_close (obex_context); server_session->priv->state = ODS_SERVER_SESSION_STATE_OPEN; if (obex_context->report_progress) g_signal_emit (server_session, signals [TRANSFER_COMPLETED], 0); break; default: break; } break; case OBEX_EV_REQHINT: switch (command) { case OBEX_CMD_PUT: OBEX_ObjectReadStream (handle, object, NULL); obex_context->obex_cmd = OBEX_CMD_PUT; /* Initialize transfer and set state */ ods_obex_transfer_new (obex_context, NULL, NULL, NULL); server_session->priv->state = ODS_SERVER_SESSION_STATE_BUSY; OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); break; case OBEX_CMD_GET: obex_context->obex_cmd = OBEX_CMD_GET; /* Initialize transfer and set state */ ods_obex_transfer_new (obex_context, NULL, NULL, NULL); server_session->priv->state = ODS_SERVER_SESSION_STATE_BUSY; OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); break; case OBEX_CMD_CONNECT: case OBEX_CMD_DISCONNECT: case OBEX_CMD_SETPATH: OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); break; default: OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, OBEX_RSP_NOT_IMPLEMENTED); break; } break; case OBEX_EV_REQCHECK: if (command == OBEX_CMD_PUT) { g_message ("CMD_PUT requested at REQCHECK"); obex_request_put (server_session, obex_context, object); } break; case OBEX_EV_REQ: switch (command) { case OBEX_CMD_DISCONNECT: OBEX_ObjectSetRsp(object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS); break; case OBEX_CMD_CONNECT: g_message ("CMD_CONNECT requested"); ods_obex_srv_connect (obex_context, object, server_session->priv->service); break; case OBEX_CMD_SETPATH: if (server_session->priv->service == ODS_SERVICE_OPP) { OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, OBEX_RSP_NOT_IMPLEMENTED); return; } g_message ("CMD_SETPATH requested"); g_message ("current path: %s", server_session->priv->path); g_message ("root path: %s", server_session->priv->root_path); if (ods_obex_srv_setpath (obex_context, object, server_session->priv->root_path, server_session->priv->path, &new_path, server_session->priv->allow_write)) { g_free (server_session->priv->path); server_session->priv->path = new_path; } g_message ("new path: %s", server_session->priv->path); break; case OBEX_CMD_GET: g_message ("CMD_GET requested"); ret = ods_obex_srv_get (obex_context, object, server_session->priv->path, server_session->priv->root_path, server_session->priv->allow_write); g_message ("ret=%d", ret); if (ret > 0 && obex_context->report_progress) { g_signal_emit (server_session, signals [TRANSFER_STARTED], 0, obex_context->remote, obex_context->local, obex_context->target_size); obex_context->transfer_started_signal_emitted = TRUE; g_message ("TransferStarted emitted at obex_event at OBEX_EV_REQ"); } break; case OBEX_CMD_PUT: g_message ("CMD_PUT requested"); obex_request_put (server_session, obex_context, object); break; default: OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, OBEX_RSP_NOT_IMPLEMENTED); break; } break; case OBEX_EV_STREAMEMPTY: ret = ods_obex_writestream (obex_context, object); obex_transfer_data_exchange_done (server_session, ret); break; case OBEX_EV_STREAMAVAIL: ret = 0; if (!server_session->priv->allow_write) { g_message ("CMD_PUT forbidden"); OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); /* We don't emit ErrorOccurred for this situation */ return; } /* Check if we have write permissions for current path */ if (g_access (server_session->priv->path, W_OK) < 0) { OBEX_ObjectSetRsp (object, OBEX_RSP_UNAUTHORIZED, OBEX_RSP_UNAUTHORIZED); ret = -EACCES; goto readstream_done; } /* This PUT request is definitely not a delete request. Let's * open a file for writing in case this wasn't done yet */ if (obex_context->remote && !obex_context->local) { if (!ods_obex_srv_new_file (obex_context, server_session->priv->path)) { OBEX_ObjectSetRsp (object, OBEX_RSP_UNAUTHORIZED, OBEX_RSP_UNAUTHORIZED); ret = -EACCES; goto readstream_done; } } /* suspend request if necessary */ obex_suspend_request (server_session, obex_context); ret = ods_obex_readstream (obex_context, object); readstream_done: obex_transfer_data_exchange_done (server_session, ret); if (ret == 2) { /* Transfer was cancelled by sending RSP_FORBIDDEN, this will * not trigger EV_ABORT so we need to emit Cancelled signal here */ obex_request_cancelled (server_session, obex_context); } else if (ret == 1) { /* Last packet was received, send image handle */ send_image_handle (server_session, obex_context, object); } break; case OBEX_EV_PARSEERR: /* Handled in io_callback */ break; case OBEX_EV_UNEXPECTED: break; default: break; } } static void ods_server_session_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { OdsServerSession *self = ODS_SERVER_SESSION (object); switch (property_id) { case ODS_SERVER_SESSION_FD: self->priv->fd = g_value_get_int (value); if (self->priv->fd >= 0) { OdsObexContext *obex_context = self->priv->obex_context; GError *error = NULL; guint16 rx_mtu = ODS_DEFAULT_RX_MTU; guint16 tx_mtu = ODS_DEFAULT_TX_MTU; g_message ("Creating server session"); if (self->priv->using_tty) { rx_mtu = ODS_TTY_RX_MTU; tx_mtu = ODS_TTY_TX_MTU; } ods_obex_setup_fdtransport (obex_context, self->priv->fd, rx_mtu, tx_mtu, obex_event, obex_io_callback, self, &error); if (error) { g_warning ("Error while creating server session: %s", error->message); ods_server_session_disconnect_internal (self); g_clear_error (&error); } } break; case ODS_SERVER_SESSION_SERVICE: self->priv->service = g_value_get_int (value); break; case ODS_SERVER_SESSION_PATH: self->priv->root_path = g_value_dup_string (value); self->priv->path = g_value_dup_string (value); g_warning ("Session path: %s", self->priv->path); break; case ODS_SERVER_SESSION_ALLOW_WRITE: self->priv->allow_write = g_value_get_boolean (value); break; case ODS_SERVER_SESSION_AUTO_ACCEPT: self->priv->auto_accept = g_value_get_boolean (value); break; case ODS_SERVER_SESSION_REQUIRE_IMAGING_THUMBNAILS: self->priv->require_imaging_thumbnails = g_value_get_boolean (value); break; case ODS_SERVER_SESSION_USING_TTY: self->priv->using_tty = g_value_get_boolean (value); break; case ODS_SERVER_SESSION_OWNER: self->priv->owner = g_value_dup_string (value); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); break; } } static void ods_server_session_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { OdsServerSession *self = ODS_SERVER_SESSION (object); switch (property_id) { case ODS_SERVER_SESSION_FD: g_value_set_int (value, self->priv->fd); break; case ODS_SERVER_SESSION_SERVICE: g_value_set_int (value, self->priv->service); break; case ODS_SERVER_SESSION_PATH: g_value_set_string (value, self->priv->path); break; case ODS_SERVER_SESSION_ALLOW_WRITE: g_value_set_boolean (value, self->priv->allow_write); break; case ODS_SERVER_SESSION_AUTO_ACCEPT: g_value_set_boolean (value, self->priv->auto_accept); break; case ODS_SERVER_SESSION_REQUIRE_IMAGING_THUMBNAILS: g_value_set_boolean (value, self->priv->require_imaging_thumbnails); break; case ODS_SERVER_SESSION_USING_TTY: g_value_set_boolean (value, self->priv->using_tty); break; case ODS_SERVER_SESSION_OWNER: g_value_set_string (value, self->priv->owner); break; case ODS_SERVER_SESSION_DBUS_PATH: g_value_set_string (value, self->priv->dbus_path); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); break; } } /** * ods_server_session_class_init: * @klass: The OdsServerSessionClass **/ static void ods_server_session_class_init (OdsServerSessionClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = ods_server_session_finalize; object_class->set_property = ods_server_session_set_property; object_class->get_property = ods_server_session_get_property; g_object_class_install_property (object_class, ODS_SERVER_SESSION_FD, g_param_spec_int ("fd", "", "", -1, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_SERVICE, g_param_spec_int ("service", "", "", 0, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_PATH, g_param_spec_string ("path", "", "", "" /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_OWNER, g_param_spec_string ("owner", "", "", "" /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_ALLOW_WRITE, g_param_spec_boolean("allow-write", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_AUTO_ACCEPT, g_param_spec_boolean("auto-accept", "", "", TRUE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_REQUIRE_IMAGING_THUMBNAILS, g_param_spec_boolean("require-imaging-thumbnails", "", "", FALSE, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_USING_TTY, g_param_spec_boolean("using-tty", "", "", FALSE, G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SERVER_SESSION_DBUS_PATH, g_param_spec_string ("dbus-path", "", "", "" /* default value */, G_PARAM_READABLE)); signals [CANCELLED] = g_signal_new ("cancelled", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, cancelled), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [DISCONNECTED] = g_signal_new ("disconnected", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, disconnected), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [TRANSFER_STARTED] = g_signal_new ("transfer-started", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, transfer_started), NULL, NULL, ods_marshal_VOID__STRING_STRING_UINT64, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64); signals [TRANSFER_PROGRESS] = g_signal_new ("transfer-progress", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, transfer_progress), NULL, NULL, ods_marshal_VOID__UINT64, G_TYPE_NONE, 1, G_TYPE_UINT64); signals [TRANSFER_COMPLETED] = g_signal_new ("transfer-completed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, transfer_completed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [ERROR_OCCURRED] = g_signal_new ("error-occurred", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, error_occurred), NULL, NULL, ods_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals [REMOTE_DISPLAY_REQUESTED] = g_signal_new ("remote-display-requested", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsServerSessionClass, remote_display_requested), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING); g_type_class_add_private (klass, sizeof (OdsServerSessionPrivate)); GError *error = NULL; /* Init the DBus connection, per-klass */ klass->connection = dbus_g_bus_get (ODS_DBUS_BUS, &error); if (klass->connection == NULL) { g_warning("Unable to connect to dbus: %s", error->message); g_clear_error (&error); return; } /* &dbus_glib_ods_server_session_object_info is provided in the * dbus/ods-server-session-dbus-glue.h file */ dbus_g_object_type_install_info (ODS_TYPE_SERVER_SESSION, &dbus_glib_ods_server_session_object_info); } /** * ods_server_session_init: * @server_session: This class instance **/ static void ods_server_session_init (OdsServerSession *server_session) { OdsServerSessionClass *klass = ODS_SERVER_SESSION_GET_CLASS (server_session); server_session->priv = ODS_SERVER_SESSION_GET_PRIVATE (server_session); server_session->priv->obex_context = ods_obex_context_new (); /* figure out DBus object path for this instance */ server_session->priv->state = ODS_SERVER_SESSION_STATE_OPEN; server_session->priv->dbus_path = g_strdup_printf (ODS_SERVER_SESSION_DBUS_PATH_PATTERN, iterator); iterator++; /* default selected image handle for BIP RemoteDisplay is 0000001 */ server_session->priv->selected_img = 1; /* create mutex */ g_static_mutex_init (&server_session->priv->mutex); dbus_g_connection_register_g_object (klass->connection, server_session->priv->dbus_path, G_OBJECT (server_session)); } /** * ods_server_session_finalize: * @object: The object to finalize * * Finalize the session **/ static void ods_server_session_finalize (GObject *object) { OdsServerSession *server_session; g_return_if_fail (object != NULL); g_return_if_fail (ODS_IS_SERVER_SESSION (object)); server_session = ODS_SERVER_SESSION (object); g_return_if_fail (server_session->priv != NULL); /* close connection, free obex_context */ g_message ("closing connection"); /* In TTY mode, fd ownership will revert to the OdsServer, so don't * close it. See server_session_disconnected_cb. */ if (!server_session->priv->using_tty) { shutdown (server_session->priv->fd, SHUT_RDWR); close (server_session->priv->fd); } server_session->priv->fd = -1; OBEX_Cleanup (server_session->priv->obex_context->obex_handle); g_free (server_session->priv->obex_context); /* free other private variables */ if (server_session->priv->img_handle_list) g_hash_table_unref (server_session->priv->img_handle_list); g_free (server_session->priv->root_path); g_free (server_session->priv->path); g_free (server_session->priv->owner); g_free (server_session->priv->dbus_path); g_static_mutex_free (&server_session->priv->mutex); G_OBJECT_CLASS (ods_server_session_parent_class)->finalize (object); } /** * ods_server_session_new: * * Return value: a new OdsServerSession object. **/ OdsServerSession * ods_server_session_new (gint fd, gint service, const gchar *path, gboolean allow_write, gboolean auto_accept, gboolean require_imaging_thumbnails, const gchar *owner) { OdsServerSession *server_session; server_session = g_object_new (ODS_TYPE_SERVER_SESSION, "fd", fd, "service", service, "path", path, "allow-write", allow_write, "auto-accept", auto_accept, "require-imaging-thumbnails", require_imaging_thumbnails, "owner", owner, NULL); return ODS_SERVER_SESSION (server_session); } gboolean ods_server_session_accept (OdsServerSession *server_session, DBusGMethodInvocation *context) { GError *error = NULL; ODS_SERVER_SESSION_LOCK (server_session); /* do checks */ if (!ods_check_caller (context, server_session->priv->owner)) { ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } if (server_session->priv->state != ODS_SERVER_SESSION_STATE_BUSY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "There is no transfer in progress"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } /* Accept file */ server_session->priv->obex_context->suspend_result = OBEX_SUSP_ACCEPTED; dbus_g_method_return (context); ODS_SERVER_SESSION_UNLOCK (server_session); return TRUE; } gboolean ods_server_session_reject (OdsServerSession *server_session, DBusGMethodInvocation *context) { GError *error = NULL; ODS_SERVER_SESSION_LOCK (server_session); /* do checks */ if (!ods_check_caller (context, server_session->priv->owner)) { ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } if (server_session->priv->state != ODS_SERVER_SESSION_STATE_BUSY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "There is no transfer in progress"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } /* Reject file */ server_session->priv->obex_context->suspend_result = OBEX_SUSP_REJECTED; dbus_g_method_return (context); ODS_SERVER_SESSION_UNLOCK (server_session); return TRUE; } void ods_server_session_disconnect_internal (OdsServerSession *server_session) { if (server_session->priv->state == ODS_SERVER_SESSION_STATE_OPEN) { OBEX_TransportDisconnect (server_session->priv->obex_context->obex_handle); server_session->priv->state = ODS_SERVER_SESSION_STATE_NOT_CONNECTED; } g_idle_add ((GSourceFunc) emit_disconnected, server_session); } gboolean ods_server_session_disconnect (OdsServerSession *server_session, DBusGMethodInvocation *context) { GError *error = NULL; ODS_SERVER_SESSION_LOCK (server_session); /* do checks */ if (!ods_check_caller (context, server_session->priv->owner)) { ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } if (server_session->priv->state == ODS_SERVER_SESSION_STATE_BUSY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_BUSY, "Operations in progress need to be cancelled first"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } ods_server_session_disconnect_internal (server_session); dbus_g_method_return (context); ODS_SERVER_SESSION_UNLOCK (server_session); return TRUE; } GHashTable * ods_server_session_get_transfer_info (OdsServerSession *server_session) { return ods_obex_transfer_get_info (server_session->priv->obex_context); } gboolean ods_server_session_cancel_internal (OdsServerSession *server_session) { OdsObexContext *ctxt = server_session->priv->obex_context; if (server_session->priv->state != ODS_SERVER_SESSION_STATE_BUSY) { /* emit CANCELLED signal now */ g_signal_emit (server_session, signals[CANCELLED], 0); return FALSE; } if (ctxt->obex_cmd == OBEX_CMD_GET) { /* Send CMD_ABORT now */ OBEX_CancelRequest (ctxt->obex_handle, TRUE); } else { /* Send RSP_FORBIDDEN at obex_readstream; * cleanup will be done in obex_event */ ctxt->cancelled = TRUE; } /* In case ServerSession got stuck in suspended mode (client app quitted without * accepting/rejecting transfer), we reject transfer at this point */ server_session->priv->obex_context->suspend_result = OBEX_SUSP_REJECTED; return TRUE; } gboolean ods_server_session_cancel (OdsServerSession *server_session, DBusGMethodInvocation *context) { ODS_SERVER_SESSION_LOCK (server_session); /* do checks */ if (!ods_check_caller (context, server_session->priv->owner)) { ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } if (ods_server_session_cancel_internal (server_session)) { if (server_session->priv->dbus_context) { GError *error; g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SERVER_SESSION_UNLOCK (server_session); return FALSE; } /* set dbus context */ server_session->priv->dbus_context = context; /* will return at obex_event{EV_ABORT} */ } else { dbus_g_method_return (context); ODS_SERVER_SESSION_UNLOCK (server_session); } return TRUE; } obex-data-server-0.4.6/src/ods-imaging-helpers.h0000644000175000017500000000556111524724173016425 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_IMAGING_HELPERS_H_ #define __ODS_IMAGING_HELPERS_H_ #include enum { ODS_IMAGING_TRANSFORMATION_STRETCH = 1, ODS_IMAGING_TRANSFORMATION_CROP, ODS_IMAGING_TRANSFORMATION_FILL }; #define ODS_IMAGING_TRANSFORMATION_STRETCH_STR "stretch" #define ODS_IMAGING_TRANSFORMATION_CROP_STR "crop" #define ODS_IMAGING_TRANSFORMATION_FILL_STR "fill" #define ODS_IMAGING_THUMBNAIL_WIDTH 160 #define ODS_IMAGING_THUMBNAIL_HEIGHT 120 #define ODS_IMAGING_THUMBNAIL_ENCODING "JPEG" typedef struct OdsImageInfo_ { gchar *filename; gchar *resized_image_filename; gulong width; gulong height; gchar *encoding; guint transformation; goffset size; } OdsImageInfo; typedef void (* OdsImagingFunc) (OdsImageInfo*, gpointer); gchar* get_image_descriptor (const gchar *encoding, const gchar *pixel, guint64 size, const gchar *transformation); gchar* get_attachment_descriptor (const gchar *name, guint64 size, const gchar *content_type, const gchar *charset, const gchar *created); void parse_image_descriptor (const gchar *descriptor, gchar **encoding, gchar **pixel, guint64 *size, gchar **transformation); void parse_attachment_descriptor (const gchar *descriptor, gchar **name, guint64 *size, gchar **content_type, gchar **charset, gchar **created); void ods_image_info_free (OdsImageInfo *info); gchar* ods_imaging_get_pixel_string (gulong width, gulong height); const gchar* ods_imaging_get_transformation_string (guint transformation); guint ods_imaging_get_transformation (const gchar *trans); gboolean ods_imaging_get_image_info_async (const gchar *filename, OdsImagingFunc func, gpointer data); gboolean ods_imaging_resize_image_async (const gchar *filename, gulong width, gulong height, const gchar *encoding, guint transformation, OdsImagingFunc func, gpointer data); gboolean ods_imaging_make_image_thumbnail_async (const gchar *filename, OdsImagingFunc func, gpointer data); #endif /*__ODS_IMAGING_HELPERS_H_*/ obex-data-server-0.4.6/src/ods-marshal.list0000644000175000017500000000014711524724173015520 00000000000000NONE:STRING,STRING,UINT64 NONE:UINT64 NONE:STRING,STRING NONE:STRING,STRING,STRING NONE:STRING,BOOLEAN obex-data-server-0.4.6/src/ods-server.xml0000644000175000017500000000325311524724173015225 00000000000000 obex-data-server-0.4.6/src/ods-main.c0000644000175000017500000001225011524724173014262 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include "ods-common.h" #include "ods-manager.h" #include "ods-logging.h" static GMainLoop *main_loop; static OdsManager *manager = NULL; static void manager_disposed_cb (OdsManager *manager, gpointer data) { g_message ("quitting main loop"); g_main_loop_quit (main_loop); } static void sig_term (int sig) { g_message ("me was killed"); g_signal_connect (manager, "disposed", G_CALLBACK (manager_disposed_cb), NULL); ods_manager_dispose (manager); } static gboolean ods_service_register (DBusGConnection *connection) { DBusGProxy *bus_proxy = NULL; GError *error = NULL; guint request_name_result; bus_proxy = dbus_g_proxy_new_for_name (connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); if (!org_freedesktop_DBus_request_name (bus_proxy, ODS_DBUS_SERVICE, 0, &request_name_result, &error)) { g_critical ("Unable to register service: %s", error->message); g_clear_error (&error); g_object_unref (bus_proxy); return FALSE; } /* free the bus_proxy */ g_object_unref (bus_proxy); /* already running */ if (request_name_result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { g_critical ("Already running in this session"); return FALSE; } return TRUE; } /** * main: **/ int main (int argc, char *argv[]) { DBusGConnection *system_connection; DBusGConnection *session_connection; GError *error = NULL; GOptionContext *context; struct sigaction sa; gboolean no_daemon = FALSE; gboolean system_bus = FALSE; gboolean show_version = FALSE; gboolean log = FALSE; gboolean debug = FALSE; const GOptionEntry options[] = { { "no-daemon", 'n', 0, G_OPTION_ARG_NONE, &no_daemon, "Do not daemonize", NULL }, { "system-bus", 's', 0, G_OPTION_ARG_NONE, &system_bus, "Use system bus instead of the default session bus", NULL}, { "log", 'l', 0, G_OPTION_ARG_NONE, &log, "Log all messages to syslog", NULL}, { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, "Enable debugging messages", NULL}, { "version", 'v', 0, G_OPTION_ARG_NONE, &show_version, "Show version of obex-data-server and exit immediately", NULL}, { NULL} }; setlocale (LC_CTYPE, ""); #if defined(USE_IMAGEMAGICK) || defined (USE_GDKPIXBUF) /* threading is only used for BIP stuff */ g_thread_init (NULL); #endif context = g_option_context_new (""); g_option_context_add_main_entries (context, options, NULL); if (!g_option_context_parse (context, &argc, &argv, &error)) { g_warning ("%s", error->message); g_clear_error (&error); } g_option_context_free (context); g_type_init (); if (show_version) { printf (PACKAGE_STRING "\n"); return 0; } if (!no_daemon && daemon (0, 0)) { g_critical ("Could not daemonize: %s", g_strerror (errno)); } /* init logging stuff */ ods_log_init (PACKAGE_NAME, log, debug); /* check dbus connections, exit if not valid */ system_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error); if (error) { g_critical ("%s", error->message); g_clear_error (&error); return -1; } if (!system_bus) { ODS_DBUS_BUS = DBUS_BUS_SESSION; g_message ("Using Session bus"); } else { ODS_DBUS_BUS = DBUS_BUS_SYSTEM; g_message ("Using System bus"); } session_connection = dbus_g_bus_get (ODS_DBUS_BUS, &error); if (error) { g_critical ("%s", error->message); g_clear_error (&error); return -1; } if (!ods_service_register (session_connection)) { return -1; } /* create a new manager object */ manager = ods_manager_new (); if (!ods_manager_is_initialized (manager)) { g_critical ("Failed to initialize OdsManager object"); g_object_unref (manager); return -1; } main_loop = g_main_loop_new (NULL, FALSE); memset (&sa, 0, sizeof (sa)); sa.sa_handler = sig_term; sigaction (SIGTERM, &sa, NULL); sigaction (SIGINT, &sa, NULL); g_main_loop_run (main_loop); g_object_unref (manager); ods_log_finalize (); return 0; } obex-data-server-0.4.6/src/ods-marshal.c0000644000175000017500000002345011546317666015002 00000000000000 #include #ifdef G_ENABLE_DEBUG #define g_marshal_value_peek_boolean(v) g_value_get_boolean (v) #define g_marshal_value_peek_char(v) g_value_get_char (v) #define g_marshal_value_peek_uchar(v) g_value_get_uchar (v) #define g_marshal_value_peek_int(v) g_value_get_int (v) #define g_marshal_value_peek_uint(v) g_value_get_uint (v) #define g_marshal_value_peek_long(v) g_value_get_long (v) #define g_marshal_value_peek_ulong(v) g_value_get_ulong (v) #define g_marshal_value_peek_int64(v) g_value_get_int64 (v) #define g_marshal_value_peek_uint64(v) g_value_get_uint64 (v) #define g_marshal_value_peek_enum(v) g_value_get_enum (v) #define g_marshal_value_peek_flags(v) g_value_get_flags (v) #define g_marshal_value_peek_float(v) g_value_get_float (v) #define g_marshal_value_peek_double(v) g_value_get_double (v) #define g_marshal_value_peek_string(v) (char*) g_value_get_string (v) #define g_marshal_value_peek_param(v) g_value_get_param (v) #define g_marshal_value_peek_boxed(v) g_value_get_boxed (v) #define g_marshal_value_peek_pointer(v) g_value_get_pointer (v) #define g_marshal_value_peek_object(v) g_value_get_object (v) #define g_marshal_value_peek_variant(v) g_value_get_variant (v) #else /* !G_ENABLE_DEBUG */ /* WARNING: This code accesses GValues directly, which is UNSUPPORTED API. * Do not access GValues directly in your code. Instead, use the * g_value_get_*() functions */ #define g_marshal_value_peek_boolean(v) (v)->data[0].v_int #define g_marshal_value_peek_char(v) (v)->data[0].v_int #define g_marshal_value_peek_uchar(v) (v)->data[0].v_uint #define g_marshal_value_peek_int(v) (v)->data[0].v_int #define g_marshal_value_peek_uint(v) (v)->data[0].v_uint #define g_marshal_value_peek_long(v) (v)->data[0].v_long #define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong #define g_marshal_value_peek_int64(v) (v)->data[0].v_int64 #define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64 #define g_marshal_value_peek_enum(v) (v)->data[0].v_long #define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong #define g_marshal_value_peek_float(v) (v)->data[0].v_float #define g_marshal_value_peek_double(v) (v)->data[0].v_double #define g_marshal_value_peek_string(v) (v)->data[0].v_pointer #define g_marshal_value_peek_param(v) (v)->data[0].v_pointer #define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer #define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer #define g_marshal_value_peek_object(v) (v)->data[0].v_pointer #define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer #endif /* !G_ENABLE_DEBUG */ /* NONE:STRING,STRING,UINT64 (src/ods-marshal.list:1) */ void ods_marshal_VOID__STRING_STRING_UINT64 (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__STRING_STRING_UINT64) (gpointer data1, gpointer arg_1, gpointer arg_2, guint64 arg_3, gpointer data2); register GMarshalFunc_VOID__STRING_STRING_UINT64 callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 4); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__STRING_STRING_UINT64) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_string (param_values + 1), g_marshal_value_peek_string (param_values + 2), g_marshal_value_peek_uint64 (param_values + 3), data2); } /* NONE:UINT64 (src/ods-marshal.list:2) */ void ods_marshal_VOID__UINT64 (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__UINT64) (gpointer data1, guint64 arg_1, gpointer data2); register GMarshalFunc_VOID__UINT64 callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 2); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__UINT64) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_uint64 (param_values + 1), data2); } /* NONE:STRING,STRING (src/ods-marshal.list:3) */ void ods_marshal_VOID__STRING_STRING (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__STRING_STRING) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2); register GMarshalFunc_VOID__STRING_STRING callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__STRING_STRING) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_string (param_values + 1), g_marshal_value_peek_string (param_values + 2), data2); } /* NONE:STRING,STRING,STRING (src/ods-marshal.list:4) */ void ods_marshal_VOID__STRING_STRING_STRING (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__STRING_STRING_STRING) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer arg_3, gpointer data2); register GMarshalFunc_VOID__STRING_STRING_STRING callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 4); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__STRING_STRING_STRING) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_string (param_values + 1), g_marshal_value_peek_string (param_values + 2), g_marshal_value_peek_string (param_values + 3), data2); } /* NONE:STRING,BOOLEAN (src/ods-marshal.list:5) */ void ods_marshal_VOID__STRING_BOOLEAN (GClosure *closure, GValue *return_value G_GNUC_UNUSED, guint n_param_values, const GValue *param_values, gpointer invocation_hint G_GNUC_UNUSED, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__STRING_BOOLEAN) (gpointer data1, gpointer arg_1, gboolean arg_2, gpointer data2); register GMarshalFunc_VOID__STRING_BOOLEAN callback; register GCClosure *cc = (GCClosure*) closure; register gpointer data1, data2; g_return_if_fail (n_param_values == 3); if (G_CCLOSURE_SWAP_DATA (closure)) { data1 = closure->data; data2 = g_value_peek_pointer (param_values + 0); } else { data1 = g_value_peek_pointer (param_values + 0); data2 = closure->data; } callback = (GMarshalFunc_VOID__STRING_BOOLEAN) (marshal_data ? marshal_data : cc->callback); callback (data1, g_marshal_value_peek_string (param_values + 1), g_marshal_value_peek_boolean (param_values + 2), data2); } obex-data-server-0.4.6/src/ods-folder-listing.h0000644000175000017500000000221411524724173016264 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_FOLDER_LISTING_H_ #define __ODS_FOLDER_LISTING_H_ #include gchar* get_folder_listing (const gchar *path, const gchar *root_path, gboolean allow_write); #endif /*__ODS_FOLDER_LISTING_H_*/ obex-data-server-0.4.6/src/ods-logging.c0000644000175000017500000001555711524724173015001 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include static gboolean syslog_enabled = FALSE; static gboolean debug_enabled = FALSE; static struct { int g_log_level; int syslog_prio; const char *prefix; } log_levels[] = { { G_LOG_LEVEL_MESSAGE, LOG_INFO, "" }, { G_LOG_LEVEL_WARNING, LOG_WARNING, "**Warning" }, { G_LOG_LEVEL_ERROR, LOG_ERR, "**Error" }, { G_LOG_LEVEL_DEBUG, LOG_DEBUG, "##DEBUG" }, { G_LOG_LEVEL_CRITICAL, LOG_CRIT, "**Critical"}, { G_LOG_LEVEL_INFO, LOG_INFO, "" }, { 0xFF, 0xFF, "" }, }; static void log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { const char *prefix = ""; int syslog_prio = LOG_INFO; int i; char *out = NULL; /* suppress debug messages if debugging is disabled */ if (!debug_enabled && log_level == G_LOG_LEVEL_DEBUG) return; for (i = 0; log_levels[i].g_log_level != 0xFF; i++) { if (log_levels[i].g_log_level != log_level) continue; syslog_prio = log_levels[i].syslog_prio; prefix = log_levels[i].prefix; } if (*prefix != '\0') { out = g_strdup_printf ("%s: %s", prefix, message); } if (syslog_enabled) syslog (syslog_prio, "%s", out ? out : message); else printf ("%s\n", out ? out : message); g_free (out); } void ods_log_init (const char *ident, gboolean enable_syslog, gboolean enable_debug) { g_log_set_handler (NULL, G_LOG_LEVEL_MASK | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION, log_handler, NULL); if (enable_syslog) openlog (ident, LOG_PID | LOG_NDELAY | LOG_PERROR, LOG_DAEMON); else printf ("%s\n", PACKAGE_STRING); syslog_enabled = enable_syslog; debug_enabled = enable_debug; } void ods_log_finalize () { if (syslog_enabled) closelog (); } static struct { int evt; const char *name; } obex_event[] = { { OBEX_EV_PROGRESS, "PROGRESS" }, /* Progress has been made */ { OBEX_EV_REQHINT, "REQHINT" }, /* An incoming request is about to come */ { OBEX_EV_REQ, "REQ" }, /* An incoming request has arrived */ { OBEX_EV_REQDONE, "REQDONE" }, /* Request has finished */ { OBEX_EV_LINKERR, "LINKERR" }, /* Link has been disconnected */ { OBEX_EV_PARSEERR, "PARSEERR" }, /* Malformed data encountered */ { OBEX_EV_ACCEPTHINT, "ACCEPTHINT" }, /* Connection accepted */ { OBEX_EV_ABORT, "ABORT" }, /* Request was aborted */ { OBEX_EV_STREAMEMPTY, "STREAMEMPTY" }, /* Need to feed more data when sending a stream */ { OBEX_EV_STREAMAVAIL, "STREAMAVAIL" }, /* Time to pick up data when receiving a stream */ { OBEX_EV_UNEXPECTED, "UNEXPECTED" }, /* Unexpected data, not fatal */ { OBEX_EV_REQCHECK, "REQCHECK" }, /* First packet of an incoming request has been parsed */ { 0xFF, "" }, }; /* Possible OBEX commands */ static struct { int cmd; const char *name; } obex_command[] = { { OBEX_CMD_CONNECT, "CONNECT" }, { OBEX_CMD_DISCONNECT, "DISCONNECT"}, { OBEX_CMD_PUT, "PUT" }, { OBEX_CMD_GET, "GET" }, { OBEX_CMD_SETPATH, "SETPATH" }, { OBEX_CMD_SESSION, "SESSION" }, { OBEX_CMD_ABORT, "ABORT" }, { OBEX_FINAL, "FINAL" }, { 0xFF, "" }, }; /* Possible OBEX responses */ static struct { int rsp; const char *name; } obex_response[] = { { OBEX_RSP_CONTINUE, "CONTINUE" }, { OBEX_RSP_SWITCH_PRO, "SWITCH_PRO" }, { OBEX_RSP_SUCCESS, "SUCCESS" }, { OBEX_RSP_CREATED, "CREATED" }, { OBEX_RSP_ACCEPTED, "ACCEPTED" }, { OBEX_RSP_NON_AUTHORITATIVE, "NON_AUTHORITATIVE" }, { OBEX_RSP_NO_CONTENT, "NO_CONTENT" }, { OBEX_RSP_RESET_CONTENT, "RESET_CONTENT" }, { OBEX_RSP_PARTIAL_CONTENT, "PARTIAL_CONTENT" }, { OBEX_RSP_MULTIPLE_CHOICES, "MULTIPLE_CHOICES" }, { OBEX_RSP_MOVED_PERMANENTLY, "MOVED_PERMANENTLY" }, { OBEX_RSP_MOVED_TEMPORARILY, "MOVED_TEMPORARILY" }, { OBEX_RSP_SEE_OTHER, "SEE_OTHER" }, { OBEX_RSP_NOT_MODIFIED, "NOT_MODIFIED" }, { OBEX_RSP_USE_PROXY, "USE_PROXY" }, { OBEX_RSP_BAD_REQUEST, "BAD_REQUEST" }, { OBEX_RSP_UNAUTHORIZED, "UNAUTHORIZED" }, { OBEX_RSP_PAYMENT_REQUIRED, "PAYMENT_REQUIRED" }, { OBEX_RSP_FORBIDDEN, "FORBIDDEN" }, { OBEX_RSP_NOT_FOUND, "NOT_FOUND" }, { OBEX_RSP_METHOD_NOT_ALLOWED, "METHOD_NOT_ALLOWED" }, { OBEX_RSP_NOT_ACCEPTABLE, "NOT_ACCEPTABLE" }, { OBEX_RSP_PROXY_AUTH_REQUIRED, "PROXY_AUTH_REQUIRED" }, { OBEX_RSP_REQUEST_TIME_OUT, "REQUEST_TIME_OUT" }, { OBEX_RSP_CONFLICT, "CONFLICT" }, { OBEX_RSP_GONE, "GONE" }, { OBEX_RSP_LENGTH_REQUIRED, "LENGTH_REQUIRED" }, { OBEX_RSP_PRECONDITION_FAILED, "PRECONDITION_FAILED" }, { OBEX_RSP_REQ_ENTITY_TOO_LARGE, "REQ_ENTITY_TOO_LARGE" }, { OBEX_RSP_REQ_URL_TOO_LARGE, "REQ_URL_TOO_LARGE" }, { OBEX_RSP_UNSUPPORTED_MEDIA_TYPE, "UNSUPPORTED_MEDIA_TYPE"}, { OBEX_RSP_INTERNAL_SERVER_ERROR, "INTERNAL_SERVER_ERROR" }, { OBEX_RSP_NOT_IMPLEMENTED, "NOT_IMPLEMENTED" }, { OBEX_RSP_BAD_GATEWAY, "BAD_GATEWAY" }, { OBEX_RSP_SERVICE_UNAVAILABLE, "SERVICE_UNAVAILABLE" }, { OBEX_RSP_GATEWAY_TIMEOUT, "GATEWAY_TIMEOUT" }, { OBEX_RSP_VERSION_NOT_SUPPORTED, "VERSION_NOT_SUPPORTED" }, { OBEX_RSP_DATABASE_FULL, "DATABASE_FULL" }, { OBEX_RSP_DATABASE_LOCKED, "DATABASE_LOCKED" }, { 0xFF, "" }, }; void ods_log_obex (const char *prefix, int evt, int cmd, int rsp) { const char *evtstr = NULL, *cmdstr = NULL, *rspstr = NULL; int i; if (!debug_enabled) return; for (i = 0; obex_event[i].evt != 0xFF; i++) { if (obex_event[i].evt != evt) continue; evtstr = obex_event[i].name; } for (i = 0; obex_command[i].cmd != 0xFF; i++) { if (obex_command[i].cmd != cmd) continue; cmdstr = obex_command[i].name; } for (i = 0; obex_response[i].rsp != 0xFF; i++) { if (obex_response[i].rsp != rsp) continue; rspstr = obex_response[i].name; } if (prefix) { g_debug ("%s OBEX event: %s(0x%x), %s(0x%x), %s(0x%x)", prefix, evtstr, evt, cmdstr, cmd, rspstr, rsp); } else { g_debug ("OBEX event: %s(0x%x), %s(0x%x), %s(0x%x)", evtstr, evt, cmdstr, cmd, rspstr, rsp); } } obex-data-server-0.4.6/src/ods-folder-listing.c0000644000175000017500000001113511524724173016261 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include "ods-common.h" #define FL_XML_VERSION "" EOL_CHARS #define FL_XML_TYPE "" EOL_CHARS #define FL_XML_BODY_BEGIN "" EOL_CHARS #define FL_XML_BODY_END "" EOL_CHARS #define FL_XML_PARENT_FOLDER_ELEMENT "" EOL_CHARS #define FL_XML_FILE_ELEMENT "" EOL_CHARS #define FL_XML_FOLDER_ELEMENT "" EOL_CHARS inline static gchar * get_permission_string (mode_t file, mode_t folder, gboolean allow_write) { return g_strdup_printf ( "user-perm=\"%s%s%s\" group-perm=\"%s%s%s\" other-perm=\"%s%s%s\"", (file & S_IRUSR ? "R" : ""), (file & S_IWUSR && allow_write ? "W" : ""), (folder & S_IWUSR ? "D" : ""), (file & S_IRGRP ? "R" : ""), (file & S_IWGRP && allow_write ? "W" : ""), (folder & S_IWGRP ? "D" : ""), (file & S_IROTH ? "R" : ""), (file & S_IWOTH && allow_write ? "W" : ""), (folder & S_IWOTH ? "D" : "")); } gchar* get_folder_listing (const gchar *path, const gchar *root_path, gboolean allow_write) { GString *listing; struct dirent *dirp; DIR *dp; struct stat dirstat; struct stat filestat; gchar *filename = NULL; gchar *filename_utf8; GError *error = NULL; gboolean is_dir; gchar *perm_str = NULL; gchar atime_str[17]; gchar mtime_str[17]; gchar ctime_str[17]; listing = g_string_new (""); listing = g_string_append (listing, FL_XML_VERSION); listing = g_string_append (listing, FL_XML_TYPE); listing = g_string_append (listing, FL_XML_BODY_BEGIN); /* Add parent folder element if path!=root_path */ if (strcmp (path, root_path)) listing = g_string_append (listing, FL_XML_PARENT_FOLDER_ELEMENT); /* Go through directory, add file and folder elements */ stat (path, &dirstat); dp = opendir (path); while (dp != NULL && (dirp = readdir (dp))) { if (dirp->d_name[0] == '.') continue; filename = g_build_filename (path, dirp->d_name, NULL); filename_utf8 = g_filename_to_utf8 (dirp->d_name, -1, NULL, NULL, &error); if (filename_utf8 == NULL) { g_message ("get_folder_listing error: %s", error->message); g_clear_error (&error); /* continue anyway */ g_free (filename); continue; } /* stat file */ lstat (filename, &filestat); is_dir = S_ISDIR (filestat.st_mode); /* get permission string */ perm_str = get_permission_string (filestat.st_mode, dirstat.st_mode, allow_write); /* get time strings */ ods_make_iso8601 (filestat.st_atime, atime_str, sizeof (atime_str)); ods_make_iso8601 (filestat.st_mtime, mtime_str, sizeof (mtime_str)); ods_make_iso8601 (filestat.st_ctime, ctime_str, sizeof (ctime_str)); if (is_dir) { g_string_append_printf (listing, FL_XML_FOLDER_ELEMENT, filename_utf8, perm_str, atime_str, mtime_str, ctime_str); } else { g_string_append_printf (listing, FL_XML_FILE_ELEMENT, filename_utf8, (guint64) filestat.st_size, perm_str, atime_str, mtime_str, ctime_str); } /* free mem */ g_free (filename); g_free (filename_utf8); g_free (perm_str); } closedir (dp); listing = g_string_append (listing, FL_XML_BODY_END); return g_string_free (listing, FALSE); } obex-data-server-0.4.6/src/ods-manager.xml0000644000175000017500000000735711524724173015342 00000000000000 obex-data-server-0.4.6/src/ods-obex.c0000644000175000017500000016102311524726202014271 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * Parts of code taken from osso-gwobex library by: * Johan Hedberg * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ods-capabilities.h" #include "ods-common.h" #include "ods-folder-listing.h" #include "ods-imaging-helpers.h" #include "ods-obex.h" #include "ods-session.h" #include "ods-error.h" #define ATTACHMENT_FILENAME "attachment" static void get_target_size_and_time (obex_t *handle, obex_object_t *object, guint64 *size, time_t *time) { obex_headerdata_t hv; uint8_t hi; unsigned int hlen; *size = 0; *time = -1; while (OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)) { switch (hi) { case OBEX_HDR_LENGTH: *size = hv.bq4; break; case OBEX_HDR_TIME: *time = ods_parse_iso8601 ((char *)hv.bs, hlen); break; default: break; } } OBEX_ObjectReParseHeaders (handle, object); } /** * ods_process_usb_input: * @data: obex_t handle * * Idle callback that reads data from a USB interface * * Return value: whether there is more data to read **/ static gboolean ods_process_usb_input (gpointer data) { OdsObexContext *ctxt = (OdsObexContext *) data; int i = OBEX_HandleInput (ctxt->obex_handle, 1); if (i <= 0) { /* Link error: for example USB cable was disconnected */ (ctxt->io_callback) (NULL, G_IO_ERR, ctxt->obex_handle); return FALSE; } return ctxt->usb_read_more; } static gboolean ods_obex_timeout (gpointer data) { OdsObexContext *ctxt = (OdsObexContext *) data; obex_object_t *object; g_message ("Request timeout (%ds), session considered dead", ODS_OBEX_TIMEOUT); ctxt->timeout_id = 0; /* issue dummy obex_event with OBEX_RSP_REQUEST_TIME_OUT */ if (ctxt->obex_event) { object = OBEX_ObjectNew(ctxt->obex_handle, ctxt->obex_cmd); (ctxt->obex_event) (ctxt->obex_handle, object, 0, OBEX_EV_REQDONE, ctxt->obex_cmd, OBEX_RSP_REQUEST_TIME_OUT); OBEX_ObjectDelete (ctxt->obex_handle, object); } /* issue dummy io_callback with G_IO_ERR condition * (so that session gets disconnected) * also check that io_callback is not null (in some cases obex_context * might have been already closed (ods_obex_close_transport() was called), * e.g. when CMD_CONNECT times out) */ if (ctxt->io_callback) { (ctxt->io_callback) (NULL, G_IO_ERR, ctxt->obex_handle); } /* immediately remove io watch, we consider this connection dead */ ods_safe_gsource_remove (&(ctxt->io_watch)); return FALSE; } static gint ods_obex_send (OdsObexContext *ctxt, obex_object_t *object) { int err; OdsSession* session; gint usbintfnum; ctxt->obex_cmd = OBEX_ObjectGetCommand (ctxt->obex_handle, object); err = OBEX_Request (ctxt->obex_handle, object); if (err == -EBUSY) { g_warning ("EBUSY in ods_session_obex_send"); } if (err >=0 ) { session = ODS_SESSION (OBEX_GetUserData (ctxt->obex_handle)); g_object_get (session, "usbintfnum", &usbintfnum, NULL); if (usbintfnum >= 0) { /* It is not possible to use io_watch with USB, * so data is read in a custom idle callback function */ g_idle_add ((GSourceFunc)ods_process_usb_input, ctxt); } ctxt->timeout_id = g_timeout_add_seconds (ODS_OBEX_TIMEOUT, ods_obex_timeout, ctxt); } return err; } static gboolean ods_obex_io (GIOChannel *io_channel, GIOCondition cond, gpointer data) { OdsObexContext *ctxt = (OdsObexContext *) data; /* got data or error so cancel request timeout (if set) */ ods_safe_gsource_remove (&(ctxt->timeout_id)); /* call real io_callback */ return (ctxt->io_callback) (io_channel, cond, ctxt->obex_handle); } static gchar * ods_obex_get_new_path (const gchar *folder, const gchar *filename) { gchar *path; gchar *new_path; guint iterator = 2; gchar *first_part; gchar *extension; gchar *parentess; guint pos; /* In case we don't know what the filename is (HDR_NAME wasn't received) */ if (filename == NULL || *filename == '\0') filename = "Unknown"; path = g_build_filename (folder, filename, NULL); new_path = g_strdup (path); extension = g_strrstr (path, "."); if (!extension) extension = ""; while (g_file_test (new_path, G_FILE_TEST_EXISTS)) { if (iterator == 2) { parentess = g_strrstr (new_path, "("); if (parentess != NULL && !g_str_has_prefix (parentess, "(2)")) parentess = NULL; pos = parentess ? strlen (parentess) : strlen (extension); pos = strlen (new_path) - pos; } else { parentess = g_strrstr (new_path, "("); pos = strlen (new_path) - strlen (parentess); } first_part = g_strndup (new_path, pos); g_free (new_path); new_path = g_strdup_printf ("%s(%d)%s", first_part, iterator, extension); g_free (first_part); iterator++; } g_free (path); return new_path; } void ods_obex_transfer_new (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type) { obex_context->local = g_strdup (local); obex_context->remote = g_strdup (remote); obex_context->type = g_strdup (type); obex_context->target_size = 0; obex_context->modtime = -1; obex_context->report_progress = TRUE; /* by default */ obex_context->transfer_started_signal_emitted = FALSE; obex_context->cancelled = FALSE; obex_context->suspend_result = 0; obex_context->buf_size = 0; obex_context->buf = NULL; obex_context->stream_fd = -1; obex_context->counter = 0; } static gboolean ods_obex_susp_timeout (gpointer data) { OdsObexContext *ctxt = (OdsObexContext *) data; g_message ("Suspend timeout (%ds), rejecting incoming file", ODS_OBEX_TIMEOUT); ctxt->suspend_timeout_id = 0; ctxt->suspend_result = OBEX_SUSP_REJECTED; return FALSE; } void ods_obex_transfer_suspend (OdsObexContext *ctxt) { g_message ("Suspending request"); ctxt->suspend_timeout_id = g_timeout_add_seconds (ODS_OBEX_TIMEOUT, ods_obex_susp_timeout, ctxt); while (!ctxt->suspend_result) g_main_context_iteration (NULL, TRUE); ods_safe_gsource_remove (&(ctxt->suspend_timeout_id)); g_message ("Suspend result: %d", ctxt->suspend_result); } void ods_obex_transfer_close (OdsObexContext *obex_context) { if (obex_context->local) { g_free (obex_context->local); obex_context->local = NULL; } if (obex_context->remote) { g_free (obex_context->remote); obex_context->remote = NULL; } if (obex_context->type) { g_free (obex_context->type); obex_context->type = NULL; } if (obex_context->img_handle) { g_free (obex_context->img_handle); obex_context->img_handle = NULL; } if (obex_context->ext_info) { g_hash_table_unref (obex_context->ext_info); obex_context->ext_info = NULL; } if (obex_context->buf) { g_free (obex_context->buf); obex_context->buf = NULL; } if (obex_context->fifo_watch > 0) { g_source_remove (obex_context->fifo_watch); obex_context->fifo_watch = 0; } if (obex_context->stream_fd >= 0) close (obex_context->stream_fd); } void ods_obex_transfer_add_info (OdsObexContext *obex_context, gchar *key, gchar *value) { if (!key || !value) return; if (!obex_context->ext_info) { obex_context->ext_info = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); } g_hash_table_insert (obex_context->ext_info, key, value); } GHashTable* ods_obex_transfer_get_info (OdsObexContext *obex_context) { GHashTable *info; gchar *time_str; GHashTableIter iter; gpointer key, value; info = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_free); g_hash_table_insert (info, "LocalPath", g_strdup (obex_context->local)); g_hash_table_insert (info, "RemoteFilename", g_strdup (obex_context->remote)); g_hash_table_insert (info, "Size", g_strdup_printf ("%" G_GUINT64_FORMAT, obex_context->target_size)); if (obex_context->type) g_hash_table_insert (info, "Type", g_strdup (obex_context->type)); if (obex_context->modtime != -1) { time_str = (gchar *)g_malloc (17); ods_make_iso8601 (obex_context->modtime, time_str, sizeof (time_str)); g_hash_table_insert (info, "Time", time_str); } if (obex_context->obex_cmd == OBEX_CMD_GET) g_hash_table_insert (info, "OBEXCommand", g_strdup ("GET")); else if (obex_context->obex_cmd == OBEX_CMD_PUT) g_hash_table_insert (info, "OBEXCommand", g_strdup ("PUT")); if (obex_context->img_handle) g_hash_table_insert (info, "ImageHandle", g_strdup (obex_context->img_handle)); /* Add additional transfer info (if any) */ if (obex_context->ext_info) { g_hash_table_iter_init (&iter, obex_context->ext_info); while (g_hash_table_iter_next (&iter, &key, &value)) g_hash_table_insert (info, key, g_strdup (value)); } return info; } OdsObexContext* ods_obex_context_new (void) { OdsObexContext *obex_context = g_new0 (OdsObexContext, 1); obex_context->rx_max = ODS_DEFAULT_RX_MTU; obex_context->tx_max = ODS_DEFAULT_TX_MTU - 200; obex_context->connection_id = CONID_INVALID; obex_context->stream_fd = -1; return obex_context; } gboolean ods_obex_setup_fdtransport (OdsObexContext *obex_context, gint fd, guint16 rx_mtu, guint16 tx_mtu, obex_event_t eventcb, GIOFunc io_cb, gpointer user_data, GError **error) { GIOChannel *chan; gint ret; /* call OBEX_Init, setup FD Transport here */ obex_context->obex_event = eventcb; obex_context->io_callback = io_cb; obex_context->obex_handle = OBEX_Init (OBEX_TRANS_FD, eventcb, 0); if (obex_context->obex_handle == NULL) { g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Out of memory"); return FALSE; } OBEX_SetUserData (obex_context->obex_handle, user_data); OBEX_SetTransportMTU (obex_context->obex_handle, rx_mtu, tx_mtu); g_message ("Used MTUs: RX=%u, TX=%u", rx_mtu, tx_mtu); ret = FdOBEX_TransportSetup (obex_context->obex_handle, fd, fd, 0); if (ret < 0) { OBEX_Cleanup (obex_context->obex_handle); g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Transport setup failed"); return FALSE; } chan = g_io_channel_unix_new (fd); obex_context->io_watch = g_io_add_watch(chan, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL, ods_obex_io, obex_context); g_io_channel_unref(chan); return obex_context->io_watch ? TRUE : FALSE; } gboolean ods_obex_setup_usbtransport (OdsObexContext *obex_context, gint intf_num, obex_event_t eventcb, GIOFunc io_cb, gpointer user_data, GError **error) { gint ret; obex_interface_t *obex_intf; int interfaces_num; /* call OBEX_Init, setup USB Transport here */ obex_context->obex_event = eventcb; obex_context->io_callback = io_cb; obex_context->obex_handle = OBEX_Init (OBEX_TRANS_USB, eventcb, 0); if (obex_context->obex_handle == NULL) { g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Out of memory"); goto err; } interfaces_num = OBEX_FindInterfaces(obex_context->obex_handle, &obex_intf); if (intf_num >= interfaces_num) { g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Invalid interface number"); goto err; } OBEX_SetUserData (obex_context->obex_handle, user_data); ret = OBEX_InterfaceConnect(obex_context->obex_handle, &obex_intf[intf_num]); if (ret < 0) { g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "USB setup failed"); goto err; } return TRUE; err: if (obex_context->obex_handle) OBEX_Cleanup (obex_context->obex_handle); return FALSE; } void ods_obex_close_transport (OdsObexContext *ctxt) { ods_safe_gsource_remove (&(ctxt->timeout_id)); ods_safe_gsource_remove (&(ctxt->io_watch)); ctxt->obex_event = NULL; ctxt->io_callback = NULL; } gchar * ods_obex_get_buffer_as_string (OdsObexContext *obex_context) { /* put /0 in the end */ obex_context->buf = g_realloc (obex_context->buf, obex_context->buf_size+1); obex_context->buf[obex_context->buf_size] = 0; return (gchar *)obex_context->buf; } gboolean ods_obex_srv_new_file (OdsObexContext *obex_context, const gchar *path) { /* Get local path */ obex_context->local = ods_obex_get_new_path (path, obex_context->remote); /* open local file for writing */ obex_context->stream_fd = open (obex_context->local, O_WRONLY | O_CREAT, 0666); return obex_context->stream_fd >= 0; } gint ods_obex_connect_done (OdsObexContext *obex_context, obex_object_t *object) { obex_headerdata_t hv; uint8_t hi; unsigned int hlen; uint8_t *ptr; if (OBEX_ObjectGetNonHdrData (object, &ptr) != sizeof (obex_connect_hdr_t)) { return -1; } else { obex_connect_hdr_t *nonhdrdata = (obex_connect_hdr_t *) ptr; uint16_t mtu = g_ntohs( nonhdrdata->mtu); int new_size; g_message ("Version: 0x%02x. Flags: 0x%02x OBEX packet length: %d", nonhdrdata->version, nonhdrdata->flags, mtu); /* Leave space for headers */ new_size = mtu - 200; if (new_size < obex_context->tx_max) { g_message ("Resizing stream chunks to %d", new_size); obex_context->tx_max = new_size; } } /* parse headers */ while (OBEX_ObjectGetNextHeader(obex_context->obex_handle, object, &hi, &hv, &hlen)) { switch (hi) { case OBEX_HDR_CONNECTION: obex_context->connection_id = hv.bq4; break; default: break; } } return 0; } gint ods_obex_connect (OdsObexContext *obex_context, const guchar *uuid, guint uuid_length) { obex_object_t *object; obex_headerdata_t hd; int ret; object = OBEX_ObjectNew(obex_context->obex_handle, OBEX_CMD_CONNECT); if (!object) { return -ENOMEM; } /* Add target header */ if (uuid) { hd.bs = uuid; ret = OBEX_ObjectAddHeader(obex_context->obex_handle, object, OBEX_HDR_TARGET, hd, uuid_length, OBEX_FL_FIT_ONE_PACKET); if (ret < 0) { OBEX_ObjectDelete(obex_context->obex_handle, object); return ret; } } ret = ods_obex_send(obex_context, object); if (ret < 0) OBEX_ObjectDelete(obex_context->obex_handle, object); return ret; } gint ods_obex_srv_connect (OdsObexContext *obex_context, obex_object_t *object, guint service) { obex_headerdata_t hv; uint8_t hi; guint hlen; uint8_t *ptr; const guchar *target = NULL; guint target_len = 0; obex_headerdata_t hd; gint ret; if (OBEX_ObjectGetNonHdrData (object, &ptr) != sizeof (obex_connect_hdr_t)) { return -1; } else { obex_connect_hdr_t *nonhdrdata = (obex_connect_hdr_t *) ptr; uint16_t mtu = g_ntohs (nonhdrdata->mtu); int new_size; g_message ("Version: 0x%02x. Flags: 0x%02x OBEX packet length: %d", nonhdrdata->version, nonhdrdata->flags, mtu); /* Leave space for headers */ new_size = mtu - 200; if (new_size < obex_context->tx_max) { g_message ("Resizing stream chunks to %d", new_size); obex_context->tx_max = new_size; } } /* parse headers */ while (OBEX_ObjectGetNextHeader(obex_context->obex_handle, object, &hi, &hv, &hlen)) { if (hi == OBEX_HDR_TARGET) { target = hv.bs; target_len = hlen; } } OBEX_ObjectReParseHeaders (obex_context->obex_handle, object); switch (service) { case ODS_SERVICE_FTP: /* Target header must be F9EC7BC4-953C-11D2-984E-525400DC9E09*/ if (!target || memcmp(OBEX_FTP_UUID, target, hlen) != 0) { g_message("Target header Incorrect"); goto fail; } break; case ODS_SERVICE_PBAP: /* Target header must be 796135f0-f0c5-11d8-0966-0800200c9a66 */ if (!target || memcmp(OBEX_PBAP_UUID, target, hlen) != 0) { g_message("Target header Incorrect"); goto fail; } break; case ODS_SERVICE_BIP: if (!target) { g_message("No Target header received for BIP connection"); goto fail; } if (!memcmp (OBEX_BIP_IPUSH_UUID, target, hlen)) break; if (!memcmp (OBEX_BIP_RD_UUID, target, hlen)) break; g_message ("Unsupported Imaging feature requested"); goto fail; case ODS_SERVICE_OPP: /* Target header must not be used */ if (target) { g_message("Target header must not be used"); goto fail; } OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); return 0; default: goto fail; } hd.bs = target; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_WHO, hd, target_len, OBEX_FL_FIT_ONE_PACKET); if (ret < 0) { OBEX_ObjectDelete (obex_context->obex_handle, object); return ret; } hd.bs = NULL; hd.bq4 = 1; /* Connection ID is always 1 */ obex_context->connection_id = 1; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_CONNECTION, hd, 4, OBEX_FL_FIT_ONE_PACKET); if (ret < 0) { OBEX_ObjectDelete (obex_context->obex_handle, object); return ret; } OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); return 0; fail: OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); return 0; } gint ods_obex_disconnect (OdsObexContext *obex_context) { obex_object_t *object; gint ret; g_message ("Sending CMD_DISCONNECT"); object = OBEX_ObjectNew(obex_context->obex_handle, OBEX_CMD_DISCONNECT); if (!object) { return -ENOMEM; } /* Add connection header */ if (obex_context->connection_id != CONID_INVALID) { obex_headerdata_t hv; hv.bq4 = obex_context->connection_id; ret = OBEX_ObjectAddHeader(obex_context->obex_handle, object, OBEX_HDR_CONNECTION, hv, 4, 0); if (ret < 0) { OBEX_ObjectDelete(obex_context->obex_handle, object); return ret; } } ret = ods_obex_send (obex_context, object); if (ret < 0) OBEX_ObjectDelete(obex_context->obex_handle, object); return ret; } static gboolean fifo_watch (GIOChannel *io_channel, GIOCondition cond, gpointer data) { OdsObexContext *obex_context = (OdsObexContext*) data; if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { obex_context->suspend_result = OBEX_SUSP_FIFO_ERR; return FALSE; } obex_context->suspend_result = OBEX_SUSP_FIFO_ACT; return TRUE; } gint ods_obex_readstream (OdsObexContext *obex_context, obex_object_t *object) { const uint8_t *buf; gint actual; gint written = 0; gint write_ret; gint ret = 0; if (obex_context->target_size == 0 && obex_context->counter == 0) { /* first data came in, get size and time */ get_target_size_and_time (obex_context->obex_handle, object, &obex_context->target_size, &obex_context->modtime); } if (obex_context->cancelled) { /* It's not possible to cancel incoming request by sending CMD_ABORT * hence we set RSP_FORBIDDEN response */ OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); ret = 2; goto out; } actual = OBEX_ObjectReadStream (obex_context->obex_handle, object, &buf); if (actual > 0) { g_message ("There is some data"); obex_context->counter += actual; if (obex_context->stream_fd >= 0) { /* write data to file */ while (written < actual) { write_ret = write (obex_context->stream_fd, buf + written, actual - written); written += write_ret; if (write_ret < 0) { if (errno == EINTR) continue; else if (errno == EAGAIN) { /* FIFO is full, wait for it to be read */ ods_obex_transfer_suspend (obex_context); if (obex_context->suspend_result == OBEX_SUSP_FIFO_ACT) { obex_context->suspend_result = 0; /* FIFO was read, we can continue writing */ continue; } else { obex_context->suspend_result = 0; /* FIFO error, cancel transfer */ OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); ret = 2; goto out; } } else { ret = -errno; goto out; } } } } else { g_message ("Writing to buf"); /* write data to internal buffer */ obex_context->buf = g_realloc (obex_context->buf, obex_context->counter); memcpy (&obex_context->buf[obex_context->buf_size], buf, actual); obex_context->buf_size = obex_context->counter; } } else { /* No data on OBEX stream */ ret = 1; } out: if (ret < 0) { /* close this transfer */ ods_obex_transfer_close (obex_context); } return ret; } gint ods_obex_writestream (OdsObexContext *obex_context, obex_object_t *object) { g_message ("obex_writestream"); obex_headerdata_t hv; gint actual = -1; gint read_bytes = 0; gint ret = 0; if (obex_context->stream_fd >= 0) { g_message ("writestream from File: %d", obex_context->stream_fd); hv.bs = obex_context->buf; while (read_bytes < obex_context->tx_max) { actual = read (obex_context->stream_fd, obex_context->buf+read_bytes, obex_context->tx_max-read_bytes); read_bytes += actual; if (actual > 0) { obex_context->counter += actual; if (read_bytes < obex_context->tx_max) { if (obex_context->fifo_watch > 0) { g_message ("FIFO (read less than needed), waiting for data"); fifo_suspend: ods_obex_transfer_suspend (obex_context); if (obex_context->suspend_result == OBEX_SUSP_FIFO_ACT) { obex_context->suspend_result = 0; /* FIFO has more data, we can read */ g_message ("FIFO (continue reading)"); continue; } else { obex_context->suspend_result = 0; /* FIFO error, cancel transfer */ g_message ("FIFO (reading failed)"); OBEX_CancelRequest (obex_context->obex_handle, TRUE); ret = 2; goto out; } } else break; } } else if (actual == 0 && read_bytes == 0) { g_message ("read 0 bytes (EOF)"); /* EOF */ OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_BODY, hv, 0, OBEX_FL_STREAM_DATAEND); /* transfer done */ ret = 1; goto out; } else { if (obex_context->fifo_watch > 0 && errno == EAGAIN) goto fifo_suspend; else { g_message ("read error %s", strerror (errno)); /* error reading file */ ret = -errno; goto out; } } } if (read_bytes > 0) { OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_BODY, hv, read_bytes, OBEX_FL_STREAM_DATA); /* Everything OK, continue sending data */ ret = 0; } } else if (obex_context->buf_size > 0) { g_message ("writestream from Buffer"); /* used only in server mode to send folder listings and such */ actual = obex_context->buf_size - obex_context->counter; if (actual > obex_context->tx_max) actual = obex_context->tx_max; g_message ("buf_size: %" G_GUINT64_FORMAT ", actual: %d", obex_context->buf_size, actual); hv.bs = &obex_context->buf[obex_context->counter]; if (actual > 0) { OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_BODY, hv, actual, OBEX_FL_STREAM_DATA); obex_context->counter += actual; /* Everything OK, continue sending data */ ret = 0; } else if (actual == 0) { /* EOF */ OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_BODY, hv, 0, OBEX_FL_STREAM_DATAEND); /* transfer done */ ret = 1; } } else { /* shouldn't happen */ g_warning ("Invalid fd while transfer in progress"); ret = -1; } out: if (ret < 0) { /* close this transfer */ ods_obex_transfer_close (obex_context); } return ret; } gint ods_obex_get (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type, gboolean is_fifo) { gint ret; obex_headerdata_t hv; obex_object_t *object; gchar *uname; gsize uname_len = 0; g_assert (remote || type); ods_obex_transfer_new (obex_context, local, remote, type); object = OBEX_ObjectNew (obex_context->obex_handle, OBEX_CMD_GET); if (!object) { ret = -ENOMEM; goto out; } /* Add connection header */ if (obex_context->connection_id != CONID_INVALID) { hv.bq4 = obex_context->connection_id; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_CONNECTION, hv, 4, 0); if (ret < 0) goto out; } /* Add type header */ if (type) { hv.bs = (guchar *)type; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_TYPE, hv, strlen (type) + 1, 0); if (ret < 0) goto out; } /* Add name header */ if (remote) { uname_len = ods_filename_to_utf16 (&uname, remote); if (uname == NULL) { ret = -EINVAL; goto out; } /* OpenOBEX is buggy and won't append the header unless hv.bs != NULL */ hv.bs = (guchar *) uname; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_NAME, hv, uname_len, 0); if (ret < 0) goto out; } /* Add local name header */ if (local) { int oflags; if (is_fifo) oflags = O_WRONLY | O_NONBLOCK; else oflags = O_WRONLY | O_CREAT; obex_context->stream_fd = open (local, oflags, 0666); if (obex_context->stream_fd < 0) { ret = -errno; goto out; } if (is_fifo) { GIOChannel *chan; /* Setup IO watch to know when it is possible to write to FIFO or error happens */ chan = g_io_channel_unix_new (obex_context->stream_fd); obex_context->fifo_watch = g_io_add_watch (chan, G_IO_OUT | G_IO_ERR | G_IO_HUP | G_IO_NVAL, fifo_watch, obex_context); g_io_channel_unref (chan); } } else { /* don't report progress when receiving to internal buffer only */ obex_context->report_progress = FALSE; } /* Initiate transfer */ OBEX_ObjectReadStream (obex_context->obex_handle, object, NULL); ret = ods_obex_send (obex_context, object); out: if (uname_len > 0) g_free (uname); if (ret < 0 && object) OBEX_ObjectDelete (obex_context->obex_handle, object); if (ret < 0 && obex_context->stream_fd >= 0) g_unlink (obex_context->local); /* delete incomplete file */ if (ret < 0) ods_obex_transfer_close (obex_context); return ret; } gint ods_obex_srv_get (OdsObexContext *obex_context, obex_object_t *object, const gchar *current_path, const gchar *root_path, gboolean allow_write) { obex_headerdata_t hv; uint8_t hi; guint hlen; gint object_size = 0; time_t object_time = -1; gint ret; g_message ("stream_fd=%d", obex_context->stream_fd); while (OBEX_ObjectGetNextHeader (obex_context->obex_handle, object, &hi, &hv, &hlen)) { switch (hi) { case OBEX_HDR_NAME: if (hlen == 0) { /* This is GET by Type, leave remote = NULL */ break; } obex_context->remote = ods_filename_from_utf16 ((gchar *) hv.bs, hlen); break; case OBEX_HDR_TYPE: if (hv.bs[hlen - 1] != '\0' || !g_utf8_validate ((const gchar *) hv.bs, -1, NULL)) { /* invalid type header */ g_message ("HDR_TYPE invalid: %s", (gchar*) hv.bs); } else { obex_context->type = g_strdup ((const gchar *) hv.bs); g_message ("HDR_TYPE: %s", obex_context->type); } break; case OBEX_HDR_CONNECTION: if (obex_context->connection_id != CONID_INVALID && hv.bq4 != obex_context->connection_id) { /* wrong connection id */ ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_BAD_REQUEST, OBEX_RSP_BAD_REQUEST); goto out; } break; default: break; } } if (obex_context->remote && ((obex_context->type==NULL) || strcmp (obex_context->type, LST_TYPE))) { /* If we have name header but type is NOT x-obex/folder-listing */ obex_context->local = g_build_filename (current_path, obex_context->remote, NULL); g_message ("local filename: %s", obex_context->local); /* Check if such file exists */ if (!g_file_test (obex_context->local, G_FILE_TEST_EXISTS)) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); goto out; } if (!g_file_test (obex_context->local, G_FILE_TEST_IS_REGULAR)) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); goto out; } if (g_access (obex_context->local, R_OK) < 0) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_UNAUTHORIZED, OBEX_RSP_UNAUTHORIZED); goto out; } } if (obex_context->remote) g_message ("name: %s", obex_context->remote); if (obex_context->type) g_message ("type: %s", obex_context->type); OBEX_ObjectReParseHeaders (obex_context->obex_handle, object); if (obex_context->local) { g_message ("Serving local file"); /* open local file for reading */ obex_context->stream_fd = open (obex_context->local, O_RDONLY); if (obex_context->stream_fd < 0) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_INTERNAL_SERVER_ERROR, OBEX_RSP_INTERNAL_SERVER_ERROR); goto out; } /* allocate buffer */ obex_context->buf = g_malloc (obex_context->tx_max); obex_context->buf_size = obex_context->tx_max; /* Try to figure out modification time and size */ struct stat stats; if (fstat (obex_context->stream_fd, &stats) == 0) { object_size = stats.st_size; object_time = stats.st_mtime; obex_context->modtime = object_time; } /* Add a time header */ if (object_time >= 0) { gchar tstr[17]; gint len; len = ods_make_iso8601 (object_time, tstr, sizeof (tstr)); if (len >= 0) { hv.bs = (guchar *)tstr; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_TIME, hv, len, 0); if (ret < 0) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_INTERNAL_SERVER_ERROR, OBEX_RSP_INTERNAL_SERVER_ERROR); goto out; } } } /* Add a length header */ if (object_size > 0) { obex_context->target_size = object_size; hv.bq4 = (uint32_t)object_size; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_LENGTH, hv, 4, 0); if (ret < 0) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_INTERNAL_SERVER_ERROR, OBEX_RSP_INTERNAL_SERVER_ERROR); goto out; } } else { obex_context->target_size = 0; } } else if (obex_context->type) { /* Don't report progress for object GET by type */ obex_context->report_progress = FALSE; if (!strcmp (obex_context->type, LST_TYPE)) { gchar *new_path = NULL; g_message ("Serving FOLDER LISTING object"); if (obex_context->remote) { /* We need to use some subfolder if we have NAME header */ new_path = g_build_filename (current_path, obex_context->remote, NULL); if (!g_file_test (new_path, G_FILE_TEST_IS_DIR)) { g_free (new_path); ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); goto out; } } /* write folder listing to buffer */ obex_context->buf = (guchar*) get_folder_listing ( new_path ? new_path : current_path, root_path, allow_write); g_free (new_path); } else if (!strcmp (obex_context->type, CAP_TYPE)) { g_message ("Serving CAPABILITY object"); obex_context->buf = (guchar*) ods_get_capability (root_path); } else if (!strcmp (obex_context->type, BIP_CAPABILITIES_TYPE)) { g_message ("Serving IMAGING CAPABILITIES object"); obex_context->buf = (guchar*) ods_get_imaging_capabilities (); } else { /* currently no other types are supported */ ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, OBEX_RSP_NOT_IMPLEMENTED); goto out; } if (!obex_context->buf) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); goto out; } g_message ("Object: %s", (gchar*) obex_context->buf); obex_context->buf_size = strlen ((gchar*) obex_context->buf); g_message ("Object length: %" G_GUINT64_FORMAT, obex_context->buf_size); } else { /* neither name nor type was specified */ ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_BAD_REQUEST, OBEX_RSP_BAD_REQUEST); goto out; } /* Add body header */ hv.bs = NULL; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_BODY, hv, 0, OBEX_FL_STREAM_START); out: if (ret < 0) ods_obex_transfer_close (obex_context); else OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); return ret; } static gint ods_obex_put_full (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type, const gchar *img_description, const gchar *img_handle, const guchar *apparam, guint apparam_len, guint64 size, time_t mtime, gboolean is_fifo, gint fifo_fd) { gint ret; obex_headerdata_t hv; obex_object_t *object = NULL; gchar *uname = NULL; gsize uname_len = 0; gchar *uhandle = NULL; gsize uhandle_len = 0; off_t object_size = 0; time_t object_time = -1; g_assert (remote || type); ods_obex_transfer_new (obex_context, local, remote, type); obex_context->img_handle = g_strdup (img_handle); /* get UTF16 name for remote file */ if (remote) { uname_len = ods_filename_to_utf16 (&uname, remote); if (uname == NULL) { ret = -EINVAL; goto out; } } /* get UTF16 version of img_handle */ if (img_handle) { uhandle_len = ods_filename_to_utf16 (&uhandle, img_handle); if (uhandle == NULL) { ret = -EINVAL; goto out; } } /* open local file, allocate buffer */ if (local) { int oflags = O_RDONLY; if (is_fifo) oflags |= O_NONBLOCK; if (is_fifo && fifo_fd > -1) obex_context->stream_fd = fifo_fd; else obex_context->stream_fd = open (local, oflags); if (obex_context->stream_fd < 0) { ret = -errno; goto out; } if (is_fifo) { GIOChannel *chan; /* Setup IO watch to know when it is possible to write to FIFO or error happens */ chan = g_io_channel_unix_new (obex_context->stream_fd); obex_context->fifo_watch = g_io_add_watch (chan, G_IO_IN | G_IO_ERR | G_IO_HUP | G_IO_NVAL, fifo_watch, obex_context); g_io_channel_unref (chan); } /* Allocate buffer */ obex_context->buf = g_malloc (obex_context->tx_max); obex_context->buf_size = obex_context->tx_max; } else { obex_context->report_progress = FALSE; } object = OBEX_ObjectNew (obex_context->obex_handle, OBEX_CMD_PUT); if (!object) { ret = -ENOMEM; goto out; } /* Add connection header */ if (obex_context->connection_id != CONID_INVALID) { hv.bq4 = obex_context->connection_id; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_CONNECTION, hv, 4, 0); if (ret < 0) goto out; } /* Add name header */ if (uname) { hv.bs = (guchar *) uname; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_NAME, hv, uname_len, 0); if (ret < 0) goto out; } /* Add type header */ if (type) { hv.bs = (guchar *)type; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_TYPE, hv, strlen(type) + 1, 0); if (ret < 0) goto out; } /* Try to figure out modification time and size */ if (obex_context->stream_fd >= 0 && !img_handle && !img_description) { /* we don't send TIME and LENGTH headers for BIP functions */ if (is_fifo) { /* if this is FIFO, we use supplied size and time instead of stat */ object_size = size; object_time = mtime; } else { struct stat stats; if (fstat (obex_context->stream_fd, &stats) == 0) { object_size = stats.st_size; object_time = stats.st_mtime; } } obex_context->modtime = object_time; } /* Add a time header */ if (object_time != -1) { gchar tstr[17]; gint len; len = ods_make_iso8601 (object_time, tstr, sizeof (tstr)); if (len >= 0) { hv.bs = (guchar *)tstr; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_TIME, hv, len, 0); if (ret < 0) goto out; } } /* Add a length header */ if (object_size > 0) { obex_context->target_size = object_size; hv.bq4 = (uint32_t)object_size; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_LENGTH, hv, 4, 0); if (ret < 0) goto out; } else { /* set target_size without sending length header (for BIP) */ obex_context->target_size = size; } /* Add Img-Description header */ if (img_description) { hv.bs = (guchar *)img_description; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_IMG_DESCRIPTOR, hv, strlen (img_description), 0); if (ret < 0) goto out; } /* Add Img-Handle header */ if (uhandle) { hv.bs = (guchar *)uhandle; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_IMG_HANDLE, hv, uhandle_len, 0); if (ret < 0) goto out; } /* Add Application-Parameters header */ if (apparam) { hv.bs = apparam; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_APPARAM, hv, apparam_len, 0); if (ret < 0) goto out; } /* Add body header */ if (obex_context->stream_fd >= 0) { hv.bs = NULL; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_BODY, hv, 0, OBEX_FL_STREAM_START); if (ret < 0) goto out; } ret = ods_obex_send (obex_context, object); out: if (uname_len > 0) g_free (uname); if (uhandle_len > 0) g_free (uhandle); if (ret < 0 && object) OBEX_ObjectDelete (obex_context->obex_handle, object); if (ret < 0) ods_obex_transfer_close (obex_context); return ret; } gint ods_obex_put (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type, guint64 size, time_t mtime, gboolean is_fifo, gint fifo_fd) { return ods_obex_put_full (obex_context, local, remote, type, NULL, NULL, NULL, 0, size, mtime, is_fifo, fifo_fd); } static void ods_obex_srv_put_image (OdsObexContext *obex_context, const gchar *img_descriptor) { gchar *encoding = NULL; gchar *pixel = NULL; guint64 size = 0; gchar *transformation = NULL; parse_image_descriptor (img_descriptor, &encoding, &pixel, &size, &transformation); obex_context->target_size = size; if (encoding) ods_obex_transfer_add_info (obex_context, "Encoding", encoding); if (pixel) ods_obex_transfer_add_info (obex_context, "Pixel", pixel); if (transformation) ods_obex_transfer_add_info (obex_context, "Transformation", transformation); } static void ods_obex_srv_put_linked_thumbnail (OdsObexContext *obex_context) { /* make remote filename the same as image handle */ obex_context->remote = g_strdup (obex_context->img_handle); } static void ods_obex_srv_put_linked_attachment (OdsObexContext *obex_context, const gchar *img_descriptor) { gchar *name = NULL; guint64 size = 0; gchar *content_type = NULL; gchar *charset = NULL; gchar *created = NULL; parse_attachment_descriptor (img_descriptor, &name, &size, &content_type, &charset, &created); if (!name) name = g_strdup (ATTACHMENT_FILENAME); obex_context->remote = name; obex_context->target_size = size; if (content_type) ods_obex_transfer_add_info (obex_context, "ContentType", content_type); if (charset) ods_obex_transfer_add_info (obex_context, "Charset", charset); if (created) ods_obex_transfer_add_info (obex_context, "Created", created); } static gboolean ods_obex_srv_remote_display (OdsObexContext *obex_context, guchar *apparam, guint apparam_len, guint8 *action) { bip_apparam_remote_display_t *apparam_hdr; g_assert (action); if (apparam_len != sizeof (bip_apparam_remote_display_t)) { /* Invalid application parameters header */ return FALSE; } apparam_hdr = (bip_apparam_remote_display_t*) apparam; if (apparam_hdr->tag_id != BIP_APPARAM_REMOTEDISPLAY_TAGID) { /* Invalid TagID */ return FALSE; } *action = apparam_hdr->value; return TRUE; } gint ods_obex_srv_put (OdsObexContext *obex_context, obex_object_t *object, const gchar *path, guint8 *action, gboolean no_response_on_success) { obex_headerdata_t hv; uint8_t hi; guint hlen; gint ret = 0; guint written = 0; gint write_ret; gboolean is_delete = TRUE; gchar *img_descriptor = NULL; guchar *apparam = NULL; guint apparam_len = 0; while (OBEX_ObjectGetNextHeader(obex_context->obex_handle, object, &hi, &hv, &hlen)) { g_message ("header: %d", hi); switch (hi) { case OBEX_HDR_BODY: is_delete = FALSE; g_message ("HDR_BODY length=%u", hlen); break; case OBEX_HDR_NAME: obex_context->remote = ods_filename_from_utf16 ((gchar *) hv.bs, hlen); g_message ("HDR_NAME: %s", obex_context->remote); break; case OBEX_HDR_TYPE: if (hv.bs[hlen - 1] != '\0' || !g_utf8_validate ((const gchar *) hv.bs, -1, NULL)) { /* invalid type header */ g_message ("HDR_TYPE invalid: %s", (gchar*) hv.bs); } else { obex_context->type = g_strdup ((const gchar *) hv.bs); is_delete = FALSE; g_message ("HDR_TYPE: %s", obex_context->type); } break; case OBEX_HDR_LENGTH: obex_context->target_size = hv.bq4; is_delete = FALSE; g_message ("HDR_LENGTH: %" G_GUINT64_FORMAT, obex_context->target_size); break; case OBEX_HDR_TIME: obex_context->modtime = ods_parse_iso8601 ((gchar*) hv.bs, hlen); g_message ("HDR_TIME"); break; case OBEX_HDR_DESCRIPTION: /* Not very useful info */ break; case OBEX_HDR_COUNT: /* This informs us how many objects client is going to send * during this session. We really don't care. */ break; case OBEX_HDR_CONNECTION: if (obex_context->connection_id != CONID_INVALID && hv.bq4 != obex_context->connection_id) { /* wrong connection id */ ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_BAD_REQUEST, OBEX_RSP_BAD_REQUEST); goto out; } break; case OBEX_HDR_IMG_DESCRIPTOR: /* BIP-specific Img-Description header */ img_descriptor = g_malloc0 (hlen+1);/* allocate one more byte for terminating \0 */ memcpy (img_descriptor, hv.bs, hlen); break; case OBEX_HDR_IMG_HANDLE: /* BIP-specific Img-Handle header */ obex_context->img_handle = ods_filename_from_utf16 ((gchar *) hv.bs, hlen); g_message ("HDR_IMG_HANDLE: %s", obex_context->img_handle); break; case OBEX_HDR_APPARAM: /* application parameters header */ apparam_len = hlen; apparam = g_malloc (apparam_len); memcpy (apparam, hv.bs, apparam_len); break; default: break; } } OBEX_ObjectReParseHeaders (obex_context->obex_handle, object); /* Call helper functions to deal with specific data */ if (obex_context->connection_id != CONID_INVALID && obex_context->type) { if (!g_ascii_strncasecmp (obex_context->type, BIP_IMG_TYPE, strlen (obex_context->type))) { /* PutImage was requested */ ods_obex_srv_put_image (obex_context, img_descriptor); } else if (!g_ascii_strncasecmp (obex_context->type, BIP_THM_TYPE, strlen (obex_context->type))) { /* PutLinkedThumbnail was requested */ ods_obex_srv_put_linked_thumbnail (obex_context); } else if (!g_ascii_strncasecmp (obex_context->type, BIP_ATTACHMENT_TYPE, strlen (obex_context->type))) { /* PutLinkedAttachment was requested */ ods_obex_srv_put_linked_attachment (obex_context, img_descriptor); } else if (!g_ascii_strncasecmp (obex_context->type, BIP_DISPLAY_TYPE, strlen (obex_context->type))) { /* RemoteDisplay was requested */ if (!ods_obex_srv_remote_display (obex_context, apparam, apparam_len, action)) { obex_context->report_progress = FALSE; ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_BAD_REQUEST, OBEX_RSP_BAD_REQUEST); goto out; } } } g_message ("path: %s", path); /* Open file for writing only if this is not a delete request */ if (!is_delete) { if (!ods_obex_srv_new_file (obex_context, path)) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_UNAUTHORIZED, OBEX_RSP_UNAUTHORIZED); goto out; } } else { /* this is a delete request */ obex_context->report_progress = FALSE; obex_context->local = g_build_filename (path, obex_context->remote, NULL); if (!g_file_test (obex_context->local, G_FILE_TEST_EXISTS)) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); goto out; } if (g_access (obex_context->local, W_OK) < 0) { ret = -1; OBEX_ObjectSetRsp (object, OBEX_RSP_UNAUTHORIZED, OBEX_RSP_UNAUTHORIZED); goto out; } g_message ("Deleting: %s", obex_context->local); if (g_file_test (obex_context->local, G_FILE_TEST_IS_DIR)) ret = rmdir (obex_context->local); else ret = g_unlink (obex_context->local); if (ret == -1) OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); } /* If there is some data received already, write it to file */ while (written < obex_context->buf_size) { write_ret = write (obex_context->stream_fd, obex_context->buf + written, obex_context->buf_size - written); if (write_ret < 0 && errno == EINTR) continue; if (write_ret < 0) { ret = -errno; OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); break; } written += write_ret; } out: g_free (img_descriptor); g_free (apparam); if (ret < 0) ods_obex_transfer_close (obex_context); else if (!no_response_on_success) OBEX_ObjectSetRsp (object, OBEX_RSP_CONTINUE, OBEX_RSP_SUCCESS); return ret; } gint ods_obex_setpath (OdsObexContext *obex_context, const gchar *path, gboolean create) { gint ret; obex_headerdata_t hv; obex_object_t *object = NULL; obex_setpath_hdr_t nonhdrdata; gchar *uname; gsize uname_len; nonhdrdata.flags = 0x02; nonhdrdata.constants = 0; if (strcmp (path, "..") == 0) { /* move up one directory */ nonhdrdata.flags = 0x03; uname_len = 0; } else { /* normal directory change */ uname_len = ods_filename_to_utf16 (&uname, path); if (uname == NULL) { ret = -EINVAL; goto out; } } /* Add create flag */ if (create) nonhdrdata.flags &= ~0x02; object = OBEX_ObjectNew (obex_context->obex_handle, OBEX_CMD_SETPATH); if (!object) { ret = -ENOMEM; goto out; } /* Attach flags */ ret = OBEX_ObjectSetNonHdrData (object, (uint8_t*)&nonhdrdata, 2); if (ret < 0) goto out; /* Add connection header */ if (obex_context->connection_id != CONID_INVALID) { hv.bq4 = obex_context->connection_id; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_CONNECTION, hv, 4, 0); if (ret < 0) goto out; } /* Add name header */ hv.bs = (guchar *) uname; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_NAME, hv, uname_len, 0); if (ret < 0) goto out; ret = ods_obex_send (obex_context, object); out: if (uname_len > 0 ) g_free (uname); if (ret < 0 && object) OBEX_ObjectDelete (obex_context->obex_handle, object); return ret; } gboolean ods_obex_srv_setpath (OdsObexContext *obex_context, obex_object_t *object, const gchar *root_path, const gchar *current_path, gchar **new_path, gboolean allow_write) { uint8_t *nonhdrdata_dummy = NULL; obex_setpath_hdr_t *nonhdrdata; obex_headerdata_t hv; uint8_t hi; guint hlen; gchar *directory = NULL; gboolean create = FALSE; gboolean backup = FALSE; gboolean ret = FALSE; OBEX_ObjectGetNonHdrData (object, &nonhdrdata_dummy); if (!nonhdrdata_dummy) { OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); return FALSE; } nonhdrdata = (obex_setpath_hdr_t*) nonhdrdata_dummy; if (nonhdrdata->flags == 0) create = TRUE; else if (nonhdrdata->flags == 0x03) backup = TRUE; else if (nonhdrdata->flags != 0x02) { OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); return FALSE; } if (backup) { /* we have to go to parent directory */ /* Check if we can't go up */ if (strcmp (root_path, current_path) == 0) { OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); return FALSE; } *new_path = g_path_get_dirname (current_path); OBEX_ObjectSetRsp (object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS); return TRUE; } /* set default response to Forbidden (in case we fail to parse the headers correctly) */ OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); while (OBEX_ObjectGetNextHeader (obex_context->obex_handle, object, &hi, &hv, &hlen)) { if (hi == OBEX_HDR_NAME) { if (hlen > 0) { /* Normal directory change */ directory = ods_filename_from_utf16 ((gchar *) hv.bs, hlen); *new_path = g_build_filename (current_path, directory, NULL); /* Check if such path exists */ if (g_file_test (*new_path, G_FILE_TEST_EXISTS)) { if (create) { g_free (*new_path); *new_path = ods_obex_get_new_path (current_path, directory); } else { OBEX_ObjectSetRsp (object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS); ret = TRUE; goto out; } } else if (!create) { OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_FOUND, OBEX_RSP_NOT_FOUND); ret = FALSE; goto out; } /* In case we are Creating new folder */ if (allow_write && mkdir (*new_path, 0755) == 0) { OBEX_ObjectSetRsp (object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS); ret = TRUE; goto out; } OBEX_ObjectSetRsp (object, OBEX_RSP_FORBIDDEN, OBEX_RSP_FORBIDDEN); ret = FALSE; goto out; } else { /* Name header empty, change path to root */ *new_path = g_strdup (root_path); OBEX_ObjectSetRsp (object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS); ret = TRUE; goto out; } } } out: if (directory) g_free (directory); if (!ret && *new_path) { g_free (*new_path); *new_path = NULL; } return ret; } gint ods_obex_put_image (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *encoding, const gchar *pixel, guint64 size, const gchar *transformation) { gchar *img_descriptor; gint ret; g_assert (local && remote && encoding && pixel && transformation); img_descriptor = get_image_descriptor (encoding, pixel, size, transformation); ret = ods_obex_put_full (obex_context, local, remote, BIP_IMG_TYPE, img_descriptor, NULL, NULL, 0, size, -1, FALSE, -1); if (*encoding != '\0') ods_obex_transfer_add_info (obex_context, "Encoding", g_strdup (encoding)); if (*pixel != '\0') ods_obex_transfer_add_info (obex_context, "Pixel", g_strdup (pixel)); if (*transformation != '\0') ods_obex_transfer_add_info (obex_context, "Transformation", g_strdup (transformation)); g_free (img_descriptor); return ret; } gint ods_obex_put_linked_thumbnail (OdsObexContext *obex_context, const gchar *local, const gchar *img_handle, guint64 size) { g_assert (local && img_handle); return ods_obex_put_full (obex_context, local, NULL, BIP_THM_TYPE, NULL, img_handle, NULL, 0, size, -1, FALSE, -1); } gint ods_obex_put_linked_attachment (OdsObexContext *obex_context, const gchar *local, const gchar *img_handle, const gchar *name, const gchar *content_type, const gchar *charset, guint64 size, time_t ctime) { gchar *att_descriptor; gint ret; struct stat stats; guint64 object_size = 0; time_t object_ctime = -1; gchar created_time[17]; g_assert (local && img_handle && name && content_type && charset); if (size > 0) { object_size = size; object_ctime = ctime; } else if (g_stat (local, &stats) == 0) { object_size = stats.st_size; object_ctime = stats.st_ctime; } if (object_ctime != -1) ods_make_iso8601 (ctime, created_time, sizeof (created_time)); att_descriptor = get_attachment_descriptor(name, object_size, content_type, charset, object_ctime!=-1 ? created_time : ""); ret = ods_obex_put_full (obex_context, local, NULL, BIP_ATTACHMENT_TYPE, att_descriptor, img_handle, NULL, 0, object_size, -1, FALSE, -1); obex_context->remote = g_strdup (name);/* set it here so that we don't send NAME header*/ if (*content_type != '\0') ods_obex_transfer_add_info (obex_context, "ContentType", g_strdup (content_type)); if (*charset != '\0') ods_obex_transfer_add_info (obex_context, "Charset", g_strdup (charset)); if (ctime != -1) ods_obex_transfer_add_info (obex_context, "Created", g_strdup (created_time)); g_free (att_descriptor); return ret; } /* img_handle must not be NULL, must be empty when action != SelectImage */ gint ods_obex_remote_display (OdsObexContext *obex_context, const gchar *img_handle, guint8 action) { bip_apparam_remote_display_t *apparam_hdr; gint ret; g_assert (img_handle); apparam_hdr = g_new0 (bip_apparam_remote_display_t, 1); apparam_hdr->tag_id = BIP_APPARAM_REMOTEDISPLAY_TAGID; apparam_hdr->length = 1; apparam_hdr->value = action; ret = ods_obex_put_full (obex_context, NULL, NULL, BIP_DISPLAY_TYPE, NULL, img_handle, (guchar *) apparam_hdr, sizeof (bip_apparam_remote_display_t), 0, -1, FALSE, -1); g_free (apparam_hdr); return ret; } gint ods_obex_action (OdsObexContext *obex_context, const gchar *src, const gchar *dst, guint8 action, guint32 perms) { gint ret; obex_object_t *object; obex_headerdata_t hv; gchar *uname; gsize uname_len; if (action != OBEX_ACTION_SETPERM) g_assert (src && dst); object = OBEX_ObjectNew (obex_context->obex_handle, OBEX_CMD_ACTION); /* Add connection header */ if (obex_context->connection_id != CONID_INVALID) { hv.bq4 = obex_context->connection_id; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_CONNECTION, hv, 4, 0); if (ret < 0) goto out; } /* src header */ uname_len = ods_filename_to_utf16 (&uname, src); if (uname == NULL) { ret = -EINVAL; goto out; } hv.bs = (guchar *) uname; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_NAME, hv, uname_len, 0); g_free (uname); if (ret < 0) goto out; /* dst header */ uname_len = ods_filename_to_utf16 (&uname, dst); if (uname == NULL) { ret = -EINVAL; goto out; } hv.bs = (guchar *) uname; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_DESTNAME, hv, uname_len, 0); g_free (uname); if (ret < 0) goto out; /* action header */ hv.bq1 = action; OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_ACTION_ID, hv, 1, 0); /* permissions header */ if (action == OBEX_ACTION_SETPERM) { hv.bq4 = perms; ret = OBEX_ObjectAddHeader (obex_context->obex_handle, object, OBEX_HDR_PERMISSIONS, hv, 4, 0); if (ret < 0) goto out; } ret = ods_obex_send (obex_context, object); out: if (ret < 0 && object) OBEX_ObjectDelete (obex_context->obex_handle, object); return ret; } obex-data-server-0.4.6/src/ods-error.c0000644000175000017500000001513011524724173014467 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include "ods-error.h" /** * ods_error_quark: * Return value: Our personal error quark. **/ GQuark ods_error_quark (void) { static GQuark quark = 0; if (!quark) { quark = g_quark_from_static_string ("ods_error"); } return quark; } /** * ods_error_get_type: **/ #define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC } GType ods_error_get_type (void) { static GType etype = 0; if (etype == 0) { static const GEnumValue values[] = { ENUM_ENTRY (ODS_ERROR_INVALID_ARGUMENTS, "InvalidArguments"), ENUM_ENTRY (ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "ConnectionAttemptFailed"), ENUM_ENTRY (ODS_ERROR_NOT_SUPPORTED, "NotSupported"), ENUM_ENTRY (ODS_ERROR_NOT_FOUND, "NotFound"), ENUM_ENTRY (ODS_ERROR_BUSY, "Busy"), ENUM_ENTRY (ODS_ERROR_NOT_AUTHORIZED, "NotAuthorized"), ENUM_ENTRY (ODS_ERROR_OUT_OF_MEMORY, "OutOfMemory"), ENUM_ENTRY (ODS_ERROR_FAILED, "Failed"), /* generic error */ ENUM_ENTRY (ODS_ERROR_NOT_CONNECTED, "NotConnected"), ENUM_ENTRY (ODS_ERROR_FORBIDDEN, "Forbidden"), ENUM_ENTRY (ODS_ERROR_LINK_ERROR, "LinkError"), ENUM_ENTRY (ODS_ERROR_BAD_DATA, "BadData"), ENUM_ENTRY (ODS_ERROR_STARTED, "Started"), ENUM_ENTRY (ODS_ERROR_NOT_STARTED, "NotStarted"), ENUM_ENTRY (ODS_ERROR_TRANSPORT_NOT_AVAILABLE, "TransportNotAvailable"), ENUM_ENTRY (ODS_ERROR_CONNECTION_REFUSED, "ConnectionRefused"), ENUM_ENTRY (ODS_ERROR_CONNECTION_TIMEOUT, "ConnectionTimeout"), ENUM_ENTRY (ODS_ERROR_BAD_REQUEST, "BadRequest"), ENUM_ENTRY (ODS_ERROR_NOT_IMPLEMENTED, "NotImplemented"), ENUM_ENTRY (ODS_ERROR_SERVER_ERROR, "ServerError"), ENUM_ENTRY (ODS_ERROR_TIMEOUT, "Timeout"), ENUM_ENTRY (ODS_ERROR_CANCELLED, "Cancelled"), ENUM_ENTRY (ODS_ERROR_NOT_MODIFIED, "NotModified"), ENUM_ENTRY (ODS_ERROR_DATABASE_ERROR, "DatabaseError"), ENUM_ENTRY (ODS_ERROR_CONFLICT, "Conflict"), ENUM_ENTRY (ODS_ERROR_UNSUPPORTED_MEDIA_TYPE, "UnsupportedMediaType"), ENUM_ENTRY (ODS_ERROR_NO_FIFO_READER, "NoFifoReader"), { 0, 0, 0 } }; etype = g_enum_register_static ("OdsError", values); } return etype; } void ods_error_err2gerror (gint err, GError **error) { if (!error) return; if (err < 0) err = -err; switch (err) { case EACCES: g_set_error (error, ODS_ERROR, ODS_ERROR_NOT_AUTHORIZED, "Permission denied"); break; case EBUSY: g_set_error (error, ODS_ERROR, ODS_ERROR_BUSY, "Another operation in progress"); break; case EINVAL: g_set_error (error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid arguments"); break; case ENOENT: g_set_error (error, ODS_ERROR, ODS_ERROR_NOT_FOUND, "File not found"); break; case ENOMEM: g_set_error (error, ODS_ERROR, ODS_ERROR_OUT_OF_MEMORY, "Out of memory"); break; case EPERM: g_set_error (error, ODS_ERROR, ODS_ERROR_FORBIDDEN, "Operation forbidden"); break; case ENOSPC: g_set_error (error, ODS_ERROR, ODS_ERROR_DATABASE_ERROR, "No space left on device"); break; case ENXIO: g_set_error (error, ODS_ERROR, ODS_ERROR_NO_FIFO_READER, "No process has opened supplied FIFO for reading"); break; default: g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Unknown error occurred (errno: %d)", err); break; } } void ods_error_obexrsp2gerror (gint obex_response, GError **error) { if (!error) return; switch (obex_response) { case OBEX_RSP_REQUEST_TIME_OUT: g_set_error (error, ODS_ERROR, ODS_ERROR_TIMEOUT, "Request timeout"); break; case OBEX_RSP_BAD_REQUEST: g_set_error (error, ODS_ERROR, ODS_ERROR_BAD_REQUEST, "Bad request"); break; case OBEX_RSP_FORBIDDEN: g_set_error (error, ODS_ERROR, ODS_ERROR_FORBIDDEN, "Operation forbidden"); break; case OBEX_RSP_NOT_FOUND: g_set_error (error, ODS_ERROR, ODS_ERROR_NOT_FOUND, "File not found"); break; case OBEX_RSP_NOT_IMPLEMENTED: g_set_error (error, ODS_ERROR, ODS_ERROR_NOT_IMPLEMENTED, "Not implemented"); break; case OBEX_RSP_UNAUTHORIZED: g_set_error (error, ODS_ERROR, ODS_ERROR_NOT_AUTHORIZED, "Not authorized"); break; case OBEX_RSP_INTERNAL_SERVER_ERROR: g_set_error (error, ODS_ERROR, ODS_ERROR_SERVER_ERROR, "Remote server error"); break; case OBEX_RSP_NOT_MODIFIED: g_set_error (error, ODS_ERROR, ODS_ERROR_NOT_MODIFIED, "No modification done"); break; case OBEX_RSP_CONFLICT: g_set_error (error, ODS_ERROR, ODS_ERROR_CONFLICT, "Conflict error"); break; case OBEX_RSP_DATABASE_FULL: g_set_error (error, ODS_ERROR, ODS_ERROR_DATABASE_ERROR, "Could not write (database full)"); break; case OBEX_RSP_DATABASE_LOCKED: g_set_error (error, ODS_ERROR, ODS_ERROR_DATABASE_ERROR, "Could not read/write (database locked)"); break; case OBEX_RSP_UNSUPPORTED_MEDIA_TYPE: g_set_error (error, ODS_ERROR, ODS_ERROR_UNSUPPORTED_MEDIA_TYPE, "Media type not supported"); break; default: g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Operation failed (unexpected response)"); break; } } gchar * ods_error_get_dbus_name (GError *error) { GEnumClass *klass; GEnumValue *value; const gchar *error_name; klass = g_type_class_ref (ods_error_get_type ()); value = g_enum_get_value (klass, error->code); g_type_class_unref (klass); error_name = value->value_nick; return g_strdup_printf ("%s.%s", ODS_ERROR_DBUS_INTERFACE, error_name); } obex-data-server-0.4.6/src/ods-usb.c0000644000175000017500000003145411524724173014136 00000000000000#include "config.h" #ifdef USE_USB #include #include /* perror */ #include /* errno and EADDRNOTAVAIL */ #include #include #include "ods-usb.h" struct ods_usb_intf_transport_t { struct ods_usb_intf_transport_t *prev, *next; /* Next and previous interfaces in the list */ struct usb_device *device; /* USB device that has the interface */ int configuration; /* Device configuration */ int configuration_description; /* Configuration string descriptor number */ int control_interface; /* OBEX master interface */ int control_setting; /* OBEX master interface setting */ int control_interface_description; /* OBEX master interface string descriptor number * If non-zero, use usb_get_string_simple() from * libusb to retrieve human-readable description */ unsigned char *extra_descriptors; /* Extra master interface descriptors */ int extra_descriptors_len; /* Length of extra descriptors */ int data_interface; /* OBEX data/slave interface */ int data_idle_setting; /* OBEX data/slave idle setting */ int data_interface_idle_description; /* OBEX data/slave interface string descriptor number * in idle setting */ int data_active_setting; /* OBEX data/slave active setting */ int data_interface_active_description; /* OBEX data/slave interface string descriptor number * in active setting */ int data_endpoint_read; /* OBEX data/slave interface read endpoint */ int data_endpoint_write; /* OBEX data/slave interface write endpoint */ usb_dev_handle *dev_control; /* libusb handler for control interace */ usb_dev_handle *dev_data; /* libusb handler for data interface */ char *path; /* Path, see path in obex_usb_intf_t */ }; /* "Union Functional Descriptor" from CDC spec 5.2.3.X * used to find data/slave OBEX interface */ #pragma pack(1) struct cdc_union_desc { guint8 bLength; guint8 bDescriptorType; guint8 bDescriptorSubType; guint8 bMasterInterface0; guint8 bSlaveInterface0; }; #pragma pack() /* CDC class and subclass types */ #define USB_CDC_CLASS 0x02 #define USB_CDC_OBEX_SUBCLASS 0x0b /* class and subclass specific descriptor types */ #define CDC_HEADER_TYPE 0x00 #define CDC_CALL_MANAGEMENT_TYPE 0x01 #define CDC_AC_MANAGEMENT_TYPE 0x02 #define CDC_UNION_TYPE 0x06 #define CDC_COUNTRY_TYPE 0x07 #define CDC_OBEX_TYPE 0x15 #define CDC_OBEX_SERVICE_ID_TYPE 0x19 /* Interface descriptor */ #define USB_DT_CS_INTERFACE 0x24 #define CDC_DATA_INTERFACE_TYPE 0x0a #define WMC_DEFAULT_OBEX_SERVER_UUID \ { 0x02, 0xae, 0xb3, 0x20, \ 0xf6, 0x49, 0x11, 0xda, \ 0x97, 0x4d, 0x08, 0x00, \ 0x20, 0x0c, 0x9a, 0x66 } #define USB_MAX_STRING_SIZE 256 #define USB_OBEX_TIMEOUT 10000 /* 10 seconds */ /* * Helper function to usbobex_find_interfaces */ static void find_eps(struct ods_usb_intf_transport_t *intf, struct usb_interface_descriptor data_intf, int *found_active, int *found_idle) { struct usb_endpoint_descriptor *ep0, *ep1; if (data_intf.bNumEndpoints == 2) { ep0 = data_intf.endpoint; ep1 = data_intf.endpoint + 1; if ((ep0->bEndpointAddress & USB_ENDPOINT_IN) && ((ep0->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_BULK) && !(ep1->bEndpointAddress & USB_ENDPOINT_IN) && ((ep1->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_BULK)) { *found_active = 1; intf->data_active_setting = data_intf.bAlternateSetting; intf->data_interface_active_description = data_intf.iInterface; intf->data_endpoint_read = ep0->bEndpointAddress; intf->data_endpoint_write = ep1->bEndpointAddress; } if (!(ep0->bEndpointAddress & USB_ENDPOINT_IN) && ((ep0->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_BULK) && (ep1->bEndpointAddress & USB_ENDPOINT_IN) && ((ep1->bmAttributes & USB_ENDPOINT_TYPE_MASK) == USB_ENDPOINT_TYPE_BULK)) { *found_active = 1; intf->data_active_setting = data_intf.bAlternateSetting; intf->data_interface_active_description = data_intf.iInterface; intf->data_endpoint_read = ep1->bEndpointAddress; intf->data_endpoint_write = ep0->bEndpointAddress; } } if (data_intf.bNumEndpoints == 0) { *found_idle = 1; intf->data_idle_setting = data_intf.bAlternateSetting; intf->data_interface_idle_description = data_intf.iInterface; } } /* * Helper function to usbobex_find_interfaces */ static int find_obex_data_interface(unsigned char *buffer, int buflen, struct usb_config_descriptor config, struct ods_usb_intf_transport_t *intf) { struct cdc_union_desc *union_header = NULL; int i, a; int found_active = 0; int found_idle = 0; if (!buffer) { g_debug("Weird descriptor references"); return -EINVAL; } while (buflen > 0) { if (buffer [1] != USB_DT_CS_INTERFACE) { g_debug("skipping garbage"); goto next_desc; } switch (buffer [2]) { case CDC_UNION_TYPE: /* we've found it */ if (union_header) { g_debug("More than one union descriptor, skiping ..."); goto next_desc; } union_header = (struct cdc_union_desc *)buffer; break; case CDC_OBEX_TYPE: /* maybe check version */ case CDC_OBEX_SERVICE_ID_TYPE: /* This one is handled later */ case CDC_HEADER_TYPE: break; /* for now we ignore it */ default: g_debug("Ignoring extra header, type %d, length %d", buffer[2], buffer[0]); break; } next_desc: buflen -= buffer[0]; buffer += buffer[0]; } if (!union_header) { g_debug("No union descriptor, giving up"); return -ENODEV; } /* Found the slave interface, now find active/idle settings and endpoints */ intf->data_interface = union_header->bSlaveInterface0; /* Loop through all of the interfaces */ for (i = 0; i < config.bNumInterfaces; i++) { /* Loop through all of the alternate settings */ for (a = 0; a < config.interface[i].num_altsetting; a++) { /* Check if this interface is OBEX data interface*/ /* and find endpoints */ if (config.interface[i].altsetting[a].bInterfaceNumber == intf->data_interface) find_eps(intf, config.interface[i].altsetting[a], &found_active, &found_idle); } } if (!found_idle) { g_debug("No idle setting"); return -ENODEV; } if (!found_active) { g_debug("No active setting"); return -ENODEV; } return 0; } /* * Helper function to usbobex_find_interfaces */ static int get_intf_string(struct usb_dev_handle *usb_handle, char **string, int id) { if (id) { if ((*string = malloc(USB_MAX_STRING_SIZE)) == NULL) return -ENOMEM; *string[0] = '\0'; return usb_get_string_simple(usb_handle, id, *string, USB_MAX_STRING_SIZE); } return 0; } /* * Helper function to usbobex_find_interfaces */ static struct ods_usb_intf_transport_t *check_intf(struct usb_device *dev, int c, int i, int a, char *bus, char *device, struct ods_usb_intf_transport_t *current) { struct ods_usb_intf_transport_t *next = NULL; if ((dev->config[c].interface[i].altsetting[a].bInterfaceClass == USB_CDC_CLASS) && (dev->config[c].interface[i].altsetting[a].bInterfaceSubClass == USB_CDC_OBEX_SUBCLASS)) { int err; unsigned char *buffer = dev->config[c].interface[i].altsetting[a].extra; int buflen = dev->config[c].interface[i].altsetting[a].extralen; next = malloc(sizeof(struct ods_usb_intf_transport_t)); if (next == NULL) return current; next->device = dev; next->configuration = dev->config[c].bConfigurationValue; next->configuration_description = dev->config[c].iConfiguration; next->control_interface = dev->config[c].interface[i].altsetting[a].bInterfaceNumber; next->control_interface_description = dev->config[c].interface[i].altsetting[a].iInterface; next->control_setting = dev->config[c].interface[i].altsetting[a].bAlternateSetting; next->extra_descriptors = buffer; next->extra_descriptors_len = buflen; err = find_obex_data_interface(buffer, buflen, dev->config[c], next); if (err) free(next); else { char path[200], *s, *shortdev; /* On MacOS X we might get 002-04a9-3139-00-00 instead of 002 for the dev. */ shortdev = strdup (device); s = strchr(shortdev, '-'); if (s) *s='\0'; /* Create the usb: path for the device */ snprintf (path, sizeof(path), "usb:%s,%s,%d", bus, shortdev, dev->config[c].interface[i].altsetting[a].bInterfaceNumber); free (shortdev); next->path = strdup (path); if (current) current->next = next; next->prev = current; next->next = NULL; current = next; } } return current; } /* * Helper function to usbobex_find_interfaces */ static void find_obex_service_descriptor(unsigned char *buffer, int buflen, ods_usb_intf_service_t **service) { if (!buffer) { g_debug("Weird descriptor references"); return ; } while (buflen > 0) { if (buffer[1] != USB_DT_CS_INTERFACE) { g_debug("skipping garbage"); goto next_desc; } switch (buffer[2]) { case CDC_OBEX_SERVICE_ID_TYPE: /* we've found it */ if (buflen < 22) /* Check descriptor size */ g_debug("Invalid service id descriptor"); else if (*service == NULL) { *service = malloc(sizeof(ods_usb_intf_service_t)); if (*service != NULL) { const guint8 default_uuid[16] = WMC_DEFAULT_OBEX_SERVER_UUID; (*service)->role = buffer[3]; memcpy((*service)->uuid, buffer+4, 16); (*service)->version = (buffer[20]<<8)|(buffer[21]); if (memcmp((*service)->uuid, default_uuid, 16) == 0 ) (*service)->is_default_uuid = 1; else (*service)->is_default_uuid = 0; } } break; case CDC_OBEX_TYPE: /* maybe check version */ case CDC_UNION_TYPE: case CDC_HEADER_TYPE: break; default: g_debug("Ignoring extra header, type %d, length %d", buffer[2], buffer[0]); break; } next_desc: buflen -= buffer[0]; buffer += buffer[0]; } } /* * Function usbobex_find_interfaces () * * Find available USBOBEX interfaces on the system */ GList *ods_usbobex_find_interfaces(void) { struct usb_bus *busses; struct usb_bus *bus; struct usb_device *dev; int c, i, a; struct ods_usb_intf_transport_t *current = NULL; struct ods_usb_intf_transport_t *tmp = NULL; struct usb_dev_handle *usb_handle; GList *list = NULL; usb_init(); usb_find_busses(); usb_find_devices(); busses = usb_get_busses(); for (bus = busses; bus; bus = bus->next) { for (dev = bus->devices; dev; dev = dev->next) { /* Loop through all of the configurations */ for (c = 0; c < dev->descriptor.bNumConfigurations; c++) { /* Loop through all of the interfaces */ for (i = 0; i < dev->config[c].bNumInterfaces; i++) { /* Loop through all of the alternate settings */ for (a = 0; a < dev->config[c].interface[i].num_altsetting; a++) { /* Check if this interface is OBEX */ /* and find data interface */ current = check_intf(dev, c, i, a, bus->dirname, dev->filename, current); } } } } } /* Rewind the double-linked list */ while (current && current->prev) current = current->prev; while (current) { ods_usb_info *item; usb_handle = usb_open(current->device); item = g_new0 (ods_usb_info, 1); get_intf_string(usb_handle, &item->manufacturer, current->device->descriptor.iManufacturer); get_intf_string(usb_handle, &item->product, current->device->descriptor.iProduct); get_intf_string(usb_handle, &item->serial, current->device->descriptor.iSerialNumber); get_intf_string(usb_handle, &item->configuration, current->configuration_description); get_intf_string(usb_handle, &item->control_interface, current->control_interface_description); get_intf_string(usb_handle, &item->data_interface_idle, current->data_interface_idle_description); get_intf_string(usb_handle, &item->data_interface_active, current->data_interface_active_description); item->path = current->path; find_obex_service_descriptor(current->extra_descriptors, current->extra_descriptors_len, &item->service); usb_close(usb_handle); current = current->next; list = g_list_prepend (list, item); } list = g_list_reverse (list); /* Rewind the double-linked list */ while (current && current->prev) current = current->prev; while (current) { tmp = current->next; free(current); current = tmp; } return list; } /* * Function usbobex_free_interfaces () * * Free the list of discovered USBOBEX interfaces on the system */ static void ods_usbobex_free_interface(ods_usb_info *item) { free(item->manufacturer); free(item->product); free(item->serial); free(item->configuration); free(item->control_interface); free(item->data_interface_idle); free(item->data_interface_active); free(item->service); free(item->path); free(item); } void ods_usbobex_free_interfaces(GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc) ods_usbobex_free_interface, NULL); g_list_free (list); } #endif /* USE_USB */ obex-data-server-0.4.6/src/ods-manager.c0000644000175000017500000014015311524724173014754 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ods-bluez.h" #include "ods-common.h" #include "ods-error.h" #include "ods-server.h" #include "ods-session.h" #include "ods-marshal.h" #include "ods-manager.h" #include "ods-usb.h" #include "ods-manager-dbus-glue.h" #define ODS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ODS_TYPE_MANAGER, OdsManagerPrivate)) typedef struct OdsManagerSessionInfo_ { OdsSession *session; /* Bluetooth specific */ OdsBluezCancellable *bluetooth_cancel_data; gchar *bluetooth_target_address; gchar *bluetooth_source_address; gint bluetooth_channel; /* USB specific */ gint usb_interface_number; /* TTY specific */ gchar *tty_dev; } OdsManagerSessionInfo; typedef struct OdsManagerServerInfo_ { OdsServer *server; /* Bluetooth specific */ gchar *bluetooth_source_address; gboolean require_pairing; guint32 sdp_record_handle; /* TTY specific */ gchar *tty_dev; } OdsManagerServerInfo; typedef struct OdsManagerCreateSessionData_ { OdsManager *manager; OdsSession *session; gchar *tty_dev; } OdsManagerCreateSessionData; struct OdsManagerPrivate { gboolean is_disposing; gboolean disposed; gboolean initialized; /* Session list (DBus path as key and OdsManagerSessionInfo as value) */ GHashTable *session_list; /* Server list (DBus path as key and OdsManagerServerInfo as value) */ GHashTable *server_list; DBusGProxy *dbus_proxy; GHashTable *listened_dbus_names; GHashTable *removed_dbus_names; }; enum { SESSION_CONNECTED, SESSION_CLOSED, SESSION_CONNECT_ERROR, DISPOSED, LAST_SIGNAL }; static guint signals [LAST_SIGNAL] = { 0, }; G_DEFINE_TYPE (OdsManager, ods_manager, G_TYPE_OBJECT) static gboolean ods_manager_session_finalize (gpointer key, OdsManagerSessionInfo *session_info, OdsManager *manager); static gboolean ods_manager_server_finalize (gpointer key, OdsManagerServerInfo *server_info, OdsManager *manager); static void ods_manager_finalize (GObject *object); static void ods_manager_listened_names_add (OdsManager *manager, const gchar *dbus_owner, const gchar *dbus_path) { GHashTable *object_list = NULL; if (!(object_list = g_hash_table_lookup (manager->priv->listened_dbus_names, dbus_owner))) { object_list = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); g_hash_table_insert (manager->priv->listened_dbus_names, g_strdup (dbus_owner), object_list); } g_hash_table_insert (object_list, g_strdup (dbus_path), NULL); } static void ods_manager_listened_names_remove (OdsManager *manager, const gchar *dbus_owner, const gchar *dbus_path) { GHashTable *object_list; g_message ("Removing listened DBUS name %s (object: %s)", dbus_owner, dbus_path); if ((object_list = g_hash_table_lookup (manager->priv->listened_dbus_names, dbus_owner))) { if (dbus_path) { g_hash_table_remove (object_list, dbus_path); if (g_hash_table_size (object_list) > 0) return; } } g_hash_table_remove (manager->priv->listened_dbus_names, dbus_owner); g_hash_table_remove (manager->priv->removed_dbus_names, dbus_owner); g_message ("Removed from listened DBUS names list"); if (manager->priv->is_disposing && g_hash_table_size (manager->priv->listened_dbus_names) == 0) { g_message ("Manager disposed"); manager->priv->disposed = TRUE; g_signal_emit (manager, signals [DISPOSED], 0); } } static void ods_manager_session_list_add (OdsManager *manager, OdsSession *session, OdsBluezCancellable *bluetooth_cancel_data, const gchar *bluetooth_target_address, const gchar *bluetooth_source_address, const gint usb_interface_number, const gchar *tty_dev, const gchar *dbus_owner, const gchar *dbus_path) { OdsManagerSessionInfo *session_info; session_info = g_new0 (OdsManagerSessionInfo, 1); session_info->session = session; session_info->bluetooth_cancel_data = bluetooth_cancel_data; session_info->bluetooth_target_address = g_strdup (bluetooth_target_address); session_info->bluetooth_source_address = g_strdup (bluetooth_source_address); session_info->usb_interface_number = usb_interface_number; session_info->tty_dev = g_strdup (tty_dev); g_hash_table_insert (manager->priv->session_list, g_strdup (dbus_path), session_info); ods_manager_listened_names_add (manager, dbus_owner, dbus_path); } static void ods_manager_server_list_add (OdsManager *manager, OdsServer *server, const gchar *bluetooth_source_address, gboolean require_pairing, guint32 sdp_record_handle, const gchar *tty_dev, const gchar *dbus_owner, const gchar *dbus_path) { OdsManagerServerInfo *server_info; server_info = g_new0 (OdsManagerServerInfo, 1); server_info->server = server; server_info->bluetooth_source_address = g_strdup (bluetooth_source_address); server_info->require_pairing = require_pairing; server_info->sdp_record_handle = sdp_record_handle; server_info->tty_dev = g_strdup (tty_dev); g_hash_table_insert (manager->priv->server_list, g_strdup (dbus_path), server_info); ods_manager_listened_names_add (manager, dbus_owner, dbus_path); } static void ods_manager_session_info_free (OdsManagerSessionInfo *session_info) { g_free (session_info->bluetooth_target_address); g_free (session_info->bluetooth_source_address); g_free (session_info->tty_dev); g_free (session_info); } static void ods_manager_server_info_free (OdsManagerServerInfo *server_info) { g_free (server_info->bluetooth_source_address); g_free (server_info->tty_dev); g_free (server_info); } static void ods_manager_session_list_remove (OdsManager *manager, OdsSession *session) { gchar *session_object; gchar *owner; g_object_get (session, "dbus-path", &session_object, NULL); g_object_get (session, "owner", &owner, NULL); if (!manager->priv->is_disposing) g_hash_table_remove (manager->priv->session_list, session_object); ods_manager_listened_names_remove (manager, owner, session_object); g_free (session_object); g_free (owner); } static void ods_manager_server_list_remove (OdsManager *manager, OdsServer *server) { gchar *server_object; gchar *owner; g_object_get (server, "dbus-path", &server_object, NULL); g_object_get (server, "owner", &owner, NULL); if (!manager->priv->is_disposing) g_hash_table_remove (manager->priv->server_list, server_object); ods_manager_listened_names_remove (manager, owner, server_object); g_free (server_object); g_free (owner); } static void session_closed_cb (OdsSession *session, OdsManager *manager) { gchar *session_object; g_message ("session closed"); g_object_get (session, "dbus-path", &session_object, NULL); ods_manager_session_list_remove (manager, session); g_signal_emit (manager, signals [SESSION_CLOSED], 0, session_object); g_free (session_object); g_object_unref (session); } static void session_connect_result_cb (OdsSession *session, const gchar *error_name, const gchar *error_message, OdsManager *manager) { gchar *session_object; g_message ("session_connect_result_cb"); g_object_get (session, "dbus-path", &session_object, NULL); if (!error_name) g_signal_emit (manager, signals [SESSION_CONNECTED], 0, session_object); else { g_signal_emit (manager, signals [SESSION_CONNECT_ERROR], 0, session_object, error_name, error_message); session_closed_cb (session, manager); } g_signal_handlers_disconnect_by_func (session, G_CALLBACK (session_connect_result_cb), manager); g_free (session_object); } static void server_disposed_cb (OdsServer *server, OdsManager *manager) { g_message ("server closed"); /* Free everything */ ods_manager_server_list_remove (manager, server); g_object_unref (server); } static void server_closed_cb (OdsServer *server, OdsManager *manager) { g_message ("disposing server"); g_signal_connect (server, "disposed", G_CALLBACK (server_disposed_cb), manager); ods_server_dispose (server); } static void server_started_cb (OdsServer *server, OdsManager *manager) { OdsManagerServerInfo *server_info; gchar *server_object; gchar *path; guint service; ImagingSdpData *imagingdata = NULL; struct statvfs sfs; guint32 record_handle; /* Add service record to SDP database */ g_object_get (server, "dbus-path", &server_object, NULL); g_object_get (server, "path", &path, NULL); g_object_get (server, "service", &service, NULL); server_info = g_hash_table_lookup (manager->priv->server_list, server_object); if (!server_info->bluetooth_source_address) { /* nothing to do for tty server */ goto out; } if (service == ODS_SERVICE_BIP) { /* ods currently supports ImagePush and RemoteDisplay * as Imaging Responder */ imagingdata = g_new0 (ImagingSdpData, 1); imagingdata->supp_capabilities |= BIP_SUPP_CAP_GENERIC_IMAGING; imagingdata->supp_capabilities |= BIP_SUPP_CAP_DISPLAYING; imagingdata->supp_features |= BIP_SUPP_FEAT_IMAGE_PUSH; imagingdata->supp_features |= BIP_SUPP_FEAT_REMOTE_DISPLAY; imagingdata->supp_functions |= BIP_SUPP_FUNC_GET_CAPABILITIES; imagingdata->supp_functions |= BIP_SUPP_FUNC_PUT_IMAGE; imagingdata->supp_functions |= BIP_SUPP_FUNC_PUT_LINKED_ATTACHMENT; imagingdata->supp_functions |= BIP_SUPP_FUNC_PUT_LINKED_THUMBNAIL; imagingdata->supp_functions |= BIP_SUPP_FUNC_REMOTE_DISPLAY; if (statvfs (path, &sfs) == -1) imagingdata->data_capacity = 0; else imagingdata->data_capacity = (guint64)sfs.f_frsize * sfs.f_bfree; } record_handle = ods_bluez_add_service_record ( server_info->bluetooth_source_address, service, imagingdata); if (record_handle == 0) { /* could not add SDP record */ g_warning ("Could not add SDP record for server (%s), closing server", server_object); /* stop server */ g_signal_connect (server, "disposed", G_CALLBACK (server_disposed_cb), manager); g_object_run_dispose (G_OBJECT (server)); } else { server_info->sdp_record_handle = record_handle; } out: g_free (server_object); g_free (path); if (imagingdata) g_free (imagingdata); } static void server_stopped_cb (OdsServer *server, OdsManager *manager) { OdsManagerServerInfo *server_info; gchar *server_object; g_message ("server stopped"); g_object_get (server, "dbus-path", &server_object, NULL); /* Remove SDP record (Bluetooth specific) */ server_info = g_hash_table_lookup (manager->priv->server_list, server_object); if (!server_info) goto out; if (server_info->sdp_record_handle && server_info->bluetooth_source_address) { ods_bluez_remove_service_record (server_info->bluetooth_source_address, server_info->sdp_record_handle); } out: g_free (server_object); } static void session_cancelled_cb (OdsSession *session, OdsManager *manager) { GError *error = NULL; g_message ("session cancelled"); g_signal_connect (session, "disconnected", G_CALLBACK (session_closed_cb), manager); if (ods_session_disconnect_internal (session, &error) == -1) { /* shouldn't ever happen */ g_clear_error (&error); } } static void ods_manager_finalize_object (gpointer *object, OdsManager *manager) { OdsManagerSessionInfo *session_info; OdsManagerServerInfo *server_info; /* Determine whether we have to close a session or a server */ if ((session_info = g_hash_table_lookup (manager->priv->session_list, object))) { g_warning ("Finalizing session"); ods_manager_session_finalize (NULL, session_info, manager); } else if ((server_info = g_hash_table_lookup (manager->priv->server_list, object))) { g_warning ("Finalizing server"); ods_manager_server_finalize (NULL, server_info, manager); } } static void dbus_name_owner_changed_cb (DBusGProxy *dbus_proxy, const gchar *name, const gchar *old_owner, const gchar *new_owner, OdsManager *manager) { GHashTable *object_list; GList *object_list_dup; if (*new_owner != '\0') return; /* Lookup this name */ object_list = g_hash_table_lookup (manager->priv->listened_dbus_names, name); if (object_list == NULL || (g_hash_table_lookup (manager->priv->removed_dbus_names, name) != NULL)) return; g_warning ("DBUS NAME REMOVED: %s", name); /* insert into removed_dbus_names cause NameOwnerChanged signal * might be received twice. Use manager as bogus value */ g_hash_table_insert (manager->priv->removed_dbus_names, g_strdup (name), manager); /* Now we finalize all objects (sessions and servers) */ object_list_dup = ods_hash_table_get_keys (object_list); g_list_foreach (object_list_dup, (GFunc) ods_manager_finalize_object, manager); g_list_free (object_list_dup); } static void client_socket_connected_cb (gint fd, gint rfcomm_channel, const ImagingSdpData *imagingdata, GError *error, OdsManagerCreateSessionData *data) { gchar *session_object = NULL; gchar *owner = NULL; OdsManagerSessionInfo *session_info; g_object_get (data->session, "dbus-path", &session_object, NULL); g_object_get (data->session, "owner", &owner, NULL); /* We need to reset cancel_data for this session so that it is * properly finalized later on */ session_info = g_hash_table_lookup (data->manager->priv->session_list, session_object); g_assert (session_info); if (session_info->bluetooth_cancel_data) session_info->bluetooth_cancel_data = NULL; session_info->bluetooth_channel = rfcomm_channel; if (fd == -1) { gchar *error_name; /* Could not connect, emit SessionConnectError */ error_name = ods_error_get_dbus_name (error); g_signal_emit (data->manager, signals [SESSION_CONNECT_ERROR], 0, session_object, error_name, error->message); g_free (error_name); /* Finalize session object*/ session_closed_cb (data->session, data->manager); goto out; } if (imagingdata) { g_message ("Imaging SDP data:"); g_message (">> capabilities: %" G_GUINT16_FORMAT, imagingdata->supp_capabilities); g_message (">> features: %" G_GUINT16_FORMAT, imagingdata->supp_features); g_message (">> functions: %" G_GUINT32_FORMAT, imagingdata->supp_functions); g_message (">> capacity: %" G_GUINT64_FORMAT, imagingdata->data_capacity); g_object_set (data->session, "imaging-sdp-data", imagingdata, NULL); } g_message ("Session created by: %s", owner); /* Connect to the session objects signals. */ g_signal_connect (data->session, "closed", G_CALLBACK (session_closed_cb), data->manager); g_signal_connect (data->session, "connect-result-internal", G_CALLBACK (session_connect_result_cb), data->manager); /* Set the connected socket as session fd. * The session will automatically do OBEX Connect */ g_object_set (data->session, "fd", fd, NULL); out: g_free (owner); g_free (session_object); g_free (data); } static struct { const char *name; uint16_t class; gint service; } ods_services[] = { { "pbap", PBAP_SVCLASS_ID, ODS_SERVICE_PBAP}, { "ftp", OBEX_FILETRANS_SVCLASS_ID, ODS_SERVICE_FTP }, { "bip", IMAGING_RESPONDER_SVCLASS_ID, ODS_SERVICE_BIP }, { "opp", OBEX_OBJPUSH_SVCLASS_ID, ODS_SERVICE_OPP }, { } }; static gboolean pattern2service (const char *pattern, uint16_t *uuid, gint *service) { int i; for (i = 0; ods_services[i].name; i++) { if (strcasecmp (ods_services[i].name, pattern) == 0) { *uuid = ods_services[i].class; *service = ods_services[i].service; return TRUE; } } return FALSE; } static gboolean string2service (const char *string, uuid_t *uuid, gint *service) { uint32_t data0, data4; uint16_t data1, data2, data3, data5; if (uuid && strlen(string) == 36 && string[8] == '-' && string[13] == '-' && string[18] == '-' && string[23] == '-' && sscanf(string, "%08x-%04hx-%04hx-%04hx-%08x%04hx", &data0, &data1, &data2, &data3, &data4, &data5) == 6) { uint8_t val[16]; data0 = g_htonl(data0); data1 = g_htons(data1); data2 = g_htons(data2); data3 = g_htons(data3); data4 = g_htonl(data4); data5 = g_htons(data5); memcpy(&val[0], &data0, 4); memcpy(&val[4], &data1, 2); memcpy(&val[6], &data2, 2); memcpy(&val[8], &data3, 2); memcpy(&val[10], &data4, 4); memcpy(&val[14], &data5, 2); sdp_uuid128_create (uuid, val); /* we got UUID128, let's use generic GOEP service */ *service = ODS_SERVICE_GOEP; return TRUE; } else { uint16_t class; /* got pattern specifying exactly which service to use */ if (pattern2service (string, &class, service)) { if (uuid) sdp_uuid16_create (uuid, class); return TRUE; } } return FALSE; } static gint tty_open (const gchar *tty_dev, GError **error) { int fd, arg; glong flags; struct termios options; fd = open (tty_dev, O_RDWR | O_NOCTTY); if (fd < 0) goto failed; flags = fcntl (fd, F_GETFL); fcntl (fd, F_SETFL, flags & ~O_NONBLOCK); tcgetattr (fd, &options); cfmakeraw (&options); options.c_oflag &= ~ONLCR; tcsetattr (fd, TCSANOW, &options); arg = fcntl (fd, F_GETFL); if (arg < 0) goto failed; arg |= O_NONBLOCK; if (fcntl (fd, F_SETFL, arg) < 0) goto failed; g_message ("TTY device %s opened", tty_dev); return fd; failed: if (fd >= 0) close (fd); ods_error_err2gerror (errno, error); if (g_error_matches (*error, ODS_ERROR, ODS_ERROR_FAILED)) { /* replace "unknown errno" error with more readable one */ g_debug ("Unknown err code: (%d)", errno); g_clear_error (error); g_set_error (error, ODS_ERROR, ODS_ERROR_FAILED, "Could not open tty device"); } return -errno; } static gboolean create_bluetooth_session_full (OdsManager *manager, const gchar *target_address, const gchar *source_address, const gchar *pattern, const gchar *bip_feature, DBusGMethodInvocation *context) { GError *error = NULL; gboolean ret = TRUE; gboolean valid; bdaddr_t src; bdaddr_t dst; uuid_t uuid; gint service; gchar **parsed = NULL; OdsSession *session; gchar *sender; gchar *session_object; gchar *target_uuid = NULL; guint imaging_feature = 0; OdsBluezCancellable *cancel_data; g_return_val_if_fail (manager != NULL, FALSE); g_return_val_if_fail (ODS_IS_MANAGER (manager), FALSE); /* check target address validity */ str2ba (target_address, &dst); /* can be only real address */ valid = bachk (target_address) == 0 && bacmp (&dst, BDADDR_ANY) && bacmp (&dst, BDADDR_ALL); if (!valid) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid target Bluetooth address"); dbus_g_method_return_error (context, error); ret = FALSE; goto out; } /* check address validity */ str2ba (source_address, &src); /* can be real address or BDADDR_ANY */ valid = bachk (source_address) == 0 && bacmp (&src, BDADDR_ALL); if (!valid) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid source Bluetooth address"); dbus_g_method_return_error (context, error); ret = FALSE; goto out; } /* format of pattern at this point should be [:] */ parsed = g_strsplit (pattern, ":", 2); /* convert pattern to service and bluetooth UUID */ if (!string2service (parsed[0], &uuid, &service)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid pattern"); dbus_g_method_return_error (context, error); ret = FALSE; goto out; } /* determine target UUID according to service */ switch (service) { case ODS_SERVICE_FTP: target_uuid = OBEX_FTP_UUID; break; case ODS_SERVICE_PBAP: target_uuid = OBEX_PBAP_UUID; break; case ODS_SERVICE_BIP: if (!g_ascii_strcasecmp (bip_feature, ODS_MANAGER_BIP_IMAGEPUSH_STR)) { target_uuid = OBEX_BIP_IPUSH_UUID; imaging_feature = BIP_SUPP_FEAT_IMAGE_PUSH; } else if (!g_ascii_strcasecmp (bip_feature, ODS_MANAGER_BIP_REMOTEDISPLAY_STR)) { target_uuid = OBEX_BIP_RD_UUID; imaging_feature = BIP_SUPP_FEAT_REMOTE_DISPLAY; } else { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Unknown imaging feature"); dbus_g_method_return_error (context, error); ret = FALSE; goto out; } break; } /* Create a session object */ sender = dbus_g_method_get_sender (context); session = ods_session_new (-1, -1, service, sender, target_uuid); if (imaging_feature != 0) g_object_set (session, "imaging-feature", imaging_feature, NULL); g_object_get (session, "dbus-path", &session_object, NULL); /* connect Bluetooth transport (ods-bluez.c) */ OdsManagerCreateSessionData *cb_data;/* data to pass to callback */ cb_data = g_new0 (OdsManagerCreateSessionData, 1); cb_data->manager = manager; cb_data->session = session; /* start connecting socket for session */ if (parsed[0]) g_message ("Parsed[0]: %s", parsed[0]); if (parsed[1]) g_message ("Parsed[1]: %s", parsed[1]); cancel_data = ods_bluez_get_client_socket (&dst, &src, &uuid, imaging_feature, (g_strv_length (parsed)>1 ? atoi (parsed[1]) : 0), (OdsBluezFunc) client_socket_connected_cb, cb_data); ods_manager_session_list_add (cb_data->manager, cb_data->session, cancel_data, target_address, source_address, -1, NULL, sender, session_object); if (!cancel_data) { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, "Service search failed (%s)", strerror (errno)); client_socket_connected_cb (-1, -1, NULL, error, cb_data); /* SessionConnectError will be emitted immediately after session obj is returned */ } /* Return session object now, SessionConnected will be emitted when * session is fully connected */ dbus_g_method_return (context, session_object); g_free (sender); g_free (session_object); out: if (error) g_clear_error (&error); if (parsed) g_strfreev (parsed); return ret; } /** * ods_manager_create_bluetooth_session: * @manager: This class instance * @target_address: Bluetooth address of remote device to connect to * @source_address: Bluetooth address of local device (adapter) * @pattern: OBEX UUID (commonly "opp", "ftp", etc.) * * Creates and auto-connects Bluetooth session. * * Return value: **/ gboolean ods_manager_create_bluetooth_session (OdsManager *manager, const gchar *target_address, const gchar *source_address, const gchar *pattern, DBusGMethodInvocation *context) { return create_bluetooth_session_full (manager, target_address, source_address, pattern, NULL, context); } /** * ods_manager_create_usb_session: * @manager: This class instance * @interface_number: USB OBEX interface number to connect to * @pattern: service used (commonly "ftp") * * Creates and auto-connects USB session. * * Return value: **/ gboolean ods_manager_create_usb_session (OdsManager *manager, const gint interface_number, const gchar *pattern, DBusGMethodInvocation *context) { GError *error = NULL; gboolean ret = TRUE; OdsSession *session; gint service; gchar *target_uuid = NULL; gchar *sender; gchar *session_object; g_return_val_if_fail (manager != NULL, FALSE); g_return_val_if_fail (ODS_IS_MANAGER (manager), FALSE); if (interface_number < 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid USB interface number"); dbus_g_method_return_error (context, error); ret = FALSE; goto out; } /* convert pattern to service and bluetooth UUID */ if (!string2service (pattern, NULL, &service)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid pattern"); dbus_g_method_return_error (context, error); ret = FALSE; goto out; } /* FIXME detect unsuported services and error out */ if (service == ODS_SERVICE_FTP) target_uuid = OBEX_FTP_UUID; /* Create a session object */ sender = dbus_g_method_get_sender (context); session = ods_session_new (-1, -1, service, sender, target_uuid); g_object_get (session, "dbus-path", &session_object, NULL); ods_manager_session_list_add (manager, session, NULL, NULL, NULL, interface_number, NULL, sender, session_object); g_message ("Session created by: %s", sender); /* Connect to the session objects signals. */ g_signal_connect (session, "closed", G_CALLBACK (session_closed_cb), manager); g_signal_connect (session, "connect-result-internal", G_CALLBACK (session_connect_result_cb), manager); /* Set USB interface number. * The session will automatically do OBEX Connect */ g_object_set (session, "usbintfnum", interface_number, NULL); /* Return session object now, SessionConnected will be emitted when * session is fully connected */ dbus_g_method_return (context, session_object); g_free (sender); g_free (session_object); out: if (error) g_clear_error (&error); return ret; } static gboolean connect_tty_session (gpointer data) { OdsManagerCreateSessionData *cb_data = (OdsManagerCreateSessionData*) data; gint fd; gchar *session_object = NULL; GError *error = NULL; gchar *error_name = NULL; /* open tty device */ fd = tty_open (cb_data->tty_dev, &error); if (fd < 0) { g_object_get (cb_data->session, "dbus-path", &session_object, NULL); /* Could not connect, emit SessionConnectError */ error_name = ods_error_get_dbus_name (error); g_signal_emit (cb_data->manager, signals [SESSION_CONNECT_ERROR], 0, session_object, error_name, error->message); /* Finalize session object*/ session_closed_cb (cb_data->session, cb_data->manager); g_clear_error (&error); g_free (session_object); g_free (error_name); } else { /* Connect to the session objects signals. */ g_signal_connect (cb_data->session, "closed", G_CALLBACK (session_closed_cb), cb_data->manager); g_signal_connect (cb_data->session, "connect-result-internal", G_CALLBACK (session_connect_result_cb), cb_data->manager); g_object_set (cb_data->session, "fd", fd, NULL); } g_free (cb_data->tty_dev); g_free (cb_data); return FALSE; } gboolean ods_manager_create_tty_session (OdsManager *manager, const gchar *tty_dev, const gchar *pattern, DBusGMethodInvocation *context) { GError *error = NULL; OdsSession *session; gint service; gchar *target_uuid = NULL; gchar *sender = NULL; gchar *session_object = NULL; OdsManagerCreateSessionData *cb_data; g_return_val_if_fail (manager != NULL, FALSE); g_return_val_if_fail (ODS_IS_MANAGER (manager), FALSE); /* convert pattern to service and bluetooth UUID */ if (!string2service (pattern, NULL, &service)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid pattern"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* FIXME detect unsuported services and error out */ if (service == ODS_SERVICE_FTP) target_uuid = OBEX_FTP_UUID; /* Create a session object */ sender = dbus_g_method_get_sender (context); session = ods_session_new (-1, -1, service, sender, target_uuid); g_object_get (session, "dbus-path", &session_object, NULL); ods_manager_session_list_add (manager, session, NULL, NULL, NULL, -1, tty_dev, sender, session_object); g_message ("Session created by: %s", sender); /* connect will happen later in connect_tty_session */ cb_data = g_new0 (OdsManagerCreateSessionData, 1); cb_data->manager = manager; cb_data->session = session; cb_data->tty_dev = g_strdup (tty_dev); g_idle_add (connect_tty_session, cb_data); /* Return session object now, SessionConnected will be emitted when * session is fully connected */ dbus_g_method_return (context, session_object); g_free (sender); g_free (session_object); return TRUE; } /** * ods_manager_get_usb_interfaces_num: * @manager: This class instance * * Returns number of currently available USB OBEX interfaces * * Return value: **/ guint ods_manager_get_usb_interfaces_num (OdsManager *manager) { #ifdef USE_USB GList *list; guint num_interfaces; list = ods_usbobex_find_interfaces (); num_interfaces = g_list_length (list); ods_usbobex_free_interfaces (list); return num_interfaces; #else return 0; #endif /* USE_USB */ } /** * ods_manager_get_usb_interfaces_info: * @manager: This class instance * @interface_number: the number of interface to return information about * * Returns information about a specific USB USB OBEX interface * * Return value: **/ GHashTable * ods_manager_get_usb_interface_info (OdsManager *manager, const gint interface_number) { #ifdef USE_USB ods_usb_info *item; GList *list; #endif GHashTable *info; info = g_hash_table_new_full ((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal, NULL, (GDestroyNotify) g_free); #ifdef USE_USB list = ods_usbobex_find_interfaces(); item = g_list_nth_data (list, interface_number); if (item == NULL) { g_warning("No such USB interface, requested interface %d info", interface_number); return info; } g_message ("item->path %s", item->path); g_hash_table_insert (info, "Manufacturer", g_strdup (item->manufacturer)); g_hash_table_insert (info, "Product", g_strdup (item->product)); g_hash_table_insert (info, "Serial", g_strdup (item->serial)); g_hash_table_insert (info, "Configuration", g_strdup (item->configuration)); g_hash_table_insert (info, "ControlInterface", g_strdup (item->control_interface)); g_hash_table_insert (info, "DataInterfaceIdle", g_strdup (item->data_interface_idle)); g_hash_table_insert (info, "DataInterfaceActive", g_strdup (item->data_interface_active)); g_hash_table_insert (info, "Path", g_strdup (item->path)); ods_usbobex_free_interfaces (list); #endif /* USE_USB */ return info; } gboolean ods_manager_create_bluetooth_imaging_session (OdsManager *manager, const gchar *target_address, const gchar *source_address, const gchar *bip_feature, DBusGMethodInvocation *context) { gchar **parsed; gchar *pattern; gboolean ret; parsed = g_strsplit (bip_feature, ":", 2); if (g_strv_length (parsed)>1) pattern = g_strdup_printf (ODS_MANAGER_BIP_STR ":%s", parsed[1]); else pattern = g_strdup (ODS_MANAGER_BIP_STR); ret = create_bluetooth_session_full (manager, target_address, source_address, pattern, parsed[0], context); g_strfreev (parsed); g_free (pattern); return ret; } static gboolean cancel_session_connect (OdsManager *manager, OdsManagerSessionInfo *session_info) { if (session_info->bluetooth_cancel_data) { ods_bluez_cancel_get_client_socket (session_info->bluetooth_cancel_data); return TRUE; } /* for future reference: Check for other transports cancellables */ return FALSE; } gboolean ods_manager_cancel_session_connect (OdsManager *manager, const gchar *session_object) { OdsManagerSessionInfo *session_info; session_info = g_hash_table_lookup (manager->priv->session_list, session_object); if (!session_info) return FALSE; return cancel_session_connect (manager, session_info); } gboolean ods_manager_create_bluetooth_server (OdsManager *manager, const gchar *source_address, const gchar *pattern, gboolean require_pairing, DBusGMethodInvocation *context) { GError *error = NULL; gboolean valid; bdaddr_t bd_address; gint service; guint8 channel; gint fd; gint sockopt; OdsServer *server; gchar *sender; gchar *server_object; g_return_val_if_fail (manager != NULL, FALSE); g_return_val_if_fail (ODS_IS_MANAGER (manager), FALSE); /* check address validity */ str2ba (source_address, &bd_address); /* can be real address or BDADDR_ANY */ valid = bachk (source_address) == 0 && bacmp (&bd_address, BDADDR_ALL); if (!valid) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid Bluetooth address"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* check pattern validity (has to be supported/known service */ if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_FTP_STR)) { service = ODS_SERVICE_FTP; channel = ODS_FTP_RFCOMM_CHANNEL; } else if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_OPP_STR)) { service = ODS_SERVICE_OPP; channel = ODS_OPP_RFCOMM_CHANNEL; } else if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_PBAP_STR)) { service = ODS_SERVICE_PBAP; channel = ODS_PBAP_RFCOMM_CHANNEL; } else if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_BIP_STR)) { service = ODS_SERVICE_BIP; channel = ODS_BIP_RFCOMM_CHANNEL; } else { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid pattern"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* create server socket */ fd = ods_bluez_get_server_socket (source_address, channel); if (fd == -1) { /* could not create server socket */ g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not create server socket"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } g_message ("server socket created"); /* require_pairing */ if (require_pairing) { sockopt = RFCOMM_LM_AUTH | RFCOMM_LM_ENCRYPT; if (setsockopt (fd, SOL_RFCOMM, RFCOMM_LM, &sockopt, sizeof (sockopt)) < 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Setting RFCOMM link mode failed"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } } /* create server object and return it's object path */ sender = dbus_g_method_get_sender (context); g_message ("Server created by: %s", sender); server = ods_server_new (fd, service, sender); /* add server to server list */ g_object_get (server, "dbus-path", &server_object, NULL); ods_manager_server_list_add (manager, server, source_address, require_pairing, 0, NULL, sender, server_object); /* deal with signals */ g_signal_connect (server, "started", G_CALLBACK (server_started_cb), manager); g_signal_connect (server, "stopped", G_CALLBACK (server_stopped_cb), manager); g_signal_connect (server, "closed", G_CALLBACK (server_closed_cb), manager); /* return server object path */ dbus_g_method_return (context, server_object); g_free (sender); g_free (server_object); return TRUE; } gboolean ods_manager_create_tty_server (OdsManager *manager, const gchar *tty_dev, const gchar *pattern, DBusGMethodInvocation *context) { GError *error = NULL; gint service; gint fd; OdsServer *server; gchar *sender; gchar *server_object; g_return_val_if_fail (manager != NULL, FALSE); g_return_val_if_fail (ODS_IS_MANAGER (manager), FALSE); /* check pattern validity (has to be supported/known service */ if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_FTP_STR)) service = ODS_SERVICE_FTP; else if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_OPP_STR)) service = ODS_SERVICE_OPP; else if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_PBAP_STR)) service = ODS_SERVICE_PBAP; else if (!g_ascii_strcasecmp (pattern, ODS_MANAGER_BIP_STR)) service = ODS_SERVICE_BIP; else { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid pattern"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* open tty device */ fd = tty_open (tty_dev, &error); if (fd < 0) { dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* create server object and return it's object path */ sender = dbus_g_method_get_sender (context); g_message ("Server created by: %s", sender); server = ods_server_new (fd, service, sender); g_object_set (server, "tty-dev", tty_dev, NULL); /* add server to server list */ g_object_get (server, "dbus-path", &server_object, NULL); ods_manager_server_list_add (manager, server, NULL, FALSE, 0, tty_dev, sender, server_object); /* deal with signals */ g_signal_connect (server, "started", G_CALLBACK (server_started_cb), manager); g_signal_connect (server, "stopped", G_CALLBACK (server_stopped_cb), manager); g_signal_connect (server, "closed", G_CALLBACK (server_closed_cb), manager); /* return server object path */ dbus_g_method_return (context, server_object); g_free (sender); g_free (server_object); return TRUE; } GHashTable * ods_manager_get_session_info (OdsManager *manager, gchar *session_object) { GHashTable *info; OdsManagerSessionInfo *session_info; info = g_hash_table_new ((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal); session_info = g_hash_table_lookup (manager->priv->session_list, session_object); if (session_info) { if (session_info->bluetooth_target_address) { g_hash_table_insert (info, "BluetoothTargetAddress", g_strdup (session_info->bluetooth_target_address)); g_hash_table_insert (info, "BluetoothSourceAddress", g_strdup (session_info->bluetooth_source_address)); g_hash_table_insert (info, "BluetoothChannel", g_strdup_printf ("%d", session_info->bluetooth_channel)); } if (session_info->usb_interface_number > 0) { g_hash_table_insert (info, "UsbInterfaceNumber", g_strdup_printf ("%d", session_info->usb_interface_number)); } if (session_info->tty_dev) { g_hash_table_insert (info, "TTYDevice", g_strdup (session_info->tty_dev)); } } return info; } GHashTable * ods_manager_get_server_info (OdsManager *manager, gchar *server_object) { GHashTable *info; OdsManagerServerInfo *server_info; info = g_hash_table_new ((GHashFunc)g_str_hash, (GEqualFunc)g_str_equal); server_info = g_hash_table_lookup (manager->priv->server_list, server_object); if (server_info) { if (server_info->bluetooth_source_address) { g_hash_table_insert (info, "BluetoothSourceAddress", g_strdup (server_info->bluetooth_source_address)); g_hash_table_insert (info, "RequirePairing", g_strdup (server_info->require_pairing ? "True": "False")); } if (server_info->tty_dev) { g_hash_table_insert (info, "TTYDevice", g_strdup (server_info->tty_dev)); } } return info; } gchar** ods_manager_get_session_list (OdsManager *manager) { return ods_hash_table_keys2strv (manager->priv->session_list); } gchar** ods_manager_get_server_list (OdsManager *manager) { return ods_hash_table_keys2strv (manager->priv->server_list); } gchar* ods_manager_get_version (OdsManager *manager) { return g_strdup_printf ("%s:%d", PACKAGE_VERSION, ODS_API_VERSION); } /** * ods_manager_class_init: * @klass: The OdsManagerClass **/ static void ods_manager_class_init (OdsManagerClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = ods_manager_finalize; signals [SESSION_CONNECTED] = g_signal_new ("session-connected", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsManagerClass, session_connected), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, DBUS_TYPE_G_OBJECT_PATH); signals [SESSION_CLOSED] = g_signal_new ("session-closed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsManagerClass, session_closed), NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, DBUS_TYPE_G_OBJECT_PATH); signals [SESSION_CONNECT_ERROR] = g_signal_new ("session-connect-error", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsManagerClass, session_connect_error), NULL, NULL, ods_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, 3, DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING, G_TYPE_STRING); signals [DISPOSED] = g_signal_new ("disposed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsManagerClass, disposed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); g_type_class_add_private (klass, sizeof (OdsManagerPrivate)); GError *error = NULL; /* Init the DBus connection, per-klass */ klass->connection = dbus_g_bus_get (ODS_DBUS_BUS, &error); if (klass->connection == NULL) { g_warning("Unable to connect to dbus: %s", error->message); g_clear_error (&error); return; } /* &dbus_glib_ods_manager_object_info is provided in the * dbus/ods-manager-dbus-glue.h file */ dbus_g_object_type_install_info (ODS_TYPE_MANAGER, &dbus_glib_ods_manager_object_info); /* also register global error domain */ dbus_g_error_domain_register (ODS_ERROR, ODS_ERROR_DBUS_INTERFACE, ODS_TYPE_ERROR); } /** * ods_manager_init: * @manager: This class instance **/ static void ods_manager_init (OdsManager *manager) { OdsManagerClass *klass = ODS_MANAGER_GET_CLASS (manager); manager->priv = ODS_MANAGER_GET_PRIVATE (manager); manager->priv->session_list = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) ods_manager_session_info_free); manager->priv->server_list = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) ods_manager_server_info_free); manager->priv->initialized = TRUE;/* For future use */ manager->priv->dbus_proxy = dbus_g_proxy_new_for_name (klass->connection, DBUS_SERVICE_DBUS, DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS); dbus_g_proxy_add_signal (manager->priv->dbus_proxy, "NameOwnerChanged", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (manager->priv->dbus_proxy, "NameOwnerChanged", G_CALLBACK (dbus_name_owner_changed_cb), manager, NULL); manager->priv->listened_dbus_names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_hash_table_unref); manager->priv->removed_dbus_names = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); dbus_g_connection_register_g_object (klass->connection, ODS_MANAGER_DBUS_PATH, G_OBJECT (manager)); } static gboolean ods_manager_session_finalize (gpointer key, OdsManagerSessionInfo *session_info, OdsManager *manager) { g_message ("attempting to close session"); /* If session is being connected, cancel */ if (cancel_session_connect (manager, session_info)) return TRUE; /* Finalize already connected session */ g_signal_connect (session_info->session, "cancelled", G_CALLBACK (session_cancelled_cb), manager); ods_session_cancel_internal (session_info->session); /* Even if there was nothing to cancel, we will get * CANCELLED signal and disconnection will happen in * session_cancelled_cb */ return TRUE; } static gboolean ods_manager_server_finalize (gpointer key, OdsManagerServerInfo *server_info, OdsManager *manager) { OdsServer *server = server_info->server; /* STOPPED signal will not be emitted, call teh callback now */ server_stopped_cb (server, manager); g_signal_connect (server, "disposed", G_CALLBACK (server_disposed_cb), manager); ods_server_dispose (server); return TRUE; } void ods_manager_dispose (OdsManager *manager) { g_return_if_fail (manager != NULL); g_return_if_fail (ODS_IS_MANAGER (manager)); g_return_if_fail (manager->priv != NULL); if (manager->priv->disposed) return; g_message ("Disposing manager"); manager->priv->is_disposing = TRUE; /* check if there is nothing to dispose */ if (g_hash_table_size (manager->priv->listened_dbus_names) == 0) { g_message ("Manager disposed at once"); manager->priv->disposed = TRUE; g_signal_emit (manager, signals [DISPOSED], 0); } else { g_hash_table_foreach_remove (manager->priv->session_list, (GHRFunc) ods_manager_session_finalize, manager); g_hash_table_foreach_remove (manager->priv->server_list, (GHRFunc) ods_manager_server_finalize, manager); } } /** * ods_manager_finalize: * @object: The object to finalize * * Finalise the manager, by unref'ing all the depending modules. **/ static void ods_manager_finalize (GObject *object) { OdsManager *manager; g_return_if_fail (object != NULL); g_return_if_fail (ODS_IS_MANAGER (object)); manager = ODS_MANAGER (object); g_return_if_fail (manager->priv != NULL); g_return_if_fail (manager->priv->disposed); g_message ("Finalizing manager"); ods_bluez_finalize(); g_hash_table_unref (manager->priv->listened_dbus_names); g_hash_table_unref (manager->priv->session_list); g_hash_table_unref (manager->priv->server_list); g_object_unref (G_OBJECT (manager->priv->dbus_proxy)); G_OBJECT_CLASS (ods_manager_parent_class)->finalize (object); } /** * ods_manager_new: * * Return value: a new OdsManager object. **/ OdsManager * ods_manager_new (void) { OdsManager *manager; manager = g_object_new (ODS_TYPE_MANAGER, NULL); return ODS_MANAGER (manager); } /** * ods_manager_is_initialized: * @manager: OdsManager instance * * Checks if object was initialized succesfully. Might not be initialized * if OdsBluez was not initialized successfully * * Return value: TRUE for success, FALSE otherwise. **/ gboolean ods_manager_is_initialized (OdsManager *manager) { return manager->priv->initialized; } obex-data-server-0.4.6/src/ods-manager.h0000644000175000017500000001103411524724173014754 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_MANAGER_H #define __ODS_MANAGER_H #include #include #include "ods-common.h" G_BEGIN_DECLS #define ODS_MANAGER_DBUS_PATH "/org/openobex" #define ODS_MANAGER_DBUS_INTERFACE "org.openobex.Manager" #define ODS_MANAGER_OPP_STR "opp" #define ODS_MANAGER_FTP_STR "ftp" #define ODS_MANAGER_PBAP_STR "pbap" #define ODS_MANAGER_BIP_STR "bip" #define ODS_MANAGER_BIP_IMAGEPUSH_STR "imagepush" #define ODS_MANAGER_BIP_REMOTEDISPLAY_STR "remotedisplay" #define ODS_TYPE_MANAGER (ods_manager_get_type ()) #define ODS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ODS_TYPE_MANAGER, OdsManager)) #define ODS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ODS_TYPE_MANAGER, OdsManagerClass)) #define ODS_IS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ODS_TYPE_MANAGER)) #define ODS_IS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ODS_TYPE_MANAGER)) #define ODS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ODS_TYPE_MANAGER, OdsManagerClass)) typedef struct OdsManagerPrivate OdsManagerPrivate; typedef struct { GObject parent; OdsManagerPrivate *priv; } OdsManager; typedef struct { GObjectClass parent_class; void (* session_connected) (OdsManager *manager, const gchar *session_object); void (* session_closed) (OdsManager *manager, const gchar *session_object); void (* session_connect_error)(OdsManager *manager, const gchar *session_object, const gchar *error_name, const gchar *error_message); void (* disposed) (OdsManager *manager); DBusGConnection *connection; } OdsManagerClass; GType ods_manager_get_type (void); OdsManager *ods_manager_new (void); gboolean ods_manager_is_initialized (OdsManager *manager); gboolean ods_manager_create_bluetooth_session (OdsManager *manager, const gchar *target_address, const gchar *source_address, const gchar *pattern, DBusGMethodInvocation *context); gboolean ods_manager_create_bluetooth_imaging_session (OdsManager *manager, const gchar *target_address, const gchar *source_address, const gchar *bip_feature, DBusGMethodInvocation *context); gboolean ods_manager_create_usb_session (OdsManager *manager, const gint interface_number, const gchar *pattern, DBusGMethodInvocation *context); gboolean ods_manager_create_tty_session (OdsManager *manager, const gchar *tty_dev, const gchar *pattern, DBusGMethodInvocation *context); guint ods_manager_get_usb_interfaces_num (OdsManager *manager); GHashTable *ods_manager_get_usb_interface_info (OdsManager *manager, const gint interface_number); gboolean ods_manager_cancel_session_connect (OdsManager *manager, const gchar *session_object); gboolean ods_manager_create_bluetooth_server (OdsManager *manager, const gchar *source_address, const gchar *pattern, gboolean require_pairing, DBusGMethodInvocation *context); gboolean ods_manager_create_tty_server (OdsManager *manager, const gchar *tty_dev, const gchar *pattern, DBusGMethodInvocation *context); void ods_manager_dispose (OdsManager *manager); GHashTable *ods_manager_get_session_info (OdsManager *manager, gchar *session_object); GHashTable *ods_manager_get_server_info (OdsManager *manager, gchar *server_object); gchar **ods_manager_get_session_list (OdsManager *manager); gchar **ods_manager_get_server_list (OdsManager *manager); gchar *ods_manager_get_version (OdsManager *manager); G_END_DECLS #endif /* __ODS_MANAGER_H */ obex-data-server-0.4.6/src/ods-imaging-helpers.c0000644000175000017500000005770411524724173016426 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #ifdef USE_IMAGEMAGICK #include #endif #ifdef USE_GDKPIXBUF #include #endif #include "ods-common.h" #include "ods-imaging-helpers.h" #define ODS_IMAGING_FILL_COLOR "#FFFFFF" #define ODS_IMAGING_FILL_COLOR_RGBA 0xFFFFFFFF #define ODS_IMAGING_TEMPNAME "ods_imageXXXXXX" /* constants for generating XML */ #define IMG_DESCRIPTOR "" EOL_CHARS #define IMG_DESCRIPTOR_IMG_SIZE "size=\"%" G_GUINT64_FORMAT "\" " #define IMG_DESCRIPTOR_IMG_TRANSFORMATION "transformation=\"%s\" " #define IMG_DESCRIPTOR_IMG "" EOL_CHARS #define IMG_DESCRIPTOR_END "" EOL_CHARS #define ATT_DESCRIPTOR "" EOL_CHARS #define ATT_DESCRIPTOR_ATT_CONTENT_TYPE "content-type=\"%s\" " #define ATT_DESCRIPTOR_ATT_CHARSET "charset=\"%s\" " #define ATT_DESCRIPTOR_ATT_CREATED "created=\"%s\" " #define ATT_DESCRIPTOR_ATT "" EOL_CHARS #define ATT_DESCRIPTOR_END "" EOL_CHARS typedef struct OdsImagingCallbackData_ { OdsImagingFunc func; OdsImageInfo *data; gpointer user_data; } OdsImagingCallbackData; /* constants for parsing XML */ #define IMG_ELEMENT "image" #define ATT_ELEMENT "attachment" typedef struct OdsImgDescriptorParse_ { /* Used for Image and Attachment descriptors */ gchar **encoding; gchar **pixel; guint64 *size; gchar **transformation; /* attachment specific */ gchar **name; gchar **content_type; gchar **charset; gchar **created; } OdsImgDescriptorParse; /* encoding, pixel and transformation can be empty but must not be NULL */ gchar* get_image_descriptor (const gchar *encoding, const gchar *pixel, guint64 size, const gchar *transformation) { GString *descriptor; GString *descriptor_optional; gchar *descriptor_optional_chr; g_assert (encoding && pixel && transformation); descriptor = g_string_new (""); descriptor_optional = g_string_new (""); descriptor = g_string_append (descriptor, IMG_DESCRIPTOR); if (size > 0) g_string_append_printf (descriptor_optional, IMG_DESCRIPTOR_IMG_SIZE, size); if (*transformation != '\0') g_string_append_printf (descriptor_optional, IMG_DESCRIPTOR_IMG_TRANSFORMATION, transformation); descriptor_optional_chr = g_string_free (descriptor_optional, FALSE); g_string_append_printf (descriptor, IMG_DESCRIPTOR_IMG, encoding, pixel, descriptor_optional_chr); descriptor = g_string_append (descriptor, IMG_DESCRIPTOR_END); g_free (descriptor_optional_chr); return g_string_free (descriptor, FALSE); } /* content_type, charset and created can be empty but must not be NULL */ gchar* get_attachment_descriptor (const gchar *name, guint64 size, const gchar *content_type, const gchar *charset, const gchar *created) { GString *descriptor; GString *descriptor_optional; gchar *descriptor_optional_chr; g_assert (name && content_type && charset && created); descriptor = g_string_new (""); descriptor_optional = g_string_new (""); descriptor = g_string_append (descriptor, ATT_DESCRIPTOR); if (*content_type != '\0') g_string_append_printf (descriptor_optional, ATT_DESCRIPTOR_ATT_CONTENT_TYPE, content_type); if (*charset != '\0') g_string_append_printf (descriptor_optional, ATT_DESCRIPTOR_ATT_CHARSET, charset); if (*created != '\0') g_string_append_printf (descriptor_optional, ATT_DESCRIPTOR_ATT_CREATED, created); descriptor_optional_chr = g_string_free (descriptor_optional, FALSE); g_string_append_printf (descriptor, ATT_DESCRIPTOR_ATT, name, size, descriptor_optional_chr); descriptor = g_string_append (descriptor, ATT_DESCRIPTOR_END); g_free (descriptor_optional_chr); return g_string_free (descriptor, FALSE); } static void img_parse_element_start (GMarkupParseContext *context, const gchar *element_name, const gchar **attribute_names, const gchar **attribute_values, gpointer data, GError **error) { OdsImgDescriptorParse *out_vars; gboolean ret; const gchar *size_str = NULL; out_vars = (OdsImgDescriptorParse*)data; if (g_ascii_strncasecmp (element_name, IMG_ELEMENT, strlen (element_name)) && g_ascii_strncasecmp (element_name, ATT_ELEMENT, strlen (element_name))) { /* we are only parsing and elements */ return; } ret = g_markup_collect_attributes (element_name, attribute_names, attribute_values, error, /* encoding */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "encoding", out_vars->encoding, /* pixel */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "pixel", out_vars->pixel, /* size */ G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "size", &size_str, /* maxsize (ignore) */ G_MARKUP_COLLECT_STRING | G_MARKUP_COLLECT_OPTIONAL, "maxsize", NULL, /* transformation */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "transformation", out_vars->transformation, /* name */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "name", out_vars->name, /* content_type */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "content-type", out_vars->content_type, /* charset */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "charset", out_vars->charset, /* created */ G_MARKUP_COLLECT_STRDUP | G_MARKUP_COLLECT_OPTIONAL, "created", out_vars->created, G_MARKUP_COLLECT_INVALID); if (!ret) g_message ("Parsing descriptor XML data element failed"); if (size_str) *(out_vars->size) = g_ascii_strtoull (size_str, NULL, 10); } static void parse_descriptor (const gchar *descriptor, OdsImgDescriptorParse *out_vars) { GMarkupParser *parser; GMarkupParseContext *parse_ctx; gboolean ret; GError *error = NULL; g_assert (descriptor); parser = g_new0 (GMarkupParser, 1); parser->start_element = img_parse_element_start; parse_ctx = g_markup_parse_context_new (parser, 0, out_vars, NULL); ret = g_markup_parse_context_parse (parse_ctx, descriptor, strlen (descriptor), &error); /* parsing error is not fatal, * we can continue without data provided in descriptor */ if (!ret) { g_message ("Failed to parse descriptor XML data (%s)", error->message); g_clear_error (&error); } else { ret = g_markup_parse_context_end_parse (parse_ctx, &error); if (!ret) { g_message ("Failed to parse descriptor XML data (%s)", error->message); g_clear_error (&error); } } g_markup_parse_context_free (parse_ctx); g_free (parser); } void parse_image_descriptor (const gchar *descriptor, gchar **encoding, gchar **pixel, guint64 *size, gchar **transformation) { OdsImgDescriptorParse *out_vars; g_assert (encoding && pixel && size && transformation); out_vars = g_new0 (OdsImgDescriptorParse, 1); out_vars->encoding = encoding; out_vars->pixel = pixel; out_vars->size = size; out_vars->transformation = transformation; parse_descriptor (descriptor, out_vars); g_free (out_vars); } void parse_attachment_descriptor (const gchar *descriptor, gchar **name, guint64 *size, gchar **content_type, gchar **charset, gchar **created) { OdsImgDescriptorParse *out_vars; g_assert (name && size && content_type && charset && created); out_vars = g_new0 (OdsImgDescriptorParse, 1); out_vars->name = name; out_vars->size = size; out_vars->content_type = content_type; out_vars->charset = charset; out_vars->created = created; parse_descriptor (descriptor, out_vars); g_free (out_vars); } void ods_image_info_free (OdsImageInfo *info) { if (info->filename) g_free (info->filename); if (info->resized_image_filename) g_free (info->resized_image_filename); if (info->encoding) g_free (info->encoding); g_free (info); } gchar* ods_imaging_get_pixel_string (gulong width, gulong height) { return g_strdup_printf ("%lu*%lu", width, height); } const gchar* ods_imaging_get_transformation_string (guint transformation) { switch (transformation) { case ODS_IMAGING_TRANSFORMATION_STRETCH: return ODS_IMAGING_TRANSFORMATION_STRETCH_STR; case ODS_IMAGING_TRANSFORMATION_CROP: return ODS_IMAGING_TRANSFORMATION_CROP_STR; case ODS_IMAGING_TRANSFORMATION_FILL: return ODS_IMAGING_TRANSFORMATION_FILL_STR; default: return ""; } } guint ods_imaging_get_transformation (const gchar *trans) { if (!g_ascii_strcasecmp (trans, ODS_IMAGING_TRANSFORMATION_STRETCH_STR)) return ODS_IMAGING_TRANSFORMATION_STRETCH; if (!g_ascii_strcasecmp (trans, ODS_IMAGING_TRANSFORMATION_CROP_STR)) return ODS_IMAGING_TRANSFORMATION_CROP; if (!g_ascii_strcasecmp (trans, ODS_IMAGING_TRANSFORMATION_FILL_STR)) return ODS_IMAGING_TRANSFORMATION_FILL; return 0; } #if defined(USE_IMAGEMAGICK) || defined (USE_GDKPIXBUF) static gboolean ods_imaging_thread_callback (OdsImagingCallbackData *cb_data) { cb_data->func (cb_data->data, cb_data->user_data); return FALSE; } #endif /* USE_IMAGEMAGICK || USE_GDKPIXBUF */ #ifdef USE_IMAGEMAGICK static void ods_imaging_get_image_info (OdsImagingCallbackData *cb_data) { MagickBooleanType wand_ret; MagickWand *magick_wand; OdsImageInfo *image_info; struct stat file_stat; image_info = cb_data->data; MagickWandGenesis (); magick_wand = NewMagickWand (); /* read the image */ wand_ret = MagickReadImage (magick_wand, image_info->filename); if (wand_ret == MagickFalse) goto out; /* get info */ image_info->width = MagickGetImageWidth (magick_wand); image_info->height = MagickGetImageHeight (magick_wand); image_info->encoding = MagickGetImageFormat (magick_wand); if (g_stat (image_info->filename, &file_stat) == 0) image_info->size = file_stat.st_size; out: magick_wand = DestroyMagickWand (magick_wand); MagickWandTerminus (); g_idle_add ((GSourceFunc)ods_imaging_thread_callback, cb_data); } static void ods_imaging_resize_image (OdsImagingCallbackData *cb_data) { OdsImageInfo *info; MagickBooleanType ret; MagickWand *magick_wand; gchar *current_encoding = NULL; gulong current_width = 0; gulong current_height = 0; gboolean do_resize; gboolean do_encode; struct stat file_stat; g_message("resize_image thread started"); info = cb_data->data; MagickWandGenesis (); magick_wand = NewMagickWand (); /* read the image */ ret = MagickReadImage (magick_wand, info->filename); if (ret == MagickFalse) goto out; /* get image info and determine what we need to do */ current_encoding = MagickGetImageFormat (magick_wand); current_width = MagickGetImageWidth (magick_wand); current_height = MagickGetImageHeight (magick_wand); do_encode = info->encoding && strcmp (info->encoding, current_encoding); do_resize = (info->width != current_width) || (info->height != current_height); /* resize image if needed */ if (do_resize) { if (info->transformation == ODS_IMAGING_TRANSFORMATION_CROP) { /* Transformation CROP */ if (info->width > current_width || info->height > current_height) info->transformation = ODS_IMAGING_TRANSFORMATION_STRETCH; else { ret = MagickCropImage (magick_wand, info->width, info->height, 0, 0); if (ret == MagickFalse) goto out; } } else if (info->transformation == ODS_IMAGING_TRANSFORMATION_FILL) { /* Transformation FILL */ if (info->width < current_width || info->height < current_height) info->transformation = ODS_IMAGING_TRANSFORMATION_STRETCH; else { MagickWand *composite_wand; PixelWand *pixel_wand; composite_wand = magick_wand; magick_wand = NewMagickWand (); pixel_wand = NewPixelWand (); PixelSetColor (pixel_wand, ODS_IMAGING_FILL_COLOR); ret = MagickNewImage (magick_wand, info->width, info->height, pixel_wand); if (!info->encoding) info->encoding = current_encoding; do_encode = TRUE; DestroyPixelWand (pixel_wand); if (ret == MagickFalse) { DestroyMagickWand (composite_wand); goto out; } ret = MagickCompositeImage (magick_wand, composite_wand, SrcOverCompositeOp, 0, 0); DestroyMagickWand (composite_wand); if (ret == MagickFalse) goto out; } } if (info->transformation == ODS_IMAGING_TRANSFORMATION_STRETCH) { ret = MagickThumbnailImage (magick_wand, info->width, info->height); if (ret == MagickFalse) goto out; } } /* encode image if needed */ if (do_encode) { ret = MagickSetImageFormat (magick_wand, info->encoding); if (ret == MagickFalse) goto out; } /* write resized/encoded image to file */ if (do_resize || do_encode) { GError *error = NULL; gint fd; fd = g_file_open_tmp (ODS_IMAGING_TEMPNAME, &(info->resized_image_filename), &error); if (fd == -1) { g_clear_error (&error); g_free (info->resized_image_filename); info->resized_image_filename = NULL; goto out; } close (fd);/* Do this roundtrip because MagickWriteImageFile is buggy */ ret = MagickWriteImage (magick_wand, info->resized_image_filename); if (ret == MagickFalse) { g_free (info->resized_image_filename); info->resized_image_filename = NULL; goto out; } /* get resized image size */ if (g_stat (info->resized_image_filename, &file_stat) == 0) info->size = file_stat.st_size; } else { /* no operations needed to be done, return original filename */ info->resized_image_filename = g_strdup (info->filename); } out: if (current_encoding) g_free (current_encoding); magick_wand = DestroyMagickWand (magick_wand); MagickWandTerminus (); g_idle_add ((GSourceFunc)ods_imaging_thread_callback, cb_data); g_message ("resize_image thread finished, adding callback to idle"); } #endif /* USE_IMAGEMAGICK */ #ifdef USE_GDKPIXBUF static char * format_to_encoding (GdkPixbufFormat *format) { char *name, *encoding; name = gdk_pixbuf_format_get_name (format); encoding = g_ascii_strup (name, -1); g_free (name); return encoding; } static const char * encoding_to_pixbuf_format (const char *encoding) { /* FIXME should we check the output of gdk_pixbuf_get_formats() * and gdk_pixbuf_format_is_writable() instead? */ if (strcmp (encoding, "JPEG") == 0) return "jpeg"; if (strcmp (encoding, "PNG") == 0) return "png"; if (strcmp (encoding, "BMP") == 0) return "bmp"; return NULL; } static GdkPixbuf * ods_imaging_pixbuf_new_with_format (const char *filename, char **encoding) { GdkPixbuf *pixbuf; GMappedFile *file; GdkPixbufLoader *loader; GdkPixbufFormat *format; file = g_mapped_file_new (filename, FALSE, NULL); if (file == NULL) return NULL; loader = gdk_pixbuf_loader_new (); if (gdk_pixbuf_loader_write (loader, (guchar *) g_mapped_file_get_contents (file), g_mapped_file_get_length (file), NULL) == FALSE) { g_mapped_file_free (file); g_object_unref (loader); return NULL; } g_mapped_file_free (file); if (gdk_pixbuf_loader_close (loader, NULL) == FALSE) { g_object_unref (loader); return NULL; } format = gdk_pixbuf_loader_get_format (loader); *encoding = format_to_encoding (format); pixbuf = g_object_ref (gdk_pixbuf_loader_get_pixbuf (loader)); g_object_unref (loader); return pixbuf; } static void ods_imaging_get_image_info (OdsImagingCallbackData *cb_data) { GdkPixbuf *pixbuf; OdsImageInfo *image_info; struct stat file_stat; image_info = cb_data->data; g_type_init (); pixbuf = ods_imaging_pixbuf_new_with_format (image_info->filename, &image_info->encoding); if (pixbuf == NULL) goto out; /* get info */ image_info->width = gdk_pixbuf_get_width (pixbuf); image_info->height = gdk_pixbuf_get_height (pixbuf); if (g_stat (image_info->filename, &file_stat) == 0) image_info->size = file_stat.st_size; g_object_unref (pixbuf); out: g_idle_add ((GSourceFunc)ods_imaging_thread_callback, cb_data); } static void ods_imaging_resize_image (OdsImagingCallbackData *cb_data) { OdsImageInfo *info; GdkPixbuf *pixbuf; gchar *current_encoding = NULL; gulong current_width = 0; gulong current_height = 0; gboolean do_resize; gboolean do_encode; const char *format; struct stat file_stat; g_message("resize_image thread started"); info = cb_data->data; g_type_init (); /* read the image */ pixbuf = ods_imaging_pixbuf_new_with_format (info->filename, ¤t_encoding); if (pixbuf == NULL) goto out; /* get image info and determine what we need to do */ current_width = gdk_pixbuf_get_width (pixbuf); current_height = gdk_pixbuf_get_height (pixbuf); do_encode = info->encoding && strcmp (info->encoding, current_encoding); format = encoding_to_pixbuf_format (info->encoding); if (format == NULL) goto out; do_resize = (info->width != current_width) || (info->height != current_height); /* resize image if needed */ if (do_resize) { if (info->transformation == ODS_IMAGING_TRANSFORMATION_CROP) { /* Transformation CROP */ if (info->width > current_width || info->height > current_height) info->transformation = ODS_IMAGING_TRANSFORMATION_STRETCH; else { GdkPixbuf *new; new = gdk_pixbuf_new_subpixbuf (pixbuf, 0, 0, info->width, info->height); g_object_unref (pixbuf); pixbuf = new; } } else if (info->transformation == ODS_IMAGING_TRANSFORMATION_FILL) { /* Transformation FILL */ if (info->width < current_width || info->height < current_height) info->transformation = ODS_IMAGING_TRANSFORMATION_STRETCH; else { GdkPixbuf *blank, *new; blank = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, info->width, info->height); new = gdk_pixbuf_add_alpha (blank, FALSE, 0, 0, 0); g_object_unref (blank); gdk_pixbuf_fill (new, ODS_IMAGING_FILL_COLOR_RGBA); gdk_pixbuf_copy_area (pixbuf, 0, 0, current_width, current_height, new, 0, 0); g_object_unref (pixbuf); pixbuf = new; } } if (info->transformation == ODS_IMAGING_TRANSFORMATION_STRETCH) { GdkPixbuf *new; new = gdk_pixbuf_scale_simple (pixbuf, info->width, info->height, GDK_INTERP_BILINEAR); g_object_unref (pixbuf); pixbuf = new; } } /* write resized/encoded image to file */ if (do_resize || do_encode) { GError *error = NULL; gint fd; fd = g_file_open_tmp (ODS_IMAGING_TEMPNAME, &(info->resized_image_filename), &error); if (fd == -1) { g_clear_error (&error); g_free (info->resized_image_filename); info->resized_image_filename = NULL; goto out; } close (fd); if (gdk_pixbuf_save (pixbuf, info->resized_image_filename, format, NULL, NULL) == FALSE) { g_free (info->resized_image_filename); info->resized_image_filename = NULL; goto out; } /* get resized image size */ if (g_stat (info->resized_image_filename, &file_stat) == 0) info->size = file_stat.st_size; } else { /* no operations needed to be done, return original filename */ info->resized_image_filename = g_strdup (info->filename); } out: if (current_encoding) g_free (current_encoding); if (pixbuf != NULL) g_object_unref (pixbuf); g_idle_add ((GSourceFunc)ods_imaging_thread_callback, cb_data); g_message ("resize_image thread finished, adding callback to idle"); } #endif /* USE_GDKPIXBUF */ gboolean ods_imaging_get_image_info_async (const gchar *filename, OdsImagingFunc func, gpointer data) { #if defined(USE_IMAGEMAGICK) || defined(USE_GDKPIXBUF) OdsImageInfo *image_info; OdsImagingCallbackData *cb_data; image_info = g_new0 (OdsImageInfo, 1); image_info->filename = g_strdup (filename); cb_data = g_new0 (OdsImagingCallbackData, 1); cb_data->func = func; cb_data->data = image_info; cb_data->user_data = data; if (!g_thread_create ((GThreadFunc)ods_imaging_get_image_info, cb_data, FALSE, NULL)) { g_warning ("Thread creation failed"); g_free (cb_data->data); g_free (cb_data); return FALSE; } return TRUE; #else return FALSE; #endif /* USE_IMAGEMAGICK || USE_GDKPIXBUF */ } /* encoding can be NULL, otherwise it must be UPPERCASE * transformation can be 0 (no resizing done) */ gboolean ods_imaging_resize_image_async (const gchar *filename, gulong width, gulong height, const gchar *encoding, guint transformation, OdsImagingFunc func, gpointer data) { #if defined(USE_IMAGEMAGICK) || defined (USE_GDKPIXBUF) OdsImageInfo *image_info; OdsImagingCallbackData *cb_data; g_message ("resize_image_async"); image_info = g_new0 (OdsImageInfo, 1); image_info->filename = g_strdup (filename); image_info->width = width; image_info->height = height; if (encoding) image_info->encoding = g_strdup (encoding); image_info->transformation = transformation; cb_data = g_new0 (OdsImagingCallbackData, 1); cb_data->func = func; cb_data->data = image_info; cb_data->user_data = data; if (!g_thread_create ((GThreadFunc)ods_imaging_resize_image, cb_data, FALSE, NULL)) { g_warning ("Thread creation failed"); g_free (cb_data->data); g_free (cb_data); return FALSE; } return TRUE; #else return FALSE; #endif /* USE_IMAGEMAGICK || USE_GDKPIXBUF */ } gboolean ods_imaging_make_image_thumbnail_async (const gchar *filename, OdsImagingFunc func, gpointer data) { return ods_imaging_resize_image_async (filename, ODS_IMAGING_THUMBNAIL_WIDTH, ODS_IMAGING_THUMBNAIL_HEIGHT, ODS_IMAGING_THUMBNAIL_ENCODING, ODS_IMAGING_TRANSFORMATION_STRETCH, func, data); } obex-data-server-0.4.6/src/ods-bluez.h0000644000175000017500000000723511524724173014473 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_BLUEZ_H #define __ODS_BLUEZ_H #include #include /* BIP SDP record bits */ #define BIP_SUPP_CAP_GENERIC_IMAGING (1) #define BIP_SUPP_CAP_CAPTURING (1 << 1) #define BIP_SUPP_CAP_PRINTING (1 << 2) #define BIP_SUPP_CAP_DISPLAYING (1 << 3) #define BIP_SUPP_FEAT_IMAGE_PUSH (1) #define BIP_SUPP_FEAT_IMAGE_PUSH_STORE (1 << 1) #define BIP_SUPP_FEAT_IMAGE_PUSH_PRINT (1 << 2) #define BIP_SUPP_FEAT_IMAGE_PUSH_DISPLAY (1 << 3) #define BIP_SUPP_FEAT_IMAGE_PULL (1 << 4) #define BIP_SUPP_FEAT_ADVANCED_IMAGE_PRINTING (1 << 5) #define BIP_SUPP_FEAT_AUTOMATIC_ARCHIVE (1 << 6) #define BIP_SUPP_FEAT_REMOTE_CAMERA (1 << 7) #define BIP_SUPP_FEAT_REMOTE_DISPLAY (1 << 8) #define BIP_SUPP_FUNC_GET_CAPABILITIES (1) #define BIP_SUPP_FUNC_PUT_IMAGE (1 << 1) #define BIP_SUPP_FUNC_PUT_LINKED_ATTACHMENT (1 << 2) #define BIP_SUPP_FUNC_PUT_LINKED_THUMBNAIL (1 << 3) #define BIP_SUPP_FUNC_REMOTE_DISPLAY (1 << 4) #define BIP_SUPP_FUNC_GET_IMAGES_LIST (1 << 5) #define BIP_SUPP_FUNC_GET_IMAGE_PROPERTIES (1 << 6) #define BIP_SUPP_FUNC_GET_IMAGE (1 << 7) #define BIP_SUPP_FUNC_GET_LINKED_THUMBNAIL (1 << 8) #define BIP_SUPP_FUNC_GET_LINKED_ATTACHMENT (1 << 9) #define BIP_SUPP_FUNC_DELETE_IMAGE (1 << 10) #define BIP_SUPP_FUNC_START_PRINT (1 << 11) #define BIP_SUPP_FUNC_START_ARCHIVE (1 << 13) #define BIP_SUPP_FUNC_GET_MONITORING_IMAGE (1 << 14) #define BIP_SUPP_FUNC_GET_STATUS (1 << 16) typedef struct ImagingSdpData_ { guint8 supp_capabilities; guint16 supp_features; guint32 supp_functions; guint64 data_capacity; } ImagingSdpData; typedef void (* OdsBluezFunc) (gint, gint, const ImagingSdpData*, GError*, gpointer); typedef struct OdsBluezCancellable_ { /* cancellable data */ sdp_session_t *session; GIOChannel *io_channel; guint io_watch; gint fd;/* RFCOMM socket */ /* other data */ OdsBluezFunc cb; gpointer cb_data; bdaddr_t target_address; bdaddr_t source_address; uuid_t uuid; guint imaging_feature; ImagingSdpData *imagingdata; gint channel; } OdsBluezCancellable; OdsBluezCancellable* ods_bluez_get_client_socket (const bdaddr_t *dst, const bdaddr_t *src, const uuid_t *uuid, guint imaging_feature, gint channel, OdsBluezFunc func, gpointer data); void ods_bluez_cancel_get_client_socket (OdsBluezCancellable *cancel); gint ods_bluez_get_server_socket (const gchar *address, guint8 channel); guint32 ods_bluez_add_service_record (const gchar *device, gint service, ImagingSdpData *imagingdata); void ods_bluez_remove_service_record (const gchar *device, guint32 record_handle); void ods_bluez_finalize (); #endif /* __ODS_BLUEZ_H */ obex-data-server-0.4.6/src/ods-server-session.xml0000644000175000017500000000245411524724173016710 00000000000000 obex-data-server-0.4.6/src/ods-obex.h0000644000175000017500000002051211524724173014300 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_OBEX_H #define __ODS_OBEX_H #include #include #include /* FTP CMD_ACTION */ #ifndef OBEX_CMD_ACTION #define OBEX_CMD_ACTION 0x06 #define OBEX_HDR_ACTION_ID 0x94 #define OBEX_HDR_DESTNAME 0x15 #define OBEX_HDR_PERMISSIONS 0xD6 #define OBEX_ACTION_COPY 0x00 #define OBEX_ACTION_MOVE 0x01 #define OBEX_ACTION_SETPERM 0x02 #endif /* OBEX_CMD_ACTION */ /* CMD_ACTION permissions */ #define OBEX_PERM_READ 1 #define OBEX_PERM_WRITE 1 << 1 #define OBEX_PERM_DEL 1 << 2 #define OBEX_PERM_MODIFY 1 << 7 /* Transfer suspend results */ #define OBEX_SUSP_REJECTED -1 #define OBEX_SUSP_ACCEPTED 1 #define OBEX_SUSP_FIFO_ERR -2 #define OBEX_SUSP_FIFO_ACT 2 /* BIP-specific headers */ #define OBEX_HDR_IMG_DESCRIPTOR 0x71 #define OBEX_HDR_IMG_HANDLE 0x30 /* BIP app-parameters header for RemoteDisplay */ #define BIP_REMOTEDISPLAY_NEXTIMAGE 0x01 #define BIP_REMOTEDISPLAY_PREVIOUSIMAGE 0x02 #define BIP_REMOTEDISPLAY_SELECTIMAGE 0x03 #define BIP_REMOTEDISPLAY_CURRENTIMAGE 0x04 #define BIP_APPARAM_REMOTEDISPLAY_TAGID 0x08 typedef struct bip_apparam_remote_display { uint8_t tag_id; uint8_t length; uint8_t value; } __attribute__ ((packed)) bip_apparam_remote_display_t; #define CONID_INVALID 0xFFFFFFFF #define ODS_DEFAULT_RX_MTU 32767 #define ODS_DEFAULT_TX_MTU 32767 #define ODS_TTY_RX_MTU 65535 #define ODS_TTY_TX_MTU 65535 /* Request timeout (when ods considers request as timed out and kills connection) */ /* in seconds */ #define ODS_OBEX_TIMEOUT 15 #define CAP_TYPE "x-obex/capability" #define OBP_TYPE "x-obex/object-profile" #define LST_TYPE "x-obex/folder-listing" /* BIP-specific object types */ #define BIP_IMG_TYPE "x-bt/img-img" #define BIP_THM_TYPE "x-bt/img-thm" #define BIP_ATTACHMENT_TYPE "x-bt/img-attachment" #define BIP_LISTING_TYPE "x-bt/img-listing" #define BIP_PROPERTIES_TYPE "x-bt/img-properties" #define BIP_CAPABILITIES_TYPE "x-bt/img-capabilities" #define BIP_MONITORING_TYPE "x-bt/img-monitoring" #define BIP_DISPLAY_TYPE "x-bt/img-display" #define BIP_PRINT_TYPE "x-bt/img-print" #define BIP_PARTIAL_TYPE "x-bt/img-partial" #define BIP_ARCHIVE_TYPE "x-bt/img-archive" #define BIP_STATUS_TYPE "x-bt/img-status" typedef struct { obex_t *obex_handle; guint16 tx_max; guint16 rx_max; guint32 connection_id; obex_event_t obex_event; GIOFunc io_callback; guint io_watch; gboolean usb_read_more; /* USB trasport specific (set in session->obex_usbevent) */ /* transfer basic info */ guint8 obex_cmd; /* obex command */ guint timeout_id; /* source id for timeout function (>0 if set) (used for client requests) */ gchar *local; gchar *remote; gchar *type; guint64 target_size; time_t modtime; gboolean report_progress; gboolean transfer_started_signal_emitted; guint suspend_timeout_id; gint suspend_result; /* transfers can be suspended for serversession accept/reject or when FIFO pipes are used in sessions */ /* extended info */ gchar *img_handle;/* BIP-specific image handle */ GHashTable *ext_info;/* Any extended info which is not used internally */ /* transfer data */ guchar *buf; /* Data buffer for put and get requests */ guint64 buf_size; gint stream_fd; guint fifo_watch;/* used to watch for fifo events */ /* transfer status */ guint64 counter; gboolean cancelled; } OdsObexContext; typedef struct obex_connect_hdr { uint8_t version; uint8_t flags; uint16_t mtu; } __attribute__ ((packed)) obex_connect_hdr_t; typedef struct obex_setpath_hdr { uint8_t flags; uint8_t constants; } __attribute__ ((packed)) obex_setpath_hdr_t; void ods_obex_transfer_new (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type); void ods_obex_transfer_suspend (OdsObexContext *obex_context); void ods_obex_transfer_close (OdsObexContext *obex_context); void ods_obex_transfer_add_info (OdsObexContext *obex_context, gchar *key, gchar *value); GHashTable* ods_obex_transfer_get_info (OdsObexContext *obex_context); OdsObexContext *ods_obex_context_new (void); gboolean ods_obex_setup_fdtransport (OdsObexContext *obex_context, gint fd, guint16 rx_mtu, guint16 tx_mtu, obex_event_t eventcb, GIOFunc io_cb, gpointer user_data, GError **error); gboolean ods_obex_setup_usbtransport (OdsObexContext *obex_context, gint intf_num, obex_event_t eventcb, GIOFunc io_cb, gpointer user_data, GError **error); void ods_obex_close_transport (OdsObexContext *ctxt); gchar *ods_obex_get_buffer_as_string (OdsObexContext *obex_context); gboolean ods_obex_srv_new_file (OdsObexContext *obex_context, const gchar *path); gint ods_obex_connect_done (OdsObexContext *obex_context, obex_object_t *object); gint ods_obex_connect (OdsObexContext *obex_context, const guchar *uuid, guint uuid_length); gint ods_obex_srv_connect (OdsObexContext *obex_context, obex_object_t *object, guint service); gint ods_obex_disconnect (OdsObexContext *obex_context); gint ods_obex_readstream (OdsObexContext *obex_context, obex_object_t *object); gint ods_obex_writestream(OdsObexContext *obex_context, obex_object_t *object); gint ods_obex_get (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type, gboolean is_fifo); gint ods_obex_srv_get (OdsObexContext *obex_context, obex_object_t *object, const gchar *current_path, const gchar *root_path, gboolean allow_write); gint ods_obex_put (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *type, guint64 size, time_t mtime, gboolean is_fifo, gint fifo_fd); gint ods_obex_srv_put (OdsObexContext *obex_context, obex_object_t *object, const gchar *path, guint8 *action, gboolean no_response_on_success); gint ods_obex_setpath (OdsObexContext *obex_context, const gchar *path, gboolean create); gboolean ods_obex_srv_setpath (OdsObexContext *obex_context, obex_object_t *object, const gchar *root_path, const gchar *current_path, gchar **new_path, gboolean allow_write); gint ods_obex_put_image (OdsObexContext *obex_context, const gchar *local, const gchar *remote, const gchar *encoding, const gchar *pixel, guint64 size, const gchar *transformation); gint ods_obex_put_linked_thumbnail (OdsObexContext *obex_context, const gchar *local, const gchar *img_handle, guint64 size); gint ods_obex_put_linked_attachment (OdsObexContext *obex_context, const gchar *local, const gchar *img_handle, const gchar *name, const gchar *content_type, const gchar *charset, guint64 size, time_t ctime); gint ods_obex_remote_display (OdsObexContext *obex_context, const gchar *img_handle, guint8 action); gint ods_obex_action (OdsObexContext *obex_context, const gchar *src, const gchar *dst, guint8 action, guint32 perms); #endif /* __ODS_OBEX_H */ obex-data-server-0.4.6/src/ods-session.c0000644000175000017500000022275011524724173015031 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2009 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ods-bluez.h" #include "ods-common.h" #include "ods-error.h" #include "ods-imaging-helpers.h" #include "ods-manager.h" #include "ods-marshal.h" #include "ods-logging.h" #include "ods-obex.h" #include "ods-session.h" #include "ods-session-dbus-glue.h" static void ods_session_finalize (GObject *object); static void ods_session_connect_internal (OdsSession *session, GError **error); #define ODS_SESSION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ODS_TYPE_SESSION, OdsSessionPrivate)) #define ODS_SESSION_DBUS_PATH_PATTERN "/org/openobex/session%d" #define ODS_SESSION_DBUS_INTERFACE "org.openobex.Session" typedef enum { ODS_SESSION_STATE_INIT, ODS_SESSION_STATE_OPEN, ODS_SESSION_STATE_BUSY, ODS_SESSION_STATE_NOT_CONNECTED } OdsSessionState; typedef struct OdsSessionPutImageData_ { OdsSession *session; DBusGMethodInvocation *context; gchar *img_handle; gboolean only_get_info; } OdsSessionPutImageData; struct OdsSessionPrivate { /* constructor properties */ gint fd; /* rfcomm device */ guint service; gchar *owner; /* D-Bus client, who initiated this session */ guchar *target_uuid; /* Target UUID used for CMD_CONNECT */ gint usbintfnum; /* USB interface number */ /* state variables */ OdsSessionState state; /* ODS_SESSION_STATE_INIT by default */ /* OBEX connection */ OdsObexContext *obex_context; /* other */ GStaticMutex mutex; DBusGMethodInvocation *dbus_context; /* D-Bus context for async methods */ gchar *dbus_path; /* D-Bus path for this object */ gchar *current_path; /* Current path on remote device */ gchar *new_path; /* Temporarily stored new path on remote device */ gint transfer_hint_fifo; gchar *transfer_hint_name; gchar *transfer_hint_type; guint64 transfer_hint_size; gint64 transfer_hint_mtime; gint64 transfer_hint_ctime; /* BIP-specific */ guint imaging_feature; ImagingSdpData *imaging_sdp_data; }; enum { CANCELLED, CONNECT_RESULT_INTERNAL, DISCONNECTED, CLOSED, TRANSFER_STARTED, TRANSFER_PROGRESS, TRANSFER_COMPLETED, ERROR_OCCURRED, IMAGE_HANDLE_RECEIVED, LAST_SIGNAL }; static guint signals [LAST_SIGNAL] = { 0, }; /* for numbering established sessions */ static guint iterator = 0; G_DEFINE_TYPE (OdsSession, ods_session, G_TYPE_OBJECT) static void session_log (OdsSession *session, GLogLevelFlags log_level, const gchar *message, ...) { va_list args; gchar *format = NULL; va_start (args, message); if (session->priv->dbus_path) { format = g_strdup_printf("%s: %s", session->priv->dbus_path, message); g_logv (G_LOG_DOMAIN, log_level, format, args); g_free (format); } else { g_logv (G_LOG_DOMAIN, log_level, message, args); } va_end (args); } #define session_message(session, format, ...) session_log (session, G_LOG_LEVEL_MESSAGE, format, ##__VA_ARGS__) #define session_warning(session, format, ...) session_log (session, G_LOG_LEVEL_WARNING, format, ##__VA_ARGS__) #define ODS_SESSION_LOCK(session) session_log (session, G_LOG_LEVEL_MESSAGE, "LOCK %s", __FUNCTION__); g_static_mutex_lock (&(session)->priv->mutex) #define ODS_SESSION_UNLOCK(session) session_log (session, G_LOG_LEVEL_MESSAGE, "UNLOCK %s", __FUNCTION__); g_static_mutex_unlock (&(session)->priv->mutex) static void emit_connect_result_internal (OdsSession *session, GError *error) { gchar *error_name; if (error) { ods_obex_close_transport (session->priv->obex_context); error_name = ods_error_get_dbus_name (error); g_signal_emit (session, signals [CONNECT_RESULT_INTERNAL], 0, error_name, error->message); g_free (error_name); } else { g_signal_emit (session, signals [CONNECT_RESULT_INTERNAL], 0, NULL, NULL); } } static gboolean local_file_test (const gchar *local_path, gboolean *is_fifo) { gboolean ret; /* Check if this is regular file or symlink pointing to regular file */ ret = g_file_test (local_path, G_FILE_TEST_IS_REGULAR); /* Check if it is a FIFO */ *is_fifo = FALSE; if (!ret) { struct stat s; if (g_stat (local_path, &s) == 0 && S_ISFIFO (s.st_mode)) { *is_fifo = TRUE; ret = TRUE; } } return ret; } static gboolean emit_disconnected (OdsSession *session) { ods_obex_close_transport (session->priv->obex_context); g_signal_emit (session, signals [DISCONNECTED], 0); return FALSE; } static gboolean obex_io_callback (GIOChannel *io_channel, GIOCondition cond, gpointer data) { obex_t *obex_handle; OdsSession *session; GError *error = NULL; gboolean ret = TRUE; obex_handle = (obex_t *) data; session = ODS_SESSION (OBEX_GetUserData (obex_handle)); session_message (session, "io callback"); if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) { if (session->priv->state == ODS_SESSION_STATE_INIT) { /* Link error happened while establishing OBEX connection, * hence emit ConnectResultInternal here (no need to emit * Disconnected signal) */ g_set_error (&error, ODS_ERROR, ODS_ERROR_LINK_ERROR, "Lost connection"); emit_connect_result_internal (session, error); g_clear_error (&error); return FALSE; } /* emit Disconnected for all other states */ g_idle_add ((GSourceFunc) emit_disconnected, session); if (session->priv->state == ODS_SESSION_STATE_NOT_CONNECTED) { /* CMD_DISCONNECT was sent but did not receive proper reply, * don't emit ErrorOccurred */ return FALSE; } g_set_error (&error, ODS_ERROR, ODS_ERROR_LINK_ERROR, "Connection error"); /* cleanup transfer data and set state to NOT_CONNECTED */ /* If it was GET operation, remove incomplete file */ if (session->priv->obex_context->obex_cmd == OBEX_CMD_GET && session->priv->obex_context->stream_fd >= 0) g_unlink (session->priv->obex_context->local); ods_obex_transfer_close (session->priv->obex_context); session->priv->state = ODS_SESSION_STATE_NOT_CONNECTED; /* Return D-Bus context, unlock mutex */ if (session->priv->dbus_context) { dbus_g_method_return_error (session->priv->dbus_context, error); session->priv->dbus_context = NULL; ODS_SESSION_UNLOCK (session); } ret = FALSE; } else if (OBEX_HandleInput (obex_handle, 1) < 0) { g_set_error (&error, ODS_ERROR, ODS_ERROR_BAD_DATA, "Could not parse incoming data"); } if (error) { gchar *error_name; /* Get D-Bus name for error */ error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred signal */ g_signal_emit (session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); } return ret; } static void reset_transfer_hints (OdsSession *session) { session->priv->transfer_hint_fifo = -1; g_free (session->priv->transfer_hint_name); session->priv->transfer_hint_name = NULL; g_free (session->priv->transfer_hint_type); session->priv->transfer_hint_type = NULL; session->priv->transfer_hint_size = 0; session->priv->transfer_hint_mtime = -1; session->priv->transfer_hint_ctime = -1; } static void obex_transfer_done (OdsSession *session, gint response) { GError *error = NULL; gchar *error_name; session->priv->state = ODS_SESSION_STATE_OPEN; if (response != OBEX_RSP_SUCCESS && response != OBEX_RSP_PARTIAL_CONTENT) { /* get GError corresponding to OBEX response code */ ods_error_obexrsp2gerror (response, &error); /* Get D-Bus name for error */ error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred Signal */ g_signal_emit (session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); return; } if (session->priv->obex_context->report_progress) { /* emit signals */ g_signal_emit (session, signals [TRANSFER_PROGRESS], 0, session->priv->obex_context->target_size); g_signal_emit (session, signals [TRANSFER_COMPLETED], 0); } } static void obex_transfer_data_exchange_done (OdsSession *session, gint ret) { GError *error = NULL; gchar *error_name; OdsObexContext *obex_context; obex_context = session->priv->obex_context; if (ret < 0) { ods_error_err2gerror (ret, &error); /* Get D-Bus name for error */ error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred Signal */ g_signal_emit (session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); /* Reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; } else if (ret == 0 && obex_context->report_progress && !obex_context->transfer_started_signal_emitted) { g_signal_emit (session, signals [TRANSFER_STARTED], 0, obex_context->remote, obex_context->local, obex_context->target_size); obex_context->transfer_started_signal_emitted = TRUE; } } static void make_thumbnail_cb (OdsImageInfo *info, OdsSessionPutImageData *data) { GError *error = NULL; gchar *error_name; gint ret; if (!info->resized_image_filename) { /* Could not make thumbnail */ g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not make image thumbnail"); goto out; } ret = ods_obex_put_linked_thumbnail (data->session->priv->obex_context, info->resized_image_filename, data->img_handle, info->size); if (ret < 0) { ods_error_err2gerror (ret, &error); goto out; } out: if (error) { error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred Signal */ g_signal_emit (data->session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); /* reset state */ data->session->priv->state = ODS_SESSION_STATE_OPEN; } g_free (data->img_handle); g_free (data); ods_image_info_free (info); } static void obex_request_done (OdsSession *session, obex_object_t *object, int command, int response) { GError *error = NULL; OdsObexContext *obex_context; /* for CMD_PUT only */ obex_headerdata_t hv; uint8_t hi; guint hlen; gchar *img_handle = NULL; OdsSessionPutImageData *cb_data; gchar *error_name; gchar *local_path = NULL; session_message (session, "obex_request_done: command %d, response %d (%s)", command, response, OBEX_ResponseToString (response)); obex_context = session->priv->obex_context; switch (command) { case OBEX_CMD_CONNECT: if (response == OBEX_RSP_SUCCESS) { ods_obex_connect_done (obex_context, object); /* update state */ session->priv->state = ODS_SESSION_STATE_OPEN; emit_connect_result_internal (session, NULL); } else { g_set_error (&error, ODS_ERROR, ODS_ERROR_CONNECTION_REFUSED, "Remote device refused connection"); emit_connect_result_internal (session, error); g_clear_error (&error); } break; case OBEX_CMD_DISCONNECT: g_idle_add ((GSourceFunc) emit_disconnected, session); break; case OBEX_CMD_SETPATH: /* check response code here */ if (response == OBEX_RSP_NOT_FOUND) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_FOUND, "Path not found"); if (session->priv->dbus_context) { dbus_g_method_return_error (session->priv->dbus_context, error); session->priv->dbus_context = NULL; } g_clear_error (&error); } else if (response == OBEX_RSP_SUCCESS) { gchar *temp; if (!strcmp (session->priv->new_path, "")) temp = g_strdup ("/"); else if (!strcmp (session->priv->new_path, "..")) { gchar *temp2; /* get rid of trailing "/" */ session->priv->current_path[ strlen (session->priv->current_path)-1] = 0; temp2 = g_path_get_dirname (session->priv->current_path); /* add trailing "/" */ temp = g_strdup_printf ("%s/", temp2); g_free (temp2); } else { gchar *first_element; /* make sure we don't leave "/" in the beginning */ if (session->priv->current_path[0] == '/') first_element = ""; else first_element = session->priv->current_path; temp = g_strdup_printf ("%s%s/", first_element, session->priv->new_path); } g_free (session->priv->current_path); session->priv->current_path = temp; if (session->priv->dbus_context) { dbus_g_method_return (session->priv->dbus_context); session->priv->dbus_context = NULL; } } else {/* some other response code, must be error */ /* get GError corresponding to OBEX response code */ ods_error_obexrsp2gerror (response, &error); dbus_g_method_return_error (session->priv->dbus_context, error); session->priv->dbus_context = NULL; g_clear_error (&error); } ODS_SESSION_UNLOCK (session); break; case OBEX_CMD_ACTION: if (response == OBEX_RSP_SUCCESS) { if (session->priv->dbus_context) { dbus_g_method_return (session->priv->dbus_context); session->priv->dbus_context = NULL; } } else { /* get GError corresponding to OBEX response code */ ods_error_obexrsp2gerror (response, &error); dbus_g_method_return_error (session->priv->dbus_context, error); session->priv->dbus_context = NULL; g_clear_error (&error); } ODS_SESSION_UNLOCK (session); break; case OBEX_CMD_PUT: if (!obex_context->report_progress) { /* DeleteRemoteFile or RemoteDisplay* was executed */ session->priv->state = ODS_SESSION_STATE_OPEN; if (session->priv->dbus_context) { if (response != OBEX_RSP_SUCCESS) { /* get GError corresponding to OBEX response code */ ods_error_obexrsp2gerror (response, &error); dbus_g_method_return_error (session->priv->dbus_context, error); session->priv->dbus_context = NULL; g_clear_error (&error); } else { dbus_g_method_return (session->priv->dbus_context); session->priv->dbus_context = NULL; } ODS_SESSION_UNLOCK (session); } } else { /* Check for img-handle header (in case of BIP PutImage) */ while (OBEX_ObjectGetNextHeader(obex_context->obex_handle, object, &hi, &hv, &hlen)) { if (hi == OBEX_HDR_IMG_HANDLE) { img_handle = ods_filename_from_utf16 ((gchar *) hv.bs, hlen); g_signal_emit (session, signals [IMAGE_HANDLE_RECEIVED], 0, img_handle, response==OBEX_RSP_PARTIAL_CONTENT); if (response == OBEX_RSP_PARTIAL_CONTENT) { /* save local_path */ local_path = g_strdup (obex_context->local); } } } /* finish transfer (emit signals) */ obex_transfer_done (session, response); } ods_obex_transfer_close (obex_context); if (img_handle && response==OBEX_RSP_PARTIAL_CONTENT) { /* Responder requested thumbnail, let's send it */ session->priv->state = ODS_SESSION_STATE_BUSY; cb_data = g_new0 (OdsSessionPutImageData, 1); cb_data->session = session; cb_data->img_handle = g_strdup (img_handle); if (!ods_imaging_make_image_thumbnail_async (local_path, (OdsImagingFunc)make_thumbnail_cb, cb_data)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not create thread"); error_name = ods_error_get_dbus_name (error); /* emit ErrorOccurred Signal */ g_signal_emit (session, signals [ERROR_OCCURRED], 0, error_name, error->message); g_free (error_name); g_clear_error (&error); g_free (cb_data->img_handle); g_free (cb_data); /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; } } if (img_handle) g_free (img_handle); if (local_path) g_free (local_path); break; case OBEX_CMD_GET: if (!obex_context->report_progress) { /* RetrieveFolderListing, GetCapability or GetImagingCapabilities * was executed */ session->priv->state = ODS_SESSION_STATE_OPEN; if (session->priv->dbus_context) { if (response != OBEX_RSP_SUCCESS) { /* get GError corresponding to OBEX response code */ ods_error_obexrsp2gerror (response, &error); dbus_g_method_return_error (session->priv->dbus_context, error); session->priv->dbus_context = NULL; g_clear_error (&error); } else { gchar *buf; buf = g_strdup (ods_obex_get_buffer_as_string (obex_context)); dbus_g_method_return (session->priv->dbus_context, buf); g_free (buf); session->priv->dbus_context = NULL; } ODS_SESSION_UNLOCK (session); } } else { obex_transfer_done (session, response); /* change modification time for received file */ if (obex_context->local) { session_warning (session, "MODTIME: %d", (gint)obex_context->modtime); if (obex_context->modtime != -1) { struct utimbuf ubuf; ubuf.actime = time (NULL); ubuf.modtime = obex_context->modtime; if (utime (obex_context->local, &ubuf) < 0) session_warning (session, "Invalid modification time"); } } } ods_obex_transfer_close (obex_context); break; case OBEX_CMD_SESSION: break; } } static void obex_request_cancelled (OdsSession *session, OdsObexContext *obex_context) { /* Cleanup transfer data and reset state */ /* If it was GET operation, remove incomplete file */ if (obex_context->obex_cmd == OBEX_CMD_GET && obex_context->stream_fd >= 0) g_unlink (obex_context->local); ods_obex_transfer_close (obex_context); session->priv->state = ODS_SESSION_STATE_OPEN; /* Emit Cancelled signal */ g_signal_emit (session, signals [CANCELLED], 0); /* In case this was trigerred by Cancel method */ if (session->priv->dbus_context) { dbus_g_method_return (session->priv->dbus_context); session->priv->dbus_context = NULL; ODS_SESSION_UNLOCK (session); } } static void obex_event (obex_t *handle, obex_object_t *object, int mode, int event, int command, int response) { OdsSession *session; OdsObexContext *obex_context; gint ret; session = ODS_SESSION (OBEX_GetUserData (handle)); obex_context = session->priv->obex_context; ods_log_obex (session->priv->dbus_path, event, command, response); switch (event) { case OBEX_EV_PROGRESS: if (obex_context->report_progress) { g_signal_emit (session, signals [TRANSFER_PROGRESS], 0, obex_context->counter); session_warning (session, "PROGRESS: %" G_GUINT64_FORMAT, obex_context->counter); } break; case OBEX_EV_REQHINT: OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, response); break; case OBEX_EV_REQ: OBEX_ObjectSetRsp (object, OBEX_RSP_NOT_IMPLEMENTED, response); break; case OBEX_EV_REQDONE: obex_request_done (session, object, command, response); break; case OBEX_EV_PARSEERR: session_warning (session, "EV_PARSEERR"); break; case OBEX_EV_ACCEPTHINT: session_warning (session, "EV_ACCEPTHINT"); break; case OBEX_EV_LINKERR: /* we will get LINKERR when Cancel was called, but device didn't * send OBEX_RSP_SUCCESS response (might be OBEX_RSP_BAD_REQUEST). * When link error really happens, it is handled in io_callback */ session_warning (session, "EV_LINKERR"); /* go through to ABORT actions */ case OBEX_EV_ABORT: session_message (session, "EV_ABORT"); obex_request_cancelled (session, obex_context); break; case OBEX_EV_STREAMEMPTY: ret = ods_obex_writestream (obex_context, object); obex_transfer_data_exchange_done (session, ret); break; case OBEX_EV_STREAMAVAIL: ret = ods_obex_readstream (obex_context, object); obex_transfer_data_exchange_done (session, ret); if (ret == 2) { /* Transfer was cancelled by sending RSP_FORBIDDEN, this will * not trigger EV_ABORT so we need to emit Cancelled signal here */ obex_request_cancelled (session, obex_context); } break; case OBEX_EV_UNEXPECTED: case OBEX_EV_REQCHECK: break; } } static void obex_usbevent (obex_t *handle, obex_object_t *object, int mode, int event, int command, int response) { OdsSession *session; OdsObexContext *ctxt; session = ODS_SESSION (OBEX_GetUserData (handle)); ctxt = session->priv->obex_context; obex_event (handle, object, mode, event, command, response); if (event == OBEX_EV_PROGRESS || event == OBEX_EV_STREAMEMPTY || event == OBEX_EV_STREAMAVAIL) ctxt->usb_read_more = TRUE; /* There is more data to read */ else ctxt->usb_read_more = FALSE; } static gboolean ods_session_check_state (OdsSession *session, DBusGMethodInvocation *context) { GError *error = NULL; /* check if connected */ if (session->priv->state == ODS_SESSION_STATE_INIT || session->priv->state == ODS_SESSION_STATE_NOT_CONNECTED) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_CONNECTED, "Not connected"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* check if busy */ if (session->priv->state == ODS_SESSION_STATE_BUSY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_BUSY, "Another operation in progress"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } return TRUE; } static void ods_session_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { OdsSession *self = (OdsSession *) object; OdsObexContext *obex_context = self->priv->obex_context; ImagingSdpData *imaging_data; guchar *target_uuid; GError *error = NULL; switch (property_id) { case ODS_SESSION_FD: self->priv->fd = g_value_get_int (value); if (self->priv->fd >= 0) { if (ods_obex_setup_fdtransport ( obex_context, self->priv->fd, ODS_DEFAULT_RX_MTU, ODS_DEFAULT_TX_MTU, obex_event, obex_io_callback, self, &error)) { /* connect automatically */ ods_session_connect_internal (self, &error); } if (error) { emit_connect_result_internal (self, error); g_clear_error (&error); } } break; case ODS_SESSION_SERVICE: self->priv->service = g_value_get_int (value); break; case ODS_SESSION_OWNER: self->priv->owner = g_value_dup_string (value); break; case ODS_SESSION_IMAGING_FEATURE: self->priv->imaging_feature = g_value_get_int (value); break; case ODS_SESSION_IMAGING_SDP_DATA: imaging_data = g_value_get_pointer (value); self->priv->imaging_sdp_data = g_new0 (ImagingSdpData, 1); memcpy (self->priv->imaging_sdp_data, imaging_data, sizeof (ImagingSdpData)); break; case ODS_SESSION_TARGET_UUID: target_uuid = g_value_get_pointer (value); if (target_uuid) { self->priv->target_uuid = g_malloc0 (OBEX_UUID_LEN); memcpy (self->priv->target_uuid, target_uuid, OBEX_UUID_LEN); } break; case ODS_SESSION_USBINTFNUM: self->priv->usbintfnum = g_value_get_int (value); if (self->priv->usbintfnum >= 0) { if (ods_obex_setup_usbtransport (obex_context, self->priv->usbintfnum, obex_usbevent, obex_io_callback, self, &error)) { /* connect automatically */ ods_session_connect_internal (self, &error); } if (error) { emit_connect_result_internal (self, error); g_clear_error (&error); } } break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); break; } } static void ods_session_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { OdsSession *self = (OdsSession *) object; switch (property_id) { case ODS_SESSION_FD: g_value_set_int (value, self->priv->fd); break; case ODS_SESSION_SERVICE: g_value_set_int (value, self->priv->service); break; case ODS_SESSION_OWNER: g_value_set_string (value, self->priv->owner); break; case ODS_SESSION_DBUS_PATH: g_value_set_string (value, self->priv->dbus_path); break; case ODS_SESSION_IMAGING_FEATURE: g_value_set_int (value, self->priv->imaging_feature); break; case ODS_SESSION_IMAGING_SDP_DATA: g_value_set_pointer (value, self->priv->imaging_sdp_data); break; case ODS_SESSION_TARGET_UUID: g_value_set_pointer (value, self->priv->target_uuid); break; case ODS_SESSION_USBINTFNUM: g_value_set_int (value, self->priv->usbintfnum); break; default: /* We don't have any other property... */ G_OBJECT_WARN_INVALID_PROPERTY_ID(object,property_id,pspec); break; } } /** * ods_session_class_init: * @klass: The OdsSessionClass **/ static void ods_session_class_init (OdsSessionClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); object_class->finalize = ods_session_finalize; object_class->set_property = ods_session_set_property; object_class->get_property = ods_session_get_property; g_object_class_install_property (object_class, ODS_SESSION_FD, g_param_spec_int ("fd", "", "", -1, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SESSION_SERVICE, g_param_spec_int ("service", "", "", 0, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SESSION_OWNER, g_param_spec_string ("owner", "", "", "" /* default value */, G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SESSION_DBUS_PATH, g_param_spec_string ("dbus-path", "", "", "" /* default value */, G_PARAM_READABLE)); g_object_class_install_property (object_class, ODS_SESSION_IMAGING_FEATURE, g_param_spec_int ("imaging-feature", "", "", 0, G_MAXINT, /* min, max values */ 0 /* default value */, G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SESSION_IMAGING_SDP_DATA, g_param_spec_pointer ("imaging-sdp-data", "", "", G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SESSION_TARGET_UUID, g_param_spec_pointer ("target-uuid", "", "", G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE)); g_object_class_install_property (object_class, ODS_SESSION_USBINTFNUM, g_param_spec_int ("usbintfnum", "", "", G_MININT, G_MAXINT, /* min, max values */ -1 /* default value */, G_PARAM_READWRITE)); signals [CANCELLED] = g_signal_new ("cancelled", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, cancelled), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [CONNECT_RESULT_INTERNAL] = g_signal_new ("connect-result-internal", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, connect_result_internal), NULL, NULL, ods_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals [DISCONNECTED] = g_signal_new ("disconnected", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, disconnected), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [CLOSED] = g_signal_new ("closed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, closed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [TRANSFER_STARTED] = g_signal_new ("transfer-started", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, transfer_started), NULL, NULL, ods_marshal_VOID__STRING_STRING_UINT64, G_TYPE_NONE, 3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64); signals [TRANSFER_PROGRESS] = g_signal_new ("transfer-progress", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, transfer_progress), NULL, NULL, ods_marshal_VOID__UINT64, G_TYPE_NONE, 1, G_TYPE_UINT64); signals [TRANSFER_COMPLETED] = g_signal_new ("transfer-completed", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, transfer_completed), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0); signals [ERROR_OCCURRED] = g_signal_new ("error-occurred", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, error_occurred), NULL, NULL, ods_marshal_VOID__STRING_STRING, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_STRING); signals [IMAGE_HANDLE_RECEIVED] = g_signal_new ("image-handle-received", G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (OdsSessionClass, image_handle_received), NULL, NULL, ods_marshal_VOID__STRING_BOOLEAN, G_TYPE_NONE, 2, G_TYPE_STRING, G_TYPE_BOOLEAN); g_type_class_add_private (klass, sizeof (OdsSessionPrivate)); GError *error = NULL; /* Init the DBus connection, per-klass */ klass->connection = dbus_g_bus_get (ODS_DBUS_BUS, &error); if (klass->connection == NULL) { g_warning("Unable to connect to dbus: %s", error->message); g_clear_error (&error); return; } /* &dbus_glib_ods_session_object_info is provided in the * dbus/ods-session-dbus-glue.h file */ dbus_g_object_type_install_info (ODS_TYPE_SESSION, &dbus_glib_ods_session_object_info); } /** * ods_session_init: * @session: This class instance **/ static void ods_session_init (OdsSession *session) { OdsSessionClass *klass = ODS_SESSION_GET_CLASS (session); session->priv = ODS_SESSION_GET_PRIVATE (session); /* initial priv values */ session->priv->state = ODS_SESSION_STATE_INIT; session->priv->current_path = g_strdup ("/"); session->priv->transfer_hint_fifo = -1; session->priv->transfer_hint_ctime = -1; session->priv->transfer_hint_mtime = -1; session->priv->obex_context = ods_obex_context_new (); /* figure out DBus object path for this instance */ session->priv->dbus_path = g_strdup_printf (ODS_SESSION_DBUS_PATH_PATTERN, iterator); iterator++; /* create mutex */ g_static_mutex_init (&session->priv->mutex); dbus_g_connection_register_g_object (klass->connection, session->priv->dbus_path, G_OBJECT (session)); } /** * ods_session_finalize: * @object: The object to finalize * * Finalize the session **/ static void ods_session_finalize (GObject *object) { OdsSession *session; g_return_if_fail (object != NULL); g_return_if_fail (ODS_IS_SESSION (object)); session = ODS_SESSION (object); g_return_if_fail (session->priv != NULL); /* close connection, free obex_context */ ods_obex_close_transport (session->priv->obex_context); if (session->priv->fd != -1) { session_message (session, "closing connection"); close (session->priv->fd); } OBEX_Cleanup (session->priv->obex_context->obex_handle); g_free (session->priv->obex_context); /* free other private variables */ g_free (session->priv->owner); g_free (session->priv->dbus_path); g_free (session->priv->imaging_sdp_data); g_free (session->priv->target_uuid); if (session->priv->new_path) g_free (session->priv->new_path); g_free (session->priv->current_path); g_free (session->priv->transfer_hint_name); g_free (session->priv->transfer_hint_type); g_static_mutex_free (&session->priv->mutex); G_OBJECT_CLASS (ods_session_parent_class)->finalize (object); } /** * ods_session_new: * * Return value: a new OdsSession object. **/ OdsSession * ods_session_new (gint fd, gint usb_interface_number, gint service, const gchar *owner, const gchar *target_uuid) { OdsSession *session; session = g_object_new (ODS_TYPE_SESSION, "fd", fd, "usbintfnum", usb_interface_number, "service", service, "owner", owner, "target-uuid", target_uuid, NULL); return ODS_SESSION (session); } static void ods_session_connect_internal (OdsSession *session, GError **error) { guchar *uuid = NULL; guint uuid_length = 0; gint ret; if (session->priv->state != ODS_SESSION_STATE_INIT) return; if (session->priv->target_uuid) { uuid = session->priv->target_uuid; uuid_length = OBEX_UUID_LEN; } /* send obex connect command */ ret = ods_obex_connect (session->priv->obex_context, uuid, uuid_length); if (ret < 0) ods_error_err2gerror (ret, error); } gint ods_session_disconnect_internal (OdsSession *session, GError **error) { gint ret; if (session->priv->state == ODS_SESSION_STATE_NOT_CONNECTED) { /* emit DISCONNECTED signal now */ g_idle_add ((GSourceFunc) emit_disconnected, session); return 1; } /* actually disconnect */ session->priv->state = ODS_SESSION_STATE_NOT_CONNECTED; ret = ods_obex_disconnect (session->priv->obex_context); if (ret < 0) { /* emit DISCONNECTED signal now and set state to NOT_CONNECTED * in this case disconnection will happen when socket is closed */ g_idle_add ((GSourceFunc) emit_disconnected, session); ods_error_err2gerror (ret, error); return -1; } return 0; } gboolean ods_session_disconnect (OdsSession *session, DBusGMethodInvocation *context) { gint ret; GError *error = NULL; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->state == ODS_SESSION_STATE_INIT) g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_AUTHORIZED, "Session is still being connected, Cancel connection instead"); else if (session->priv->state == ODS_SESSION_STATE_BUSY) g_set_error (&error, ODS_ERROR, ODS_ERROR_BUSY, "Operations in progress need to be cancelled first"); if (error) { dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } ret = ods_session_disconnect_internal (session, &error); if (ret == -1) { dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); } else { dbus_g_method_return (context); ODS_SESSION_UNLOCK (session); } return TRUE; } gboolean ods_session_close (OdsSession *session, DBusGMethodInvocation *context) { GError *error = NULL; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->state == ODS_SESSION_STATE_INIT) g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_AUTHORIZED, "Session is still being connected, Cancel connection instead"); else if (session->priv->state != ODS_SESSION_STATE_NOT_CONNECTED) g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Need to disconnect first"); if (error) { dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* emit CLOSED signal; manager will finalize this object */ ODS_SESSION_UNLOCK (session); g_signal_emit (session, signals[CLOSED], 0); dbus_g_method_return (context); return TRUE; } static gboolean ods_session_setpath (OdsSession *session, const gchar *path, gboolean create, DBusGMethodInvocation *context) { gint ret; GError *error = NULL; OdsObexContext *obex_context = session->priv->obex_context; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_GOEP && session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } /* validate path */ if (strchr (path, '/')) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid character in path ('/')"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->dbus_context) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* set dbus context */ session->priv->dbus_context = context; /* copy new path to temporary variable */ if (session->priv->new_path) g_free (session->priv->new_path); session->priv->new_path = g_strdup (path); /* change the folder */ ret = ods_obex_setpath (obex_context, path, create); if (ret < 0) { ods_error_err2gerror(ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); /* reset state */ session->priv->dbus_context = NULL; ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } gboolean ods_session_change_current_folder (OdsSession *session, const gchar *path, DBusGMethodInvocation *context) { return ods_session_setpath (session, path, FALSE, context); } gboolean ods_session_change_current_folder_backward (OdsSession *session, DBusGMethodInvocation *context) { return ods_session_setpath (session, "..", FALSE, context); } gboolean ods_session_change_current_folder_to_root (OdsSession *session, DBusGMethodInvocation *context) { return ods_session_setpath (session, "", FALSE, context); } gchar * ods_session_get_current_path (OdsSession *session) { return g_strdup (session->priv->current_path); } static gboolean ods_session_copy_remote_file_full (OdsSession *session, const gchar *remote_filename, const gchar *type, const gchar *local_path, DBusGMethodInvocation *context) { gint ret; GError *error = NULL; gboolean is_fifo; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_GOEP && session->priv->service != ODS_SERVICE_OPP && session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } /* validate remote_filename */ if (remote_filename && (*remote_filename == '\0' || strchr (remote_filename, '/'))) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid remote filename"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* validate type */ if (type && *type == '\0') { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid type"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* validate local path */ if (*local_path == '\0') { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid local path"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } local_file_test (local_path, &is_fifo); /* non existent path is also OK, it'll be created */ session->priv->state = ODS_SESSION_STATE_BUSY; ret = ods_obex_get (session->priv->obex_context, local_path, remote_filename, type, is_fifo); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } /* return immediately, user will get transfer progress and completion signals */ dbus_g_method_return (context); ODS_SESSION_UNLOCK (session); return TRUE; } gboolean ods_session_copy_remote_file (OdsSession *session, const gchar *remote_filename, const gchar *local_path, DBusGMethodInvocation *context) { return ods_session_copy_remote_file_full (session, remote_filename, NULL, local_path, context); } gboolean ods_session_copy_remote_file_by_type (OdsSession *session, const gchar *type, const gchar *local_path, DBusGMethodInvocation *context) { return ods_session_copy_remote_file_full (session, NULL, type, local_path, context); } gboolean ods_session_create_folder (OdsSession *session, const gchar *folder_name, DBusGMethodInvocation *context) { return ods_session_setpath (session, folder_name, TRUE, context); } static gboolean ods_session_get_by_type (OdsSession *session, DBusGMethodInvocation *context, const gchar *type) { gint ret; GError *error = NULL; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->dbus_context) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* set dbus context */ session->priv->dbus_context = context; session->priv->state = ODS_SESSION_STATE_BUSY; ret = ods_obex_get (session->priv->obex_context, NULL, NULL, type, FALSE); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); session->priv->dbus_context = NULL; /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } gboolean ods_session_retrieve_folder_listing (OdsSession *session, DBusGMethodInvocation *context) { GError *error = NULL; if (session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } return ods_session_get_by_type (session, context, LST_TYPE); } gboolean ods_session_get_capability (OdsSession *session, DBusGMethodInvocation *context) { GError *error = NULL; if (session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } return ods_session_get_by_type (session, context, CAP_TYPE); } gboolean ods_session_get_imaging_capabilities (OdsSession *session, DBusGMethodInvocation *context) { GError *error = NULL; if (session->priv->service != ODS_SERVICE_BIP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } return ods_session_get_by_type (session, context, BIP_CAPABILITIES_TYPE); } gboolean ods_session_send_file_ext (OdsSession *session, const gchar *local_path, const gchar *remote_filename, const gchar *type, DBusGMethodInvocation *context) { gint ret; gchar *basename = NULL; const gchar *remote_used = NULL; const gchar *type_used = NULL; GError *error = NULL; gboolean is_fifo; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_GOEP && session->priv->service != ODS_SERVICE_OPP && session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (!local_file_test (local_path, &is_fifo)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid local path"); dbus_g_method_return_error (context, error); g_clear_error (&error); return FALSE; } /* Figure out if we have to use different remote_filename and type */ if (*remote_filename != '\0') { g_free (session->priv->transfer_hint_name); session->priv->transfer_hint_name = g_strdup (remote_filename); } if (session->priv->transfer_hint_name) remote_used = session->priv->transfer_hint_name; else { basename = g_path_get_basename (local_path); remote_used = basename; } if (*type != '\0') { g_free (session->priv->transfer_hint_type); session->priv->transfer_hint_type = g_strdup (type); } if (session->priv->transfer_hint_type) type_used = session->priv->transfer_hint_type; session->priv->state = ODS_SESSION_STATE_BUSY; ret = ods_obex_put (session->priv->obex_context, local_path, remote_used, type_used, session->priv->transfer_hint_size, session->priv->transfer_hint_mtime, is_fifo, session->priv->transfer_hint_fifo); g_free (basename); reset_transfer_hints (session); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } /* return immediately, user will get transfer progress and completion signals */ dbus_g_method_return (context); ODS_SESSION_UNLOCK (session); return TRUE; } gboolean ods_session_send_file (OdsSession *session, const gchar *local_path, DBusGMethodInvocation *context) { return ods_session_send_file_ext (session, local_path, "", "", context); } gboolean ods_session_set_transfer_hints (OdsSession *session, const gchar *fifo, const gchar *remote_filename, const gchar *type, guint64 size, gint64 mtime, gint64 ctime, DBusGMethodInvocation *context) { GError *error = NULL; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } /* Cleanup old data */ if (session->priv->transfer_hint_fifo >= 0) close (session->priv->transfer_hint_fifo); reset_transfer_hints (session); /* Set transfer hints */ if (*fifo != '\0') { session->priv->transfer_hint_fifo = open (fifo, O_RDONLY | O_NONBLOCK); if (session->priv->transfer_hint_fifo < 0) { ods_error_err2gerror (errno, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } } if (*remote_filename != '\0') session->priv->transfer_hint_name = g_strdup (remote_filename); if (*type != '\0') session->priv->transfer_hint_type = g_strdup (type); session->priv->transfer_hint_size = size; session->priv->transfer_hint_mtime = mtime; session->priv->transfer_hint_ctime = ctime; dbus_g_method_return (context); ODS_SESSION_UNLOCK (session); return TRUE; } gboolean ods_session_delete_remote_file (OdsSession *session, const gchar *remote_filename, DBusGMethodInvocation *context) { gint ret; GError *error = NULL; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (*remote_filename == '\0' || strchr (remote_filename, '/')) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid remote filename"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->dbus_context) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* set dbus context */ session->priv->dbus_context = context; session->priv->state = ODS_SESSION_STATE_BUSY; ret = ods_obex_put (session->priv->obex_context, NULL, remote_filename, NULL, 0, -1, FALSE, -1); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); session->priv->dbus_context = NULL; /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } static gboolean ods_session_remote_action (OdsSession *session, const gchar *remote_source, const gchar *remote_destination, guint8 action, DBusGMethodInvocation *context) { gint ret; GError *error = NULL; OdsObexContext *obex_context = session->priv->obex_context; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_GOEP && session->priv->service != ODS_SERVICE_FTP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } /* validate remote_source */ if (strchr (remote_source, '/')) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid character in remote_source ('/')"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->dbus_context) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* set dbus context */ session->priv->dbus_context = context; /* do selected action */ ret = ods_obex_action (obex_context, remote_source, remote_destination, action, 0); if (ret < 0) { ods_error_err2gerror(ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); /* reset state */ session->priv->dbus_context = NULL; ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } gboolean ods_session_remote_copy (OdsSession *session, const gchar *remote_source, const gchar *remote_destination, DBusGMethodInvocation *context) { return ods_session_remote_action (session, remote_source, remote_destination, OBEX_ACTION_COPY, context); } gboolean ods_session_remote_move (OdsSession *session, const gchar *remote_source, const gchar *remote_destination, DBusGMethodInvocation *context) { return ods_session_remote_action (session, remote_source, remote_destination, OBEX_ACTION_MOVE, context); } static void get_image_info_cb (OdsImageInfo *info, OdsSessionPutImageData *data) { GError *error = NULL; gchar *basename; gchar *pixel_str; const gchar *transformation_str; gint ret; if (!info->encoding) { /* Could not acquire image info */ g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not acquire image info"); dbus_g_method_return_error (data->context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (data->session); goto out; } if (data->only_get_info) { dbus_g_method_return (data->context, info->width, info->height, g_strdup (info->encoding)); ODS_SESSION_UNLOCK (data->session); goto out; } basename = g_path_get_basename (info->filename); pixel_str = ods_imaging_get_pixel_string (info->width, info->height); transformation_str = ods_imaging_get_transformation_string ( info->transformation); ret = ods_obex_put_image (data->session->priv->obex_context, info->filename, basename, info->encoding, pixel_str, info->size, transformation_str); g_free (basename); g_free (pixel_str); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (data->context, error); g_clear_error (&error); /* reset state */ data->session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (data->session); goto out; } dbus_g_method_return (data->context); ODS_SESSION_UNLOCK (data->session); out: g_free (data); ods_image_info_free (info); } gboolean ods_session_get_image_info (OdsSession *session, const gchar *local_path, DBusGMethodInvocation *context) { GError *error = NULL; OdsSessionPutImageData *cb_data; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (!g_file_test (local_path, G_FILE_TEST_IS_REGULAR)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid local path"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } cb_data = g_new0 (OdsSessionPutImageData, 1); cb_data->session = session; cb_data->context = context; cb_data->only_get_info = TRUE; if (!ods_imaging_get_image_info_async (local_path, (OdsImagingFunc)get_image_info_cb, cb_data)) { #ifdef USE_IMAGEMAGICK g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not create thread"); #else g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported (ImageMagick support disabled)"); #endif dbus_g_method_return_error (context, error); g_clear_error (&error); g_free (cb_data); ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } gboolean ods_session_put_image (OdsSession *session, const gchar *local_path, DBusGMethodInvocation *context) { GError *error = NULL; OdsSessionPutImageData *cb_data; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_BIP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->imaging_feature != BIP_SUPP_FEAT_IMAGE_PUSH && session->priv->imaging_feature != BIP_SUPP_FEAT_REMOTE_DISPLAY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected imaging feature"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (!g_file_test (local_path, G_FILE_TEST_IS_REGULAR)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid local path"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } session->priv->state = ODS_SESSION_STATE_BUSY; cb_data = g_new0 (OdsSessionPutImageData, 1); cb_data->session = session; cb_data->context = context; if (!ods_imaging_get_image_info_async (local_path, (OdsImagingFunc)get_image_info_cb, cb_data)) { #ifdef USE_IMAGEMAGICK g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not create thread"); #else g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported (ImageMagick support disabled)"); #endif dbus_g_method_return_error (context, error); g_clear_error (&error); g_free (cb_data); /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } static void resize_image_cb (OdsImageInfo *info, OdsSessionPutImageData *data) { GError *error = NULL; gchar *basename; gchar *pixel_str; const gchar *transformation_str; gint ret; session_message (data->session, "resize_image_cb"); if (!info->resized_image_filename) { /* Could not acquire image info */ g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not resize/encode image"); dbus_g_method_return_error (data->context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (data->session); goto out; } basename = g_path_get_basename (info->filename); pixel_str = ods_imaging_get_pixel_string (info->width, info->height); transformation_str = ods_imaging_get_transformation_string ( info->transformation); ret = ods_obex_put_image (data->session->priv->obex_context, info->resized_image_filename, basename, info->encoding, pixel_str, info->size, transformation_str); g_free (basename); g_free (pixel_str); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (data->context, error); g_clear_error (&error); /* reset state */ data->session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (data->session); goto out; } dbus_g_method_return (data->context); ODS_SESSION_UNLOCK (data->session); out: g_free (data); ods_image_info_free (info); } gboolean ods_session_put_image_resized (OdsSession *session, const gchar *local_path, guint16 width, guint16 height, const gchar *encoding, const gchar *transformation, DBusGMethodInvocation *context) { GError *error = NULL; OdsSessionPutImageData *cb_data; const gchar *encoding_local; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_BIP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->imaging_feature != BIP_SUPP_FEAT_IMAGE_PUSH && session->priv->imaging_feature != BIP_SUPP_FEAT_REMOTE_DISPLAY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected imaging feature"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (!g_file_test (local_path, G_FILE_TEST_IS_REGULAR)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid local path"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } session->priv->state = ODS_SESSION_STATE_BUSY; cb_data = g_new0 (OdsSessionPutImageData, 1); cb_data->session = session; cb_data->context = context; if (*encoding == '\0') encoding_local = NULL; else encoding_local = encoding; if (!ods_imaging_resize_image_async (local_path, width, height, encoding, ods_imaging_get_transformation (transformation), (OdsImagingFunc)resize_image_cb, cb_data)) { #ifdef USE_IMAGEMAGICK g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "Could not create thread"); #else g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported (ImageMagick support disabled)"); #endif dbus_g_method_return_error (context, error); g_clear_error (&error); g_free (cb_data); /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } return TRUE; } gboolean ods_session_put_linked_attachment (OdsSession *session, const gchar *image_handle, const gchar *local_path, const gchar *content_type, const gchar *charset, DBusGMethodInvocation *context) { GError *error = NULL; const gchar *remote_used; gchar *basename = NULL; gint ret; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_BIP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->imaging_feature != BIP_SUPP_FEAT_IMAGE_PUSH) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected imaging feature"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!(session->priv->imaging_sdp_data->supp_functions & BIP_SUPP_FUNC_PUT_LINKED_ATTACHMENT)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by remote device"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (!g_file_test (local_path, G_FILE_TEST_IS_REGULAR)) { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid local path"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (*image_handle == '\0') { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid image handle"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->transfer_hint_name) remote_used = session->priv->transfer_hint_name; else { basename = g_path_get_basename (local_path); remote_used = basename; } session->priv->state = ODS_SESSION_STATE_BUSY; ret = ods_obex_put_linked_attachment (session->priv->obex_context, local_path, image_handle, remote_used, content_type, charset, 0, -1); g_free (basename); reset_transfer_hints (session); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } dbus_g_method_return (context); ODS_SESSION_UNLOCK (session); return TRUE; } static gboolean ods_session_remote_display_full (OdsSession *session, const gchar *image_handle, guint8 action, DBusGMethodInvocation *context) { gint ret; GError *error = NULL; ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->service != ODS_SERVICE_BIP) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected profile"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->imaging_feature != BIP_SUPP_FEAT_REMOTE_DISPLAY) { g_set_error (&error, ODS_ERROR, ODS_ERROR_NOT_SUPPORTED, "Function not supported by selected imaging feature"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (!ods_session_check_state (session, context)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (action == BIP_REMOTEDISPLAY_SELECTIMAGE && *image_handle == '\0') { g_set_error (&error, ODS_ERROR, ODS_ERROR_INVALID_ARGUMENTS, "Invalid image handle"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } if (session->priv->dbus_context) { g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* set dbus context */ session->priv->dbus_context = context; session->priv->state = ODS_SESSION_STATE_BUSY; ret = ods_obex_remote_display (session->priv->obex_context, image_handle, action); if (ret < 0) { ods_error_err2gerror (ret, &error); dbus_g_method_return_error (context, error); g_clear_error (&error); session->priv->dbus_context = NULL; /* reset state */ session->priv->state = ODS_SESSION_STATE_OPEN; ODS_SESSION_UNLOCK (session); return FALSE; } /* will actually return when we get REQ_DONE */ return TRUE; } gboolean ods_session_remote_display_select_image (OdsSession *session, const gchar *image_handle, DBusGMethodInvocation *context) { return ods_session_remote_display_full (session, image_handle, BIP_REMOTEDISPLAY_SELECTIMAGE, context); } gboolean ods_session_remote_display_show_current_image (OdsSession *session, DBusGMethodInvocation *context) { return ods_session_remote_display_full (session, "", BIP_REMOTEDISPLAY_CURRENTIMAGE, context); } gboolean ods_session_remote_display_show_next_image (OdsSession *session, DBusGMethodInvocation *context) { return ods_session_remote_display_full (session, "", BIP_REMOTEDISPLAY_NEXTIMAGE, context); } gboolean ods_session_remote_display_show_previous_image (OdsSession *session, DBusGMethodInvocation *context) { return ods_session_remote_display_full (session, "", BIP_REMOTEDISPLAY_PREVIOUSIMAGE, context); } GHashTable * ods_session_get_transfer_info (OdsSession *session) { return ods_obex_transfer_get_info (session->priv->obex_context); } gboolean ods_session_is_busy (OdsSession *session) { /* check for any operation (except transfers) */ if (!g_static_mutex_trylock (&session->priv->mutex)) return TRUE; else g_static_mutex_unlock (&session->priv->mutex); /* check for transfers */ return (session->priv->state == ODS_SESSION_STATE_BUSY); } gboolean ods_session_cancel_internal (OdsSession *session) { OdsObexContext *ctxt = session->priv->obex_context; if (session->priv->state != ODS_SESSION_STATE_BUSY) { /* emit CANCELLED signal now */ g_signal_emit (session, signals[CANCELLED], 0); return FALSE; } if (ctxt->obex_cmd == OBEX_CMD_PUT) { /* Send CMD_ABORT now */ OBEX_CancelRequest (ctxt->obex_handle, TRUE); } else { /* Send RSP_FORBIDDEN at obex_readstream; * cleanup will be done in obex_event */ ctxt->cancelled = TRUE; } return TRUE; } gboolean ods_session_cancel (OdsSession *session, DBusGMethodInvocation *context) { ODS_SESSION_LOCK (session); /* do checks */ if (!ods_check_caller (context, session->priv->owner)) { ODS_SESSION_UNLOCK (session); return FALSE; } if (ods_session_cancel_internal (session)) { if (session->priv->dbus_context) { GError *error; g_set_error (&error, ODS_ERROR, ODS_ERROR_FAILED, "DBus context is set (this is probably a bug)"); dbus_g_method_return_error (context, error); g_clear_error (&error); ODS_SESSION_UNLOCK (session); return FALSE; } /* set dbus context */ session->priv->dbus_context = context; /* will return at obex_event{EV_ABORT} */ } else { dbus_g_method_return (context); ODS_SESSION_UNLOCK (session); } return TRUE; } obex-data-server-0.4.6/src/ods-error.h0000644000175000017500000000416311524724173014500 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __ODS_ERROR_H #define __ODS_ERROR_H #include G_BEGIN_DECLS #define ODS_ERROR_DBUS_INTERFACE "org.openobex.Error" #define ODS_ERROR (ods_error_quark ()) #define ODS_TYPE_ERROR (ods_error_get_type ()) typedef enum { ODS_ERROR_INVALID_ARGUMENTS, ODS_ERROR_CONNECTION_ATTEMPT_FAILED, ODS_ERROR_NOT_SUPPORTED, ODS_ERROR_NOT_FOUND, ODS_ERROR_BUSY, ODS_ERROR_NOT_AUTHORIZED, ODS_ERROR_OUT_OF_MEMORY, ODS_ERROR_FAILED, ODS_ERROR_NOT_CONNECTED, ODS_ERROR_FORBIDDEN, ODS_ERROR_LINK_ERROR, ODS_ERROR_BAD_DATA, ODS_ERROR_STARTED, ODS_ERROR_NOT_STARTED, ODS_ERROR_TRANSPORT_NOT_AVAILABLE, ODS_ERROR_CONNECTION_REFUSED, ODS_ERROR_CONNECTION_TIMEOUT, ODS_ERROR_BAD_REQUEST, ODS_ERROR_NOT_IMPLEMENTED, ODS_ERROR_SERVER_ERROR, ODS_ERROR_TIMEOUT, ODS_ERROR_CANCELLED, ODS_ERROR_NOT_MODIFIED, ODS_ERROR_DATABASE_ERROR, ODS_ERROR_CONFLICT, ODS_ERROR_UNSUPPORTED_MEDIA_TYPE, ODS_ERROR_NO_FIFO_READER } OdsError; GQuark ods_error_quark (void); GType ods_error_get_type (void); void ods_error_err2gerror (int err, GError **error); void ods_error_obexrsp2gerror (gint obex_response, GError **error); gchar *ods_error_get_dbus_name (GError *error); G_END_DECLS #endif /* __ODS_ERROR_H */ obex-data-server-0.4.6/ChangeLog0000644000175000017500000016151611546317424013405 00000000000000====== obex-data-server-0.4.6 ====== 2011-02-10 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_get): Fix server GET when type is not set (fixes #493, #584) 2010-10-28 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_setpath): * src/ods-obex.h: * src/ods-server-session.c (obex_event): Disable directory creation when writing is not allowed (path by nami; #492) 2010-10-27 Tadas Dailyda * src/ods-server-session.c (send_image_handle): Fix BIP image PUT in server-side (patch by nami; #490) 2010-02-06 Tadas Dailyda * src/ods-logging.c (ods_log_obex): * src/ods-logging.h: * src/ods-server-session.c (obex_event): * src/ods-session.c (session_log), (obex_io_callback), (obex_request_done), (obex_event), (ods_session_finalize), (resize_image_cb): Improve message logging for sessions so that message is always prefixed with session's dbus path 2010-01-22 Tadas Dailyda * src/ods-bluez.c (sdp_initiate_search), (ods_bluez_cancel_get_client_socket): Fix crasher during SDP discovery 2010-01-03 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_get), (ods_obex_srv_put): Handle invalid Type header gracefully 2009-10-22 Tadas Dailyda * configure.ac: * src/ods-usb.c: * src/ods-usb.h: Fix ods-usb.{c|h} to not include usb.h when using --disable-usb (#215) ====== obex-data-server-0.4.5 ====== 2009-10-18 Tadas Dailyda * dbus-api.txt: Add info about suspend timeouts 2009-10-18 Tadas Dailyda * test/ods-opp-test.py: * test/ods-server-test.py: update test scripts to support tty transport 2009-10-18 Tadas Dailyda * src/ods-logging.c (log_handler): * src/ods-manager.c (tty_open): * test/ods-server-test.py: Little fix in logging, enable tty transport in ods-server-test.py 2009-10-18 Tadas Dailyda * data/obex-data-server.1: * src/ods-main.c (main): * src/ods-obex.c (ods_obex_susp_timeout), (ods_obex_transfer_suspend): * src/ods-obex.h: Update man page, implement suspend timeouts, fix -v 2009-09-02 Tadas Dailyda * Makefile.am: * acinclude.m4: * autogen.sh: * configure.ac: * configure.in: * data/Makefile.am: * dbus-api.txt: * src/Makefile.am: * src/ods-capabilities.c (ods_get_capability), (ods_get_imaging_capabilities): * src/ods-manager.c (ods_manager_session_list_add), (ods_manager_session_info_free), (client_socket_connected_cb), (tty_open), (create_bluetooth_session_full), (ods_manager_create_usb_session), (connect_tty_session), (ods_manager_create_tty_session), (ods_manager_create_tty_server), (ods_manager_get_session_info): * src/ods-manager.h: * src/ods-manager.xml: * src/ods-obex.c (ods_obex_get_new_path): * src/ods-server-session.c (ods_server_session_finalize): * src/ods-server.c (server_session_disconnected_cb), (connect_callback), (ods_server_attach_callback), (ods_server_constructor), (ods_server_finalize): * src/ods-session.c: * test/Makefile.am: Use non-recursive/silent build system, add support for TTY sessions, fix TTY server support, other bug fixes and code cleanup 2009-08-25 Tadas Dailyda * configure.in: * dbus-api.txt: * src/ods-logging.c (log_handler): * src/ods-manager.c (ods_manager_server_list_add), (ods_manager_server_info_free), (server_started_cb), (server_stopped_cb), (ods_manager_create_bluetooth_server), (tty_init), (ods_manager_create_tty_server), (ods_manager_get_server_info): * src/ods-manager.h: * src/ods-manager.xml: * src/ods-obex.c (ods_obex_get_new_path), (ods_obex_context_new), (ods_obex_setup_fdtransport), (ods_obex_connect_done), (ods_obex_srv_connect): * src/ods-obex.h: * src/ods-server-session.c (ods_server_session_set_property), (ods_server_session_get_property), (ods_server_session_class_init): * src/ods-server-session.h: * src/ods-server.c (ods_server_session_list_add), (connect_callback), (ods_server_set_property), (ods_server_get_property), (ods_server_class_init), (ods_server_init), (ods_server_finalize), (ods_server_get_server_session_info): * src/ods-server.h: * src/ods-session.c (ods_session_set_property): Add TTY server support, fix debug off in logging, refine filename choosing, prepare for 0.4.5 release 2009-08-23 Tadas Dailyda * src/ods-obex.c (ods_obex_timeout), (ods_obex_setup_fdtransport), (ods_obex_close_transport), (ods_obex_writestream): * src/ods-obex.h: * src/ods-server-session.c (emit_disconnected), (ods_server_session_set_property), (ods_server_session_cancel_internal): * src/ods-session.c (emit_connect_result_internal), (emit_disconnected), (ods_session_set_property), (ods_session_cancel_internal): Fix one newly introduced bug, workaround request cancelling bug in openobex 2009-08-22 Tadas Dailyda * src/ods-common.c (ods_safe_gsource_remove): * src/ods-common.h: * src/ods-logging.c: * src/ods-obex.c (ods_obex_timeout), (ods_obex_io): * src/ods-session.c (emit_connect_result_internal), (emit_disconnected): Add ods_safe_gsource_remove for safely removing event sources 2009-08-22 Tadas Dailyda * src/ods-manager.c (ods_manager_get_usb_interface_info): * src/ods-obex.c (ods_process_usb_input), (ods_obex_timeout), (ods_obex_send), (ods_obex_io), (ods_obex_setup_fdtransport), (ods_obex_setup_usbtransport), (ods_obex_connect_done), (ods_obex_connect), (ods_obex_srv_connect), (ods_obex_disconnect), (ods_obex_readstream), (ods_obex_get), (ods_obex_put_full), (ods_obex_setpath), (ods_obex_action): * src/ods-obex.h: * src/ods-session.c (emit_connect_result_internal), (emit_disconnected), (obex_usbevent), (ods_session_set_property): * src/ods-session.h: * src/ods-usb.c (find_obex_data_interface), (find_obex_service_descriptor): Implement timeout system, various code cleanup all over the place 2009-08-22 Tadas Dailyda * src/ods-obex.c (ods_obex_setup_fdtransport), (ods_obex_setup_usbtransport): * src/ods-obex.h: * src/ods-server-session.c (ods_server_session_set_property): * src/ods-session.c (ods_session_set_property): * test/Makefile.am: Move transport setup to ods-obex.c, add obex_event to OdsObexContext, distribute ods-opp-test.py 2009-08-20 Tadas Dailyda * autogen.sh: * configure.in: * test/ods-opp-test.py: Add silent rules to automake, add simple OPP send test script 2009-08-17 Tadas Dailyda * data/obex-data-server.1: * src/Makefile.am: * src/ods-logging.c (log_handler), (ods_log_init), (ods_log_finalize), (ods_log_obex): * src/ods-logging.h: * src/ods-main.c (ods_service_register), (main): * src/ods-server-session.c (obex_event): * src/ods-session.c (obex_event): Add more advanced logging functionality with ability to log to syslog 2009-07-16 Tadas Dailyda * src/ods-main.c (main): Use locales ONLY for filenames! 2009-06-02 Tadas Dailyda * data/obex-data-server.conf: * test/ods-dbus-test.c (session_connected_cb), (session_connect_error_cb): Fix system bus configuration, update ods-dbus-test.c a little bit 2009-04-17 Tadas Dailyda * dbus-api.txt: Fix RetrieveFolderListing description 2009-02-14 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_get): Add support for GET using folder listing type and name header in server 2009-02-10 Tadas Dailyda * src/ods-bluez.c (client_socket_connect_cb), (rfcomm_connect), (sdp_get_channel), (sdp_search_completed_cb), (sdp_search_process_cb), (sdp_connect_watch), (ods_bluez_cancel_get_client_socket): * src/ods-bluez.h: * src/ods-manager.c (client_socket_connected_cb), (create_bluetooth_session_full): * src/ods-session.c (ods_session_class_init): * test/ods-session-test.py: Revert previous changes and update ods-session-test.py to actually work with 0.4 API 2009-02-10 Tadas Dailyda * src/ods-bluez.c (client_socket_connect_cb), (rfcomm_connect), (sdp_get_channel), (sdp_search_completed_cb), (sdp_search_process_cb), (sdp_connect_watch), (ods_bluez_cancel_get_client_socket): * src/ods-bluez.h: * src/ods-manager.c (client_socket_connected_cb), (create_bluetooth_session_full): * src/ods-session.c (ods_session_class_init): Use NOKIAFTP_UUID for CMD_CONNECT if discovered via SDP ====== obex-data-server-0.4.4 ====== 2009-02-09 Tadas Dailyda * configure.in: * src/ods-usb.c (find_obex_service_descriptor): * src/ods-usb.h: Don't depend on openobex 1.4 for USB interface discovery ====== obex-data-server-0.4.3 ====== 2009-02-08 Tadas Dailyda * configure.in: * dbus-api.txt: Clarify how non-transfer methods work in documentation 2009-02-08 Tadas Dailyda * configure.in: Require only openobex 1.3 if usb support is disabled 2009-02-08 Tadas Dailyda * configure.in: Bump openobex dependency to 1.4 (needed for new USB stuff) 2009-02-06 Tadas Dailyda * dbus-api.txt: * src/ods-obex.c (ods_obex_transfer_get_info): Add OBEXCommand to transfer info for distinguishing between PUT and GET requests 2009-02-06 Tadas Dailyda * src/ods-bluez.c (ods_bluez_cancellable_free), (sdp_search_completed_cb), (sdp_initiate_search), (sdp_connect_watch), (ods_bluez_get_client_socket): * src/ods-bluez.h: * src/ods-obex.c (ods_obex_writestream): Fix Nokia UUID workaround (this was apparently broken in 0.4) 2009-01-31 Tadas Dailyda * configure.in: * src/Makefile.am: * src/ods-manager.c (ods_manager_get_usb_interfaces_num), (ods_manager_get_usb_interface_info): * src/ods-session.c (ods_session_set_transfer_hints): * src/ods-usb.c (find_eps), (find_obex_data_interface), (get_intf_string), (check_intf), (find_obex_service_descriptor), (ods_usbobex_find_interfaces), (ods_usbobex_free_interface), (ods_usbobex_free_interfaces): * src/ods-usb.h: * test/ods-dbus-test.c (session_connected_cb): * test/ods-session-test.py: Make USB interface discovery independent from openobex to be able to export more information (thanks to Bastien Nocera), check for errors in Session.SetTransferHints 2009-01-27 Tadas Dailyda * src/ods-server-session.c: * src/ods-session.c (ods_session_set_transfer_hints): * src/ods-session.h: * src/ods-session.xml: Export RemoteCopy and RemoteMove methods through DBus, add function names to LOCK/UNLOCK debug messages 2009-01-24 Tadas Dailyda * src/ods-obex.c (ods_obex_put_full), (ods_obex_put), (ods_obex_put_image), (ods_obex_put_linked_thumbnail), (ods_obex_put_linked_attachment), (ods_obex_remote_display): * src/ods-obex.h: * src/ods-session.c (reset_transfer_hints), (ods_session_init), (ods_session_copy_remote_file_full), (ods_session_send_file_ext), (ods_session_set_transfer_hints), (ods_session_delete_remote_file): * src/ods-session.h: * src/ods-session.xml: Further work on FIFO support, fix up Session.SetTransferHints 2009-01-16 Tadas Dailyda * src/ods-session.c (ods_session_copy_remote_file_full): Fix Session.CopyRemoteFile.. to allow empty local_path 2008-11-30 Tadas Dailyda * src/ods-error.c (ods_error_get_type), (ods_error_err2gerror): * src/ods-error.h: * src/ods-manager.c (ods_manager_create_bluetooth_server): * src/ods-obex.c (get_target_size_and_time), (ods_obex_transfer_close), (ods_obex_disconnect), (fifo_watch), (ods_obex_readstream), (ods_obex_writestream), (ods_obex_get), (ods_obex_srv_get), (ods_obex_put_full), (ods_obex_srv_setpath), (ods_obex_put_image), (ods_obex_put_linked_thumbnail), (ods_obex_put_linked_attachment): * src/ods-obex.h: * src/ods-server-session.c (obex_suspend_request), (obex_request_put), (ods_server_session_accept), (ods_server_session_reject), (ods_server_session_cancel_internal): * src/ods-session.c (local_file_test), (reset_transfer_hints), (ods_session_init), (ods_session_finalize), (ods_session_copy_remote_file_full), (ods_session_get_by_type), (ods_session_send_file_ext), (ods_session_set_transfer_hints), (ods_session_delete_remote_file), (ods_session_put_linked_attachment): * src/ods-session.h: * src/ods-session.xml: Add support for using FIFOs instead of regular files for transfers, add Session.SetTransferHints for specifying different name, size and modification time when sending from FIFO 2008-11-27 Tadas Dailyda * src/ods-bluez.c (rfcomm_connect), (ods_bluez_get_client_socket), (ods_bluez_cancel_get_client_socket): * src/ods-bluez.h: Properly close RFCOMM socket in Manager.CancelSessionConnect 2008-11-27 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_put): * src/ods-obex.h: * src/ods-server-session.c (obex_request_put): Fix emmision of ServerSession.TransferCompleted signal when suspending small file transfer 2008-11-25 Tadas Dailyda * src/ods-server-session.c (obex_request_cancelled), (obex_suspend_request), (obex_request_put), (obex_event): Fix request suspending for very small files 2008-11-25 Tadas Dailyda * src/ods-obex.c (ods_obex_transfer_new): Reset obex_context->Cancelled for subsequent transfers 2008-11-24 Tadas Dailyda * src/ods-server-session.c (ods_server_session_cancel): Properly return from ServerSession.Cancel when no operation in progress 2008-11-24 Tadas Dailyda * src/ods-session.c (ods_session_cancel): Properly return from Session.Cancel when no operation in progress 2008-11-24 Tadas Dailyda * dbus-api.txt: Fix ErrorOccurred in docs (double 'r') 2008-11-24 Tadas Dailyda * src/ods-error.c (ods_error_get_type), (ods_error_obexrsp2gerror): * src/ods-error.h: Add UnsupportedMediaType error and fix another typo 2008-11-24 Tadas Dailyda * src/ods-error.c (ods_error_err2gerror): Fix a typo in error conversion code 2008-11-15 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_put): Fix a nasty crash when type header is not received 2008-11-14 Tadas Dailyda * src/ods-manager.c (server_closed_cb): Dispose server when it is Closed by client app (this was broken) 2008-11-14 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_put): * src/ods-server-session.c (obex_transfer_data_exchange_done), (obex_request_put), (obex_event): Fix emission of TransferStarted for PUT requests in ServerSession 2008-11-14 Tadas Dailyda * src/ods-server.c (ods_server_finalize): Properly close server socket 2008-11-14 Tadas Dailyda * src/ods-server-session.c (obex_transfer_data_exchange_done), (obex_request_put), (obex_event): Debug output when emitting TransferStarted signal 2008-11-14 Tadas Dailyda * src/ods-server-session.c (obex_request_cancelled), (obex_event): * src/ods-session.c (obex_request_cancelled), (obex_event): Fix cancelling of incoming transfers (fixes #147) 2008-11-14 Tadas Dailyda * dbus-api.txt: * src/ods-server-session.c (ods_server_session_cancel_internal): ServerSession.Cancel now also rejects incoming transfer if it is suspended (fixes #146) ====== obex-data-server-0.4.2 ====== 2008-11-01 Tadas Dailyda * dbus-api.txt: * src/ods-error.c (ods_error_get_type), (ods_error_err2gerror), (ods_error_obexrsp2gerror): * src/ods-error.h: * src/ods-session.c (obex_request_done), (ods_session_remote_action), (ods_session_remote_copy), (ods_session_remote_move): Implement RemoteCopy and RemoteMove methods in Session, add more errors corresponding to OBEX responses 2008-10-31 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_get): Another fix for ARM build (#144) 2008-10-30 Tadas Dailyda * configure.in: Use Wand.pc for ImageMagick PKG_CHECK since ImageMagick.pc links only to MagickCore in some distros 2008-10-29 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_put): * src/ods-server-session.c (obex_request_put): Avoid executing obex_request_put in ServerSession several times for the same transfer 2008-10-27 Tadas Dailyda * src/ods-manager.c (create_bluetooth_session_full): Avoid printing out NULL (fixes #143) 2008-10-26 Tadas Dailyda * configure.in: Check for Bluez 3.34 or later since older versions don't have sdp_extract_pdu_safe and sdp_extract_seqtype_safe functions ====== obex-data-server-0.4.1 ====== 2008-10-25 Tadas Dailyda * src/ods-obex.c (ods_obex_action): * src/ods-obex.h: Add CMD_ACTION function (no exposure in API yet) 2008-10-25 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_put): * src/ods-server-session.c (obex_transfer_data_exchange_done), (obex_event): * test/ods-server-test.py: Fix TransferStarted signal emission in ServerSession (hopefully this finally fixes #140) 2008-10-23 Tadas Dailyda * dbus-api.txt: * src/ods-server-session.c (ods_server_session_cancel): * src/ods-session.c (ods_session_setpath), (ods_session_get_by_type), (ods_session_delete_remote_file), (ods_session_remote_display_full), (ods_session_cancel): Do not use g_assert for checking if DBus context is set in Session and ServerSession methods, instead return Failed error (fixes #142) 2008-10-23 Tadas Dailyda * src/ods-server-session.c (setup_transport), (ods_server_session_set_property), (ods_server_session_class_init): * src/ods-server.c (server_session_fd_assign), (connect_callback): Ensure a time gap between Server.SessionCreated signal and ServerSession.TransferStarted signal (fixes a race condition when app misses TransferStarted signal; bugs #129, #140) ====== obex-data-server-0.4 ====== 2008-10-17 Tadas Dailyda * src/ods-obex.h: * test/Makefile.am: Increase default RX MTU (32767), distribute ods-bip-test.py 2008-10-17 Tadas Dailyda * src/ods-manager.c (ods_manager_create_usb_session): * src/ods-session.c (ods_session_setup_usbtransport): Small fixes for USB transport 2008-10-11 Tadas Dailyda * dbus-api.txt: * src/ods-manager.c (ods_manager_session_list_add), (string2service), (create_bluetooth_session_full), (ods_manager_create_usb_session), (ods_manager_dummy_obex_event), (ods_manager_get_usb_interfaces_num), (ods_manager_get_usb_interface_info): * src/ods-manager.h: * src/ods-manager.xml: * src/ods-obex.c (ods_obex_send): * src/ods-session.c (emit_connect_result_internal), (emit_disconnected), (obex_usbevent), (ods_session_setup_fdtransport), (ods_session_setup_usbtransport), (ods_session_set_property), (ods_session_get_property), (ods_session_class_init), (ods_session_new), (ods_process_usb_input): * src/ods-session.h: Add support for USB transport (sessions only): Thanks to Alex Kanavin for the complete patch 2008-10-09 Tadas Dailyda * dbus-api.txt: * src/ods-bluez.c (client_socket_connect_cb), (rfcomm_connect), (sdp_get_channel), (sdp_search_completed_cb), (sdp_search_process_cb), (sdp_connect_watch), (ods_bluez_get_client_socket), (ods_bluez_cancel_get_client_socket): * src/ods-bluez.h: * src/ods-manager.c (client_socket_connected_cb), (create_bluetooth_session_full), (ods_manager_get_session_info): Add BluetoothChannel (RFCOMM channel used for session) to SessionInfo 2008-10-09 Tadas Dailyda * dbus-api.txt: * src/ods-common.c (ods_hash_table_keys2strv): * src/ods-common.h: * src/ods-manager.c (ods_manager_get_session_list), (ods_manager_get_server_list), (ods_manager_get_version): * src/ods-manager.h: * src/ods-manager.xml: * src/ods-obex.c (ods_obex_connect_done), (ods_obex_srv_connect): * src/ods-server.c (ods_server_get_server_session_list): * src/ods-server.h: * src/ods-server.xml: Add Manager.GetVersion(), Manager.GetSessionList(), Manager.GetServerList(), Server.GetServerSessionList(); cleanup obex connect functions 2008-10-05 Tadas Dailyda * src/ods-imaging-helpers.c (ods_imaging_resize_image): * src/ods-server-session.c (send_image_handle), (obex_request_put), (obex_event): * test/ods-bip-test.py: Fix crash when BIP server receives small image, update ods-bip-test.py to handle transformations, fix gdk-pixbuf fill transformation 2008-10-05 Tadas Dailyda * configure.in: * src/Makefile.am: * src/ods-imaging-helpers.c (format_to_encoding), (encoding_to_pixbuf_format), (ods_imaging_pixbuf_new_with_format), (ods_imaging_get_image_info), (ods_imaging_resize_image), (ods_imaging_get_image_info_async), (ods_imaging_resize_image_async): * src/ods-main.c (main): Make it possible to use gdk-pixbuf instead of ImageMagick for BIP operations (thanks to Bastien Nocera for the patch) 2008-10-04 Tadas Dailyda * src/ods-imaging-helpers.c (ods_imaging_get_image_info), (ods_imaging_resize_image): Use g_stat instead of stat 2008-10-03 Tadas Dailyda * src/ods-bluez.c (client_socket_connect_cb), (sdp_session_get), (sdp_session_list_add), (sdp_session_list_remove), (add_bin_service_record), (ods_bluez_remove_service_record), (ods_bluez_finalize): * src/ods-bluez.h: * src/ods-manager.c (ods_manager_finalize): Fix SDP stuff for servers, properly close RFCOMM sockets when connecting fails 2008-09-23 Tadas Dailyda * src/ods-bluez.c (sdp_connect_watch), (ods_bluez_get_client_socket): * src/ods-manager.c (create_bluetooth_session_full): Make SDP connection non blocking, eliminate one dead end, make errors more informative 2008-09-23 Tadas Dailyda * configure.in: * src/ods-bluez.c (ods_bluez_cancellable_free), (rfcomm_connect), (sdp_get_channel), (sdp_search_completed_cb), (sdp_search_process_cb), (sdp_initiate_search), (sdp_connect_watch), (ods_bluez_get_client_socket), (ods_bluez_cancel_get_client_socket), (ods_bluez_get_server_socket), (add_bin_service_record), (ods_bluez_add_service_record), (ods_bluez_remove_service_record): * src/ods-bluez.h: * src/ods-manager.c (server_started_cb), (server_stopped_cb), (pattern2service), (string2service), (create_bluetooth_session_full), (cancel_session_connect), (ods_manager_create_bluetooth_server), (ods_manager_finalize): Rewrote all SDP client code using libbluetooth making ods Bluez 3.x and 4.x compatible out of the box 2008-09-12 Tadas Dailyda * src/ods-session.c (obex_request_done): Fix memory leak when returning result of GetCapability, GetImagingCapabilities or GetFolderListing 2008-09-12 Tadas Dailyda * src/ods-obex.c (ods_obex_srv_new_file), (ods_obex_get): Use proper 0666 mode when creating files (fixes #128) 2008-09-12 Tadas Dailyda * src/ods-error.c (ods_error_err2gerror): * src/ods-manager.c (session_connect_result_cb): * src/ods-obex.c (ods_obex_readstream), (ods_obex_writestream): * src/ods-obex.h: * src/ods-server-session.c (obex_transfer_data_exchange_done), (obex_event), (ods_server_session_cancel_internal), (ods_server_session_cancel): * src/ods-server-session.h: * src/ods-server.c (server_session_cancel), (server_session_finalize): * src/ods-session.c (obex_transfer_data_exchange_done), (obex_request_done), (obex_event), (ods_session_cancel_internal), (ods_session_cancel): * src/ods-session.h: * test/ods-bip-test.py: Rework cancel operation (both server and session wise); the new code works better when cancelling incoming transfer; link error handling fix for ods-bip-test.py 2008-08-25 Tadas Dailyda * src/ods-main.c (main): Add --version option, properly free GOptionContext 2008-08-24 Tadas Dailyda * src/ods-manager.c (client_socket_connected_cb): * src/ods-session.c (obex_io_callback), (ods_session_check_state), (ods_session_init), (ods_session_connect_internal), (ods_session_disconnect), (ods_session_close): Add SESSION_STATE_INIT to Session to better handle Session connection state 2008-08-24 Tadas Dailyda * src/ods-server-session.c (emit_disconnected), (ods_server_session_init), (ods_server_session_disconnect_internal): * src/ods-server-session.h: * src/ods-session.c (emit_connect_result_internal), (emit_disconnected), (obex_io_callback), (obex_request_done), (ods_session_setup_transport), (ods_session_init), (ods_session_disconnect_internal): * src/ods-session.h: Use g_strdup_printf for generating object paths, fix CONNECT_RESULT_INTERNAL and DISCONNECTED signal emission on Session and ServerSession objects 2008-08-20 Tadas Dailyda * src/ods-obex.c (ods_obex_transfer_new): * src/ods-obex.h: * src/ods-server-session.c (obex_event), (ods_server_session_accept), (ods_server_session_reject): * test/ods-server-test.py: Make Accept/Reject work without patched openobex, update ods-server-test.py to be able to interactively accept/reject transfers 2008-08-18 Tadas Dailyda * dbus-api.txt: * src/ods-manager.c (create_bluetooth_session_full): * src/ods-server-session.c (remote_display_action): * src/ods-session.c (ods_session_set_property), (ods_session_get_property), (ods_session_class_init), (ods_session_connect_internal), (get_image_info_cb), (ods_session_get_image_info), (ods_session_remote_display_full): * src/ods-session.h: * src/ods-session.xml: * test/ods-bip-test.py: * test/ods-server-test.py: Add Session.GetImageInfo method, fix Target UUID handling, fix RemoteDisplay Session implementation, make ods-bip-test.py a full blown BIP ImagePush testing app, update option parsing for ods-server-test.py 2008-08-12 Tadas Dailyda * dbus-api.txt: * src/ods-obex.c (ods_obex_transfer_get_info): * src/ods-server-session.c (obex_request_put), (obex_event), (ods_server_session_set_property), (ods_server_session_get_property), (ods_server_session_class_init), (ods_server_session_new): * src/ods-server-session.h: * src/ods-server.c (connect_callback), (ods_server_set_option): * src/ods-server.h: * src/ods-server.xml: * test/ods-server-test.py: Introduce Server.SetOption method, finishing touches for BIP server support, don't include Time in TransferInfo when no modtime available (differs from 0.3 behaviour), include Type in TransferInfo when available, update ods-server-test.py for better BIP handling 2008-08-09 Tadas Dailyda * src/ods-bluez.c (add_service_record_internal): Fix BIP SDP record 2008-08-06 Tadas Dailyda * src/ods-server-session.c (remote_display_action), (obex_event): Properly send image_handle along with last packet for BIP PutImage 2008-08-06 Tadas Dailyda * dbus-api.txt: * src/ods-obex.c (ods_obex_srv_remote_display): * src/ods-server-session.c (remote_display_action), (obex_event), (ods_server_session_class_init): * src/ods-server-session.h: * src/ods-server-session.xml: Implement RemoteDisplay server-side handling, add RemoteDisplayRequested signal to ServerSession 2008-08-05 Tadas Dailyda * src/ods-bluez.c (add_service_record_internal): * src/ods-obex.c (ods_obex_transfer_add_info), (ods_obex_srv_connect), (ods_obex_readstream), (ods_obex_srv_get): * src/ods-server-session.c (image_list_add), (obex_event), (ods_server_session_init), (ods_server_session_finalize): First working BIP Image Push server (does not return image handle properly) 2008-08-05 Tadas Dailyda * src/ods-obex.c (ods_obex_transfer_get_info), (ods_obex_put_image), (ods_obex_put_linked_attachment): * src/ods-obex.h: * src/ods-server-session.c (ods_server_session_get_transfer_info): * src/ods-session.c (ods_session_get_transfer_info): Add extended info for Imaging Initiator functionality, rework GetTransferInfo on Session and ServerSession object 2008-08-04 Tadas Dailyda * dbus-api.txt: * src/ods-obex.c (ods_obex_transfer_close), (ods_obex_transfer_add_info), (ods_obex_put_full), (ods_obex_srv_put_image), (ods_obex_srv_put_linked_thumbnail), (ods_obex_srv_put_linked_attachment), (ods_obex_srv_remote_display), (ods_obex_srv_put): * src/ods-obex.h: * src/ods-server-session.c (obex_event): * src/ods-session.c (ods_session_copy_remote_file_full), (ods_session_copy_remote_file), (ods_session_copy_remote_file_by_type), (ods_session_send_file_ext), (ods_session_send_file), (ods_session_get_transfer_info): * src/ods-session.h: * src/ods-session.xml: Add SendFileExt and CopyRemoteFileByType to Session (bugs #71, #112), continue work on BIP server-side functions 2008-08-01 Tadas Dailyda * src/ods-obex.c (ods_obex_transfer_close), (ods_obex_put_full), (ods_obex_srv_put_image), (ods_obex_srv_put_linked_thumbnail), (ods_obex_srv_put_linked_attachment), (ods_obex_srv_remote_display), (ods_obex_srv_put): * src/ods-obex.h: Start BIP server-side function implementation 2008-08-01 Tadas Dailyda * src/ods-imaging-helpers.c (img_parse_element_start), (parse_descriptor), (parse_image_descriptor), (parse_attachment_descriptor): * src/ods-imaging-helpers.h: New functions for parsing BIP Image and Attachment descriptors 2008-07-30 Tadas Dailyda * src/ods-manager.c (server_started_cb), (ods_manager_create_bluetooth_server): Add BIP SDP record for Server 2008-07-29 Tadas Dailyda * configure.in: * data/Makefile.am: * data/capability.xml: * data/imaging_capabilities.xml: * src/Makefile.am: * src/ods-capabilities.c (ods_get_variable), (ods_insert_variables), (ods_get_capability), (ods_get_imaging_capabilities): * src/ods-capabilities.h: * src/ods-obex.c (ods_obex_srv_get): Add x-obex/capability and x-bt/img-capabilities XML objects support 2008-07-25 Tadas Dailyda * dbus-api.txt: * src/ods-bluez.c (ods_bluez_cancellable_free), (client_socket_connect_cb), (rfcomm_connect), (get_remote_service_record_cb), (get_remote_service_handles_cb), (ods_bluez_get_client_socket), (ods_bluez_cancel_get_client_socket): * src/ods-bluez.h: * src/ods-error.c (ods_error_get_type): * src/ods-error.h: * src/ods-manager.c (ods_manager_session_list_add), (client_socket_connected_cb), (create_bluetooth_session_full), (cancel_session_connect), (ods_manager_cancel_session_connect), (ods_manager_session_finalize): * src/ods-manager.h: * src/ods-manager.xml: * src/ods-session.c (obex_io_callback), (ods_session_disconnect), (ods_session_close): * test/ods-dbus-test.c (session_connected_cb), (create_bluetooth_session): Implement CancelSessionConnect for Manager, remove unnecessary call to g_source_remove in OdsSession 2008-07-25 00:08 Tadas Dailyda * ChangeLog, NEWS: Generate ChangeLog with svn2cl, properly use NEWS file 2008-07-23 20:00 Tadas Dailyda * ChangeLog, configure.in, dbus-api.txt, src/ods-imaging-helpers.c, test/ods-bip-test.py: Fix optional BIP support, merge ChangeLog from 0.3.4 2008-07-21 16:18 Tadas Dailyda * data/Makefile.am, data/obex-data-server.service.in: change dbus service file accordingly when --enable-system-config is used 2008-07-21 15:31 Tadas Dailyda * configure.in, src/ods-imaging-helpers.c, src/ods-main.c, src/ods-session.c: Make ImageMagick and threading support for BIP optional (--disable-image-magick) 2008-07-21 12:17 Tadas Dailyda * configure.in: minor change for (#98) build warnings 2008-07-21 12:11 Tadas Dailyda * src/ods-obex.c: Fix signed/unsigned comparison 2008-07-21 11:51 Tadas Dailyda * src/ods-imaging-helpers.c, src/ods-obex.c, src/ods-obex.h, src/ods-session.c: set target_size for BIP transfers 2008-07-18 22:53 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-manager.c, test/ods-bip-test.py: First somewhat working ImagePush client 2008-07-18 17:15 Tadas Dailyda * src/ods-common.c: really fix bad utf conversion bug 2008-07-18 16:42 Tadas Dailyda * dbus-api.txt, src/ods-common.c, src/ods-imaging-helpers.c, src/ods-imaging-helpers.h, src/ods-marshal.list, src/ods-obex.c, src/ods-session.c, src/ods-session.h, src/ods-session.xml: Implement ImageHandleReceived signal, send thumbnail when BIP responder requests, fix bad utf conversion bug 2008-07-17 16:20 Tadas Dailyda * dbus-api.txt, src/ods-imaging-helpers.c, src/ods-obex.c, src/ods-obex.h, src/ods-session.c, src/ods-session.h, src/ods-session.xml: Add PutLinkedAttachment to Session, fix RemoteDisplay functions 2008-07-16 14:44 Tadas Dailyda * configure.in, dbus-api.txt, src/Makefile.am, src/ods-bluez.c, src/ods-bluez.h, src/ods-imaging-helpers.c, src/ods-imaging-helpers.h, src/ods-main.c, src/ods-manager.c, src/ods-session.c, src/ods-session.h, src/ods-session.xml: PutImage, PutImageResized, imaging-feature property for OdsSession, fix session socket binding/closing, disable Session functions according to used profile, link against gthread, update API docs with BIP functions, other fixes 2008-07-10 18:12 Tadas Dailyda * src/ods-bluez.c, src/ods-common.h, src/ods-manager.c, src/ods-manager.h, src/ods-manager.xml, src/ods-obex.h, src/ods-session.c, src/ods-session.h, src/ods-session.xml: Further SDP record registering fixes, refactoring of OdsSession and addition of BIP RemoteDisplay functions to OdsSession 2008-07-10 12:18 Tadas Dailyda * src/ods-bluez.c, src/ods-obex.h: Fix SDP record registering (bug #102) 2008-07-09 22:02 Tadas Dailyda * src/ods-obex.c, src/ods-obex.h: Add BIP RemoteDisplay function 2008-07-09 18:58 Tadas Dailyda * configure.in, src/Makefile.am, src/ods-imaging-helpers.c, src/ods-imaging-helpers.h: Implement BIP image transformation functions (uses ImageMagick) 2008-07-04 15:05 Tadas Dailyda * dbus-api.txt, src/ods-session.c, src/ods-session.h, src/ods-session.xml, test/ods-dbus-test.c: BIP GetImagingCapabilities() 2008-07-04 09:29 Tadas Dailyda * src/ods-manager.c, src/ods-session.c: BIP testing stuff 2008-07-03 19:24 Tadas Dailyda * src/Makefile.am, src/ods-bluez.c, src/ods-imaging-descriptors.c, src/ods-imaging-descriptors.h, src/ods-imaging-helpers.c, src/ods-imaging-helpers.h, src/ods-obex.c, src/ods-obex.h: Add BIP PutImage, PutLinkedThumbnail and PutLinkedAttachment 2008-07-03 15:09 Tadas Dailyda * src/ods-bluez.c: Fix socket condition checking in session connection 2008-07-03 14:14 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-manager.c: Unhardcode BIP SDP data, some checks 2008-07-02 00:23 Tadas Dailyda * configure.in, dbus-api.txt, src/ods-bluez.c, src/ods-error.c, src/ods-error.h, src/ods-manager.c, src/ods-manager.h, src/ods-manager.xml, src/ods-marshal.list, src/ods-session.c, src/ods-session.h, src/ods-session.xml, test/ods-dbus-test.c: Redesign Session connection (bugs #19, #53) 2008-07-01 06:52 Tadas Dailyda * data/Makefile.am, data/obex-data-server.1: Add manbearpig :) 2008-06-27 17:13 Tadas Dailyda * ChangeLog, configure.in, src/ods-server.c: merge ods-0_3 branch 2008-06-27 15:16 Tadas Dailyda * src/ods-server-session.c, src/ods-session.c: close session sockets 2008-06-27 15:13 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h: Add more BIP SDP stuff 2008-06-27 13:51 Tadas Dailyda * src/Makefile.am, src/ods-bluez.c, src/ods-common.h, src/ods-folder-listing.c, src/ods-imaging-descriptors.c, src/ods-imaging-descriptors.h, src/ods-manager.c, src/ods-manager.h, src/ods-obex.h: add BIP stuff 2008-06-26 21:22 Tadas Dailyda * dbus-api.txt, src/ods-manager.c: Update SessionInfo and ServerInfo in Manager 2008-06-26 21:05 Tadas Dailyda * dbus-api.txt, src/ods-bluez.c, src/ods-bluez.h, src/ods-manager.c, src/ods-manager.h, src/ods-manager.xml, test/ods-dbus-test.c, test/ods-session-test.py: Allow to choose hci device when creating Bluetooth Session (#52) (API CHANGE) 2008-06-25 18:56 Tadas Dailyda * ChangeLog, configure.in: Final fixes for 0.3.2 2008-06-19 12:02 Tadas Dailyda * ChangeLog, configure.in: Prepare for 0.3.2 release 2008-06-18 15:34 Tadas Dailyda * src/ods-manager.c, src/ods-session.c, test/ods-dbus-test.c: Final memory leak fixes (bugs #46, #74) 2008-06-18 14:24 Tadas Dailyda * src/ods-common.h: Add BIP UUIDs 2008-06-18 12:44 Tadas Dailyda * src/ods-server-session.c: check current path permission before accepting PUT (bug #88) 2008-06-17 21:16 Tadas Dailyda * src/ods-obex.c, src/ods-server-session.c, src/ods-session.c: Fix session/server-session finalizing 2008-06-05 15:19 Tadas Dailyda * src/ods-obex.c: Enable sending empty NAME header for SETPATH 2008-06-02 13:02 Tadas Dailyda * src/ods-common.c, src/ods-error.c, src/ods-error.h, src/ods-obex.c: Improve server-side error reporting, check for connection id (fixes #90, #92) 2008-05-30 20:54 Tadas Dailyda * src/ods-bluez.c, src/ods-common.c, src/ods-common.h, src/ods-manager.c: portability fixes (#91) 2008-05-30 18:21 Tadas Dailyda * src/ods-server.c: Fix #83 for real 2008-05-29 17:56 Tadas Dailyda * src/ods-manager.c: small fix 2008-05-28 21:16 Tadas Dailyda * src/ods-server.c: small fix 2008-05-28 21:05 Tadas Dailyda * src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-server.c: don't use GObject dispose in manager, another fix for #83 2008-05-28 13:43 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-common.c, src/ods-common.h, src/ods-error.c, src/ods-error.h, src/ods-folder-listing.c, src/ods-folder-listing.h, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-server-session.h, src/ods-server.c, src/ods-server.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c: Fix #85, #86; update copyright info and mode lines 2008-05-27 14:03 Tadas Dailyda * src/ods-manager.c: Fix crash on exit (#83, patch by Larry) 2008-05-22 21:21 Tadas Dailyda * src/ods-folder-listing.c: use UTF8 filenames in folder listing (#78) 2008-05-22 21:00 Tadas Dailyda * src/ods-manager.c, src/ods-server.c, src/ods-server.h: Fix #77 2008-05-22 20:45 Tadas Dailyda * src/ods-server-session.c: disable CMD_SETPATH for OPP (patch by Larry) 2008-05-21 23:01 Tadas Dailyda * src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c: Check TARGET headers (patch by Larry Jr) 2008-05-19 17:53 Tadas Dailyda * src/ods-bluez.c: Fix ods-bluez.c 2008-05-16 12:31 Tadas Dailyda * src/ods-manager.c: don't try to remove SDP record when it's not registered (patch by Claudio Takahasi; #79) 2008-05-13 23:38 Tadas Dailyda * src/ods-bluez.c, src/ods-common.h, src/ods-error.c, src/ods-manager.h, src/ods-session.c: implement Nokia FTP workaround (#55), fix ods-error.c, fix session path handling 2008-05-12 22:21 Tadas Dailyda * src/ods-obex.c: Fix one more invalid pointer free 2008-05-12 22:08 Tadas Dailyda * src/ods-obex.c: fix freeing invalid pointer (patch by Vinicius Gomes) 2008-05-12 19:52 Tadas Dailyda * src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, test/ods-server-test.py: Fix Accept/Reject #54 (only works with patched openobex-cvs) 2008-05-07 17:42 Tadas Dailyda * src/ods-bluez.c, src/ods-common.c, src/ods-common.h, src/ods-obex.c: fix for non-UTF8 locales (bug #67) 2008-04-01 12:46 Tadas Dailyda * ChangeLog: update changelog 2008-04-01 12:42 Tadas Dailyda * ChangeLog, configure.in: Prepare for 0.3.1 release 2008-04-01 12:30 Tadas Dailyda * src/ods-session.c, test/ods-dbus-test.c, test/ods-server-test.py: Revert changes unneeded for upcoming bugfix release 2008-03-25 09:56 Tadas Dailyda * src/ods-session.c, test/ods-dbus-test.c: a proof for #53 2008-03-12 17:13 Tadas Dailyda * dbus-api.txt, src/ods-error.c, src/ods-error.h, src/ods-session.c, test/ods-server-test.py: Possibly fix #53 2008-03-07 15:16 Tadas Dailyda * dbus-api.txt, src/ods-bluez.c, src/ods-common.h, src/ods-manager.c: Support for PBAP server (#60) 2008-03-07 00:15 Tadas Dailyda * src/ods-session.c: bah 2008-03-06 23:49 Tadas Dailyda * dbus-api.txt: update docs 2008-03-06 20:47 Tadas Dailyda * src/ods-bluez.c, src/ods-manager.c, src/ods-session.c: Some small changes 2008-03-05 20:23 Tadas Dailyda * src/ods-main.c: use setlocale 2008-03-05 20:13 Tadas Dailyda * configure.in, src/ods-server-session.c, src/ods-session.c: maybe fix #57 and fix naming issue in configure.in 2008-03-02 22:42 Tadas Dailyda * src/ods-session.c: revert patch 2008-03-02 15:59 Tadas Dailyda * src/ods-session.c: Fix #57 2008-03-01 19:41 Tadas Dailyda * src/ods-server-session.c: fix possible bug 2008-02-29 23:47 Tadas Dailyda * test/ods-server-test.py: update ods-server-test.py 2008-02-21 22:40 Tadas Dailyda * ChangeLog: update changelog 2008-02-21 22:35 Tadas Dailyda * configure.in, dbus-api.txt, src/ods-bluez.c, src/ods-manager.c, src/ods-manager.h, src/ods-manager.xml, src/ods-server.c, src/ods-server.h, src/ods-server.xml, test/ods-server-test.py: move require_pairing to Manager.CreateBluetoothServer, memory fixes, prepare for 0.3 2008-02-12 17:19 Tadas Dailyda * ChangeLog, configure.in, src/ods-folder-listing.c: exclude dot files from folder listings, prepare for 0.2 release 2008-02-12 16:38 Tadas Dailyda * dbus-api.txt, src/ods-server-session.c, src/ods-server-session.h, src/ods-server-session.xml: Fix Accept function 2008-02-12 16:19 Tadas Dailyda * configure.in, data/Makefile.am, src/ods-bluez.c, src/ods-bluez.h, src/ods-common.c, src/ods-common.h, src/ods-error.c, src/ods-error.h, src/ods-folder-listing.c, src/ods-folder-listing.h, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-server-session.h, src/ods-server.c, src/ods-server.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c, test/ods-server-test.py: implement Accept/Reject for ServerSession, make dbus system config file optional, fix licencing info 2008-02-11 17:59 Tadas Dailyda * src/ods-folder-listing.c, src/ods-folder-listing.h, src/ods-manager.c, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-server-session.h, src/ods-server.c, src/ods-server.h: Fix allow_write==false handling, fix SDP record for server lifetime 2008-02-11 15:54 Tadas Dailyda * dbus-api.txt, src/ods-server-session.c, src/ods-server-session.h, src/ods-server-session.xml, src/ods-server.c, src/ods-server.h, src/ods-server.xml, test/ods-server-test.py: Implement allow_write and require_pairing for Server.Start() 2008-02-11 04:13 Tadas Dailyda * dbus-api.txt, src/ods-server-session.h, src/ods-server.h, src/ods-session.h, test/Makefile.am: make object paths lowercase, distribute python tests 2008-02-06 23:16 Tadas Dailyda * dbus-api.txt: doc update 2008-02-06 22:30 Tadas Dailyda * src/ods-bluez.c: more mem fixes 2008-02-06 21:27 Tadas Dailyda * Makefile.am, configure.in, src/ods-bluez.c, src/ods-manager.c, src/ods-manager.xml, src/ods-server.c, src/ods-server.xml, test/ods-dbus-test.c: Use o type signature, properly free memory for D-Bus calls, prepare for 0.1 2008-02-06 11:51 Tadas Dailyda * dbus-api.txt: doc update 2008-02-06 11:45 Tadas Dailyda * src/ods-bluez.c: more memory handling fixes 2008-02-06 10:39 Tadas Dailyda * src/ods-manager.c, test/ods-dbus-test.c: smth 2008-02-06 00:08 Tadas Dailyda * src/Makefile.am, src/ods-bluez.c, src/ods-bluez.h, src/ods-manager.c, src/ods-session.c: Patch from Manuel Naranjo (#34) and some memory handling fixes 2008-02-04 16:20 Tadas Dailyda * src/ods-bluez.c: fix #41 2008-01-24 18:00 Tadas Dailyda * configure.in, dbus-api.txt, src/ods-server-session.xml, src/ods-session.c, src/ods-session.h, src/ods-session.xml, test/ods-dbus-test.c: Fix stuff that became broken because of API change 2008-01-24 16:21 Tadas Dailyda * configure.in, src/ods-main.c: Fix #25 2008-01-24 15:28 Tadas Dailyda * dbus-api.txt, src/ods-folder-listing.c, src/ods-marshal.list, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-server-session.h, src/ods-session.c, test/ods-dbus-test.c: Fix #20, #32 2008-01-24 00:56 Tadas Dailyda * dbus-api.txt, src/ods-obex.c: minor cleanup 2008-01-23 22:08 Tadas Dailyda * src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-session.c: fix #20 (hopefully :)) 2008-01-23 17:15 Tadas Dailyda * src/ods-bluez.c, src/ods-session.c: Fix ChangeCurrentFolder in Session and Memory bug in ods-bluez (thanks to Manuel Naranjo) 2008-01-22 20:51 Tadas Dailyda * src/ods-server-session.c, src/ods-server.c: Fix #23 and #27 2008-01-22 20:18 Tadas Dailyda * dbus-api.txt, src/Makefile.am, src/ods-error.c, src/ods-error.h, src/ods-manager.c: Fix #30 2008-01-21 20:26 Tadas Dailyda * test/ods-dbus-test.c: ods-dbus-test only for OPP and SendFile() testing 2008-01-21 19:46 Tadas Dailyda * configure.in, src/Makefile.am, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-server.c, src/ods-server.h: Fix #21, #26, some autotools polishing by hadess 2007-12-22 18:05 Tadas Dailyda * src/ods-common.c, src/ods-common.h, src/ods-main.c: fix #31 (Thanks to Christopher Brill and Manuel Naranjo) 2007-12-22 18:02 Tadas Dailyda * Makefile.am, configure.in, data/Makefile.am, data/obex-data-server.conf: fix #31 (Thanks to Christopher Brill and Manuel Naranjo) 2007-11-30 17:03 Tadas Dailyda * src/ods-main.c, src/ods-manager.c, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c: Fix #20 2007-11-29 22:01 Tadas Dailyda * src/ods-manager.c: preliminary fix for #21 2007-11-28 17:49 Tadas Dailyda * data/obex-data-server.service.in: fix .service file 2007-11-25 18:45 Tadas Dailyda * dbus-api.txt: more doc updates 2007-11-25 18:35 Tadas Dailyda * dbus-api.txt: more doc updates 2007-11-25 17:45 Tadas Dailyda * dbus-api.txt: doc update 2007-11-25 17:39 Tadas Dailyda * src/ods-server.c, test/ods-server-test.py: use baswap for getServerSessionInfo stuff 2007-11-25 17:33 Tadas Dailyda * src/ods-server.c, src/ods-server.h, src/ods-server.xml, test/ods-server-test.py: GetServerSessionInfo function in Server object 2007-11-24 17:38 Tadas Dailyda * src/ods-manager.c: fix GetSessionInfo 2007-11-23 23:24 Tadas Dailyda * dbus-api.txt, src/ods-manager.c, src/ods-manager.h, src/ods-manager.xml: GetSessionInfo and GetServerInfo functions for Manager object 2007-10-26 00:37 Tadas Dailyda * test/ods-dbus-test.c: test app unhardcoding 2007-10-01 20:11 Tadas Dailyda * src/ods-bluez.c, src/ods-obex.c, src/ods-session.c: Input validation in OdsSession 2007-09-14 20:30 Tadas Dailyda * dbus-api.txt, src/ods-manager.c, src/ods-obex.c, src/ods-server-session.c, src/ods-server-session.h, src/ods-server.c, src/ods-server.h, src/ods-server.xml, test/ods-server-test.py, test/ods-session-test.py: Documentation updates, add allow_delete option to Server 2007-09-11 21:21 Tadas Dailyda * x: testing 2007-09-11 21:20 Tadas Dailyda * x: testing 2007-09-11 17:27 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-manager.c, src/ods-manager.h, src/ods-manager.xml, src/ods-server.c, src/ods-session.c, src/ods-session.h: Make Session connecting non-blocking, remove auto_connect option when creating session : tds 2007-09-07 17:22 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-manager.c, src/ods-obex.c, src/ods-server-session.c, src/ods-server-session.h, src/ods-server.c, src/ods-session.c: Implemented proper server finalization, finished ServerSession implementation 2007-09-04 17:03 Tadas Dailyda * src/ods-folder-listing.c, src/ods-manager.c, src/ods-obex.c, src/ods-session.c: Fix stupid bug, make it build both under 32 and 64 bit 2007-09-02 18:42 Tadas Dailyda * configure.in: correct glib dependency 2007-09-02 18:36 Tadas Dailyda * src/ods-folder-listing.c: blah 2007-09-02 18:34 Tadas Dailyda * ., src/ods-common.c, src/ods-common.h, src/ods-session.c: further 64bit fixes 2007-09-02 14:49 Tadas Dailyda * src/ods-folder-listing.c, src/ods-manager.c, src/ods-obex.c: 64-bit fixes 2007-09-02 14:28 Tadas Dailyda * dbus-api.txt, src/ods-error.c, src/ods-folder-listing.c, src/ods-manager.c, src/ods-obex.c, src/ods-session.c: replace Mutex with StaticMutex, other fixes 2007-08-30 18:14 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-obex.c, src/ods-server-session.c, src/ods-server-session.h: minor fixes : tds 2007-08-29 23:00 Tadas Dailyda * src/ods-common.c, src/ods-manager.c: Use bachk() 2007-08-29 22:51 Tadas Dailyda * src/ods-common.c, src/ods-common.h, src/ods-manager.c, src/ods-session.c: Use NameOwnerChanged DBus signal to determine when client disconnects from bus 2007-08-28 18:01 Tadas Dailyda * Makefile.am, data/ftp-service-record.xml, data/opp-service-record.xml, src/ods-bluez.c, src/ods-common.h, src/ods-manager.h: Use binary SDP records instead of XML 2007-08-28 14:10 Tadas Dailyda * Makefile.am, configure.in, data/Makefile.am, src, src/Makefile.am, src/dbus, src/ods-manager.c, src/ods-manager.xml, src/ods-server-session.c, src/ods-server-session.xml, src/ods-server.c, src/ods-server.xml, src/ods-session.c, src/ods-session.xml, test/Makefile.am: even more build cleanup 2007-08-28 13:34 Tadas Dailyda * Makefile.am, autogen.sh, configure.in, src/Makefile.am, src/dbus/Makefile.am, src/dbus/ods-server-session-dbus-glue.h, src/ods-bluez.c, src/ods-main.c, src/ods-manager.c, src/ods-obex.c, src/ods-session.c, test/Makefile.am: more build fixage 2007-08-28 12:03 Tadas Dailyda * acinclude.m4, aclocal, configure.in, data/Makefile.am, data/obex-data-server.conf, src/ods-session.c: autotools fixage : tds 2007-08-27 19:37 Tadas Dailyda * test/ods-server-test.py: b 2007-08-27 19:27 Tadas Dailyda * src/ods-bluez.c, src/ods-bluez.h, src/ods-server-session.c, test/ods-server-test.py: some fixes, ods-server-test improvements 2007-08-16 17:04 Tadas Dailyda * src/Makefile.am, src/dbus/ods-server-session-dbus-glue.h, src/ods-bluez.c, src/ods-common.c, src/ods-common.h, src/ods-error.c, src/ods-folder-listing.c, src/ods-folder-listing.h, src/ods-main.c, src/ods-manager.c, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-server.c, src/ods-session.h, test/ods-server-test.py: OBEX Object Push and OBEX FTP server implementation 2007-08-02 12:32 Tadas Dailyda * src/Makefile.am, src/ods-common.c, src/ods-common.h, src/ods-obex.c, src/ods-obex.h, src/ods-server-session.c, src/ods-server.c, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h: some refactoring, further work on OdsServerSession GObject 2007-07-31 13:30 Tadas Dailyda * configure.in, data/ftp-service-record.xml, src/Makefile.am, src/dbus/Makefile.am, src/dbus/ods-server-session-dbus-glue.h, src/dbus/ods-server-session.xml, src/ods-bluez.c, src/ods-error.c, src/ods-error.h, src/ods-server-session.c, src/ods-server-session.h, src/ods-server.c, src/ods-server.h: Server session stuff, further work on Server GObject :tds 2007-07-30 15:27 Tadas Dailyda * configure.in, data/opp-service-record.xml, src/dbus/ods-server.xml, src/ods-bluez.c, src/ods-main.c, src/ods-manager.c, src/ods-server.c, src/ods-server.h, test/ods-server-test.py: server registers records / accepts client connections 2007-07-26 21:34 Tadas Dailyda * src/Makefile.am, src/dbus, src/ods-server.c, src/ods-server.h: server.{c|h} skeleton 2007-07-26 17:20 Tadas Dailyda * dbus-api.txt, src/dbus/Makefile.am, src/dbus/ods-manager.xml, src/dbus/ods-server.xml, src/ods-bluez.c, src/ods-bluez.h, src/ods-common.h, src/ods-manager.c, src/ods-manager.h, src/ods-server.c, src/ods-server.h, test/ods-session-test.py: Beginnings of server implementation 2007-07-19 16:12 Tadas Dailyda * src/ods-session-low-level.c, src/ods-session.c, src/ods-session.h, test/ods-session-test.py: final session impl : tds 2007-07-17 23:27 Tadas Dailyda * dbus-api.txt, src/ods-bluez.c, src/ods-error.c, src/ods-error.h, src/ods-main.c, src/ods-manager.c, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c, test/ods-session-test.py: Full Session implementation (some minor fixes left do be done) 2007-07-16 20:22 Tadas Dailyda * src/dbus/ods-session.xml, src/ods-error.c, src/ods-error.h, src/ods-marshal.list, src/ods-session-low-level.c, src/ods-session.c, src/ods-session.h, test/Makefile.am, test/ods-dbus-test.c: All Operations (except Cancel) working: tds 2007-07-16 13:09 Tadas Dailyda * dbus-api.txt, src/dbus/ods-session.xml, src/ods-bluez.c, src/ods-error.c, src/ods-manager.c, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c: Working RetrieveFolderListing, all SetPath methods 2007-07-14 17:25 Tadas Dailyda * src/Makefile.am, src/dbus/ods-session.xml, src/ods-error.h, src/ods-manager.c, src/ods-manager.h, src/ods-session.c, test/ods-dbus-test.c: Working Connect, Disconnect, Close for Session 2007-07-14 15:19 Tadas Dailyda * dbus-api.txt, src/Makefile.am, src/dbus/ods-manager.xml, src/ods-bluez.c, src/ods-bluez.h, src/ods-error.c, src/ods-error.h, src/ods-manager-low-level.c, src/ods-manager-low-level.h, src/ods-manager.c, src/ods-manager.h, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c: Very close to full session implementation now 2007-07-12 12:41 Tadas Dailyda * src/ods-common.c, src/ods-common.h, src/ods-error.c, src/ods-error.h, src/ods-manager-low-level.c, src/ods-manager-low-level.h, src/ods-manager.c, src/ods-manager.h, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c: More on session implementation 2007-07-10 19:29 Tadas Dailyda * src/Makefile.am, src/dbus/ods-session.xml, src/ods-common.c, src/ods-common.h, src/ods-main.c, src/ods-manager-low-level.c, src/ods-manager.c, src/ods-manager.h, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c: Further work on session implementation 2007-06-27 10:23 Tadas Dailyda * data/obex-data-server.conf, data/obex-data-server.service.in, src/ods-session-low-level.c, src/ods-session-low-level.h, src/ods-session.c, src/ods-session.h: some fixes, beginnings of session implementation 2007-06-26 16:19 Tadas Dailyda * dbus-api.txt, src/Makefile.am, src/ods-error.c, src/ods-error.h, src/ods-manager-low-level.c, src/ods-manager-low-level.h, src/ods-manager.c, src/ods-manager.h, src/ods-session.c, src/ods-session.h, test/ods-dbus-test.c: move errors to global domain, some other stuff: tds 2007-06-26 00:14 Tadas Dailyda * src/Makefile.am, src/dbus/ods-manager.xml, src/ods-manager-low-level.c, src/ods-manager-low-level.h, src/ods-manager.c, src/ods-manager.h, src/ods-session.c, src/ods-session.h: further non-productive work 2007-06-22 23:51 Tadas Dailyda * dbus-api.txt, src/ods-manager.c, src/ods-session.c, src/ods-session.h: smth 2007-06-21 23:49 Tadas Dailyda * src/dbus/ods-manager.xml, src/ods-common.c, src/ods-common.h, src/ods-manager.c, src/ods-manager.h, test/ods-dbus-test.c: even more to come 2007-06-21 19:58 Tadas Dailyda * Makefile.am, configure.in, dbus-api.txt, src/Makefile.am, src/dbus/ods-manager.xml, src/ods-common.c, src/ods-common.h, src/ods-const.h, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-session.c, test, test/Makefile.am, test/ods-dbus-test.c: Further war with dbus-glib 2007-06-20 23:20 Tadas Dailyda * Makefile.am, src/dbus/ods-manager.xml, src/dbus/ods-session.xml, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-session.c, src/ods-session.h, test, test/Makefile.am: Further work 2007-06-20 14:08 Tadas Dailyda * configure.in, src, src/Makefile.am, src/dbus, src/dbus/Makefile.am, src/dbus/ods-session.xml, src/ods-marshal.list, src/ods-session.c, src/ods-session.h: Beginnings of session class 2007-06-19 21:28 Tadas Dailyda * dbus-api.txt, src, src/Makefile.am, src/dbus/ods-manager.xml, src/ods-const.h, src/ods-main.c, src/ods-manager.c, src/ods-manager.h, src/ods-session.c, src/ods-session.h: fixed D-Bus API + some other code 2007-06-15 21:52 Tadas Dailyda * ., data, src, src/dbus: svn:ignore 2007-06-15 21:28 Tadas Dailyda * ., AUTHORS, COPYING, ChangeLog, INSTALL, Makefile.am, NEWS, README, aclocal, aclocal/as_ac_expand.m4, autogen.sh, configure.in, data, data/Makefile.am, data/obex-data-server.conf, data/obex-data-server.service.in, dbus-api.txt, src, src/Makefile.am, src/dbus, src/dbus/Makefile.am, src/dbus/ods-manager.xml, src/ods-main.c, src/ods-manager.c, src/ods-manager.h: initial layout obex-data-server-0.4.6/data/0000755000175000017500000000000011546317666012622 500000000000000obex-data-server-0.4.6/data/obex-data-server.10000644000175000017500000000200011524724173015753 00000000000000.TH obex-data-server "1" "18 October 2009" .SH NAME obex-data-server \- D-Bus service providing OBEX functionality .SH SYNOPSIS .B obex-data-server [OPTIONS] .SH DESCRIPTION .PP .B obex-data-server is D-Bus service providing high-level OBEX client and server side functionality. It currently supports OPP (Object Push Profile), FTP (File Transfer profile) and partially BIP (Basic Imaging profile). Supported transports are Bluetooth, USB (client only) or TTY. obex-data-server exposes it's functionality through 'org.openobex' namespace in D-Bus. .SH OPTIONS .IP "-n, --no-daemon" Do not daemonize the service .IP "-s, --system-bus" Use D-Bus System bus instead of the default Session bus .IP "-l, --log" Log all messages to syslog .IP "-d, --debug" Enable debugging messages .IP "-v, --version" Show version of obex-data-server and exit immediately .SH AUTHOR .PP This manual page was written by Tadas Dailyda . .SH "REPORTING BUGS" Report bugs to http://bugs.muiline.com (obex-data-server project). obex-data-server-0.4.6/data/obex-data-server.service.in0000644000175000017500000000013411524724173017666 00000000000000[D-BUS Service] Name=org.openobex Exec=@servicedir@/obex-data-server --no-daemon @add_args@ obex-data-server-0.4.6/data/imaging_capabilities.xml0000644000175000017500000000042011524724173017373 00000000000000 obex-data-server-0.4.6/data/capability.xml0000644000175000017500000000054711524724173015402 00000000000000 Generic Computer Filesystem {$MEM_FREE} {$MEM_USED} obex-data-server-0.4.6/data/obex-data-server.conf0000644000175000017500000000111011524724173016541 00000000000000 obex-data-server-0.4.6/install-sh0000755000175000017500000003253711331674343013635 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2009-04-28.21; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # Protect names starting with `-'. case $dst in -*) dst=./$dst;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; -*) prefix='./';; *) prefix='';; esac eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: obex-data-server-0.4.6/Makefile.in0000644000175000017500000010522611546317437013700 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = src/obex-data-server$(EXEEXT) noinst_PROGRAMS = test/ods-dbus-test$(EXEEXT) subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ depcomp install-sh missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" \ "$(DESTDIR)$(configdir)" "$(DESTDIR)$(dbusconfigdir)" \ "$(DESTDIR)$(servicedir)" PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am__dirstamp = $(am__leading_dot)dirstamp am_src_obex_data_server_OBJECTS = src/ods-bluez.$(OBJEXT) \ src/ods-usb.$(OBJEXT) src/ods-capabilities.$(OBJEXT) \ src/ods-common.$(OBJEXT) src/ods-error.$(OBJEXT) \ src/ods-folder-listing.$(OBJEXT) \ src/ods-imaging-helpers.$(OBJEXT) src/ods-main.$(OBJEXT) \ src/ods-marshal.$(OBJEXT) src/ods-manager.$(OBJEXT) \ src/ods-logging.$(OBJEXT) src/ods-obex.$(OBJEXT) \ src/ods-server.$(OBJEXT) src/ods-server-session.$(OBJEXT) \ src/ods-session.$(OBJEXT) src_obex_data_server_OBJECTS = $(am_src_obex_data_server_OBJECTS) src_obex_data_server_DEPENDENCIES = am_test_ods_dbus_test_OBJECTS = src/ods-marshal.$(OBJEXT) \ test/ods-dbus-test.$(OBJEXT) test_ods_dbus_test_OBJECTS = $(am_test_ods_dbus_test_OBJECTS) test_ods_dbus_test_DEPENDENCIES = DEFAULT_INCLUDES = -I.@am__isrc@ depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(src_obex_data_server_SOURCES) \ $(test_ods_dbus_test_SOURCES) DIST_SOURCES = $(src_obex_data_server_SOURCES) \ $(test_ods_dbus_test_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man1dir = $(mandir)/man1 NROFF = nroff MANS = $(man_MANS) DATA = $(config_DATA) $(dbusconfig_DATA) $(service_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d "$(distdir)" \ || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr "$(distdir)"; }; } DIST_ARCHIVES = $(distdir).tar.gz GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BIP_CFLAGS = @BIP_CFLAGS@ BIP_LIBS = @BIP_LIBS@ BLUEZ_CFLAGS = @BLUEZ_CFLAGS@ BLUEZ_LIBS = @BLUEZ_LIBS@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DBUS_BINDING_TOOL = @DBUS_BINDING_TOOL@ DBUS_CFLAGS = @DBUS_CFLAGS@ DBUS_LIBS = @DBUS_LIBS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EXEEXT = @EXEEXT@ GLIB_CFLAGS = @GLIB_CFLAGS@ GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ GLIB_LIBS = @GLIB_LIBS@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ OPENOBEX_CFLAGS = @OPENOBEX_CFLAGS@ OPENOBEX_LIBS = @OPENOBEX_LIBS@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USB_CFLAGS = @USB_CFLAGS@ USB_LIBS = @USB_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ ########## # general / main dir ########## AM_MAKEFLAGS = --no-print-directory AM_CFLAGS = @GLIB_CFLAGS@ @BIP_CFLAGS@ @USB_CFLAGS@ @DBUS_CFLAGS@ @BLUEZ_CFLAGS@ @OPENOBEX_CFLAGS@ DISTCLEANFILES = data/obex-data-server.service BUILT_SOURCES = src/ods-manager-dbus-glue.h src/ods-marshal.c \ src/ods-marshal.h src/ods-server-dbus-glue.h \ src/ods-server-session-dbus-glue.h src/ods-session-dbus-glue.h CLEANFILES = $(BUILT_SOURCES) ########## # src dir ########## EXTRA_DIST = dbus-api.txt data/obex-data-server.1 \ data/obex-data-server.service.in data/obex-data-server.conf \ data/capability.xml data/imaging_capabilities.xml \ src/ods-manager.xml src/ods-marshal.list src/ods-server.xml \ src/ods-server-session.xml src/ods-session.xml \ test/ods-server-test.py test/ods-session-test.py \ test/ods-bip-test.py test/ods-opp-test.py ########## # data dir ########## configdir = $(sysconfdir)/obex-data-server config_DATA = data/capability.xml data/imaging_capabilities.xml @SYSTEMCONFIG_TRUE@dbusconfigdir = $(sysconfdir)/dbus-1/system.d @SYSTEMCONFIG_TRUE@dbusconfig_DATA = data/obex-data-server.conf servicedir = $(datarootdir)/dbus-1/services service_in_files = data/obex-data-server.service.in service_DATA = data/obex-data-server.service @SYSTEMCONFIG_TRUE@add_args = --system-bus man_MANS = data/obex-data-server.1 src_obex_data_server_SOURCES = src/ods-bluez.h src/ods-bluez.c \ src/ods-usb.c src/ods-usb.h \ src/ods-capabilities.h src/ods-capabilities.c \ src/ods-common.h src/ods-common.c \ src/ods-error.h src/ods-error.c \ src/ods-folder-listing.h src/ods-folder-listing.c \ src/ods-imaging-helpers.h src/ods-imaging-helpers.c \ src/ods-main.c \ src/ods-marshal.c src/ods-marshal.h \ src/ods-manager.h src/ods-manager.c \ src/ods-logging.h src/ods-logging.c \ src/ods-obex.h src/ods-obex.c \ src/ods-server.h src/ods-server.c \ src/ods-server-session.h src/ods-server-session.c \ src/ods-session.h src/ods-session.c src_obex_data_server_LDADD = @GLIB_LIBS@ @BIP_LIBS@ @USB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ @OPENOBEX_LIBS@ test_ods_dbus_test_SOURCES = src/ods-marshal.h src/ods-marshal.c \ test/ods-dbus-test.c test_ods_dbus_test_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj am--refresh: @: $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) src/$(am__dirstamp): @$(MKDIR_P) src @: > src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) src/$(DEPDIR) @: > src/$(DEPDIR)/$(am__dirstamp) src/ods-bluez.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-usb.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-capabilities.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-common.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-error.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-folder-listing.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-imaging-helpers.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-main.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-marshal.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-manager.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-logging.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-obex.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-server.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-server-session.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/ods-session.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/obex-data-server$(EXEEXT): $(src_obex_data_server_OBJECTS) $(src_obex_data_server_DEPENDENCIES) src/$(am__dirstamp) @rm -f src/obex-data-server$(EXEEXT) $(AM_V_CCLD)$(LINK) $(src_obex_data_server_OBJECTS) $(src_obex_data_server_LDADD) $(LIBS) test/$(am__dirstamp): @$(MKDIR_P) test @: > test/$(am__dirstamp) test/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) test/$(DEPDIR) @: > test/$(DEPDIR)/$(am__dirstamp) test/ods-dbus-test.$(OBJEXT): test/$(am__dirstamp) \ test/$(DEPDIR)/$(am__dirstamp) test/ods-dbus-test$(EXEEXT): $(test_ods_dbus_test_OBJECTS) $(test_ods_dbus_test_DEPENDENCIES) test/$(am__dirstamp) @rm -f test/ods-dbus-test$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ods_dbus_test_OBJECTS) $(test_ods_dbus_test_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) -rm -f src/ods-bluez.$(OBJEXT) -rm -f src/ods-capabilities.$(OBJEXT) -rm -f src/ods-common.$(OBJEXT) -rm -f src/ods-error.$(OBJEXT) -rm -f src/ods-folder-listing.$(OBJEXT) -rm -f src/ods-imaging-helpers.$(OBJEXT) -rm -f src/ods-logging.$(OBJEXT) -rm -f src/ods-main.$(OBJEXT) -rm -f src/ods-manager.$(OBJEXT) -rm -f src/ods-marshal.$(OBJEXT) -rm -f src/ods-obex.$(OBJEXT) -rm -f src/ods-server-session.$(OBJEXT) -rm -f src/ods-server.$(OBJEXT) -rm -f src/ods-session.$(OBJEXT) -rm -f src/ods-usb.$(OBJEXT) -rm -f test/ods-dbus-test.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-bluez.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-capabilities.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-common.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-error.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-folder-listing.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-imaging-helpers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-logging.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-manager.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-marshal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-obex.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-server-session.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-session.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/ods-usb.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@test/$(DEPDIR)/ods-dbus-test.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ @am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` install-man1: $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" @list=''; test -n "$(man1dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ done; } uninstall-man1: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man1dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.1[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man1dir)" && rm -f $$files; } install-configDATA: $(config_DATA) @$(NORMAL_INSTALL) test -z "$(configdir)" || $(MKDIR_P) "$(DESTDIR)$(configdir)" @list='$(config_DATA)'; test -n "$(configdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(configdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(configdir)" || exit $$?; \ done uninstall-configDATA: @$(NORMAL_UNINSTALL) @list='$(config_DATA)'; test -n "$(configdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(configdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(configdir)" && rm -f $$files install-dbusconfigDATA: $(dbusconfig_DATA) @$(NORMAL_INSTALL) test -z "$(dbusconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusconfigdir)" @list='$(dbusconfig_DATA)'; test -n "$(dbusconfigdir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusconfigdir)" || exit $$?; \ done uninstall-dbusconfigDATA: @$(NORMAL_UNINSTALL) @list='$(dbusconfig_DATA)'; test -n "$(dbusconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(dbusconfigdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(dbusconfigdir)" && rm -f $$files install-serviceDATA: $(service_DATA) @$(NORMAL_INSTALL) test -z "$(servicedir)" || $(MKDIR_P) "$(DESTDIR)$(servicedir)" @list='$(service_DATA)'; test -n "$(servicedir)" || list=; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(servicedir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(servicedir)" || exit $$?; \ done uninstall-serviceDATA: @$(NORMAL_UNINSTALL) @list='$(service_DATA)'; test -n "$(servicedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ test -n "$$files" || exit 0; \ echo " ( cd '$(DESTDIR)$(servicedir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(servicedir)" && rm -f $$files ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-lzma: distdir tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma $(am__remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lzma*) \ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @$(am__cd) '$(distuninstallcheck_dir)' \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(configdir)" "$(DESTDIR)$(dbusconfigdir)" "$(DESTDIR)$(servicedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) -rm -f src/$(DEPDIR)/$(am__dirstamp) -rm -f src/$(am__dirstamp) -rm -f test/$(DEPDIR)/$(am__dirstamp) -rm -f test/$(am__dirstamp) -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf src/$(DEPDIR) test/$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-configDATA install-dbusconfigDATA install-man \ install-serviceDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man1 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -rf src/$(DEPDIR) test/$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-configDATA \ uninstall-dbusconfigDATA uninstall-man uninstall-serviceDATA uninstall-man: uninstall-man1 .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic clean-noinstPROGRAMS ctags \ dist dist-all dist-bzip2 dist-gzip dist-lzma dist-shar \ dist-tarZ dist-xz dist-zip distcheck distclean \ distclean-compile distclean-generic distclean-hdr \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-configDATA install-data \ install-data-am install-dbusconfigDATA install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man1 install-pdf install-pdf-am install-ps \ install-ps-am install-serviceDATA install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS uninstall-configDATA \ uninstall-dbusconfigDATA uninstall-man uninstall-man1 \ uninstall-serviceDATA $(service_DATA): $(service_in_files) config.log $(AM_V_GEN)$(SED) -e "s|\@servicedir\@|$(bindir)|;s|\@add_args\@|$(add_args)|" $< > $@ src/ods-manager-dbus-glue.h: src/ods-manager.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_manager \ --mode=glib-server --output=$@ $< src/ods-server-dbus-glue.h: src/ods-server.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_server \ --mode=glib-server --output=$@ $< src/ods-server-session-dbus-glue.h: src/ods-server-session.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_server_session \ --mode=glib-server --output=$@ $< src/ods-session-dbus-glue.h: src/ods-session.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_session \ --mode=glib-server --output=$@ $< src/ods-marshal.c: src/ods-marshal.list $(AM_V_GEN)@GLIB_GENMARSHAL@ $< --prefix=ods_marshal --body > $@ src/ods-marshal.h: src/ods-marshal.list $(AM_V_GEN)@GLIB_GENMARSHAL@ $< --prefix=ods_marshal --header > $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: obex-data-server-0.4.6/NEWS0000644000175000017500000001213611546317424012323 000000000000000.4.6 version * Fix --disable-usb build flag * Properly handle empty and invalid type headers in server GET and PUT * Fix crasher during SDP discovery * Fix BIP server PUT * Disable directory creation when writing is not allowed * Improve logging system (prefixes indicating which session a particular message belongs to) 0.4.5 version * Add support for GET folder listing with name header in server (usually name header is not used!) * Fix system bus configuration file according to new default policy * Use locales only for filenames (previously caused D-Bus disconnect when translated errors were passed) * Refine logging functionality (ability to log to syslog, enable/disable debug messages) * Use silent and non-recursive makefiles * New OPP test script: ods-opp-test.py * Request timeout system (when no response is received from remote device in 15 seconds after request was issued, TimeOut error will happen and connection will be closed) * Transfer suspension timeout system (when auto_accept is False for server and Accept() or Reject() is not called in 15 seconds after TransferStarted signal, incoming file will be automatically rejected) * Support for TTY transport (server and client). TTY server can be used in USB gadgets, session support is somewhat experimental and only for testing purposes * A bunch of other bugs fixed and code cleaned up in quiet a few places :) 0.4.4 version * Revert openobex 1.4 dependency. Now ods builds with openobex 1.3 even with usb support on 0.4.3 version * Fix Nokia SDP workaround (this has been broken back in 0.4) * Actually export RemoteCopy and RemoteMove methods * Export more information about USB interfaces. ods now depends on libusb and openobex 1.4 for usb support. USB support can be disable with --disable-usb. * Export OBEXCommand in TransferInfo to differentiate between PUT and GET requests * Various server fixes 0.4.2 version * Implement RemoteCopy and RemoteMove methods in Session * Use Wand.pc for ImageMagick PKG_CHECK to be compatible with all distros * Avoid executing obex_request_put in ServerSession several times for the same transfer * Avoid printing out NULL for ARM compatibility * Check for Bluez 3.34 or later in configure 0.4.1 version * Fix a race condition when client app misses ServerSession.TransferStarted signal * Do not use g_assert for checking if DBus context is set in Session and ServerSession methods * Fix TransferStarted signal emission in ServerSession 0.4 version * Implement partial BIP profile support (ImagePush and RemoteDisplay features supported) * Add support for Bluez 4.x (also still compatible with Bluez 3.x) * Add support for USB transport (only for Sessions ATM) * Add a way to cancel Session connection (Manager.CancelSessionConnect) * FTP servers now expose a capability object * When creating new files, set permissions according to umask * Add a way to specify source Bluetooth adapter for Sessions (changed CreateBluetoothSession) * Let applications know about all sessions/servers running (GetServerList(), GetSessionList() methods) * Lots of other bug fixes 0.3.4 version * Fix filename conversion to UTF-16 (bug introduced in 0.3.2) * Add manual page * When --enable-system-config build option is used, change DBus .service file accordingly * Small build fixes 0.3.3 version * Properly close sockets for Session and ServerSession objects 0.3.2 version * Reduce compiler warnings (fixes bug #98) * Fix ServerSession Accept/Reject (bug #54, only works with patched openobex) * Use different FTP UUID for some Nokia devices (bug #55) * Don't try to remove service record when it is not registered (bug #79) * Check OBEX Target header for FTP sessions (bug #81) * Disable FTP specific commands when OPP is used (bug #82) * Use UTF-8 filenames in folder listing objects (bug #78) * Improve OBEX error reporting (bugs #85, #86, #87, #88) * Fix crashers on exit (bugs #77, #83) * Portability fixes (bug #91) * Check connection ID for FTP session (bugs #90, #92) * Send empty Name header when using ChangeCurrentFolderToRoot (bug #100) * Don't try to access memory regions that were already freed (bug #74). Also fixes a long-standing segfault issue (bug #46) 0.3.1 version * Fix two crashers (bugs #57, #59) * Add SDP record support for PBAP server (no real PBAP support yet) (bug #60) * Fix naming issue in configure.in 0.3 version: * API change: Manager.CreateBluetoothServer(string source_address, string pattern, boolean require_pairing) * API change: Server.Start(string path, boolean allow_write, boolean auto_accept) * update ods-server-test.py according to new API * Remove some memory leaks 0.2 version: * Distribute python tests (ods-session-test.py and ods-server-test.py). * Make object paths lowercase. * API change: Server.Start(string path, boolean allow_write, boolean require_pairing, boolean auto_accept). * New methods: Server.Accept(), Server.Reject(). * Fix server SDP record lifetime (now exists between Start() and Stop()). * Make D-Bus system config file optional (enable with --enable-system-config configure option). * Exclude dot files from folder listings. obex-data-server-0.4.6/configure0000755000175000017500000053415011546317436013543 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.67 for obex-data-server 0.4.6. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software # Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='obex-data-server' PACKAGE_TARNAME='obex-data-server' PACKAGE_VERSION='0.4.6' PACKAGE_STRING='obex-data-server 0.4.6' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_default_prefix=/usr/local ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS OPENOBEX_LIBS OPENOBEX_CFLAGS BLUEZ_LIBS BLUEZ_CFLAGS DBUS_LIBS DBUS_CFLAGS GLIB_LIBS GLIB_CFLAGS SYSTEMCONFIG_FALSE SYSTEMCONFIG_TRUE USB_LIBS USB_CFLAGS BIP_LIBS BIP_CFLAGS DBUS_BINDING_TOOL GLIB_GENMARSHAL PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG SED am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC MAINT MAINTAINER_MODE_FALSE MAINTAINER_MODE_TRUE AM_BACKSLASH AM_DEFAULT_VERBOSITY am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_maintainer_mode enable_dependency_tracking enable_bip enable_usb enable_system_config enable_debug enable_more_warnings ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR BIP_CFLAGS BIP_LIBS USB_CFLAGS USB_LIBS GLIB_CFLAGS GLIB_LIBS DBUS_CFLAGS DBUS_LIBS BLUEZ_CFLAGS BLUEZ_LIBS OPENOBEX_CFLAGS OPENOBEX_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures obex-data-server 0.4.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/obex-data-server] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of obex-data-server 0.4.6:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0') --enable-maintainer-mode enable make rules and dependencies not useful (and sometimes confusing) to the casual installer --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --enable-bip=gdk-pixbuf|magick|auto|no Enable BIP support (disabling it will break some BIP functions) --disable-usb Disable USB support (breaks USB interface discovery functions) --enable-system-config install D-Bus system config file --enable-debug turn on debugging --enable-more-warnings Maximum compiler warnings Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path BIP_CFLAGS C compiler flags for BIP, overriding pkg-config BIP_LIBS linker flags for BIP, overriding pkg-config USB_CFLAGS C compiler flags for USB, overriding pkg-config USB_LIBS linker flags for USB, overriding pkg-config GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config GLIB_LIBS linker flags for GLIB, overriding pkg-config DBUS_CFLAGS C compiler flags for DBUS, overriding pkg-config DBUS_LIBS linker flags for DBUS, overriding pkg-config BLUEZ_CFLAGS C compiler flags for BLUEZ, overriding pkg-config BLUEZ_LIBS linker flags for BLUEZ, overriding pkg-config OPENOBEX_CFLAGS C compiler flags for OPENOBEX, overriding pkg-config OPENOBEX_LIBS linker flags for OPENOBEX, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF obex-data-server configure 0.4.6 generated by GNU Autoconf 2.67 Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || $as_test_x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} as_fn_set_status $ac_retval } # ac_fn_c_try_link cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by obex-data-server $as_me 0.4.6, which was generated by GNU Autoconf 2.67. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5 ; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.11' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_AWK+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='obex-data-server' VERSION='0.4.6' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=0;; esac AM_BACKSLASH='\' ac_config_headers="$ac_config_headers config.h" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 $as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } # Check whether --enable-maintainer-mode was given. if test "${enable_maintainer_mode+set}" = set; then : enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval else USE_MAINTAINER_MODE=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 $as_echo "$USE_MAINTAINER_MODE" >&6; } if test $USE_MAINTAINER_MODE = yes; then MAINTAINER_MODE_TRUE= MAINTAINER_MODE_FALSE='#' else MAINTAINER_MODE_TRUE='#' MAINTAINER_MODE_FALSE= fi MAINT=$MAINTAINER_MODE_TRUE if test "$sysconfdir" = "\${prefix}/etc" \ && { test "$prefix" = "NONE" || test "$prefix" = "/usr" \ || test "$prefix" = "/usr/" ; } ; then if test "$( (uname -s) )" = "Linux" ; then sysconfdir=/etc fi ( prefix=$ac_default_prefix sysconfdir=`eval echo "$sysconfdir"` { $as_echo "$as_me:${as_lineno-$LINENO}: configuration directory is \"$sysconfdir\"." >&5 $as_echo "$as_me: configuration directory is \"$sysconfdir\"." >&6;} { $as_echo "$as_me:${as_lineno-$LINENO}: use --sysconfdir to override." >&5 $as_echo "$as_me: use --sysconfdir to override." >&6;} ) fi cat >>confdefs.h <<_ACEOF #define CONFIGDIR "$sysconfdir" _ACEOF if test "${CFLAGS}" = ""; then CFLAGS="-Wall -O2 -D_FORTIFY_SOURCE=2" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5 ; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5 ; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5 ; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if test "${ac_cv_objext+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5 ; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if test "${ac_cv_path_SED+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # Extract the first word of "glib-genmarshal", so it can be a program name with args. set dummy glib-genmarshal; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_GLIB_GENMARSHAL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $GLIB_GENMARSHAL in [\\/]* | ?:[\\/]*) ac_cv_path_GLIB_GENMARSHAL="$GLIB_GENMARSHAL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_GLIB_GENMARSHAL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi GLIB_GENMARSHAL=$ac_cv_path_GLIB_GENMARSHAL if test -n "$GLIB_GENMARSHAL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GLIB_GENMARSHAL" >&5 $as_echo "$GLIB_GENMARSHAL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "dbus-binding-tool", so it can be a program name with args. set dummy dbus-binding-tool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if test "${ac_cv_path_DBUS_BINDING_TOOL+set}" = set; then : $as_echo_n "(cached) " >&6 else case $DBUS_BINDING_TOOL in [\\/]* | ?:[\\/]*) ac_cv_path_DBUS_BINDING_TOOL="$DBUS_BINDING_TOOL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_DBUS_BINDING_TOOL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi DBUS_BINDING_TOOL=$ac_cv_path_DBUS_BINDING_TOOL if test -n "$DBUS_BINDING_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DBUS_BINDING_TOOL" >&5 $as_echo "$DBUS_BINDING_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi GLIB_REQUIRED=2.10.0 DBUS_REQUIRED=0.70 BLUEZ_REQUIRED=3.34 OPENOBEX_REQUIRED=1.3 IMAGEMAGICK_REQUIRED=6.0.0 bip_found=no bip_type=disabled # Check whether --enable-bip was given. if test "${enable_bip+set}" = set; then : enableval=$enable_bip; bip_enable=${enableval} else bip_enable=auto fi if test "$bip_enable" = "auto" || test "$bip_enable" = "magick"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIP" >&5 $as_echo_n "checking for BIP... " >&6; } if test -n "$BIP_CFLAGS"; then pkg_cv_BIP_CFLAGS="$BIP_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gthread-2.0 Wand >= \$IMAGEMAGICK_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BIP_CFLAGS=`$PKG_CONFIG --cflags "gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$BIP_LIBS"; then pkg_cv_BIP_LIBS="$BIP_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gthread-2.0 Wand >= \$IMAGEMAGICK_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BIP_LIBS=`$PKG_CONFIG --libs "gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then BIP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED" 2>&1` else BIP_PKG_ERRORS=`$PKG_CONFIG --print-errors "gthread-2.0 Wand >= $IMAGEMAGICK_REQUIRED" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BIP_PKG_ERRORS" >&5 bip_found=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } bip_found=no else BIP_CFLAGS=$pkg_cv_BIP_CFLAGS BIP_LIBS=$pkg_cv_BIP_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } bip_found=yes fi if test "$bip_found" = "yes" ; then $as_echo "#define USE_IMAGEMAGICK /**/" >>confdefs.h bip_type="ImageMagick" else if test "$bip_enable" = "magick"; then as_fn_error $? "you requested BIP support using ImageMagick, but it is not available" "$LINENO" 5 fi fi fi if test "$bip_enable" = "auto" -a "$bip_found" = "no" || test "$bip_enable" = "gdk-pixbuf" ; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BIP" >&5 $as_echo_n "checking for BIP... " >&6; } if test -n "$BIP_CFLAGS"; then pkg_cv_BIP_CFLAGS="$BIP_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gthread-2.0 gdk-pixbuf-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gthread-2.0 gdk-pixbuf-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BIP_CFLAGS=`$PKG_CONFIG --cflags "gthread-2.0 gdk-pixbuf-2.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$BIP_LIBS"; then pkg_cv_BIP_LIBS="$BIP_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gthread-2.0 gdk-pixbuf-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "gthread-2.0 gdk-pixbuf-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BIP_LIBS=`$PKG_CONFIG --libs "gthread-2.0 gdk-pixbuf-2.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then BIP_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gthread-2.0 gdk-pixbuf-2.0" 2>&1` else BIP_PKG_ERRORS=`$PKG_CONFIG --print-errors "gthread-2.0 gdk-pixbuf-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BIP_PKG_ERRORS" >&5 bip_found=no elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } bip_found=no else BIP_CFLAGS=$pkg_cv_BIP_CFLAGS BIP_LIBS=$pkg_cv_BIP_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } bip_found=yes fi if test "$bip_found" = "yes" ; then $as_echo "#define USE_GDKPIXBUF /**/" >>confdefs.h bip_type="gdk-pixbuf" else if test "$bip_enable" = "gdk-pixbuf"; then as_fn_error $? "you requested BIP support using gdk-pixbuf, but it is not available" "$LINENO" 5 fi fi fi # Check whether --enable-usb was given. if test "${enable_usb+set}" = set; then : enableval=$enable_usb; usb_enable=no else usb_enable=yes fi if test "${usb_enable}" = "yes"; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for USB" >&5 $as_echo_n "checking for USB... " >&6; } if test -n "$USB_CFLAGS"; then pkg_cv_USB_CFLAGS="$USB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_USB_CFLAGS=`$PKG_CONFIG --cflags "libusb" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$USB_LIBS"; then pkg_cv_USB_LIBS="$USB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libusb\""; } >&5 ($PKG_CONFIG --exists --print-errors "libusb") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_USB_LIBS=`$PKG_CONFIG --libs "libusb" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then USB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libusb" 2>&1` else USB_PKG_ERRORS=`$PKG_CONFIG --print-errors "libusb" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$USB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libusb) were not met: $USB_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables USB_CFLAGS and USB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables USB_CFLAGS and USB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5 ; } else USB_CFLAGS=$pkg_cv_USB_CFLAGS USB_LIBS=$pkg_cv_USB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi $as_echo "#define USE_USB /**/" >>confdefs.h fi # Check whether --enable-system-config was given. if test "${enable_system_config+set}" = set; then : enableval=$enable_system_config; system_config_enable=${enableval} fi if test "${system_config_enable}" = "yes"; then SYSTEMCONFIG_TRUE= SYSTEMCONFIG_FALSE='#' else SYSTEMCONFIG_TRUE='#' SYSTEMCONFIG_FALSE= fi # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; set_debug="$enableval" else if test -d $srcdir/.svn; then set_debug=yes else set_debug=no fi fi if test "$set_debug" != "no"; then CFLAGS="$CFLAGS -g -pg" LDFLAGS="$LDFLAGS -pg" fi # Check whether --enable-more-warnings was given. if test "${enable_more_warnings+set}" = set; then : enableval=$enable_more_warnings; set_more_warnings="$enableval" else if test -d $srcdir/.svn; then set_more_warnings=yes else set_more_warnings=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for more warnings" >&5 $as_echo_n "checking for more warnings... " >&6; } if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } CFLAGS+=" -Werror -Wextra -Wcast-align" CFLAGS+=" -Wnested-externs -Wpointer-arith" CFLAGS+=" -Wno-unused-parameter -Wno-missing-field-initializers" CFLAGS+=" -Wredundant-decls" CFLAGS+=" -Wsign-compare -fno-strict-aliasing" else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GLIB" >&5 $as_echo_n "checking for GLIB... " >&6; } if test -n "$GLIB_CFLAGS"; then pkg_cv_GLIB_CFLAGS="$GLIB_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED gobject-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED gobject-2.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$GLIB_LIBS"; then pkg_cv_GLIB_LIBS="$GLIB_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED gobject-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_GLIB_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED gobject-2.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then GLIB_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0" 2>&1` else GLIB_PKG_ERRORS=`$PKG_CONFIG --print-errors "glib-2.0 >= $GLIB_REQUIRED gobject-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$GLIB_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQUIRED gobject-2.0) were not met: $GLIB_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables GLIB_CFLAGS and GLIB_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5 ; } else GLIB_CFLAGS=$pkg_cv_GLIB_CFLAGS GLIB_LIBS=$pkg_cv_GLIB_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for DBUS" >&5 $as_echo_n "checking for DBUS... " >&6; } if test -n "$DBUS_CFLAGS"; then pkg_cv_DBUS_CFLAGS="$DBUS_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-glib-1 >= \$DBUS_REQUIRED dbus-1 >= \$DBUS_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DBUS_CFLAGS=`$PKG_CONFIG --cflags "dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$DBUS_LIBS"; then pkg_cv_DBUS_LIBS="$DBUS_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"dbus-glib-1 >= \$DBUS_REQUIRED dbus-1 >= \$DBUS_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_DBUS_LIBS=`$PKG_CONFIG --libs "dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then DBUS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED" 2>&1` else DBUS_PKG_ERRORS=`$PKG_CONFIG --print-errors "dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$DBUS_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (dbus-glib-1 >= $DBUS_REQUIRED dbus-1 >= $DBUS_REQUIRED) were not met: $DBUS_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables DBUS_CFLAGS and DBUS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables DBUS_CFLAGS and DBUS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5 ; } else DBUS_CFLAGS=$pkg_cv_DBUS_CFLAGS DBUS_LIBS=$pkg_cv_DBUS_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BLUEZ" >&5 $as_echo_n "checking for BLUEZ... " >&6; } if test -n "$BLUEZ_CFLAGS"; then pkg_cv_BLUEZ_CFLAGS="$BLUEZ_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez >= \$BLUEZ_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "bluez >= $BLUEZ_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BLUEZ_CFLAGS=`$PKG_CONFIG --cflags "bluez >= $BLUEZ_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$BLUEZ_LIBS"; then pkg_cv_BLUEZ_LIBS="$BLUEZ_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"bluez >= \$BLUEZ_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "bluez >= $BLUEZ_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_BLUEZ_LIBS=`$PKG_CONFIG --libs "bluez >= $BLUEZ_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then BLUEZ_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "bluez >= $BLUEZ_REQUIRED" 2>&1` else BLUEZ_PKG_ERRORS=`$PKG_CONFIG --print-errors "bluez >= $BLUEZ_REQUIRED" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$BLUEZ_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (bluez >= $BLUEZ_REQUIRED) were not met: $BLUEZ_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables BLUEZ_CFLAGS and BLUEZ_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables BLUEZ_CFLAGS and BLUEZ_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5 ; } else BLUEZ_CFLAGS=$pkg_cv_BLUEZ_CFLAGS BLUEZ_LIBS=$pkg_cv_BLUEZ_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sdp_extract_seqtype_safe in -lbluetooth" >&5 $as_echo_n "checking for sdp_extract_seqtype_safe in -lbluetooth... " >&6; } if test "${ac_cv_lib_bluetooth_sdp_extract_seqtype_safe+set}" = set; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbluetooth $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char sdp_extract_seqtype_safe (); int main () { return sdp_extract_seqtype_safe (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bluetooth_sdp_extract_seqtype_safe=yes else ac_cv_lib_bluetooth_sdp_extract_seqtype_safe=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_bluetooth_sdp_extract_seqtype_safe" >&5 $as_echo "$ac_cv_lib_bluetooth_sdp_extract_seqtype_safe" >&6; } if test "x$ac_cv_lib_bluetooth_sdp_extract_seqtype_safe" = x""yes; then : $as_echo "#define USE_BLUEZ3FUNCS /**/" >>confdefs.h fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENOBEX" >&5 $as_echo_n "checking for OPENOBEX... " >&6; } if test -n "$OPENOBEX_CFLAGS"; then pkg_cv_OPENOBEX_CFLAGS="$OPENOBEX_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openobex >= \$OPENOBEX_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "openobex >= $OPENOBEX_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENOBEX_CFLAGS=`$PKG_CONFIG --cflags "openobex >= $OPENOBEX_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$OPENOBEX_LIBS"; then pkg_cv_OPENOBEX_LIBS="$OPENOBEX_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openobex >= \$OPENOBEX_REQUIRED\""; } >&5 ($PKG_CONFIG --exists --print-errors "openobex >= $OPENOBEX_REQUIRED") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENOBEX_LIBS=`$PKG_CONFIG --libs "openobex >= $OPENOBEX_REQUIRED" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then OPENOBEX_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "openobex >= $OPENOBEX_REQUIRED" 2>&1` else OPENOBEX_PKG_ERRORS=`$PKG_CONFIG --print-errors "openobex >= $OPENOBEX_REQUIRED" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$OPENOBEX_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (openobex >= $OPENOBEX_REQUIRED) were not met: $OPENOBEX_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables OPENOBEX_CFLAGS and OPENOBEX_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables OPENOBEX_CFLAGS and OPENOBEX_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5 ; } else OPENOBEX_CFLAGS=$pkg_cv_OPENOBEX_CFLAGS OPENOBEX_LIBS=$pkg_cv_OPENOBEX_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${SYSTEMCONFIG_TRUE}" && test -z "${SYSTEMCONFIG_FALSE}"; then as_fn_error $? "conditional \"SYSTEMCONFIG\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in #( -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by obex-data-server $as_me 0.4.6, which was generated by GNU Autoconf 2.67. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ obex-data-server config.status 0.4.6 configured by $0, generated by GNU Autoconf 2.67, with options \\"\$ac_cs_config\\" Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_t=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_t"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out" && rm -f "$tmp/out";; *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" } >"$tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo " obex-data-server $VERSION ============================= prefix: ${prefix} compiler: ${CC} cflags: ${CFLAGS} BIP imaging support: $bip_type USB support: $usb_enable " obex-data-server-0.4.6/README0000644000175000017500000000123111524724173012475 00000000000000obex-data-server ================ Copyright (C) 2007-2009 Tadas Dailyda Published under GNU GPL 2 license obex-data-server is D-Bus service providing high-level OBEX client and server side functionality. Website: http://wiki.muiline.com/obex-data-server News: http://tadas.dailyda.com/blog/category/obex-data-server Mail list: http://groups.google.com/group/ods-devel Bugtracker: http://bugs.muiline.com Dependencies: - glib - dbus - dbus-glib - BlueZ - openobex - ImageMagick or gdk-pixbuf (optional) - libusb (optional) Full building instructions: http://wiki.muiline.com/obex-data-server/building obex-data-server-0.4.6/missing0000755000175000017500000002623311331674343013224 00000000000000#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2009-04-28.21; # UTC # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # 2008, 2009 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and \`g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # normalize program name to check for. program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). This is about non-GNU programs, so use $1 not # $program. case $1 in lex*|yacc*) # Not GNU programs, they don't have --version. ;; tar*) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $program in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te*) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison*|yacc*) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex*|flex*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit $? fi ;; makeinfo*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar*) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: obex-data-server-0.4.6/aclocal.m40000644000175000017500000012422311546317435013467 00000000000000# generated automatically by aclocal 1.11.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],, [m4_warning([this file was generated for autoconf 2.67. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # serial 1 (pkg-config-0.24) # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility]) AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path]) AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path]) if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) # only at the first occurence in configure.ac, so if the first place # it's called might be skipped (such as if it is within an "if", you # have to call PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_default([$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT])dnl ]) elif test $pkg_failed = untried; then AC_MSG_RESULT([no]) m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])dnl ]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) $3 fi[]dnl ])# PKG_CHECK_MODULES # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [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.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # 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.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 10 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvisualcpp | msvcmsys) # This compiler won't grok `-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS. AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Add --enable-maintainer-mode option to configure. -*- Autoconf -*- # From Jim Meyering # Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MAINTAINER_MODE([DEFAULT-MODE]) # ---------------------------------- # Control maintainer-specific portions of Makefiles. # Default is to disable them, unless `enable' is passed literally. # For symmetry, `disable' may be passed as well. Anyway, the user # can override the default with the --enable/--disable switch. AC_DEFUN([AM_MAINTAINER_MODE], [m4_case(m4_default([$1], [disable]), [enable], [m4_define([am_maintainer_other], [disable])], [disable], [m4_define([am_maintainer_other], [enable])], [m4_define([am_maintainer_other], [enable]) m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) dnl maintainer-mode's default is 'disable' unless 'enable' is passed AC_ARG_ENABLE([maintainer-mode], [ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful (and sometimes confusing) to the casual installer], [USE_MAINTAINER_MODE=$enableval], [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) AC_MSG_RESULT([$USE_MAINTAINER_MODE]) AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) MAINT=$MAINTAINER_MODE_TRUE AC_SUBST([MAINT])dnl ] ) AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from `make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # (`yes' being less verbose, `no' or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [ --enable-silent-rules less verbose build output (undo: `make V=1') --disable-silent-rules verbose build output (undo: `make V=0')]) case $enable_silent_rules in yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR obex-data-server-0.4.6/config.h.in0000644000175000017500000000160011524724215013635 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Directory for the configuration files */ #undef CONFIGDIR /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* We are using Bluez 3.x */ #undef USE_BLUEZ3FUNCS /* We have ImageMagick support */ #undef USE_GDKPIXBUF /* We have ImageMagick support */ #undef USE_IMAGEMAGICK /* We have USB support */ #undef USE_USB /* Version number of package */ #undef VERSION obex-data-server-0.4.6/test/0000755000175000017500000000000011546317666012670 500000000000000obex-data-server-0.4.6/test/ods-bip-test.py0000755000175000017500000002754411524724173015502 00000000000000#!/usr/bin/python import dbus import dbus.decorators import dbus.glib import gobject import math from optparse import OptionParser import readline from signal import * import sys from xml.dom.minidom import parseString class Tester: total_bytes = -1 progress_started = False preferred_width = 0 preferred_height = 0 preferred_encoding = '' preferred_transformation = 'stretch' image_iter = -1 image_handles = [] thumbnail_requested = False rotate = '\\|/-' rotate_iter = 0 def __init__(self, options, args): self.options = options self.args = args self.bus = dbus.SessionBus() manager_obj = self.bus.get_object('org.openobex', '/org/openobex') self.manager = dbus.Interface(manager_obj, 'org.openobex.Manager') self.manager.connect_to_signal('SessionConnected', self.session_connected_cb) self.manager.connect_to_signal('SessionConnectError', self.session_connect_error_cb) if options.remote_display: feature = 'remotedisplay' else: feature = 'imagepush' if options.transformation: self.preferred_transformation = options.transformation self.session_path = self.manager.CreateBluetoothImagingSession( args[0], options.local_device, feature) session_obj = self.bus.get_object('org.openobex', self.session_path) self.session = dbus.Interface(session_obj, 'org.openobex.Session') self.session.connect_to_signal('Disconnected', self.disconnected_cb) self.session.connect_to_signal('Closed', self.closed_cb) self.session.connect_to_signal('Cancelled', self.cancelled_cb) self.session.connect_to_signal('TransferStarted', self.transfer_started_cb) self.session.connect_to_signal('TransferProgress', self.transfer_progress_cb) self.session.connect_to_signal('TransferCompleted', self.transfer_completed_cb) self.session.connect_to_signal('ErrorOccurred', self.error_occurred_cb) self.session.connect_to_signal('ImageHandleReceived', self.image_handle_received_cb) self.main_loop = gobject.MainLoop() self.main_loop.run() def session_connected_cb(self, session_path): if session_path == self.session_path: if self.options.size: width_str, height_str = self.options.size.split('*') self.preferred_width = int(width_str) self.preferred_height = int(height_str) elif self.options.preferred or self.options.capabilities: caps = self.call_method('GetImagingCapabilities') if self.options.capabilities: print caps self.call_method('Disconnect') else: #parse capabilities pixel = '' try: dom = parseString(caps) format = dom.getElementsByTagName('preferred-format')[0] self.preferred_encoding = format.getAttribute('encoding') pixel = format.getAttribute('pixel') transformation = format.getAttribute('transformation') except: #ignore parsing errors because all the elements we parse are optional pass if pixel: range = pixel.split('-') width_height = '0*0' if len(range) == 2: #will be using the upper limit of pixel range width_height = range[1] elif len(range) == 1: width_height = range[0] width_str, height_str = width_height.split('*') self.preferred_width = int(width_str) self.preferred_height = int(height_str) if transformation: self.preferred_transformation = transformation if not self.options.capabilities: self.send_image() def session_connect_error_cb(self, session_path, error_name, error_message): if session_path == self.session_path: print 'Connection error occurred: %s: %s' % (error_name, error_message) self.main_loop.quit() def disconnected_cb(self): self.call_method('Close') def closed_cb(self): self.main_loop.quit() def cancelled_cb(self): if self.progress_started: print print 'Transfer cancelled' self.send_image() def transfer_started_cb(self, filename, local_path, total_bytes): self.total_bytes = total_bytes self.progress_started = False transfer_info = self.call_method('GetTransferInfo') for name,value in transfer_info.iteritems(): print '--', name, '=', value def transfer_progress_cb(self, bytes_transferred): if not self.progress_started: print 'Progress: ', self.progress_started = True if self.total_bytes != -1: sys.stdout.write('\b\b\b\b%3d%%' % int(float(bytes_transferred)/self.total_bytes*100)) sys.stdout.flush() else: sys.stdout.write('\b\b\b\b'+self.rotate[self.rotate_iter]+' ') sys.stdout.flush() self.rotate_iter += 1 if self.rotate_iter == 4: self.rotate_iter = 0 def transfer_completed_cb(self): if self.progress_started: print print 'Transfer completed (Image handle is \''+self.image_handles[-1]+'\')' if self.thumbnail_requested: print 'Sending thumbnail' self.thumbnail_requested = False else: self.send_image() def error_occurred_cb(self, error_name, error_message): if self.progress_started: print print 'Error occurred: %s: %s' % (error_name, error_message) if error_name != 'org.openobex.Error.LinkError': self.send_image() def image_handle_received_cb(self, image_handle, thumbnail_requested): self.image_handles.append(image_handle) if thumbnail_requested: self.thumbnail_requested = True def call_method(self, method_name, *args): try: ret = self.session.get_dbus_method(method_name)(*args) except dbus.DBusException, e: print 'Failed: %s' % e return False return ret def send_image(self): if self.image_iter == len(self.args)-2: #no more images to send if self.options.remote_display: self.remote_display_shell() else: self.call_method('Disconnect') return self.image_iter += 1 file_to_send = self.args[self.image_iter+1] print 'Sending:', file_to_send if self.preferred_width != 0: width, height, encoding = self.call_method('GetImageInfo', file_to_send) new_width = self.preferred_width new_height = self.preferred_height do_resize = False if self.preferred_transformation == 'stretch' and (width > new_width or height > new_height): preferred_ratio = float(self.preferred_width)/self.preferred_height ratio = float(width)/height if ratio > preferred_ratio: new_height = int(math.ceil(height*(float(new_width)/width))) do_resize = True else: new_width = int(math.ceil(width*(float(new_height)/height))) do_resize = True elif self.preferred_transformation != 'stretch' and (width != new_width or height != new_height): do_resize = True if do_resize: print 'Resized to: %d*%d' % (new_width, new_height) self.call_method('PutImageResized', file_to_send, new_width, new_height, self.preferred_encoding, self.preferred_transformation) else: #no need to resize image self.call_method('PutImage', file_to_send) else: self.call_method('PutImage', file_to_send) def remote_display_shell(self): print 'RemoteDisplay interactive shell. Available commands:' print 's image_handle : select image with specified ImageHandle' print 'c : display currently selected image' print 'n : display next image' print 'p : display previous image' print 'q : quit' while True: command = raw_input('>>> ') if command.startswith('s '): image_handle = command[1:].strip() try: i = self.image_handles.index(image_handle) except: print 'error: image with such ImageHandle has not been sent' continue self.call_method('RemoteDisplaySelectImage', image_handle) elif command.strip() == 'c': self.call_method('RemoteDisplayShowCurrentImage') elif command.strip() == 'n': self.call_method('RemoteDisplayShowNextImage') elif command.strip() == 'p': self.call_method('RemoteDisplayShowPreviousImage') elif command.strip() == 'q': self.call_method('Disconnect') break else: print 'error: unknown command' if __name__ == '__main__': gobject.threads_init() dbus.glib.init_threads() usage = 'Usage: '+sys.argv[0]+' [options] remote_device [files]...' parser = OptionParser(usage) parser.add_option('-p', '--preferred', dest='preferred', action='store_true', default=False, help='Send images in size preferred by remote device') parser.add_option('-s', '--size', dest='size', help='Use size of WIDTH*HEIGHT for resizing images '\ '(different resizing rules apply for specific transformation). '\ 'Transformation might be selected either by -t option or '\ 'by remote device capabilities.', metavar='WIDTH*HEIGHT') parser.add_option('-t', '--transformation', dest='transformation', help='Transformation used for resizing images. Default is '\ 'stretch. stretch stretches images to size smaller than '\ 'specified size (either by -s option or by remote device '\ 'capabilities) preserving original size ratio, '\ 'fill puts original image in a larger one with '\ 'prefilled color, crop crops part of original image', metavar='stretch|crop|fill') parser.add_option('-c', '--capabilities', dest='capabilities', action='store_true', default=False, help='Print out imaging capabilities of remote device and exit') parser.add_option('-l', '--local', dest='local_device', default='00:00:00:00:00:00', help='ADDRESS of Bluetooth adapter to connect from. Default is 00:00:00:00:00:00', metavar='ADDRESS') parser.add_option('-r', '--remote-display', dest='remote_display', action='store_true', default=False, help='Start RemoteDisplay interactive shell after uploading all images') options, args = parser.parse_args() err1 = '' err2 = '' if len(args) < 1: err1 = 'error: Remote device address not specified' if (not options.capabilities) and len(args) < 2: err2 = 'error: No files to send' if err1 or err2: print usage print if err1: print err1 if err2: print err2 exit() tester = Tester(options, args) obex-data-server-0.4.6/test/ods-session-test.py0000755000175000017500000001242311524724173016401 00000000000000#!/usr/bin/python import dbus import dbus.decorators import dbus.glib import gobject from os.path import basename,splitext from signal import * from time import ctime bt_address = '00:12:EE:7C:30:D4' #bt_address = '00:01:E3:54:D0:87' folder_to_go_to = 'Pictures' folder_to_create = 'Nonsense' file_to_send = '/home/skirsdeda/Desktop/x.jpg' class Tester: total_bytes = -1 exec_iter = 0 def __init__(self): self.bus = dbus.SessionBus() manager_obj = self.bus.get_object('org.openobex', '/org/openobex') self.manager = dbus.Interface(manager_obj, 'org.openobex.Manager') self.session_path = self.manager.CreateBluetoothSession(bt_address, '00:00:00:00:00:00', 'ftp') print 'Session object: ', self.session_path session_obj = self.bus.get_object('org.openobex', self.session_path) self.session = dbus.Interface(session_obj, 'org.openobex.Session') self.manager.connect_to_signal('SessionConnected', self.connected_cb) self.session.connect_to_signal('Disconnected', self.disconnected_cb) self.session.connect_to_signal('Closed', self.closed_cb) self.session.connect_to_signal('Cancelled', self.cancelled_cb) self.session.connect_to_signal('TransferStarted', self.transfer_started_cb) self.session.connect_to_signal('TransferProgress', self.transfer_progress_cb) self.session.connect_to_signal('TransferCompleted', self.transfer_completed_cb) self.session.connect_to_signal('ErrorOccurred', self.error_occurred_cb) self.main_loop = gobject.MainLoop() self.main_loop.run() def connected_cb(self, session_path): if session_path == self.session_path: print 'Connected' self.run() def disconnected_cb(self): print 'Disconnected' self.call_method('Close') def closed_cb(self): print 'Closed' self.main_loop.quit() def cancelled_cb(self): print 'Transfer cancelled' self.run() def transfer_started_cb(self, filename, local_path, total_bytes): if self.exec_iter == 3: self.call_method('Cancel') return print 'Transfer started (%s, %s, %d)' % (filename, local_path, total_bytes) self.total_bytes = total_bytes transfer_info = self.call_method('GetTransferInfo') print '-- Size = %s' % transfer_info['Size'] print '-- RemoteFilename = %s' % transfer_info['RemoteFilename'] print '-- LocalPath = %s' % transfer_info['LocalPath'] if 'Time' in transfer_info: print '-- Time = ', transfer_info['Time'] def transfer_progress_cb(self, bytes_transferred): if self.total_bytes != 0: print 'Progress: %d %%' % int(float(bytes_transferred)/self.total_bytes*100) else: print 'Progress' def transfer_completed_cb(self): print 'Transfer completed' self.run() def error_occurred_cb(self, error_name, error_message): print 'Error occurred: %s: %s' % (error_name, error_message) if error_name == 'org.openobex.Error.LinkError': self.call_method('Close') self.run() def call_method(self, method_name, *args): to_print = '>>> ' + method_name + '(' for arg in args: to_print += arg + ', ' print to_print.rstrip(', ') + ')' try: ret = self.session.get_dbus_method(method_name)(*args) except dbus.DBusException, e: print 'Failed: %s' % e return False return ret def run(self): if self.exec_iter == 0: print self.call_method('RetrieveFolderListing') print self.call_method('GetCurrentPath') self.call_method('ChangeCurrentFolder', folder_to_go_to) print self.call_method('RetrieveFolderListing') self.call_method('CreateFolder', folder_to_create) print self.call_method('GetCurrentPath') self.call_method('ChangeCurrentFolderBackward') print self.call_method('GetCurrentPath') self.call_method('DeleteRemoteFile', folder_to_create) self.call_method('SendFile', file_to_send) print self.call_method('IsBusy') elif self.exec_iter == 1: print self.call_method('IsBusy') path, ext = splitext(file_to_send) file_to_save_to = path + '_1' + ext self.call_method('CopyRemoteFile', basename(file_to_send), file_to_save_to) elif self.exec_iter == 2: self.call_method('DeleteRemoteFile', basename(file_to_send)) self.call_method('SendFile', file_to_send) elif self.exec_iter == 3: self.call_method('ChangeCurrentFolderToRoot') print self.call_method('GetCurrentPath') print self.call_method('GetCapability') self.call_method('Disconnect') self.exec_iter += 1 if __name__ == '__main__': gobject.threads_init() dbus.glib.init_threads() tester = Tester() obex-data-server-0.4.6/test/ods-server-test.py0000755000175000017500000002022511524724173016223 00000000000000#!/usr/bin/python import dbus import dbus.decorators import dbus.glib import gobject from optparse import OptionParser import sys from signal import * import time class ServerSession: def __init__(self, session_object_path): self.prefix = '>>'+session_object_path+'<< ' self.bus = dbus.SessionBus() # get org.openobex.ServerSession object session_obj = self.bus.get_object('org.openobex', session_object_path) self.session = dbus.Interface(session_obj, 'org.openobex.ServerSession') # connect signals self.session.connect_to_signal('Disconnected', self.disconnected_cb) self.session.connect_to_signal('Cancelled', self.cancelled_cb) self.session.connect_to_signal('TransferStarted', self.transfer_started_cb) self.session.connect_to_signal('TransferProgress', self.transfer_progress_cb) self.session.connect_to_signal('TransferCompleted', self.transfer_completed_cb) self.session.connect_to_signal('ErrorOccurred', self.error_occurred_cb) self.session.connect_to_signal('RemoteDisplayRequested', self.remote_display_requested_cb) # emitted when session is disconnected def disconnected_cb(self): print self.prefix, print 'Disconnected' # emitted when transfer is cancelled def cancelled_cb(self): print self.prefix, print 'Transfer cancelled' # emitted when transfer begins def transfer_started_cb(self, filename, local_path, total_bytes): print self.prefix, print 'Transfer started (%s, %s, %d)' % (filename, local_path, total_bytes) self.total_bytes = total_bytes info = self.session.GetTransferInfo() print self.prefix, 'All transfer info:' for name,value in info.iteritems(): print self.prefix, '--', name, '=', value if options.ask_to_accept: print "Accept file? Type 'a' to accept, 'r' to reject:" command = raw_input('>>> ') if command.strip() == 'a': print 'Accepting' self.session.Accept() else: print 'Rejecting' self.session.Reject() # emitted constantly during transfer def transfer_progress_cb(self, bytes_transferred): print self.prefix, if self.total_bytes > 0: print 'Progress: %d %%' % int(float(bytes_transferred)/self.total_bytes*100) else: print 'Progress' # emitted when transfer is completed def transfer_completed_cb(self): print self.prefix, print 'Transfer completed' # emitted when error occurs (for instance link error) def error_occurred_cb(self, error_name, error_message): print self.prefix, print 'Error occurred: %s: %s' % (error_name, error_message) # emitted when BIP RemoteDisplay feature is requested def remote_display_requested_cb(self, img_filename): print self.prefix, print 'RemoteDisplay requested for image: ', img_filename class Tester: def __init__(self, server_type, root_path, options): self.server_type = server_type self.root_path = root_path self.options = options # get bus if options.system_bus: self.bus = dbus.SystemBus() else: self.bus = dbus.SessionBus() # get org.openobex.Manager object manager_obj = self.bus.get_object('org.openobex', '/org/openobex') self.manager = dbus.Interface(manager_obj, 'org.openobex.Manager') # call Create{Bluetooth|Tty}Server with specified server type # (opp - Object Push Profile, # ftp - File Transfer Profile, # bip - Basic Imaging Profile) # returns Server object path if options.tty_dev: server_path = self.manager.CreateTtyServer(options.tty_dev, self.server_type) else: server_path = self.manager.CreateBluetoothServer(options.local_device, self.server_type, options.pairing) print 'Server object: ', server_path # get org.openobex.Server object server_obj = self.bus.get_object('org.openobex', server_path) self.server = dbus.Interface(server_obj, 'org.openobex.Server') # connect signals self.server.connect_to_signal('Started', self.started_cb) self.server.connect_to_signal('Stopped', self.stopped_cb) self.server.connect_to_signal('Closed', self.closed_cb) self.server.connect_to_signal('ErrorOccurred', self.error_occurred_cb) self.server.connect_to_signal('SessionCreated', self.session_created_cb) self.server.connect_to_signal('SessionRemoved', self.session_removed_cb) # require remote device to send thumbnails for BIP PutImage sessions self.server.SetOption('RequireImagingThumbnails', options.thumbnails) # start server with specified options self.server.Start(self.root_path, not options.readonly, not options.ask_to_accept) self.main_loop = gobject.MainLoop() self.main_loop.run() # emitted when Server is started def started_cb(self): print 'Started' # emitted when Server is stopped def stopped_cb(self): print 'Stopped' # emitted when Server is closed def closed_cb(self): print 'Closed' def error_occurred_cb(self, error_name, error_message): print 'Error occurred: %s: %s' % (error_name, error_message) # emitted when client connects to server (server session is established) def session_created_cb(self, session_object_path): print 'Session created: %s' % session_object_path session_info = self.server.GetServerSessionInfo(session_object_path) print 'Session Bluetooth address: %s' % session_info['BluetoothAddress'] session = ServerSession(session_object_path) # emitted when client disconnects def session_removed_cb(self, session_object_path): print 'Session removed: %s' % session_object_path if __name__ == '__main__': gobject.threads_init() dbus.glib.init_threads() usage = 'Usage: '+sys.argv[0]+' [options] profile path' parser = OptionParser(usage) parser.add_option('-l', '--local', dest='local_device', default='00:00:00:00:00:00', help='ADDRESS of Bluetooth adapter to listen on. Default is 00:00:00:00:00:00', metavar='ADDRESS') parser.add_option('-p', '--pairing', dest='pairing', action='store_true', default=False, help='Require remote devices to be paired before allowing them to connect. Disabled by default') parser.add_option('-y', '--tty', dest='tty_dev', help='Listen on specified TTY device instead of Bluetooth. If TTY device is used, all Bluetooth options are ignored.', metavar='TTY_DEV') parser.add_option('-s', '--system-bus', dest='system_bus', action='store_true', default=False, help='Search for obex-data-server on System bus instead of Session bus (use when ods is running in D-Bus System bus)') parser.add_option('-r', '--readonly', dest='readonly', action='store_true', default=False, help='Disallow any write operations. Allowed by default') parser.add_option('-t', '--thumbnails', dest='thumbnails', action='store_true', default=False, help='Require remote device to send thumbnails when using Imaging (BIP) server') parser.add_option('-a', '--ask-to-accept', dest='ask_to_accept', action='store_true', default=False, help='Prompt user to accept or reject every file. By default all files are accepted') options, args = parser.parse_args() if len(args) != 2: print usage print print 'error: Wrong number of arguments' exit() tester = Tester(args[0], args[1], options) obex-data-server-0.4.6/test/ods-opp-test.py0000755000175000017500000001337311524724173015521 00000000000000#!/usr/bin/python import dbus import dbus.decorators import dbus.glib import gobject from optparse import OptionParser import sys class Tester: total_bytes = -1 progress_started = False file_iter = 0 rotate = '\\|/-' rotate_iter = 0 def __init__(self, options, args): self.options = options self.args = args if options.system_bus: self.bus = dbus.SystemBus() else: self.bus = dbus.SessionBus() manager_obj = self.bus.get_object('org.openobex', '/org/openobex') self.manager = dbus.Interface(manager_obj, 'org.openobex.Manager') self.manager.connect_to_signal('SessionConnected', self.session_connected_cb) self.manager.connect_to_signal('SessionConnectError', self.session_connect_error_cb) if options.tty_dev: self.session_path = self.manager.CreateTtySession(options.tty_dev, 'opp') else: self.session_path = self.manager.CreateBluetoothSession( args[0], options.local_device, 'opp') session_obj = self.bus.get_object('org.openobex', self.session_path) self.session = dbus.Interface(session_obj, 'org.openobex.Session') self.session.connect_to_signal('Disconnected', self.disconnected_cb) self.session.connect_to_signal('Closed', self.closed_cb) self.session.connect_to_signal('Cancelled', self.cancelled_cb) self.session.connect_to_signal('TransferStarted', self.transfer_started_cb) self.session.connect_to_signal('TransferProgress', self.transfer_progress_cb) self.session.connect_to_signal('TransferCompleted', self.transfer_completed_cb) self.session.connect_to_signal('ErrorOccurred', self.error_occurred_cb) self.main_loop = gobject.MainLoop() self.main_loop.run() def session_connected_cb(self, session_path): if session_path == self.session_path: self.send_file() def session_connect_error_cb(self, session_path, error_name, error_message): if session_path == self.session_path: print 'Connection error occurred: %s: %s' % (error_name, error_message) self.main_loop.quit() def disconnected_cb(self): self.call_method('Close') def closed_cb(self): self.main_loop.quit() def cancelled_cb(self): if self.progress_started: print print 'Transfer cancelled' self.send_file() def transfer_started_cb(self, filename, local_path, total_bytes): self.total_bytes = total_bytes self.progress_started = False transfer_info = self.call_method('GetTransferInfo') for name,value in transfer_info.iteritems(): print '--', name, '=', value def transfer_progress_cb(self, bytes_transferred): if not self.progress_started: print 'Progress: ', self.progress_started = True if self.total_bytes != -1: sys.stdout.write('\b\b\b\b%3d%%' % int(float(bytes_transferred)/self.total_bytes*100)) sys.stdout.flush() else: sys.stdout.write('\b\b\b\b'+self.rotate[self.rotate_iter]+' ') sys.stdout.flush() self.rotate_iter += 1 if self.rotate_iter == 4: self.rotate_iter = 0 def transfer_completed_cb(self): if self.progress_started: print print 'Transfer completed' self.send_file() def error_occurred_cb(self, error_name, error_message): if self.progress_started: print print 'Error occurred: %s: %s' % (error_name, error_message) if error_name != 'org.openobex.Error.LinkError': self.send_file() def call_method(self, method_name, *args): try: ret = self.session.get_dbus_method(method_name)(*args) except dbus.DBusException, e: print 'Failed: %s' % e return False return ret def send_file(self): if self.file_iter == len(self.options.files): #no more files to send self.call_method('Disconnect') return file_to_send = self.options.files[self.file_iter] self.file_iter += 1 print 'Sending:', file_to_send self.call_method('SendFile', file_to_send) if __name__ == '__main__': usage = 'Usage: '+sys.argv[0]+' [options] [bt_device] [files]...' parser = OptionParser(usage) parser.add_option('-l', '--local', dest='local_device', default='00:00:00:00:00:00', help='ADDRESS of Bluetooth adapter to connect from. Default is 00:00:00:00:00:00', metavar='ADDRESS') parser.add_option('-y', '--tty', dest='tty_dev', help='Connect to specified TTY device instead of Bluetooth. If TTY device is used, all Bluetooth options are ignored.', metavar='TTY_DEV') parser.add_option('-s', '--system-bus', dest='system_bus', action='store_true', default=False, help='Search for obex-data-server on System bus instead of Session bus (use when ods is running in D-Bus System bus)') options, args = parser.parse_args() err1 = '' err2 = '' if not options.tty_dev and len(args) < 1: err1 = 'error: Remote device address not specified' if options.tty_dev: min_args = 1 else: min_args = 2 if len(args) < min_args: err2 = 'error: No files to send' if err1 or err2: print usage print if err1: print err1 if err2: print err2 exit() options.files = args[min_args-1:] tester = Tester(options, args) obex-data-server-0.4.6/test/ods-dbus-test.c0000644000175000017500000003707711524724173015456 00000000000000/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- * * Copyright (C) 2007-2008 Tadas Dailyda * * Licensed under the GNU General Public License Version 2 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include #include #include #include #include #include #include #include #include "../src/ods-marshal.h" GMainLoop *loop; gint total_bytes_global = -1; const gchar* filename; DBusGProxy *session_proxy; static void session_connected_cb (DBusGProxy *proxy, const gchar *session_object, gpointer user_data) { gboolean ret; GError *error = NULL; //gchar *listing; /* Let's see if this is for session that we created */ if (strcmp (session_object, dbus_g_proxy_get_path (session_proxy))) return; g_message ("Session connected: %s", session_object); /*g_message ("RetrieveFolderListing ()"); ret = dbus_g_proxy_call (session_proxy, "RetrieveFolderListing", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Here goes the listing:\n%s", listing); g_free (listing); } g_message ("GetCurrentPath ()"); ret = dbus_g_proxy_call (session_proxy, "GetCurrentPath", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Current path: %s", listing); g_free (listing); }*/ /*g_message ("ChangeCurrentFolder (\"Data\")"); ret = dbus_g_proxy_call (session_proxy, "ChangeCurrentFolder", &error, G_TYPE_STRING, "Data", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } g_message ("GetCurrentPath ()"); ret = dbus_g_proxy_call (session_proxy, "GetCurrentPath", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Current path: %s", listing); g_free (listing); } g_message ("RetrieveFolderListing ()"); ret = dbus_g_proxy_call (session_proxy, "RetrieveFolderListing", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Here goes the listing:\n%s", listing); g_free (listing); } g_message ("ChangeCurrentFolder (\"../Pictures\")"); ret = dbus_g_proxy_call (session_proxy, "ChangeCurrentFolder", &error, G_TYPE_STRING, "../Pictures", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error (%s): %s", dbus_g_error_get_name (error), error->message); g_clear_error (&error); } g_message ("GetCurrentPath ()"); ret = dbus_g_proxy_call (session_proxy, "GetCurrentPath", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Current path: %s", listing); g_free (listing); } g_message ("RetrieveFolderListing ()"); ret = dbus_g_proxy_call (session_proxy, "RetrieveFolderListing", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Here goes the listing:\n%s", listing); g_free (listing); }*/ /*g_message ("CopyRemoteFile (\"060820_143442.jpg\", \"/home/skirsdeda/Desktop/x.jpg\")"); ret = dbus_g_proxy_call (session_proxy, "CopyRemoteFile", &error, G_TYPE_STRING, "060820_143442.jpg", G_TYPE_STRING, "/home/skirsdeda/Desktop/x.jpg", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); }*/ /*gchar *capabilities; g_message ("GetImagingCapabilities ()"); ret = dbus_g_proxy_call (session_proxy, "GetImagingCapabilities", &error, G_TYPE_INVALID, G_TYPE_STRING, &capabilities, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Imaging capabilities:\n%s", capabilities); g_free (capabilities); }*/ /*ret = dbus_g_proxy_call (session_proxy, "SetTransferHints", &error, G_TYPE_STRING, "blah", G_TYPE_STRING, "", G_TYPE_STRING, "", G_TYPE_UINT64, (guint64)0, G_TYPE_INT64, (gint64)-1, G_TYPE_INT64, (gint64)-1, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); }*/ g_message ("SendFile (\"%s\")", filename); ret = dbus_g_proxy_call (session_proxy, "SendFile", &error, G_TYPE_STRING, filename, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } } static void session_connect_error_cb (DBusGProxy *proxy, const gchar *session_object, const char *error_name, const char *error_message, gpointer user_data) { /* Let's see if this is for session that we created */ if (strcmp (session_object, dbus_g_proxy_get_path (session_proxy))) return; g_message ("Session connect error: %s: %s", error_name, error_message); } static void session_closed_cb (DBusGProxy *proxy, const char *session_object, gpointer user_data) { g_message ("Session removed: %s", session_object); g_main_loop_quit (loop); } static void transfer_started_cb (DBusGProxy *proxy, const char *filename, const char *local_path, guint64 total_bytes, gpointer user_data) { g_message ("Transfer started: (%s, %s, %" G_GUINT64_FORMAT ")", filename, local_path, total_bytes); total_bytes_global = total_bytes; } static void transfer_progress_cb (DBusGProxy *proxy, guint64 bytes_transferred, gpointer user_data) { if (total_bytes_global != -1) { gdouble progress = (gdouble)bytes_transferred / total_bytes_global * 100; g_message ("Transfer progress: %.1f %%", progress); } else { g_message ("Transfer progress"); } } static void transfer_completed_cb (DBusGProxy *proxy, gpointer user_data) { gboolean ret; GError *error = NULL; //gchar *listing; g_message ("Transfer completed"); /*g_message ("ChangeCurrentFolder (\"Pictures\")"); ret = dbus_g_proxy_call (proxy, "ChangeCurrentFolder", &error, G_TYPE_STRING, "Pictures", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } g_message ("GetCurrentPath ()"); ret = dbus_g_proxy_call (proxy, "GetCurrentPath", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Current path: %s", listing); g_free (listing); } g_message ("CreateFolder (\"Nonsense\")"); ret = dbus_g_proxy_call (proxy, "CreateFolder", &error, G_TYPE_STRING, "Nonsense", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } g_message ("RetrieveFolderListing ()"); ret = dbus_g_proxy_call (proxy, "RetrieveFolderListing", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Here goes the listing:\n%s", listing); g_free (listing); } g_message ("DeleteRemoteFile (\"x.jpg\")"); ret = dbus_g_proxy_call (proxy, "DeleteRemoteFile", &error, G_TYPE_STRING, "x.jpg", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); }*/ /*g_message ("DeleteRemoteFile (\"x (1).jpg\")"); ret = dbus_g_proxy_call (proxy, "DeleteRemoteFile", &error, G_TYPE_STRING, "x (1).jpg", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } g_message ("DeleteRemoteFile (\"x (2).jpg\")"); ret = dbus_g_proxy_call (proxy, "DeleteRemoteFile", &error, G_TYPE_STRING, "x (2).jpg", G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); }*/ /*g_message ("ChangeCurrentFolderBackward ()"); ret = dbus_g_proxy_call (proxy, "ChangeCurrentFolderBackward", &error, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } g_message ("RetrieveFolderListing ()"); ret = dbus_g_proxy_call (proxy, "RetrieveFolderListing", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Here goes the listing:\n%s", listing); g_free (listing); }*/ /*g_message ("ChangeCurrentFolderToRoot ()"); ret = dbus_g_proxy_call (proxy, "ChangeCurrentFolderToRoot", &error, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } g_message ("RetrieveFolderListing ()"); ret = dbus_g_proxy_call (proxy, "RetrieveFolderListing", &error, G_TYPE_INVALID, G_TYPE_STRING, &listing, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } else { g_message ("Here goes the listing:\n%s", listing); g_free (listing); }*/ g_message ("Disconnect ()"); ret = dbus_g_proxy_call (proxy, "Disconnect", &error, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } } static void error_occurred_cb (DBusGProxy *proxy, const gchar *error_name, const gchar *error_message, gpointer user_data) { g_message ("Error occurred"); g_warning ("%s: %s", error_name, error_message); g_main_loop_quit (loop); } static void session_disconnected_cb (DBusGProxy *proxy, gpointer user_data) { gboolean ret; GError *error = NULL; g_message ("Session disconnected"); ret = dbus_g_proxy_call (proxy, "Close", &error, G_TYPE_INVALID, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); } } static gboolean create_bluetooth_session (DBusGConnection *dbus_connection, DBusGProxy *dbus_proxy, const gchar *address, const gchar *pattern) { int ret; gchar *session_object_path = NULL; GError *error = NULL; g_message ("CreateBluetoothSession (\"%s\", \"00:00:00:00:00:00\", \"%s\")", address, pattern); ret = dbus_g_proxy_call (dbus_proxy, "CreateBluetoothSession", &error, G_TYPE_STRING, address, G_TYPE_STRING, "00:00:00:00:00:00", G_TYPE_STRING, pattern, G_TYPE_INVALID, DBUS_TYPE_G_OBJECT_PATH, &session_object_path, G_TYPE_INVALID); if (!ret) { g_warning ("Error: %s", error->message); g_clear_error (&error); return FALSE; } else { g_message ("Object path: %s", session_object_path); session_proxy = dbus_g_proxy_new_for_name (dbus_connection, "org.openobex", session_object_path, "org.openobex.Session"); /* register marshallers so we can get TransferStarted and TransferProgress signals */ dbus_g_object_register_marshaller (ods_marshal_VOID__STRING_STRING_UINT64, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID); dbus_g_object_register_marshaller (ods_marshal_VOID__UINT64, G_TYPE_NONE, G_TYPE_UINT64, G_TYPE_INVALID); dbus_g_object_register_marshaller (ods_marshal_VOID__STRING_STRING, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (session_proxy, "Disconnected", G_TYPE_INVALID); dbus_g_proxy_connect_signal (session_proxy, "Disconnected", G_CALLBACK (session_disconnected_cb), NULL, NULL); dbus_g_proxy_add_signal (session_proxy, "TransferStarted", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_UINT64, G_TYPE_INVALID); dbus_g_proxy_connect_signal (session_proxy, "TransferStarted", G_CALLBACK (transfer_started_cb), NULL, NULL); dbus_g_proxy_add_signal (session_proxy, "TransferProgress", G_TYPE_UINT64, G_TYPE_INVALID); dbus_g_proxy_connect_signal (session_proxy, "TransferProgress", G_CALLBACK (transfer_progress_cb), NULL, NULL); dbus_g_proxy_add_signal (session_proxy, "TransferCompleted", G_TYPE_INVALID); dbus_g_proxy_connect_signal (session_proxy, "TransferCompleted", G_CALLBACK (transfer_completed_cb), NULL, NULL); dbus_g_proxy_add_signal (session_proxy, "ErrorOccurred", G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (session_proxy, "ErrorOccurred", G_CALLBACK (error_occurred_cb), NULL, NULL); /*dbus_g_proxy_call (dbus_proxy, "CancelSessionConnect", &error, G_TYPE_STRING, session_object_path, G_TYPE_INVALID, G_TYPE_INVALID);*/ if (session_object_path != NULL) g_free (session_object_path); return TRUE; } } /** * main: **/ int main (int argc, char *argv[]) { if (argc != 4) { g_critical ( "Usage: %s AA:BB:CC:DD:EE:FF profile file.txt", argv[0]); return -1; } filename = argv[3]; DBusGConnection *dbus_connection; DBusGProxy *dbus_proxy; GError *error = NULL; g_type_init (); dbus_connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); if (error) { g_warning ("%s", error->message); g_clear_error (&error); } dbus_proxy = dbus_g_proxy_new_for_name (dbus_connection, "org.openobex", "/org/openobex", "org.openobex.Manager"); dbus_g_object_register_marshaller (ods_marshal_VOID__STRING_STRING_STRING, G_TYPE_NONE, DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_add_signal (dbus_proxy, "SessionConnected", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); dbus_g_proxy_connect_signal (dbus_proxy, "SessionConnected", G_CALLBACK (session_connected_cb), NULL, NULL); dbus_g_proxy_add_signal (dbus_proxy, "SessionConnectError", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal (dbus_proxy, "SessionConnectError", G_CALLBACK (session_connect_error_cb), NULL, NULL); dbus_g_proxy_add_signal (dbus_proxy, "SessionClosed", DBUS_TYPE_G_OBJECT_PATH, G_TYPE_INVALID); dbus_g_proxy_connect_signal (dbus_proxy, "SessionClosed", G_CALLBACK (session_closed_cb), NULL, NULL); if (!create_bluetooth_session (dbus_connection, dbus_proxy, argv[1], argv[2])) return 1; loop = g_main_loop_new (NULL, FALSE); g_main_loop_run (loop); return 0; } obex-data-server-0.4.6/Makefile.am0000644000175000017500000000657211524724173013666 00000000000000########## # general / main dir ########## AM_MAKEFLAGS = --no-print-directory AM_CFLAGS = @GLIB_CFLAGS@ @BIP_CFLAGS@ @USB_CFLAGS@ @DBUS_CFLAGS@ @BLUEZ_CFLAGS@ @OPENOBEX_CFLAGS@ DISTCLEANFILES = BUILT_SOURCES = bin_PROGRAMS = CLEANFILES = noinst_PROGRAMS = EXTRA_DIST = dbus-api.txt ########## # data dir ########## configdir = $(sysconfdir)/obex-data-server config_DATA = data/capability.xml data/imaging_capabilities.xml if SYSTEMCONFIG dbusconfigdir = $(sysconfdir)/dbus-1/system.d dbusconfig_DATA = data/obex-data-server.conf endif servicedir = $(datarootdir)/dbus-1/services service_in_files = data/obex-data-server.service.in service_DATA = data/obex-data-server.service if SYSTEMCONFIG add_args = --system-bus endif $(service_DATA): $(service_in_files) config.log $(AM_V_GEN)$(SED) -e "s|\@servicedir\@|$(bindir)|;s|\@add_args\@|$(add_args)|" $< > $@ man_MANS = data/obex-data-server.1 EXTRA_DIST += data/obex-data-server.1 data/obex-data-server.service.in \ data/obex-data-server.conf data/capability.xml \ data/imaging_capabilities.xml DISTCLEANFILES += data/obex-data-server.service ########## # src dir ########## EXTRA_DIST += src/ods-manager.xml src/ods-marshal.list \ src/ods-server.xml src/ods-server-session.xml \ src/ods-session.xml BUILT_SOURCES += src/ods-manager-dbus-glue.h src/ods-marshal.c \ src/ods-marshal.h src/ods-server-dbus-glue.h \ src/ods-server-session-dbus-glue.h src/ods-session-dbus-glue.h bin_PROGRAMS += src/obex-data-server src_obex_data_server_SOURCES = src/ods-bluez.h src/ods-bluez.c \ src/ods-usb.c src/ods-usb.h \ src/ods-capabilities.h src/ods-capabilities.c \ src/ods-common.h src/ods-common.c \ src/ods-error.h src/ods-error.c \ src/ods-folder-listing.h src/ods-folder-listing.c \ src/ods-imaging-helpers.h src/ods-imaging-helpers.c \ src/ods-main.c \ src/ods-marshal.c src/ods-marshal.h \ src/ods-manager.h src/ods-manager.c \ src/ods-logging.h src/ods-logging.c \ src/ods-obex.h src/ods-obex.c \ src/ods-server.h src/ods-server.c \ src/ods-server-session.h src/ods-server-session.c \ src/ods-session.h src/ods-session.c src_obex_data_server_LDADD = @GLIB_LIBS@ @BIP_LIBS@ @USB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ @OPENOBEX_LIBS@ src/ods-manager-dbus-glue.h: src/ods-manager.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_manager \ --mode=glib-server --output=$@ $< src/ods-server-dbus-glue.h: src/ods-server.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_server \ --mode=glib-server --output=$@ $< src/ods-server-session-dbus-glue.h: src/ods-server-session.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_server_session \ --mode=glib-server --output=$@ $< src/ods-session-dbus-glue.h: src/ods-session.xml $(AM_V_GEN)$(DBUS_BINDING_TOOL) --prefix=ods_session \ --mode=glib-server --output=$@ $< src/ods-marshal.c: src/ods-marshal.list $(AM_V_GEN)@GLIB_GENMARSHAL@ $< --prefix=ods_marshal --body > $@ src/ods-marshal.h: src/ods-marshal.list $(AM_V_GEN)@GLIB_GENMARSHAL@ $< --prefix=ods_marshal --header > $@ CLEANFILES += $(BUILT_SOURCES) ########## # test dir ########## noinst_PROGRAMS += test/ods-dbus-test test_ods_dbus_test_SOURCES = src/ods-marshal.h src/ods-marshal.c \ test/ods-dbus-test.c test_ods_dbus_test_LDADD = @GLIB_LIBS@ @DBUS_LIBS@ @BLUEZ_LIBS@ EXTRA_DIST += test/ods-server-test.py test/ods-session-test.py \ test/ods-bip-test.py test/ods-opp-test.py obex-data-server-0.4.6/COPYING0000644000175000017500000004311011524724173012652 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. obex-data-server-0.4.6/INSTALL0000644000175000017500000002203011524724173012646 00000000000000Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. obex-data-server-0.4.6/dbus-api.txt0000644000175000017500000007746511524724173014110 00000000000000Manager hierarchy =============================== Service org.openobex Interface org.openobex.Manager Object path /org/openobex Methods object CreateBluetoothSession(string target_address, string source_address, string pattern) Creates a Bluetooth OBEX session and returns the new session object of type org.openobex.Session. Session is automatically connected. The target_address represents the remote Bluetooth device, source_address specifies which Bluetooth adapter to use (to use default adapter, use "00:00:00:00:00:00") and the pattern specifies the OBEX service it connects to, or the OBEX service using a fixed Bluetooth channel. Pattern can be a UUID-128 identifying the service or place holder as "opp" (for Object Push) or "ftp" (for FTP). In case you want to use a fixed channel, UUID has to be like: UUID:CHANNEL where UUID is a valid UUID or service place holder like before, and CHANNEL is an integer representing a valid RFCOMM channel. Session object can only be used when SessionConnected signal is emitted. If connection fails (remote device refuses connection, link dies, etc.), SessionConnectError signal is emitted instead. To cancel connecting use CancelSessionConnect method. Returns object path for the created session. Possible errors: org.openobex.Error.InvalidArguments org.openobex.Error.TransportNotAvailable object CreateBluetoothImagingSession(string target_address, string source_addres, string bip_feature) Create Bluetooth OBEX session using BIP profile and returns new session object of type org.openobex.Session. target_address represents the remote Bluetooth device, source_address specifies which Bluetooth adapter to use ("00:00:00:00:00:00" for default adapter). bip_feature specifies imaging feature to use ("imagepush" or "remotedisplay"). In case you want to use a fixed RFCOMM channel, bip_feature has to be like FEATURE:CHANNEL where CHANNEL is an integer representing a valid RFCOMM channel. Session object can only be used when SessionConnected signal is emitted. If connection fails, SessionConnectError signal is emitted instead. To cancel connecting use CancelSessionConnect method. Returns object path for the created session. Possible errors: org.openobex.Error.InvalidArguments org.openobex.Error.TransportNotAvailable object CreateUsbSession(integer interface_number, string profile) Creates a USB OBEX session and returns the new session object of type org.openobex.Session. Session is automatically connected. To find out about available USB OBEX interfaces, use GetUsbInterfacesNum and GetUsbInterfaceInfo. profile specifies profile to be used for session (FTP profile is commonly used for USB OBEX sessions). Session object can only be used when SessionConnected signal is emitted. If connection fails (remote device refuses connection, link dies, etc.), SessionConnectError signal is emitted instead. Do not use CancelSessionConnect with USB sessions (connection is established instantly). Returns object path for the created session. Possible errors: org.openobex.Error.InvalidArguments org.openobex.Error.TransportNotAvailable object CreateTtySession(string tty_dev, string profile) (since 0.4.5) Creates OBEX session using TTY device and returns the new session object of type org.openobex.Session. Session is automatically connected. tty_dev specifies TTY device node. pattern specifies the profile to be used for session which may be either "ftp" for OBEX FTP server, "opp" for OBEX Object Push server or "bip" for OBEX Basic Imaging server. Session object can only be used when SessionConnected signal is emitted. If connection fails (remote device refuses connection, link dies, etc.), SessionConnectError signal is emitted instead. Do not use CancelSessionConnect with TTY sessions (connection is established instantly). Returns object path for the created session. Possible errors: org.openobex.Error.InvalidArguments integer GetUsbInterfacesNum() Returns the number of available USB OBEX interfaces Possible errors: none dict GetUsbInterfaceInfo(integer interface_number) Returns info about specified USB OBEX interface: "Manufacturer" : Manufacturer of the device "Product" : Product name of the device "Serial" : Serial number of the device "Configuration" : USB configuration that this interface belongs to "ControlInterface" : description of the OBEX control interface, typically reveals the functionality of the interface "DataInterfaceIdle" : description of the OBEX data idle interface, typically empty "DataInterfaceActive" : description of the OBEX data active interface, typically empty If specified interface number is too large, returns empty structure. Possible errors: none boolean CancelSessionConnect(object session_object) Cancells session connection. If Session is being connected, connection will be cancelled and SessionConnectError signal with org.openobex.Cancelled error will be emitted. If session is already connected or invalid session is supplied, this function will do nothing and FALSE will be returned. Returns TRUE if cancelled successfully, FALSE otherwise. Possible errors: none object CreateBluetoothServer(string source_address, string pattern, boolean require_pairing) Gets Server object for specified bluetooth source address. source_address can be Bluetooth address of any adapter or just "00:00:00:00:00:00" for default adapter. pattern specifies the type of server to create which may be either "ftp" for OBEX FTP server, "opp" for OBEX Object Push server or "bip" for OBEX Basic Imaging server. require_pairing specifies whether client device should be paired before allowing any operations (recommended values: True for FTP, False for OPP). Returns object path for the created server. Possible errors: org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.TransportNotAvailable object CreateTtyServer(string tty_dev, string pattern) (since 0.4.5) Gets Server object for specified TTY device (e.g. /dev/ttyUSB0). This kind of server can be used on embedded devices to serve files via USB OBEX. tty_dev specifies TTY device node. pattern specifies the type of server which may be either "ftp" for OBEX FTP server, "opp" for OBEX Object Push server or "bip" for OBEX Basic Imaging server. Return object path for the created server. Possible errors: org.openobex.Error.Failed org.openobex.Error.InvalidArguments dict GetSessionInfo(object session_object) Returns info about specified session: "BluetoothTargetAddress" : Target device Bluetooth address (only for Bluetooth sessions); "BluetoothSourceAddress" : Source Bluetooth address (hci device used) (only for Bluetooth sessions); "BluetoothChannel" : RFCOMM channel used for session (only for Bluetooth sessions); "UsbInterfaceNumber" : USB interface number (only for USB sessions); "TTYDevice" : TTY device which is used (only for TTY sessions); If specified session does not exist, returns empty structure. session_object specifies DBus path of Session object. Possible errors: none dict GetServerInfo(object server_object) Returns info about specified server: "BluetoothSourceAddress" : Bluetooth source address (only for Bluetooth servers); "RequirePairing" : if connecting to server triggers pairing (only for Bluetooth servers); "TTYDevice" : TTY device which is used (only for TTY servers); If specified session does not exist, returns empty structure. server_object specifies DBus path of Server object. Possible errors: none array GetSessionList() Returns list of open sessions. Array contains DBus paths of sessions. Possible errors: none array GetServerList() Returns list of open servers. Array contains DBus paths of servers. Possible errors: none string GetVersion() Returns obex-data-server version and obex-data-server API version. Returned string is formated like that: ":". API version is an integer. When API incompatible with older one is released, this number is increased by one. As of ods version 0.4 API version is 1. Example of returned string: "0.4:1". Possible errors: none Signals void SessionConnected(object path) Emitted when Session is connected to target device. void SessionConnectError(object path, string error_name, string error_message) Emitted when Session connection fails. Session object must not be used after that. void SessionClosed(object path) Emitted when Session is closed and no longer valid. Server hierarchy =============================== Service org.openobex Interface org.openobex.Server Object path /org/openobex/server{0,1,2...} Methods void Start(string path, boolean allow_write, boolean auto_accept) Starts OBEX Object Push / FTP server (begins listening for connections). Started signal is emitted after the server is started. If error occurs, ErrorOccurred signal is emitted instead. Once the server is started, it emits SessionCreated signal for every newly connected client. If this is Object Push server, path defines where all received files will be saved. In case of FTP server path is the top-level folder which will be served. allow_write specifies whether write operations will be allowed (put and delete). In most cases, allow_write should be set to True. auto_accept specifies whether incoming files should be always accepted (recommended values: True for FTP, False for OPP). If auto_accept is set to False, either Accept() or Reject() has to be called every time after you receive TransferStarted signal in ServerSession object. If Accept() or Reject() is not called in 15 seconds after TransferStarted signal, timeout will happen and the incoming file will be automatically rejected. It is important to listen for Cancelled signal on ServerSession object when auto_accept is False because you can receive Cancelled signal while waiting for user to accept or reject incoming file. This would effectively mean that timeout happened and the incoming file was rejected. Possible errors: org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.Started void Stop() Stops the server. All client connections will be closed and operations will be cancelled. Stopped signal is emitted after the server is stopped. Possible errors: org.openobex.Error.NotAuthorized org.openobex.Error.NotStarted void Close() Closes the server. If server is not stopped, all client connections will be closed, operations will be cancelled. Server object will be destroyed after that. Closed signal is emitted immediately when this method is invoked. Possible errors: org.openobex.Error.NotAuthorized boolean IsStarted() Returns true if server is started, false otherwise. Possible errors: none void SetOption(string name, variant value) Sets server options. Supported options: "Limit" : maximum server sessions that server will accept (0 for no limit). Default is 0. Value type is uint16. "RequireImagingThumbnails" : whether to require clients to send thumbnails for uploaded images (specific to BIP servers). Default is False. Value type is boolean. Possible errors: org.openobex.Error.InvalidArguments dict GetServerSessionInfo(object session_object) Returns info about specified server session: "BluetoothAddress" : Client device Bluetooth address; If specified server session does not exist, returns empty structure. session_object specifies DBus path of ServerSession object. Possible errors: none array GetServerSessionList() Returns list of open server sessions. Array contains DBus paths of server sessions. Possible errors: none Signals void Started() This signal informs that the server was started. void Stopped() This signal informs that the server was stopped and all operations were ceased. void Closed() This signal informs that the server was closed and it's object is no longer valid. void ErrorOccurred(string error_name, string error_message) This signal informs that error occurred while starting or stopping the server. void SessionCreated(object session_object) Signal informs that client connected to server and new ServerSession object was created. Returns path of ServerSession object. void SessionRemoved(object session_object) Signal informs that client disconnected from server. Returns path of ServerSession object that was closed. Session hierarchy =============================== Service org.openobex Interface org.openobex.Session Object path /org/openobex/session{0,1,2...} Methods void Disconnect() Disconnects from remote device by sending OBEX disconnect command. Disconnected signal is emitted once disconnected. Normally, "Close" should be called immediately after Session is disconnected. Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.NotAuthorized org.openobex.Error.OutOfMemory void Close() Closes the session (the actual connection to remote device is closed). Session object is finalized and can not be used anymore. Closed signal is emitted once closed. Possible errors: org.openobex.Error.Failed org.openobex.Error.NotAuthorized void ChangeCurrentFolder(string path) Changes current path on a remote device to the specified one. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.OutOfMemory void ChangeCurrentFolderBackward() Changes current path on a remote device one level up. If current folder is root, path is not changed. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.OutOfMemory void ChangeCurrentFolderToRoot() Changes current path on a remote device to root. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.OutOfMemory string GetCurrentPath() Returns current path on a remote device. Possible errors: none void CopyRemoteFile(string remote_filename, string local_path) Starts receiving a specified file from a remote device. remote_filename specifies the file to receive on a remote device. local_path is the path where received file will be saved. TransferStarted signal is emitted when transfer starts. If error occurs during operation, ErrorOccurred signal is emitted instead. Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.NotFound org.openobex.Error.OutOfMemory void CopyRemoteFileByType(string type, string local_path) Starts receiving default object of specified type from a remote device. type specifies OBEX type to receive. local_path is the path where received file will be saved. TransferStarted signal is emitted when transfer starts. If error occurs during operation, ErrorOccurred signal is emitted instead. Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.NotFound org.openobex.Error.OutOfMemory void CreateFolder(string folder_name) Creates a folder on a remote device with a specified name. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Busy org.openobex.Error.Failed org.openobex.Error.InvalidArguments org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.OutOfMemory string RetrieveFolderListing() Retrieves the list of files in the current folder. The list is XML formatted string. See OBEX specification for info about the format. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: string GetCapability() Retrieves the FTP capability object. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: void SendFile(string local_path) Starts sending a specified file to a remote device. local_path specifies the path to file that will be sent. TransferStarted signal is emitted when transfer starts. If error occurs during operation, ErrorOccurred signal is emitted. Possible errors: org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.Busy org.openobex.Error.InvalidArguments org.openobex.Error.OutOfMemory org.openobex.Error.NotFound !! org.openobex.Error.Failed void SendFileExt(string local_path, string remote_filename, string type) Starts sending a specified file to a remote device. It's possible to specify different filename (remote_filename) than that of local file. When remote_filename is empty, original filename is used. type specifies particular OBEX type to send file as. type can be empty. When type is used, remote_filename must be empty. TransferStarted signal is emitted when transfer starts. If error occurs during operation, ErrorOccurred signal is emitted. Possible errors: org.openobex.Error.NotAuthorized org.openobex.Error.NotConnected org.openobex.Error.Busy org.openobex.Error.InvalidArguments org.openobex.Error.OutOfMemory org.openobex.Error.NotFound !! org.openobex.Error.Failed void DeleteRemoteFile(string remote_filename) Deletes specified file on remote device. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Failed void RemoteCopy(string remote_source, string remote_destination) (since 0.4.3) FTP profile Initiates remote copy operation (data is copied from one location to the other in remote device). remote_source specifies a file or folder to be copied (this file or folder has to exist in current directory). remote_destination specifies path where to copy data. This path can be relative to current folder or relative to root folder. Both slash ('/') and backslash ('\') symbols can be used in path. Example source/destination pairs : 'File.txt' : 'Folder/OtherFolder/NewFile.txt' 'Folder' : '/Folder/OtherFolder/NewFolder' (relative to root folder) 'Folder' : 'Folder\NewFolder' Note that ods does not check remote_destination argument validity. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). ! This method is not included in official FTP profile specification, therefore not many devices support it. Possible errors: void RemoteMove(string remote_source, string remote_destination) (since 0.4.3) FTP profile Initiates remote move operation (data is moved from one location to the other in remote device). See RemoteCopy method for how the arguments should be used. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). ! This method is not included in official FTP profile specification, therefore not many devices support it. Possible errors: string GetImagingCapabilities() BIP profile, all features Retrieves imaging capabilities object ("x-bt/img-capabilities"). This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: void GetImageInfo(string local_path, out uint16 width, out uint16 height, out string encoding) BIP profile utility function Returns image info for specified locally stored image. Returns width, height and encoding. Can be used to determine how image should be resized to match remote device preferred image format specified in imaging capabilities object. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.InvalidArguments org.openobex.Error.NotSupported org.openobex.Error.Failed void PutImage(string local_path) BIP profile, ImagePush and RemoteDisplay features Pushes image to remote device. local_path specifies image filename. TransferStarted signal is emitted when transfer starts. If error occurs during operation, ErrorOccurred signal is emitted. When transfer finishes successfully, ImageHandleReceived signal is emitted (ImageHandleReceived signal returns image handle for pushed image to be used in further operations). Possible errors: void PutImageResized(string local_path, uint16 width, uint16 height, string encoding, string transformation) BIP profile, ImagePush and RemoteDisplay features Pushes resized/encoded image to remote device. Client application should parse ImagingCapabilities object prior to this to acquire image formats supported by remote device. local_path specifies original image filename. width and height specify new dimensions. encoding specifies image format ("JPEG", "PNG", etc.). If encoding is empty, original encoding will be preserved. See ImageMagick supported formats list for available values. transformation defines how image should be resized. Possible transformations are "stretch" (stretches image to new dimensions), "crop" (crops image) or "fill" (in case dimensions are bigger than original, image is filled with white backround). If specified dimensions match the original dimensions, no resizing will be done. If invalid transformation value is used, "stretch" will be used by default. TransferStarted signal is emitted when transfer starts. If error occurs during operation, ErrorOccurred signal is emitted. When transfer finishes successfully, ImageHandleReceived signal is emitted (ImageHandleReceived signal returns image handle for pushed image to be used in further operations). Possible errors: void PutLinkedAttachment(string image_handle, string local_path, string content_type, string charset) BIP profile, ImagePush feature Pushes attachment linked to previously pushed image. image_handle specifies handle of previously pushed image, local_path is path to file to be sent. content_type specifies attachment's MIME content type, e.g. "text/plain". content_type is optional and can be empty. charset specifies charset in which attachment is encoded. charset is also optional and can be empty. Progress of transfer is reported using TransferStarted, TransferProgress, ErrorOccurred and TransferCompleted signals. Possible errors: void RemoteDisplaySelectImage(string image_handle) BIP profile, RemoteDisplay feature Selects previously pushed image (using PutImage or PutImageResized methods). image_handle specifies image handle corresponding to previously pushed image (returned by ImageHandleReceived signal). This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Failed void RemoteDisplayShowCurrentImage() BIP profile, RemoteDisplay feature Triggers remote device to show currently selected image. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Failed void RemoteDisplayShowNextImage() BIP profile, RemoteDisplay feature Triggers remote device to show next image. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Failed void RemoteDisplayShowPreviousImage() BIP profile, RemoteDisplay feature Triggers remote device to show previous image. This method only returns after operation is finished. This means that if method returned without any error, operation is complete (this is in contrast with how file transfers work). Possible errors: org.openobex.Error.Failed dict GetTransferInfo() Returns info about the ongoing transfer: "LocalPath" : full local path; "RemoteFilename" : filename; "Size" : total bytes being transferred; "Time" : last modification time of file being sent; "OBEXCommand" : either "GET" or "PUT"; Possible errors: none boolean IsBusy() Returns true if there is an operation in progress, false otherwise. Possible errors: none void Cancel() Cancels any operation that is in progress. Possible errors: org.openobex.Error.Failed Signals void Cancelled() This signal informs that the current transfer was cancelled either by client or by server. void Disconnected() This signal informs that the session was disconnected. void Closed() This signal informs that the session was terminated and that it's object is no longer valid. void TransferStarted(string filename, string local_path, uint64 total_bytes) This signal informs that transfer was started. total_bytes is the number of total bytes that are being sent (0 if total bytes are unknown). filename specifies the filename (without path) of file being sent or null if it is unknown. local_path specifies where the file is stored locally. void TransferProgress(uint64 bytes_transferred) This signal is emitted constantly during the transfer. bytes_transferred specifies how many bytes were already transferred. void TransferCompleted() This signal informs that transfer was completed. void ErrorOccurred(string error_name, string error_message) This signal informs that error occurred while performing some operation. void ImageHandleReceived(string image_handle, boolean thumbnail_requested) This signal returns image handle for pushed image (using PutImage or PutImageResized). thumbnail_requested specifies whether Imaging Responder requested client to send thumbnail. If thumbnail was requested, TransferStarted/TransferProgress/TransferCompleted signals will be emitted when transferring thumbnail. ServerSession hierarchy =============================== Service org.openobex Interface org.openobex.ServerSession Object path /org/openobex/serversession{0,1,2...} Methods void Accept() Accepts incoming file (use this when auto_accept is set to False for corresponding Server object). If auto_accept is True, this function will do nothing. Call this method just after receiving TransferStarted signal. If there is no transfer in progress or if current transfer is not an incoming transfer, error will be returned. If you do not call Accept() or Reject() in 15 seconds after TransferStarted signal, incoming file will be automatically rejected and you will receive Cancelled signal. Possible errors: org.openobex.Error.Failed void Reject() Rejects incoming file (use this when auto_accept is set to False for corresponding Server object). If auto_accept is True, this function will do nothing. Call this method just after receiving TransferStarted signal. If there is no transfer in progress or if current transfer is not an incoming transfer, error will be returned. If you do not call Accept() or Reject() in 15 seconds after TransferStarted signal, incoming file will be automatically rejected and you will receive Cancelled signal. Possible errors: org.openobex.Error.Failed void Disconnect() Disconnects from remote device. ServerSession object is finalized and can not be used anymore. Disconnected signal is emitted once disconnected. Possible errors: dict GetTransferInfo() Returns all info about the ongoing transfer (filename, local path, total bytes). Possible errors: none void Cancel() Cancels any operation that is in progress. Possible errors: org.openobex.Error.Failed Signals void Cancelled() This signal informs that the current transfer was cancelled either by client or by server. void Disconnected() This signal informs that the ServerSession was disconnected. ServerSession object is finalized and can not be used anymore. void TransferStarted(string filename, string local_path, uint64 total_bytes) This signal informs that transfer was started. total_bytes is the number of total bytes that are being sent (0 if total bytes are unknown). filename specifies the filename (without path) of file being sent or null if it is unknown. local_path specifies where the file is stored locally. void TransferProgress(uint64 bytes_transferred) This signal is emitted constantly during the transfer. bytes_transferred specifies how many bytes were already transferred. void TransferCompleted() This signal informs that transfer was completed. void ErrorOccurred(string error_name, string error_message) This signal informs that error occurred while performing some operation. void RemoteDisplayRequested(string filename) This signal is used for Imaging sessions that use Remote Display feature. Signal informs that remote device requested display of previously uploaded image. filename specifies the filename of image to be displayed.