From c0a3c5b934b997cf4bba32b3880a0b24f287bd12 Mon Sep 17 00:00:00 2001 From: Regis Merlino Date: Wed, 21 Aug 2013 10:39:54 +0200 Subject: [PATCH] Update gupnp to 0.20.5 (fdeb6f9f) --- Makefile.in | 2 - NEWS | 56 ++++ build-aux/ltmain.sh | 4 +- configure | 196 ++++--------- configure.ac | 7 +- doc/Makefile.am | 49 +++- doc/Makefile.in | 80 +++--- doc/client-tutorial.xml | 2 +- doc/gupnp-docs.xml | 1 + doc/gupnp-sections.txt | 82 ++++++ doc/html/GUPnPContext.html | 14 +- doc/html/GUPnPContextManager.html | 44 ++- doc/html/GUPnPDeviceInfo.html | 32 ++- doc/html/GUPnPResourceFactory.html | 4 +- doc/html/GUPnPService.html | 54 +++- doc/html/GUPnPServiceProxy.html | 27 +- doc/html/GUPnPWhiteList.html | 311 +++++++++++++++++++++ doc/html/GUPnPXMLDoc.html | 8 + doc/html/api-utility.html | 3 + doc/html/api.html | 3 + doc/html/client-tutorial.html | 12 +- doc/html/gupnp-Error-codes.html | 2 +- doc/html/gupnp-binding-tool.html | 6 +- doc/html/gupnp.devhelp2 | 14 + doc/html/index.html | 7 +- doc/html/index.sgml | 18 ++ doc/html/ix01.html | 28 +- doc/html/server-tutorial.html | 28 +- doc/server-tutorial.xml | 16 +- doc/tmpl/gupnp-context-manager.sgml | 110 -------- doc/tmpl/gupnp-context.sgml | 170 ----------- doc/tmpl/gupnp-control-point.sgml | 124 -------- doc/tmpl/gupnp-device-info.sgml | 307 -------------------- doc/tmpl/gupnp-device-proxy.sgml | 30 -- doc/tmpl/gupnp-device.sgml | 35 --- doc/tmpl/gupnp-error.sgml | 94 ------- doc/tmpl/gupnp-resource-factory.sgml | 88 ------ doc/tmpl/gupnp-root-device.sgml | 128 --------- doc/tmpl/gupnp-service-info.sgml | 177 ------------ doc/tmpl/gupnp-service-introspection.sgml | 132 --------- doc/tmpl/gupnp-service-proxy.sgml | 278 ------------------ doc/tmpl/gupnp-service.sgml | 263 ----------------- doc/tmpl/gupnp-types.sgml | 87 ------ doc/tmpl/gupnp-unused.sgml | 0 doc/tmpl/gupnp-xml-doc.sgml | 50 ---- examples/Makefile.in | 2 - gtk-doc.make | 32 +-- libgupnp/Makefile.am | 2 + libgupnp/Makefile.in | 23 +- libgupnp/gupnp-context-manager.c | 233 +++++++++++++++- libgupnp/gupnp-context-manager.h | 5 + libgupnp/gupnp-context.c | 6 +- libgupnp/gupnp-device-info.c | 58 +++- libgupnp/gupnp-device-info.h | 3 + libgupnp/gupnp-error.h | 1 + libgupnp/gupnp-network-manager.c | 67 +++-- libgupnp/gupnp-service-proxy.c | 18 +- libgupnp/gupnp-service.c | 29 +- libgupnp/gupnp-simple-context-manager.c | 2 +- libgupnp/gupnp-white-list.c | 390 ++++++++++++++++++++++++++ libgupnp/gupnp-white-list.h | 107 +++++++ libgupnp/gupnp-xml-doc.h | 10 + libgupnp/gupnp.h | 1 + m4/libtool.m4 | 40 +-- packaging/GUPnP.changes | 3 + packaging/GUPnP.spec | 2 +- tests/Makefile.am | 8 +- tests/Makefile.in | 25 +- tests/gtest/Makefile.am | 2 - tests/gtest/Makefile.in | 24 +- tests/gtest/test-context.c | 15 - tests/test-white-list.c | 291 +++++++++++++++++++ tools/Makefile.in | 2 - tools/gupnp-binding-tool | 450 +++++++++++++++--------------- vala/GUPnP-1.0.metadata | 2 + vala/Makefile.in | 2 - 76 files changed, 2296 insertions(+), 2742 deletions(-) create mode 100644 doc/html/GUPnPWhiteList.html delete mode 100644 doc/tmpl/gupnp-context-manager.sgml delete mode 100644 doc/tmpl/gupnp-context.sgml delete mode 100644 doc/tmpl/gupnp-control-point.sgml delete mode 100644 doc/tmpl/gupnp-device-info.sgml delete mode 100644 doc/tmpl/gupnp-device-proxy.sgml delete mode 100644 doc/tmpl/gupnp-device.sgml delete mode 100644 doc/tmpl/gupnp-error.sgml delete mode 100644 doc/tmpl/gupnp-resource-factory.sgml delete mode 100644 doc/tmpl/gupnp-root-device.sgml delete mode 100644 doc/tmpl/gupnp-service-info.sgml delete mode 100644 doc/tmpl/gupnp-service-introspection.sgml delete mode 100644 doc/tmpl/gupnp-service-proxy.sgml delete mode 100644 doc/tmpl/gupnp-service.sgml delete mode 100644 doc/tmpl/gupnp-types.sgml delete mode 100644 doc/tmpl/gupnp-unused.sgml delete mode 100644 doc/tmpl/gupnp-xml-doc.sgml create mode 100644 libgupnp/gupnp-white-list.c create mode 100644 libgupnp/gupnp-white-list.h create mode 100644 tests/test-white-list.c diff --git a/Makefile.in b/Makefile.in index e407fa3..10a9163 100644 --- a/Makefile.in +++ b/Makefile.in @@ -209,8 +209,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ diff --git a/NEWS b/NEWS index b91debe..7aec806 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,59 @@ +0.20.5 +====== + +Changes since 0.20.5: + - Add some missing G_{BEGIN,END}_DECLS guards. + - Fix uninitialized variable use introduced in previous version. + - Add simple network device whitelisting infrastructure. + - Port gupnp-binding-tool so it's usable with python3. + - Minor code fixes. + - Fix crashes in NetworkManager context manager during some async calls. + - Fix a small memory leak in the unix and windows CM. + - Always enable GTest tests. + - Upgrade gtk-doc stuff. + - Fix the service example in documentation. + - Remove the test for inverted arguments in the GUPnPContext tests. + +Bugs fixed in this release: + - https://bugzilla.gnome.org/show_bug.cgi?id=694454 + - https://bugzilla.gnome.org/show_bug.cgi?id=704094 + - https://bugzilla.gnome.org/show_bug.cgi?id=704383 + - https://bugzilla.gnome.org/show_bug.cgi?id=705712 + - https://bugzilla.gnome.org/show_bug.cgi?id=706326 + +All contributors to this release: + - Jens Georg + - Ludovic Ferrandis + - Olivier Crête + - Bohuslav Kabrda + +0.20.4 +====== + +Changes since 0.20.3: +- Fix warnings in gtk-doc run. +- Some minor improvements to the documentation. +- Make the user-agent ASCII-only to fix issues with discovery when + g_get_application_name () returned a translated string. +- Force HTTP version to be 1.1 in SOAP requests. +- Fix potential crashes in XML parsing. +- Fix potential memory leak in gupnp_service_proxy_send_action_valist. +- Some codestyle fixes. +- Add gupnp_device_info_list_dlna_device_class_identifier () to retrieve the + content of nodes. + +Bugs fixed in this release: + - https://bugzilla.gnome.org/show_bug.cgi?id=704953 + - https://bugzilla.gnome.org/show_bug.cgi?id=702555 + - https://bugzilla.gnome.org/show_bug.cgi?id=704094 + - https://bugzilla.gnome.org/show_bug.cgi?id=700947 + +All contributors to this release: + Ludovic Ferrandis + Jens Georg + Sébastien Bianti + Bastien Nocera + 0.20.3 ====== diff --git a/build-aux/ltmain.sh b/build-aux/ltmain.sh index 0096fe6..b9205ee 100644 --- a/build-aux/ltmain.sh +++ b/build-aux/ltmain.sh @@ -70,7 +70,7 @@ # compiler: $LTCC # compiler flags: $LTCFLAGS # linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1ubuntu2 +# $progname: (GNU libtool) 2.4.2 Debian-2.4.2-1.2ubuntu1 # automake: $automake_version # autoconf: $autoconf_version # @@ -80,7 +80,7 @@ PROGRAM=libtool PACKAGE=libtool -VERSION="2.4.2 Debian-2.4.2-1ubuntu2" +VERSION="2.4.2 Debian-2.4.2-1.2ubuntu1" TIMESTAMP="" package_revision=1.3337 diff --git a/configure b/configure index 0eaac0c..e874272 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gupnp 0.20.3. +# Generated by GNU Autoconf 2.69 for gupnp 0.20.5. # # Report bugs to . # @@ -651,8 +651,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='gupnp' PACKAGE_TARNAME='gupnp' -PACKAGE_VERSION='0.20.3' -PACKAGE_STRING='gupnp 0.20.3' +PACKAGE_VERSION='0.20.5' +PACKAGE_STRING='gupnp 0.20.5' PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=gupnp&component=gupnp' PACKAGE_URL='http://www.gupnp.org/' @@ -748,10 +748,6 @@ GTHREAD_LIBS GTHREAD_CFLAGS LIBGUPNP_LIBS LIBGUPNP_CFLAGS -HAVE_GTEST_FALSE -HAVE_GTEST_TRUE -GTest_LIBS -GTest_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG @@ -908,8 +904,6 @@ CPP PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR -GTest_CFLAGS -GTest_LIBS LIBGUPNP_CFLAGS LIBGUPNP_LIBS GTHREAD_CFLAGS @@ -1460,7 +1454,7 @@ 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 gupnp 0.20.3 to adapt to many kinds of systems. +\`configure' configures gupnp 0.20.5 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1531,7 +1525,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gupnp 0.20.3:";; + short | recursive ) echo "Configuration of gupnp 0.20.5:";; esac cat <<\_ACEOF @@ -1584,9 +1578,6 @@ Some influential environment variables: directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path - GTest_CFLAGS - C compiler flags for GTest, overriding pkg-config - GTest_LIBS linker flags for GTest, overriding pkg-config LIBGUPNP_CFLAGS C compiler flags for LIBGUPNP, overriding pkg-config LIBGUPNP_LIBS @@ -1673,7 +1664,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gupnp configure 0.20.3 +gupnp configure 0.20.5 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1951,7 +1942,7 @@ 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 gupnp $as_me 0.20.3, which was +It was created by gupnp $as_me 0.20.5, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2886,7 +2877,7 @@ fi # Define the identity of the package. PACKAGE='gupnp' - VERSION='0.20.3' + VERSION='0.20.5' cat >>confdefs.h <<_ACEOF @@ -5538,7 +5529,8 @@ else ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -5939,10 +5931,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -5981,7 +5969,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -7078,7 +7066,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -8640,7 +8635,7 @@ lt_prog_compiler_static= lt_prog_compiler_static='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -10810,17 +10805,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -10937,7 +10921,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -11985,6 +11969,28 @@ CC="$lt_save_CC" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking operating system" >&5 +$as_echo_n "checking operating system... " >&6; } +os_win32=no +case "$target_os" in + mingw*|cygwin*) + os_win32=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Win32" >&5 +$as_echo "Win32" >&6; } + UUID= + ;; + darwin*) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Darwin" >&5 +$as_echo "Darwin" >&6; } + UUID= + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_os" >&5 +$as_echo "$target_os" >&6; } + UUID=uuid + ;; +esac + @@ -12107,108 +12113,6 @@ $as_echo "no" >&6; } fi pkg_failed=no -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GTest" >&5 -$as_echo_n "checking for GTest... " >&6; } - -if test -n "$GTest_CFLAGS"; then - pkg_cv_GTest_CFLAGS="$GTest_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 >= 2.16\""; } >&5 - ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.16") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GTest_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= 2.16" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -else - pkg_failed=yes -fi - else - pkg_failed=untried -fi -if test -n "$GTest_LIBS"; then - pkg_cv_GTest_LIBS="$GTest_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 >= 2.16\""; } >&5 - ($PKG_CONFIG --exists --print-errors "glib-2.0 >= 2.16") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - pkg_cv_GTest_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= 2.16" 2>/dev/null` - test "x$?" != "x0" && pkg_failed=yes -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 - GTest_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= 2.16" 2>&1` - else - GTest_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= 2.16" 2>&1` - fi - # Put the nasty error message in config.log where it belongs - echo "$GTest_PKG_ERRORS" >&5 - - gtest=no -elif test $pkg_failed = untried; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - gtest=no -else - GTest_CFLAGS=$pkg_cv_GTest_CFLAGS - GTest_LIBS=$pkg_cv_GTest_LIBS - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - gtest=yes -fi - if test x$gtest = xyes; then - HAVE_GTEST_TRUE= - HAVE_GTEST_FALSE='#' -else - HAVE_GTEST_TRUE='#' - HAVE_GTEST_FALSE= -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking operating system" >&5 -$as_echo_n "checking operating system... " >&6; } -os_win32=no -case "$target_os" in - mingw*|cygwin*) - os_win32=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Win32" >&5 -$as_echo "Win32" >&6; } - UUID= - ;; - darwin*) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: Darwin" >&5 -$as_echo "Darwin" >&6; } - UUID= - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $target_os" >&5 -$as_echo "$target_os" >&6; } - UUID=uuid - ;; -esac - - -pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGUPNP" >&5 $as_echo_n "checking for LIBGUPNP... " >&6; } @@ -13120,14 +13024,14 @@ fi if test x$enable_gtk_doc = xyes; then if test -n "$PKG_CONFIG" && \ - { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-doc >= 1.0\""; } >&5 - ($PKG_CONFIG --exists --print-errors "gtk-doc >= 1.0") 2>&5 + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gtk-doc >= 1.14\""; } >&5 + ($PKG_CONFIG --exists --print-errors "gtk-doc >= 1.14") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : else - as_fn_error $? "You need to have gtk-doc >= 1.0 installed to build $PACKAGE_NAME" "$LINENO" 5 + as_fn_error $? "You need to have gtk-doc >= 1.14 installed to build $PACKAGE_NAME" "$LINENO" 5 fi if test "x$PACKAGE_NAME" != "xglib"; then @@ -13422,10 +13326,6 @@ 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 "${HAVE_GTEST_TRUE}" && test -z "${HAVE_GTEST_FALSE}"; then - as_fn_error $? "conditional \"HAVE_GTEST\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi if test -z "${OS_WIN32_TRUE}" && test -z "${OS_WIN32_FALSE}"; then as_fn_error $? "conditional \"OS_WIN32\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -13871,7 +13771,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gupnp $as_me 0.20.3, which was +This file was extended by gupnp $as_me 0.20.5, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13938,7 +13838,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gupnp config.status 0.20.3 +gupnp config.status 0.20.5 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index 76980cd..0d7e91f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ([2.64]) AC_INIT([gupnp], - [0.20.3], + [0.20.5], [http://bugzilla.gnome.org/enter_bug.cgi?product=gupnp&component=gupnp], [gupnp], [http://www.gupnp.org/]) @@ -28,9 +28,6 @@ LT_PREREQ([2.2]) LT_INIT -PKG_CHECK_MODULES(GTest, glib-2.0 >= 2.16, [gtest=yes], [gtest=no]) -AM_CONDITIONAL(HAVE_GTEST, [test x$gtest = xyes]) - AC_MSG_CHECKING([operating system]) os_win32=no case "$target_os" in @@ -156,7 +153,7 @@ AS_IF([test "x$VAPIGEN" != "x"], [have_vapigen=yes]) AM_CONDITIONAL([HAVE_VAPIGEN], [test "x$VAPIGEN" != "x"]) # Gtk-doc -GTK_DOC_CHECK([1.0]) +GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) AC_CONFIG_FILES([ Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index af34552..2e92132 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -11,29 +11,37 @@ AUTOMAKE_OPTIONS = 1.6 # The name of the module, e.g. 'glib'. DOC_MODULE=gupnp +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + + # The top-level SGML file. You can change this if you want to. DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml -# The directory containing the source code. Relative to $(srcdir). -# gtk-doc will search all .c & .h files beneath here for inline comments -# documenting the functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk +# Directories containing the source code. +# gtk-doc will search all .c and .h files beneath these paths +# for inline comments documenting functions and macros. +# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk DOC_SOURCE_DIR=../libgupnp # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS= # Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" SCAN_OPTIONS=--deprecated-guards="GUPNP_DISABLE_DEPRECATED" # Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS=--sgml-mode --output-format=xml +# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml +MKDB_OPTIONS=--xml-mode --output-format=xml # Extra options to supply to gtkdoc-mktmpl # e.g. MKTMPL_OPTIONS=--only-section-tmpl MKTMPL_OPTIONS= +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS= + # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html FIXXREF_OPTIONS= @@ -44,14 +52,19 @@ FIXXREF_OPTIONS= HFILE_GLOB=$(top_srcdir)/libgupnp/*.h CFILE_GLOB=$(top_srcdir)/libgupnp/*.c -# Header files to ignore when scanning. -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES= + +# Header files or dirs to ignore when scanning. Use base file/dir names +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code IGNORE_HFILES=gena-protocol.h \ xml-util.h \ gvalue-util.h \ http-headers.h \ gupnp-marshal.h \ gupnp-context-private.h \ + gupnp-linux-context-manager.h \ gupnp-network-manager.h \ gupnp-unix-context-manager.h \ gupnp-device-info-private.h \ @@ -76,9 +89,9 @@ expand_content_files=client-tutorial.xml server-tutorial.xml # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. -# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -INCLUDES=-I$(top_srcdir) $(LIBGUPNP_CFLAGS) +GTKDOC_CFLAGS=-I$(top_srcdir) $(LIBGUPNP_CFLAGS) GTKDOC_LIBS=$(top_builddir)/libgupnp/libgupnp-1.0.la $(LIBGUPNP_LIBS) # This includes the standard gtk-doc make rules, copied by gtkdocize. @@ -87,3 +100,19 @@ include $(top_srcdir)/gtk-doc.make # Other files to distribute # e.g. EXTRA_DIST += version.xml.in EXTRA_DIST += version.xml.in + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want 'make check' to test you doc status +# and run some sanity checks +if ENABLE_GTK_DOC +TESTS_ENVIRONMENT = cd $(srcdir) && \ + DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \ + SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir) +# TESTS = $(GTKDOC_CHECK) +endif + +-include $(top_srcdir)/git.mk diff --git a/doc/Makefile.in b/doc/Makefile.in index 9062500..65cf76b 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -124,8 +124,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ @@ -248,29 +246,36 @@ AUTOMAKE_OPTIONS = 1.6 # The name of the module, e.g. 'glib'. DOC_MODULE = gupnp +# Uncomment for versioned docs and specify the version of the module, e.g. '2'. +#DOC_MODULE_VERSION=2 + # The top-level SGML file. You can change this if you want to. DOC_MAIN_SGML_FILE = $(DOC_MODULE)-docs.xml -# The directory containing the source code. Relative to $(srcdir). -# gtk-doc will search all .c & .h files beneath here for inline comments -# documenting the functions and macros. -# e.g. DOC_SOURCE_DIR=../../../gtk +# Directories containing the source code. +# gtk-doc will search all .c and .h files beneath these paths +# for inline comments documenting functions and macros. +# e.g. DOC_SOURCE_DIR=$(top_srcdir)/gtk $(top_srcdir)/gdk DOC_SOURCE_DIR = ../libgupnp # Extra options to pass to gtkdoc-scangobj. Not normally needed. SCANGOBJ_OPTIONS = # Extra options to supply to gtkdoc-scan. +# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED" SCAN_OPTIONS = --deprecated-guards="GUPNP_DISABLE_DEPRECATED" # Extra options to supply to gtkdoc-mkdb. -# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml -MKDB_OPTIONS = --sgml-mode --output-format=xml +# e.g. MKDB_OPTIONS=--xml-mode --output-format=xml +MKDB_OPTIONS = --xml-mode --output-format=xml # Extra options to supply to gtkdoc-mktmpl # e.g. MKTMPL_OPTIONS=--only-section-tmpl MKTMPL_OPTIONS = +# Extra options to supply to gtkdoc-mkhtml +MKHTML_OPTIONS = + # Extra options to supply to gtkdoc-fixref. Not normally needed. # e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html FIXXREF_OPTIONS = @@ -281,14 +286,19 @@ FIXXREF_OPTIONS = HFILE_GLOB = $(top_srcdir)/libgupnp/*.h CFILE_GLOB = $(top_srcdir)/libgupnp/*.c -# Header files to ignore when scanning. -# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h +# Extra header to include when scanning, which are not under DOC_SOURCE_DIR +# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h +EXTRA_HFILES = + +# Header files or dirs to ignore when scanning. Use base file/dir names +# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h private_code IGNORE_HFILES = gena-protocol.h \ xml-util.h \ gvalue-util.h \ http-headers.h \ gupnp-marshal.h \ gupnp-context-private.h \ + gupnp-linux-context-manager.h \ gupnp-network-manager.h \ gupnp-unix-context-manager.h \ gupnp-device-info-private.h \ @@ -314,9 +324,9 @@ expand_content_files = client-tutorial.xml server-tutorial.xml # CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library. # Only needed if you are using gtkdoc-scangobj to dynamically query widget # signals and properties. -# e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) +# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS) # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib) -INCLUDES = -I$(top_srcdir) $(LIBGUPNP_CFLAGS) +GTKDOC_CFLAGS = -I$(top_srcdir) $(LIBGUPNP_CFLAGS) GTKDOC_LIBS = $(top_builddir)/libgupnp/libgupnp-1.0.la $(LIBGUPNP_LIBS) @GTK_DOC_USE_LIBTOOL_FALSE@GTKDOC_CC = $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @GTK_DOC_USE_LIBTOOL_TRUE@GTKDOC_CC = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(INCLUDES) $(GTKDOC_DEPS_CFLAGS) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) @@ -344,9 +354,9 @@ SETUP_FILES = \ # Other files to distribute # e.g. EXTRA_DIST += version.xml.in EXTRA_DIST = $(HTML_IMAGES) $(SETUP_FILES) version.xml.in -DOC_STAMPS = setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ +DOC_STAMPS = setup-build.stamp scan-build.stamp sgml-build.stamp \ html-build.stamp pdf-build.stamp \ - tmpl.stamp sgml.stamp html.stamp pdf.stamp + sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ @@ -365,6 +375,18 @@ CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_HTML_TRUE@HTML_BUILD_STAMP = html-build.stamp @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_FALSE@PDF_BUILD_STAMP = @ENABLE_GTK_DOC_TRUE@@GTK_DOC_BUILD_PDF_TRUE@PDF_BUILD_STAMP = pdf-build.stamp + +# Files not to distribute +# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types +# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt +#DISTCLEANFILES += + +# Comment this out if you want 'make check' to test you doc status +# and run some sanity checks +@ENABLE_GTK_DOC_TRUE@TESTS_ENVIRONMENT = cd $(srcdir) && \ +@ENABLE_GTK_DOC_TRUE@ DOC_MODULE=$(DOC_MODULE) DOC_MAIN_SGML_FILE=$(DOC_MAIN_SGML_FILE) \ +@ENABLE_GTK_DOC_TRUE@ SRCDIR=$(abs_srcdir) BUILDDIR=$(abs_builddir) + all: all-am .SUFFIXES: @@ -585,9 +607,6 @@ setup-build.stamp: cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ done; \ fi; \ - test -d $(abs_srcdir)/tmpl && \ - { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ - chmod -R u+w $(abs_builddir)/tmpl; } \ fi @touch setup-build.stamp @@ -621,29 +640,10 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true -#### templates #### - -tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo ' DOC Rebuilding template files' - @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) - @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ - if test -w $(abs_srcdir) ; then \ - cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ - fi \ - fi - @touch tmpl-build.stamp - -tmpl.stamp: tmpl-build.stamp - @true - -$(srcdir)/tmpl/*.sgml: - @true - #### xml #### -sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) +sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) @echo ' DOC Building XML' - @-chmod -R u+w $(srcdir) @_source_dir='' ; \ for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ @@ -720,7 +720,6 @@ distclean-local: $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ - rm -rf tmpl; \ fi maintainer-clean-local: clean @@ -765,9 +764,7 @@ uninstall-local: @ENABLE_GTK_DOC_FALSE@ @false dist-hook: dist-check-gtkdoc dist-hook-local - @mkdir $(distdir)/tmpl @mkdir $(distdir)/html - @-cp ./tmpl/*.sgml $(distdir)/tmpl @cp ./html/* $(distdir)/html @-cp ./$(DOC_MODULE).pdf $(distdir)/ @-cp ./$(DOC_MODULE).types $(distdir)/ @@ -776,6 +773,9 @@ dist-hook: dist-check-gtkdoc dist-hook-local @$(GTKDOC_REBASE) --online --relative --html-dir=$(distdir)/html .PHONY : dist-hook-local docs +# TESTS = $(GTKDOC_CHECK) + +-include $(top_srcdir)/git.mk # 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. diff --git a/doc/client-tutorial.xml b/doc/client-tutorial.xml index c480e07..0373d68 100644 --- a/doc/client-tutorial.xml +++ b/doc/client-tutorial.xml @@ -139,7 +139,7 @@ service_proxy_available_cb (GUPnPControlPoint *cp, It is possible to get change notifications for the service state variables that have attribute sendEvents="yes". We'll demonstrate - this by modifying service_proxy_available_cb() and using + this by modifying service_proxy_available_cb and using gupnp_service_proxy_add_notify() to setup a notification callback: static void diff --git a/doc/gupnp-docs.xml b/doc/gupnp-docs.xml index 94c96e3..d7fb919 100644 --- a/doc/gupnp-docs.xml +++ b/doc/gupnp-docs.xml @@ -75,6 +75,7 @@ + diff --git a/doc/gupnp-sections.txt b/doc/gupnp-sections.txt index d53fd97..e0cd73c 100644 --- a/doc/gupnp-sections.txt +++ b/doc/gupnp-sections.txt @@ -43,6 +43,7 @@ gupnp_device_info_get_presentation_url gupnp_device_info_get_upc gupnp_device_info_get_icon_url gupnp_device_info_list_dlna_capabilities +gupnp_device_info_list_dlna_device_class_identifier gupnp_device_info_get_description_value gupnp_device_info_list_devices gupnp_device_info_list_device_types @@ -205,6 +206,7 @@ gupnp_context_manager_rescan_control_points gupnp_context_manager_manage_control_point gupnp_context_manager_manage_root_device gupnp_context_manager_get_port +gupnp_context_manager_get_white_list GUPnPContextManagerClass GUPNP_CONTEXT_MANAGER @@ -389,3 +391,83 @@ gupnp_eventing_error_quark gupnp_control_error_quark gupnp_xml_error_quark + +
+gupnp-connman-manager + +GUPNP_CONNMAN_MANAGER +GUPNP_CONNMAN_MANAGER_CLASS +GUPNP_CONNMAN_MANAGER_GET_CLASS +GUPNP_IS_CONNMAN_MANAGER +GUPNP_IS_CONNMAN_MANAGER_CLASS +GUPNP_TYPE_CONNMAN_MANAGER +GUPnPConnmanManager +GUPnPConnmanManagerClass +GUPnPConnmanManagerPrivate +
+ +
+gupnp-simple-context-manager + +GUPNP_IS_SIMPLE_CONTEXT_MANAGER +GUPNP_IS_SIMPLE_CONTEXT_MANAGER_CLASS +GUPNP_SIMPLE_CONTEXT_MANAGER +GUPNP_SIMPLE_CONTEXT_MANAGER_CLASS +GUPNP_SIMPLE_CONTEXT_MANAGER_GET_CLASS +GUPNP_TYPE_SIMPLE_CONTEXT_MANAGER +GUPnPSimpleContextManager +GUPnPSimpleContextManagerClass +GUPnPSimpleContextManagerPrivate +
+ +
+gupnp-windows-context-manager + +GUPNP_IS_WINDOWS_CONTEXT_MANAGER +GUPNP_IS_WINDOWS_CONTEXT_MANAGER_CLASS +GUPNP_TYPE_WINDOWS_CONTEXT_MANAGER +GUPNP_WINDOWS_CONTEXT_MANAGER +GUPNP_WINDOWS_CONTEXT_MANAGER_CLASS +GUPNP_WINDOWS_CONTEXT_MANAGER_GET_CLASS +GUPnPWindowsContextManager +GUPnPWindowsContextManagerClass +gupnp_windows_context_manager_get_type +
+ +
+gupnp-unix-context-manager +
+ +
+gupnp-linux-context-manager +
+ +
+gupnp-network-manager +
+ +
+gupnp-white-list +GUPnPWhiteList +GUPnPWhiteList +gupnp_white_list_add_entry +gupnp_white_list_check_context +gupnp_white_list_clear +gupnp_white_list_set_enabled +gupnp_white_list_get_entries +gupnp_white_list_is_empty +gupnp_white_list_get_enabled +gupnp_white_list_new +gupnp_white_list_remove_entry + +gupnp_white_list_get_type +GUPNP_IS_WHITE_LIST +GUPNP_IS_WHITE_LIST_CLASS +GUPNP_TYPE_WHITE_LIST +GUPNP_WHITE_LIST +GUPNP_WHITE_LIST_CLASS +GUPNP_WHITE_LIST_GET_CLASS +GUPnPWhiteListClass + +GUPnPWhiteListPrivate +
diff --git a/doc/html/GUPnPContext.html b/doc/html/GUPnPContext.html index 137670b..dd20240 100644 --- a/doc/html/GUPnPContext.html +++ b/doc/html/GUPnPContext.html @@ -103,7 +103,7 @@ GUPnP classes. It automatically starts a web server on demand.

For debugging, it is possible to see the messages being sent and received by -exporting GUPNP_DEBUG. +exporting GUPNP_DEBUG.

@@ -345,11 +345,17 @@ Content-Language header is set to this value. The default value is "en".

- + + - + + + + + + +

context :

A GUPnPContext -language A language tag as defined in RFC 2616 3.10

language :

A language tag as defined in RFC 2616 3.10

diff --git a/doc/html/GUPnPContextManager.html b/doc/html/GUPnPContextManager.html index 9d17d19..97b7da3 100644 --- a/doc/html/GUPnPContextManager.html +++ b/doc/html/GUPnPContextManager.html @@ -7,7 +7,7 @@ - + @@ -18,7 +18,7 @@ Up Home GUPnP Reference Manual -Next +Next Top @@ -56,6 +56,8 @@ (GUPnPContextManager *manager, GUPnPRootDevice *root_device); guint gupnp_context_manager_get_port (GUPnPContextManager *manager); +GUPnPWhiteList * gupnp_context_manager_get_white_list + (GUPnPContextManager *manager);
@@ -70,12 +72,13 @@
   "main-context"             gpointer              : Read / Write / Construct Only
   "port"                     guint                 : Read / Write / Construct Only
+  "white-list"               GUPnPWhiteList*       : Read
 
@@ -254,6 +257,31 @@ Get the network port associated with this context manager. +
+
+

gupnp_context_manager_get_white_list ()

+
GUPnPWhiteList *    gupnp_context_manager_get_white_list
+                                                        (GUPnPContextManager *manager);
+

+Get the GUPnPWhiteList associated with manager. +

+
++ + + + + + + + + + +

manager :

A GUPnPContextManager +

Returns :

The GUPnPWhiteList asssociated with this +context manager. [transfer none] +
+

Property Details

@@ -272,6 +300,14 @@ port is used by

Default value: 0

+
+
+

The "white-list" property

+
  "white-list"               GUPnPWhiteList*       : Read
+

+The white list to use. +

+

Signal Details

@@ -279,7 +315,7 @@ port is used by

The "context-available" signal

void                user_function                      (GUPnPContextManager *context_manager,
                                                         GUPnPContext        *context,
-                                                        gpointer             user_data)            : Run Last
+ gpointer user_data) : Run First

Signals the availability of new GUPnPContext.

diff --git a/doc/html/GUPnPDeviceInfo.html b/doc/html/GUPnPDeviceInfo.html index 45c450a..92bb465 100644 --- a/doc/html/GUPnPDeviceInfo.html +++ b/doc/html/GUPnPDeviceInfo.html @@ -74,6 +74,8 @@ const char * int *height); GList * gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info); +GList * gupnp_device_info_list_dlna_device_class_identifier + (GUPnPDeviceInfo *info); char * gupnp_device_info_get_description_value (GUPnPDeviceInfo *info, const char *element); @@ -579,7 +581,7 @@ returned icon, or GList * gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info);

-Get a GList of strings that represent the device capabilities as announced +Get a GList of strings that represent the device capabilities as announced in the device description file using the <dlna:X_DLNACAP> element.

@@ -602,6 +604,34 @@ element. [ +

gupnp_device_info_list_dlna_device_class_identifier ()

+
GList *             gupnp_device_info_list_dlna_device_class_identifier
+                                                        (GUPnPDeviceInfo *info);
+

+Get a GList of strings that represent the device class and version as +announced in the device description file using the <dlna:X_DLNADOC> +element. +

+
++ + + + + + + + + + +

info :

A GUPnPDeviceInfo +

Returns :

a GList of newly allocated strings or +NULL if the device description doesn't contain the <dlna:X_DLNADOC> +element. [transfer full][element-type utf8] +
+
+
+

gupnp_device_info_get_description_value ()

char *              gupnp_device_info_get_description_value
                                                         (GUPnPDeviceInfo *info,
diff --git a/doc/html/GUPnPResourceFactory.html b/doc/html/GUPnPResourceFactory.html
index 30bee08..353a404 100644
--- a/doc/html/GUPnPResourceFactory.html
+++ b/doc/html/GUPnPResourceFactory.html
@@ -6,7 +6,7 @@
 
 
 
-
+
 
 
 
@@ -14,7 +14,7 @@
 
 
-
+
diff --git a/doc/html/GUPnPService.html b/doc/html/GUPnPService.html
index 6463f59..922db9d 100644
--- a/doc/html/GUPnPService.html
+++ b/doc/html/GUPnPService.html
@@ -200,11 +200,18 @@ Retrieves the specified action arguments.
 

- + + - + + + + + +

action :

A GUPnPServiceAction

... :

tuples of argument name, argument type, and argument value +location, terminated with NULL.

@@ -345,11 +352,18 @@ Sets the specified action return values.

- + + - + + + + + +

action :

A GUPnPServiceAction

... :

tuples of return value name, return value type, and +actual return value, terminated with NULL.

@@ -544,11 +558,18 @@ have changed to the specified values.

- + + - + + + + + +

service :

A GUPnPService

... :

Tuples of variable name, variable type, and variable value, +terminated with NULL.

@@ -647,7 +668,7 @@ Sends out any pending notifications, and stops queuing of new ones. A convenience function that attempts to connect all possible "action-invoked" and "query-variable" signals to appropriate callbacks for the service service. It uses service introspection -and GModule's introspective features. It is very simillar to +and GModule's introspective features. It is very simillar to gtk_builder_connect_signals() except that it attempts to guess the names of the signal handlers on its own.

@@ -657,19 +678,26 @@ functions for "query-variable" signals, except that "query_" should be prepended to the variable name. For example, callback function for -"GetSystemUpdateID" action should be either named as +GetSystemUpdateID action should be either named as "get_system_update_id_cb" or "on_get_system_update_id" and callback function for the query of "SystemUpdateID" state variable should be named -"query_system_update_id_cb" or "on_query_system_update_id". +query_system_update_id_cb or +on_query_system_update_id.

-Note that this function will not work correctly if GModule is not supported -on the platform or introspection is not available for service service.

+
+

Note

This function will not work correctly if GModule is not supported +on the platform or introspection is not available for service.

-WARNING: This function can not and therefore does not guarantee that the +

+

+

+
+

Warning

This function can not and therefore does not guarantee that the resulting signal connections will be correct as it depends heavily on a -particular naming schemes described above. +particular naming schemes described above.
+

diff --git a/doc/html/GUPnPServiceProxy.html b/doc/html/GUPnPServiceProxy.html index 2342b64..9faf882 100644 --- a/doc/html/GUPnPServiceProxy.html +++ b/doc/html/GUPnPServiceProxy.html @@ -273,6 +273,13 @@ a UPnPError the error code will be the same in error + + + + @@ -487,6 +494,12 @@ or failed. [... :

+
+ + + + + + @@ -792,9 +811,6 @@ out-parameter names, types and place-holders for values. The returned list in out_values must be freed using g_list_free and each element in it using g_value_unset and g_slice_free.

-

-Return value : TRUE on success. -

... :

tuples of in parameter name, in parameter type, and in parameter +value, followed by NULL, and then tuples of out parameter name, +out parameter type, and out parameter value location, terminated with NULL +

Returns :

TRUE if sending the action was succesful.tuples of in parameter name, in parameter type, and in parameter +value, terminated with NULL +

Returns :

A GUPnPServiceProxyAction handle. This will be freed when gupnp_service_proxy_cancel_action() or @@ -686,6 +699,12 @@ a UPnPError the error code will be the same in error

... :

tuples of out parameter name, out parameter type, and out parameter +value location, terminated with NULL. The out parameter values should be +freed after use

Returns :

TRUE on success.
@@ -833,6 +849,11 @@ that line up with out_names. GValue) that line up with out_names and out_types. [element-type GValue][transfer full][out] + + + +

Returns :

+TRUE on success.
diff --git a/doc/html/GUPnPWhiteList.html b/doc/html/GUPnPWhiteList.html new file mode 100644 index 0000000..9b9bd67 --- /dev/null +++ b/doc/html/GUPnPWhiteList.html @@ -0,0 +1,311 @@ + + + + +GUPnPWhiteList + + + + + + + + + + + + + + + + + + + +
+
+
+ + +
+

GUPnPWhiteList

+

GUPnPWhiteList — Class for network filtering.

+
+ +
+

Object Hierarchy

+
+  GObject
+   +----GUPnPWhiteList
+
+
+
+

Description

+

+GUPnPWhiteList handles network filtering. It provides API to manage a list +of entries that will be used to filter networks. +The GUPnPWhiteList could be enabled or not. If it's enabled but the entries +list is empty, it behaves as disabled. +

+
+
+

Details

+
+

struct GUPnPWhiteList

+
struct GUPnPWhiteList;
+

+This struct contains private data only, and should be accessed using the +functions below. +

+
+
+
+

gupnp_white_list_add_entry ()

+
gboolean            gupnp_white_list_add_entry          (GUPnPWhiteList *white_list,
+                                                         gchar *entry);
+

+Add entry in the list of valid criteria used by white_list to +filter networks. +if entry already exists, it won't be added a second time. +

+
++ + + + + + + + + + + + + + +

white_list :

A GUPnPWhiteList +

entry :

A value used to filter network

Returns :

+TRUE if entry is added, FALSE otherwise.
+
+
+
+

gupnp_white_list_check_context ()

+
gboolean            gupnp_white_list_check_context      (GUPnPWhiteList *white_list,
+                                                         GUPnPContext *context);
+

+It will check if the context is allowed or not. The white_list will check +all its entries againt GUPnPContext interface, host ip and network fields +information. This function doesn't take into account the white_list status +(enabled or not). +

+
++ + + + + + + + + + + + + + +

white_list :

A GUPnPWhiteList +

context :

A GUPnPContext to test.

Returns :

+TRUE if context is matching the white_list criterias, +FALSE otherwise.
+
+
+
+

gupnp_white_list_clear ()

+
void                gupnp_white_list_clear              (GUPnPWhiteList *white_list);
+

+Remove all entries from GList that compose the white list. +The list is now empty. Even if GUPnPWhiteList is enabled, it will have the +same behavior as if it was disabled. +

+
++ + + + +

white_list :

A GUPnPWhiteList +
+
+
+
+

gupnp_white_list_set_enabled ()

+
void                gupnp_white_list_set_enabled        (GUPnPWhiteList *white_list,
+                                                         gboolean enable);
+

+Enable or disable the GUPnPWhiteList to perform the network filtering. +

+
++ + + + + + + + + + +

white_list :

A GUPnPWhiteList +

enable :

+TRUE to enable white_list, FALSE otherwise
+
+
+
+

gupnp_white_list_get_entries ()

+
GList *             gupnp_white_list_get_entries        (GUPnPWhiteList *white_list);
+

+Get the GList of entries that compose the white list. Do not free +

+
++ + + + + + + + + + +

white_list :

A GUPnPWhiteList +

Returns :

a GList of entries +used to filter networks, interfaces,... or NULL. +Do not modify or free the list nor its elements. [element-type utf8][transfer none] +
+
+
+
+

gupnp_white_list_is_empty ()

+
gboolean            gupnp_white_list_is_empty           (GUPnPWhiteList *white_list);
+

+Return the state of the entries list of GUPnPWhiteList +

+
++ + + + + + + + + + +

white_list :

A GUPnPWhiteList +

Returns :

+TRUE if white_list is empty, FALSE otherwise.
+
+
+
+

gupnp_white_list_get_enabled ()

+
gboolean            gupnp_white_list_get_enabled        (GUPnPWhiteList *white_list);
+

+Return the status of the GUPnPWhiteList +

+
++ + + + + + + + + + +

white_list :

A GUPnPWhiteList +

Returns :

+TRUE if white_list is enabled, FALSE otherwise.
+
+
+
+

gupnp_white_list_new ()

+
GUPnPWhiteList *    gupnp_white_list_new                (void);
+

+Create a new GUPnPWhiteList. +The white list is disabled by default. +

+
++ + + + +

Returns :

A new GUPnPWhiteList object. [transfer full] +
+
+
+
+

gupnp_white_list_remove_entry ()

+
gboolean            gupnp_white_list_remove_entry       (GUPnPWhiteList *white_list,
+                                                         gchar *entry);
+

+Remove entry in the list of valid criteria used by white_list to +filter networks. +

+
++ + + + + + + + + + + + + + +

white_list :

A GUPnPWhiteList +

entry :

A value to remove from the filter list.

Returns :

+TRUE if entry is removed, FALSE otherwise.
+
+
+
+ + + \ No newline at end of file diff --git a/doc/html/GUPnPXMLDoc.html b/doc/html/GUPnPXMLDoc.html index 2e4ae2a..dc011ab 100644 --- a/doc/html/GUPnPXMLDoc.html +++ b/doc/html/GUPnPXMLDoc.html @@ -68,7 +68,15 @@ references. };

+Reference-counting wrapper for libxml's xmlDoc

+
++ + + + +

xmlDoc *doc;

Pointer to the document.

diff --git a/doc/html/api-utility.html b/doc/html/api-utility.html index b0a998e..8c6af5a 100644 --- a/doc/html/api-utility.html +++ b/doc/html/api-utility.html @@ -30,6 +30,9 @@ GUPnPContextManager — Manages GUPnPContext objects.
+GUPnPWhiteList — Class for network filtering. +
+
GUPnPResourceFactory — Class for resource and resource proxy object creation.
diff --git a/doc/html/api.html b/doc/html/api.html index c56d9ec..2222802 100644 --- a/doc/html/api.html +++ b/doc/html/api.html @@ -70,6 +70,9 @@ GUPnPContextManager — Manages GUPnPContext objects.
+GUPnPWhiteList — Class for network filtering. +
+
GUPnPResourceFactory — Class for resource and resource proxy object creation.
diff --git a/doc/html/client-tutorial.html b/doc/html/client-tutorial.html index 507c27f..395ddcd 100644 --- a/doc/html/client-tutorial.html +++ b/doc/html/client-tutorial.html @@ -24,7 +24,7 @@ Writing a UPnP Client

-Introduction

+Introduction

This chapter explains how to write an application which fetches the external IP address from an UPnP-compliant modem. To do this a @@ -41,7 +41,7 @@

-Finding Services

+Finding Services

First, we initialize GUPnP and create a control point targeting the service type. Then we connect a signal handler so that we are notified @@ -104,7 +104,7 @@ main (int argc, char **argv)

-Invoking Actions

+Invoking Actions

Now we have an application which searches for the service we specified and calls service_proxy_available_cb for each one it @@ -154,11 +154,11 @@ service_proxy_available_cb (GUPnPControlPoint *cp,

-Subscribing to state variable change notifications

+Subscribing to state variable change notifications

It is possible to get change notifications for the service state variables that have attribute sendEvents="yes". We'll demonstrate - this by modifying service_proxy_available_cb() and using + this by modifying service_proxy_available_cb and using gupnp_service_proxy_add_notify() to setup a notification callback:

static void
@@ -189,7 +189,7 @@ service_proxy_available_cb (GUPnPControlPoint *cp,
 
 

-Generating Wrappers

+Generating Wrappers

Using gupnp_service_proxy_send_action() and gupnp_service_proxy_add_notify () can become tedious, because of the requirement to specify the types and deal diff --git a/doc/html/gupnp-Error-codes.html b/doc/html/gupnp-Error-codes.html index 305f420..e03eb82 100644 --- a/doc/html/gupnp-Error-codes.html +++ b/doc/html/gupnp-Error-codes.html @@ -276,7 +276,7 @@ processing of XML data.

GUPNP_XML_ERROR_INVALID_ATTRIBUTE

- +An XML node has an unknown attribute. diff --git a/doc/html/gupnp-binding-tool.html b/doc/html/gupnp-binding-tool.html index 0d9470f..9b96911 100644 --- a/doc/html/gupnp-binding-tool.html +++ b/doc/html/gupnp-binding-tool.html @@ -33,7 +33,7 @@

gupnp-binding-tool [--prefix {PREFIX}] [--mode {client|server}] {SCPD file}

-

Description

+

Description

gupnp-binding-tool takes a SCPD file and generates convenience C functions which call the actual GUPnP functions. The client-side bindings can be seen @@ -49,7 +49,7 @@

-

Client side bindings

+

Client side bindings

As an example, this action:

@@ -138,7 +138,7 @@ igd_external_ip_address_add_notify (GUPnPServiceProxy *proxy,

-

Server side bindings

+

Server side bindings

The corresponding server bindings for the same UPnP action (DeletePortMapping) look like this: diff --git a/doc/html/gupnp.devhelp2 b/doc/html/gupnp.devhelp2 index c4b2348..b79f7af 100644 --- a/doc/html/gupnp.devhelp2 +++ b/doc/html/gupnp.devhelp2 @@ -26,6 +26,7 @@ + @@ -63,6 +64,7 @@ + @@ -213,10 +215,22 @@ + + + + + + + + + + + + diff --git a/doc/html/index.html b/doc/html/index.html index f8950e8..19fb5bc 100644 --- a/doc/html/index.html +++ b/doc/html/index.html @@ -14,11 +14,11 @@

-

Version 0.20.3 +

Version 0.20.5

-

+

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later @@ -95,6 +95,9 @@ GUPnPContextManager — Manages GUPnPContext objects.

+GUPnPWhiteList — Class for network filtering. +
+
GUPnPResourceFactory — Class for resource and resource proxy object creation.
diff --git a/doc/html/index.sgml b/doc/html/index.sgml index e01acc5..0788f18 100644 --- a/doc/html/index.sgml +++ b/doc/html/index.sgml @@ -23,6 +23,7 @@ + @@ -253,12 +254,29 @@ + + + + + + + + + + + + + + + + + diff --git a/doc/html/ix01.html b/doc/html/ix01.html index d5d6195..b542543 100644 --- a/doc/html/ix01.html +++ b/doc/html/ix01.html @@ -20,7 +20,7 @@

-Index

+Index

G

@@ -46,6 +46,8 @@
GUPnPContextManager:port, The "port" property
+
GUPnPContextManager:white-list, The "white-list" property +
GUPnPControlError, enum GUPnPControlError
GUPnPControlPoint, struct GUPnPControlPoint @@ -154,6 +156,8 @@
GUPnPServiceStateVariableInfo, GUPnPServiceStateVariableInfo
+
GUPnPWhiteList, struct GUPnPWhiteList +
GUPnPXMLDoc, struct GUPnPXMLDoc
GUPnPXMLError, enum GUPnPXMLError @@ -178,6 +182,8 @@
gupnp_context_manager_get_port, gupnp_context_manager_get_port ()
+
gupnp_context_manager_get_white_list, gupnp_context_manager_get_white_list () +
gupnp_context_manager_manage_control_point, gupnp_context_manager_manage_control_point ()
gupnp_context_manager_manage_root_device, gupnp_context_manager_manage_root_device () @@ -254,6 +260,8 @@
gupnp_device_info_list_dlna_capabilities, gupnp_device_info_list_dlna_capabilities ()
+
gupnp_device_info_list_dlna_device_class_identifier, gupnp_device_info_list_dlna_device_class_identifier () +
gupnp_device_info_list_services, gupnp_device_info_list_services ()
gupnp_device_info_list_service_types, gupnp_device_info_list_service_types () @@ -418,6 +426,24 @@
GUPNP_TYPE_UUID, GUPNP_TYPE_UUID
+
gupnp_white_list_add_entry, gupnp_white_list_add_entry () +
+
gupnp_white_list_check_context, gupnp_white_list_check_context () +
+
gupnp_white_list_clear, gupnp_white_list_clear () +
+
gupnp_white_list_get_enabled, gupnp_white_list_get_enabled () +
+
gupnp_white_list_get_entries, gupnp_white_list_get_entries () +
+
gupnp_white_list_is_empty, gupnp_white_list_is_empty () +
+
gupnp_white_list_new, gupnp_white_list_new () +
+
gupnp_white_list_remove_entry, gupnp_white_list_remove_entry () +
+
gupnp_white_list_set_enabled, gupnp_white_list_set_enabled () +
gupnp_xml_doc_new, gupnp_xml_doc_new ()
gupnp_xml_doc_new_from_path, gupnp_xml_doc_new_from_path () diff --git a/doc/html/server-tutorial.html b/doc/html/server-tutorial.html index ead9dbe..f1ec040 100644 --- a/doc/html/server-tutorial.html +++ b/doc/html/server-tutorial.html @@ -24,7 +24,7 @@ Writing a UPnP Service

-Introduction

+Introduction

This chapter explains how to implement a UPnP service using GUPnP. For this example we will create a virtual UPnP-enabled light bulb. @@ -42,7 +42,7 @@

-Defining the Device

+Defining the Device

The first step is to write the device description file. This is a short XML document which describes the device and what @@ -118,7 +118,7 @@

-Defining Services

+Defining Services

Because we are using a standard service we can use the service description from the specification. This is the SwitchPower1 @@ -211,7 +211,7 @@

-Implementing the Device

+Implementing the Device

Before starting to implement the device, some boilerplate code is needed to initialise GUPnP. GLib types and threading needs to be initialised, @@ -225,19 +225,15 @@ /* Create the GUPnP context with default host and port */ context = gupnp_context_new (NULL, NULL, 0, NULL);

- UPnP uses HTTP to provide the device and service description files, so - next we tell GUPnP to publish them. This is done with - gupnp_context_host_path() which takes a local filename to send when a - certain server path is requested. -

-
gupnp_context_host_path (context, "BinaryLight1.xml", "/BinaryLight1.xml");
-gupnp_context_host_path (context, "SwitchPower1.xml", "/SwitchPower1.xml");
-

- Next the root device can be created. + Next the root device can be created. The name of the device description + file can be passed as an absolute file path or a relative path to the + second parameter of gupnp_root_device_new(). The service description + files referenced in the device description are expected to be at the path + given there as well.

GUPnPRootDevice *dev;
 /* Create the root device object */
-dev = gupnp_root_device_new (context, "/BinaryLight1.xml");
+dev = gupnp_root_device_new (context, "BinaryLight1.xml", ".");
 /* Activate the root device, so that it announces itself */
 gupnp_root_device_set_available (dev, TRUE);

@@ -249,7 +245,7 @@ gupnp_root_device_set_available (dev, TRUE);

-Implementing a Service

+Implementing a Service

To implement a service we first fetch the #GUPnPService from the root device using gupnp_device_info_get_service() (#GUPnPRootDevice is a @@ -358,7 +354,7 @@ g_signal_connect (service, "query-variable::Status", G_CALLBACK (query_status_cb

-Generating Service-specific Wrappers

+Generating Service-specific Wrappers

Using service-specific wrappers can simplify the implementation of a service. Wrappers can be generated with gupnp-binding-tool(1) diff --git a/doc/server-tutorial.xml b/doc/server-tutorial.xml index 06f1501..8f03295 100644 --- a/doc/server-tutorial.xml +++ b/doc/server-tutorial.xml @@ -135,19 +135,15 @@ /* Create the GUPnP context with default host and port */ context = gupnp_context_new (NULL, NULL, 0, NULL); - UPnP uses HTTP to provide the device and service description files, so - next we tell GUPnP to publish them. This is done with - gupnp_context_host_path() which takes a local filename to send when a - certain server path is requested. - -gupnp_context_host_path (context, "BinaryLight1.xml", "/BinaryLight1.xml"); -gupnp_context_host_path (context, "SwitchPower1.xml", "/SwitchPower1.xml"); - - Next the root device can be created. + Next the root device can be created. The name of the device description + file can be passed as an absolute file path or a relative path to the + second parameter of gupnp_root_device_new(). The service description + files referenced in the device description are expected to be at the path + given there as well. GUPnPRootDevice *dev; /* Create the root device object */ -dev = gupnp_root_device_new (context, "/BinaryLight1.xml"); +dev = gupnp_root_device_new (context, "BinaryLight1.xml", "."); /* Activate the root device, so that it announces itself */ gupnp_root_device_set_available (dev, TRUE); diff --git a/doc/tmpl/gupnp-context-manager.sgml b/doc/tmpl/gupnp-context-manager.sgml deleted file mode 100644 index d04fe2d..0000000 --- a/doc/tmpl/gupnp-context-manager.sgml +++ /dev/null @@ -1,110 +0,0 @@ - -GUPnPContextManager - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@gupnpcontextmanager: the object which received the signal. -@arg1: - - - - - - -@gupnpcontextmanager: the object which received the signal. -@arg1: - - - - - - - - - - - - - - - - -@main_context: -@port: -@Returns: - - - - - - - -@port: -@Returns: - - - - - - - -@manager: - - - - - - - -@manager: -@control_point: - - - - - - - -@manager: -@root_device: - - - - - - - -@manager: -@Returns: - - diff --git a/doc/tmpl/gupnp-context.sgml b/doc/tmpl/gupnp-context.sgml deleted file mode 100644 index 8c04c5b..0000000 --- a/doc/tmpl/gupnp-context.sgml +++ /dev/null @@ -1,170 +0,0 @@ - -GUPnPContext - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@main_context: -@iface: -@port: -@error: -@Returns: - - - - - - - -@context: -@Returns: - - - - - - - -@context: -@Returns: - - - - - - - -@context: -@Returns: - - - - - - - -@context: -@Returns: - - - - - - - -@context: -@timeout: - - - - - - - -@context: -@Returns: - - - - - - - -@context: -@Returns: - - - - - - - -@context: -@language: - - - - - - - -@context: -@local_path: -@server_path: - - - - - - - -@context: -@local_path: -@server_path: -@user_agent: -@Returns: - - - - - - - -@context: -@server_path: - - diff --git a/doc/tmpl/gupnp-control-point.sgml b/doc/tmpl/gupnp-control-point.sgml deleted file mode 100644 index 6c86558..0000000 --- a/doc/tmpl/gupnp-control-point.sgml +++ /dev/null @@ -1,124 +0,0 @@ - -GUPnPControlPoint - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@gupnpcontrolpoint: the object which received the signal. -@arg1: - - - - - - -@gupnpcontrolpoint: the object which received the signal. -@arg1: - - - - - - -@gupnpcontrolpoint: the object which received the signal. -@arg1: - - - - - - -@gupnpcontrolpoint: the object which received the signal. -@arg1: - - - - - - - - - - - -@context: -@target: -@Returns: - - - - - - - -@context: -@factory: -@target: -@Returns: - - - - - - - -@control_point: -@Returns: - - - - - - - -@control_point: -@Returns: - - - - - - - -@control_point: -@Returns: - - - - - - - -@control_point: -@Returns: - - diff --git a/doc/tmpl/gupnp-device-info.sgml b/doc/tmpl/gupnp-device-info.sgml deleted file mode 100644 index a56eb24..0000000 --- a/doc/tmpl/gupnp-device-info.sgml +++ /dev/null @@ -1,307 +0,0 @@ - -GUPnPDeviceInfo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@device_info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@requested_mime_type: -@requested_depth: -@requested_width: -@requested_height: -@prefer_bigger: -@mime_type: -@depth: -@width: -@height: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@element: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@type: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@type: -@Returns: - - diff --git a/doc/tmpl/gupnp-device-proxy.sgml b/doc/tmpl/gupnp-device-proxy.sgml deleted file mode 100644 index 6f3eb38..0000000 --- a/doc/tmpl/gupnp-device-proxy.sgml +++ /dev/null @@ -1,30 +0,0 @@ - -GUPnPDeviceProxy - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/tmpl/gupnp-device.sgml b/doc/tmpl/gupnp-device.sgml deleted file mode 100644 index 6ba340b..0000000 --- a/doc/tmpl/gupnp-device.sgml +++ /dev/null @@ -1,35 +0,0 @@ - -GUPnPDevice - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/tmpl/gupnp-error.sgml b/doc/tmpl/gupnp-error.sgml deleted file mode 100644 index a79f7fa..0000000 --- a/doc/tmpl/gupnp-error.sgml +++ /dev/null @@ -1,94 +0,0 @@ - -Error codes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@GUPNP_SERVER_ERROR_INTERNAL_SERVER_ERROR: -@GUPNP_SERVER_ERROR_NOT_FOUND: -@GUPNP_SERVER_ERROR_NOT_IMPLEMENTED: -@GUPNP_SERVER_ERROR_INVALID_RESPONSE: -@GUPNP_SERVER_ERROR_INVALID_URL: -@GUPNP_SERVER_ERROR_OTHER: - - - - - - - - - - - - - -@GUPNP_EVENTING_ERROR_SUBSCRIPTION_FAILED: -@GUPNP_EVENTING_ERROR_SUBSCRIPTION_LOST: -@GUPNP_EVENTING_ERROR_NOTIFY_FAILED: - - - - - - - - - - - - - -@GUPNP_CONTROL_ERROR_INVALID_ACTION: -@GUPNP_CONTROL_ERROR_INVALID_ARGS: -@GUPNP_CONTROL_ERROR_OUT_OF_SYNC: -@GUPNP_CONTROL_ERROR_ACTION_FAILED: - - - - - - - - - - - - - -@GUPNP_XML_ERROR_PARSE: -@GUPNP_XML_ERROR_NO_NODE: -@GUPNP_XML_ERROR_EMPTY_NODE: -@GUPNP_XML_ERROR_INVALID_ATTRIBUTE: -@GUPNP_XML_ERROR_OTHER: - diff --git a/doc/tmpl/gupnp-resource-factory.sgml b/doc/tmpl/gupnp-resource-factory.sgml deleted file mode 100644 index 8f141bb..0000000 --- a/doc/tmpl/gupnp-resource-factory.sgml +++ /dev/null @@ -1,88 +0,0 @@ - -GUPnPResourceFactory - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@void: -@Returns: - - - - - - - -@void: -@Returns: - - - - - - - -@factory: -@upnp_type: -@type: - - - - - - - -@factory: -@upnp_type: -@Returns: - - - - - - - -@factory: -@upnp_type: -@type: - - - - - - - -@factory: -@upnp_type: -@Returns: - - diff --git a/doc/tmpl/gupnp-root-device.sgml b/doc/tmpl/gupnp-root-device.sgml deleted file mode 100644 index 4e7894a..0000000 --- a/doc/tmpl/gupnp-root-device.sgml +++ /dev/null @@ -1,128 +0,0 @@ - -GUPnPRootDevice - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@context: -@description_path: -@description_dir: -@Returns: - - - - - - - -@context: -@factory: -@description_doc: -@description_path: -@description_dir: -@Returns: - - - - - - - -@root_device: -@available: - - - - - - - -@root_device: -@Returns: - - - - - - - -@root_device: -@Returns: - - - - - - - -@root_device: -@Returns: - - - - - - - -@root_device: -@Returns: - - - - - - - -@root_device: -@Returns: - - diff --git a/doc/tmpl/gupnp-service-info.sgml b/doc/tmpl/gupnp-service-info.sgml deleted file mode 100644 index 1f8db51..0000000 --- a/doc/tmpl/gupnp-service-info.sgml +++ /dev/null @@ -1,177 +0,0 @@ - -GUPnPServiceInfo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@info: -@introspection: -@error: -@user_data: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@Returns: - - - - - - - -@info: -@error: -@Returns: - - - - - - - -@info: -@callback: -@user_data: - - diff --git a/doc/tmpl/gupnp-service-introspection.sgml b/doc/tmpl/gupnp-service-introspection.sgml deleted file mode 100644 index b623e90..0000000 --- a/doc/tmpl/gupnp-service-introspection.sgml +++ /dev/null @@ -1,132 +0,0 @@ - -GUPnPServiceIntrospection - - - - - - - - - - - - - - - - - - - - - - - - - - - -@GUPNP_SERVICE_ACTION_ARG_DIRECTION_IN: -@GUPNP_SERVICE_ACTION_ARG_DIRECTION_OUT: - - - - - - -@name: -@direction: -@related_state_variable: -@retval: - - - - - - -@name: -@arguments: - - - - - - -@name: -@send_events: -@is_numeric: -@type: -@default_value: -@minimum: -@maximum: -@step: -@allowed_values: - - - - - - - - - - - - - - - - - -@introspection: -@Returns: - - - - - - - -@introspection: -@Returns: - - - - - - - -@introspection: -@action_name: -@Returns: - - - - - - - -@introspection: -@Returns: - - - - - - - -@introspection: -@Returns: - - - - - - - -@introspection: -@variable_name: -@Returns: - - diff --git a/doc/tmpl/gupnp-service-proxy.sgml b/doc/tmpl/gupnp-service-proxy.sgml deleted file mode 100644 index 97396bf..0000000 --- a/doc/tmpl/gupnp-service-proxy.sgml +++ /dev/null @@ -1,278 +0,0 @@ - -GUPnPServiceProxy - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@gupnpserviceproxy: the object which received the signal. -@arg1: - - - - - - - - - - - - - - - - - -@proxy: -@action: -@user_data: - - - - - - - -@proxy: -@variable: -@value: -@user_data: - - - - - - - -@proxy: -@action: -@error: -@...: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@var_args: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@in_hash: -@out_hash: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@in_names: -@in_values: -@out_names: -@out_types: -@out_values: -@Returns: - - - - - - - -@proxy: -@action: -@callback: -@user_data: -@...: -@Returns: - - - - - - - -@proxy: -@action: -@callback: -@user_data: -@var_args: -@Returns: - - - - - - - -@proxy: -@action: -@callback: -@user_data: -@hash: -@Returns: - - - - - - - -@proxy: -@action: -@in_names: -@in_values: -@callback: -@user_data: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@...: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@var_args: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@hash: -@Returns: - - - - - - - -@proxy: -@action: -@error: -@out_names: -@out_types: -@out_values: -@Returns: - - - - - - - -@proxy: -@action: - - - - - - - -@proxy: -@variable: -@type: -@callback: -@user_data: -@Returns: - - - - - - - -@proxy: -@variable: -@callback: -@user_data: -@Returns: - - - - - - - -@proxy: -@subscribed: - - - - - - - -@proxy: -@Returns: - - diff --git a/doc/tmpl/gupnp-service.sgml b/doc/tmpl/gupnp-service.sgml deleted file mode 100644 index a9a1afe..0000000 --- a/doc/tmpl/gupnp-service.sgml +++ /dev/null @@ -1,263 +0,0 @@ - -GUPnPService - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@gupnpservice: the object which received the signal. -@arg1: - - - - - - -@gupnpservice: the object which received the signal. -@arg1: -@arg2: - - - - - - -@gupnpservice: the object which received the signal. -@arg1: -@arg2: - - - - - - - - - - - - - - - - - -@action: -@Returns: - - - - - - - -@action: -@Returns: - - - - - - - -@action: -@...: - - - - - - - -@action: -@var_args: - - - - - - - -@action: -@argument: -@value: - - - - - - - -@action: -@argument: -@type: -@Returns: - - - - - - - -@action: -@arg_names: -@arg_types: -@Returns: - - - - - - - -@action: -@...: - - - - - - - -@action: -@var_args: - - - - - - - -@action: -@argument: -@value: - - - - - - - -@action: -@arg_names: -@arg_values: - - - - - - - -@action: - - - - - - - -@action: -@error_code: -@error_description: - - - - - - - -@action: -@Returns: - - - - - - - -@action: -@Returns: - - - - - - - -@service: -@...: - - - - - - - -@service: -@var_args: - - - - - - - -@service: -@variable: -@value: - - - - - - - -@service: - - - - - - - -@service: - - - - - - - -@service: -@user_data: -@error: - - diff --git a/doc/tmpl/gupnp-types.sgml b/doc/tmpl/gupnp-types.sgml deleted file mode 100644 index 7117368..0000000 --- a/doc/tmpl/gupnp-types.sgml +++ /dev/null @@ -1,87 +0,0 @@ - -Special UPnP types - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/doc/tmpl/gupnp-unused.sgml b/doc/tmpl/gupnp-unused.sgml deleted file mode 100644 index e69de29..0000000 diff --git a/doc/tmpl/gupnp-xml-doc.sgml b/doc/tmpl/gupnp-xml-doc.sgml deleted file mode 100644 index 6947f27..0000000 --- a/doc/tmpl/gupnp-xml-doc.sgml +++ /dev/null @@ -1,50 +0,0 @@ - -GUPnPXMLDoc - - - - - - - - - - - - - - - - - - - - - - - - - - - -@doc: - - - - - - -@xml_doc: -@Returns: - - - - - - - -@path: -@error: -@Returns: - - diff --git a/examples/Makefile.in b/examples/Makefile.in index 87550b9..a397ab9 100644 --- a/examples/Makefile.in +++ b/examples/Makefile.in @@ -159,8 +159,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ diff --git a/gtk-doc.make b/gtk-doc.make index 1f75dfd..9841de4 100644 --- a/gtk-doc.make +++ b/gtk-doc.make @@ -33,9 +33,9 @@ EXTRA_DIST = \ $(HTML_IMAGES) \ $(SETUP_FILES) -DOC_STAMPS=setup-build.stamp scan-build.stamp tmpl-build.stamp sgml-build.stamp \ +DOC_STAMPS=setup-build.stamp scan-build.stamp sgml-build.stamp \ html-build.stamp pdf-build.stamp \ - tmpl.stamp sgml.stamp html.stamp pdf.stamp + sgml.stamp html.stamp pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ @@ -84,12 +84,10 @@ setup-build.stamp: cp -pu $(abs_srcdir)/$$file $(abs_builddir)/ || true; \ done; \ fi; \ - test -d $(abs_srcdir)/tmpl && \ - { cp -rp $(abs_srcdir)/tmpl $(abs_builddir)/; \ - chmod -R u+w $(abs_builddir)/tmpl; } \ fi @touch setup-build.stamp + #### scan #### scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @@ -120,29 +118,10 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true -#### templates #### - -tmpl-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo ' DOC Rebuilding template files' - @gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) - @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ - if test -w $(abs_srcdir) ; then \ - cp -rp $(abs_builddir)/tmpl $(abs_srcdir)/; \ - fi \ - fi - @touch tmpl-build.stamp - -tmpl.stamp: tmpl-build.stamp - @true - -$(srcdir)/tmpl/*.sgml: - @true - #### xml #### -sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) +sgml-build.stamp: setup-build.stamp $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) @echo ' DOC Building XML' - @-chmod -R u+w $(srcdir) @_source_dir='' ; \ for i in $(DOC_SOURCE_DIR) ; do \ _source_dir="$${_source_dir} --source-dir=$$i" ; \ @@ -219,7 +198,6 @@ distclean-local: $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt @if test "$(abs_srcdir)" != "$(abs_builddir)" ; then \ rm -f $(SETUP_FILES) $(expand_content_files) $(DOC_MODULE).types; \ - rm -rf tmpl; \ fi maintainer-clean-local: clean @@ -267,9 +245,7 @@ dist-check-gtkdoc: endif dist-hook: dist-check-gtkdoc dist-hook-local - @mkdir $(distdir)/tmpl @mkdir $(distdir)/html - @-cp ./tmpl/*.sgml $(distdir)/tmpl @cp ./html/* $(distdir)/html @-cp ./$(DOC_MODULE).pdf $(distdir)/ @-cp ./$(DOC_MODULE).types $(distdir)/ diff --git a/libgupnp/Makefile.am b/libgupnp/Makefile.am index 2843d68..6d30acb 100644 --- a/libgupnp/Makefile.am +++ b/libgupnp/Makefile.am @@ -58,6 +58,7 @@ libgupnpinc_HEADERS = gupnp-context.h \ gupnp-service-proxy.h \ gupnp-service-introspection.h \ gupnp-xml-doc.h \ + gupnp-white-list.h \ gupnp-types.h \ gupnp.h @@ -76,6 +77,7 @@ introspection_sources = $(libgupnpinc_HEADERS) \ gupnp-service-proxy.c \ gupnp-service-introspection.c \ gupnp-xml-doc.c \ + gupnp-white-list.c \ gupnp-types.c diff --git a/libgupnp/Makefile.in b/libgupnp/Makefile.in index 77c26ef..594ae20 100644 --- a/libgupnp/Makefile.in +++ b/libgupnp/Makefile.in @@ -118,13 +118,14 @@ am__libgupnp_1_0_la_SOURCES_DIST = gupnp-context.h \ gupnp-device-info.h gupnp-device-proxy.h gupnp-error.h \ gupnp-resource-factory.h gupnp-root-device.h gupnp-service.h \ gupnp-service-info.h gupnp-service-proxy.h \ - gupnp-service-introspection.h gupnp-xml-doc.h gupnp-types.h \ - gupnp.h gupnp-context.c gupnp-context-manager.c \ - gupnp-control-point.c gupnp-device.c gupnp-device-info.c \ - gupnp-device-proxy.c gupnp-error.c gupnp-resource-factory.c \ - gupnp-root-device.c gupnp-service.c gupnp-service-info.c \ - gupnp-service-proxy.c gupnp-service-introspection.c \ - gupnp-xml-doc.c gupnp-types.c http-headers.c http-headers.h \ + gupnp-service-introspection.h gupnp-xml-doc.h \ + gupnp-white-list.h gupnp-types.h gupnp.h gupnp-context.c \ + gupnp-context-manager.c gupnp-control-point.c gupnp-device.c \ + gupnp-device-info.c gupnp-device-proxy.c gupnp-error.c \ + gupnp-resource-factory.c gupnp-root-device.c gupnp-service.c \ + gupnp-service-info.c gupnp-service-proxy.c \ + gupnp-service-introspection.c gupnp-xml-doc.c \ + gupnp-white-list.c gupnp-types.c http-headers.c http-headers.h \ gupnp-context-private.h gupnp-unix-context-manager.c \ gupnp-unix-context-manager.h gupnp-network-manager.c \ gupnp-network-manager.h gupnp-connman-manager.c \ @@ -142,7 +143,8 @@ am__objects_2 = $(am__objects_1) gupnp-context.lo \ gupnp-device.lo gupnp-device-info.lo gupnp-device-proxy.lo \ gupnp-error.lo gupnp-resource-factory.lo gupnp-root-device.lo \ gupnp-service.lo gupnp-service-info.lo gupnp-service-proxy.lo \ - gupnp-service-introspection.lo gupnp-xml-doc.lo gupnp-types.lo + gupnp-service-introspection.lo gupnp-xml-doc.lo \ + gupnp-white-list.lo gupnp-types.lo @OS_WIN32_FALSE@@USE_NETWORK_MANAGER_TRUE@am__objects_3 = gupnp-network-manager.lo @OS_WIN32_FALSE@@USE_CONNMAN_TRUE@@USE_NETWORK_MANAGER_FALSE@am__objects_4 = gupnp-connman-manager.lo @HAVE_NETLINK_TRUE@am__objects_5 = gupnp-linux-context-manager.lo @@ -240,8 +242,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ @@ -388,6 +388,7 @@ libgupnpinc_HEADERS = gupnp-context.h \ gupnp-service-proxy.h \ gupnp-service-introspection.h \ gupnp-xml-doc.h \ + gupnp-white-list.h \ gupnp-types.h \ gupnp.h @@ -406,6 +407,7 @@ introspection_sources = $(libgupnpinc_HEADERS) \ gupnp-service-proxy.c \ gupnp-service-introspection.c \ gupnp-xml-doc.c \ + gupnp-white-list.c \ gupnp-types.c BUILT_SOURCES = gupnp-marshal.c gupnp-marshal.h @@ -559,6 +561,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-simple-context-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-types.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-unix-context-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-white-list.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-windows-context-manager.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gupnp-xml-doc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gvalue-util.Plo@am__quote@ diff --git a/libgupnp/gupnp-context-manager.c b/libgupnp/gupnp-context-manager.c index 4bf3cee..21ce53b 100644 --- a/libgupnp/gupnp-context-manager.c +++ b/libgupnp/gupnp-context-manager.c @@ -1,9 +1,11 @@ /* * Copyright (C) 2009 Nokia Corporation. * Copyright (C) 2006, 2007, 2008 OpenedHand Ltd. + * Copyright (C) 2013 Intel Corporation. * * Author: Zeeshan Ali (Khattak) * Jorn Baayen + * Ludovic Ferrandis * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public @@ -55,12 +57,16 @@ struct _GUPnPContextManagerPrivate { GUPnPContextManager *impl; GList *objects; /* control points and root devices */ + GList *blacklisted; /* Blacklisted Context */ + + GUPnPWhiteList *white_list; }; enum { PROP_0, PROP_MAIN_CONTEXT, PROP_PORT, + PROP_WHITE_LIST }; enum { @@ -72,11 +78,40 @@ enum { static guint signals[SIGNAL_LAST]; static void +on_context_available (GUPnPContextManager *manager, + GUPnPContext *context, + G_GNUC_UNUSED gpointer *user_data) +{ + GUPnPWhiteList *white_list; + + white_list = manager->priv->white_list; + + /* Try to catch the notification, only if the white list + * is enabled, not empty and the context doesn't match */ + if (!gupnp_white_list_is_empty (white_list) && + gupnp_white_list_get_enabled (white_list) && + !gupnp_white_list_check_context (white_list, context)) { + /* If the conext doesn't match, block the notification + * and disable the context */ + g_signal_stop_emission_by_name (manager, "context-available"); + + /* Make sure we don't send anything on now blocked network */ + g_object_set (context, "active", FALSE, NULL); + + /* Save it in case we need to re-enable it */ + manager->priv->blacklisted = g_list_prepend ( + manager->priv->blacklisted, + g_object_ref (context)); + } +} + +static void on_context_unavailable (GUPnPContextManager *manager, GUPnPContext *context, G_GNUC_UNUSED gpointer *user_data) { GList *l; + GList *black; /* Make sure we don't send anything on now unavailable network */ g_object_set (context, "active", FALSE, NULL); @@ -113,6 +148,119 @@ on_context_unavailable (GUPnPContextManager *manager, l = l->next; } } + + black = g_list_find (manager->priv->blacklisted, context); + + if (black != NULL) { + g_signal_stop_emission_by_name (manager, "context-unavailable"); + + g_object_unref (black->data); + manager->priv->blacklisted = + g_list_delete_link (manager->priv->blacklisted, black); + } +} + +static void +gupnp_context_manager_filter_context (GUPnPWhiteList *white_list, + GUPnPContextManager *manager, + gboolean check) +{ + GList *next; + GList *obj; + GList *blk; + gboolean match; + GUPnPContext *context; + GSSDPResourceBrowser *browser; + + obj = manager->priv->objects; + blk = manager->priv->blacklisted; + + while (obj != NULL) { + if (!GUPNP_IS_CONTROL_POINT (obj->data)) + continue; + + /* If the white list is empty, treat it as disabled */ + if (check) { + /* Filter out context */ + context = gupnp_control_point_get_context (obj->data); + match = gupnp_white_list_check_context (white_list, + context); + } else { + /* Re-activate all context, if needed */ + match = TRUE; + } + + browser = GSSDP_RESOURCE_BROWSER (obj->data); + gssdp_resource_browser_set_active (browser, match); + + if (match) + (void) gssdp_resource_browser_rescan (browser); + + obj = obj->next; + } + + while (blk != NULL) { + /* If the white list is empty, treat it as disabled */ + if (check) + /* Filter out context */ + match = gupnp_white_list_check_context (white_list, + blk->data); + else + /* Re-activate all context, if needed */ + match = TRUE; + + if (!match) { + blk = blk->next; + continue; + } + + next = blk->next; + g_object_set (blk->data, "active", TRUE, NULL); + + g_signal_emit_by_name (manager, "context-available", blk->data); + + g_object_unref (blk->data); + manager->priv->blacklisted = g_list_delete_link ( + manager->priv->blacklisted, + blk); + blk = next; + } +} + +static void +on_white_list_change_cb (GUPnPWhiteList *white_list, + GParamSpec *pspec, + gpointer user_data) +{ + GUPnPContextManager *manager = GUPNP_CONTEXT_MANAGER (user_data); + gboolean enabled; + gboolean is_empty; + + enabled = gupnp_white_list_get_enabled (white_list); + is_empty = gupnp_white_list_is_empty (white_list); + + if (enabled) + gupnp_context_manager_filter_context (white_list, + manager, + !is_empty); +} + +static void +on_white_list_enabled_cb (GUPnPWhiteList *white_list, + GParamSpec *pspec, + gpointer user_data) +{ + GUPnPContextManager *manager = GUPNP_CONTEXT_MANAGER (user_data); + gboolean enabled; + gboolean is_empty; + + enabled = gupnp_white_list_get_enabled (white_list); + is_empty = gupnp_white_list_is_empty (white_list); + + if (!is_empty) + gupnp_context_manager_filter_context (white_list, + manager, + enabled); } static void @@ -122,6 +270,14 @@ gupnp_context_manager_init (GUPnPContextManager *manager) G_TYPE_INSTANCE_GET_PRIVATE (manager, GUPNP_TYPE_CONTEXT_MANAGER, GUPnPContextManagerPrivate); + + manager->priv->white_list = gupnp_white_list_new (); + + g_signal_connect_after (manager->priv->white_list, "notify::entries", + G_CALLBACK (on_white_list_change_cb), manager); + + g_signal_connect_after (manager->priv->white_list, "notify::enabled", + G_CALLBACK (on_white_list_enabled_cb), manager); } static void @@ -174,6 +330,9 @@ gupnp_context_manager_get_property (GObject *object, g_value_set_pointer (value, g_main_context_get_thread_default ()); break; + case PROP_WHITE_LIST: + g_value_set_object (value, manager->priv->white_list); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -184,13 +343,29 @@ static void gupnp_context_manager_dispose (GObject *object) { GUPnPContextManager *manager; + GUPnPWhiteList *wl; GObjectClass *object_class; manager = GUPNP_CONTEXT_MANAGER (object); + wl = manager->priv->white_list; + + g_signal_handlers_disconnect_by_func (wl, + on_white_list_enabled_cb, + manager); - g_list_foreach (manager->priv->objects, (GFunc) g_object_unref, NULL); - g_list_free (manager->priv->objects); + g_signal_handlers_disconnect_by_func (wl, + on_white_list_change_cb, + NULL); + + g_list_free_full (manager->priv->objects, g_object_unref); manager->priv->objects = NULL; + g_list_free_full (manager->priv->blacklisted, g_object_unref); + manager->priv->blacklisted = NULL; + + if (wl) { + g_object_unref (wl); + manager->priv->white_list = NULL; + } /* Call super */ object_class = G_OBJECT_CLASS (gupnp_context_manager_parent_class); @@ -250,7 +425,24 @@ gupnp_context_manager_class_init (GUPnPContextManagerClass *klass) G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB)); - /** + /** + * GUPnPContextManager:white-list: + * + * The white list to use. + **/ + g_object_class_install_property + (object_class, + PROP_WHITE_LIST, + g_param_spec_object ("white-list", + "White List", + "The white list to use", + GUPNP_TYPE_WHITE_LIST, + G_PARAM_READABLE | + G_PARAM_STATIC_NAME | + G_PARAM_STATIC_NICK | + G_PARAM_STATIC_BLURB)); + + /** * GUPnPContextManager::context-available: * @context_manager: The #GUPnPContextManager that received the signal * @context: The now available #GUPnPContext @@ -259,15 +451,15 @@ gupnp_context_manager_class_init (GUPnPContextManagerClass *klass) * **/ signals[CONTEXT_AVAILABLE] = - g_signal_new ("context-available", - GUPNP_TYPE_CONTEXT_MANAGER, - G_SIGNAL_RUN_LAST, - 0, - NULL, NULL, - g_cclosure_marshal_VOID__OBJECT, - G_TYPE_NONE, - 1, - GUPNP_TYPE_CONTEXT); + g_signal_new_class_handler ("context-available", + GUPNP_TYPE_CONTEXT_MANAGER, + G_SIGNAL_RUN_FIRST, + G_CALLBACK (on_context_available), + NULL, NULL, + g_cclosure_marshal_VOID__OBJECT, + G_TYPE_NONE, + 1, + GUPNP_TYPE_CONTEXT); /** * GUPnPContextManager::context-unavailable: @@ -467,3 +659,20 @@ gupnp_context_manager_get_port (GUPnPContextManager *manager) return manager->priv->port; } + +/** + * gupnp_context_manager_get_white_list: + * @manager: A #GUPnPContextManager + * + * Get the #GUPnPWhiteList associated with @manager. + * + * Returns: (transfer none): The #GUPnPWhiteList asssociated with this + * context manager. + */ +GUPnPWhiteList * +gupnp_context_manager_get_white_list (GUPnPContextManager *manager) +{ + g_return_val_if_fail (GUPNP_IS_CONTEXT_MANAGER (manager), NULL); + + return manager->priv->white_list; +} diff --git a/libgupnp/gupnp-context-manager.h b/libgupnp/gupnp-context-manager.h index 1e04b4c..6124ea9 100644 --- a/libgupnp/gupnp-context-manager.h +++ b/libgupnp/gupnp-context-manager.h @@ -26,6 +26,7 @@ #include #include "gupnp.h" +#include "gupnp-white-list.h" G_BEGIN_DECLS @@ -105,6 +106,10 @@ gupnp_context_manager_manage_root_device guint gupnp_context_manager_get_port (GUPnPContextManager *manager); + +GUPnPWhiteList * +gupnp_context_manager_get_white_list (GUPnPContextManager *manager); + G_END_DECLS #endif /* __GUPNP_CONTEXT_MANAGER_H__ */ diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c index d9a36b0..81c030c 100644 --- a/libgupnp/gupnp-context.c +++ b/libgupnp/gupnp-context.c @@ -30,7 +30,7 @@ * GUPnP classes. It automatically starts a web server on demand. * * For debugging, it is possible to see the messages being sent and received by - * exporting %GUPNP_DEBUG. + * exporting GUPNP_DEBUG. */ #include @@ -183,7 +183,7 @@ gupnp_context_initable_init (GInitable *initable, NULL); user_agent = g_strdup_printf ("%s GUPnP/" VERSION " DLNADOC/1.50", - g_get_application_name ()? : ""); + g_get_prgname ()? : ""); g_object_set (context->priv->session, SOUP_SESSION_USER_AGENT, user_agent, @@ -684,7 +684,7 @@ host_path_data_set_language (HostPathData *data, const char *language) /** * gupnp_context_set_default_language: * @context: A #GUPnPContext - * @language A language tag as defined in RFC 2616 3.10 + * @language: A language tag as defined in RFC 2616 3.10 * * Set the default language for the Content-Length header to @language. * diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c index b18f3ec..9ef38fd 100644 --- a/libgupnp/gupnp-device-info.c +++ b/libgupnp/gupnp-device-info.c @@ -85,7 +85,7 @@ gupnp_device_info_set_property (GObject *object, switch (property_id) { case PROP_RESOURCE_FACTORY: - info->priv->factory = + info->priv->factory = GUPNP_RESOURCE_FACTORY (g_value_dup_object (value)); break; case PROP_CONTEXT: @@ -474,7 +474,7 @@ gupnp_device_info_get_device_type (GUPnPDeviceInfo *info) * @info: A #GUPnPDeviceInfo * * Get the friendly name of the device. - * + * * Return value: A string, or %NULL. g_free() after use. **/ char * @@ -577,7 +577,7 @@ gupnp_device_info_get_model_number (GUPnPDeviceInfo *info) * @info: A #GUPnPDeviceInfo * * Get a URL pointing to the device model's website. - * + * * Return value: A string, or %NULL. g_free() after use. **/ char * @@ -595,7 +595,7 @@ gupnp_device_info_get_model_url (GUPnPDeviceInfo *info) * @info: A #GUPnPDeviceInfo * * Get the serial number of the device. - * + * * Return value: A string, or %NULL. g_free() after use. **/ char * @@ -630,7 +630,7 @@ gupnp_device_info_get_upc (GUPnPDeviceInfo *info) * * Get a URL pointing to the device's presentation page, for web-based * administration. - * + * * Return value: A string, or %NULL. g_free() after use. **/ char * @@ -751,9 +751,12 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info, icon = icon_parse (info, element); if (requested_mime_type) { - mime_type_ok = - !strcmp (requested_mime_type, - (char *) icon->mime_type); + if (icon->mime_type) + mime_type_ok = !strcmp ( + requested_mime_type, + (char *) icon->mime_type); + else + mime_type_ok = FALSE; } else mime_type_ok = TRUE; @@ -869,7 +872,7 @@ gupnp_device_info_get_icon_url (GUPnPDeviceInfo *info, return ret; } -/* Returns TRUE if @query matches against @base. +/* Returns TRUE if @query matches against @base. * - If @query does not specify a version, it matches any version specified * in @base. * - If @query specifies a version, it matches any version specified in @base @@ -926,10 +929,43 @@ resource_type_match (const char *query, } /** + * gupnp_device_info_list_dlna_device_class_identifier: + * @info: A #GUPnPDeviceInfo + * + * Get a #GList of strings that represent the device class and version as + * announced in the device description file using the <dlna:X_DLNADOC> + * element. + * Returns: (transfer full) (element-type utf8): a #GList of newly allocated strings or + * %NULL if the device description doesn't contain the <dlna:X_DLNADOC> + * element. + **/ +GList * +gupnp_device_info_list_dlna_device_class_identifier (GUPnPDeviceInfo *info) +{ + xmlNode *element; + GList *list = NULL; + + g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL); + + element = info->priv->element; + + for (element = element->children; element; element = element->next) { + /* No early exit since the node explicitly may appear multiple + * times: 7.2.10.3 */ + if (!strcmp ("X_DLNADOC", (char *) element->name)) + list = g_list_prepend (list, + xmlNodeGetContent(element)); + } + + /* Return in order of appearance in document */ + return g_list_reverse (list); +} + +/** * gupnp_device_info_list_dlna_capabilities: * @info: A #GUPnPDeviceInfo * - * Get a #GList of strings that represent the device capabilities as announced + * Get a #GList of strings that represent the device capabilities as announced * in the device description file using the <dlna:X_DLNACAP> element. * * Returns: (transfer full) (element-type utf8): a #GList of newly allocated strings or @@ -1116,6 +1152,7 @@ gupnp_device_info_get_device (GUPnPDeviceInfo *info, xmlNode *element; g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL); + g_return_val_if_fail (type != NULL, NULL); class = GUPNP_DEVICE_INFO_GET_CLASS (info); @@ -1270,6 +1307,7 @@ gupnp_device_info_get_service (GUPnPDeviceInfo *info, xmlNode *element; g_return_val_if_fail (GUPNP_IS_DEVICE_INFO (info), NULL); + g_return_val_if_fail (type != NULL, NULL); class = GUPNP_DEVICE_INFO_GET_CLASS (info); diff --git a/libgupnp/gupnp-device-info.h b/libgupnp/gupnp-device-info.h index 3a14238..0a65184 100644 --- a/libgupnp/gupnp-device-info.h +++ b/libgupnp/gupnp-device-info.h @@ -152,6 +152,9 @@ char * gupnp_device_info_get_presentation_url (GUPnPDeviceInfo *info); GList * +gupnp_device_info_list_dlna_device_class_identifier (GUPnPDeviceInfo *info); + +GList * gupnp_device_info_list_dlna_capabilities (GUPnPDeviceInfo *info); char * diff --git a/libgupnp/gupnp-error.h b/libgupnp/gupnp-error.h index 90afcc7..a850857 100644 --- a/libgupnp/gupnp-error.h +++ b/libgupnp/gupnp-error.h @@ -104,6 +104,7 @@ gupnp_xml_error_quark (void) G_GNUC_CONST; * @GUPNP_XML_ERROR_PARSE: Generic XML parsing error. * @GUPNP_XML_ERROR_NO_NODE: A required XML node was not found. * @GUPNP_XML_ERROR_EMPTY_NODE: An XML node is unexpectedly empty. + * @GUPNP_XML_ERROR_INVALID_ATTRIBUTE: An XML node has an unknown attribute. * @GUPNP_XML_ERROR_OTHER: Unknown/unhandled XML related errors. * * #GError codes used for errors in the #GUPNP_XML_ERROR domain, during diff --git a/libgupnp/gupnp-network-manager.c b/libgupnp/gupnp-network-manager.c index 4ad6849..3b4e424 100644 --- a/libgupnp/gupnp-network-manager.c +++ b/libgupnp/gupnp-network-manager.c @@ -97,6 +97,8 @@ typedef enum typedef struct { + gint ref_count; + GUPnPNetworkManager *manager; GUPnPContext *context; @@ -126,15 +128,27 @@ nm_device_new (GUPnPNetworkManager *manager, nm_device = g_slice_new0 (NMDevice); - nm_device->manager = manager; - nm_device->proxy = device_proxy; + g_atomic_int_set (&nm_device->ref_count, 1); + nm_device->manager = g_object_ref (manager); + nm_device->proxy = g_object_ref (device_proxy); + + return nm_device; +} + +static NMDevice * +nm_device_ref (NMDevice *nm_device) +{ + g_atomic_int_inc (&nm_device->ref_count); return nm_device; } static void -nm_device_free (NMDevice *nm_device) +nm_device_unref (NMDevice *nm_device) { + if (!g_atomic_int_dec_and_test (&nm_device->ref_count)) + return; + g_object_unref (nm_device->proxy); if (nm_device->wifi_proxy != NULL) g_object_unref (nm_device->wifi_proxy); @@ -149,6 +163,8 @@ nm_device_free (NMDevice *nm_device) g_object_unref (nm_device->context); } + g_object_unref (nm_device->proxy); + g_object_unref (nm_device->manager); g_slice_free (NMDevice, nm_device); } @@ -254,7 +270,8 @@ create_context_for_device (NMDevice *nm_device) static void ap_proxy_new_cb (GObject *source_object, GAsyncResult *res, - gpointer user_data) { + gpointer user_data) +{ NMDevice *nm_device; GError *error; @@ -265,9 +282,13 @@ ap_proxy_new_cb (GObject *source_object, if (G_UNLIKELY (error != NULL)) { g_message ("Failed to create D-Bus proxy: %s", error->message); g_error_free (error); + goto done; } create_context_for_device (nm_device); + +done: + nm_device_unref (nm_device); } static void @@ -300,7 +321,7 @@ on_wifi_device_activated (NMDevice *nm_device) AP_INTERFACE, nm_device->manager->priv->cancellable, ap_proxy_new_cb, - nm_device); + nm_device_ref (nm_device)); } g_variant_unref (value); @@ -397,9 +418,13 @@ wifi_proxy_new_cb (GObject *source_object, if (G_UNLIKELY (error != NULL)) { g_message ("Failed to create D-Bus proxy: %s", error->message); g_error_free (error); + goto done; } use_new_device (nm_device->manager, nm_device); + +done: + nm_device_unref (nm_device); } static void @@ -421,21 +446,21 @@ device_proxy_new_cb (GObject *source_object, g_message ("Failed to create D-Bus proxy: %s", error->message); g_error_free (error); - return; + goto done; } value = g_dbus_proxy_get_cached_property (device_proxy, "DeviceType"); if (G_UNLIKELY (value == NULL)) { g_object_unref (device_proxy); - return; + goto done; } if (G_UNLIKELY (!g_variant_is_of_type (value, G_VARIANT_TYPE_UINT32))) { g_variant_unref (value); g_object_unref (device_proxy); - return; + goto done; } type = g_variant_get_uint32 (value); @@ -455,9 +480,12 @@ device_proxy_new_cb (GObject *source_object, WIFI_INTERFACE, manager->priv->cancellable, wifi_proxy_new_cb, - nm_device); + nm_device_ref (nm_device)); } else use_new_device (manager, nm_device); + +done: + g_object_unref (manager); } static int @@ -499,7 +527,7 @@ on_manager_signal (GDBusProxy *proxy, DEVICE_INTERFACE, manager->priv->cancellable, device_proxy_new_cb, - manager); + g_object_ref (manager)); g_free (device_path); } else if (g_strcmp0 (signal_name, "DeviceRemoved") == 0) { GList *device_node; @@ -526,7 +554,7 @@ on_manager_signal (GDBusProxy *proxy, nm_device = (NMDevice *) device_node->data; priv->nm_devices = g_list_remove (priv->nm_devices, nm_device); - nm_device_free (nm_device); + nm_device_unref (nm_device); g_free (device_path); } } @@ -552,8 +580,7 @@ get_devices_cb (GObject *source_object, error->message); g_error_free (error); - - return; + goto done; } g_variant_get_child (ret, 0, "ao", &device_iter); @@ -566,10 +593,13 @@ get_devices_cb (GObject *source_object, DEVICE_INTERFACE, manager->priv->cancellable, device_proxy_new_cb, - user_data); + g_object_ref (user_data)); g_variant_iter_free (device_iter); g_variant_unref (ret); + +done: + g_object_unref (manager); } static void @@ -583,8 +613,8 @@ schedule_loopback_context_creation (GUPnPNetworkManager *manager) g_main_context_get_thread_default ()); g_source_set_callback (manager->priv->idle_context_creation_src, create_loopback_context, - manager, - NULL); + g_object_ref (manager), + (GDestroyNotify) g_object_unref); g_source_unref (manager->priv->idle_context_creation_src); } @@ -627,7 +657,7 @@ init_network_manager (GUPnPNetworkManager *manager) -1, priv->cancellable, get_devices_cb, - manager); + g_object_ref (manager)); } static void @@ -685,7 +715,8 @@ gupnp_network_manager_dispose (GObject *object) } if (priv->nm_devices != NULL) { - g_list_foreach (priv->nm_devices, (GFunc) nm_device_free, NULL); + g_list_foreach (priv->nm_devices, (GFunc) nm_device_unref, + NULL); g_list_free (priv->nm_devices); priv->nm_devices = NULL; } diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c index fdf642e..10da9ac 100644 --- a/libgupnp/gupnp-service-proxy.c +++ b/libgupnp/gupnp-service-proxy.c @@ -281,14 +281,14 @@ gupnp_service_proxy_dispose (GObject *object) g_source_destroy (proxy->priv->notify_idle_src); proxy->priv->notify_idle_src = NULL; } - + while (proxy->priv->pending_notifies) { emit_notify_data_free (proxy->priv->pending_notifies->data); proxy->priv->pending_notifies = g_list_delete_link (proxy->priv->pending_notifies, proxy->priv->pending_notifies); } - + /* Call super */ object_class = G_OBJECT_CLASS (gupnp_service_proxy_parent_class); object_class->dispose (object); @@ -371,7 +371,7 @@ gupnp_service_proxy_class_init (GUPnPServiceProxyClass *klass) * @proxy: A #GUPnPServiceProxy * @action: An action * @error: The location where to store any error, or %NULL - * @Varargs: tuples of in parameter name, in parameter type, and in parameter + * @...: tuples of in parameter name, in parameter type, and in parameter * value, followed by %NULL, and then tuples of out parameter name, * out parameter type, and out parameter value location, terminated with %NULL * @@ -588,8 +588,9 @@ gupnp_service_proxy_send_action_valist (GUPnPServiceProxy *proxy, main_loop); if (!handle) { g_main_loop_unref (main_loop); + result = FALSE; - return FALSE; + goto out; } /* Loop till we get a reply (or time out) */ @@ -608,6 +609,7 @@ gupnp_service_proxy_send_action_valist (GUPnPServiceProxy *proxy, } else { g_propagate_error (error, local_error); } +out: va_end (var_args_copy); g_list_free_full (in_names, g_free); g_list_free_full (in_values, value_free); @@ -749,7 +751,7 @@ gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy, * @callback: (scope async): The callback to call when sending the action has succeeded * or failed * @user_data: User data for @callback - * @Varargs: tuples of in parameter name, in parameter type, and in parameter + * @...: tuples of in parameter name, in parameter type, and in parameter * value, terminated with %NULL * * Sends action @action with parameters @Varargs to the service exposed by @@ -1132,7 +1134,7 @@ gupnp_service_proxy_begin_action_hash * @proxy: A #GUPnPServiceProxy * @action: A #GUPnPServiceProxyAction handle * @error: The location where to store any error, or %NULL - * @Varargs: tuples of out parameter name, out parameter type, and out parameter + * @...: tuples of out parameter name, out parameter type, and out parameter * value location, terminated with %NULL. The out parameter values should be * freed after use * @@ -1381,7 +1383,7 @@ gupnp_service_proxy_end_action_valist (GUPnPServiceProxy *proxy, * in @out_values must be freed using #g_list_free and each element in it using * #g_value_unset and #g_slice_free. * - * Return value : %TRUE on success. + * Returns: %TRUE on success. **/ gboolean gupnp_service_proxy_end_action_list (GUPnPServiceProxy *proxy, @@ -1923,7 +1925,7 @@ server_handler (G_GNUC_UNUSED SoupServer *soup_server, g_source_unref (proxy->priv->notify_idle_src); } - + /* Everything went OK */ soup_message_set_status (msg, SOUP_STATUS_OK); } diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c index 81e5607..459ed77 100644 --- a/libgupnp/gupnp-service.c +++ b/libgupnp/gupnp-service.c @@ -355,7 +355,7 @@ gupnp_service_action_get_locales (GUPnPServiceAction *action) /** * gupnp_service_action_get: * @action: A #GUPnPServiceAction - * @Varargs: tuples of argument name, argument type, and argument value + * @...: tuples of argument name, argument type, and argument value * location, terminated with %NULL. * * Retrieves the specified action arguments. @@ -543,7 +543,7 @@ gupnp_service_action_get_argument_count (GUPnPServiceAction *action) /** * gupnp_service_action_set: * @action: A #GUPnPServiceAction - * @Varargs: tuples of return value name, return value type, and + * @...: tuples of return value name, return value type, and * actual return value, terminated with %NULL. * * Sets the specified action return values. @@ -929,6 +929,14 @@ control_server_handler (SoupServer *server, return; } + /* DLNA 7.2.5.6: Always use HTTP 1.1 */ + if (soup_message_get_http_version (msg) == SOUP_HTTP_1_0) { + soup_message_set_http_version (msg, SOUP_HTTP_1_1); + soup_message_headers_append (msg->response_headers, + "Connection", + "close"); + } + context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (service)); /* Get action name */ @@ -1737,7 +1745,7 @@ gupnp_service_class_init (GUPnPServiceClass *klass) /** * gupnp_service_notify: * @service: A #GUPnPService - * @Varargs: Tuples of variable name, variable type, and variable value, + * @...: Tuples of variable name, variable type, and variable value, * terminated with %NULL. * * Notifies listening clients that the properties listed in @Varargs @@ -2191,7 +2199,7 @@ connect_names_to_signal_handlers (GUPnPService *service, * A convenience function that attempts to connect all possible * #GUPnPService::action-invoked and #GUPnPService::query-variable signals to * appropriate callbacks for the service @service. It uses service introspection - * and GModule's introspective features. It is very simillar to + * and #GModule's introspective features. It is very simillar to * gtk_builder_connect_signals() except that it attempts to guess the names of * the signal handlers on its own. * @@ -2200,17 +2208,18 @@ connect_names_to_signal_handlers (GUPnPService *service, * off the action names and either prepend "on_" or append "_cb" to them. Same * goes for #GUPnPService::query-variable signals, except that "query_" should * be prepended to the variable name. For example, callback function for - * "GetSystemUpdateID" action should be either named as + * GetSystemUpdateID action should be either named as * "get_system_update_id_cb" or "on_get_system_update_id" and callback function * for the query of "SystemUpdateID" state variable should be named - * "query_system_update_id_cb" or "on_query_system_update_id". + * query_system_update_id_cb or + * on_query_system_update_id. * - * Note that this function will not work correctly if GModule is not supported - * on the platform or introspection is not available for service @service. + * This function will not work correctly if #GModule is not supported + * on the platform or introspection is not available for @service. * - * WARNING: This function can not and therefore does not guarantee that the + * This function can not and therefore does not guarantee that the * resulting signal connections will be correct as it depends heavily on a - * particular naming schemes described above. + * particular naming schemes described above. **/ void gupnp_service_signals_autoconnect (GUPnPService *service, diff --git a/libgupnp/gupnp-simple-context-manager.c b/libgupnp/gupnp-simple-context-manager.c index 4648ed5..7efaf38 100644 --- a/libgupnp/gupnp-simple-context-manager.c +++ b/libgupnp/gupnp-simple-context-manager.c @@ -114,7 +114,7 @@ create_contexts (gpointer data) while (ifaces) { create_and_signal_context ((char *) ifaces->data, manager); g_free (ifaces->data); - ifaces = g_list_remove_link (ifaces, ifaces); + ifaces = g_list_delete_link (ifaces, ifaces); } return FALSE; diff --git a/libgupnp/gupnp-white-list.c b/libgupnp/gupnp-white-list.c new file mode 100644 index 0000000..599bd2e --- /dev/null +++ b/libgupnp/gupnp-white-list.c @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2013 Intel Corporation. + * + * Author: Ludovic Ferrandis + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +/** + * SECTION:gupnp-white-list + * @short_description: Class for network filtering. + * + * #GUPnPWhiteList handles network filtering. It provides API to manage a list + * of entries that will be used to filter networks. + * The #GUPnPWhiteList could be enabled or not. If it's enabled but the entries + * list is empty, it behaves as disabled. + */ + +#include + +#include "gupnp-white-list.h" + +G_DEFINE_TYPE (GUPnPWhiteList, + gupnp_white_list, + G_TYPE_OBJECT); + +struct _GUPnPWhiteListPrivate { + gboolean enabled; + GList *entries; +}; + +enum { + PROP_0, + PROP_ENABLED, + PROP_ENTRIES +}; + +enum { + ENTRY_CHANGE, + ENABLED, + SIGNAL_LAST +}; + +static void +gupnp_white_list_init (GUPnPWhiteList *list) +{ + list->priv = G_TYPE_INSTANCE_GET_PRIVATE (list, + GUPNP_TYPE_WHITE_LIST, + GUPnPWhiteListPrivate); + + list->priv->entries = NULL; +} + +static void +gupnp_white_list_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + GUPnPWhiteList *list; + + list = GUPNP_WHITE_LIST (object); + + switch (property_id) { + case PROP_ENABLED: + list->priv->enabled = g_value_get_boolean (value); + break; + case PROP_ENTRIES: + list->priv->entries = g_value_get_pointer (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gupnp_white_list_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + GUPnPWhiteList *list; + + list = GUPNP_WHITE_LIST (object); + + switch (property_id) { + case PROP_ENABLED: + g_value_set_boolean (value, list->priv->enabled); + break; + case PROP_ENTRIES: + g_value_set_pointer (value, list->priv->entries); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); + break; + } +} + +static void +gupnp_white_list_class_finalize (GObject *object) +{ + GUPnPWhiteList *list; + GObjectClass *object_class; + + list = GUPNP_WHITE_LIST (object); + + g_list_free_full (list->priv->entries, g_free); + list->priv->entries = NULL; + + /* Call super */ + object_class = G_OBJECT_CLASS (gupnp_white_list_parent_class); + object_class->finalize (object); +} + +static void +gupnp_white_list_class_init (GUPnPWhiteListClass *klass) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (klass); + + object_class->set_property = gupnp_white_list_set_property; + object_class->get_property = gupnp_white_list_get_property; + object_class->finalize = gupnp_white_list_class_finalize; + + g_type_class_add_private (klass, sizeof (GUPnPWhiteListPrivate)); + + /** + * GUPnPWhiteList:enabled: + * + * Whether this white list is active or not. + **/ + g_object_class_install_property + (object_class, + PROP_ENABLED, + g_param_spec_boolean + ("enabled", + "Enabled", + "TRUE if the white list is active.", + FALSE, + G_PARAM_CONSTRUCT | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); + + /** + * GUPnPWhiteList:entries: + * + * Whether this white list is active or not. + * Type: GList + * Transfer: none + **/ + g_object_class_install_property + (object_class, + PROP_ENTRIES, + g_param_spec_pointer + ("entries", + "Entries", + "GList of strings that compose the white list.", + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READWRITE | + G_PARAM_STATIC_STRINGS)); +} + +/** + * gupnp_white_list_new: + * + * Create a new #GUPnPWhiteList. + * The white list is disabled by default. + * + * Returns: (transfer full): A new #GUPnPWhiteList object. + **/ +GUPnPWhiteList * +gupnp_white_list_new (void) +{ + return g_object_new (GUPNP_TYPE_WHITE_LIST, NULL); +} + +/** + * gupnp_white_list_set_enabled: + * @white_list: A #GUPnPWhiteList + * @enable: %TRUE to enable @white_list, %FALSE otherwise + * + * Enable or disable the #GUPnPWhiteList to perform the network filtering. +**/ +void +gupnp_white_list_set_enabled (GUPnPWhiteList *white_list, gboolean enable) +{ + g_return_if_fail (GUPNP_IS_WHITE_LIST (white_list)); + + white_list->priv->enabled = enable; + g_object_notify (G_OBJECT (white_list), "enabled"); +} + +/** + * gupnp_white_list_get_enabled: + * @white_list: A #GUPnPWhiteList + * + * Return the status of the #GUPnPWhiteList + * + * Return value: %TRUE if @white_list is enabled, %FALSE otherwise. + **/ +gboolean +gupnp_white_list_get_enabled (GUPnPWhiteList *white_list) +{ + g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE); + + return white_list->priv->enabled; +} + +/** + * gupnp_white_list_is_empty: + * @white_list: A #GUPnPWhiteList + * + * Return the state of the entries list of #GUPnPWhiteList + * + * Return value: %TRUE if @white_list is empty, %FALSE otherwise. + **/ +gboolean +gupnp_white_list_is_empty (GUPnPWhiteList *white_list) +{ + g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), TRUE); + + return (white_list->priv->entries == NULL); +} + +/** + * gupnp_white_list_add_entry: + * @white_list: A #GUPnPWhiteList + * @entry: A value used to filter network + * + * Add @entry in the list of valid criteria used by @white_list to + * filter networks. + * if @entry already exists, it won't be added a second time. + * + * Return value: %TRUE if @entry is added, %FALSE otherwise. + **/ +gboolean +gupnp_white_list_add_entry (GUPnPWhiteList *white_list, gchar* entry) +{ + GList *s_entry; + GUPnPWhiteListPrivate *priv; + + g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE); + g_return_val_if_fail ((entry != NULL), FALSE); + + priv = white_list->priv; + + s_entry = g_list_find_custom (priv->entries, entry, + (GCompareFunc) g_ascii_strcasecmp); + + if (s_entry == NULL) { + priv->entries = g_list_prepend (priv->entries, + g_strdup (entry)); + g_object_notify (G_OBJECT (white_list), "entries"); + } + + return (s_entry == NULL); +} + +/** + * gupnp_white_list_remove_entry: + * @white_list: A #GUPnPWhiteList + * @entry: A value to remove from the filter list. + * + * Remove @entry in the list of valid criteria used by @white_list to + * filter networks. + * + * Return value: %TRUE if @entry is removed, %FALSE otherwise. + **/ +gboolean +gupnp_white_list_remove_entry (GUPnPWhiteList *white_list, gchar* entry) +{ + GList *s_entry; + GUPnPWhiteListPrivate *priv; + + g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE); + g_return_val_if_fail ((entry != NULL), FALSE); + + priv = white_list->priv; + + s_entry = g_list_find_custom (priv->entries, entry, + (GCompareFunc) g_ascii_strcasecmp); + + if (s_entry != NULL) { + priv->entries = g_list_remove_link (priv->entries, s_entry); + g_list_free_full (s_entry, g_free); + g_object_notify (G_OBJECT (white_list), "entries"); + } + + return (s_entry != NULL); +} + +/** + * gupnp_white_list_get_entries: + * @white_list: A #GUPnPWhiteList + * + * Get the #GList of entries that compose the white list. Do not free + * + * Return value: (element-type utf8) (transfer none): a #GList of entries + * used to filter networks, interfaces,... or %NULL. + * Do not modify or free the list nor its elements. + **/ +GList * +gupnp_white_list_get_entries (GUPnPWhiteList *white_list) +{ + g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), NULL); + + return white_list->priv->entries; +} + +/** + * gupnp_white_list_clear: + * @white_list: A #GUPnPWhiteList + * + * Remove all entries from #GList that compose the white list. + * The list is now empty. Even if #GUPnPWhiteList is enabled, it will have the + * same behavior as if it was disabled. +**/ +void +gupnp_white_list_clear (GUPnPWhiteList *white_list) +{ + GUPnPWhiteListPrivate *priv; + + g_return_if_fail (GUPNP_IS_WHITE_LIST(white_list)); + + priv = white_list->priv; + g_list_free_full (priv->entries, g_free); + priv->entries = NULL; + g_object_notify (G_OBJECT (white_list), "entries"); +} + +/** + * gupnp_white_list_check_context: + * @white_list: A #GUPnPWhiteList + * @context: A #GUPnPContext to test. + * + * It will check if the @context is allowed or not. The @white_list will check + * all its entries againt #GUPnPContext interface, host ip and network fields + * information. This function doesn't take into account the @white_list status + * (enabled or not). + * + * Return value: %TRUE if @context is matching the @white_list criterias, + * %FALSE otherwise. + **/ +gboolean +gupnp_white_list_check_context (GUPnPWhiteList *white_list, + GUPnPContext *context) +{ + GSSDPClient *client; + GList *l; + const char *interface; + const char *host_ip; + const char *network; + gboolean match = FALSE; + + g_return_val_if_fail (GUPNP_IS_WHITE_LIST (white_list), FALSE); + g_return_val_if_fail (GUPNP_IS_CONTEXT (context), FALSE); + + client = GSSDP_CLIENT (context); + + interface = gssdp_client_get_interface (client); + host_ip = gssdp_client_get_host_ip (client); + network = gssdp_client_get_network (client); + + l = white_list->priv->entries; + + while (l && !match) { + match = (interface && !strcmp (l->data, interface)) || + (host_ip && !strcmp (l->data, host_ip)) || + (network && !strcmp (l->data, network)); + + l = l->next; + } + + return match; +} diff --git a/libgupnp/gupnp-white-list.h b/libgupnp/gupnp-white-list.h new file mode 100644 index 0000000..9b21b12 --- /dev/null +++ b/libgupnp/gupnp-white-list.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2013 Intel Corporation. + * + * Author: Ludovic Ferrandis + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef __GUPNP_WHITE_LIST_H__ +#define __GUPNP_WHITE_LIST_H__ + +#include +#include "gupnp-context.h" + +G_BEGIN_DECLS + +GType +gupnp_white_list_get_type (void) G_GNUC_CONST; + +#define GUPNP_TYPE_WHITE_LIST \ + (gupnp_white_list_get_type ()) +#define GUPNP_WHITE_LIST(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ + GUPNP_TYPE_WHITE_LIST, \ + GUPnPWhiteList)) +#define GUPNP_WHITE_LIST_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_CAST ((obj), \ + GUPNP_TYPE_WHITE_LIST, \ + GUPnPWhiteListClass)) +#define GUPNP_IS_WHITE_LIST(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ + GUPNP_TYPE_WHITE_LIST)) +#define GUPNP_IS_WHITE_LIST_CLASS(obj) \ + (G_TYPE_CHECK_CLASS_TYPE ((obj), \ + GUPNP_TYPE_WHITE_LIST)) +#define GUPNP_WHITE_LIST_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), \ + GUPNP_TYPE_WHITE_LIST, \ + GUPnPWhiteListClass)) + +typedef struct _GUPnPWhiteListPrivate GUPnPWhiteListPrivate; +typedef struct _GUPnPWhiteList GUPnPWhiteList; +typedef struct _GUPnPWhiteListClass GUPnPWhiteListClass; + +/** + * GUPnPWhiteList: + * + * This struct contains private data only, and should be accessed using the + * functions below. + */ +struct _GUPnPWhiteList { + GObject parent; + + GUPnPWhiteListPrivate *priv; +}; + +struct _GUPnPWhiteListClass { + GObjectClass parent_class; +}; + +GUPnPWhiteList * +gupnp_white_list_new (void); + +void +gupnp_white_list_set_enabled (GUPnPWhiteList *white_list, + gboolean enable); + +gboolean +gupnp_white_list_get_enabled (GUPnPWhiteList *white_list); + +gboolean +gupnp_white_list_is_empty (GUPnPWhiteList *white_list); + +gboolean +gupnp_white_list_add_entry (GUPnPWhiteList *white_list, + gchar* entry); + +gboolean +gupnp_white_list_remove_entry (GUPnPWhiteList *white_list, + gchar* entry); + +GList * +gupnp_white_list_get_entries (GUPnPWhiteList *white_list); + +void +gupnp_white_list_clear (GUPnPWhiteList *white_list); + +gboolean +gupnp_white_list_check_context (GUPnPWhiteList *white_list, + GUPnPContext *context); + +G_END_DECLS + +#endif /* __GUPNP_WHITE_LIST_H__ */ diff --git a/libgupnp/gupnp-xml-doc.h b/libgupnp/gupnp-xml-doc.h index bad0902..1162acd 100644 --- a/libgupnp/gupnp-xml-doc.h +++ b/libgupnp/gupnp-xml-doc.h @@ -28,6 +28,8 @@ #include #include +G_BEGIN_DECLS + GType gupnp_xml_doc_get_type (void) G_GNUC_CONST; @@ -55,6 +57,12 @@ gupnp_xml_doc_get_type (void) G_GNUC_CONST; typedef struct _GUPnPXMLDoc GUPnPXMLDoc; typedef struct _GUPnPXMLDocClass GUPnPXMLDocClass; +/** + * GUPnPXMLDoc: + * @doc: Pointer to the document. + * + * Reference-counting wrapper for libxml's #xmlDoc + */ struct _GUPnPXMLDoc { GObject parent; /*< public >*/ @@ -72,4 +80,6 @@ GUPnPXMLDoc * gupnp_xml_doc_new_from_path (const char *path, GError **error); +G_END_DECLS + #endif /* __GUPNP_XML_DOC_H__ */ diff --git a/libgupnp/gupnp.h b/libgupnp/gupnp.h index 2d8d8bc..42ef2a8 100644 --- a/libgupnp/gupnp.h +++ b/libgupnp/gupnp.h @@ -32,5 +32,6 @@ #include "gupnp-service-info.h" #include "gupnp-service-introspection.h" #include "gupnp-service-proxy.h" +#include "gupnp-white-list.h" #include "gupnp-xml-doc.h" #include "gupnp-types.h" diff --git a/m4/libtool.m4 b/m4/libtool.m4 index 828104c..02b4bbe 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -1324,7 +1324,14 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) - LD="${LD-ld} -m elf_i386" + case `/usr/bin/file conftest.o` in + *x86-64*) + LD="${LD-ld} -m elf32_x86_64" + ;; + *) + LD="${LD-ld} -m elf_i386" + ;; + esac ;; ppc64-*linux*|powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" @@ -1688,7 +1695,8 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then + if test -n "$lt_cv_sys_max_cmd_len" && \ + test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else @@ -2512,17 +2520,6 @@ freebsd* | dragonfly*) esac ;; -gnu*) - version_type=linux # correct to gnu/linux during the next big refactor - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no @@ -2639,7 +2636,7 @@ linux*oldld* | linux*aout* | linux*coff*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no @@ -3255,10 +3252,6 @@ freebsd* | dragonfly*) fi ;; -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - haiku*) lt_cv_deplibs_check_method=pass_all ;; @@ -3297,7 +3290,7 @@ irix5* | irix6* | nonstopux*) ;; # This must be glibc/ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) +linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; @@ -4049,7 +4042,7 @@ m4_if([$1], [CXX], [ ;; esac ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler @@ -4348,7 +4341,7 @@ m4_if([$1], [CXX], [ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) @@ -6241,9 +6234,6 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(ld_shlibs, $1)=yes ;; - gnu*) - ;; - haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes @@ -6405,7 +6395,7 @@ if test "$_lt_caught_CXX_error" != yes; then _LT_TAGVAR(inherit_rpath, $1)=yes ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) + linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler diff --git a/packaging/GUPnP.changes b/packaging/GUPnP.changes index 7898c4e..11bc645 100644 --- a/packaging/GUPnP.changes +++ b/packaging/GUPnP.changes @@ -1,3 +1,6 @@ +* Wed Aug 21 2013 Regis Merlino +- Update gupnp to 0.20.5 (fdeb6f9f) + * Tue Jul 16 00:01:36 UTC 2013 - tracy.graydon@intel.com - Stripped old yaml cruft out of spec file diff --git a/packaging/GUPnP.spec b/packaging/GUPnP.spec index 401eb26..6e643dd 100644 --- a/packaging/GUPnP.spec +++ b/packaging/GUPnP.spec @@ -1,6 +1,6 @@ Name: gupnp Summary: GUPnP is an framework for creating UPnP devices & control points -Version: 0.20.3 +Version: 0.20.5 Release: 1 Group: System/Libraries License: LGPLv2+ diff --git a/tests/Makefile.am b/tests/Makefile.am index 4c70f1a..8209270 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,7 +5,8 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) $(GTHREAD_CFLAGS) -I$(top_srcdir) noinst_PROGRAMS = test-browsing \ test-proxy \ test-server \ - test-introspection + test-introspection \ + test-white-list test_browsing_SOURCES = test-browsing.c test_browsing_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \ @@ -28,6 +29,11 @@ test_server_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \ $(LIBGUPNP_LIBS) test_server_LDFLAGS = -export-dynamic +test_white_list_SOURCES = test-white-list.c +test_white_list_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \ + $(GTHREAD_LIBS) \ + $(LIBGUPNP_LIBS) + CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(BUILT_SOURCES) MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES) diff --git a/tests/Makefile.in b/tests/Makefile.in index 6c815c6..9f8fcb1 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -53,7 +53,8 @@ build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ noinst_PROGRAMS = test-browsing$(EXEEXT) test-proxy$(EXEEXT) \ - test-server$(EXEEXT) test-introspection$(EXEEXT) + test-server$(EXEEXT) test-introspection$(EXEEXT) \ + test-white-list$(EXEEXT) subdir = tests DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -93,6 +94,11 @@ test_server_DEPENDENCIES = $(top_builddir)/libgupnp/libgupnp-1.0.la \ test_server_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(test_server_LDFLAGS) $(LDFLAGS) -o $@ +am_test_white_list_OBJECTS = test-white-list.$(OBJEXT) +test_white_list_OBJECTS = $(am_test_white_list_OBJECTS) +test_white_list_DEPENDENCIES = \ + $(top_builddir)/libgupnp/libgupnp-1.0.la $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp am__depfiles_maybe = depfiles @@ -120,9 +126,11 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_browsing_SOURCES) $(test_introspection_SOURCES) \ - $(test_proxy_SOURCES) $(test_server_SOURCES) + $(test_proxy_SOURCES) $(test_server_SOURCES) \ + $(test_white_list_SOURCES) DIST_SOURCES = $(test_browsing_SOURCES) $(test_introspection_SOURCES) \ - $(test_proxy_SOURCES) $(test_server_SOURCES) + $(test_proxy_SOURCES) $(test_server_SOURCES) \ + $(test_white_list_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ @@ -207,8 +215,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ @@ -342,6 +348,11 @@ test_server_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \ $(LIBGUPNP_LIBS) test_server_LDFLAGS = -export-dynamic +test_white_list_SOURCES = test-white-list.c +test_white_list_LDADD = $(top_builddir)/libgupnp/libgupnp-1.0.la \ + $(GTHREAD_LIBS) \ + $(LIBGUPNP_LIBS) + CLEANFILES = $(BUILT_SOURCES) DISTCLEANFILES = $(BUILT_SOURCES) MAINTAINERCLEANFILES = Makefile.in $(BUILT_SOURCES) @@ -400,6 +411,9 @@ test-proxy$(EXEEXT): $(test_proxy_OBJECTS) $(test_proxy_DEPENDENCIES) $(EXTRA_te test-server$(EXEEXT): $(test_server_OBJECTS) $(test_server_DEPENDENCIES) $(EXTRA_test_server_DEPENDENCIES) @rm -f test-server$(EXEEXT) $(AM_V_CCLD)$(test_server_LINK) $(test_server_OBJECTS) $(test_server_LDADD) $(LIBS) +test-white-list$(EXEEXT): $(test_white_list_OBJECTS) $(test_white_list_DEPENDENCIES) $(EXTRA_test_white_list_DEPENDENCIES) + @rm -f test-white-list$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(test_white_list_OBJECTS) $(test_white_list_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -411,6 +425,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-introspection.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-proxy.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-server.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-white-list.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/tests/gtest/Makefile.am b/tests/gtest/Makefile.am index 2578a93..2602a00 100644 --- a/tests/gtest/Makefile.am +++ b/tests/gtest/Makefile.am @@ -1,4 +1,3 @@ -if HAVE_GTEST TESTS_ENVIRONMENT = G_SLICE=debug-blocks \ LD_LIBRARY_PATH=$(top_builddir)/libgupnp/.libs:$(LD_LIBRARY_PATH) @@ -8,7 +7,6 @@ check_PROGRAMS = test-context test-bugs test_context_SOURCES = test-context.c test_bugs_SOURCES = test-bugs.c -endif LDADD = \ $(top_builddir)/libgupnp/libgupnp-1.0.la \ diff --git a/tests/gtest/Makefile.in b/tests/gtest/Makefile.in index 78a4f3f..f527241 100644 --- a/tests/gtest/Makefile.in +++ b/tests/gtest/Makefile.in @@ -51,8 +51,7 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -@HAVE_GTEST_TRUE@check_PROGRAMS = test-context$(EXEEXT) \ -@HAVE_GTEST_TRUE@ test-bugs$(EXEEXT) +check_PROGRAMS = test-context$(EXEEXT) test-bugs$(EXEEXT) subdir = tests/gtest DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -67,8 +66,7 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = -am__test_bugs_SOURCES_DIST = test-bugs.c -@HAVE_GTEST_TRUE@am_test_bugs_OBJECTS = test-bugs.$(OBJEXT) +am_test_bugs_OBJECTS = test-bugs.$(OBJEXT) test_bugs_OBJECTS = $(am_test_bugs_OBJECTS) test_bugs_LDADD = $(LDADD) am__DEPENDENCIES_1 = @@ -77,8 +75,7 @@ test_bugs_DEPENDENCIES = $(top_builddir)/libgupnp/libgupnp-1.0.la \ AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent -am__test_context_SOURCES_DIST = test-context.c -@HAVE_GTEST_TRUE@am_test_context_OBJECTS = test-context.$(OBJEXT) +am_test_context_OBJECTS = test-context.$(OBJEXT) test_context_OBJECTS = $(am_test_context_OBJECTS) test_context_LDADD = $(LDADD) test_context_DEPENDENCIES = $(top_builddir)/libgupnp/libgupnp-1.0.la \ @@ -110,8 +107,7 @@ AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_bugs_SOURCES) $(test_context_SOURCES) -DIST_SOURCES = $(am__test_bugs_SOURCES_DIST) \ - $(am__test_context_SOURCES_DIST) +DIST_SOURCES = $(test_bugs_SOURCES) $(test_context_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -160,8 +156,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ @@ -272,12 +266,12 @@ target_vendor = @target_vendor@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -@HAVE_GTEST_TRUE@TESTS_ENVIRONMENT = G_SLICE=debug-blocks \ -@HAVE_GTEST_TRUE@ LD_LIBRARY_PATH=$(top_builddir)/libgupnp/.libs:$(LD_LIBRARY_PATH) +TESTS_ENVIRONMENT = G_SLICE=debug-blocks \ + LD_LIBRARY_PATH=$(top_builddir)/libgupnp/.libs:$(LD_LIBRARY_PATH) -@HAVE_GTEST_TRUE@TESTS = $(check_PROGRAMS) -@HAVE_GTEST_TRUE@test_context_SOURCES = test-context.c -@HAVE_GTEST_TRUE@test_bugs_SOURCES = test-bugs.c +TESTS = $(check_PROGRAMS) +test_context_SOURCES = test-context.c +test_bugs_SOURCES = test-bugs.c LDADD = \ $(top_builddir)/libgupnp/libgupnp-1.0.la \ $(LIBGUPNP_LIBS) diff --git a/tests/gtest/test-context.c b/tests/gtest/test-context.c index edf41eb..bbcfd27 100644 --- a/tests/gtest/test-context.c +++ b/tests/gtest/test-context.c @@ -200,21 +200,6 @@ test_gupnp_context_http_ranged_requests (void) g_object_unref (message); - /* Try with inverted arguments */ - message = soup_message_new ("GET", uri); - g_object_ref (message); - - soup_message_headers_set_range (message->request_headers, 499, 0); - soup_session_queue_message (session, - message, - on_message_finished, - loop); - - g_main_loop_run (loop); - g_assert_cmpint (message->status_code, ==, SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE); - - g_object_unref (message); - g_free (uri); g_object_unref (context); g_main_loop_unref (loop); diff --git a/tests/test-white-list.c b/tests/test-white-list.c new file mode 100644 index 0000000..465ac72 --- /dev/null +++ b/tests/test-white-list.c @@ -0,0 +1,291 @@ +/* + * Copyright (C) 2013 Intel Corporation. + * + * Author: Ludovic Ferrandis + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include +#include +#include +#include +#include +#include +#include + +GMainLoop *main_loop; + +static void +interrupt_signal_handler (G_GNUC_UNUSED int signum) +{ + g_main_loop_quit (main_loop); +} + +static void +device_proxy_available_cb (G_GNUC_UNUSED GUPnPControlPoint *cp, + GUPnPDeviceProxy *proxy) +{ + const char *type, *location; + + type = gupnp_device_info_get_device_type (GUPNP_DEVICE_INFO (proxy)); + location = gupnp_device_info_get_location (GUPNP_DEVICE_INFO (proxy)); + + g_print ("Device available:\n"); + g_print ("\ttype: %s\n", type); + g_print ("\tlocation: %s\n", location); +} + +static void +device_proxy_unavailable_cb (G_GNUC_UNUSED GUPnPControlPoint *cp, + GUPnPDeviceProxy *proxy) +{ + const char *type, *location; + + type = gupnp_device_info_get_device_type (GUPNP_DEVICE_INFO (proxy)); + location = gupnp_device_info_get_location (GUPNP_DEVICE_INFO (proxy)); + + g_print ("Device unavailable:\n"); + g_print ("\ttype: %s\n", type); + g_print ("\tlocation: %s\n", location); +} + +static void +service_proxy_available_cb (G_GNUC_UNUSED GUPnPControlPoint *cp, + GUPnPServiceProxy *proxy) +{ + const char *type, *location; + + type = gupnp_service_info_get_service_type (GUPNP_SERVICE_INFO (proxy)); + location = gupnp_service_info_get_location (GUPNP_SERVICE_INFO (proxy)); + + g_print ("Service available:\n"); + g_print ("\ttype: %s\n", type); + g_print ("\tlocation: %s\n", location); +} + +static void +service_proxy_unavailable_cb (G_GNUC_UNUSED GUPnPControlPoint *cp, + GUPnPServiceProxy *proxy) +{ + const char *type, *location; + + type = gupnp_service_info_get_service_type (GUPNP_SERVICE_INFO (proxy)); + location = gupnp_service_info_get_location (GUPNP_SERVICE_INFO (proxy)); + + g_print ("Service unavailable:\n"); + g_print ("\ttype: %s\n", type); + g_print ("\tlocation: %s\n", location); +} + +static void +context_available_cb(GUPnPContextManager *context_manager, + GUPnPContext *context, + gpointer user_data) +{ + GUPnPControlPoint *cp; + GSSDPClient *client = GSSDP_CLIENT(context); + + g_print ("Context Available:\n"); + g_print ("\tServer ID: %s\n", gssdp_client_get_server_id (client)); + g_print ("\tInterface: %s\n", gssdp_client_get_interface (client)); + g_print ("\tHost IP : %s\n", gssdp_client_get_host_ip (client)); + g_print ("\tNetwork : %s\n", gssdp_client_get_network (client)); + g_print ("\tActive : %s\n", gssdp_client_get_active (client)? "TRUE" : "FALSE"); + + + /* We're interested in everything */ + cp = gupnp_control_point_new (context, "ssdp:all"); + + g_signal_connect (cp, + "device-proxy-available", + G_CALLBACK (device_proxy_available_cb), + NULL); + g_signal_connect (cp, + "device-proxy-unavailable", + G_CALLBACK (device_proxy_unavailable_cb), + NULL); + g_signal_connect (cp, + "service-proxy-available", + G_CALLBACK (service_proxy_available_cb), + NULL); + g_signal_connect (cp, + "service-proxy-unavailable", + G_CALLBACK (service_proxy_unavailable_cb), + NULL); + + gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), TRUE); + gupnp_context_manager_manage_control_point(context_manager, cp); + g_object_unref(cp); +} + +static void +context_unavailable_cb(GUPnPContextManager *context_manager, + GUPnPContext *context, + gpointer user_data) +{ + GSSDPClient *client = GSSDP_CLIENT(context); + + g_print ("Context Unavailable:\n"); + g_print ("\tServer ID: %s\n", gssdp_client_get_server_id (client)); + g_print ("\tInterface: %s\n", gssdp_client_get_interface (client)); + g_print ("\tHost IP : %s\n", gssdp_client_get_host_ip (client)); + g_print ("\tNetwork : %s\n", gssdp_client_get_network (client)); + g_print ("\tActive : %s\n", gssdp_client_get_active (client)? "TRUE" : "FALSE"); +} + +static void +print_wl_entry(gpointer data, gpointer user_data) +{ + g_print ("\t\t\tEntry: %s\n", (char *)data); +} + +static void +print_white_list_entries(GUPnPWhiteList *wl) +{ + GList *list; + + g_print ("\t\tWhite List Entries:\n"); + list = gupnp_white_list_get_entries(wl); + g_list_foreach (list, print_wl_entry, NULL); + g_print ("\n"); +} + +static gboolean +change_white_list(gpointer user_data) +{ + GUPnPContextManager *context_manager = user_data; + GUPnPWhiteList *white_list; + static int tomato = 0; + + g_print ("\nChange White List:\n"); + g_print ("\t Action number %d:\n", tomato); + + white_list = gupnp_context_manager_get_white_list(context_manager); + + switch (tomato) { + case 0: + g_print ("\t Add Entry eth0\n\n"); + gupnp_white_list_add_entry(white_list, "eth0"); + print_white_list_entries (white_list); + break; + case 1: + g_print ("\t Enable WL\n\n"); + gupnp_white_list_set_enabled (white_list, TRUE); + break; + case 2: + g_print ("\t Add Entry 127.0.0.1\n\n"); + gupnp_white_list_add_entry(white_list, "127.0.0.1"); + print_white_list_entries (white_list); + break; + case 3: + g_print ("\t Add Entry eth5\n\n"); + gupnp_white_list_add_entry(white_list, "eth5"); + print_white_list_entries (white_list); + break; + case 4: + g_print ("\t Remove Entry eth5\n\n"); + gupnp_white_list_remove_entry(white_list, "eth5"); + print_white_list_entries (white_list); + break; + case 5: + g_print ("\t Clear all entries\n\n"); + gupnp_white_list_clear(white_list); + print_white_list_entries (white_list); + break; + case 6: + g_print ("\t Add Entry wlan2\n\n"); + gupnp_white_list_add_entry(white_list, "wlan2"); + print_white_list_entries(white_list); + break; + case 7: + g_print ("\t Disable WL\n\n"); + gupnp_white_list_set_enabled (white_list, FALSE); + break; + case 8: + g_print ("\t Enable WL\n\n"); + gupnp_white_list_set_enabled (white_list, TRUE); + break; + case 9: + g_print ("\t Connect to wlan0\n\n"); + g_timeout_add_seconds (35, change_white_list, context_manager); + break; + case 10: + g_print ("\t Add Entry wlan0\n\n"); + gupnp_white_list_add_entry(white_list, "wlan0"); + print_white_list_entries (white_list); + break; + //~ case 11: + //~ g_print ("\t Enable WL\n"); + //~ gupnp_white_list_enable(white_list, FALSE); + //~ break; + default: + break; + } + + tomato++; + + return (tomato < 11) && (tomato != 10); +} + +int +main (G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv) +{ + GUPnPContextManager *cm; + guint id; +#ifndef G_OS_WIN32 + struct sigaction sig_action; +#endif /* G_OS_WIN32 */ + +#if !GLIB_CHECK_VERSION(2,35,0) + g_type_init (); +#endif + setlocale (LC_ALL, ""); + + cm = gupnp_context_manager_create(0); + + g_signal_connect(cm, + "context-available", + G_CALLBACK(context_available_cb), + NULL); + + g_signal_connect(cm, + "context-unavailable", + G_CALLBACK(context_unavailable_cb), + NULL); + + main_loop = g_main_loop_new (NULL, FALSE); + + id = g_timeout_add_seconds (5, change_white_list, cm); + +#ifndef G_OS_WIN32 + /* Hook the handler for SIGTERM */ + memset (&sig_action, 0, sizeof (sig_action)); + sig_action.sa_handler = interrupt_signal_handler; + sigaction (SIGINT, &sig_action, NULL); +#else + signal(SIGINT, interrupt_signal_handler); +#endif /* G_OS_WIN32 */ + + g_main_loop_run (main_loop); + g_main_loop_unref (main_loop); + + g_source_remove (id); + + g_object_unref (cm); + + return EXIT_SUCCESS; +} diff --git a/tools/Makefile.in b/tools/Makefile.in index 21f19e5..8c1544e 100644 --- a/tools/Makefile.in +++ b/tools/Makefile.in @@ -148,8 +148,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ diff --git a/tools/gupnp-binding-tool b/tools/gupnp-binding-tool index 120fffb..463e5ec 100755 --- a/tools/gupnp-binding-tool +++ b/tools/gupnp-binding-tool @@ -173,94 +173,94 @@ def getVariables(var_elements, prefix): def printClientSyncActionBinding(a): indent = (2 + len (a.c_prefixed_name)) * " " - print "static inline gboolean" - print "%s (GUPnPServiceProxy *proxy," % a.c_prefixed_name + print("static inline gboolean") + print("%s (GUPnPServiceProxy *proxy," % a.c_prefixed_name) for arg in a.in_args: - print "%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name) + print("%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name)) for arg in a.out_args: - print "%s%s*out_%s," % (indent, arg.related_var.ctype, arg.c_name) + print("%s%s*out_%s," % (indent, arg.related_var.ctype, arg.c_name)) - print "%sGError **error)" % indent + print("%sGError **error)" % indent) - print "{" + print("{") - print " return gupnp_service_proxy_send_action" - print " (proxy, \"%s\", error," % a.name + print(" return gupnp_service_proxy_send_action") + print(" (proxy, \"%s\", error," % a.name) for arg in a.in_args: - print " \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name) - print " NULL," + print(" \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name)) + print(" NULL,") for arg in a.out_args: - print " \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name) - print " NULL);" + print(" \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name)) + print(" NULL);") - print "}\n" + print("}\n") def printClientAsyncActionBinding(a): # User-callback prototype indent = (24 + len (a.c_prefixed_name)) * " " - print "typedef void (*%s_reply) (GUPnPServiceProxy *proxy," % a.c_prefixed_name + print("typedef void (*%s_reply) (GUPnPServiceProxy *proxy," % a.c_prefixed_name) for arg in a.out_args: - print "%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name) - print "%sGError *error," % indent - print "%sgpointer userdata);" % indent - print + print("%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name)) + print("%sGError *error," % indent) + print("%sgpointer userdata);" % indent) + print("") # Generated async callback handler, calls user-provided callback indent = (30 + len (a.c_prefixed_name)) * " " - print "static void _%s_async_callback (GUPnPServiceProxy *proxy," % a.c_prefixed_name - print "%sGUPnPServiceProxyAction *action," % indent - print "%sgpointer user_data)" % indent - print "{" - print " GUPnPAsyncData *cbdata;" - print " GError *error = NULL;" + print("static void _%s_async_callback (GUPnPServiceProxy *proxy," % a.c_prefixed_name) + print("%sGUPnPServiceProxyAction *action," % indent) + print("%sgpointer user_data)" % indent) + print("{") + print(" GUPnPAsyncData *cbdata;") + print(" GError *error = NULL;") for arg in a.out_args: - print " %s%s;" % (arg.related_var.ctype, arg.c_name) - print - print " cbdata = (GUPnPAsyncData *) user_data;" - print " gupnp_service_proxy_end_action" - print " (proxy, action, &error," + print(" %s%s;" % (arg.related_var.ctype, arg.c_name)) + print("") + print(" cbdata = (GUPnPAsyncData *) user_data;") + print(" gupnp_service_proxy_end_action") + print(" (proxy, action, &error,") for arg in a.out_args: - print " \"%s\", %s, &%s," % (arg.name, arg.related_var.gtype, arg.c_name) - print " NULL);" - print " ((%s_reply)cbdata->cb)" % a.c_prefixed_name - print " (proxy," + print(" \"%s\", %s, &%s," % (arg.name, arg.related_var.gtype, arg.c_name)) + print(" NULL);") + print(" ((%s_reply)cbdata->cb)" % a.c_prefixed_name) + print(" (proxy,") for arg in a.out_args: - print " %s," % arg.c_name - print " error, cbdata->userdata);" - print - print " g_slice_free1 (sizeof (*cbdata), cbdata);" - print "}" - print + print(" %s," % arg.c_name) + print(" error, cbdata->userdata);") + print("") + print(" g_slice_free1 (sizeof (*cbdata), cbdata);") + print("}") + print("") # Entry point indent = (8 + len (a.c_prefixed_name)) * " " - print "static inline GUPnPServiceProxyAction *" - print "%s_async (GUPnPServiceProxy *proxy," % a.c_prefixed_name + print("static inline GUPnPServiceProxyAction *") + print("%s_async (GUPnPServiceProxy *proxy," % a.c_prefixed_name) for arg in a.in_args: - print "%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name) - print "%s%s_reply callback," % (indent, a.c_prefixed_name) - print "%sgpointer userdata)" % indent - print "{" - print " GUPnPServiceProxyAction* action;" - print " GUPnPAsyncData *cbdata;" - print - print " cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));" - print " cbdata->cb = G_CALLBACK (callback);" - print " cbdata->userdata = userdata;" - print " action = gupnp_service_proxy_begin_action" - print " (proxy, \"%s\"," % a.name - print " _%s_async_callback, cbdata," % a.c_prefixed_name + print("%sconst %sin_%s," % (indent, arg.related_var.ctype, arg.c_name)) + print("%s%s_reply callback," % (indent, a.c_prefixed_name)) + print("%sgpointer userdata)" % indent) + print("{") + print(" GUPnPServiceProxyAction* action;") + print(" GUPnPAsyncData *cbdata;") + print("") + print(" cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));") + print(" cbdata->cb = G_CALLBACK (callback);") + print(" cbdata->userdata = userdata;") + print(" action = gupnp_service_proxy_begin_action") + print(" (proxy, \"%s\"," % a.name) + print(" _%s_async_callback, cbdata," % a.c_prefixed_name) for arg in a.in_args: - print " \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name) - print " NULL);" - print - print " return action;" - print "}" + print(" \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name)) + print(" NULL);") + print("") + print(" return action;") + print("}") def printClientVariableNotifyBinding(v): @@ -268,159 +268,159 @@ def printClientVariableNotifyBinding(v): # callback prototype indent = (22 + len (v.c_prefixed_name)) * " " - print "typedef void" - print "(*%s_changed_callback) (GUPnPServiceProxy *proxy," % v.c_prefixed_name - print "%s%s%s," % (indent, ctype, v.c_name) - print "%sgpointer userdata);" % indent - print + print("typedef void") + print("(*%s_changed_callback) (GUPnPServiceProxy *proxy," % v.c_prefixed_name) + print("%s%s%s," % (indent, ctype, v.c_name)) + print("%sgpointer userdata);" % indent) + print("") # private callback indent = (20 + len (v.c_prefixed_name)) * " " - print "static void" - print "_%s_changed_callback (GUPnPServiceProxy *proxy," % v.c_prefixed_name - print "%sconst gchar *variable," % indent - print "%sGValue *value," % indent - print "%sgpointer userdata)" % indent - print "{" - print " GUPnPAsyncData *cbdata;" - print " %s%s;" % (ctype, v.c_name) - print - print " cbdata = (GUPnPAsyncData *) userdata;" - print " %s = %s (value);" % (v.c_name, v.get_function) - print " ((%s_changed_callback)cbdata->cb)" % v.c_prefixed_name - print " (proxy," - print " %s," % v.c_name - print " cbdata->userdata);" - print - print " g_slice_free1 (sizeof (*cbdata), cbdata);" - print "}" - print + print("static void") + print("_%s_changed_callback (GUPnPServiceProxy *proxy," % v.c_prefixed_name) + print("%sconst gchar *variable," % indent) + print("%sGValue *value," % indent) + print("%sgpointer userdata)" % indent) + print("{") + print(" GUPnPAsyncData *cbdata;") + print(" %s%s;" % (ctype, v.c_name)) + print("") + print(" cbdata = (GUPnPAsyncData *) userdata;") + print(" %s = %s (value);" % (v.c_name, v.get_function)) + print(" ((%s_changed_callback)cbdata->cb)" % v.c_prefixed_name) + print(" (proxy,") + print(" %s," % v.c_name) + print(" cbdata->userdata);") + print("") + print(" g_slice_free1 (sizeof (*cbdata), cbdata);") + print("}") + print("") # public notify_add function indent = (13 + len (v.c_prefixed_name)) * " " - print "static inline gboolean" - print "%s_add_notify (GUPnPServiceProxy *proxy," % v.c_prefixed_name - print "%s%s_changed_callback callback," % (indent, v.c_prefixed_name) - print "%sgpointer userdata)" % indent - print "{" - print " GUPnPAsyncData *cbdata;" - print - print " cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));" - print " cbdata->cb = G_CALLBACK (callback);" - print " cbdata->userdata = userdata;" - print - print " return gupnp_service_proxy_add_notify" - print " (proxy," - print " \"%s\"," % v.name - print " %s," % v.gtype - print " _%s_changed_callback," % v.c_prefixed_name - print " cbdata);" - print "}" + print("static inline gboolean") + print("%s_add_notify (GUPnPServiceProxy *proxy," % v.c_prefixed_name) + print("%s%s_changed_callback callback," % (indent, v.c_prefixed_name)) + print("%sgpointer userdata)" % indent) + print("{") + print(" GUPnPAsyncData *cbdata;") + print("") + print(" cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));") + print(" cbdata->cb = G_CALLBACK (callback);") + print(" cbdata->userdata = userdata;") + print("") + print(" return gupnp_service_proxy_add_notify") + print(" (proxy,") + print(" \"%s\"," % v.name) + print(" %s," % v.gtype) + print(" _%s_changed_callback," % v.c_prefixed_name) + print(" cbdata);") + print("}") def printServerVariableQueryBinding(v): # User callback proto indent = (28 + len (v.ctype)+ len (v.c_prefixed_name)) * " " - print "typedef %s(*%s_query_callback) (GUPnPService *service," % (v.ctype, v.c_prefixed_name) - print "%sgpointer userdata);" % indent - print + print("typedef %s(*%s_query_callback) (GUPnPService *service," % (v.ctype, v.c_prefixed_name)) + print("%sgpointer userdata);" % indent) + print("") indent = (12 + len (v.c_prefixed_name)) * " " - print "static void" - print "_%s_query_cb (GUPnPService *service," % v.c_prefixed_name - print "%sgchar *variable," % indent - print "%sGValue *value," % indent - print "%sgpointer userdata)" % indent - print "{" - print " GUPnPAsyncData *cbdata;" - print " %s%s;" % (v.ctype, v.c_name) - print + print("static void") + print("_%s_query_cb (GUPnPService *service," % v.c_prefixed_name) + print("%sgchar *variable," % indent) + print("%sGValue *value," % indent) + print("%sgpointer userdata)" % indent) + print("{") + print(" GUPnPAsyncData *cbdata;") + print(" %s%s;" % (v.ctype, v.c_name)) + print("") indent = (36 + len (v.c_name) + len (v.c_prefixed_name)) * " " - print " cbdata = (GUPnPAsyncData *) userdata;" - print " %s = ((%s_query_callback)cbdata->cb) (service," % (v.c_name, v.c_prefixed_name) - print "%scbdata->userdata);" % indent - print " g_value_init (value, %s);" % v.gtype - print " %s (value, %s);" % (v.set_function, v.c_name) - print "}" - print + print(" cbdata = (GUPnPAsyncData *) userdata;") + print(" %s = ((%s_query_callback)cbdata->cb) (service," % (v.c_name, v.c_prefixed_name)) + print("%scbdata->userdata);" % indent) + print(" g_value_init (value, %s);" % v.gtype) + print(" %s (value, %s);" % (v.set_function, v.c_name)) + print("}") + print("") indent = (16 + len (v.c_prefixed_name)) * " " - print "gulong" - print "%s_query_connect (GUPnPService *service," % v.c_prefixed_name - print "%s%s_query_callback callback," % (indent, v.c_prefixed_name) - print "%sgpointer userdata)" % indent - print "{" - print " GUPnPAsyncData *cbdata;" - print - print " cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));" - print " cbdata->cb = G_CALLBACK (callback);" - print " cbdata->userdata = userdata;" - print - print " return g_signal_connect_data (service," - print " \"query-variable::%s\"," % v.name - print " G_CALLBACK (_%s_query_cb)," % v.c_prefixed_name - print " cbdata," - print " _free_cb_data," - print " (GConnectFlags) 0);" - print "}" - print + print("gulong") + print("%s_query_connect (GUPnPService *service," % v.c_prefixed_name) + print("%s%s_query_callback callback," % (indent, v.c_prefixed_name)) + print("%sgpointer userdata)" % indent) + print("{") + print(" GUPnPAsyncData *cbdata;") + print("") + print(" cbdata = (GUPnPAsyncData *) g_slice_alloc (sizeof (*cbdata));") + print(" cbdata->cb = G_CALLBACK (callback);") + print(" cbdata->userdata = userdata;") + print("") + print(" return g_signal_connect_data (service,") + print(" \"query-variable::%s\"," % v.name) + print(" G_CALLBACK (_%s_query_cb)," % v.c_prefixed_name) + print(" cbdata,") + print(" _free_cb_data,") + print(" (GConnectFlags) 0);") + print("}") + print("") def printServerActionBinding(a): # getter and setter func for GUPnPServiceAction indent = (13 + len (a.c_prefixed_name)) * " " if len (a.in_args) > 0: - print "static inline void" - print "%s_action_get (GUPnPServiceAction *action," % (a.c_prefixed_name) + print("static inline void") + print("%s_action_get (GUPnPServiceAction *action," % (a.c_prefixed_name)) for arg in a.in_args[:-1]: - print "%s%s*in_%s," % (indent, arg.related_var.ctype, arg.c_name) - print "%s%s*in_%s)" % (indent, a.in_args[-1].related_var.ctype, a.in_args[-1].c_name) - print "{" - print " gupnp_service_action_get (action," + print("%s%s*in_%s," % (indent, arg.related_var.ctype, arg.c_name)) + print("%s%s*in_%s)" % (indent, a.in_args[-1].related_var.ctype, a.in_args[-1].c_name)) + print("{") + print(" gupnp_service_action_get (action,") for arg in a.in_args: - print " \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name) - print " NULL);" - print "}" - print + print(" \"%s\", %s, in_%s," % (arg.name, arg.related_var.gtype, arg.c_name)) + print(" NULL);") + print("}") + print("") if len (a.out_args) > 0: - print "static inline void" - print "%s_action_set (GUPnPServiceAction *action," % (a.c_prefixed_name) + print("static inline void") + print("%s_action_set (GUPnPServiceAction *action," % (a.c_prefixed_name)) for arg in a.out_args[:-1]: - print "%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name) - print "%sconst %sout_%s)" % (indent, a.out_args[-1].related_var.ctype, a.out_args[-1].c_name) - print "{" - print " gupnp_service_action_set (action," + print("%sconst %sout_%s," % (indent, arg.related_var.ctype, arg.c_name)) + print("%sconst %sout_%s)" % (indent, a.out_args[-1].related_var.ctype, a.out_args[-1].c_name)) + print("{") + print(" gupnp_service_action_set (action,") for arg in a.out_args: - print " \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name) - print " NULL);" - print "}" - print + print(" \"%s\", %s, out_%s," % (arg.name, arg.related_var.gtype, arg.c_name)) + print(" NULL);") + print("}") + print("") indent = (17 + len (a.c_prefixed_name)) * " " - print "static inline gulong" - print "%s_action_connect (GUPnPService *service," % a.c_prefixed_name - print "%sGCallback callback," % indent - print "%sgpointer userdata)" % indent - print "{" - print " return g_signal_connect (service," - print " \"action-invoked::%s\"," % a.name - print " callback," - print " userdata);" - print "}" - print + print("static inline gulong") + print("%s_action_connect (GUPnPService *service," % a.c_prefixed_name) + print("%sGCallback callback," % indent) + print("%sgpointer userdata)" % indent) + print("{") + print(" return g_signal_connect (service,") + print(" \"action-invoked::%s\"," % a.name) + print(" callback,") + print(" userdata);") + print("}") + print("") def PrintServerVariableNotifyBinding(v): indent = (18 + len (v.c_prefixed_name)) * " " - print "void" - print "%s_variable_notify (GUPnPService *service," % v.c_prefixed_name - print "%sconst %s%s)" % (indent ,v.ctype, v.c_name) - print "{" - print " gupnp_service_notify (service," - print " \"%s\", %s, %s," % (v.name, v.gtype, v.c_name) - print " NULL);" - print "}" - print + print("void") + print("%s_variable_notify (GUPnPService *service," % v.c_prefixed_name) + print("%sconst %s%s)" % (indent ,v.ctype, v.c_name)) + print("{") + print(" gupnp_service_notify (service,") + print(" \"%s\", %s, %s," % (v.name, v.gtype, v.c_name)) + print(" NULL);") + print("}") + print("") def parseSCPD(scpd, prefix): """ @@ -441,74 +441,74 @@ def parseSCPD(scpd, prefix): def printClientBindings(binding_name, actions, variables): define = "GUPNP_GENERATED_CLIENT_BINDING_%s" % binding_name - print "/* Generated by gupnp-binding-tool */" - print - print "#include " - print - print "#ifndef %s" % define - print "#define %s" % define - print - print "G_BEGIN_DECLS" - - print "\n#ifndef __GUPNPASYNCDATA_TYPE__" - print "#define __GUPNPASYNCDATA_TYPE__" - print "typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;" - print "#endif" + print("/* Generated by gupnp-binding-tool */") + print("") + print("#include ") + print("") + print("#ifndef %s" % define) + print("#define %s" % define) + print("") + print("G_BEGIN_DECLS") + + print("\n#ifndef __GUPNPASYNCDATA_TYPE__") + print("#define __GUPNPASYNCDATA_TYPE__") + print("typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;") + print("#endif") for a in actions: - print "\n/* action %s */\n" % a.name + print("\n/* action %s */\n" % a.name) printClientSyncActionBinding(a) printClientAsyncActionBinding(a) for v in variables: if (not v.dummy) and v.notified: - print "\n/* state variable %s */\n" % v.name + print("\n/* state variable %s */\n" % v.name) printClientVariableNotifyBinding(v) - print - print "G_END_DECLS" - print - print "#endif /* %s */" % define + print("") + print("G_END_DECLS") + print("") + print("#endif /* %s */" % define) def printServerBindings(binding_name, actions, variables): define = "GUPNP_GENERATED_CLIENT_BINDING_%s" % binding_name - print "/* Generated by gupnp-binding-tool */" - print - print "#include " - print - print "#ifndef %s" % define - print "#define %s" % define - print - print "G_BEGIN_DECLS" - - print "\n#ifndef __GUPNPASYNCDATA_TYPE__" - print "#define __GUPNPASYNCDATA_TYPE__" - print "typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;" - print "#endif" - - print "static void" - print "_free_cb_data (gpointer data, GClosure *closure)" - print "{" - print " GUPnPAsyncData *cbdata = (GUPnPAsyncData *) data;" - print " g_slice_free1 (sizeof (*cbdata), cbdata);" - print "}" - print + print("/* Generated by gupnp-binding-tool */") + print("") + print("#include ") + print("") + print("#ifndef %s" % define) + print("#define %s" % define) + print("") + print("G_BEGIN_DECLS") + + print("\n#ifndef __GUPNPASYNCDATA_TYPE__") + print("#define __GUPNPASYNCDATA_TYPE__") + print("typedef struct {GCallback cb; gpointer userdata; } GUPnPAsyncData;") + print("#endif") + + print("static void") + print("_free_cb_data (gpointer data, GClosure *closure)") + print("{") + print(" GUPnPAsyncData *cbdata = (GUPnPAsyncData *) data;") + print(" g_slice_free1 (sizeof (*cbdata), cbdata);") + print("}") + print("") for a in actions: - print "\n/* action %s */\n" % a.name + print("\n/* action %s */\n" % a.name) printServerActionBinding(a) for v in variables: if not v.dummy: - print "\n/* state variable %s */\n" % v.name + print("\n/* state variable %s */\n" % v.name) printServerVariableQueryBinding(v) if v.notified: PrintServerVariableNotifyBinding(v) - print - print "G_END_DECLS" - print - print "#endif /* %s */" % define + print("") + print("G_END_DECLS") + print("") + print("#endif /* %s */" % define) def main (): diff --git a/vala/GUPnP-1.0.metadata b/vala/GUPnP-1.0.metadata index 50f14b1..a8ab94c 100644 --- a/vala/GUPnP-1.0.metadata +++ b/vala/GUPnP-1.0.metadata @@ -28,6 +28,8 @@ ServiceProxy .end_action_list skip .send_action_hash skip .send_action_list skip +WhiteList + .entries skip ControlError skip control_error_quark skip EventingError skip diff --git a/vala/Makefile.in b/vala/Makefile.in index 771f25f..e3e24d1 100644 --- a/vala/Makefile.in +++ b/vala/Makefile.in @@ -147,8 +147,6 @@ GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ GTKDOC_MKPDF = @GTKDOC_MKPDF@ GTKDOC_REBASE = @GTKDOC_REBASE@ -GTest_CFLAGS = @GTest_CFLAGS@ -GTest_LIBS = @GTest_LIBS@ HAVE_NETLINK = @HAVE_NETLINK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ -- 2.7.4