From 58f8be580039b0575b197b9573a1c92745d96d30 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Tue, 17 Jan 2017 20:25:09 +0100 Subject: New upstream version 1.5.90 --- libnm/Makefile.am | 255 ----- libnm/Makefile.in | 1433 ----------------------------- libnm/NetworkManager.h | 16 +- libnm/generate-plugin-docs.pl | 48 +- libnm/generate-setting-docs.py | 4 +- libnm/libnm.ver | 60 ++ libnm/nm-access-point.c | 6 +- libnm/nm-active-connection.c | 33 +- libnm/nm-client.c | 947 +++++++++++++++++-- libnm/nm-client.h | 29 + libnm/nm-dbus-helpers.c | 99 +- libnm/nm-dbus-helpers.h | 21 +- libnm/nm-device-adsl.c | 6 +- libnm/nm-device-bond.c | 9 +- libnm/nm-device-bridge.c | 9 +- libnm/nm-device-bt.c | 8 +- libnm/nm-device-ethernet.c | 10 +- libnm/nm-device-generic.c | 17 +- libnm/nm-device-infiniband.c | 8 +- libnm/nm-device-ip-tunnel.c | 14 +- libnm/nm-device-macsec.c | 639 +++++++++++++ libnm/nm-device-macsec.h | 101 ++ libnm/nm-device-macvlan.c | 10 +- libnm/nm-device-modem.c | 6 +- libnm/nm-device-olpc-mesh.c | 8 +- libnm/nm-device-private.h | 26 - libnm/nm-device-team.c | 11 +- libnm/nm-device-tun.c | 10 +- libnm/nm-device-vlan.c | 8 +- libnm/nm-device-vxlan.c | 12 +- libnm/nm-device-wifi.c | 31 +- libnm/nm-device-wimax.c | 12 +- libnm/nm-device.c | 231 +---- libnm/nm-dhcp4-config.c | 3 - libnm/nm-dhcp6-config.c | 3 - libnm/nm-dns-manager.c | 450 +++++++++ libnm/nm-dns-manager.h | 72 ++ libnm/nm-enum-types.c | 123 --- libnm/nm-enum-types.h | 24 - libnm/nm-ifcfg-rh-docs.xml | 303 ------ libnm/nm-ip-config.c | 2 +- libnm/nm-ip4-config.c | 3 - libnm/nm-ip6-config.c | 3 - libnm/nm-keyfile-docs.xml | 104 --- libnm/nm-manager.c | 337 ++----- libnm/nm-manager.h | 4 +- libnm/nm-object-cache.c | 90 -- libnm/nm-object-cache.h | 35 - libnm/nm-object-private.h | 29 +- libnm/nm-object.c | 878 ++++-------------- libnm/nm-object.h | 2 + libnm/nm-property-docs.xml | 43 +- libnm/nm-remote-connection.c | 117 ++- libnm/nm-remote-settings.c | 79 +- libnm/nm-secret-agent-old.c | 50 +- libnm/nm-setting-docs-overrides.xml | 163 ---- libnm/nm-setting-docs.xml | 385 -------- libnm/nm-settings-docs-overrides.xml | 177 ++++ libnm/nm-settings-docs.xml | 404 ++++++++ libnm/nm-settings-ifcfg-rh-docs.xml | 331 +++++++ libnm/nm-settings-keyfile-docs.xml | 108 +++ libnm/nm-types.h | 1 + libnm/nm-vpn-connection.c | 9 +- libnm/nm-vpn-editor.h | 4 +- libnm/nm-vpn-plugin-old.c | 12 +- libnm/nm-vpn-service-plugin.c | 12 +- libnm/nm-wimax-nsp.c | 4 +- libnm/tests/Makefile.am | 65 -- libnm/tests/Makefile.in | 1293 -------------------------- libnm/tests/test-nm-client.c | 16 +- libnm/tests/test-remote-settings-client.c | 21 +- libnm/tests/test-secret-agent.c | 23 +- 72 files changed, 3808 insertions(+), 6111 deletions(-) delete mode 100644 libnm/Makefile.am delete mode 100644 libnm/Makefile.in create mode 100644 libnm/nm-device-macsec.c create mode 100644 libnm/nm-device-macsec.h create mode 100644 libnm/nm-dns-manager.c create mode 100644 libnm/nm-dns-manager.h delete mode 100644 libnm/nm-enum-types.c delete mode 100644 libnm/nm-enum-types.h delete mode 100644 libnm/nm-ifcfg-rh-docs.xml delete mode 100644 libnm/nm-keyfile-docs.xml delete mode 100644 libnm/nm-object-cache.c delete mode 100644 libnm/nm-object-cache.h delete mode 100644 libnm/nm-setting-docs-overrides.xml delete mode 100644 libnm/nm-setting-docs.xml create mode 100644 libnm/nm-settings-docs-overrides.xml create mode 100644 libnm/nm-settings-docs.xml create mode 100644 libnm/nm-settings-ifcfg-rh-docs.xml create mode 100644 libnm/nm-settings-keyfile-docs.xml delete mode 100644 libnm/tests/Makefile.am delete mode 100644 libnm/tests/Makefile.in (limited to 'libnm') diff --git a/libnm/Makefile.am b/libnm/Makefile.am deleted file mode 100644 index ee64d4eb..00000000 --- a/libnm/Makefile.am +++ /dev/null @@ -1,255 +0,0 @@ -include $(GLIB_MAKEFILE) - -@GNOME_CODE_COVERAGE_RULES@ - -SUBDIRS = . tests - -AM_CPPFLAGS = \ - -I$(top_srcdir)/shared \ - -I$(top_builddir)/shared \ - -I$(top_builddir)/introspection \ - -I$(top_srcdir)/libnm-core \ - -I$(top_builddir)/libnm-core \ - -I$(top_srcdir)/libnm \ - -I$(top_builddir)/libnm \ - -DG_LOG_DOMAIN=\""libnm"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \ - $(GLIB_CFLAGS) \ - $(GUDEV_CFLAGS) \ - -DNMRUNDIR=\"$(nmrundir)\" \ - $(CODE_COVERAGE_CFLAGS) - -include $(top_srcdir)/libnm-core/Makefile.libnm-core - -# libnm - -lib_LTLIBRARIES = libnm.la - -libnmincludedir = $(includedir)/libnm - -libnminclude_hfiles = \ - $(top_builddir)/shared/nm-version-macros.h \ - NetworkManager.h \ - nm-access-point.h \ - nm-active-connection.h \ - nm-client.h \ - nm-device-adsl.h \ - nm-device-bond.h \ - nm-device-bridge.h \ - nm-device-bt.h \ - nm-device-ethernet.h \ - nm-device-generic.h \ - nm-device-infiniband.h \ - nm-device-ip-tunnel.h \ - nm-device-macvlan.h \ - nm-device-modem.h \ - nm-device-olpc-mesh.h \ - nm-device-team.h \ - nm-device-tun.h \ - nm-device-vlan.h \ - nm-device-vxlan.h \ - nm-device-wifi.h \ - nm-device-wimax.h \ - nm-device.h \ - nm-dhcp-config.h \ - nm-enum-types.h \ - nm-ip-config.h \ - nm-object.h \ - nm-remote-connection.h \ - nm-types.h \ - nm-vpn-connection.h \ - nm-vpn-editor.h \ - nm-wimax-nsp.h - -libnminclude_nointrospect_hfiles = \ - nm-secret-agent-old.h \ - nm-vpn-plugin-old.h \ - nm-vpn-service-plugin.h - -libnminclude_HEADERS = \ - $(libnminclude_hfiles) \ - $(libnminclude_nointrospect_hfiles) - -libnm_la_private_headers = \ - nm-dbus-helpers.h \ - nm-device-private.h \ - nm-dhcp4-config.h \ - nm-dhcp6-config.h \ - nm-ip4-config.h \ - nm-ip6-config.h \ - nm-manager.h \ - nm-object-cache.h \ - nm-object-private.h \ - nm-remote-connection-private.h \ - nm-remote-settings.h - -libnm_la_csources = \ - nm-access-point.c \ - nm-active-connection.c \ - nm-client.c \ - nm-dbus-helpers.c \ - nm-device-adsl.c \ - nm-device-bond.c \ - nm-device-bridge.c \ - nm-device-bt.c \ - nm-device-ethernet.c \ - nm-device-generic.c \ - nm-device-infiniband.c \ - nm-device-ip-tunnel.c \ - nm-device-macvlan.c \ - nm-device-modem.c \ - nm-device-olpc-mesh.c \ - nm-device-team.c \ - nm-device-tun.c \ - nm-device-vlan.c \ - nm-device-vxlan.c \ - nm-device-wifi.c \ - nm-device-wimax.c \ - nm-device.c \ - nm-dhcp-config.c \ - nm-dhcp4-config.c \ - nm-dhcp6-config.c \ - nm-enum-types.c \ - nm-ip-config.c \ - nm-ip4-config.c \ - nm-ip6-config.c \ - nm-manager.c \ - nm-object-cache.c \ - nm-object.c \ - nm-remote-connection.c \ - nm-remote-settings.c \ - nm-secret-agent-old.c \ - nm-vpn-connection.c \ - nm-vpn-plugin-old.c \ - nm-vpn-editor.c \ - nm-vpn-service-plugin.c \ - nm-wimax-nsp.c - -libnm_la_SOURCES = \ - $(libnm_la_csources) \ - $(libnm_la_private_headers) - -GLIB_GENERATED = nm-enum-types.h nm-enum-types.c -nm_enum_types_sources = $(libnminclude_HEADERS) -GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM --fhead '\#include \n' -GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM --fhead '\#include "nm-default.h"\n' - -libnm_la_LIBADD = \ - $(top_builddir)/libnm-core/libnm-core.la \ - $(top_builddir)/introspection/libnmdbus.la \ - $(DL_LIBS) \ - $(GLIB_LIBS) \ - $(UUID_LIBS) \ - $(GUDEV_LIBS) - -SYMBOL_VIS_FILE=$(srcdir)/libnm.ver - -libnm_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \ - $(CODE_COVERAGE_LDFLAGS) \ - -version-info "1:0:1" - -### - -BUILT_SOURCES = $(GLIB_GENERATED) - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libnm.pc - -DISTCLEANFILES = libnm.pc - -EXTRA_DIST = libnm.pc.in libnm.ver - -CLEANFILES = $(BUILT_SOURCES) - --include $(INTROSPECTION_MAKEFILE) -INTROSPECTION_GIRS = -INTROSPECTION_COMPILER_ARGS = \ - --includedir=$(top_srcdir)/libnm-core \ - --includedir=$(top_builddir)/libnm-core \ - --includedir=$(top_srcdir)/libnm \ - --includedir=$(top_builddir)/libnm - -# Pass SANITIZER_ENV where a command that uses built libraries is -# executed, to suppress possible errors -INTROSPECTION_SCANNER_ENV = $(SANITIZER_ENV) - -if HAVE_INTROSPECTION -introspection_sources = \ - $(libnm_core_headers) \ - $(libnminclude_hfiles) \ - $(libnm_core_sources) \ - $(libnm_la_csources) - -NM-1.0.gir: libnm.la -NM_1_0_gir_INCLUDES = Gio-2.0 -NM_1_0_gir_PACKAGES = gio-2.0 gudev-1.0 -NM_1_0_gir_EXPORT_PACKAGES = libnm -NM_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -NM_1_0_gir_LIBS = libnm.la -NM_1_0_gir_FILES = $(introspection_sources) -NM_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm -INTROSPECTION_GIRS += NM-1.0.gir - -girdir = $(datadir)/gir-1.0 -gir_DATA = $(INTROSPECTION_GIRS) - -typelibdir = $(libdir)/girepository-1.0 -typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) - -CLEANFILES += $(gir_DATA) $(typelib_DATA) -endif - -check-local: - $(top_srcdir)/tools/check-exports.sh $(builddir)/.libs/libnm.so $(SYMBOL_VIS_FILE) - -if BUILD_SETTING_DOCS - -noinst_DATA = \ - nm-property-docs.xml \ - nm-setting-docs-overrides.xml \ - nm-setting-docs.xml \ - nm-keyfile-docs.xml \ - nm-ifcfg-rh-docs.xml - -docs_sources = $(filter-out %/nm-core-enum-types.c,$(libnm_core_sources)) - -nm-setting-docs-overrides.xml: generate-plugin-docs.pl $(docs_sources) - $(srcdir)/generate-plugin-docs.pl dbus $(top_srcdir)/libnm-core $@ - -# When the python scripts loads libnm and the address sanitizers is -# enabled, we must LD_PRELOAD libasan otherwise it will complain that -# it was not loaded as initial library. -nm-property-docs.xml: generate-setting-docs.py $(docs_sources) | NM-1.0.gir NM-1.0.typelib libnm.la - export GI_TYPELIB_PATH=$(abs_builddir)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}; \ - export LD_LIBRARY_PATH=$(abs_builddir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}; \ - if echo $(CFLAGS) | grep -e -fsanitize=address; then \ - export LD_PRELOAD="$${LD_PRELOAD} $$(ldd $(abs_builddir)/.libs/libnm.so | grep libasan\.so\.. -o | head -n 1)"; \ - fi; \ - [ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \ - $(srcdir)/generate-setting-docs.py \ - --gir $(builddir)/NM-1.0.gir \ - --output $@ - -nm-setting-docs.xml: generate-setting-docs.py $(docs_sources) nm-setting-docs-overrides.xml | NM-1.0.gir NM-1.0.typelib libnm.la - export GI_TYPELIB_PATH=$(abs_builddir)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}; \ - export LD_LIBRARY_PATH=$(abs_builddir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}; \ - if echo $(CFLAGS) | grep -e -fsanitize=address; then \ - export LD_PRELOAD="$${LD_PRELOAD} $$(ldd $(abs_builddir)/.libs/libnm.so | grep libasan\.so\.. -o | head -n 1)"; \ - fi; \ - [ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \ - $(srcdir)/generate-setting-docs.py \ - --gir $(builddir)/NM-1.0.gir \ - --overrides $(builddir)/nm-setting-docs-overrides.xml \ - --output $@ - -nm-keyfile-docs.xml: generate-plugin-docs.pl $(docs_sources) - $(srcdir)/generate-plugin-docs.pl keyfile $(top_srcdir)/libnm-core $@ -nm-ifcfg-rh-docs.xml: generate-plugin-docs.pl $(docs_sources) - $(srcdir)/generate-plugin-docs.pl ifcfg-rh $(top_srcdir)/libnm-core $@ - -CLEANFILES += $(noinst_DATA) -EXTRA_DIST += $(noinst_DATA) - -endif - -EXTRA_DIST += generate-setting-docs.py generate-plugin-docs.pl diff --git a/libnm/Makefile.in b/libnm/Makefile.in deleted file mode 100644 index e6af7c12..00000000 --- a/libnm/Makefile.in +++ /dev/null @@ -1,1433 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# In order for this to work correctly from both libnm-core/ and libnm/, -# we have to specify full pathnames. (We can't just use $(addprefix) from -# libnm/, because that's incompatible with the Makefile.introspection rules.) - - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@HAVE_INTROSPECTION_TRUE@am__append_1 = NM-1.0.gir -@HAVE_INTROSPECTION_TRUE@am__append_2 = $(gir_DATA) $(typelib_DATA) -@BUILD_SETTING_DOCS_TRUE@am__append_3 = $(noinst_DATA) -@BUILD_SETTING_DOCS_TRUE@am__append_4 = $(noinst_DATA) -subdir = libnm -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/ax_lib_readline.m4 \ - $(top_srcdir)/m4/compiler_options.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/git-sha-record.m4 \ - $(top_srcdir)/m4/gnome-code-coverage.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(libnminclude_HEADERS) \ - $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = libnm.pc -CONFIG_CLEAN_VPATH_FILES = -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" \ - "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" \ - "$(DESTDIR)$(libnmincludedir)" -LTLIBRARIES = $(lib_LTLIBRARIES) -am__DEPENDENCIES_1 = -libnm_la_DEPENDENCIES = $(top_builddir)/libnm-core/libnm-core.la \ - $(top_builddir)/introspection/libnmdbus.la \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ - $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) -am__objects_1 = nm-access-point.lo nm-active-connection.lo \ - nm-client.lo nm-dbus-helpers.lo nm-device-adsl.lo \ - nm-device-bond.lo nm-device-bridge.lo nm-device-bt.lo \ - nm-device-ethernet.lo nm-device-generic.lo \ - nm-device-infiniband.lo nm-device-ip-tunnel.lo \ - nm-device-macvlan.lo nm-device-modem.lo nm-device-olpc-mesh.lo \ - nm-device-team.lo nm-device-tun.lo nm-device-vlan.lo \ - nm-device-vxlan.lo nm-device-wifi.lo nm-device-wimax.lo \ - nm-device.lo nm-dhcp-config.lo nm-dhcp4-config.lo \ - nm-dhcp6-config.lo nm-enum-types.lo nm-ip-config.lo \ - nm-ip4-config.lo nm-ip6-config.lo nm-manager.lo \ - nm-object-cache.lo nm-object.lo nm-remote-connection.lo \ - nm-remote-settings.lo nm-secret-agent-old.lo \ - nm-vpn-connection.lo nm-vpn-plugin-old.lo nm-vpn-editor.lo \ - nm-vpn-service-plugin.lo nm-wimax-nsp.lo -am__objects_2 = -am_libnm_la_OBJECTS = $(am__objects_1) $(am__objects_2) -libnm_la_OBJECTS = $(am_libnm_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libnm_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(libnm_la_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libnm_la_SOURCES) -DIST_SOURCES = $(libnm_la_SOURCES) -RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ - ctags-recursive dvi-recursive html-recursive info-recursive \ - install-data-recursive install-dvi-recursive \ - install-exec-recursive install-html-recursive \ - install-info-recursive install-pdf-recursive \ - install-ps-recursive install-recursive installcheck-recursive \ - installdirs-recursive pdf-recursive ps-recursive \ - tags-recursive uninstall-recursive -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -DATA = $(gir_DATA) $(noinst_DATA) $(pkgconfig_DATA) $(typelib_DATA) -HEADERS = $(libnminclude_HEADERS) -RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ - distclean-recursive maintainer-clean-recursive -am__recursive_targets = \ - $(RECURSIVE_TARGETS) \ - $(RECURSIVE_CLEAN_TARGETS) \ - $(am__extra_recursive_targets) -AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ - distdir -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -DIST_SUBDIRS = $(SUBDIRS) -am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/libnm.pc.in \ - $(top_srcdir)/build-aux/depcomp \ - $(top_srcdir)/libnm-core/Makefile.libnm-core -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -am__relativize = \ - dir0=`pwd`; \ - sed_first='s,^\([^/]*\)/.*$$,\1,'; \ - sed_rest='s,^[^/]*/*,,'; \ - sed_last='s,^.*/\([^/]*\)$$,\1,'; \ - sed_butlast='s,/*[^/]*$$,,'; \ - while test -n "$$dir1"; do \ - first=`echo "$$dir1" | sed -e "$$sed_first"`; \ - if test "$$first" != "."; then \ - if test "$$first" = ".."; then \ - dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ - dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ - else \ - first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ - if test "$$first2" = "$$first"; then \ - dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ - else \ - dir2="../$$dir2"; \ - fi; \ - dir0="$$dir0"/"$$first"; \ - fi; \ - fi; \ - dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ - done; \ - reldir="$$dir2" -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ -BLUEZ5_LIBS = @BLUEZ5_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ -DLLTOOL = @DLLTOOL@ -DL_LIBS = @DL_LIBS@ -DNSMASQ_PATH = @DNSMASQ_PATH@ -DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -IPTABLES_PATH = @IPTABLES_PATH@ -JANSSON_CFLAGS = @JANSSON_CFLAGS@ -JANSSON_LIBS = @JANSSON_LIBS@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@ -LIBAUDIT_LIBS = @LIBAUDIT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ -LIBNDP_LIBS = @LIBNDP_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ -LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ -LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ -LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LOG_DRIVER = @LOG_DRIVER@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ -MM_GLIB_LIBS = @MM_GLIB_LIBS@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NEWT_CFLAGS = @NEWT_CFLAGS@ -NEWT_LIBS = @NEWT_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ -NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ -NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ -NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PPPD_PATH = @PPPD_PATH@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -SANITIZERS = @SANITIZERS@ -SANITIZER_ENV = @SANITIZER_ENV@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ -SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@ -SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ -SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ -SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@ -SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@ -SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ -SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_DIR = @UDEV_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VALGRIND_RULES = @VALGRIND_RULES@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -nmbinary = @nmbinary@ -nmconfdir = @nmconfdir@ -nmdatadir = @nmdatadir@ -nmlibdir = @nmlibdir@ -nmrundir = @nmrundir@ -nmstatedir = @nmstatedir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_dhclient = @with_dhclient@ -with_dhcpcd = @with_dhcpcd@ -with_netconfig = @with_netconfig@ -with_resolvconf = @with_resolvconf@ -with_valgrind = @with_valgrind@ -SUBDIRS = . tests -AM_CPPFLAGS = \ - -I$(top_srcdir)/shared \ - -I$(top_builddir)/shared \ - -I$(top_builddir)/introspection \ - -I$(top_srcdir)/libnm-core \ - -I$(top_builddir)/libnm-core \ - -I$(top_srcdir)/libnm \ - -I$(top_builddir)/libnm \ - -DG_LOG_DOMAIN=\""libnm"\" \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \ - $(GLIB_CFLAGS) \ - $(GUDEV_CFLAGS) \ - -DNMRUNDIR=\"$(nmrundir)\" \ - $(CODE_COVERAGE_CFLAGS) - -core = $(top_srcdir)/libnm-core -core_build = $(top_builddir)/libnm-core -libnm_core_headers = \ - $(top_builddir)/shared/nm-version-macros.h \ - $(core_build)/nm-core-enum-types.h \ - $(core)/nm-connection.h \ - $(core)/nm-core-types.h \ - $(core)/nm-dbus-interface.h \ - $(core)/nm-errors.h \ - $(core)/nm-setting-8021x.h \ - $(core)/nm-setting-adsl.h \ - $(core)/nm-setting-bluetooth.h \ - $(core)/nm-setting-bond.h \ - $(core)/nm-setting-bridge-port.h \ - $(core)/nm-setting-bridge.h \ - $(core)/nm-setting-cdma.h \ - $(core)/nm-setting-connection.h \ - $(core)/nm-setting-dcb.h \ - $(core)/nm-setting-generic.h \ - $(core)/nm-setting-gsm.h \ - $(core)/nm-setting-infiniband.h \ - $(core)/nm-setting-ip-config.h \ - $(core)/nm-setting-ip-tunnel.h \ - $(core)/nm-setting-ip4-config.h \ - $(core)/nm-setting-ip6-config.h \ - $(core)/nm-setting-macvlan.h \ - $(core)/nm-setting-olpc-mesh.h \ - $(core)/nm-setting-ppp.h \ - $(core)/nm-setting-pppoe.h \ - $(core)/nm-setting-serial.h \ - $(core)/nm-setting-team-port.h \ - $(core)/nm-setting-team.h \ - $(core)/nm-setting-tun.h \ - $(core)/nm-setting-vlan.h \ - $(core)/nm-setting-vpn.h \ - $(core)/nm-setting-vxlan.h \ - $(core)/nm-setting-wimax.h \ - $(core)/nm-setting-wired.h \ - $(core)/nm-setting-wireless-security.h \ - $(core)/nm-setting-wireless.h \ - $(core)/nm-setting.h \ - $(core)/nm-simple-connection.h \ - $(core)/nm-utils.h \ - $(core)/nm-version.h \ - $(core)/nm-vpn-dbus-interface.h \ - $(core)/nm-vpn-editor-plugin.h \ - $(core)/nm-vpn-plugin-info.h - -libnm_core_private_headers = \ - $(top_builddir)/shared/nm-utils/nm-shared-utils.h \ - $(core)/crypto.h \ - $(core)/nm-connection-private.h \ - $(core)/nm-core-internal.h \ - $(core)/nm-core-types-internal.h \ - $(core)/nm-keyfile-internal.h \ - $(core)/nm-keyfile-utils.h \ - $(core)/nm-property-compare.h \ - $(core)/nm-setting-private.h \ - $(core)/nm-utils-private.h - -libnm_core_sources = \ - $(top_builddir)/shared/nm-utils/nm-shared-utils.c \ - $(core_build)/nm-core-enum-types.c \ - $(core)/crypto.c \ - $(core)/nm-connection.c \ - $(core)/nm-dbus-utils.c \ - $(core)/nm-errors.c \ - $(core)/nm-keyfile-reader.c \ - $(core)/nm-keyfile-utils.c \ - $(core)/nm-keyfile-writer.c \ - $(core)/nm-property-compare.c \ - $(core)/nm-setting-8021x.c \ - $(core)/nm-setting-adsl.c \ - $(core)/nm-setting-bluetooth.c \ - $(core)/nm-setting-bond.c \ - $(core)/nm-setting-bridge-port.c \ - $(core)/nm-setting-bridge.c \ - $(core)/nm-setting-cdma.c \ - $(core)/nm-setting-connection.c \ - $(core)/nm-setting-dcb.c \ - $(core)/nm-setting-generic.c \ - $(core)/nm-setting-gsm.c \ - $(core)/nm-setting-infiniband.c \ - $(core)/nm-setting-ip-config.c \ - $(core)/nm-setting-ip-tunnel.c \ - $(core)/nm-setting-ip4-config.c \ - $(core)/nm-setting-ip6-config.c \ - $(core)/nm-setting-macvlan.c \ - $(core)/nm-setting-olpc-mesh.c \ - $(core)/nm-setting-ppp.c \ - $(core)/nm-setting-pppoe.c \ - $(core)/nm-setting-serial.c \ - $(core)/nm-setting-team-port.c \ - $(core)/nm-setting-team.c \ - $(core)/nm-setting-tun.c \ - $(core)/nm-setting-vlan.c \ - $(core)/nm-setting-vpn.c \ - $(core)/nm-setting-vxlan.c \ - $(core)/nm-setting-wimax.c \ - $(core)/nm-setting-wired.c \ - $(core)/nm-setting-wireless-security.c \ - $(core)/nm-setting-wireless.c \ - $(core)/nm-setting.c \ - $(core)/nm-simple-connection.c \ - $(core)/nm-utils.c \ - $(core)/nm-vpn-editor-plugin.c \ - $(core)/nm-vpn-plugin-info.c - - -# libnm -lib_LTLIBRARIES = libnm.la -libnmincludedir = $(includedir)/libnm -libnminclude_hfiles = \ - $(top_builddir)/shared/nm-version-macros.h \ - NetworkManager.h \ - nm-access-point.h \ - nm-active-connection.h \ - nm-client.h \ - nm-device-adsl.h \ - nm-device-bond.h \ - nm-device-bridge.h \ - nm-device-bt.h \ - nm-device-ethernet.h \ - nm-device-generic.h \ - nm-device-infiniband.h \ - nm-device-ip-tunnel.h \ - nm-device-macvlan.h \ - nm-device-modem.h \ - nm-device-olpc-mesh.h \ - nm-device-team.h \ - nm-device-tun.h \ - nm-device-vlan.h \ - nm-device-vxlan.h \ - nm-device-wifi.h \ - nm-device-wimax.h \ - nm-device.h \ - nm-dhcp-config.h \ - nm-enum-types.h \ - nm-ip-config.h \ - nm-object.h \ - nm-remote-connection.h \ - nm-types.h \ - nm-vpn-connection.h \ - nm-vpn-editor.h \ - nm-wimax-nsp.h - -libnminclude_nointrospect_hfiles = \ - nm-secret-agent-old.h \ - nm-vpn-plugin-old.h \ - nm-vpn-service-plugin.h - -libnminclude_HEADERS = \ - $(libnminclude_hfiles) \ - $(libnminclude_nointrospect_hfiles) - -libnm_la_private_headers = \ - nm-dbus-helpers.h \ - nm-device-private.h \ - nm-dhcp4-config.h \ - nm-dhcp6-config.h \ - nm-ip4-config.h \ - nm-ip6-config.h \ - nm-manager.h \ - nm-object-cache.h \ - nm-object-private.h \ - nm-remote-connection-private.h \ - nm-remote-settings.h - -libnm_la_csources = \ - nm-access-point.c \ - nm-active-connection.c \ - nm-client.c \ - nm-dbus-helpers.c \ - nm-device-adsl.c \ - nm-device-bond.c \ - nm-device-bridge.c \ - nm-device-bt.c \ - nm-device-ethernet.c \ - nm-device-generic.c \ - nm-device-infiniband.c \ - nm-device-ip-tunnel.c \ - nm-device-macvlan.c \ - nm-device-modem.c \ - nm-device-olpc-mesh.c \ - nm-device-team.c \ - nm-device-tun.c \ - nm-device-vlan.c \ - nm-device-vxlan.c \ - nm-device-wifi.c \ - nm-device-wimax.c \ - nm-device.c \ - nm-dhcp-config.c \ - nm-dhcp4-config.c \ - nm-dhcp6-config.c \ - nm-enum-types.c \ - nm-ip-config.c \ - nm-ip4-config.c \ - nm-ip6-config.c \ - nm-manager.c \ - nm-object-cache.c \ - nm-object.c \ - nm-remote-connection.c \ - nm-remote-settings.c \ - nm-secret-agent-old.c \ - nm-vpn-connection.c \ - nm-vpn-plugin-old.c \ - nm-vpn-editor.c \ - nm-vpn-service-plugin.c \ - nm-wimax-nsp.c - -libnm_la_SOURCES = \ - $(libnm_la_csources) \ - $(libnm_la_private_headers) - -GLIB_GENERATED = nm-enum-types.h nm-enum-types.c -nm_enum_types_sources = $(libnminclude_HEADERS) -GLIB_MKENUMS_H_FLAGS = --identifier-prefix NM --fhead '\#include \n' -GLIB_MKENUMS_C_FLAGS = --identifier-prefix NM --fhead '\#include "nm-default.h"\n' -libnm_la_LIBADD = \ - $(top_builddir)/libnm-core/libnm-core.la \ - $(top_builddir)/introspection/libnmdbus.la \ - $(DL_LIBS) \ - $(GLIB_LIBS) \ - $(UUID_LIBS) \ - $(GUDEV_LIBS) - -SYMBOL_VIS_FILE = $(srcdir)/libnm.ver -libnm_la_LDFLAGS = -Wl,--version-script=$(SYMBOL_VIS_FILE) \ - $(CODE_COVERAGE_LDFLAGS) \ - -version-info "1:0:1" - - -### -BUILT_SOURCES = $(GLIB_GENERATED) -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = libnm.pc -DISTCLEANFILES = libnm.pc -EXTRA_DIST = libnm.pc.in libnm.ver $(am__append_4) \ - generate-setting-docs.py generate-plugin-docs.pl -CLEANFILES = $(BUILT_SOURCES) $(am__append_2) $(am__append_3) -INTROSPECTION_GIRS = $(am__append_1) -INTROSPECTION_COMPILER_ARGS = \ - --includedir=$(top_srcdir)/libnm-core \ - --includedir=$(top_builddir)/libnm-core \ - --includedir=$(top_srcdir)/libnm \ - --includedir=$(top_builddir)/libnm - - -# Pass SANITIZER_ENV where a command that uses built libraries is -# executed, to suppress possible errors -INTROSPECTION_SCANNER_ENV = $(SANITIZER_ENV) -@HAVE_INTROSPECTION_TRUE@introspection_sources = \ -@HAVE_INTROSPECTION_TRUE@ $(libnm_core_headers) \ -@HAVE_INTROSPECTION_TRUE@ $(libnminclude_hfiles) \ -@HAVE_INTROSPECTION_TRUE@ $(libnm_core_sources) \ -@HAVE_INTROSPECTION_TRUE@ $(libnm_la_csources) - -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_INCLUDES = Gio-2.0 -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_PACKAGES = gio-2.0 gudev-1.0 -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_EXPORT_PACKAGES = libnm -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_LIBS = libnm.la -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_FILES = $(introspection_sources) -@HAVE_INTROSPECTION_TRUE@NM_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm -@HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0 -@HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) -@HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 -@HAVE_INTROSPECTION_TRUE@typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) -@BUILD_SETTING_DOCS_TRUE@noinst_DATA = \ -@BUILD_SETTING_DOCS_TRUE@ nm-property-docs.xml \ -@BUILD_SETTING_DOCS_TRUE@ nm-setting-docs-overrides.xml \ -@BUILD_SETTING_DOCS_TRUE@ nm-setting-docs.xml \ -@BUILD_SETTING_DOCS_TRUE@ nm-keyfile-docs.xml \ -@BUILD_SETTING_DOCS_TRUE@ nm-ifcfg-rh-docs.xml - -@BUILD_SETTING_DOCS_TRUE@docs_sources = $(filter-out %/nm-core-enum-types.c,$(libnm_core_sources)) -all: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) all-recursive - -.SUFFIXES: -.SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/libnm-core/Makefile.libnm-core $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libnm/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu libnm/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; -$(top_srcdir)/libnm-core/Makefile.libnm-core $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -libnm.pc: $(top_builddir)/config.status $(srcdir)/libnm.pc.in - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ - -install-libLTLIBRARIES: $(lib_LTLIBRARIES) - @$(NORMAL_INSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - list2=; for p in $$list; do \ - if test -f $$p; then \ - list2="$$list2 $$p"; \ - else :; fi; \ - done; \ - test -z "$$list2" || { \ - echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ - } - -uninstall-libLTLIBRARIES: - @$(NORMAL_UNINSTALL) - @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ - for p in $$list; do \ - $(am__strip_dir) \ - echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ - $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ - done - -clean-libLTLIBRARIES: - -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libnm.la: $(libnm_la_OBJECTS) $(libnm_la_DEPENDENCIES) $(EXTRA_libnm_la_DEPENDENCIES) - $(AM_V_CCLD)$(libnm_la_LINK) -rpath $(libdir) $(libnm_la_OBJECTS) $(libnm_la_LIBADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-access-point.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-active-connection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-client.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dbus-helpers.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-adsl.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-bond.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-bridge.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-bt.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-ethernet.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-generic.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-infiniband.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-ip-tunnel.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-macvlan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-modem.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-olpc-mesh.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-team.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-tun.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-vlan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-vxlan.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-wifi.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device-wimax.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-device.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dhcp-config.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dhcp4-config.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-dhcp6-config.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-enum-types.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-ip-config.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-ip4-config.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-ip6-config.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-manager.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-object-cache.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-object.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-remote-connection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-remote-settings.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-secret-agent-old.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-vpn-connection.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-vpn-editor.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-vpn-plugin-old.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-vpn-service-plugin.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-wimax-nsp.Plo@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-girDATA: $(gir_DATA) - @$(NORMAL_INSTALL) - @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(girdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(girdir)" || exit $$?; \ - done - -uninstall-girDATA: - @$(NORMAL_UNINSTALL) - @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(girdir)'; $(am__uninstall_files_from_dir) -install-pkgconfigDATA: $(pkgconfig_DATA) - @$(NORMAL_INSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ - done - -uninstall-pkgconfigDATA: - @$(NORMAL_UNINSTALL) - @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) -install-typelibDATA: $(typelib_DATA) - @$(NORMAL_INSTALL) - @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(typelibdir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(typelibdir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(typelibdir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(typelibdir)" || exit $$?; \ - done - -uninstall-typelibDATA: - @$(NORMAL_UNINSTALL) - @list='$(typelib_DATA)'; test -n "$(typelibdir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(typelibdir)'; $(am__uninstall_files_from_dir) -install-libnmincludeHEADERS: $(libnminclude_HEADERS) - @$(NORMAL_INSTALL) - @list='$(libnminclude_HEADERS)'; test -n "$(libnmincludedir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(libnmincludedir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(libnmincludedir)" || exit 1; \ - fi; \ - for p in $$list; do \ - if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; \ - done | $(am__base_list) | \ - while read files; do \ - echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(libnmincludedir)'"; \ - $(INSTALL_HEADER) $$files "$(DESTDIR)$(libnmincludedir)" || exit $$?; \ - done - -uninstall-libnmincludeHEADERS: - @$(NORMAL_UNINSTALL) - @list='$(libnminclude_HEADERS)'; test -n "$(libnmincludedir)" || list=; \ - files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ - dir='$(DESTDIR)$(libnmincludedir)'; $(am__uninstall_files_from_dir) - -# This directory's subdirectories are mostly independent; you can cd -# into them and run 'make' without going through this Makefile. -# To change the values of 'make' variables: instead of editing Makefiles, -# (1) if the variable is set in 'config.status', edit 'config.status' -# (which will cause the Makefiles to be regenerated when you run 'make'); -# (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): - @fail=; \ - if $(am__make_keepgoing); then \ - failcom='fail=yes'; \ - else \ - failcom='exit 1'; \ - fi; \ - dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ - case "$@" in \ - distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ - *) list='$(SUBDIRS)' ;; \ - esac; \ - for subdir in $$list; do \ - echo "Making $$target in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ - || eval $$failcom; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ - fi; test -z "$$fail" - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-recursive -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ - include_option=--etags-include; \ - empty_fix=.; \ - else \ - include_option=--include; \ - empty_fix=; \ - fi; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - test ! -f $$subdir/TAGS || \ - set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ - fi; \ - done; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-recursive - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-recursive - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done - @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ - if test "$$subdir" = .; then :; else \ - $(am__make_dryrun) \ - || test -d "$(distdir)/$$subdir" \ - || $(MKDIR_P) "$(distdir)/$$subdir" \ - || exit 1; \ - dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ - $(am__relativize); \ - new_distdir=$$reldir; \ - dir1=$$subdir; dir2="$(top_distdir)"; \ - $(am__relativize); \ - new_top_distdir=$$reldir; \ - echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ - echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ - ($(am__cd) $$subdir && \ - $(MAKE) $(AM_MAKEFLAGS) \ - top_distdir="$$new_top_distdir" \ - distdir="$$new_distdir" \ - am__remove_distdir=: \ - am__skip_length_check=: \ - am__skip_mode_fix=: \ - distdir) \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-local -check: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) check-recursive -all-am: Makefile $(LTLIBRARIES) $(DATA) $(HEADERS) -installdirs: installdirs-recursive -installdirs-am: - for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(girdir)" "$(DESTDIR)$(pkgconfigdir)" "$(DESTDIR)$(typelibdir)" "$(DESTDIR)$(libnmincludedir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) install-recursive -install-exec: install-exec-recursive -install-data: install-data-recursive -uninstall: uninstall-recursive - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-recursive -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." - -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) -clean: clean-recursive - -clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ - mostlyclean-am - -distclean: distclean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-recursive - -dvi-am: - -html: html-recursive - -html-am: - -info: info-recursive - -info-am: - -install-data-am: install-girDATA install-libnmincludeHEADERS \ - install-pkgconfigDATA install-typelibDATA - -install-dvi: install-dvi-recursive - -install-dvi-am: - -install-exec-am: install-libLTLIBRARIES - -install-html: install-html-recursive - -install-html-am: - -install-info: install-info-recursive - -install-info-am: - -install-man: - -install-pdf: install-pdf-recursive - -install-pdf-am: - -install-ps: install-ps-recursive - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-recursive - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-recursive - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-recursive - -pdf-am: - -ps: ps-recursive - -ps-am: - -uninstall-am: uninstall-girDATA uninstall-libLTLIBRARIES \ - uninstall-libnmincludeHEADERS uninstall-pkgconfigDATA \ - uninstall-typelibDATA - -.MAKE: $(am__recursive_targets) all check check-am install install-am \ - install-strip - -.PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ - check-am check-local clean clean-generic clean-libLTLIBRARIES \ - clean-libtool cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-girDATA \ - install-html install-html-am install-info install-info-am \ - install-libLTLIBRARIES install-libnmincludeHEADERS install-man \ - install-pdf install-pdf-am install-pkgconfigDATA install-ps \ - install-ps-am install-strip install-typelibDATA installcheck \ - installcheck-am installdirs installdirs-am maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags tags-am uninstall uninstall-am uninstall-girDATA \ - uninstall-libLTLIBRARIES uninstall-libnmincludeHEADERS \ - uninstall-pkgconfigDATA uninstall-typelibDATA - -.PRECIOUS: Makefile - -include $(GLIB_MAKEFILE) - -@GNOME_CODE_COVERAGE_RULES@ - --include $(INTROSPECTION_MAKEFILE) - -@HAVE_INTROSPECTION_TRUE@NM-1.0.gir: libnm.la - -check-local: - $(top_srcdir)/tools/check-exports.sh $(builddir)/.libs/libnm.so $(SYMBOL_VIS_FILE) - -@BUILD_SETTING_DOCS_TRUE@nm-setting-docs-overrides.xml: generate-plugin-docs.pl $(docs_sources) -@BUILD_SETTING_DOCS_TRUE@ $(srcdir)/generate-plugin-docs.pl dbus $(top_srcdir)/libnm-core $@ - -# When the python scripts loads libnm and the address sanitizers is -# enabled, we must LD_PRELOAD libasan otherwise it will complain that -# it was not loaded as initial library. -@BUILD_SETTING_DOCS_TRUE@nm-property-docs.xml: generate-setting-docs.py $(docs_sources) | NM-1.0.gir NM-1.0.typelib libnm.la -@BUILD_SETTING_DOCS_TRUE@ export GI_TYPELIB_PATH=$(abs_builddir)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}; \ -@BUILD_SETTING_DOCS_TRUE@ export LD_LIBRARY_PATH=$(abs_builddir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}; \ -@BUILD_SETTING_DOCS_TRUE@ if echo $(CFLAGS) | grep -e -fsanitize=address; then \ -@BUILD_SETTING_DOCS_TRUE@ export LD_PRELOAD="$${LD_PRELOAD} $$(ldd $(abs_builddir)/.libs/libnm.so | grep libasan\.so\.. -o | head -n 1)"; \ -@BUILD_SETTING_DOCS_TRUE@ fi; \ -@BUILD_SETTING_DOCS_TRUE@ [ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \ -@BUILD_SETTING_DOCS_TRUE@ $(srcdir)/generate-setting-docs.py \ -@BUILD_SETTING_DOCS_TRUE@ --gir $(builddir)/NM-1.0.gir \ -@BUILD_SETTING_DOCS_TRUE@ --output $@ - -@BUILD_SETTING_DOCS_TRUE@nm-setting-docs.xml: generate-setting-docs.py $(docs_sources) nm-setting-docs-overrides.xml | NM-1.0.gir NM-1.0.typelib libnm.la -@BUILD_SETTING_DOCS_TRUE@ export GI_TYPELIB_PATH=$(abs_builddir)$${GI_TYPELIB_PATH:+:$$GI_TYPELIB_PATH}; \ -@BUILD_SETTING_DOCS_TRUE@ export LD_LIBRARY_PATH=$(abs_builddir)/.libs$${LD_LIBRARY_PATH:+:$$LD_LIBRARY_PATH}; \ -@BUILD_SETTING_DOCS_TRUE@ if echo $(CFLAGS) | grep -e -fsanitize=address; then \ -@BUILD_SETTING_DOCS_TRUE@ export LD_PRELOAD="$${LD_PRELOAD} $$(ldd $(abs_builddir)/.libs/libnm.so | grep libasan\.so\.. -o | head -n 1)"; \ -@BUILD_SETTING_DOCS_TRUE@ fi; \ -@BUILD_SETTING_DOCS_TRUE@ [ -n "$(SANITIZER_ENV)" ] && export $(SANITIZER_ENV) ; \ -@BUILD_SETTING_DOCS_TRUE@ $(srcdir)/generate-setting-docs.py \ -@BUILD_SETTING_DOCS_TRUE@ --gir $(builddir)/NM-1.0.gir \ -@BUILD_SETTING_DOCS_TRUE@ --overrides $(builddir)/nm-setting-docs-overrides.xml \ -@BUILD_SETTING_DOCS_TRUE@ --output $@ - -@BUILD_SETTING_DOCS_TRUE@nm-keyfile-docs.xml: generate-plugin-docs.pl $(docs_sources) -@BUILD_SETTING_DOCS_TRUE@ $(srcdir)/generate-plugin-docs.pl keyfile $(top_srcdir)/libnm-core $@ -@BUILD_SETTING_DOCS_TRUE@nm-ifcfg-rh-docs.xml: generate-plugin-docs.pl $(docs_sources) -@BUILD_SETTING_DOCS_TRUE@ $(srcdir)/generate-plugin-docs.pl ifcfg-rh $(top_srcdir)/libnm-core $@ - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libnm/NetworkManager.h b/libnm/NetworkManager.h index b5dab8fd..d0dec1a0 100644 --- a/libnm/NetworkManager.h +++ b/libnm/NetworkManager.h @@ -36,10 +36,14 @@ #include #include #include +#include +#include #include #include #include +#include #include +#include #include #include #include @@ -52,33 +56,35 @@ #include #include #include -#include #include +#include #include #include #include #include #include #include -#include -#include #include #include +#include +#include +#include #include #include #include #include +#include #include -#include #include +#include #include #include #include #include #include #include -#include #include +#include #include #include #include diff --git a/libnm/generate-plugin-docs.pl b/libnm/generate-plugin-docs.pl index 35cfdfc6..405c6e11 100755 --- a/libnm/generate-plugin-docs.pl +++ b/libnm/generate-plugin-docs.pl @@ -43,10 +43,6 @@ use strict; use warnings; use v5.10; -#YAML:XS is based on libyaml C library and it is a good and fast YAML implementation. -#However it may not be present everywhere. So use YAML instead. -#use YAML::XS qw(Load); -use YAML qw(Load); # global variables my @keywords = ("property", "variable", "format", "values", "default", "example", "description"); @@ -60,12 +56,12 @@ my $start_tag = "---$plugin---\\s*\$"; my $end_tag = '---end---'; # get source files to scan for documentation comments (nm-setting-.c) -my $file = "$srcdir/Makefile.libnm-core"; +my $file = "$srcdir/Makefile.am"; open my $fh, '<', $file or die "Can't open $file: $!"; while (my $line = <$fh>) { - chomp $line; - my @strings = $line =~ /\/(nm-setting-[^.]*\.c)(?:\s|$)/g; - push @source_files, @strings + if ($line =~ /^\t*(libnm-core\/nm-setting-[^.]*\.c)( \\)?$/g) { + push @source_files, $1; + } } close $fh; @@ -124,35 +120,31 @@ sub scan_doc_comments { close $fi; } -# process plugin property documentation comments (as a YAML document) +# process plugin property documentation comments sub process_data { return if not @data; my $kwd_pat = join("|", @keywords); - my $yaml_literal_seq = "|\n"; + my %parsed_data; + my $this_key; foreach (@data) { - # make a proper YAML document from @data - $_ =~ s/^\s*\**\s+|\s+$//; # remove leading spaces and *, and traling spaces - # Properly indent the text so that it is a valid YAML, and insert | (for literal text) - if ($_ =~ /^($kwd_pat):\s+/) { - # add | after "keyword:" that allows using literal text (YAML won't break on special character) - # http://learnxinyminutes.com/docs/yaml/ and http://www.yaml.org/spec/1.2/spec.html#id2795688 - $_ =~ s/(^($kwd_pat):)/$1 $yaml_literal_seq/; - } else { - $_ = " " . $_; # indent the text + if (/^\s*\**\s+($kwd_pat):\s+(.*?)\s*$/) { + $this_key = $1; + $parsed_data{$this_key} = "$2\n"; + } elsif (/^\s*\**\s+(.*?)\s*$/) { + die "Extra mess in a comment: $_" unless $this_key; + $parsed_data{$this_key} .= "$1\n"; } } - my $str = join ("", @data); - my $yaml_data = Load($str); # now write a line into the XML - my $name = $yaml_data->{property} // ""; - my $var = $yaml_data->{variable} // $name; # fallback to "property: " - my $format = $yaml_data->{format} // ""; - my $values = $yaml_data->{values} // ""; - my $def = $yaml_data->{default} // ""; - my $exam = $yaml_data->{example} // ""; - my $desc = $yaml_data->{description} // ""; + my $name = $parsed_data{property} // ""; + my $var = $parsed_data{variable} // $name; # fallback to "property: " + my $format = $parsed_data{format} // ""; + my $values = $parsed_data{values} // ""; + my $def = $parsed_data{default} // ""; + my $exam = $parsed_data{example} // ""; + my $desc = $parsed_data{description} // ""; chomp($name, $var, $format, $values, $def, $exam, $desc); escape_xml_chars($name, $var, $format, $values, $def, $exam, $desc); diff --git a/libnm/generate-setting-docs.py b/libnm/generate-setting-docs.py index 8265bccd..d2358d9e 100755 --- a/libnm/generate-setting-docs.py +++ b/libnm/generate-setting-docs.py @@ -82,7 +82,7 @@ def init_constants(girxml, settings): for setting in settings: setting_type_name = 'NM' + setting.attrib['name']; setting_name_symbol = 'NM_' + setting.attrib[symbol_prefix_key].upper() + '_SETTING_NAME' - if constants.has_key(setting_name_symbol): + if setting_name_symbol in constants: setting_name = constants[setting_name_symbol] setting_names[setting_type_name] = setting_name @@ -184,7 +184,7 @@ outfile.write(""" """) for settingxml in settings: - if settingxml.attrib.has_key('abstract'): + if 'abstract' in settingxml.attrib: continue new_func = NM.__getattr__(settingxml.attrib['name']) diff --git a/libnm/libnm.ver b/libnm/libnm.ver index cc2fc7df..d0562e2c 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1083,3 +1083,63 @@ global: nm_vpn_plugin_info_new_search_file; nm_vpn_plugin_info_supports_hints; } libnm_1_2_0; + +libnm_1_6_0 { +global: + nm_capability_get_type; + nm_client_get_dns_configuration; + nm_client_get_dns_mode; + nm_client_get_dns_rc_manager; + nm_connection_get_setting_macsec; + nm_connection_get_setting_proxy; + nm_device_macsec_get_cipher_suite; + nm_device_macsec_get_encoding_sa; + nm_device_macsec_get_encrypt; + nm_device_macsec_get_es; + nm_device_macsec_get_hw_address; + nm_device_macsec_get_icv_length; + nm_device_macsec_get_include_sci; + nm_device_macsec_get_protect; + nm_device_macsec_get_replay_protect; + nm_device_macsec_get_scb; + nm_device_macsec_get_sci; + nm_device_macsec_get_type; + nm_device_macsec_get_validation; + nm_device_macsec_get_window; + nm_dns_entry_get_domains; + nm_dns_entry_get_interface; + nm_dns_entry_get_nameservers; + nm_dns_entry_get_priority; + nm_dns_entry_get_type; + nm_dns_entry_get_vpn; + nm_dns_entry_unref; + nm_setting_connection_get_autoconnect_retries; + nm_setting_macsec_get_encrypt; + nm_setting_macsec_get_mka_cak; + nm_setting_macsec_get_mka_cak_flags; + nm_setting_macsec_get_mka_ckn; + nm_setting_macsec_get_mode; + nm_setting_macsec_get_parent; + nm_setting_macsec_get_port; + nm_setting_macsec_get_type; + nm_setting_macsec_get_validation; + nm_setting_macsec_mode_get_type; + nm_setting_macsec_new; + nm_setting_macsec_validation_get_type; + nm_setting_proxy_get_type; + nm_setting_proxy_new; + nm_setting_proxy_get_method; + nm_setting_proxy_method_get_type; + nm_setting_proxy_get_browser_only; + nm_setting_proxy_get_pac_url; + nm_setting_proxy_get_pac_script; + nm_setting_802_1x_get_ca_cert_uri; + nm_setting_802_1x_get_phase2_ca_cert_uri; + nm_setting_802_1x_get_client_cert_uri; + nm_setting_802_1x_get_phase2_client_cert_uri; + nm_setting_802_1x_get_private_key_uri; + nm_setting_802_1x_get_phase2_private_key_uri; + nm_utils_is_json_object; + nm_utils_version; + nm_utils_is_valid_iface_name; +} libnm_1_4_0; diff --git a/libnm/nm-access-point.c b/libnm/nm-access-point.c index d1dd1c3f..60b8e33d 100644 --- a/libnm/nm-access-point.c +++ b/libnm/nm-access-point.c @@ -170,7 +170,7 @@ nm_access_point_get_bssid (NMAccessPoint *ap) { g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL); - return NM_ACCESS_POINT_GET_PRIVATE (ap)->bssid; + return nm_str_not_empty (NM_ACCESS_POINT_GET_PRIVATE (ap)->bssid); } /** @@ -381,7 +381,7 @@ nm_access_point_filter_connections (NMAccessPoint *ap, const GPtrArray *connecti return filtered; } -/************************************************************/ +/*****************************************************************************/ static void nm_access_point_init (NMAccessPoint *ap) @@ -485,8 +485,6 @@ nm_access_point_class_init (NMAccessPointClass *ap_class) g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_ACCESS_POINT); - /* virtual methods */ object_class->get_property = get_property; object_class->finalize = finalize; diff --git a/libnm/nm-active-connection.c b/libnm/nm-active-connection.c index a1636598..6a823403 100644 --- a/libnm/nm-active-connection.c +++ b/libnm/nm-active-connection.c @@ -28,7 +28,6 @@ #include "nm-object-private.h" #include "nm-core-internal.h" #include "nm-device.h" -#include "nm-device-private.h" #include "nm-connection.h" #include "nm-vpn-connection.h" #include "nm-dbus-helpers.h" @@ -38,14 +37,7 @@ #include "nm-ip6-config.h" #include "nm-remote-connection.h" -static GType _nm_active_connection_decide_type (GVariant *value); - -G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT, - _nm_object_register_type_func (g_define_type_id, - _nm_active_connection_decide_type, - NM_DBUS_INTERFACE_ACTIVE_CONNECTION, - "Vpn"); - ) +G_DEFINE_TYPE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT); #define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate)) @@ -88,16 +80,6 @@ enum { LAST_PROP }; -static GType -_nm_active_connection_decide_type (GVariant *value) -{ - /* @value is the value of the o.fd.NM.ActiveConnection property "VPN" */ - if (g_variant_get_boolean (value)) - return NM_TYPE_VPN_CONNECTION; - else - return NM_TYPE_ACTIVE_CONNECTION; -} - /** * nm_active_connection_get_connection: * @connection: a #NMActiveConnection @@ -129,7 +111,7 @@ nm_active_connection_get_id (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id; + return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id); } /** @@ -146,7 +128,7 @@ nm_active_connection_get_uuid (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid; + return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid); } /** @@ -163,7 +145,7 @@ nm_active_connection_get_connection_type (NMActiveConnection *connection) { g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL); - return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type; + return nm_str_not_empty (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type); } /** @@ -461,6 +443,7 @@ get_property (GObject *object, static gboolean demarshal_specific_object_path (NMObject *object, GParamSpec *pspec, GVariant *value, gpointer field) { + const char *v; char **param = (char **) field; /* We have to demarshal this manually, because the D-Bus property name @@ -471,8 +454,10 @@ demarshal_specific_object_path (NMObject *object, GParamSpec *pspec, GVariant *v if (!g_variant_is_of_type (value, G_VARIANT_TYPE_OBJECT_PATH)) return FALSE; + v = g_variant_get_string (value, NULL); + g_free (*param); - *param = g_variant_dup_string (value, NULL); + *param = nm_streq0 (v, "/") ? NULL : g_strdup (v); return TRUE; } @@ -516,8 +501,6 @@ nm_active_connection_class_init (NMActiveConnectionClass *ap_class) g_type_class_add_private (ap_class, sizeof (NMActiveConnectionPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_ACTIVE_CONNECTION); - /* virtual methods */ object_class->get_property = get_property; object_class->dispose = dispose; diff --git a/libnm/nm-client.c b/libnm/nm-client.c index 64c0d9de..63eaa84c 100644 --- a/libnm/nm-client.c +++ b/libnm/nm-client.c @@ -26,16 +26,55 @@ #include "nm-utils.h" #include "nm-client.h" #include "nm-manager.h" +#include "nm-dns-manager.h" #include "nm-remote-settings.h" #include "nm-device-ethernet.h" #include "nm-device-wifi.h" -#include "nm-device-private.h" #include "nm-core-internal.h" #include "nm-active-connection.h" #include "nm-vpn-connection.h" #include "nm-remote-connection.h" -#include "nm-object-cache.h" #include "nm-dbus-helpers.h" +#include "nm-wimax-nsp.h" +#include "nm-object-private.h" + +#include "introspection/org.freedesktop.NetworkManager.h" +#include "introspection/org.freedesktop.NetworkManager.Device.Wireless.h" +#include "introspection/org.freedesktop.NetworkManager.Device.h" +#include "introspection/org.freedesktop.NetworkManager.DnsManager.h" +#include "introspection/org.freedesktop.NetworkManager.Settings.h" +#include "introspection/org.freedesktop.NetworkManager.Settings.Connection.h" +#include "introspection/org.freedesktop.NetworkManager.VPN.Connection.h" + +#include "nm-access-point.h" +#include "nm-active-connection.h" +#include "nm-device-adsl.h" +#include "nm-device-bond.h" +#include "nm-device-bridge.h" +#include "nm-device-bt.h" +#include "nm-device-ethernet.h" +#include "nm-device-generic.h" +#include "nm-device-infiniband.h" +#include "nm-device-ip-tunnel.h" +#include "nm-device-macsec.h" +#include "nm-device-macvlan.h" +#include "nm-device-modem.h" +#include "nm-device-olpc-mesh.h" +#include "nm-device-team.h" +#include "nm-device-tun.h" +#include "nm-device-vlan.h" +#include "nm-device-vxlan.h" +#include "nm-device-wifi.h" +#include "nm-device-wimax.h" +#include "nm-dhcp4-config.h" +#include "nm-dhcp6-config.h" +#include "nm-dhcp-config.h" +#include "nm-ip4-config.h" +#include "nm-ip6-config.h" +#include "nm-manager.h" +#include "nm-remote-connection.h" +#include "nm-remote-settings.h" +#include "nm-vpn-connection.h" void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled); @@ -52,6 +91,9 @@ G_DEFINE_TYPE_WITH_CODE (NMClient, nm_client, G_TYPE_OBJECT, typedef struct { NMManager *manager; NMRemoteSettings *settings; + NMDnsManager *dns_manager; + GDBusObjectManager *object_manager; + GCancellable *new_object_manager_cancellable; } NMClientPrivate; enum { @@ -77,6 +119,9 @@ enum { PROP_HOSTNAME, PROP_CAN_MODIFY, PROP_METERED, + PROP_DNS_MODE, + PROP_DNS_RC_MANAGER, + PROP_DNS_CONFIGURATION, LAST_PROP }; @@ -97,7 +142,9 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -/**********************************************************************/ +static const GPtrArray empty = { 0, }; + +/*****************************************************************************/ /** * nm_client_error_quark: @@ -116,7 +163,7 @@ nm_client_error_quark (void) return quark; } -/**********************************************************************/ +/*****************************************************************************/ static void nm_client_init (NMClient *client) @@ -150,6 +197,9 @@ nm_client_get_version (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return NULL; + return nm_manager_get_version (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -166,6 +216,9 @@ nm_client_get_state (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NM_STATE_UNKNOWN); + if (!nm_client_get_nm_running (client)) + return NM_STATE_UNKNOWN; + return nm_manager_get_state (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -181,7 +234,10 @@ nm_client_get_state (NMClient *client) gboolean nm_client_get_startup (NMClient *client) { - g_return_val_if_fail (NM_IS_CLIENT (client), NM_STATE_UNKNOWN); + g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + + if (!nm_client_get_nm_running (client)) + return FALSE; return nm_manager_get_startup (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -199,7 +255,7 @@ nm_client_get_nm_running (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); - return nm_manager_get_nm_running (NM_CLIENT_GET_PRIVATE (client)->manager); + return NM_CLIENT_GET_PRIVATE (client)->manager != NULL; } /** @@ -215,6 +271,9 @@ nm_client_networking_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_networking_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -255,6 +314,9 @@ nm_client_wireless_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_wireless_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -270,7 +332,7 @@ nm_client_wireless_set_enabled (NMClient *client, gboolean enabled) { g_return_if_fail (NM_IS_CLIENT (client)); - if (!_nm_client_check_nm_running (client, NULL)) + if (!nm_client_get_nm_running (client)) return; nm_manager_wireless_set_enabled (NM_CLIENT_GET_PRIVATE (client)->manager, enabled); @@ -289,6 +351,9 @@ nm_client_wireless_hardware_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_wireless_hardware_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -305,6 +370,9 @@ nm_client_wwan_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_wwan_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -339,6 +407,9 @@ nm_client_wwan_hardware_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_wwan_hardware_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -355,6 +426,9 @@ nm_client_wimax_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_wimax_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -370,7 +444,7 @@ nm_client_wimax_set_enabled (NMClient *client, gboolean enabled) { g_return_if_fail (NM_IS_CLIENT (client)); - if (!_nm_client_check_nm_running (client, NULL)) + if (!nm_client_get_nm_running (client)) return; nm_manager_wimax_set_enabled (NM_CLIENT_GET_PRIVATE (client)->manager, enabled); @@ -389,6 +463,9 @@ nm_client_wimax_hardware_get_enabled (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!nm_client_get_nm_running (client)) + return FALSE; + return nm_manager_wimax_hardware_get_enabled (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -459,6 +536,9 @@ nm_client_get_permission_result (NMClient *client, NMClientPermission permission { g_return_val_if_fail (NM_IS_CLIENT (client), NM_CLIENT_PERMISSION_RESULT_UNKNOWN); + if (!nm_client_get_nm_running (client)) + return NM_CLIENT_PERMISSION_RESULT_UNKNOWN; + return nm_manager_get_permission_result (NM_CLIENT_GET_PRIVATE (client)->manager, permission); } @@ -478,6 +558,9 @@ nm_client_get_connectivity (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NM_CONNECTIVITY_UNKNOWN); + if (!nm_client_get_nm_running (client)) + return NM_CONNECTIVITY_UNKNOWN; + return nm_manager_get_connectivity (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -614,6 +697,9 @@ nm_client_save_hostname (NMClient *client, { g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); + if (!_nm_client_check_nm_running (client, error)) + return FALSE; + return nm_remote_settings_save_hostname (NM_CLIENT_GET_PRIVATE (client)->settings, hostname, cancellable, error); } @@ -698,9 +784,9 @@ nm_client_save_hostname_finish (NMClient *client, return g_simple_async_result_get_op_res_gboolean (simple); } -/****************************************************************/ +/*****************************************************************************/ /* Devices */ -/****************************************************************/ +/*****************************************************************************/ /** * nm_client_get_devices: @@ -720,6 +806,9 @@ nm_client_get_devices (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return ∅ + return nm_manager_get_devices (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -748,6 +837,9 @@ nm_client_get_all_devices (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return ∅ + return nm_manager_get_all_devices (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -766,6 +858,9 @@ nm_client_get_device_by_path (NMClient *client, const char *object_path) g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (object_path, NULL); + if (!nm_client_get_nm_running (client)) + return NULL; + return nm_manager_get_device_by_path (NM_CLIENT_GET_PRIVATE (client)->manager, object_path); } @@ -784,12 +879,15 @@ nm_client_get_device_by_iface (NMClient *client, const char *iface) g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (iface, NULL); + if (!nm_client_get_nm_running (client)) + return NULL; + return nm_manager_get_device_by_iface (NM_CLIENT_GET_PRIVATE (client)->manager, iface); } -/****************************************************************/ +/*****************************************************************************/ /* Active Connections */ -/****************************************************************/ +/*****************************************************************************/ /** * nm_client_get_active_connections: @@ -806,6 +904,9 @@ nm_client_get_active_connections (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return ∅ + return nm_manager_get_active_connections (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -833,6 +934,9 @@ nm_client_get_primary_connection (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return NULL; + return nm_manager_get_primary_connection (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -852,6 +956,9 @@ nm_client_get_activating_connection (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return NULL; + return nm_manager_get_activating_connection (NM_CLIENT_GET_PRIVATE (client)->manager); } @@ -1093,7 +1200,7 @@ nm_client_deactivate_connection (NMClient *client, g_return_val_if_fail (NM_IS_CLIENT (client), FALSE); g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE); - if (!_nm_client_check_nm_running (client, NULL)) + if (!nm_client_get_nm_running (client)) return TRUE; return nm_manager_deactivate_connection (NM_CLIENT_GET_PRIVATE (client)->manager, @@ -1180,9 +1287,9 @@ nm_client_deactivate_connection_finish (NMClient *client, return g_simple_async_result_get_op_res_gboolean (simple); } -/****************************************************************/ +/*****************************************************************************/ /* Connections */ -/****************************************************************/ +/*****************************************************************************/ /** * nm_client_get_connections: @@ -1200,6 +1307,9 @@ nm_client_get_connections (NMClient *client) { g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + if (!nm_client_get_nm_running (client)) + return ∅ + return nm_remote_settings_get_connections (NM_CLIENT_GET_PRIVATE (client)->settings); } @@ -1222,6 +1332,9 @@ nm_client_get_connection_by_id (NMClient *client, const char *id) g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (id != NULL, NULL); + if (!nm_client_get_nm_running (client)) + NULL; + return nm_remote_settings_get_connection_by_id (NM_CLIENT_GET_PRIVATE (client)->settings, id); } @@ -1244,6 +1357,9 @@ nm_client_get_connection_by_path (NMClient *client, const char *path) g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (path != NULL, NULL); + if (!nm_client_get_nm_running (client)) + NULL; + return nm_remote_settings_get_connection_by_path (NM_CLIENT_GET_PRIVATE (client)->settings, path); } @@ -1266,6 +1382,9 @@ nm_client_get_connection_by_uuid (NMClient *client, const char *uuid) g_return_val_if_fail (NM_IS_CLIENT (client), NULL); g_return_val_if_fail (uuid != NULL, NULL); + if (!nm_client_get_nm_running (client)) + NULL; + return nm_remote_settings_get_connection_by_uuid (NM_CLIENT_GET_PRIVATE (client)->settings, uuid); } @@ -1602,7 +1721,86 @@ nm_client_reload_connections_finish (NMClient *client, return g_simple_async_result_get_op_res_gboolean (simple); } -/****************************************************************/ +/*****************************************************************************/ + +/** + * nm_client_get_dns_mode: + * @client: the #NMClient + * + * Gets the current DNS processing mode. + * + * Return value: the DNS processing mode, or %NULL in case the + * value is not available. + * + * Since: 1.6 + **/ +const char * +nm_client_get_dns_mode (NMClient *client) +{ + NMClientPrivate *priv; + + g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + priv = NM_CLIENT_GET_PRIVATE (client); + + if (priv->dns_manager) + return nm_dns_manager_get_mode (priv->dns_manager); + else + return NULL; +} + +/** + * nm_client_get_dns_rc_manager: + * @client: the #NMClient + * + * Gets the current DNS resolv.conf manager. + * + * Return value: the resolv.conf manager or %NULL in case the + * value is not available. + * + * Since: 1.6 + **/ +const char * +nm_client_get_dns_rc_manager (NMClient *client) +{ + NMClientPrivate *priv; + + g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + priv = NM_CLIENT_GET_PRIVATE (client); + + if (priv->dns_manager) + return nm_dns_manager_get_rc_manager (priv->dns_manager); + else + return NULL; +} + +/** + * nm_client_get_dns_configuration: + * @client: a #NMClient + * + * Gets the current DNS configuration + * + * Returns: (transfer none) (element-type NMDnsEntry): a #GPtrArray + * containing #NMDnsEntry elements or %NULL in case the value is not + * available. The returned array is owned by the #NMClient object + * and should not be modified. + * + * Since: 1.6 + **/ +const GPtrArray * +nm_client_get_dns_configuration (NMClient *client) +{ + NMClientPrivate *priv; + + g_return_val_if_fail (NM_IS_CLIENT (client), NULL); + priv = NM_CLIENT_GET_PRIVATE (client); + + if (priv->dns_manager) + return nm_dns_manager_get_configuration (priv->dns_manager); + else + return NULL; +} + +/*****************************************************************************/ /** * nm_client_new: @@ -1770,14 +1968,222 @@ manager_active_connection_removed (NMManager *manager, } static void -constructed (GObject *object) +dns_notify (GObject *object, + GParamSpec *pspec, + gpointer client) +{ + char pname[128]; + + if (NM_IN_STRSET (pspec->name, + NM_DNS_MANAGER_MODE, + NM_DNS_MANAGER_RC_MANAGER, + NM_DNS_MANAGER_CONFIGURATION)) { + nm_sprintf_buf (pname, "dns-%s", pspec->name); + g_object_notify (client, pname); + } +} + +/****************************************************************/ +/* Object Initialization */ +/****************************************************************/ + +static GType +proxy_type (GDBusObjectManagerClient *manager, + const gchar *object_path, + const gchar *interface_name, + gpointer user_data) +{ + /* ObjectManager asks us for an object proxy. Unfortunatelly, we can't + * decide that by interface name and GDBusObjectManager doesn't allow + * us to look at the known interface list. Thus we need to create a + * generic GDBusObject and only couple a NMObject subclass later. */ + if (!interface_name) + return G_TYPE_DBUS_OBJECT_PROXY; + + /* An interface proxy */ + if (strcmp (interface_name, NM_DBUS_INTERFACE) == 0) + return NMDBUS_TYPE_MANAGER_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_DEVICE_WIRELESS) == 0) + return NMDBUS_TYPE_DEVICE_WIFI_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_DEVICE) == 0) + return NMDBUS_TYPE_DEVICE_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_SETTINGS_CONNECTION) == 0) + return NMDBUS_TYPE_SETTINGS_CONNECTION_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_SETTINGS) == 0) + return NMDBUS_TYPE_SETTINGS_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_DNS_MANAGER) == 0) + return NMDBUS_TYPE_DNS_MANAGER_PROXY; + else if (strcmp (interface_name, NM_DBUS_INTERFACE_VPN_CONNECTION) == 0) + return NMDBUS_TYPE_VPN_CONNECTION_PROXY; + + /* Use a generic D-Bus Proxy whenever we can. The typed GDBusProxy + * subclasses actually use quite some memory, so they're better avoided. */ + return G_TYPE_DBUS_PROXY; +} + +static NMObject * +obj_nm_for_gdbus_object (GDBusObject *object, GDBusObjectManager *object_manager) +{ + GList *interfaces; + GList *l; + GType type = G_TYPE_INVALID; + NMObject *obj_nm; + + g_return_val_if_fail (G_IS_DBUS_OBJECT_PROXY (object), NULL); + + interfaces = g_dbus_object_get_interfaces (object); + for (l = interfaces; l; l = l->next) { + GDBusProxy *proxy = G_DBUS_PROXY (l->data); + const char *ifname = g_dbus_proxy_get_interface_name (proxy); + + /* This is a performance/scalability hack. It makes sense to call it + * from here, since this is in the common object creation path. */ + _nm_dbus_proxy_replace_match (proxy); + + if (strcmp (ifname, NM_DBUS_INTERFACE) == 0) + type = NM_TYPE_MANAGER; + else if (strcmp (ifname, NM_DBUS_INTERFACE_ACCESS_POINT) == 0) + type = NM_TYPE_ACCESS_POINT; + else if (strcmp (ifname, NM_DBUS_INTERFACE_ACTIVE_CONNECTION) == 0 && type != NM_TYPE_VPN_CONNECTION) + type = NM_TYPE_ACTIVE_CONNECTION; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_ADSL) == 0) + type = NM_TYPE_DEVICE_ADSL; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_BOND) == 0) + type = NM_TYPE_DEVICE_BOND; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_BRIDGE) == 0) + type = NM_TYPE_DEVICE_BRIDGE; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH) == 0) + type = NM_TYPE_DEVICE_BT; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_WIRED) == 0) + type = NM_TYPE_DEVICE_ETHERNET; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_GENERIC) == 0) + type = NM_TYPE_DEVICE_GENERIC; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_INFINIBAND) == 0) + type = NM_TYPE_DEVICE_INFINIBAND; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL) == 0) + type = NM_TYPE_DEVICE_IP_TUNNEL; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_MACSEC) == 0) + type = NM_TYPE_DEVICE_MACSEC; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_MACVLAN) == 0) + type = NM_TYPE_DEVICE_MACVLAN; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_MODEM) == 0) + type = NM_TYPE_DEVICE_MODEM; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_OLPC_MESH) == 0) + type = NM_TYPE_DEVICE_OLPC_MESH; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_TEAM) == 0) + type = NM_TYPE_DEVICE_TEAM; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_TUN) == 0) + type = NM_TYPE_DEVICE_TUN; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_VLAN) == 0) + type = NM_TYPE_DEVICE_VLAN; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_VXLAN) == 0) + type = NM_TYPE_DEVICE_VXLAN; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_WIRELESS) == 0) + type = NM_TYPE_DEVICE_WIFI; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DEVICE_WIMAX) == 0) + type = NM_TYPE_DEVICE_WIMAX; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DHCP4_CONFIG) == 0) + type = NM_TYPE_DHCP4_CONFIG; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DHCP6_CONFIG) == 0) + type = NM_TYPE_DHCP6_CONFIG; + else if (strcmp (ifname, NM_DBUS_INTERFACE_IP4_CONFIG) == 0) + type = NM_TYPE_IP4_CONFIG; + else if (strcmp (ifname, NM_DBUS_INTERFACE_IP6_CONFIG) == 0) + type = NM_TYPE_IP6_CONFIG; + else if (strcmp (ifname, NM_DBUS_INTERFACE_SETTINGS_CONNECTION) == 0) + type = NM_TYPE_REMOTE_CONNECTION; + else if (strcmp (ifname, NM_DBUS_INTERFACE_SETTINGS) == 0) + type = NM_TYPE_REMOTE_SETTINGS; + else if (strcmp (ifname, NM_DBUS_INTERFACE_DNS_MANAGER) == 0) + type = NM_TYPE_DNS_MANAGER; + else if (strcmp (ifname, NM_DBUS_INTERFACE_VPN_CONNECTION) == 0) + type = NM_TYPE_VPN_CONNECTION; + else if (strcmp (ifname, NM_DBUS_INTERFACE_WIMAX_NSP) == 0) + type = NM_TYPE_WIMAX_NSP; + + if (type != G_TYPE_INVALID) + break; + } + + g_list_free_full (interfaces, g_object_unref); + if (type == G_TYPE_INVALID) + return NULL; + + obj_nm = g_object_new (type, + NM_OBJECT_DBUS_OBJECT, object, + NM_OBJECT_DBUS_OBJECT_MANAGER, object_manager, + NULL); + g_object_set_qdata_full (G_OBJECT (object), _nm_object_obj_nm_quark (), + obj_nm, g_object_unref); + return obj_nm; +} + +static void +obj_nm_inited (GObject *object, GAsyncResult *result, gpointer user_data) +{ + if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, NULL)) { + /* This is a can-not-happen situation, the NMObject subclasses are not + * supposed to fail initialization. */ + g_warn_if_reached (); + } +} + + +static void +object_added (GDBusObjectManager *object_manager, GDBusObject *object, gpointer user_data) +{ + NMObject *obj_nm; + + obj_nm = obj_nm_for_gdbus_object (object, object_manager); + if (obj_nm) { + g_async_initable_init_async (G_ASYNC_INITABLE (obj_nm), + G_PRIORITY_DEFAULT, NULL, + obj_nm_inited, NULL); + } +} + +static void +object_removed (GDBusObjectManager *object_manager, GDBusObject *object, gpointer user_data) +{ + g_object_set_qdata (G_OBJECT (object), _nm_object_obj_nm_quark (), NULL); +} + +static gboolean +objects_created (NMClient *client, GDBusObjectManager *object_manager, GError **error) { - NMClient *client = NM_CLIENT (object); NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (client); + gs_unref_object GDBusObject *manager = NULL; + gs_unref_object GDBusObject *settings = NULL; + gs_unref_object GDBusObject *dns_manager = NULL; + NMObject *obj_nm; + GList *objects, *iter; + + /* First just ensure all the NMObjects for known GDBusObjects exist. */ + objects = g_dbus_object_manager_get_objects (object_manager); + for (iter = objects; iter; iter = iter->next) + obj_nm_for_gdbus_object (iter->data, object_manager); + g_list_free_full (objects, g_object_unref); + + manager = g_dbus_object_manager_get_object (object_manager, NM_DBUS_PATH); + if (!manager) { + g_set_error_literal (error, + NM_CLIENT_ERROR, + NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, + "Manager object not found"); + return FALSE; + } + + obj_nm = g_object_get_qdata (G_OBJECT (manager), _nm_object_obj_nm_quark ()); + if (!obj_nm) { + g_set_error_literal (error, + NM_CLIENT_ERROR, + NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, + "Manager object lacks the proper interface"); + return FALSE; + } + + priv->manager = NM_MANAGER (g_object_ref (obj_nm)); - priv->manager = g_object_new (NM_TYPE_MANAGER, - NM_OBJECT_PATH, NM_DBUS_PATH, - NULL); g_signal_connect (priv->manager, "notify", G_CALLBACK (subobject_notify), client); g_signal_connect (priv->manager, "device-added", @@ -1795,9 +2201,26 @@ constructed (GObject *object) g_signal_connect (priv->manager, "active-connection-removed", G_CALLBACK (manager_active_connection_removed), client); - priv->settings = g_object_new (NM_TYPE_REMOTE_SETTINGS, - NM_OBJECT_PATH, NM_DBUS_PATH_SETTINGS, - NULL); + settings = g_dbus_object_manager_get_object (object_manager, NM_DBUS_PATH_SETTINGS); + if (!settings) { + g_set_error_literal (error, + NM_CLIENT_ERROR, + NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, + "Settings object not found"); + return FALSE; + } + + obj_nm = g_object_get_qdata (G_OBJECT (settings), _nm_object_obj_nm_quark ()); + if (!obj_nm) { + g_set_error_literal (error, + NM_CLIENT_ERROR, + NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, + "Settings object lacks the proper interface"); + return FALSE; + } + + priv->settings = NM_REMOTE_SETTINGS (g_object_ref (obj_nm)); + g_signal_connect (priv->settings, "notify", G_CALLBACK (subobject_notify), client); g_signal_connect (priv->settings, "connection-added", @@ -1805,29 +2228,91 @@ constructed (GObject *object) g_signal_connect (priv->settings, "connection-removed", G_CALLBACK (settings_connection_removed), client); - G_OBJECT_CLASS (nm_client_parent_class)->constructed (object); + dns_manager = g_dbus_object_manager_get_object (object_manager, NM_DBUS_PATH_DNS_MANAGER); + if (dns_manager) { + obj_nm = g_object_get_qdata (G_OBJECT (dns_manager), _nm_object_obj_nm_quark ()); + if (!obj_nm) { + g_set_error_literal (error, + NM_CLIENT_ERROR, + NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, + "DNS manager object lacks the proper interface"); + return FALSE; + } + priv->dns_manager = NM_DNS_MANAGER (g_object_ref (obj_nm)); + + g_signal_connect (priv->dns_manager, "notify", + G_CALLBACK (dns_notify), client); + } + + + /* The handlers don't really use the client instance. However + * it makes it convenient to unhook them by data. */ + g_signal_connect (object_manager, "object-added", + G_CALLBACK (object_added), client); + g_signal_connect (object_manager, "object-removed", + G_CALLBACK (object_removed), client); + + return TRUE; } +/* Synchronous initialization. */ + +static void name_owner_changed (GObject *object, GParamSpec *pspec, gpointer user_data); + static gboolean init_sync (GInitable *initable, GCancellable *cancellable, GError **error) { NMClient *client = NM_CLIENT (initable); NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (client); + GList *objects, *iter; + gchar *name_owner; - if (!g_initable_init (G_INITABLE (priv->manager), cancellable, error)) - return FALSE; - if (!g_initable_init (G_INITABLE (priv->settings), cancellable, error)) + priv->object_manager = g_dbus_object_manager_client_new_for_bus_sync (_nm_dbus_bus_type (), + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START, + "org.freedesktop.NetworkManager", + "/org/freedesktop", + proxy_type, NULL, NULL, + cancellable, error); + + if (!priv->object_manager) return FALSE; + name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager)); + if (name_owner) { + g_free (name_owner); + if (!objects_created (client, priv->object_manager, error)) + return FALSE; + + objects = g_dbus_object_manager_get_objects (priv->object_manager); + for (iter = objects; iter; iter = iter->next) { + NMObject *obj_nm; + + obj_nm = g_object_get_qdata (iter->data, _nm_object_obj_nm_quark ()); + if (!obj_nm) + continue; + + if (!g_initable_init (G_INITABLE (obj_nm), cancellable, NULL)) { + /* This is a can-not-happen situation, the NMObject subclasses are not + * supposed to fail initialization. */ + g_warn_if_reached (); + } + } + g_list_free_full (objects, g_object_unref); + } + + g_signal_connect (priv->object_manager, "notify::name-owner", + G_CALLBACK (name_owner_changed), client); + return TRUE; } +/* Asynchronous initialization. */ + typedef struct { NMClient *client; GCancellable *cancellable; GSimpleAsyncResult *result; - gboolean manager_inited; - gboolean settings_inited; + int pending_init; } NMClientInitData; static void @@ -1840,7 +2325,7 @@ init_async_complete (NMClientInitData *init_data) } static void -init_async_inited_manager (GObject *object, GAsyncResult *result, gpointer user_data) +async_inited_obj_nm (GObject *object, GAsyncResult *result, gpointer user_data) { NMClientInitData *init_data = user_data; GError *error = NULL; @@ -1848,46 +2333,185 @@ init_async_inited_manager (GObject *object, GAsyncResult *result, gpointer user_ if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) g_simple_async_result_take_error (init_data->result, error); - init_data->manager_inited = TRUE; - if (init_data->settings_inited) - init_async_complete (init_data); + if (init_data) { + init_data->pending_init--; + if (init_data->pending_init == 0) + init_async_complete (init_data); + } +} + +static void +init_async (GAsyncInitable *initable, int io_priority, + GCancellable *cancellable, GAsyncReadyCallback callback, + gpointer user_data); + +static void +unhook_om (NMClient *self) +{ + NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (self); + GList *objects, *iter; + + if (priv->manager) { + const GPtrArray *active_connections; + const GPtrArray *devices; + int i; + + active_connections = nm_manager_get_active_connections (priv->manager); + for (i = 0; i < active_connections->len; i++) + g_signal_emit (self, signals[ACTIVE_CONNECTION_REMOVED], 0, active_connections->pdata[i]); + + devices = nm_manager_get_all_devices (priv->manager); + for (i = 0; i < devices->len; i++) + g_signal_emit (self, signals[DEVICE_REMOVED], 0, devices->pdata[i]); + + g_signal_handlers_disconnect_by_data (priv->manager, self); + g_clear_object (&priv->manager); + g_object_notify (G_OBJECT (self), NM_CLIENT_ACTIVE_CONNECTIONS); + g_object_notify (G_OBJECT (self), NM_CLIENT_NM_RUNNING); + } + if (priv->settings) { + const GPtrArray *connections; + guint i; + + connections = nm_remote_settings_get_connections (priv->settings); + for (i = 0; i < connections->len; i++) + g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connections->pdata[i]); + + g_signal_handlers_disconnect_by_data (priv->settings, self); + g_clear_object (&priv->settings); + g_object_notify (G_OBJECT (self), NM_CLIENT_CONNECTIONS); + g_object_notify (G_OBJECT (self), NM_CLIENT_HOSTNAME); + g_object_notify (G_OBJECT (self), NM_CLIENT_CAN_MODIFY); + } + if (priv->dns_manager) { + g_signal_handlers_disconnect_by_data (priv->dns_manager, self); + g_clear_object (&priv->dns_manager); + } + + objects = g_dbus_object_manager_get_objects (priv->object_manager); + for (iter = objects; iter; iter = iter->next) + g_object_set_qdata (iter->data, _nm_object_obj_nm_quark (), NULL); + g_list_free_full (objects, g_object_unref); } static void -init_async_inited_settings (GObject *object, GAsyncResult *result, gpointer user_data) +new_object_manager (GObject *source_object, GAsyncResult *res, gpointer user_data) +{ + NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (source_object); + + g_object_notify (G_OBJECT (user_data), NM_CLIENT_NM_RUNNING); + g_clear_object (&priv->new_object_manager_cancellable); +} + +static void +got_object_manager (GObject *object, GAsyncResult *result, gpointer user_data) { NMClientInitData *init_data = user_data; + NMClient *client; + NMClientPrivate *priv; + GList *objects, *iter; + gchar *name_owner; GError *error = NULL; + GDBusObjectManager *object_manager; + + object_manager = g_dbus_object_manager_client_new_for_bus_finish (result, &error); + if (object_manager == NULL) { + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_simple_async_result_take_error (init_data->result, error); + init_async_complete (init_data); + } + return; + } - if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) - g_simple_async_result_take_error (init_data->result, error); - - init_data->settings_inited = TRUE; - if (init_data->manager_inited) + client = init_data->client; + priv = NM_CLIENT_GET_PRIVATE (client); + priv->object_manager = object_manager; + + name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager)); + if (name_owner) { + g_free (name_owner); + if (!objects_created (client, priv->object_manager, &error)) { + g_simple_async_result_take_error (init_data->result, error); + init_async_complete (init_data); + return; + } + + objects = g_dbus_object_manager_get_objects (priv->object_manager); + for (iter = objects; iter; iter = iter->next) { + NMObject *obj_nm; + + obj_nm = g_object_get_qdata (iter->data, _nm_object_obj_nm_quark ()); + if (!obj_nm) + continue; + + init_data->pending_init++; + g_async_initable_init_async (G_ASYNC_INITABLE (obj_nm), + G_PRIORITY_DEFAULT, init_data->cancellable, + async_inited_obj_nm, init_data); + } + g_list_free_full (objects, g_object_unref); + + } else init_async_complete (init_data); + + g_signal_connect (priv->object_manager, "notify::name-owner", + G_CALLBACK (name_owner_changed), client); } static void -init_async (GAsyncInitable *initable, int io_priority, - GCancellable *cancellable, GAsyncReadyCallback callback, - gpointer user_data) +prepare_object_manager (NMClient *client, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) { - NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (initable); NMClientInitData *init_data; init_data = g_slice_new0 (NMClientInitData); - init_data->client = NM_CLIENT (initable); + init_data->client = client; init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback, + init_data->result = g_simple_async_result_new (G_OBJECT (client), callback, user_data, init_async); g_simple_async_result_set_op_res_gboolean (init_data->result, TRUE); - g_async_initable_init_async (G_ASYNC_INITABLE (priv->manager), - G_PRIORITY_DEFAULT, init_data->cancellable, - init_async_inited_manager, init_data); - g_async_initable_init_async (G_ASYNC_INITABLE (priv->settings), - G_PRIORITY_DEFAULT, init_data->cancellable, - init_async_inited_settings, init_data); + g_dbus_object_manager_client_new_for_bus (_nm_dbus_bus_type (), + G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_DO_NOT_AUTO_START, + "org.freedesktop.NetworkManager", + "/org/freedesktop", + proxy_type, NULL, NULL, + init_data->cancellable, + got_object_manager, + init_data); +} + +static void +name_owner_changed (GObject *object, GParamSpec *pspec, gpointer user_data) +{ + NMClient *self = user_data; + NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (self); + GDBusObjectManager *object_manager = G_DBUS_OBJECT_MANAGER (object); + gchar *name_owner; + + name_owner = g_dbus_object_manager_client_get_name_owner (G_DBUS_OBJECT_MANAGER_CLIENT (object)); + if (name_owner) { + g_free (name_owner); + g_object_unref (object_manager); + if (priv->new_object_manager_cancellable) + g_cancellable_cancel (priv->new_object_manager_cancellable); + priv->new_object_manager_cancellable = g_cancellable_new (); + prepare_object_manager (self, priv->new_object_manager_cancellable, + new_object_manager, user_data); + } else { + g_signal_handlers_disconnect_by_func (object_manager, object_added, self); + unhook_om (self); + } +} + +static void +init_async (GAsyncInitable *initable, int io_priority, + GCancellable *cancellable, GAsyncReadyCallback callback, + gpointer user_data) +{ + prepare_object_manager (NM_CLIENT (initable), cancellable, callback, user_data); } static gboolean @@ -1906,15 +2530,39 @@ dispose (GObject *object) { NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object); + if (priv->new_object_manager_cancellable) { + g_cancellable_cancel (priv->new_object_manager_cancellable); + g_clear_object (&priv->new_object_manager_cancellable); + } + if (priv->manager) { g_signal_handlers_disconnect_by_data (priv->manager, object); g_clear_object (&priv->manager); } + if (priv->settings) { g_signal_handlers_disconnect_by_data (priv->settings, object); g_clear_object (&priv->settings); } + if (priv->dns_manager) { + g_signal_handlers_disconnect_by_data (priv->dns_manager, object); + g_clear_object (&priv->dns_manager); + } + + if (priv->object_manager) { + GList *objects, *iter; + + /* Unhook the NM objects. */ + objects = g_dbus_object_manager_get_objects (priv->object_manager); + for (iter = objects; iter; iter = iter->next) + g_object_set_qdata (G_OBJECT (iter->data), _nm_object_obj_nm_quark (), NULL); + g_list_free_full (objects, g_object_unref); + + g_signal_handlers_disconnect_by_data (priv->object_manager, object); + g_clear_object (&priv->object_manager); + } + G_OBJECT_CLASS (nm_client_parent_class)->dispose (object); } @@ -1922,13 +2570,15 @@ static void set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { + NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object); + switch (prop_id) { case PROP_NETWORKING_ENABLED: case PROP_WIRELESS_ENABLED: case PROP_WWAN_ENABLED: case PROP_WIMAX_ENABLED: - g_object_set_property (G_OBJECT (NM_CLIENT_GET_PRIVATE (object)->manager), - pspec->name, value); + if (priv->manager) + g_object_set_property (G_OBJECT (priv->manager), pspec->name, value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1940,33 +2590,116 @@ static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { + NMClient *self = NM_CLIENT (object); + NMClientPrivate *priv = NM_CLIENT_GET_PRIVATE (object); + switch (prop_id) { + case PROP_NM_RUNNING: + g_value_set_boolean (value, nm_client_get_nm_running (self)); + break; + + /* Manager properties. */ case PROP_VERSION: + g_value_set_string (value, nm_client_get_version (self)); + break; case PROP_STATE: + g_value_set_enum (value, nm_client_get_state (self)); + break; case PROP_STARTUP: - case PROP_NM_RUNNING: + g_value_set_boolean (value, nm_client_get_startup (self)); + break; case PROP_NETWORKING_ENABLED: + g_value_set_boolean (value, nm_client_networking_get_enabled (self)); + break; case PROP_WIRELESS_ENABLED: + g_value_set_boolean (value, nm_client_wireless_get_enabled (self)); + break; case PROP_WIRELESS_HARDWARE_ENABLED: + if (priv->manager) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_set_boolean (value, FALSE); + break; case PROP_WWAN_ENABLED: + g_value_set_boolean (value, nm_client_wwan_get_enabled (self)); + break; case PROP_WWAN_HARDWARE_ENABLED: + if (priv->manager) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_set_boolean (value, FALSE); + break; case PROP_WIMAX_ENABLED: + g_value_set_boolean (value, nm_client_wimax_get_enabled (self)); + break; case PROP_WIMAX_HARDWARE_ENABLED: + if (priv->manager) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_set_boolean (value, FALSE); + break; case PROP_ACTIVE_CONNECTIONS: + g_value_take_boxed (value, _nm_utils_copy_object_array (nm_client_get_active_connections (self))); + break; case PROP_CONNECTIVITY: + g_value_set_enum (value, nm_client_get_connectivity (self)); + break; case PROP_PRIMARY_CONNECTION: + g_value_set_object (value, nm_client_get_primary_connection (self)); + break; case PROP_ACTIVATING_CONNECTION: + g_value_set_object (value, nm_client_get_activating_connection (self)); + break; case PROP_DEVICES: + g_value_take_boxed (value, _nm_utils_copy_object_array (nm_client_get_devices (self))); + break; case PROP_METERED: + if (priv->manager) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_set_uint (value, NM_METERED_UNKNOWN); + break; case PROP_ALL_DEVICES: - g_object_get_property (G_OBJECT (NM_CLIENT_GET_PRIVATE (object)->manager), - pspec->name, value); + g_value_take_boxed (value, _nm_utils_copy_object_array (nm_client_get_all_devices (self))); break; + + /* Settings properties. */ case PROP_CONNECTIONS: + if (priv->settings) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_take_boxed (value, _nm_utils_copy_object_array (&empty)); + break; case PROP_HOSTNAME: + if (priv->settings) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_set_string (value, NULL); + break; case PROP_CAN_MODIFY: - g_object_get_property (G_OBJECT (NM_CLIENT_GET_PRIVATE (object)->settings), - pspec->name, value); + if (priv->settings) + g_object_get_property (G_OBJECT (priv->settings), pspec->name, value); + else + g_value_set_boolean (value, FALSE); + break; + + /* DNS properties */ + case PROP_DNS_MODE: + case PROP_DNS_RC_MANAGER: + g_return_if_fail (pspec->name && strlen (pspec->name) > NM_STRLEN ("dns-")); + if (priv->dns_manager) + g_object_get_property (G_OBJECT (priv->dns_manager), + &pspec->name[NM_STRLEN ("dns-")], value); + else + g_value_set_string (value, NULL); + break; + case PROP_DNS_CONFIGURATION: + if (priv->dns_manager) { + g_object_get_property (G_OBJECT (priv->dns_manager), + NM_DNS_MANAGER_CONFIGURATION, + value); + } else + g_value_take_boxed (value, NULL); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1982,7 +2715,6 @@ nm_client_class_init (NMClientClass *client_class) g_type_class_add_private (client_class, sizeof (NMClientPrivate)); /* virtual methods */ - object_class->constructed = constructed; object_class->set_property = set_property; object_class->get_property = get_property; object_class->dispose = dispose; @@ -2260,6 +2992,54 @@ nm_client_class_init (NMClientClass *client_class) G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); + /** + * NMClient:dns-mode: + * + * The current DNS processing mode. + * + * Since: 1.6 + **/ + g_object_class_install_property + (object_class, PROP_DNS_MODE, + g_param_spec_string (NM_CLIENT_DNS_MODE, "", "", + "", + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMClient:dns-rc-manager: + * + * The current resolv.conf management mode. + * + * Since: 1.6 + **/ + g_object_class_install_property + (object_class, PROP_DNS_RC_MANAGER, + g_param_spec_string (NM_CLIENT_DNS_RC_MANAGER, "", "", + "", + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMClient:dns-configuration: + * + * The current DNS configuration represented as an array of + * dictionaries. Each dictionary has the "nameservers", + * "priority" keys and, optionally, "interface" and "vpn". + * "nameservers" is the list of DNS servers, "priority" their + * relative priority, "interface" the interface on which these + * servers are contacted, "vpn" a boolean telling whether the + * configuration was obtained from a VPN connection. + * + * Since: 1.6 + **/ + g_object_class_install_property + (object_class, PROP_DNS_CONFIGURATION, + g_param_spec_boxed (NM_CLIENT_DNS_CONFIGURATION, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + /* signals */ /** @@ -2419,3 +3199,50 @@ nm_client_async_initable_iface_init (GAsyncInitableIface *iface) iface->init_async = init_async; iface->init_finish = init_finish; } + +/***************************************************************************** + * Backported symbols. Usually, new API is only added in new major versions + * of NetworkManager (that is, on "master" branch). Sometimes however, we might + * have to backport some API to an older stable branch. In that case, we backport + * the symbols with a different version corresponding to the minor API. + * + * To allow upgrading from such a extended minor-release, "master" contains these + * backported symbols too. + * + * For example, 1.2.0 added nm_setting_connection_autoconnect_slaves_get_type. + * This was backported for 1.0.4 as nm_setting_connection_autoconnect_slaves_get_type@libnm_1_0_4 + * To allow an application that was linked against 1.0.4 to seamlessly upgrade to + * a newer major version, the same symbols is also exposed on "master". Note, that + * a user can only seamlessly upgrade to a newer major version, that is released + * *after* 1.0.4 is out. In this example, 1.2.0 was released after 1.4.0, and thus + * a 1.0.4 user can upgrade to 1.2.0 ABI. + *****************************************************************************/ + +NM_BACKPORT_SYMBOL (libnm_1_0_4, NMSettingConnectionAutoconnectSlaves, nm_setting_connection_get_autoconnect_slaves, (NMSettingConnection *setting), (setting)); + +NM_BACKPORT_SYMBOL (libnm_1_0_4, GType, nm_setting_connection_autoconnect_slaves_get_type, (void), ()); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, NMMetered, nm_setting_connection_get_metered, (NMSettingConnection *setting), (setting)); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, GType, nm_metered_get_type, (void), ()); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, NMSettingWiredWakeOnLan, nm_setting_wired_get_wake_on_lan, + (NMSettingWired *setting), (setting)); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, const char *, nm_setting_wired_get_wake_on_lan_password, + (NMSettingWired *setting), (setting)); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, GType, nm_setting_wired_wake_on_lan_get_type, (void), ()); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, const guint *, nm_utils_wifi_2ghz_freqs, (void), ()); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, const guint *, nm_utils_wifi_5ghz_freqs, (void), ()); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, char *, nm_utils_enum_to_str, + (GType type, int value), (type, value)); + +NM_BACKPORT_SYMBOL (libnm_1_0_6, gboolean, nm_utils_enum_from_str, + (GType type, const char *str, int *out_value, char **err_token), + (type, str, out_value, err_token)); + +NM_BACKPORT_SYMBOL (libnm_1_2_4, gint, nm_setting_ip_config_get_dns_priority, (NMSettingIPConfig *setting), (setting)); diff --git a/libnm/nm-client.h b/libnm/nm-client.h index 5358ded4..65e0bac8 100644 --- a/libnm/nm-client.h +++ b/libnm/nm-client.h @@ -58,6 +58,9 @@ G_BEGIN_DECLS #define NM_CLIENT_HOSTNAME "hostname" #define NM_CLIENT_CAN_MODIFY "can-modify" #define NM_CLIENT_METERED "metered" +#define NM_CLIENT_DNS_MODE "dns-mode" +#define NM_CLIENT_DNS_RC_MANAGER "dns-rc-manager" +#define NM_CLIENT_DNS_CONFIGURATION "dns-configuration" #define NM_CLIENT_DEVICE_ADDED "device-added" #define NM_CLIENT_DEVICE_REMOVED "device-removed" @@ -169,6 +172,25 @@ typedef enum { #define NM_CLIENT_ERROR nm_client_error_quark () GQuark nm_client_error_quark (void); +/* DNS stuff */ + +typedef struct NMDnsEntry NMDnsEntry; + +NM_AVAILABLE_IN_1_6 +GType nm_dns_entry_get_type (void); +NM_AVAILABLE_IN_1_6 +void nm_dns_entry_unref (NMDnsEntry *entry); +NM_AVAILABLE_IN_1_6 +const char * nm_dns_entry_get_interface (NMDnsEntry *entry); +NM_AVAILABLE_IN_1_6 +const char * const *nm_dns_entry_get_nameservers (NMDnsEntry *entry); +NM_AVAILABLE_IN_1_6 +const char * const *nm_dns_entry_get_domains (NMDnsEntry *entry); +NM_AVAILABLE_IN_1_6 +int nm_dns_entry_get_priority (NMDnsEntry *entry); +NM_AVAILABLE_IN_1_6 +gboolean nm_dns_entry_get_vpn (NMDnsEntry *entry); + /** * NMClient: */ @@ -359,6 +381,13 @@ gboolean nm_client_reload_connections_finish (NMClient *client, GAsyncResult *result, GError **error); +NM_AVAILABLE_IN_1_6 +const char *nm_client_get_dns_mode (NMClient *client); +NM_AVAILABLE_IN_1_6 +const char *nm_client_get_dns_rc_manager (NMClient *client); +NM_AVAILABLE_IN_1_6 +const GPtrArray *nm_client_get_dns_configuration (NMClient *client); + G_END_DECLS #endif /* __NM_CLIENT_H__ */ diff --git a/libnm/nm-dbus-helpers.c b/libnm/nm-dbus-helpers.c index 3076674a..f835b591 100644 --- a/libnm/nm-dbus-helpers.c +++ b/libnm/nm-dbus-helpers.c @@ -98,24 +98,6 @@ _nm_dbus_is_connection_private (GDBusConnection *connection) return g_dbus_connection_get_unique_name (connection) == NULL; } -static GHashTable *proxy_types; - -#undef _nm_dbus_register_proxy_type -void -_nm_dbus_register_proxy_type (const char *interface, - GType proxy_type) -{ - if (!proxy_types) - proxy_types = g_hash_table_new (g_str_hash, g_str_equal); - - g_assert (g_hash_table_lookup (proxy_types, interface) == NULL); - g_hash_table_insert (proxy_types, (char *) interface, GSIZE_TO_POINTER (proxy_type)); -} - -/* We don't (currently) use GDBus's property-handling code */ -#define NM_DBUS_PROXY_FLAGS (G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | \ - G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START) - /* D-Bus has an upper limit on number of Match rules and it's rather easy * to hit as the proxy likes to add one for each object. Let's remove the Match * rule the proxy added and ensure a less granular rule is present instead. @@ -126,15 +108,13 @@ _nm_dbus_register_proxy_type (const char *interface, * Ideally, we should be able to tell glib not to hook its rules: * https://bugzilla.gnome.org/show_bug.cgi?id=758749 */ -static void +void _nm_dbus_proxy_replace_match (GDBusProxy *proxy) { GDBusConnection *connection = g_dbus_proxy_get_connection (proxy); static unsigned match_counter = 1024; gchar *match; - nm_assert (!g_strcmp0 (g_dbus_proxy_get_name (proxy), NM_DBUS_SERVICE)); - if (match_counter == 1) { /* If we hit the low matches watermark, install a * less granular one. */ @@ -177,83 +157,6 @@ _nm_dbus_proxy_replace_match (GDBusProxy *proxy) g_free (match); } -GDBusProxy * -_nm_dbus_new_proxy_for_connection (GDBusConnection *connection, - const char *path, - const char *interface, - GCancellable *cancellable, - GError **error) -{ - GDBusProxy *proxy; - GType proxy_type; - const char *name; - - proxy_type = GPOINTER_TO_SIZE (g_hash_table_lookup (proxy_types, interface)); - if (!proxy_type) - proxy_type = G_TYPE_DBUS_PROXY; - - if (_nm_dbus_is_connection_private (connection)) - name = NULL; - else - name = NM_DBUS_SERVICE; - - proxy = g_initable_new (proxy_type, cancellable, error, - "g-connection", connection, - "g-flags", NM_DBUS_PROXY_FLAGS, - "g-name", name, - "g-object-path", path, - "g-interface-name", interface, - NULL); - _nm_dbus_proxy_replace_match (proxy); - - return proxy; -} - -void -_nm_dbus_new_proxy_for_connection_async (GDBusConnection *connection, - const char *path, - const char *interface, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - GType proxy_type; - const char *name; - - proxy_type = GPOINTER_TO_SIZE (g_hash_table_lookup (proxy_types, interface)); - if (!proxy_type) - proxy_type = G_TYPE_DBUS_PROXY; - - if (_nm_dbus_is_connection_private (connection)) - name = NULL; - else - name = NM_DBUS_SERVICE; - - g_async_initable_new_async (proxy_type, G_PRIORITY_DEFAULT, - cancellable, callback, user_data, - "g-connection", connection, - "g-flags", NM_DBUS_PROXY_FLAGS, - "g-name", name, - "g-object-path", path, - "g-interface-name", interface, - NULL); -} - -GDBusProxy * -_nm_dbus_new_proxy_for_connection_finish (GAsyncResult *result, - GError **error) -{ - GObject *source; - GDBusProxy *proxy; - - source = g_async_result_get_source_object (result); - proxy = G_DBUS_PROXY (g_async_initable_new_finish (G_ASYNC_INITABLE (source), result, error)); - g_object_unref (source); - _nm_dbus_proxy_replace_match (proxy); - - return proxy; -} - /* Binds the properties on a generated server-side GDBus object to the * corresponding properties on the public object. */ diff --git a/libnm/nm-dbus-helpers.h b/libnm/nm-dbus-helpers.h index 4ec8988a..1847da1d 100644 --- a/libnm/nm-dbus-helpers.h +++ b/libnm/nm-dbus-helpers.h @@ -36,26 +36,7 @@ GDBusConnection *_nm_dbus_new_connection_finish (GAsyncResult *result, gboolean _nm_dbus_is_connection_private (GDBusConnection *connection); -void _nm_dbus_register_proxy_type (const char *interface, - GType proxy_type); -/* Guarantee that @interface is a static string */ -#define _nm_dbus_register_proxy_type(interface, proxy_type) \ - _nm_dbus_register_proxy_type (interface "", proxy_type) \ - -GDBusProxy *_nm_dbus_new_proxy_for_connection (GDBusConnection *connection, - const char *path, - const char *interface, - GCancellable *cancellable, - GError **error); - -void _nm_dbus_new_proxy_for_connection_async (GDBusConnection *connection, - const char *path, - const char *interface, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -GDBusProxy *_nm_dbus_new_proxy_for_connection_finish (GAsyncResult *result, - GError **error); +void _nm_dbus_proxy_replace_match (GDBusProxy *proxy); void _nm_dbus_bind_properties (gpointer object, gpointer skeleton); diff --git a/libnm/nm-device-adsl.c b/libnm/nm-device-adsl.c index 7608ff39..3285745d 100644 --- a/libnm/nm-device-adsl.c +++ b/libnm/nm-device-adsl.c @@ -25,7 +25,6 @@ #include -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-setting-adsl.h" @@ -84,12 +83,11 @@ get_setting_type (NMDevice *device) return NM_TYPE_SETTING_ADSL; } -/******************************************************************/ +/*****************************************************************************/ static void nm_device_adsl_init (NMDeviceAdsl *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_ADSL); } static void @@ -135,8 +133,6 @@ nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class) g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_ADSL); - /* virtual methods */ object_class->get_property = get_property; diff --git a/libnm/nm-device-bond.c b/libnm/nm-device-bond.c index 483d9d00..96334840 100644 --- a/libnm/nm-device-bond.c +++ b/libnm/nm-device-bond.c @@ -27,7 +27,6 @@ #include "nm-utils.h" #include "nm-device-bond.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-core-internal.h" @@ -64,7 +63,7 @@ nm_device_bond_get_hw_address (NMDeviceBond *device) { g_return_val_if_fail (NM_IS_DEVICE_BOND (device), NULL); - return NM_DEVICE_BOND_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_BOND_GET_PRIVATE (device)->hw_address); } /** @@ -130,15 +129,13 @@ get_hw_address (NMDevice *device) return nm_device_bond_get_hw_address (NM_DEVICE_BOND (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_bond_init (NMDeviceBond *device) { NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device); - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BOND); - priv->slaves = g_ptr_array_new (); } @@ -213,8 +210,6 @@ nm_device_bond_class_init (NMDeviceBondClass *bond_class) g_type_class_add_private (bond_class, sizeof (NMDeviceBondPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_BOND); - /* virtual methods */ object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/libnm/nm-device-bridge.c b/libnm/nm-device-bridge.c index c6bf1359..55f09a20 100644 --- a/libnm/nm-device-bridge.c +++ b/libnm/nm-device-bridge.c @@ -27,7 +27,6 @@ #include "nm-utils.h" #include "nm-device-bridge.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-core-internal.h" @@ -64,7 +63,7 @@ nm_device_bridge_get_hw_address (NMDeviceBridge *device) { g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), NULL); - return NM_DEVICE_BRIDGE_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_BRIDGE_GET_PRIVATE (device)->hw_address); } /** @@ -130,15 +129,13 @@ get_hw_address (NMDevice *device) return nm_device_bridge_get_hw_address (NM_DEVICE_BRIDGE (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_bridge_init (NMDeviceBridge *device) { NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device); - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BRIDGE); - priv->slaves = g_ptr_array_new (); } @@ -213,8 +210,6 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class) g_type_class_add_private (bridge_class, sizeof (NMDeviceBridgePrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_BRIDGE); - /* virtual methods */ object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/libnm/nm-device-bt.c b/libnm/nm-device-bt.c index dc28ad89..0fcd28b9 100644 --- a/libnm/nm-device-bt.c +++ b/libnm/nm-device-bt.c @@ -28,7 +28,6 @@ #include "nm-utils.h" #include "nm-device-bt.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-enum-types.h" @@ -65,7 +64,7 @@ nm_device_bt_get_hw_address (NMDeviceBt *device) { g_return_val_if_fail (NM_IS_DEVICE_BT (device), NULL); - return NM_DEVICE_BT_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_BT_GET_PRIVATE (device)->hw_address); } /** @@ -178,12 +177,11 @@ get_hw_address (NMDevice *device) return nm_device_bt_get_hw_address (NM_DEVICE_BT (device)); } -/************************************************************/ +/*****************************************************************************/ static void nm_device_bt_init (NMDeviceBt *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BT); } static void @@ -248,8 +246,6 @@ nm_device_bt_class_init (NMDeviceBtClass *bt_class) g_type_class_add_private (bt_class, sizeof (NMDeviceBtPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-ethernet.c b/libnm/nm-device-ethernet.c index 825ed7b3..727ea8a6 100644 --- a/libnm/nm-device-ethernet.c +++ b/libnm/nm-device-ethernet.c @@ -29,7 +29,6 @@ #include "nm-utils.h" #include "nm-device-ethernet.h" -#include "nm-device-private.h" #include "nm-object-private.h" G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE) @@ -69,7 +68,7 @@ nm_device_ethernet_get_hw_address (NMDeviceEthernet *device) { g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL); - return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->hw_address); } /** @@ -86,7 +85,7 @@ nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device) { g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL); - return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->perm_hw_address; + return nm_str_not_empty (NM_DEVICE_ETHERNET_GET_PRIVATE (device)->perm_hw_address); } /** @@ -277,12 +276,11 @@ get_hw_address (NMDevice *device) return nm_device_ethernet_get_hw_address (NM_DEVICE_ETHERNET (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_ethernet_init (NMDeviceEthernet *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_ETHERNET); } static void @@ -357,8 +355,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class) g_type_class_add_private (eth_class, sizeof (NMDeviceEthernetPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_WIRED); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-generic.c b/libnm/nm-device-generic.c index 069ca0ea..62cb89eb 100644 --- a/libnm/nm-device-generic.c +++ b/libnm/nm-device-generic.c @@ -23,7 +23,6 @@ #include #include "nm-device-generic.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-setting-generic.h" #include "nm-setting-connection.h" @@ -59,17 +58,17 @@ nm_device_generic_get_hw_address (NMDeviceGeneric *device) { g_return_val_if_fail (NM_IS_DEVICE_GENERIC (device), NULL); - return NM_DEVICE_GENERIC_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_GENERIC_GET_PRIVATE (device)->hw_address); } -/***********************************************************/ +/*****************************************************************************/ static const char * get_type_description (NMDevice *device) { NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (device); - return priv->type_description; + return nm_str_not_empty (priv->type_description); } static const char * @@ -108,12 +107,11 @@ get_setting_type (NMDevice *device) return NM_TYPE_SETTING_GENERIC; } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_generic_init (NMDeviceGeneric *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_GENERIC); } static void @@ -150,14 +148,15 @@ get_property (GObject *object, GValue *value, GParamSpec *pspec) { - NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object); + NMDeviceGeneric *self = NM_DEVICE_GENERIC (object); + NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (self); switch (prop_id) { case PROP_HW_ADDRESS: g_value_set_string (value, priv->hw_address); break; case PROP_TYPE_DESCRIPTION: - g_value_set_string (value, priv->type_description); + g_value_set_string (value, get_type_description ((NMDevice *) self)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -174,8 +173,6 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass) g_type_class_add_private (klass, sizeof (NMDeviceGenericPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_GENERIC); - object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-infiniband.c b/libnm/nm-device-infiniband.c index 6770b1c5..1ed942b5 100644 --- a/libnm/nm-device-infiniband.c +++ b/libnm/nm-device-infiniband.c @@ -27,7 +27,6 @@ #include "nm-utils.h" #include "nm-device-infiniband.h" -#include "nm-device-private.h" #include "nm-object-private.h" G_DEFINE_TYPE (NMDeviceInfiniband, nm_device_infiniband, NM_TYPE_DEVICE) @@ -61,7 +60,7 @@ nm_device_infiniband_get_hw_address (NMDeviceInfiniband *device) { g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (device), NULL); - return NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->hw_address); } /** @@ -127,12 +126,11 @@ get_hw_address (NMDevice *device) return nm_device_infiniband_get_hw_address (NM_DEVICE_INFINIBAND (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_infiniband_init (NMDeviceInfiniband *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_INFINIBAND); } static void @@ -192,8 +190,6 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *ib_class) g_type_class_add_private (ib_class, sizeof (NMDeviceInfinibandPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_INFINIBAND); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-ip-tunnel.c b/libnm/nm-device-ip-tunnel.c index f5b3cad6..e0dfc0f4 100644 --- a/libnm/nm-device-ip-tunnel.c +++ b/libnm/nm-device-ip-tunnel.c @@ -27,7 +27,6 @@ #include "nm-utils.h" #include "nm-device-ip-tunnel.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-core-internal.h" @@ -111,7 +110,7 @@ nm_device_ip_tunnel_get_local (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->local; + return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->local); } /** @@ -127,7 +126,7 @@ nm_device_ip_tunnel_get_remote (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->remote; + return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->remote); } /** @@ -192,7 +191,7 @@ nm_device_ip_tunnel_get_input_key (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->input_key; + return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->input_key); } /** @@ -208,7 +207,7 @@ nm_device_ip_tunnel_get_output_key (NMDeviceIPTunnel *device) { g_return_val_if_fail (NM_IS_DEVICE_IP_TUNNEL (device), NULL); - return NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->output_key; + return nm_str_not_empty (NM_DEVICE_IP_TUNNEL_GET_PRIVATE (device)->output_key); } /** @@ -264,12 +263,11 @@ get_setting_type (NMDevice *device) return NM_TYPE_SETTING_IP_TUNNEL; } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_ip_tunnel_init (NMDeviceIPTunnel *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_IP_TUNNEL); } static void @@ -369,8 +367,6 @@ nm_device_ip_tunnel_class_init (NMDeviceIPTunnelClass *bond_class) g_type_class_add_private (bond_class, sizeof (NMDeviceIPTunnelPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_IP_TUNNEL); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-macsec.c b/libnm/nm-device-macsec.c new file mode 100644 index 00000000..16bbbebb --- /dev/null +++ b/libnm/nm-device-macsec.c @@ -0,0 +1,639 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2017 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include + +#include "nm-device-macsec.h" +#include "nm-device-private.h" +#include "nm-object-private.h" +#include "nm-utils.h" + +G_DEFINE_TYPE (NMDeviceMacsec, nm_device_macsec, NM_TYPE_DEVICE) + +#define NM_DEVICE_MACSEC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_MACSEC, NMDeviceMacsecPrivate)) + +typedef struct { + NMDevice *parent; + char *hw_address; + guint64 sci; + guint64 cipher_suite; + guint8 icv_length; + guint32 window; + guint8 encoding_sa; + gboolean encrypt; + gboolean protect; + gboolean include_sci; + gboolean es; + gboolean scb; + gboolean replay_protect; + char *validation; +} NMDeviceMacsecPrivate; + +NM_GOBJECT_PROPERTIES_DEFINE_BASE ( + PROP_PARENT, + PROP_HW_ADDRESS, + PROP_SCI, + PROP_CIPHER_SUITE, + PROP_ICV_LENGTH, + PROP_WINDOW, + PROP_ENCODING_SA, + PROP_ENCRYPT, + PROP_PROTECT, + PROP_INCLUDE_SCI, + PROP_ES, + PROP_SCB, + PROP_REPLAY_PROTECT, + PROP_VALIDATION, +); + +/** + * nm_device_macsec_get_parent: + * @device: a #NMDeviceMacsec + * + * Returns: (transfer none): the device's parent device + * + * Since: 1.6 + **/ +NMDevice * +nm_device_macsec_get_parent (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), NULL); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->parent; +} + +/** + * nm_device_macsec_get_hw_address: + * @device: a #NMDeviceMacsec + * + * Gets the hardware (MAC) address of the #NMDeviceMacsec + * + * Returns: the hardware address. This is the internal string used by the + * device, and must not be modified. + * + * Since: 1.6 + **/ +const char * +nm_device_macsec_get_hw_address (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), NULL); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->hw_address; +} + +/** + * nm_device_macsec_get_sci: + * @device: a #NMDeviceMacsec + * + * Gets the Secure Channel Identifier in use + * + * Returns: the SCI + * + * Since: 1.6 + **/ +guint64 +nm_device_macsec_get_sci (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), 0); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->sci; +} + +/** + * nm_device_macsec_get_icv_length: + * @device: a #NMDeviceMacsec + * + * Gets the length of ICV (Integrity Check Value) + * + * Returns: the length of ICV + * + * Since: 1.6 + **/ +guint8 +nm_device_macsec_get_icv_length (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), 0); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->icv_length; +} + +/** + * nm_device_macsec_get_cipher_suite: + * @device: a #NMDeviceMacsec + * + * Gets the set of cryptographic algorithms in use + * + * Returns: the set of cryptographic algorithms in use + * + * Since: 1.6 + **/ +guint64 +nm_device_macsec_get_cipher_suite (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), 0); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->cipher_suite; +} + +/** + * nm_device_macsec_get_window: + * @device: a #NMDeviceMacsec + * + * Gets the size of the replay window + * + * Returns: size of the replay window + * + * Since: 1.6 + **/ +guint +nm_device_macsec_get_window (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), 0); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->window; +} + +/** + * nm_device_macsec_get_encoding_sa: + * @device: a #NMDeviceMacsec + * + * Gets the value of the Association Number (0..3) for the Security + * Association in use. + * + * Returns: the current Security Association + * + * Since: 1.6 + **/ +guint8 +nm_device_macsec_get_encoding_sa (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), 0); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->encoding_sa; +} + +/** + * nm_device_macsec_get_validation: + * @device: a #NMDeviceMacsec + * + * Gets the validation mode for incoming packets (strict, check, + * disabled) + * + * Returns: the validation mode + * + * Since: 1.6 + **/ +const char * +nm_device_macsec_get_validation (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), NULL); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->validation; +} + +/** + * nm_device_macsec_get_encrypt: + * @device: a #NMDeviceMacsec + * + * Gets whether encryption of transmitted frames is enabled + * + * Returns: whether encryption is enabled + * + * Since: 1.6 + **/ +gboolean +nm_device_macsec_get_encrypt (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), FALSE); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->encrypt; +} + +/** + * nm_device_macsec_get_protect: + * @device: a #NMDeviceMacsec + * + * Gets whether protection of transmitted frames is enabled + * + * Returns: whether protection is enabled + * + * Since: 1.6 + **/ +gboolean +nm_device_macsec_get_protect (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), FALSE); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->protect; +} + +/** + * nm_device_macsec_get_include_sci: + * @device: a #NMDeviceMacsec + * + * Gets whether the SCI is always included in SecTAG for transmitted + * frames + * + * Returns: whether the SCI is always included + * + * Since: 1.6 + **/ +gboolean +nm_device_macsec_get_include_sci (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), FALSE); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->include_sci; +} + +/** + * nm_device_macsec_get_es: + * @device: a #NMDeviceMacsec + * + * Gets whether the ES (End station) bit is enabled in SecTAG for + * transmitted frames + * + * Returns: whether the ES (End station) bit is enabled + * + * Since: 1.6 + **/ +gboolean +nm_device_macsec_get_es (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), FALSE); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->es; +} + +/** + * nm_device_macsec_get_scb: + * @device: a #NMDeviceMacsec + * + * Gets whether the SCB (Single Copy Broadcast) bit is enabled in + * SecTAG for transmitted frames + * + * Returns: whether the SCB (Single Copy Broadcast) bit is enabled + * + * Since: 1.6 + **/ +gboolean +nm_device_macsec_get_scb (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), FALSE); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->scb; +} + +/** + * nm_device_macsec_get_replay_protect: + * @device: a #NMDeviceMacsec + * + * Gets whether replay protection is enabled + * + * Returns: whether replay protection is enabled + * + * Since: 1.6 + **/ +gboolean +nm_device_macsec_get_replay_protect (NMDeviceMacsec *device) +{ + g_return_val_if_fail (NM_IS_DEVICE_MACSEC (device), FALSE); + + return NM_DEVICE_MACSEC_GET_PRIVATE (device)->replay_protect; +} + +static const char * +get_hw_address (NMDevice *device) +{ + return nm_device_macsec_get_hw_address (NM_DEVICE_MACSEC (device)); +} + +/***********************************************************/ + +static void +nm_device_macsec_init (NMDeviceMacsec *device) +{ +} + +static void +init_dbus (NMObject *object) +{ + NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (object); + const NMPropertiesInfo property_info[] = { + { NM_DEVICE_MACSEC_PARENT, &priv->parent, NULL, NM_TYPE_DEVICE }, + { NM_DEVICE_MACSEC_HW_ADDRESS, &priv->hw_address }, + { NM_DEVICE_MACSEC_SCI, &priv->sci }, + { NM_DEVICE_MACSEC_CIPHER_SUITE, &priv->cipher_suite }, + { NM_DEVICE_MACSEC_ICV_LENGTH, &priv->icv_length }, + { NM_DEVICE_MACSEC_WINDOW, &priv->window }, + { NM_DEVICE_MACSEC_ENCODING_SA, &priv->encoding_sa }, + { NM_DEVICE_MACSEC_ENCRYPT, &priv->encrypt }, + { NM_DEVICE_MACSEC_PROTECT, &priv->protect }, + { NM_DEVICE_MACSEC_INCLUDE_SCI, &priv->include_sci }, + { NM_DEVICE_MACSEC_ES, &priv->es }, + { NM_DEVICE_MACSEC_SCB, &priv->scb }, + { NM_DEVICE_MACSEC_REPLAY_PROTECT, &priv->replay_protect }, + { NM_DEVICE_MACSEC_VALIDATION, &priv->validation }, + { NULL }, + }; + + NM_OBJECT_CLASS (nm_device_macsec_parent_class)->init_dbus (object); + + _nm_object_register_properties (object, + NM_DBUS_INTERFACE_DEVICE_MACSEC, + property_info); +} + +static void +finalize (GObject *object) +{ + NMDeviceMacsecPrivate *priv = NM_DEVICE_MACSEC_GET_PRIVATE (object); + + g_free (priv->validation); + g_free (priv->hw_address); + g_clear_object (&priv->parent); + + G_OBJECT_CLASS (nm_device_macsec_parent_class)->finalize (object); +} + +static void +get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + NMDeviceMacsec *device = NM_DEVICE_MACSEC (object); + + switch (prop_id) { + case PROP_PARENT: + g_value_set_object (value, nm_device_macsec_get_parent (device)); + break; + case PROP_HW_ADDRESS: + g_value_set_string (value, nm_device_macsec_get_hw_address (device)); + break; + case PROP_SCI: + g_value_set_uint64 (value, nm_device_macsec_get_sci (device)); + break; + case PROP_ICV_LENGTH: + g_value_set_uchar (value, nm_device_macsec_get_icv_length (device)); + break; + case PROP_CIPHER_SUITE: + g_value_set_uint64 (value, nm_device_macsec_get_cipher_suite (device)); + break; + case PROP_WINDOW: + g_value_set_uint (value, nm_device_macsec_get_window (device)); + break; + case PROP_ENCODING_SA: + g_value_set_uchar (value, nm_device_macsec_get_encoding_sa (device)); + break; + case PROP_VALIDATION: + g_value_set_string (value, nm_device_macsec_get_validation (device)); + break; + case PROP_ENCRYPT: + g_value_set_boolean (value, nm_device_macsec_get_encrypt (device)); + break; + case PROP_PROTECT: + g_value_set_boolean (value, nm_device_macsec_get_protect (device)); + break; + case PROP_INCLUDE_SCI: + g_value_set_boolean (value, nm_device_macsec_get_include_sci (device)); + break; + case PROP_ES: + g_value_set_boolean (value, nm_device_macsec_get_es (device)); + break; + case PROP_SCB: + g_value_set_boolean (value, nm_device_macsec_get_scb (device)); + break; + case PROP_REPLAY_PROTECT: + g_value_set_boolean (value, nm_device_macsec_get_replay_protect (device)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_device_macsec_class_init (NMDeviceMacsecClass *macsec_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (macsec_class); + NMObjectClass *nm_object_class = NM_OBJECT_CLASS (macsec_class); + NMDeviceClass *device_class = NM_DEVICE_CLASS (macsec_class); + + g_type_class_add_private (macsec_class, sizeof (NMDeviceMacsecPrivate)); + + object_class->finalize = finalize; + object_class->get_property = get_property; + + nm_object_class->init_dbus = init_dbus; + + device_class->get_hw_address = get_hw_address; + + /** + * NMDeviceMacsec:parent: + * + * The devices's parent device. + * + * Since: 1.6 + **/ + obj_properties[PROP_PARENT] = + g_param_spec_object (NM_DEVICE_MACSEC_PARENT, "", "", + NM_TYPE_DEVICE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:hw-address: + * + * The hardware (MAC) address of the device. + * + * Since: 1.6 + **/ + obj_properties[PROP_HW_ADDRESS] = + g_param_spec_string (NM_DEVICE_MACSEC_HW_ADDRESS, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:sci: + * + * The Secure Channel Identifier in use. + * + * Since: 1.6 + **/ + obj_properties[PROP_SCI] = + g_param_spec_uint64 (NM_DEVICE_MACSEC_SCI, "", "", + 0, G_MAXUINT64, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:icv-length: + * + * The length of ICV (Integrity Check Value). + * + * Since: 1.6 + **/ + obj_properties[PROP_ICV_LENGTH] = + g_param_spec_uchar (NM_DEVICE_MACSEC_ICV_LENGTH, "", "", + 0, G_MAXUINT8, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:cipher-suite: + * + * The set of cryptographic algorithms in use. + * + * Since: 1.6 + **/ + obj_properties[PROP_CIPHER_SUITE] = + g_param_spec_uint64 (NM_DEVICE_MACSEC_CIPHER_SUITE, "", "", + 0, G_MAXUINT64, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:window: + * + * The size of the replay window. + * + * Since: 1.6 + **/ + obj_properties[PROP_WINDOW] = + g_param_spec_uint (NM_DEVICE_MACSEC_WINDOW, "", "", + 0, G_MAXUINT32, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:encoding-sa: + * + * The value of the Association Number (0..3) for the Security + * Association in use. + * + * Since: 1.6 + **/ + obj_properties[PROP_ENCODING_SA] = + g_param_spec_uchar (NM_DEVICE_MACSEC_ENCODING_SA, "", "", + 0, G_MAXUINT8, 0, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:validation: + * + * The validation mode for incoming packets (strict, check, + * disabled). + * + * Since: 1.6 + **/ + obj_properties[PROP_VALIDATION] = + g_param_spec_string (NM_DEVICE_MACSEC_VALIDATION, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:encrypt: + * + * Whether encryption of transmitted frames is enabled. + * + * Since: 1.6 + **/ + obj_properties[PROP_ENCRYPT] = + g_param_spec_boolean (NM_DEVICE_MACSEC_ENCRYPT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:protect: + * + * Whether protection of transmitted frames is enabled. + * + * Since: 1.6 + **/ + obj_properties[PROP_PROTECT] = + g_param_spec_boolean (NM_DEVICE_MACSEC_PROTECT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:include-sci: + * + * Whether the SCI is always included in SecTAG for transmitted + * frames. + * + * Since: 1.6 + **/ + obj_properties[PROP_INCLUDE_SCI] = + g_param_spec_boolean (NM_DEVICE_MACSEC_INCLUDE_SCI, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:es: + * + * Whether the ES (End station) bit is enabled in SecTAG for + * transmitted frames. + * + * Since: 1.6 + **/ + obj_properties[PROP_ES] = + g_param_spec_boolean (NM_DEVICE_MACSEC_ES, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:scb: + * + * Whether the SCB (Single Copy Broadcast) bit is enabled in + * SecTAG for transmitted frames. + * + * Since: 1.6 + **/ + obj_properties[PROP_SCB] = + g_param_spec_boolean (NM_DEVICE_MACSEC_SCB, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + /** + * NMDeviceMacsec:replay-protect: + * + * Whether replay protection is enabled. + * + * Since: 1.6 + **/ + obj_properties[PROP_REPLAY_PROTECT] = + g_param_spec_boolean (NM_DEVICE_MACSEC_REPLAY_PROTECT, "", "", + FALSE, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS); + + g_object_class_install_properties (object_class, _PROPERTY_ENUMS_LAST, obj_properties); +} diff --git a/libnm/nm-device-macsec.h b/libnm/nm-device-macsec.h new file mode 100644 index 00000000..d6d7c0ef --- /dev/null +++ b/libnm/nm-device-macsec.h @@ -0,0 +1,101 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2017 Red Hat, Inc. + */ + +#ifndef __NM_DEVICE_MACSEC_H__ +#define __NM_DEVICE_MACSEC_H__ + +#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION) +#error "Only can be included directly." +#endif + +#include + +G_BEGIN_DECLS + +#define NM_TYPE_DEVICE_MACSEC (nm_device_macsec_get_type ()) +#define NM_DEVICE_MACSEC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_MACSEC, NMDeviceMacsec)) +#define NM_DEVICE_MACSEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_MACSEC, NMDeviceMacsecClass)) +#define NM_IS_DEVICE_MACSEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_MACSEC)) +#define NM_IS_DEVICE_MACSEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_MACSEC)) +#define NM_DEVICE_MACSEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_MACSEC, NMDeviceMacsecClass)) + +#define NM_DEVICE_MACSEC_PARENT "parent" +#define NM_DEVICE_MACSEC_HW_ADDRESS "hw-address" +#define NM_DEVICE_MACSEC_SCI "sci" +#define NM_DEVICE_MACSEC_ICV_LENGTH "icv-length" +#define NM_DEVICE_MACSEC_CIPHER_SUITE "cipher-suite" +#define NM_DEVICE_MACSEC_WINDOW "window" +#define NM_DEVICE_MACSEC_ENCODING_SA "encoding-sa" +#define NM_DEVICE_MACSEC_VALIDATION "validation" +#define NM_DEVICE_MACSEC_ENCRYPT "encrypt" +#define NM_DEVICE_MACSEC_PROTECT "protect" +#define NM_DEVICE_MACSEC_INCLUDE_SCI "include-sci" +#define NM_DEVICE_MACSEC_ES "es" +#define NM_DEVICE_MACSEC_SCB "scb" +#define NM_DEVICE_MACSEC_REPLAY_PROTECT "replay-protect" + +/** + * NMDeviceMacsec: + */ +struct _NMDeviceMacsec { + NMDevice parent; +}; + +typedef struct { + NMDeviceClass parent; + + /*< private >*/ + gpointer padding[4]; +} NMDeviceMacsecClass; + +NM_AVAILABLE_IN_1_6 +GType nm_device_macsec_get_type (void); + +NM_AVAILABLE_IN_1_6 +NMDevice * nm_device_macsec_get_parent (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +const char * nm_device_macsec_get_hw_address (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +guint64 nm_device_macsec_get_sci (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +guint8 nm_device_macsec_get_icv_length (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +guint64 nm_device_macsec_get_cipher_suite (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +guint nm_device_macsec_get_window (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +guint8 nm_device_macsec_get_encoding_sa (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +const char * nm_device_macsec_get_validation (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +gboolean nm_device_macsec_get_encrypt (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +gboolean nm_device_macsec_get_protect (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +gboolean nm_device_macsec_get_include_sci (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +gboolean nm_device_macsec_get_es (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +gboolean nm_device_macsec_get_scb (NMDeviceMacsec *device); +NM_AVAILABLE_IN_1_6 +gboolean nm_device_macsec_get_replay_protect (NMDeviceMacsec *device); +G_END_DECLS + +#endif /* __NM_DEVICE_MACSEC_H__ */ diff --git a/libnm/nm-device-macvlan.c b/libnm/nm-device-macvlan.c index 825c9197..e6477219 100644 --- a/libnm/nm-device-macvlan.c +++ b/libnm/nm-device-macvlan.c @@ -28,7 +28,6 @@ #include "nm-utils.h" #include "nm-device-macvlan.h" -#include "nm-device-private.h" #include "nm-object-private.h" G_DEFINE_TYPE (NMDeviceMacvlan, nm_device_macvlan, NM_TYPE_DEVICE) @@ -86,7 +85,7 @@ nm_device_macvlan_get_mode (NMDeviceMacvlan *device) { g_return_val_if_fail (NM_IS_DEVICE_MACVLAN (device), NULL); - return NM_DEVICE_MACVLAN_GET_PRIVATE (device)->mode; + return nm_str_not_empty (NM_DEVICE_MACVLAN_GET_PRIVATE (device)->mode); } /** @@ -141,7 +140,7 @@ nm_device_macvlan_get_hw_address (NMDeviceMacvlan *device) { g_return_val_if_fail (NM_IS_DEVICE_MACVLAN (device), NULL); - return NM_DEVICE_MACVLAN_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_MACVLAN_GET_PRIVATE (device)->hw_address); } @@ -181,12 +180,11 @@ get_setting_type (NMDevice *device) return NM_TYPE_SETTING_MACVLAN; } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_macvlan_init (NMDeviceMacvlan *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_MACVLAN); } static void @@ -260,8 +258,6 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *gre_class) g_type_class_add_private (gre_class, sizeof (NMDeviceMacvlanPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_MACVLAN); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-modem.c b/libnm/nm-device-modem.c index d442dc03..7fc843f6 100644 --- a/libnm/nm-device-modem.c +++ b/libnm/nm-device-modem.c @@ -28,7 +28,6 @@ #include "nm-setting-cdma.h" #include "nm-device-modem.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-enum-types.h" @@ -153,12 +152,11 @@ get_setting_type (NMDevice *device) return G_TYPE_INVALID; } -/*******************************************************************/ +/*****************************************************************************/ static void nm_device_modem_init (NMDeviceModem *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_MODEM); } static void @@ -208,8 +206,6 @@ nm_device_modem_class_init (NMDeviceModemClass *modem_class) g_type_class_add_private (modem_class, sizeof (NMDeviceModemPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_MODEM); - /* virtual methods */ object_class->get_property = get_property; diff --git a/libnm/nm-device-olpc-mesh.c b/libnm/nm-device-olpc-mesh.c index 984ea4e4..875f11a9 100644 --- a/libnm/nm-device-olpc-mesh.c +++ b/libnm/nm-device-olpc-mesh.c @@ -26,7 +26,6 @@ #include "nm-setting-olpc-mesh.h" #include "nm-device-olpc-mesh.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-device-wifi.h" @@ -63,7 +62,7 @@ nm_device_olpc_mesh_get_hw_address (NMDeviceOlpcMesh *device) { g_return_val_if_fail (NM_IS_DEVICE_OLPC_MESH (device), NULL); - return NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->hw_address); } /** @@ -125,12 +124,11 @@ get_setting_type (NMDevice *device) return NM_TYPE_SETTING_OLPC_MESH; } -/**************************************************************/ +/*****************************************************************************/ static void nm_device_olpc_mesh_init (NMDeviceOlpcMesh *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_OLPC_MESH); } static void @@ -204,8 +202,6 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *olpc_mesh_class) g_type_class_add_private (olpc_mesh_class, sizeof (NMDeviceOlpcMeshPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_OLPC_MESH); - /* virtual methods */ object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/libnm/nm-device-private.h b/libnm/nm-device-private.h index 66fc6b6b..e69de29b 100644 --- a/libnm/nm-device-private.h +++ b/libnm/nm-device-private.h @@ -1,26 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright 2007 - 2012 Red Hat, Inc. - */ - -#ifndef __NM_DEVICE_PRIVATE_H__ -#define __NM_DEVICE_PRIVATE_H__ - -void _nm_device_set_device_type (NMDevice *device, NMDeviceType dtype); - -#endif /* __NM_DEVICE_PRIVATE_H__ */ diff --git a/libnm/nm-device-team.c b/libnm/nm-device-team.c index 3955e105..0b62b864 100644 --- a/libnm/nm-device-team.c +++ b/libnm/nm-device-team.c @@ -27,7 +27,6 @@ #include "nm-utils.h" #include "nm-device-team.h" -#include "nm-device-private.h" #include "nm-object-private.h" #include "nm-core-internal.h" @@ -66,7 +65,7 @@ nm_device_team_get_hw_address (NMDeviceTeam *device) { g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), NULL); - return NM_DEVICE_TEAM_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_TEAM_GET_PRIVATE (device)->hw_address); } /** @@ -119,7 +118,7 @@ nm_device_team_get_config (NMDeviceTeam *device) { g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), NULL); - return NM_DEVICE_TEAM_GET_PRIVATE (device)->config; + return nm_str_not_empty (NM_DEVICE_TEAM_GET_PRIVATE (device)->config); } static const char * @@ -151,15 +150,13 @@ get_setting_type (NMDevice *device) return NM_TYPE_SETTING_TEAM; } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_team_init (NMDeviceTeam *device) { NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device); - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_TEAM); - priv->slaves = g_ptr_array_new (); } @@ -239,8 +236,6 @@ nm_device_team_class_init (NMDeviceTeamClass *team_class) g_type_class_add_private (team_class, sizeof (NMDeviceTeamPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_TEAM); - /* virtual methods */ object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/libnm/nm-device-tun.c b/libnm/nm-device-tun.c index b227f5b1..2c88bf33 100644 --- a/libnm/nm-device-tun.c +++ b/libnm/nm-device-tun.c @@ -28,7 +28,6 @@ #include "nm-utils.h" #include "nm-device-tun.h" -#include "nm-device-private.h" #include "nm-object-private.h" G_DEFINE_TYPE (NMDeviceTun, nm_device_tun, NM_TYPE_DEVICE) @@ -74,7 +73,7 @@ nm_device_tun_get_hw_address (NMDeviceTun *device) { g_return_val_if_fail (NM_IS_DEVICE_TUN (device), NULL); - return NM_DEVICE_TUN_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_TUN_GET_PRIVATE (device)->hw_address); } /** @@ -92,7 +91,7 @@ nm_device_tun_get_mode (NMDeviceTun *device) { g_return_val_if_fail (NM_IS_DEVICE_TUN (device), NULL); - return NM_DEVICE_TUN_GET_PRIVATE (device)->mode; + return nm_str_not_empty (NM_DEVICE_TUN_GET_PRIVATE (device)->mode); } /** @@ -234,12 +233,11 @@ get_hw_address (NMDevice *device) return nm_device_tun_get_hw_address (NM_DEVICE_TUN (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_tun_init (NMDeviceTun *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_TUN); } static void @@ -320,8 +318,6 @@ nm_device_tun_class_init (NMDeviceTunClass *gre_class) g_type_class_add_private (gre_class, sizeof (NMDeviceTunPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_TUN); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-vlan.c b/libnm/nm-device-vlan.c index 330d6f4a..5728d404 100644 --- a/libnm/nm-device-vlan.c +++ b/libnm/nm-device-vlan.c @@ -28,7 +28,6 @@ #include "nm-utils.h" #include "nm-device-vlan.h" -#include "nm-device-private.h" #include "nm-object-private.h" G_DEFINE_TYPE (NMDeviceVlan, nm_device_vlan, NM_TYPE_DEVICE) @@ -66,7 +65,7 @@ nm_device_vlan_get_hw_address (NMDeviceVlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), NULL); - return NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address); } /** @@ -167,12 +166,11 @@ get_hw_address (NMDevice *device) return nm_device_vlan_get_hw_address (NM_DEVICE_VLAN (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_vlan_init (NMDeviceVlan *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_VLAN); } static void @@ -241,8 +239,6 @@ nm_device_vlan_class_init (NMDeviceVlanClass *vlan_class) g_type_class_add_private (vlan_class, sizeof (NMDeviceVlanPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_VLAN); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-vxlan.c b/libnm/nm-device-vxlan.c index c8da6c64..27b9c981 100644 --- a/libnm/nm-device-vxlan.c +++ b/libnm/nm-device-vxlan.c @@ -27,7 +27,6 @@ #include "nm-utils.h" #include "nm-device-vxlan.h" -#include "nm-device-private.h" #include "nm-object-private.h" G_DEFINE_TYPE (NMDeviceVxlan, nm_device_vxlan, NM_TYPE_DEVICE) @@ -95,7 +94,7 @@ nm_device_vxlan_get_hw_address (NMDeviceVxlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VXLAN (device), NULL); - return NM_DEVICE_VXLAN_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->hw_address); } /** @@ -162,7 +161,7 @@ nm_device_vxlan_get_group (NMDeviceVxlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VXLAN (device), NULL); - return NM_DEVICE_VXLAN_GET_PRIVATE (device)->group; + return nm_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->group); } /** @@ -178,7 +177,7 @@ nm_device_vxlan_get_local (NMDeviceVxlan *device) { g_return_val_if_fail (NM_IS_DEVICE_VXLAN (device), NULL); - return NM_DEVICE_VXLAN_GET_PRIVATE (device)->local; + return nm_str_not_empty (NM_DEVICE_VXLAN_GET_PRIVATE (device)->local); } /** @@ -410,12 +409,11 @@ get_hw_address (NMDevice *device) return nm_device_vxlan_get_hw_address (NM_DEVICE_VXLAN (device)); } -/***********************************************************/ +/*****************************************************************************/ static void nm_device_vxlan_init (NMDeviceVxlan *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_VXLAN); } static void @@ -542,8 +540,6 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *vxlan_class) g_type_class_add_private (vxlan_class, sizeof (NMDeviceVxlanPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_VXLAN); - /* virtual methods */ object_class->finalize = finalize; object_class->get_property = get_property; diff --git a/libnm/nm-device-wifi.c b/libnm/nm-device-wifi.c index 3fde324c..c85809dd 100644 --- a/libnm/nm-device-wifi.c +++ b/libnm/nm-device-wifi.c @@ -31,13 +31,11 @@ #include "nm-utils.h" #include "nm-access-point.h" -#include "nm-device-private.h" #include "nm-object-private.h" -#include "nm-object-cache.h" #include "nm-core-internal.h" #include "nm-dbus-helpers.h" -#include "nmdbus-device-wifi.h" +#include "introspection/org.freedesktop.NetworkManager.Device.Wireless.h" G_DEFINE_TYPE (NMDeviceWifi, nm_device_wifi, NM_TYPE_DEVICE) @@ -100,7 +98,7 @@ nm_device_wifi_get_hw_address (NMDeviceWifi *device) { g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL); - return NM_DEVICE_WIFI_GET_PRIVATE (device)->hw_address; + return nm_str_not_empty (NM_DEVICE_WIFI_GET_PRIVATE (device)->hw_address); } /** @@ -117,7 +115,7 @@ nm_device_wifi_get_permanent_hw_address (NMDeviceWifi *device) { g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL); - return NM_DEVICE_WIFI_GET_PRIVATE (device)->perm_hw_address; + return nm_str_not_empty (NM_DEVICE_WIFI_GET_PRIVATE (device)->perm_hw_address); } /** @@ -520,10 +518,7 @@ clean_up_aps (NMDeviceWifi *self, gboolean in_dispose) priv = NM_DEVICE_WIFI_GET_PRIVATE (self); - if (priv->active_ap) { - g_object_unref (priv->active_ap); - priv->active_ap = NULL; - } + g_clear_object (&priv->active_ap); aps = priv->aps; @@ -656,15 +651,13 @@ get_hw_address (NMDevice *device) return nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (device)); } -/**************************************************************/ +/*****************************************************************************/ static void nm_device_wifi_init (NMDeviceWifi *device) { NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device); - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_WIFI); - g_signal_connect (device, "notify::" NM_DEVICE_STATE, G_CALLBACK (state_changed_cb), @@ -722,10 +715,7 @@ state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data) case NM_DEVICE_STATE_DISCONNECTED: case NM_DEVICE_STATE_FAILED: /* Just clear active AP; don't clear the AP list unless wireless is disabled completely */ - if (priv->active_ap) { - g_object_unref (priv->active_ap); - priv->active_ap = NULL; - } + g_clear_object (&priv->active_ap); _nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); priv->rate = 0; _nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_WIFI_BITRATE); @@ -764,8 +754,7 @@ access_point_removed (NMDeviceWifi *self, NMAccessPoint *ap) NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self); if (ap == priv->active_ap) { - g_object_unref (priv->active_ap); - priv->active_ap = NULL; + g_clear_object (&priv->active_ap); _nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT); priv->rate = 0; @@ -781,6 +770,8 @@ dispose (GObject *object) if (priv->aps) clean_up_aps (NM_DEVICE_WIFI (object), TRUE); + g_clear_object (&priv->proxy); + G_OBJECT_CLASS (nm_device_wifi_parent_class)->dispose (object); } @@ -804,10 +795,6 @@ nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class) g_type_class_add_private (wifi_class, sizeof (NMDeviceWifiPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_WIRELESS); - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_DEVICE_WIRELESS, - NMDBUS_TYPE_DEVICE_WIFI_PROXY); - /* virtual methods */ object_class->get_property = get_property; object_class->dispose = dispose; diff --git a/libnm/nm-device-wimax.c b/libnm/nm-device-wimax.c index e26efedb..fd0a2dc5 100644 --- a/libnm/nm-device-wimax.c +++ b/libnm/nm-device-wimax.c @@ -30,9 +30,7 @@ #include "nm-device-wimax.h" #include "nm-wimax-nsp.h" #include "nm-object-private.h" -#include "nm-object-cache.h" #include "nm-core-internal.h" -#include "nm-device-private.h" G_DEFINE_TYPE (NMDeviceWimax, nm_device_wimax, NM_TYPE_DEVICE) @@ -91,7 +89,7 @@ nm_device_wimax_get_hw_address (NMDeviceWimax *wimax) { g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL); - return NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->hw_address; + return nm_str_not_empty (NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->hw_address); } /** @@ -300,7 +298,7 @@ nm_device_wimax_get_bsid (NMDeviceWimax *self) { g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), NULL); - return NM_DEVICE_WIMAX_GET_PRIVATE (self)->bsid; + return nm_str_not_empty (NM_DEVICE_WIMAX_GET_PRIVATE (self)->bsid); } static gboolean @@ -350,13 +348,11 @@ get_hw_address (NMDevice *device) return nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device)); } -/**************************************************************/ +/*****************************************************************************/ static void nm_device_wimax_init (NMDeviceWimax *device) { - _nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_WIMAX); - g_signal_connect (device, "notify::" NM_DEVICE_STATE, G_CALLBACK (state_changed_cb), @@ -531,8 +527,6 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class) g_type_class_add_private (wimax_class, sizeof (NMDeviceWimaxPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE_WIMAX); - /* virtual methods */ object_class->get_property = get_property; object_class->dispose = dispose; diff --git a/libnm/nm-device.c b/libnm/nm-device.c index b3dc01b2..02b5cad5 100644 --- a/libnm/nm-device.c +++ b/libnm/nm-device.c @@ -28,29 +28,12 @@ #include "nm-dbus-interface.h" #include "nm-active-connection.h" -#include "nm-device-ethernet.h" -#include "nm-device-adsl.h" -#include "nm-device-wifi.h" -#include "nm-device-modem.h" #include "nm-device-bt.h" -#include "nm-device-olpc-mesh.h" -#include "nm-device-wimax.h" -#include "nm-device-infiniband.h" -#include "nm-device-bond.h" -#include "nm-device-team.h" -#include "nm-device-bridge.h" -#include "nm-device-vlan.h" -#include "nm-device-vxlan.h" -#include "nm-device-generic.h" -#include "nm-device-ip-tunnel.h" -#include "nm-device-macvlan.h" -#include "nm-device-private.h" #include "nm-dhcp4-config.h" #include "nm-dhcp6-config.h" #include "nm-ip4-config.h" #include "nm-ip6-config.h" #include "nm-object-private.h" -#include "nm-object-cache.h" #include "nm-remote-connection.h" #include "nm-core-internal.h" #include "nm-utils.h" @@ -58,18 +41,12 @@ #include "nm-device-tun.h" #include "nm-setting-connection.h" -#include "nmdbus-device.h" +#include "introspection/org.freedesktop.NetworkManager.Device.h" -static GType _nm_device_decide_type (GVariant *value); static gboolean connection_compatible (NMDevice *device, NMConnection *connection, GError **error); static NMLldpNeighbor *nm_lldp_neighbor_dup (NMLldpNeighbor *neighbor); -G_DEFINE_TYPE_WITH_CODE (NMDevice, nm_device, NM_TYPE_OBJECT, - _nm_object_register_type_func (g_define_type_id, - _nm_device_decide_type, - NM_DBUS_INTERFACE_DEVICE, - "DeviceType"); - ) +G_DEFINE_ABSTRACT_TYPE (NMDevice, nm_device, NM_TYPE_OBJECT); #define NM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE, NMDevicePrivate)) @@ -213,11 +190,7 @@ demarshal_lldp_neighbors (NMObject *object, GParamSpec *pspec, GVariant *value, } static void -device_state_changed (NMDBusDevice *proxy, - guint new_state, - guint old_state, - guint reason, - gpointer user_data); +device_state_reason_changed (GObject *object, GParamSpec *pspec, gpointer user_data); static void init_dbus (NMObject *object) @@ -226,6 +199,7 @@ init_dbus (NMObject *object) const NMPropertiesInfo property_info[] = { { NM_DEVICE_UDI, &priv->udi }, { NM_DEVICE_INTERFACE, &priv->iface }, + { NM_DEVICE_DEVICE_TYPE, &priv->device_type }, { NM_DEVICE_IP_INTERFACE, &priv->ip_iface }, { NM_DEVICE_DRIVER, &priv->driver }, { NM_DEVICE_DRIVER_VERSION, &priv->driver_version }, @@ -251,7 +225,6 @@ init_dbus (NMObject *object) /* Properties that exist in D-Bus but that we don't track */ { "ip4-address", NULL }, - { "device-type", NULL }, { NULL }, }; @@ -263,136 +236,50 @@ init_dbus (NMObject *object) NM_DBUS_INTERFACE_DEVICE, property_info); - g_signal_connect (priv->proxy, "state-changed", - G_CALLBACK (device_state_changed), object); -} - -typedef struct { - NMDeviceState old_state; - NMDeviceState new_state; - NMDeviceStateReason reason; -} StateChangeData; - -static void -device_state_change_reloaded (GObject *object, - GAsyncResult *result, - gpointer user_data) -{ - NMDevice *self = NM_DEVICE (object); - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - StateChangeData *data = user_data; - NMDeviceState old_state = data->old_state; - NMDeviceState new_state = data->new_state; - NMDeviceStateReason reason = data->reason; - - g_slice_free (StateChangeData, data); - - _nm_object_reload_properties_finish (NM_OBJECT (object), result, NULL); - - /* If the device changes state several times in rapid succession, then we'll - * queue several reload_properties() calls, and there's no guarantee that - * they'll finish in the right order. In that case, only emit the signal - * for the last one. - */ - if (priv->last_seen_state != new_state) - return; - - /* Ensure that nm_device_get_state() will return the right value even if - * we haven't processed the corresponding PropertiesChanged yet. - */ - priv->state = new_state; - - g_signal_emit (self, signals[STATE_CHANGED], 0, - new_state, old_state, reason); + g_signal_connect (priv->proxy, "notify::state-reason", + G_CALLBACK (device_state_reason_changed), object); } static void -device_state_changed (NMDBusDevice *proxy, - guint new_state, - guint old_state, - guint reason, - gpointer user_data) +device_state_reason_changed (GObject *object, GParamSpec *pspec, gpointer user_data) { NMDevice *self = NM_DEVICE (user_data); NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self); - StateChangeData *data; - - if (old_state == new_state) - return; - - /* Our object-valued properties (eg, ip4_config) will still - * have their old values at this point, because NMObject is - * in the process of asynchronously reading the new values. - * Wait for that to finish before emitting the signal. - */ - priv->last_seen_state = new_state; - data = g_slice_new (StateChangeData); - data->old_state = old_state; - data->new_state = new_state; - data->reason = reason; - _nm_object_reload_properties_async (NM_OBJECT (user_data), - NULL, - device_state_change_reloaded, - data); + g_signal_emit (self, signals[STATE_CHANGED], 0, + priv->state, priv->last_seen_state, priv->reason); + priv->last_seen_state = priv->state; } -static GType -_nm_device_gtype_from_dtype (NMDeviceType dtype) +static NMDeviceType +coerce_type (NMDeviceType type) { - switch (dtype) { - case NM_DEVICE_TYPE_VETH: + switch (type) { case NM_DEVICE_TYPE_ETHERNET: - return NM_TYPE_DEVICE_ETHERNET; case NM_DEVICE_TYPE_WIFI: - return NM_TYPE_DEVICE_WIFI; - case NM_DEVICE_TYPE_MODEM: - return NM_TYPE_DEVICE_MODEM; case NM_DEVICE_TYPE_BT: - return NM_TYPE_DEVICE_BT; - case NM_DEVICE_TYPE_ADSL: - return NM_TYPE_DEVICE_ADSL; case NM_DEVICE_TYPE_OLPC_MESH: - return NM_TYPE_DEVICE_OLPC_MESH; case NM_DEVICE_TYPE_WIMAX: - return NM_TYPE_DEVICE_WIMAX; + case NM_DEVICE_TYPE_MODEM: case NM_DEVICE_TYPE_INFINIBAND: - return NM_TYPE_DEVICE_INFINIBAND; case NM_DEVICE_TYPE_BOND: - return NM_TYPE_DEVICE_BOND; case NM_DEVICE_TYPE_TEAM: - return NM_TYPE_DEVICE_TEAM; case NM_DEVICE_TYPE_BRIDGE: - return NM_TYPE_DEVICE_BRIDGE; case NM_DEVICE_TYPE_VLAN: - return NM_TYPE_DEVICE_VLAN; - case NM_DEVICE_TYPE_GENERIC: - return NM_TYPE_DEVICE_GENERIC; - case NM_DEVICE_TYPE_TUN: - return NM_TYPE_DEVICE_TUN; - case NM_DEVICE_TYPE_IP_TUNNEL: - return NM_TYPE_DEVICE_IP_TUNNEL; + case NM_DEVICE_TYPE_ADSL: + case NM_DEVICE_TYPE_MACSEC: case NM_DEVICE_TYPE_MACVLAN: - return NM_TYPE_DEVICE_MACVLAN; case NM_DEVICE_TYPE_VXLAN: - return NM_TYPE_DEVICE_VXLAN; - default: - g_warning ("Unknown device type %d", dtype); - return G_TYPE_INVALID; + case NM_DEVICE_TYPE_IP_TUNNEL: + case NM_DEVICE_TYPE_TUN: + case NM_DEVICE_TYPE_VETH: + case NM_DEVICE_TYPE_GENERIC: + case NM_DEVICE_TYPE_UNUSED1: + case NM_DEVICE_TYPE_UNUSED2: + case NM_DEVICE_TYPE_UNKNOWN: + return type; } -} - -static void -constructed (GObject *object) -{ - NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (object); - - G_OBJECT_CLASS (nm_device_parent_class)->constructed (object); - - /* Catch failure of subclasses to call _nm_device_set_device_type() */ - g_warn_if_fail (priv->device_type != NM_DEVICE_TYPE_UNKNOWN); - /* Catch a subclass setting the wrong type */ - g_warn_if_fail (G_OBJECT_TYPE (object) == _nm_device_gtype_from_dtype (priv->device_type)); + return NM_DEVICE_TYPE_UNKNOWN; } static void @@ -410,6 +297,8 @@ dispose (GObject *object) g_clear_pointer (&priv->available_connections, g_ptr_array_unref); g_clear_pointer (&priv->lldp_neighbors, g_ptr_array_unref); + g_clear_object (&priv->proxy); + G_OBJECT_CLASS (nm_device_parent_class)->dispose (object); } @@ -446,7 +335,7 @@ get_property (GObject *object, switch (prop_id) { case PROP_DEVICE_TYPE: - g_value_set_enum (value, nm_device_get_device_type (device)); + g_value_set_enum (value, coerce_type (nm_device_get_device_type (device))); break; case PROP_UDI: g_value_set_string (value, nm_device_get_udi (device)); @@ -543,10 +432,6 @@ set_property (GObject *object, gboolean b; switch (prop_id) { - case PROP_DEVICE_TYPE: - /* Construct only */ - priv->device_type = g_value_get_enum (value); - break; case PROP_MANAGED: b = g_value_get_boolean (value); if (priv->managed != b) @@ -571,11 +456,7 @@ nm_device_class_init (NMDeviceClass *device_class) g_type_class_add_private (device_class, sizeof (NMDevicePrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DEVICE); - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_DEVICE, NMDBUS_TYPE_DEVICE_PROXY); - /* virtual methods */ - object_class->constructed = constructed; object_class->get_property = get_property; object_class->set_property = set_property; object_class->dispose = dispose; @@ -953,35 +834,6 @@ nm_device_class_init (NMDeviceClass *device_class) G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT); } -/** - * _nm_device_set_device_type: - * @device: the device - * @dtype: the NM device type - * - * Sets the NM device type if it wasn't set during construction. INTERNAL - * ONLY METHOD. - **/ -void -_nm_device_set_device_type (NMDevice *device, NMDeviceType dtype) -{ - NMDevicePrivate *priv; - - g_return_if_fail (device != NULL); - g_return_if_fail (dtype != NM_DEVICE_TYPE_UNKNOWN); - - priv = NM_DEVICE_GET_PRIVATE (device); - if (priv->device_type == NM_DEVICE_TYPE_UNKNOWN) - priv->device_type = dtype; - else - g_warn_if_fail (dtype == priv->device_type); -} - -static GType -_nm_device_decide_type (GVariant *value) -{ - return _nm_device_gtype_from_dtype (g_variant_get_uint32 (value)); -} - /** * nm_device_get_iface: * @device: a #NMDevice @@ -996,7 +848,7 @@ nm_device_get_iface (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return NM_DEVICE_GET_PRIVATE (device)->iface; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->iface); } /** @@ -1014,7 +866,7 @@ nm_device_get_ip_iface (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return NM_DEVICE_GET_PRIVATE (device)->ip_iface; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->ip_iface); } /** @@ -1048,7 +900,7 @@ nm_device_get_udi (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return NM_DEVICE_GET_PRIVATE (device)->udi; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->udi); } /** @@ -1065,7 +917,7 @@ nm_device_get_driver (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return NM_DEVICE_GET_PRIVATE (device)->driver; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->driver); } /** @@ -1082,7 +934,7 @@ nm_device_get_driver_version (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return NM_DEVICE_GET_PRIVATE (device)->driver_version; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->driver_version); } /** @@ -1099,7 +951,7 @@ nm_device_get_firmware_version (NMDevice *device) { g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - return NM_DEVICE_GET_PRIVATE (device)->firmware_version; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->firmware_version); } /** @@ -1124,7 +976,7 @@ nm_device_get_type_description (NMDevice *device) g_return_val_if_fail (NM_IS_DEVICE (device), NULL); if (priv->type_description) - return priv->type_description; + return nm_str_not_empty (priv->type_description); if (NM_DEVICE_GET_CLASS (device)->get_type_description) { desc = NM_DEVICE_GET_CLASS (device)->get_type_description (device); @@ -1137,7 +989,7 @@ nm_device_get_type_description (NMDevice *device) typename += 8; priv->type_description = g_ascii_strdown (typename, -1); - return priv->type_description; + return nm_str_not_empty (priv->type_description); } /** @@ -1840,6 +1692,8 @@ get_type_name (NMDevice *device) return _("Tun"); case NM_DEVICE_TYPE_VETH: return _("Veth"); + case NM_DEVICE_TYPE_MACSEC: + return _("MACsec"); case NM_DEVICE_TYPE_GENERIC: case NM_DEVICE_TYPE_UNUSED1: case NM_DEVICE_TYPE_UNUSED2: @@ -2084,16 +1938,9 @@ done: const char * nm_device_get_physical_port_id (NMDevice *device) { - NMDevicePrivate *priv; - g_return_val_if_fail (NM_IS_DEVICE (device), NULL); - priv = NM_DEVICE_GET_PRIVATE (device); - - if (priv->physical_port_id && *priv->physical_port_id) - return priv->physical_port_id; - else - return NULL; + return nm_str_not_empty (NM_DEVICE_GET_PRIVATE (device)->physical_port_id); } /** diff --git a/libnm/nm-dhcp4-config.c b/libnm/nm-dhcp4-config.c index 26e89c27..0e783576 100644 --- a/libnm/nm-dhcp4-config.c +++ b/libnm/nm-dhcp4-config.c @@ -33,7 +33,4 @@ nm_dhcp4_config_init (NMDhcp4Config *config) static void nm_dhcp4_config_class_init (NMDhcp4ConfigClass *config_class) { - NMObjectClass *nm_object_class = NM_OBJECT_CLASS (config_class); - - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DHCP4_CONFIG); } diff --git a/libnm/nm-dhcp6-config.c b/libnm/nm-dhcp6-config.c index f1556b20..9252e734 100644 --- a/libnm/nm-dhcp6-config.c +++ b/libnm/nm-dhcp6-config.c @@ -33,7 +33,4 @@ nm_dhcp6_config_init (NMDhcp6Config *config) static void nm_dhcp6_config_class_init (NMDhcp6ConfigClass *config_class) { - NMObjectClass *nm_object_class = NM_OBJECT_CLASS (config_class); - - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_DHCP6_CONFIG); } diff --git a/libnm/nm-dns-manager.c b/libnm/nm-dns-manager.c new file mode 100644 index 00000000..f9ee332b --- /dev/null +++ b/libnm/nm-dns-manager.c @@ -0,0 +1,450 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2016 Red Hat, Inc. + */ + +#include "nm-default.h" + +#include "nm-dns-manager.h" + +#include + +#include "nm-dbus-interface.h" +#include "nm-connection.h" + +#include "nm-client.h" +#include "nm-object-private.h" +#include "nm-dbus-helpers.h" +#include "nm-core-internal.h" + +#include "introspection/org.freedesktop.NetworkManager.DnsManager.h" + +G_DEFINE_TYPE (NMDnsManager, nm_dns_manager, NM_TYPE_OBJECT) + +#define NM_DNS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DNS_MANAGER, NMDnsManagerPrivate)) + +typedef struct { + NMDBusDnsManager *proxy; + char *mode; + char *rc_manager; + GPtrArray *configuration; +} NMDnsManagerPrivate; + +enum { + PROP_0, + PROP_MODE, + PROP_RC_MANAGER, + PROP_CONFIGURATION, + + LAST_PROP +}; + +/***************************************************************************** + * NMDnsEntry + *****************************************************************************/ + +G_DEFINE_BOXED_TYPE (NMDnsEntry, nm_dns_entry, nm_dns_entry_dup, nm_dns_entry_unref) + +struct NMDnsEntry { + guint refcount; + + char *interface; + char **nameservers; + char **domains; + int priority; + gboolean vpn; +}; + +/** + * nm_dns_entry_new: + * + * Creates a new #NMDnsEntry object. + * + * Returns: (transfer full): the new #NMDnsEntry object, or %NULL on error + **/ +NMDnsEntry * +nm_dns_entry_new (const char *interface, + const char * const *nameservers, + const char * const *domains, + int priority, + gboolean vpn) +{ + NMDnsEntry *entry; + guint i, len; + + entry = g_slice_new0 (NMDnsEntry); + entry->refcount = 1; + + entry->interface = g_strdup (interface); + + if (nameservers) { + len = g_strv_length ((char **) nameservers); + entry->nameservers = g_new (char *, len + 1); + for (i = 0; i < len + 1; i++) + entry->nameservers[i] = g_strdup (nameservers[i]); + } + + if (domains) { + len = g_strv_length ((char **) domains); + entry->domains = g_new (char *, len + 1); + for (i = 0; i < len + 1; i++) + entry->domains[i] = g_strdup (domains[i]); + } + + entry->priority = priority; + entry->vpn = vpn; + + return entry; +} + +/** + * nm_dns_entry_dup: + * @entry: the #NMDnsEntry + * + * Creates a copy of @entry + * + * Returns: (transfer full): a copy of @entry + **/ +NMDnsEntry * +nm_dns_entry_dup (NMDnsEntry *entry) +{ + NMDnsEntry *copy; + + g_return_val_if_fail (entry != NULL, NULL); + g_return_val_if_fail (entry->refcount > 0, NULL); + + copy = nm_dns_entry_new (entry->interface, + (const char * const *) entry->nameservers, + (const char * const *) entry->domains, + entry->priority, + entry->vpn); + + return copy; +} + +/** + * nm_dns_entry_unref: + * @entry: the #NMDnsEntry + * + * Decreases the reference count of the object. If the reference count + * reaches zero, the object will be destroyed. + * + * Since: 1.6 + **/ +void +nm_dns_entry_unref (NMDnsEntry *entry) +{ + g_return_if_fail (entry != NULL); + g_return_if_fail (entry->refcount > 0); + + entry->refcount--; + if (entry->refcount == 0) { + g_free (entry->interface); + g_strfreev (entry->nameservers); + g_strfreev (entry->domains); + g_slice_free (NMDnsEntry, entry); + } +} + +/** + * nm_dns_entry_get_interface: + * @entry: the #NMDnsEntry + * + * Gets the interface on which name servers are contacted. + * + * Returns: (transfer none): the interface name + * + * Since: 1.6 + **/ +const char * +nm_dns_entry_get_interface (NMDnsEntry *entry) +{ + g_return_val_if_fail (entry, 0); + g_return_val_if_fail (entry->refcount > 0, 0); + + return entry->interface; +} + +/** + * nm_dns_entry_get_nameservers: + * @entry: the #NMDnsEntry + * + * Gets the list of name servers for this entry. + * + * Returns: (transfer none): the list of name servers + * + * Since: 1.6 + **/ +const char * const * +nm_dns_entry_get_nameservers (NMDnsEntry *entry) +{ + g_return_val_if_fail (entry, 0); + g_return_val_if_fail (entry->refcount > 0, 0); + + return (const char * const *) entry->nameservers; +} + +/** + * nm_dns_entry_get_domains: + * @entry: the #NMDnsEntry + * + * Gets the list of DNS domains. + * + * Returns: (transfer none): the list of DNS domains + * + * Since: 1.6 + **/ +const char * const * +nm_dns_entry_get_domains (NMDnsEntry *entry) +{ + g_return_val_if_fail (entry, 0); + g_return_val_if_fail (entry->refcount > 0, 0); + + return (const char * const *)entry->domains; +} + +/** + * nm_dns_entry_get_vpn: + * @entry: the #NMDnsEntry + * + * Gets whether the entry refers to VPN name servers. + * + * Returns: %TRUE if the entry refers to VPN name servers + * + * Since: 1.6 + **/ +gboolean +nm_dns_entry_get_vpn (NMDnsEntry *entry) +{ + g_return_val_if_fail (entry, 0); + g_return_val_if_fail (entry->refcount > 0, 0); + + return entry->vpn; +} + +/** + * nm_dns_entry_get_priority: + * @entry: the #NMDnsEntry + * + * Gets the priority of the entry + * + * Returns: the priority of the entry + * + * Since: 1.6 + **/ +int +nm_dns_entry_get_priority (NMDnsEntry *entry) +{ + g_return_val_if_fail (entry, 0); + g_return_val_if_fail (entry->refcount > 0, 0); + + return entry->priority; +} + +/*****************************************************************************/ + +static gboolean +demarshal_dns_configuration (NMObject *object, GParamSpec *pspec, GVariant *value, gpointer field) +{ + NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (object); + GVariant *entry_var; + GVariantIter iter, *iterp; + NMDnsEntry *entry; + GPtrArray *array; + + g_return_val_if_fail (g_variant_is_of_type (value, G_VARIANT_TYPE ("aa{sv}")), FALSE); + + g_variant_iter_init (&iter, value); + g_ptr_array_unref (priv->configuration); + priv->configuration = g_ptr_array_new_with_free_func ((GDestroyNotify) nm_dns_entry_unref); + + while (g_variant_iter_next (&iter, "@a{sv}", &entry_var)) { + char **nameservers = NULL, **domains = NULL; + gboolean vpn = FALSE; + char *interface = NULL, *str; + gint priority; + + if ( !g_variant_lookup (entry_var, "nameservers", "as", &iterp) + || !g_variant_lookup (entry_var, "priority", "i", &priority)) { + g_warning ("Ignoring invalid DNS configuration"); + g_variant_unref (entry_var); + continue; + } + + array = g_ptr_array_new (); + while (g_variant_iter_next (iterp, "&s", &str)) + g_ptr_array_add (array, str); + g_ptr_array_add (array, NULL); + nameservers = (char **) g_ptr_array_free (array, FALSE); + g_variant_iter_free (iterp); + + if (g_variant_lookup (entry_var, "domains", "as", &iterp)) { + array = g_ptr_array_new (); + while (g_variant_iter_next (iterp, "&s", &str)) + g_ptr_array_add (array, str); + g_ptr_array_add (array, NULL); + domains = (char **) g_ptr_array_free (array, FALSE); + g_variant_iter_free (iterp); + } + + g_variant_lookup (entry_var, "interface", "&s", &interface); + g_variant_lookup (entry_var, "priority", "i", &priority); + g_variant_lookup (entry_var, "vpn", "b", &vpn); + + entry = nm_dns_entry_new (interface, + (const char * const *) nameservers, + (const char * const *) domains, + priority, + vpn); + g_free (domains); + g_free (nameservers); + if (!entry) { + g_warning ("Ignoring invalid DNS entry"); + g_variant_unref (entry_var); + continue; + } + + g_ptr_array_add (priv->configuration, entry); + } + + _nm_object_queue_notify (object, NM_DNS_MANAGER_CONFIGURATION); + + return TRUE; +} + +/*****************************************************************************/ +const char * +nm_dns_manager_get_mode (NMDnsManager *manager) +{ + return NM_DNS_MANAGER_GET_PRIVATE (manager)->mode; +} + +const char * +nm_dns_manager_get_rc_manager (NMDnsManager *manager) +{ + return NM_DNS_MANAGER_GET_PRIVATE (manager)->rc_manager; +} + +const GPtrArray * +nm_dns_manager_get_configuration (NMDnsManager *manager) +{ + return NM_DNS_MANAGER_GET_PRIVATE (manager)->configuration; +} +/*****************************************************************************/ + +static void +nm_dns_manager_init (NMDnsManager *self) +{ + NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); + + priv->configuration = g_ptr_array_new (); +} + +static void +init_dbus (NMObject *object) +{ + NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (object); + const NMPropertiesInfo property_info[] = { + { NM_DNS_MANAGER_MODE, &priv->mode }, + { NM_DNS_MANAGER_RC_MANAGER, &priv->rc_manager }, + { NM_DNS_MANAGER_CONFIGURATION, &priv->configuration, demarshal_dns_configuration }, + { NULL }, + }; + + NM_OBJECT_CLASS (nm_dns_manager_parent_class)->init_dbus (object); + + priv->proxy = NMDBUS_DNS_MANAGER (_nm_object_get_proxy (object, NM_DBUS_INTERFACE_DNS_MANAGER)); + _nm_object_register_properties (object, + NM_DBUS_INTERFACE_DNS_MANAGER, + property_info); +} + +static void +dispose (GObject *object) +{ + NMDnsManager *self = NM_DNS_MANAGER (object); + NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (self); + + g_clear_pointer (&priv->mode, g_free); + g_clear_pointer (&priv->rc_manager, g_free); + g_clear_pointer (&priv->configuration, g_ptr_array_unref); + + G_OBJECT_CLASS (nm_dns_manager_parent_class)->dispose (object); +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMDnsManagerPrivate *priv = NM_DNS_MANAGER_GET_PRIVATE (object); + + switch (prop_id) { + case PROP_MODE: + g_value_set_string (value, priv->mode); + break; + case PROP_RC_MANAGER: + g_value_set_string (value, priv->rc_manager); + break; + case PROP_CONFIGURATION: + g_value_take_boxed (value, _nm_utils_copy_array (priv->configuration, + (NMUtilsCopyFunc) nm_dns_entry_dup, + (GDestroyNotify) nm_dns_entry_unref)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_dns_manager_class_init (NMDnsManagerClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + NMObjectClass *nm_object_class = NM_OBJECT_CLASS (class); + + g_type_class_add_private (class, sizeof (NMDnsManagerPrivate)); + + /* Virtual methods */ + object_class->get_property = get_property; + object_class->dispose = dispose; + + nm_object_class->init_dbus = init_dbus; + + /* Properties */ + + g_object_class_install_property + (object_class, PROP_MODE, + g_param_spec_string (NM_DNS_MANAGER_MODE, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property + (object_class, PROP_RC_MANAGER, + g_param_spec_string (NM_DNS_MANAGER_RC_MANAGER, "", "", + NULL, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + g_object_class_install_property + (object_class, PROP_CONFIGURATION, + g_param_spec_boxed (NM_DNS_MANAGER_CONFIGURATION, "", "", + G_TYPE_PTR_ARRAY, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); +} diff --git a/libnm/nm-dns-manager.h b/libnm/nm-dns-manager.h new file mode 100644 index 00000000..9ed3dfbe --- /dev/null +++ b/libnm/nm-dns-manager.h @@ -0,0 +1,72 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ +/* + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + * Copyright 2016 Red Hat, Inc. + */ + +#ifndef __NM_DNS_MANAGER_H__ +#define __NM_DNS_MANAGER_H__ + +#include +#include "nm-client.h" + +G_BEGIN_DECLS + +#define NM_TYPE_DNS_MANAGER (nm_dns_manager_get_type ()) +#define NM_DNS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DNS_MANAGER, NMDnsManager)) +#define NM_DNS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DNS_MANAGER, NMDnsManagerClass)) +#define NM_IS_DNS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DNS_MANAGER)) +#define NM_IS_DNS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DNS_MANAGER)) +#define NM_DNS_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DNS_MANAGER, NMDnsManagerClass)) + +#define NM_DNS_MANAGER_MODE "mode" +#define NM_DNS_MANAGER_RC_MANAGER "rc-manager" +#define NM_DNS_MANAGER_CONFIGURATION "configuration" + +typedef struct _NMDnsManager NMDnsManager; +typedef struct _NMDnsManagerClass NMDnsManagerClass; + +/** + * NMDnsManager: + */ +struct _NMDnsManager { + NMObject parent; +}; + +struct _NMDnsManagerClass { + NMObjectClass parent; + + /*< private >*/ + gpointer padding[8]; +}; + +G_END_DECLS + +GType nm_dns_manager_get_type (void); + +const char *nm_dns_manager_get_mode (NMDnsManager *manager); +const char *nm_dns_manager_get_rc_manager (NMDnsManager *manager); +const GPtrArray *nm_dns_manager_get_configuration (NMDnsManager *manager); + +NMDnsEntry * nm_dns_entry_new (const char *interface, + const char * const *nameservers, + const char * const *domains, + int priority, + gboolean vpn); +NMDnsEntry * nm_dns_entry_dup (NMDnsEntry *entry); + +#endif /* __NM_DNS_MANAGER_H__ */ diff --git a/libnm/nm-enum-types.c b/libnm/nm-enum-types.c deleted file mode 100644 index eaebcfbe..00000000 --- a/libnm/nm-enum-types.c +++ /dev/null @@ -1,123 +0,0 @@ - - - -/* Generated by glib-mkenums. Do not edit */ - -#include "config.h" - -#include "nm-enum-types.h" -#include "nm-default.h" - -#include "nm-version-macros.h" -#include "NetworkManager.h" -#include "nm-access-point.h" -#include "nm-active-connection.h" -#include "nm-client.h" -#include "nm-device-adsl.h" -#include "nm-device-bond.h" -#include "nm-device-bridge.h" -#include "nm-device-bt.h" -#include "nm-device-ethernet.h" -#include "nm-device-generic.h" -#include "nm-device-infiniband.h" -#include "nm-device-ip-tunnel.h" -#include "nm-device-macvlan.h" -#include "nm-device-modem.h" -#include "nm-device-olpc-mesh.h" -#include "nm-device-team.h" -#include "nm-device-tun.h" -#include "nm-device-vlan.h" -#include "nm-device-vxlan.h" -#include "nm-device-wifi.h" -#include "nm-device-wimax.h" -#include "nm-device.h" -#include "nm-dhcp-config.h" -#include "nm-ip-config.h" -#include "nm-object.h" -#include "nm-remote-connection.h" -#include "nm-types.h" -#include "nm-vpn-connection.h" -#include "nm-vpn-editor.h" -#include "nm-wimax-nsp.h" -#include "nm-secret-agent-old.h" -#include "nm-vpn-plugin-old.h" -#include "nm-vpn-service-plugin.h" - -GType -nm_client_permission_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) - { - static const GEnumValue values[] = { - { NM_CLIENT_PERMISSION_NONE, "NM_CLIENT_PERMISSION_NONE", "none" }, - { NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK, "NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK", "enable-disable-network" }, - { NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI, "NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI", "enable-disable-wifi" }, - { NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN, "NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN", "enable-disable-wwan" }, - { NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX, "NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX", "enable-disable-wimax" }, - { NM_CLIENT_PERMISSION_SLEEP_WAKE, "NM_CLIENT_PERMISSION_SLEEP_WAKE", "sleep-wake" }, - { NM_CLIENT_PERMISSION_NETWORK_CONTROL, "NM_CLIENT_PERMISSION_NETWORK_CONTROL", "network-control" }, - { NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED, "NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED", "wifi-share-protected" }, - { NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN, "NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN", "wifi-share-open" }, - { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM", "settings-modify-system" }, - { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN", "settings-modify-own" }, - { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME", "settings-modify-hostname" }, - { NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS, "NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS", "settings-modify-global-dns" }, - { NM_CLIENT_PERMISSION_RELOAD, "NM_CLIENT_PERMISSION_RELOAD", "reload" }, - { NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK, "NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK", "checkpoint-rollback" }, - { NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS, "NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS", "enable-disable-statistics" }, - { NM_CLIENT_PERMISSION_LAST, "NM_CLIENT_PERMISSION_LAST", "last" }, - { 0, NULL, NULL } - }; - GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMClientPermission"), values); - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} -GType -nm_client_permission_result_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) - { - static const GEnumValue values[] = { - { NM_CLIENT_PERMISSION_RESULT_UNKNOWN, "NM_CLIENT_PERMISSION_RESULT_UNKNOWN", "unknown" }, - { NM_CLIENT_PERMISSION_RESULT_YES, "NM_CLIENT_PERMISSION_RESULT_YES", "yes" }, - { NM_CLIENT_PERMISSION_RESULT_AUTH, "NM_CLIENT_PERMISSION_RESULT_AUTH", "auth" }, - { NM_CLIENT_PERMISSION_RESULT_NO, "NM_CLIENT_PERMISSION_RESULT_NO", "no" }, - { 0, NULL, NULL } - }; - GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMClientPermissionResult"), values); - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} -GType -nm_client_error_get_type (void) -{ - static volatile gsize g_define_type_id__volatile = 0; - - if (g_once_init_enter (&g_define_type_id__volatile)) - { - static const GEnumValue values[] = { - { NM_CLIENT_ERROR_FAILED, "NM_CLIENT_ERROR_FAILED", "failed" }, - { NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, "NM_CLIENT_ERROR_MANAGER_NOT_RUNNING", "manager-not-running" }, - { NM_CLIENT_ERROR_OBJECT_CREATION_FAILED, "NM_CLIENT_ERROR_OBJECT_CREATION_FAILED", "object-creation-failed" }, - { 0, NULL, NULL } - }; - GType g_define_type_id = - g_enum_register_static (g_intern_static_string ("NMClientError"), values); - g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); - } - - return g_define_type_id__volatile; -} - - - diff --git a/libnm/nm-enum-types.h b/libnm/nm-enum-types.h deleted file mode 100644 index 451c6964..00000000 --- a/libnm/nm-enum-types.h +++ /dev/null @@ -1,24 +0,0 @@ - - - -/* Generated by glib-mkenums. Do not edit */ - -#ifndef __NM_ENUM_TYPES_H__ -#define __NM_ENUM_TYPES_H__ - -#include -#include - -G_BEGIN_DECLS -GType nm_client_permission_get_type (void) G_GNUC_CONST; -#define NM_TYPE_CLIENT_PERMISSION (nm_client_permission_get_type ()) -GType nm_client_permission_result_get_type (void) G_GNUC_CONST; -#define NM_TYPE_CLIENT_PERMISSION_RESULT (nm_client_permission_result_get_type ()) -GType nm_client_error_get_type (void) G_GNUC_CONST; -#define NM_TYPE_CLIENT_ERROR (nm_client_error_get_type ()) -G_END_DECLS - -#endif /* __NM_ENUM_TYPES_H__ */ - - - diff --git a/libnm/nm-ifcfg-rh-docs.xml b/libnm/nm-ifcfg-rh-docs.xml deleted file mode 100644 index 36018c21..00000000 --- a/libnm/nm-ifcfg-rh-docs.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libnm/nm-ip-config.c b/libnm/nm-ip-config.c index 97fb0aa9..74db9994 100644 --- a/libnm/nm-ip-config.c +++ b/libnm/nm-ip-config.c @@ -395,7 +395,7 @@ nm_ip_config_get_gateway (NMIPConfig *config) { g_return_val_if_fail (NM_IS_IP_CONFIG (config), NULL); - return NM_IP_CONFIG_GET_PRIVATE (config)->gateway; + return nm_str_not_empty (NM_IP_CONFIG_GET_PRIVATE (config)->gateway); } /** diff --git a/libnm/nm-ip4-config.c b/libnm/nm-ip4-config.c index a57fc30f..322ea4e8 100644 --- a/libnm/nm-ip4-config.c +++ b/libnm/nm-ip4-config.c @@ -33,7 +33,4 @@ nm_ip4_config_init (NMIP4Config *config) static void nm_ip4_config_class_init (NMIP4ConfigClass *config_class) { - NMObjectClass *nm_object_class = NM_OBJECT_CLASS (config_class); - - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_IP4_CONFIG); } diff --git a/libnm/nm-ip6-config.c b/libnm/nm-ip6-config.c index 983c0465..93cdf332 100644 --- a/libnm/nm-ip6-config.c +++ b/libnm/nm-ip6-config.c @@ -33,7 +33,4 @@ nm_ip6_config_init (NMIP6Config *config) static void nm_ip6_config_class_init (NMIP6ConfigClass *config_class) { - NMObjectClass *nm_object_class = NM_OBJECT_CLASS (config_class); - - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_IP6_CONFIG); } diff --git a/libnm/nm-keyfile-docs.xml b/libnm/nm-keyfile-docs.xml deleted file mode 100644 index 33635aa7..00000000 --- a/libnm/nm-keyfile-docs.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libnm/nm-manager.c b/libnm/nm-manager.c index dc14f83d..1b453bd9 100644 --- a/libnm/nm-manager.c +++ b/libnm/nm-manager.c @@ -29,15 +29,13 @@ #include "nm-common-macros.h" #include "nm-device-ethernet.h" #include "nm-device-wifi.h" -#include "nm-device-private.h" #include "nm-core-internal.h" #include "nm-object-private.h" #include "nm-active-connection.h" #include "nm-vpn-connection.h" -#include "nm-object-cache.h" #include "nm-dbus-helpers.h" -#include "nmdbus-manager.h" +#include "introspection/org.freedesktop.NetworkManager.h" void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled); @@ -54,7 +52,7 @@ G_DEFINE_TYPE_WITH_CODE (NMManager, nm_manager, NM_TYPE_OBJECT, #define NM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_MANAGER, NMManagerPrivate)) typedef struct { - NMDBusManager *manager_proxy; + NMDBusManager *proxy; GCancellable *props_cancellable; char *version; NMState state; @@ -91,7 +89,6 @@ enum { PROP_VERSION, PROP_STATE, PROP_STARTUP, - PROP_NM_RUNNING, PROP_NETWORKING_ENABLED, PROP_WIRELESS_ENABLED, PROP_WIRELESS_HARDWARE_ENABLED, @@ -124,11 +121,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; -static void nm_running_changed_cb (GObject *object, - GParamSpec *pspec, - gpointer user_data); - -/**********************************************************************/ +/*****************************************************************************/ static void nm_manager_init (NMManager *manager) @@ -193,13 +186,13 @@ init_dbus (NMObject *object) NM_OBJECT_CLASS (nm_manager_parent_class)->init_dbus (object); - priv->manager_proxy = NMDBUS_MANAGER (_nm_object_get_proxy (object, NM_DBUS_INTERFACE)); + priv->proxy = NMDBUS_MANAGER (_nm_object_get_proxy (object, NM_DBUS_INTERFACE)); _nm_object_register_properties (object, NM_DBUS_INTERFACE, property_info); /* Permissions */ - g_signal_connect (priv->manager_proxy, "check-permissions", + g_signal_connect (priv->proxy, "check-permissions", G_CALLBACK (manager_recheck_permissions), object); } @@ -314,7 +307,7 @@ get_permissions_sync (NMManager *self, GError **error) NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); GVariant *permissions; - if (nmdbus_manager_call_get_permissions_sync (priv->manager_proxy, + if (nmdbus_manager_call_get_permissions_sync (priv->proxy, &permissions, NULL, error)) { update_permissions (self, permissions); @@ -371,7 +364,7 @@ manager_recheck_permissions (NMDBusManager *proxy, gpointer user_data) return; priv->perm_call_cancellable = g_cancellable_new (); - nmdbus_manager_call_get_permissions (priv->manager_proxy, + nmdbus_manager_call_get_permissions (priv->proxy, priv->perm_call_cancellable, get_permissions_reply, self); @@ -382,7 +375,7 @@ nm_manager_get_version (NMManager *manager) { g_return_val_if_fail (NM_IS_MANAGER (manager), NULL); - return NM_MANAGER_GET_PRIVATE (manager)->version; + return nm_str_not_empty (NM_MANAGER_GET_PRIVATE (manager)->version); } NMState @@ -401,14 +394,6 @@ nm_manager_get_startup (NMManager *manager) return NM_MANAGER_GET_PRIVATE (manager)->startup; } -gboolean -nm_manager_get_nm_running (NMManager *manager) -{ - g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE); - - return _nm_object_get_nm_running (NM_OBJECT (manager)); -} - gboolean nm_manager_networking_get_enabled (NMManager *manager) { @@ -424,7 +409,7 @@ nm_manager_networking_set_enabled (NMManager *manager, gboolean enable, GError * g_return_val_if_fail (NM_IS_MANAGER (manager), FALSE); - ret = nmdbus_manager_call_enable_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + ret = nmdbus_manager_call_enable_sync (NM_MANAGER_GET_PRIVATE (manager)->proxy, enable, NULL, error); if (error && *error) @@ -526,7 +511,7 @@ nm_manager_get_logging (NMManager *manager, char **level, char **domains, GError if (!level && !domains) return TRUE; - ret = nmdbus_manager_call_get_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + ret = nmdbus_manager_call_get_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->proxy, level, domains, NULL, error); if (error && *error) @@ -550,7 +535,7 @@ nm_manager_set_logging (NMManager *manager, const char *level, const char *domai if (!domains) domains = ""; - ret = nmdbus_manager_call_set_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + ret = nmdbus_manager_call_set_logging_sync (NM_MANAGER_GET_PRIVATE (manager)->proxy, level, domains, NULL, error); if (error && *error) @@ -589,7 +574,7 @@ nm_manager_check_connectivity (NMManager *manager, g_return_val_if_fail (NM_IS_MANAGER (manager), NM_CONNECTIVITY_UNKNOWN); priv = NM_MANAGER_GET_PRIVATE (manager); - if (nmdbus_manager_call_check_connectivity_sync (priv->manager_proxy, + if (nmdbus_manager_call_check_connectivity_sync (priv->proxy, &connectivity, cancellable, error)) return connectivity; @@ -636,7 +621,7 @@ nm_manager_check_connectivity_async (NMManager *manager, simple = g_simple_async_result_new (G_OBJECT (manager), callback, user_data, nm_manager_check_connectivity_async); - nmdbus_manager_call_check_connectivity (priv->manager_proxy, + nmdbus_manager_call_check_connectivity (priv->proxy, cancellable, check_connectivity_cb, simple); } @@ -657,9 +642,9 @@ nm_manager_check_connectivity_finish (NMManager *manager, return (NMConnectivityState) g_simple_async_result_get_op_res_gssize (simple); } -/****************************************************************/ +/*****************************************************************************/ /* Devices */ -/****************************************************************/ +/*****************************************************************************/ const GPtrArray * nm_manager_get_devices (NMManager *manager) @@ -721,9 +706,9 @@ nm_manager_get_device_by_iface (NMManager *manager, const char *iface) return device; } -/****************************************************************/ +/*****************************************************************************/ /* Active Connections */ -/****************************************************************/ +/*****************************************************************************/ const GPtrArray * nm_manager_get_active_connections (NMManager *manager) @@ -758,8 +743,6 @@ typedef struct { char *new_connection_path; } ActivateInfo; -static void active_removed (NMObject *object, NMActiveConnection *active, gpointer user_data); - static void activate_info_complete (ActivateInfo *info, NMActiveConnection *active, @@ -767,7 +750,6 @@ activate_info_complete (ActivateInfo *info, { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (info->manager); - g_signal_handlers_disconnect_by_func (info->manager, G_CALLBACK (active_removed), info); if (active) g_simple_async_result_set_op_res_gpointer (info->simple, g_object_ref (active), g_object_unref); else @@ -812,6 +794,10 @@ recheck_pending_activations (NMManager *self) NMActiveConnection *candidate; const GPtrArray *devices; NMDevice *device; + GDBusObjectManager *object_manager = NULL; + GError *error; + + object_manager = _nm_object_get_dbus_object_manager (NM_OBJECT (self)); /* For each pending activation, look for an active connection that has the * pending activation's object path, where the active connection and its @@ -820,9 +806,25 @@ recheck_pending_activations (NMManager *self) */ for (iter = priv->pending_activations; iter; iter = next) { ActivateInfo *info = iter->data; + gs_unref_object GDBusObject *dbus_obj = NULL; next = g_slist_next (iter); + if (!info->active_path) + continue; + + /* Check that the object manager still knows about the object. + * It could be that it vanished before we even learned its name. */ + dbus_obj = g_dbus_object_manager_get_object (object_manager, info->active_path); + if (!dbus_obj) { + error = g_error_new_literal (NM_CLIENT_ERROR, + NM_CLIENT_ERROR_OBJECT_CREATION_FAILED, + _("Active connection removed before it was initialized")); + activate_info_complete (info, NULL, error); + g_clear_error (&error); + break; + } + candidate = find_active_connection_by_path (self, info->active_path); if (!candidate) continue; @@ -857,22 +859,6 @@ activation_cancelled (GCancellable *cancellable, g_clear_error (&error); } -static void -active_removed (NMObject *object, NMActiveConnection *active, gpointer user_data) -{ - ActivateInfo *info = user_data; - GError *error = NULL; - - if (strcmp (info->active_path, nm_object_get_path (NM_OBJECT (active)))) - return; - - error = g_error_new_literal (NM_CLIENT_ERROR, - NM_CLIENT_ERROR_FAILED, - _("Active connection could not be attached to the device")); - activate_info_complete (info, NULL, error); - g_clear_error (&error); -} - static void activate_cb (GObject *object, GAsyncResult *result, @@ -889,9 +875,6 @@ activate_cb (GObject *object, G_CALLBACK (activation_cancelled), info); } - g_signal_connect (info->manager, "active-connection-removed", - G_CALLBACK (active_removed), info); - recheck_pending_activations (info->manager); } else { g_dbus_error_strip_remote_error (error); @@ -927,7 +910,7 @@ nm_manager_activate_connection_async (NMManager *manager, priv = NM_MANAGER_GET_PRIVATE (manager); priv->pending_activations = g_slist_prepend (priv->pending_activations, info); - nmdbus_manager_call_activate_connection (priv->manager_proxy, + nmdbus_manager_call_activate_connection (priv->proxy, connection ? nm_connection_get_path (connection) : "/", device ? nm_object_get_path (NM_OBJECT (device)) : "/", specific_object ? specific_object : "/", @@ -968,9 +951,6 @@ add_activate_cb (GObject *object, G_CALLBACK (activation_cancelled), info); } - g_signal_connect (info->manager, "active-connection-removed", - G_CALLBACK (active_removed), info); - recheck_pending_activations (info->manager); } else { g_dbus_error_strip_remote_error (error); @@ -1011,7 +991,7 @@ nm_manager_add_and_activate_connection_async (NMManager *manager, if (!dict) dict = g_variant_new_array (G_VARIANT_TYPE ("{sa{sv}}"), NULL, 0); - nmdbus_manager_call_add_and_activate_connection (priv->manager_proxy, + nmdbus_manager_call_add_and_activate_connection (priv->proxy, dict, nm_object_get_path (NM_OBJECT (device)), specific_object ? specific_object : "/", @@ -1076,33 +1056,7 @@ static void active_connection_removed (NMManager *self, NMActiveConnection *ac) { g_signal_handlers_disconnect_by_func (ac, G_CALLBACK (ac_devices_changed), self); -} - -static void -object_creation_failed (NMObject *object, const char *failed_path) -{ - NMManager *self = NM_MANAGER (object); - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self); - GError *error; - GSList *iter; - - /* A newly activated connection failed due to some immediate error - * and disappeared from active connection list. Make sure the - * callback gets called. - */ - error = g_error_new_literal (NM_CLIENT_ERROR, - NM_CLIENT_ERROR_OBJECT_CREATION_FAILED, - _("Active connection removed before it was initialized")); - - for (iter = priv->pending_activations; iter; iter = iter->next) { - ActivateInfo *info = iter->data; - - if (g_strcmp0 (failed_path, info->active_path) == 0) { - activate_info_complete (info, NULL, error); - g_error_free (error); - return; - } - } + recheck_pending_activations (self); } gboolean @@ -1118,7 +1072,7 @@ nm_manager_deactivate_connection (NMManager *manager, g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (active), FALSE); path = nm_object_get_path (NM_OBJECT (active)); - ret = nmdbus_manager_call_deactivate_connection_sync (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + ret = nmdbus_manager_call_deactivate_connection_sync (NM_MANAGER_GET_PRIVATE (manager)->proxy, path, cancellable, error); if (error && *error) @@ -1162,7 +1116,7 @@ nm_manager_deactivate_connection_async (NMManager *manager, nm_manager_deactivate_connection_async); path = nm_object_get_path (NM_OBJECT (active)); - nmdbus_manager_call_deactivate_connection (NM_MANAGER_GET_PRIVATE (manager)->manager_proxy, + nmdbus_manager_call_deactivate_connection (NM_MANAGER_GET_PRIVATE (manager)->proxy, path, cancellable, deactivated_cb, simple); @@ -1184,160 +1138,31 @@ nm_manager_deactivate_connection_finish (NMManager *manager, return g_simple_async_result_get_op_res_gboolean (simple); } -/****************************************************************/ +/*****************************************************************************/ static void -free_devices (NMManager *manager, gboolean in_dispose) +free_active_connections (NMManager *manager) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - gs_unref_ptrarray GPtrArray *real_devices = NULL; - gs_unref_ptrarray GPtrArray *all_devices = NULL; - GPtrArray *devices = NULL; - guint i, j; - - real_devices = priv->devices; - all_devices = priv->all_devices; - - if (in_dispose) { - priv->devices = NULL; - priv->all_devices = NULL; - } else { - priv->devices = g_ptr_array_new_with_free_func (g_object_unref); - priv->all_devices = g_ptr_array_new_with_free_func (g_object_unref); - } - - if (all_devices && all_devices->len > 0) - devices = all_devices; - else if (real_devices && real_devices->len > 0) - devices = real_devices; - - if (real_devices && devices != real_devices) { - for (i = 0; i < real_devices->len; i++) { - NMDevice *d = real_devices->pdata[i]; - - if (all_devices) { - for (j = 0; j < all_devices->len; j++) { - if (d == all_devices->pdata[j]) - goto next; - } - } - if (in_dispose) - device_removed (manager, d); - else - g_signal_emit (manager, signals[DEVICE_REMOVED], 0, d); -next: - ; - } - } - if (devices) { - for (i = 0; i < devices->len; i++) { - NMDevice *d = devices->pdata[i]; - - if (in_dispose) - device_removed (manager, d); - else - g_signal_emit (manager, signals[DEVICE_REMOVED], 0, d); - } - } -} - -static void -free_active_connections (NMManager *manager, gboolean in_dispose) -{ - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - GPtrArray *active_connections; - NMActiveConnection *active_connection; int i; if (!priv->active_connections) return; - active_connections = priv->active_connections; - if (in_dispose) - priv->active_connections = NULL; - else - priv->active_connections = g_ptr_array_new (); - - for (i = 0; i < active_connections->len; i++) { - active_connection = active_connections->pdata[i]; - g_signal_emit (manager, signals[ACTIVE_CONNECTION_REMOVED], 0, active_connection); - /* Break circular refs */ - g_object_run_dispose (G_OBJECT (active_connection)); - } - g_ptr_array_unref (active_connections); - - if (!in_dispose) - g_object_notify (G_OBJECT (manager), NM_MANAGER_ACTIVE_CONNECTIONS); + /* Break circular refs */ + for (i = 0; i < priv->active_connections->len; i++) + g_object_run_dispose (G_OBJECT (priv->active_connections->pdata[i])); + g_ptr_array_unref (priv->active_connections); + priv->active_connections = NULL; } -static void -updated_properties (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMManager *manager = NM_MANAGER (user_data); - GError *error = NULL; - - if (!_nm_object_reload_properties_finish (NM_OBJECT (object), result, &error)) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - g_warning ("%s: error reading NMManager properties: %s", __func__, error->message); - g_error_free (error); - } - - _nm_object_queue_notify (NM_OBJECT (manager), NM_MANAGER_NM_RUNNING); -} - -static void -nm_running_changed_cb (GObject *object, - GParamSpec *pspec, - gpointer user_data) -{ - NMManager *manager = NM_MANAGER (object); - NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager); - - if (!nm_manager_get_nm_running (manager)) { - nm_clear_g_cancellable (&priv->props_cancellable); - - priv->state = NM_STATE_UNKNOWN; - priv->startup = FALSE; - _nm_object_queue_notify (NM_OBJECT (manager), NM_MANAGER_NM_RUNNING); - _nm_object_suppress_property_updates (NM_OBJECT (manager), TRUE); - poke_wireless_devices_with_rf_status (manager); - free_devices (manager, FALSE); - free_active_connections (manager, FALSE); - update_permissions (manager, NULL); - priv->wireless_enabled = FALSE; - priv->wireless_hw_enabled = FALSE; - priv->wwan_enabled = FALSE; - priv->wwan_hw_enabled = FALSE; - priv->wimax_enabled = FALSE; - priv->wimax_hw_enabled = FALSE; - g_free (priv->version); - priv->version = NULL; - - /* Clear object cache to ensure bad refcounting by managers doesn't - * keep objects in the cache. - */ - _nm_object_cache_clear (); - } else { - _nm_object_suppress_property_updates (NM_OBJECT (manager), FALSE); - - nm_clear_g_cancellable (&priv->props_cancellable); - priv->props_cancellable = g_cancellable_new (); - _nm_object_reload_properties_async (NM_OBJECT (manager), priv->props_cancellable, updated_properties, manager); - - manager_recheck_permissions (priv->manager_proxy, manager); - } -} - -/****************************************************************/ +/*****************************************************************************/ static void constructed (GObject *object) { G_OBJECT_CLASS (nm_manager_parent_class)->constructed (object); - g_signal_connect (object, "notify::" NM_OBJECT_NM_RUNNING, - G_CALLBACK (nm_running_changed_cb), NULL); - g_signal_connect (object, "notify::" NM_MANAGER_WIRELESS_ENABLED, G_CALLBACK (wireless_enabled_cb), NULL); } @@ -1346,13 +1171,17 @@ static gboolean init_sync (GInitable *initable, GCancellable *cancellable, GError **error) { NMManager *manager = NM_MANAGER (initable); + GError *local_error = NULL; - if (!nm_manager_parent_initable_iface->init (initable, cancellable, error)) - return FALSE; + if (!nm_manager_parent_initable_iface->init (initable, cancellable, error)) { + /* Never happens. */ + g_return_val_if_reached (FALSE); + } - if ( nm_manager_get_nm_running (manager) - && !get_permissions_sync (manager, error)) - return FALSE; + if (!get_permissions_sync (manager, &local_error)) { + g_warning ("Unable to get permissions: %s\n", local_error->message); + g_error_free (local_error); + } return TRUE; } @@ -1375,18 +1204,18 @@ init_async_complete (NMManagerInitData *init_data) static void init_async_got_permissions (GObject *object, GAsyncResult *result, gpointer user_data) { - NMManagerInitData *init_data = user_data; + NMManager *manager = user_data; GVariant *permissions; if (nmdbus_manager_call_get_permissions_finish (NMDBUS_MANAGER (object), &permissions, result, NULL)) { - update_permissions (init_data->manager, permissions); + update_permissions (manager, permissions); g_variant_unref (permissions); } else - update_permissions (init_data->manager, NULL); + update_permissions (manager, NULL); - init_async_complete (init_data); + g_object_unref (manager); } static void @@ -1402,14 +1231,12 @@ init_async_parent_inited (GObject *source, GAsyncResult *result, gpointer user_d return; } - if (!nm_manager_get_nm_running (init_data->manager)) { - init_async_complete (init_data); - return; - } - - nmdbus_manager_call_get_permissions (priv->manager_proxy, + nmdbus_manager_call_get_permissions (priv->proxy, init_data->cancellable, - init_async_got_permissions, init_data); + init_async_got_permissions, + g_object_ref (init_data->manager)); + + init_async_complete (init_data); } static void @@ -1452,11 +1279,22 @@ dispose (GObject *object) g_clear_object (&priv->perm_call_cancellable); } - free_devices (manager, TRUE); - free_active_connections (manager, TRUE); + + if (priv->devices) { + g_ptr_array_unref (priv->devices); + priv->devices = NULL; + } + if (priv->all_devices) { + g_ptr_array_unref (priv->all_devices); + priv->all_devices = NULL; + } + + free_active_connections (manager); g_clear_object (&priv->primary_connection); g_clear_object (&priv->activating_connection); + g_clear_object (&priv->proxy); + /* Each activation should hold a ref on @manager, so if we're being disposed, * there shouldn't be any pending. */ @@ -1539,9 +1377,6 @@ get_property (GObject *object, case PROP_STARTUP: g_value_set_boolean (value, nm_manager_get_startup (self)); break; - case PROP_NM_RUNNING: - g_value_set_boolean (value, nm_manager_get_nm_running (self)); - break; case PROP_NETWORKING_ENABLED: g_value_set_boolean (value, nm_manager_networking_get_enabled (self)); break; @@ -1598,9 +1433,6 @@ nm_manager_class_init (NMManagerClass *manager_class) g_type_class_add_private (manager_class, sizeof (NMManagerPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE); - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE, NMDBUS_TYPE_MANAGER_PROXY); - /* virtual methods */ object_class->constructed = constructed; object_class->set_property = set_property; @@ -1609,7 +1441,6 @@ nm_manager_class_init (NMManagerClass *manager_class) object_class->finalize = finalize; nm_object_class->init_dbus = init_dbus; - nm_object_class->object_creation_failed = object_creation_failed; manager_class->device_added = device_added; manager_class->device_removed = device_removed; @@ -1637,12 +1468,6 @@ nm_manager_class_init (NMManagerClass *manager_class) FALSE, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property - (object_class, PROP_NM_RUNNING, - g_param_spec_boolean (NM_MANAGER_NM_RUNNING, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); g_object_class_install_property (object_class, PROP_NETWORKING_ENABLED, g_param_spec_boolean (NM_MANAGER_NETWORKING_ENABLED, "", "", diff --git a/libnm/nm-manager.h b/libnm/nm-manager.h index 7b6dd675..362b5f2f 100644 --- a/libnm/nm-manager.h +++ b/libnm/nm-manager.h @@ -37,7 +37,6 @@ G_BEGIN_DECLS #define NM_MANAGER_VERSION "version" #define NM_MANAGER_STATE "state" #define NM_MANAGER_STARTUP "startup" -#define NM_MANAGER_NM_RUNNING "nm-running" #define NM_MANAGER_NETWORKING_ENABLED "networking-enabled" #define NM_MANAGER_WIRELESS_ENABLED "wireless-enabled" #define NM_MANAGER_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled" @@ -72,7 +71,7 @@ typedef struct { NMClientPermission permission, NMClientPermissionResult result); - /* Beware: no more slots. Cannot extend struct without breaking ABI. */ + /* nm-manager.h is internal API. We can add more slots without breaking ABI. */ } NMManagerClass; GType nm_manager_get_type (void); @@ -80,7 +79,6 @@ GType nm_manager_get_type (void); const char *nm_manager_get_version (NMManager *manager); NMState nm_manager_get_state (NMManager *manager); gboolean nm_manager_get_startup (NMManager *manager); -gboolean nm_manager_get_nm_running (NMManager *manager); gboolean nm_manager_networking_get_enabled (NMManager *manager); gboolean nm_manager_networking_set_enabled (NMManager *manager, diff --git a/libnm/nm-object-cache.c b/libnm/nm-object-cache.c deleted file mode 100644 index fa56ace5..00000000 --- a/libnm/nm-object-cache.c +++ /dev/null @@ -1,90 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright 2008 Red Hat, Inc. - */ - -#include "nm-default.h" - -#include - -#include "nm-object-cache.h" -#include "nm-object.h" - -static GHashTable *cache = NULL; - -static void -_init_cache (void) -{ - if (G_UNLIKELY (cache == NULL)) - cache = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); -} - -static void -_nm_object_cache_remove_by_path (char *path) -{ - _init_cache (); - g_hash_table_remove (cache, path); - g_free (path); -} - -void -_nm_object_cache_add (NMObject *object) -{ - char *path; - - _init_cache (); - path = g_strdup (nm_object_get_path (object)); - g_hash_table_insert (cache, path, object); - g_object_set_data_full (G_OBJECT (object), "nm-object-cache-tag", - g_strdup (path), (GDestroyNotify) _nm_object_cache_remove_by_path); -} - -NMObject * -_nm_object_cache_get (const char *path) -{ - NMObject *object; - - _init_cache (); - object = g_hash_table_lookup (cache, path); - return object ? g_object_ref (object) : NULL; -} - -void -_nm_object_cache_clear (void) -{ - GHashTableIter iter; - GObject *obj; - const char *path; - char *foo; - - if (!cache) - return; - - g_hash_table_iter_init (&iter, cache); - while (g_hash_table_iter_next (&iter, (gpointer) &path, (gpointer) &obj)) { - /* Remove the callback so that if the object isn't yet released - * by a client, when it does finally get unrefed, it won't trigger - * the cache removal for a new object with the same path as the - * one being released. - */ - foo = g_object_steal_data (obj, "nm-object-cache-tag"); - g_free (foo); - - g_hash_table_iter_remove (&iter); - } -} diff --git a/libnm/nm-object-cache.h b/libnm/nm-object-cache.h deleted file mode 100644 index b29692fa..00000000 --- a/libnm/nm-object-cache.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA. - * - * Copyright 2008 Red Hat, Inc. - */ - -#ifndef __NM_OBJECT_CACHE_H__ -#define __NM_OBJECT_CACHE_H__ - -#include "nm-object.h" - -G_BEGIN_DECLS - -/* Returns referenced object from the cache */ -NMObject *_nm_object_cache_get (const char *path); -void _nm_object_cache_add (NMObject *object); -void _nm_object_cache_clear (void); - -G_END_DECLS - -#endif /* __NM_OBJECT_CACHE_H__ */ diff --git a/libnm/nm-object-private.h b/libnm/nm-object-private.h index ad78f92b..63c4142d 100644 --- a/libnm/nm-object-private.h +++ b/libnm/nm-object-private.h @@ -39,23 +39,13 @@ void _nm_object_register_properties (NMObject *object, const char *interface, const NMPropertiesInfo *info); -void _nm_object_reload_properties_async (NMObject *object, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data); -gboolean _nm_object_reload_properties_finish (NMObject *object, - GAsyncResult *result, - GError **error); - void _nm_object_queue_notify (NMObject *object, const char *property); -void _nm_object_suppress_property_updates (NMObject *object, gboolean suppress); +GDBusObjectManager *_nm_object_get_dbus_object_manager (NMObject *object); -/* DBus property accessors */ +GQuark _nm_object_obj_nm_quark (void); -void _nm_object_reload_property (NMObject *object, - const char *interface, - const char *prop_name); +/* DBus property accessors */ void _nm_object_set_property (NMObject *object, const char *interface, @@ -63,19 +53,6 @@ void _nm_object_set_property (NMObject *object, const char *format_string, ...); -/* object demarshalling support */ -typedef GType (*NMObjectDecideTypeFunc) (GVariant *); - -void _nm_object_register_type_func (GType base_type, - NMObjectDecideTypeFunc type_func, - const char *interface, - const char *property); - -#define NM_OBJECT_NM_RUNNING "nm-running-internal" -gboolean _nm_object_get_nm_running (NMObject *self); - -void _nm_object_class_add_interface (NMObjectClass *object_class, - const char *interface); GDBusProxy *_nm_object_get_proxy (NMObject *object, const char *interface); diff --git a/libnm/nm-object.c b/libnm/nm-object.c index 20395ce8..a5eccbdc 100644 --- a/libnm/nm-object.c +++ b/libnm/nm-object.c @@ -29,7 +29,6 @@ #include "nm-utils.h" #include "nm-dbus-interface.h" -#include "nm-object-cache.h" #include "nm-object-private.h" #include "nm-dbus-helpers.h" #include "nm-client.h" @@ -38,17 +37,11 @@ static gboolean debug = FALSE; #define dbgmsg(f,...) if (G_UNLIKELY (debug)) { g_message (f, ## __VA_ARGS__ ); } +G_DEFINE_QUARK (nm-obj-nm, _nm_object_obj_nm); + static void nm_object_initable_iface_init (GInitableIface *iface); static void nm_object_async_initable_iface_init (GAsyncInitableIface *iface); -typedef struct { - NMObjectDecideTypeFunc type_func; - char *interface; - char *property; -} NMObjectTypeFuncData; - -static GHashTable *type_funcs; - typedef struct { GSList *interfaces; } NMObjectClassPrivate; @@ -56,7 +49,6 @@ typedef struct { #define NM_OBJECT_CLASS_GET_PRIVATE(k) (G_TYPE_CLASS_GET_PRIVATE ((k), NM_TYPE_OBJECT, NMObjectClassPrivate)) G_DEFINE_ABSTRACT_TYPE_WITH_CODE (NMObject, nm_object, G_TYPE_OBJECT, - type_funcs = g_hash_table_new (NULL, NULL); g_type_add_class_private (g_define_type_id, sizeof (NMObjectClassPrivate)); G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_object_initable_iface_init); G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_object_async_initable_iface_init); @@ -75,15 +67,11 @@ static void reload_complete (NMObject *object, gboolean emit_now); static gboolean demarshal_generic (NMObject *object, GParamSpec *pspec, GVariant *value, gpointer field); typedef struct { - GDBusConnection *connection; - gboolean nm_running; + GDBusObject *object; + GDBusObjectManager *object_manager; - char *path; - GHashTable *proxies; - GDBusProxy *properties_proxy; GSList *property_tables; NMObject *parent; - gboolean suppress_property_updates; gboolean inited; /* async init finished? */ GSList *waiters; /* if async init did not finish, users of this object need @@ -104,35 +92,12 @@ enum { PROP_PATH, PROP_DBUS_CONNECTION, PROP_NM_RUNNING, + PROP_DBUS_OBJECT, + PROP_DBUS_OBJECT_MANAGER, LAST_PROP }; -/** - * _nm_object_class_add_interface: - * @object_class: an #NMObjectClass - * @interface: a D-Bus interface name - * - * Registers that @object_class implements @interface. A proxy for that - * interface will automatically be created at construction time, and can - * be retrieved with _nm_object_get_proxy(). - */ -void -_nm_object_class_add_interface (NMObjectClass *object_class, - const char *interface) -{ - NMObjectClassPrivate *cpriv; - - g_return_if_fail (NM_IS_OBJECT_CLASS (object_class)); - g_return_if_fail (interface); - - cpriv = NM_OBJECT_CLASS_GET_PRIVATE (object_class); - - g_return_if_fail (g_slist_find_custom (cpriv->interfaces, interface, (GCompareFunc) g_strcmp0) == NULL); - - cpriv->interfaces = g_slist_prepend (cpriv->interfaces, g_strdup (interface)); -} - /** * nm_object_get_path: * @object: a #NMObject @@ -140,14 +105,14 @@ _nm_object_class_add_interface (NMObjectClass *object_class, * Gets the DBus path of the #NMObject. * * Returns: the object's path. This is the internal string used by the - * device, and must not be modified. + * object, and must not be modified. **/ const char * nm_object_get_path (NMObject *object) { g_return_val_if_fail (NM_IS_OBJECT (object), NULL); - return NM_OBJECT_GET_PRIVATE (object)->path; + return g_dbus_object_get_object_path (NM_OBJECT_GET_PRIVATE (object)->object); } /** @@ -163,13 +128,14 @@ GDBusProxy * _nm_object_get_proxy (NMObject *object, const char *interface) { - GDBusProxy *proxy; + GDBusInterface *proxy; g_return_val_if_fail (NM_IS_OBJECT (object), NULL); - proxy = g_hash_table_lookup (NM_OBJECT_GET_PRIVATE (object)->proxies, interface); + proxy = g_dbus_object_get_interface (NM_OBJECT_GET_PRIVATE (object)->object, interface); g_return_val_if_fail (proxy != NULL, NULL); - return proxy; + + return G_DBUS_PROXY (proxy); } typedef enum { @@ -351,97 +317,6 @@ _nm_object_queue_notify (NMObject *object, const char *property) _nm_object_queue_notify_full (object, property, NULL, FALSE, NULL); } -void -_nm_object_register_type_func (GType base_type, - NMObjectDecideTypeFunc type_func, - const char *interface, - const char *property) -{ - NMObjectTypeFuncData *type_data; - - g_return_if_fail (type_func != NULL); - g_return_if_fail (interface != NULL); - g_return_if_fail (property != NULL); - - type_data = g_slice_new (NMObjectTypeFuncData); - type_data->type_func = type_func; - type_data->interface = g_strdup (interface); - type_data->property = g_strdup (property); - - g_hash_table_insert (type_funcs, - GSIZE_TO_POINTER (base_type), - type_data); -} - -static GObject * -_nm_object_create (GType type, GDBusConnection *connection, const char *path) -{ - NMObjectTypeFuncData *type_data; - GObject *object; - GError *error = NULL; - - type_data = g_hash_table_lookup (type_funcs, GSIZE_TO_POINTER (type)); - if (type_data) { - GDBusProxy *proxy; - GVariant *ret, *value; - - proxy = _nm_dbus_new_proxy_for_connection (connection, path, - DBUS_INTERFACE_PROPERTIES, - NULL, &error); - if (!proxy) { - g_warning ("Could not create proxy for %s: %s.", path, error->message); - g_error_free (error); - return NULL; - } - - ret = g_dbus_proxy_call_sync (proxy, - "Get", - g_variant_new ("(ss)", - type_data->interface, - type_data->property), - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, &error); - g_object_unref (proxy); - if (!ret) { - dbgmsg ("Could not fetch property '%s' of interface '%s' on %s: %s\n", - type_data->property, type_data->interface, path, error->message); - g_error_free (error); - return NULL; - } - - g_variant_get (ret, "(v)", &value); - type = type_data->type_func (value); - g_variant_unref (value); - g_variant_unref (ret); - } - - if (type == G_TYPE_INVALID) { - dbgmsg ("Could not create object for %s: unknown object type", path); - return NULL; - } - - object = g_object_new (type, - NM_OBJECT_PATH, path, - NM_OBJECT_DBUS_CONNECTION, connection, - NULL); - /* Cache the object before initializing it (and in particular, loading its - * property values); this is necessary to make circular references work (eg, - * when creating an NMActiveConnection, it will create an NMDevice which - * will in turn try to create the parent NMActiveConnection). Since we don't - * support multi-threaded use, we know that we will have inited the object - * before any external code sees it. - */ - _nm_object_cache_add (NM_OBJECT (object)); - NM_OBJECT_GET_PRIVATE (object)->inited = TRUE; - if (!g_initable_init (G_INITABLE (object), NULL, &error)) { - dbgmsg ("Could not create object for %s: %s", path, error->message); - g_error_free (error); - g_clear_object (&object); - } - - return object; -} - typedef struct { NMObject *self; PropertyInfo *pi; @@ -465,176 +340,6 @@ odata_free (gpointer data) static void object_property_maybe_complete (NMObject *self); - -typedef void (*NMObjectCreateCallbackFunc) (GObject *, const char *, gpointer); -typedef struct { - char *path; - NMObjectCreateCallbackFunc callback; - gpointer user_data; - NMObjectTypeFuncData *type_data; - GDBusConnection *connection; -} NMObjectTypeAsyncData; - -static void -create_async_complete (GObject *object, NMObjectTypeAsyncData *async_data) -{ - async_data->callback (object, async_data->path, async_data->user_data); - - g_free (async_data->path); - g_object_unref (async_data->connection); - g_slice_free (NMObjectTypeAsyncData, async_data); -} - -static void -create_async_inited (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - NMObjectPrivate *odata_priv; - NMObjectTypeAsyncData *async_data = user_data; - GError *error = NULL; - ObjectCreatedData *odata; - - priv->inited = TRUE; - if (!g_async_initable_init_finish (G_ASYNC_INITABLE (object), result, &error)) { - dbgmsg ("Could not create object for %s: %s", - nm_object_get_path (NM_OBJECT (object)), - error->message); - - while (priv->waiters) { - odata = priv->waiters->data; - odata_priv = NM_OBJECT_GET_PRIVATE (odata->self); - - priv->waiters = g_slist_remove (priv->waiters, odata); - if (!odata_priv->reload_error) - odata_priv->reload_error = g_error_copy (error); - odata_priv->reload_remaining--; - reload_complete (odata->self, FALSE); - } - - g_error_free (error); - g_clear_object (&object); - } - - create_async_complete (object, async_data); - - if (object) { - /* There are some object properties whose creation couldn't proceed - * because it depended on this object. */ - while (priv->waiters) { - odata = priv->waiters->data; - priv->waiters = g_slist_remove (priv->waiters, odata); - object_property_maybe_complete (odata->self); - } - } -} - -static void -create_async_got_type (NMObjectTypeAsyncData *async_data, GType type) -{ - GObject *object; - - /* Ensure we don't have the object already; we may get multiple type - * requests for the same object if there are multiple properties on - * other objects that refer to the object at this path. One of those - * other requests may have already completed. - */ - object = (GObject *) _nm_object_cache_get (async_data->path); - if (object) { - create_async_complete (object, async_data); - return; - } - - if (type == G_TYPE_INVALID) { - /* Don't know how to create this object */ - create_async_complete (NULL, async_data); - return; - } - - object = g_object_new (type, - NM_OBJECT_PATH, async_data->path, - NM_OBJECT_DBUS_CONNECTION, async_data->connection, - NULL); - _nm_object_cache_add (NM_OBJECT (object)); - g_async_initable_init_async (G_ASYNC_INITABLE (object), G_PRIORITY_DEFAULT, - NULL, create_async_inited, async_data); -} - -static void -create_async_got_property (GObject *proxy, GAsyncResult *result, gpointer user_data) -{ - NMObjectTypeAsyncData *async_data = user_data; - NMObjectTypeFuncData *type_data = async_data->type_data; - GVariant *ret, *value; - GError *error = NULL; - GType type; - - ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, - G_VARIANT_TYPE ("(v)"), &error); - if (ret) { - g_variant_get (ret, "(v)", &value); - type = type_data->type_func (value); - g_variant_unref (value); - g_variant_unref (ret); - } else { - dbgmsg ("Could not fetch property '%s' of interface '%s' on %s: %s\n", - type_data->property, type_data->interface, async_data->path, - error->message); - g_clear_error (&error); - type = G_TYPE_INVALID; - } - - create_async_got_type (async_data, type); -} - -static void -create_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMObjectTypeAsyncData *async_data = user_data; - GDBusProxy *proxy; - GError *error = NULL; - - proxy = _nm_dbus_new_proxy_for_connection_finish (result, &error); - if (!proxy) { - g_warning ("Could not create proxy for %s: %s.", async_data->path, error->message); - g_error_free (error); - create_async_complete (NULL, async_data); - return; - } - - g_dbus_proxy_call (proxy, - "Get", - g_variant_new ("(ss)", - async_data->type_data->interface, - async_data->type_data->property), - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, - create_async_got_property, async_data); -} - -static void -_nm_object_create_async (GType type, GDBusConnection *connection, const char *path, - NMObjectCreateCallbackFunc callback, gpointer user_data) -{ - NMObjectTypeAsyncData *async_data; - - async_data = g_slice_new (NMObjectTypeAsyncData); - async_data->path = g_strdup (path); - async_data->callback = callback; - async_data->user_data = user_data; - async_data->connection = g_object_ref (connection); - - async_data->type_data = g_hash_table_lookup (type_funcs, GSIZE_TO_POINTER (type)); - if (async_data->type_data) { - _nm_dbus_new_proxy_for_connection_async (connection, path, - DBUS_INTERFACE_PROPERTIES, - NULL, - create_async_got_proxy, async_data); - return; - } - - create_async_got_type (async_data, type); -} - /* Stolen from dbus-glib */ static char* wincaps_to_dash (const char *caps) @@ -855,15 +560,16 @@ object_created (GObject *obj, const char *path, gpointer user_data) object_class->object_creation_failed (odata->self, path); } - odata->objects[--odata->remaining] = obj; + odata->objects[--odata->remaining] = obj ? g_object_ref (obj) : NULL; object_property_maybe_complete (odata->self); } static gboolean handle_object_property (NMObject *self, const char *property_name, GVariant *value, - PropertyInfo *pi, gboolean synchronously) + PropertyInfo *pi) { NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); + gs_unref_object GDBusObject *object = NULL; GObject *obj; const char *path; ObjectCreatedData *odata; @@ -871,7 +577,7 @@ handle_object_property (NMObject *self, const char *property_name, GVariant *val odata = g_slice_new (ObjectCreatedData); odata->self = g_object_ref (self); odata->pi = pi; - odata->objects = g_new (GObject *, 1); + odata->objects = g_new0 (GObject *, 1); odata->length = odata->remaining = 1; odata->array = FALSE; odata->property_name = property_name; @@ -886,31 +592,28 @@ handle_object_property (NMObject *self, const char *property_name, GVariant *val return TRUE; } - obj = G_OBJECT (_nm_object_cache_get (path)); - if (obj) { - object_created (obj, path, odata); - return TRUE; - } else if (synchronously) { - obj = _nm_object_create (pi->object_type, priv->connection, path); - object_created (obj, path, odata); - return obj != NULL; - } else { - _nm_object_create_async (pi->object_type, priv->connection, path, - object_created, odata); - /* Assume success */ - return TRUE; + object = g_dbus_object_manager_get_object (priv->object_manager, path); + if (!object) { + /* This is a server bug -- a dangling object path for an object + * that does not exist. */ + g_warning ("No object known for %s", path); + return FALSE; } + + obj = g_object_get_qdata (G_OBJECT (object), _nm_object_obj_nm_quark ()); + object_created (obj, path, odata); + + return TRUE; } static gboolean handle_object_array_property (NMObject *self, const char *property_name, GVariant *value, - PropertyInfo *pi, gboolean synchronously) + PropertyInfo *pi) { NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); GObject *obj; GVariantIter iter; gsize npaths; - GPtrArray **array = pi->field; const char *path; ObjectCreatedData *odata; @@ -934,34 +637,25 @@ handle_object_array_property (NMObject *self, const char *property_name, GVarian g_variant_iter_init (&iter, value); while (g_variant_iter_next (&iter, "&o", &path)) { - if (!strcmp (path, "/")) { - /* FIXME: can't happen? */ - continue; - } + gs_unref_object GDBusObject *object = NULL; - obj = G_OBJECT (_nm_object_cache_get (path)); - if (obj) { - object_created (obj, path, odata); - } else if (synchronously) { - obj = _nm_object_create (pi->object_type, priv->connection, path); + object = g_dbus_object_manager_get_object (priv->object_manager, path); + if (object) { + obj = g_object_get_qdata (G_OBJECT (object), _nm_object_obj_nm_quark ()); object_created (obj, path, odata); } else { - _nm_object_create_async (pi->object_type, priv->connection, path, - object_created, odata); + g_warning ("no object known for %s\n", path); + odata->remaining--; + odata->length--; + object_property_maybe_complete (self); } } - if (!synchronously) { - /* Assume success */ - return TRUE; - } - - return *array && ((*array)->len == npaths); + return TRUE; } static void -handle_property_changed (NMObject *self, const char *dbus_name, - GVariant *value, gboolean synchronously) +handle_property_changed (NMObject *self, const char *dbus_name, GVariant *value) { NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); char *prop_name; @@ -1015,9 +709,9 @@ handle_property_changed (NMObject *self, const char *dbus_name, if (pspec && pi->object_type) { if (g_variant_is_of_type (value, G_VARIANT_TYPE_OBJECT_PATH)) - success = handle_object_property (self, pspec->name, value, pi, synchronously); + success = handle_object_property (self, pspec->name, value, pi); else if (g_variant_is_of_type (value, G_VARIANT_TYPE ("ao"))) - success = handle_object_array_property (self, pspec->name, value, pi, synchronously); + success = handle_object_array_property (self, pspec->name, value, pi); else { g_warn_if_reached (); goto out; @@ -1037,31 +731,23 @@ out: } static void -process_properties_changed (NMObject *self, GVariant *properties, gboolean synchronously) +properties_changed (GDBusProxy *proxy, + GVariant *changed_properties, + GStrv invalidated_properties, + gpointer user_data) { - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); + NMObject *self = NM_OBJECT (user_data); GVariantIter iter; const char *name; GVariant *value; - if (priv->suppress_property_updates) - return; - - g_variant_iter_init (&iter, properties); + g_variant_iter_init (&iter, changed_properties); while (g_variant_iter_next (&iter, "{&sv}", &name, &value)) { - handle_property_changed (self, name, value, synchronously); + handle_property_changed (self, name, value); g_variant_unref (value); } } -static void -properties_changed (GDBusProxy *proxy, - GVariant *properties, - gpointer user_data) -{ - process_properties_changed (NM_OBJECT (user_data), properties, FALSE); -} - #define HANDLE_TYPE(vtype, ctype, getter) \ G_STMT_START { \ if (g_variant_is_of_type (value, vtype)) { \ @@ -1240,10 +926,9 @@ _nm_object_register_properties (NMObject *object, } proxy = _nm_object_get_proxy (object, interface); - g_return_if_fail (proxy != NULL); - - _nm_dbus_signal_connect (proxy, "PropertiesChanged", G_VARIANT_TYPE ("(a{sv})"), - G_CALLBACK (properties_changed), object); + g_signal_connect (proxy, "g-properties-changed", + G_CALLBACK (properties_changed), object); + g_object_unref (proxy); instance = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); priv->property_tables = g_slist_prepend (priv->property_tables, instance); @@ -1265,92 +950,6 @@ _nm_object_register_properties (NMObject *object, } } -static gboolean -_nm_object_reload_properties (NMObject *object, GError **error) -{ - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - GVariant *ret, *props; - GHashTableIter iter; - const char *interface; - GDBusProxy *proxy; - - if (!g_hash_table_size (priv->proxies) || !priv->nm_running) - return TRUE; - - priv->reload_remaining++; - - g_hash_table_iter_init (&iter, priv->proxies); - while (g_hash_table_iter_next (&iter, (gpointer *) &interface, (gpointer *) &proxy)) { - ret = _nm_dbus_proxy_call_sync (priv->properties_proxy, - "GetAll", - g_variant_new ("(s)", interface), - G_VARIANT_TYPE ("(a{sv})"), - G_DBUS_CALL_FLAGS_NONE, -1, - NULL, error); - if (!ret) { - if (error && *error) - g_dbus_error_strip_remote_error (*error); - return FALSE; - } - - g_variant_get (ret, "(@a{sv})", &props); - process_properties_changed (object, props, TRUE); - g_variant_unref (props); - g_variant_unref (ret); - } - - if (--priv->reload_remaining == 0) - reload_complete (object, TRUE); - - return TRUE; -} - -void -_nm_object_suppress_property_updates (NMObject *object, gboolean suppress) -{ - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - - priv->suppress_property_updates = suppress; -} - - -void -_nm_object_reload_property (NMObject *object, - const char *interface, - const char *prop_name) -{ - GVariant *ret, *value; - GError *err = NULL; - - g_return_if_fail (NM_IS_OBJECT (object)); - g_return_if_fail (interface != NULL); - g_return_if_fail (prop_name != NULL); - - if (!NM_OBJECT_GET_PRIVATE (object)->nm_running) - return; - - ret = _nm_dbus_proxy_call_sync (NM_OBJECT_GET_PRIVATE (object)->properties_proxy, - "Get", - g_variant_new ("(ss)", interface, prop_name), - G_VARIANT_TYPE ("(v)"), - G_DBUS_CALL_FLAGS_NONE, 15000, - NULL, &err); - if (!ret) { - dbgmsg ("%s: Error getting '%s' for %s: %s\n", - __func__, - prop_name, - nm_object_get_path (object), - err->message); - g_clear_error (&err); - return; - } - - g_variant_get (ret, "(v)", &value); - handle_property_changed (object, prop_name, value, TRUE); - g_variant_unref (value); - g_variant_unref (ret); -} - void _nm_object_set_property (NMObject *object, const char *interface, @@ -1359,6 +958,7 @@ _nm_object_set_property (NMObject *object, ...) { GVariant *val, *ret; + GDBusProxy *proxy; va_list ap; g_return_if_fail (NM_IS_OBJECT (object)); @@ -1366,22 +966,21 @@ _nm_object_set_property (NMObject *object, g_return_if_fail (prop_name != NULL); g_return_if_fail (format_string != NULL); - if (!NM_OBJECT_GET_PRIVATE (object)->nm_running) - return; - va_start (ap, format_string); val = g_variant_new_va (format_string, NULL, &ap); va_end (ap); g_return_if_fail (val != NULL); - ret = g_dbus_proxy_call_sync (NM_OBJECT_GET_PRIVATE (object)->properties_proxy, - "Set", + proxy = _nm_object_get_proxy (object, interface); + ret = g_dbus_proxy_call_sync (proxy, + DBUS_INTERFACE_PROPERTIES ".Set", g_variant_new ("(ssv)", interface, prop_name, val), G_DBUS_CALL_FLAGS_NONE, 2000, NULL, NULL); /* Ignore errors. */ if (ret) g_variant_unref (ret); + g_object_unref (proxy); } static void @@ -1418,139 +1017,40 @@ reload_complete (NMObject *object, gboolean emit_now) g_clear_error (&error); } -static void -reload_got_properties (GObject *proxy, - GAsyncResult *result, - gpointer user_data) +GDBusObjectManager * +_nm_object_get_dbus_object_manager (NMObject *self) { - NMObject *object = user_data; - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - GVariant *ret, *props; - GError *error = NULL; - - ret = _nm_dbus_proxy_call_finish (G_DBUS_PROXY (proxy), result, - G_VARIANT_TYPE ("(a{sv})"), - &error); - if (ret) { - g_variant_get (ret, "(@a{sv})", &props); - process_properties_changed (object, props, FALSE); - g_variant_unref (props); - g_variant_unref (ret); - } else { - g_dbus_error_strip_remote_error (error); - if (priv->reload_error) - g_error_free (error); - else - priv->reload_error = error; - } - - if (--priv->reload_remaining == 0) - reload_complete (object, FALSE); + return NM_OBJECT_GET_PRIVATE (self)->object_manager; } -void -_nm_object_reload_properties_async (NMObject *object, - GCancellable *cancellable, - GAsyncReadyCallback callback, - gpointer user_data) -{ - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - GSimpleAsyncResult *simple; - GHashTableIter iter; - const char *interface; - GDBusProxy *proxy; +/*****************************************************************************/ - simple = g_simple_async_result_new (G_OBJECT (object), callback, - user_data, _nm_object_reload_properties_async); - - if (!g_hash_table_size (priv->proxies) || !priv->nm_running) { - g_simple_async_result_complete_in_idle (simple); - g_object_unref (simple); - return; - } - - priv->reload_results = g_slist_prepend (priv->reload_results, simple); - - /* If there was already a reload happening, we don't need to - * re-read the properties again, we just need to wait for the - * existing reload to finish. - */ - if (priv->reload_results->next) - return; - - g_hash_table_iter_init (&iter, priv->proxies); - while (g_hash_table_iter_next (&iter, (gpointer *) &interface, (gpointer *) &proxy)) { - priv->reload_remaining++; - g_dbus_proxy_call (priv->properties_proxy, - "GetAll", - g_variant_new ("(s)", interface), - G_DBUS_CALL_FLAGS_NONE, -1, - cancellable, - reload_got_properties, object); - } -} - -gboolean -_nm_object_reload_properties_finish (NMObject *object, GAsyncResult *result, GError **error) -{ - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - GSimpleAsyncResult *simple; - - g_return_val_if_fail (NM_IS_OBJECT (object), FALSE); - g_return_val_if_fail (g_simple_async_result_is_valid (result, G_OBJECT (object), _nm_object_reload_properties_async), FALSE); - - /* NM might have disappeared meanwhile. That would cause a NoReply error to be emitted, - * but we don't care if property updates were disabled. */ - if (priv->suppress_property_updates) - return TRUE; - - simple = G_SIMPLE_ASYNC_RESULT (result); - if (g_simple_async_result_propagate_error (simple, error)) - return FALSE; - - return g_simple_async_result_get_op_res_gboolean (simple); -} - -gboolean -_nm_object_get_nm_running (NMObject *self) +static void +init_dbus (NMObject *object) { - return NM_OBJECT_GET_PRIVATE (self)->nm_running; } -/**************************************************************/ - static void -on_name_owner_changed (GObject *proxy, - GParamSpec *pspec, - gpointer user_data) +init_if (GDBusInterface *interface, gpointer user_data) { NMObject *self = NM_OBJECT (user_data); - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); - gboolean now_running; - char *owner; - - now_running = ((owner = g_dbus_proxy_get_name_owner (priv->properties_proxy)) != NULL); - g_free (owner); - if (now_running != priv->nm_running) { - priv->nm_running = now_running; - g_object_notify (G_OBJECT (self), NM_OBJECT_NM_RUNNING); + GDBusProxy *proxy = G_DBUS_PROXY (interface); + gchar **props; + char **prop; + GVariant *val; + gchar *str; + + props = g_dbus_proxy_get_cached_property_names (proxy); + + for (prop = props; *prop; prop++) { + val = g_dbus_proxy_get_cached_property (proxy, *prop); + str = g_variant_print (val, TRUE); + handle_property_changed (self, *prop, val); + g_variant_unref (val); + g_free (str); } -} -static void -init_dbus (NMObject *object) -{ - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - char *owner; - - if (_nm_dbus_is_connection_private (priv->connection)) - priv->nm_running = TRUE; - else { - priv->nm_running = ((owner = g_dbus_proxy_get_name_owner (priv->properties_proxy)) != NULL); - g_free (owner); - g_signal_connect (priv->properties_proxy, "notify::g-name-owner", - G_CALLBACK (on_name_owner_changed), object); - } + g_strfreev (props); } static gboolean @@ -1558,45 +1058,36 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) { NMObject *self = NM_OBJECT (initable); NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); - NMObjectClassPrivate *cpriv = NM_OBJECT_CLASS_GET_PRIVATE (NM_OBJECT_GET_CLASS (self)); - GSList *iter; + GList *interfaces; - if (!priv->path) { - g_set_error_literal (error, NM_CLIENT_ERROR, NM_CLIENT_ERROR_OBJECT_CREATION_FAILED, - _("Caller did not specify D-Bus path for object")); - return FALSE; - } + g_assert (priv->object && priv->object_manager); - if (!priv->connection) - priv->connection = _nm_dbus_new_connection (cancellable, error); - if (!priv->connection) - return FALSE; + NM_OBJECT_GET_CLASS (self)->init_dbus (self); - /* Create proxies */ - for (iter = cpriv->interfaces; iter; iter = iter->next) { - const char *interface = iter->data; - GDBusProxy *proxy; + priv->reload_remaining++; - proxy = _nm_dbus_new_proxy_for_connection (priv->connection, priv->path, interface, - cancellable, error); - if (!proxy) - return FALSE; - g_hash_table_insert (priv->proxies, (char *) interface, proxy); - } + interfaces = g_dbus_object_get_interfaces (priv->object); + g_list_foreach (interfaces, (GFunc) init_if, self); + g_list_free_full (interfaces, g_object_unref); - priv->properties_proxy = _nm_dbus_new_proxy_for_connection (priv->connection, - priv->path, - DBUS_INTERFACE_PROPERTIES, - cancellable, error); - if (!priv->properties_proxy) - return FALSE; + priv->inited = TRUE; - NM_OBJECT_GET_CLASS (self)->init_dbus (self); + if (--priv->reload_remaining == 0) + reload_complete (self, TRUE); + + /* There are some object properties whose creation couldn't proceed + * because it depended on this object. */ + while (priv->waiters) { + ObjectCreatedData *odata = priv->waiters->data; + + priv->waiters = g_slist_remove (priv->waiters, odata); + object_property_maybe_complete (odata->self); + } - return _nm_object_reload_properties (self, error); + return TRUE; } -/**************************************************************/ +/*****************************************************************************/ typedef struct { NMObject *object; @@ -1613,87 +1104,12 @@ init_async_complete (NMObjectInitData *init_data) g_simple_async_result_take_error (init_data->simple, init_data->error); else g_simple_async_result_set_op_res_gboolean (init_data->simple, TRUE); - g_simple_async_result_complete (init_data->simple); + g_simple_async_result_complete_in_idle (init_data->simple); g_object_unref (init_data->simple); g_clear_object (&init_data->cancellable); g_slice_free (NMObjectInitData, init_data); } -static void -init_async_got_properties (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMObjectInitData *init_data = user_data; - - _nm_object_reload_properties_finish (NM_OBJECT (object), result, &init_data->error); - init_async_complete (init_data); -} - -static void -init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMObjectInitData *init_data = user_data; - NMObject *self = init_data->object; - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); - GDBusProxy *proxy; - - if (!init_data->error) { - proxy = _nm_dbus_new_proxy_for_connection_finish (result, &init_data->error); - if (proxy) { - const char *interface = g_dbus_proxy_get_interface_name (proxy); - - if (!strcmp (interface, DBUS_INTERFACE_PROPERTIES)) - priv->properties_proxy = proxy; - else - g_hash_table_insert (priv->proxies, (char *) interface, proxy); - } - } - - init_data->proxies_pending--; - if (init_data->proxies_pending) - return; - - if (init_data->error) { - init_async_complete (init_data); - return; - } - - NM_OBJECT_GET_CLASS (self)->init_dbus (self); - - _nm_object_reload_properties_async (init_data->object, init_data->cancellable, init_async_got_properties, init_data); -} - -static void -init_async_got_bus (GObject *object, GAsyncResult *result, gpointer user_data) -{ - NMObjectInitData *init_data = user_data; - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (init_data->object); - NMObjectClassPrivate *cpriv = NM_OBJECT_CLASS_GET_PRIVATE (NM_OBJECT_GET_CLASS (init_data->object)); - GSList *iter; - - priv->connection = _nm_dbus_new_connection_finish (result, &init_data->error); - if (!priv->connection) { - init_async_complete (init_data); - return; - } - - for (iter = cpriv->interfaces; iter; iter = iter->next) { - const char *interface = iter->data; - - _nm_dbus_new_proxy_for_connection_async (priv->connection, - priv->path, interface, - init_data->cancellable, - init_async_got_proxy, init_data); - init_data->proxies_pending++; - } - - _nm_dbus_new_proxy_for_connection_async (priv->connection, - priv->path, - DBUS_INTERFACE_PROPERTIES, - init_data->cancellable, - init_async_got_proxy, init_data); - init_data->proxies_pending++; -} - static void init_async (GAsyncInitable *initable, int io_priority, GCancellable *cancellable, GAsyncReadyCallback callback, @@ -1702,29 +1118,40 @@ init_async (GAsyncInitable *initable, int io_priority, NMObject *self = NM_OBJECT (initable); NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (self); NMObjectInitData *init_data; + GList *interfaces; - if (!priv->path) { - g_simple_async_report_error_in_idle (G_OBJECT (initable), - callback, user_data, - NM_CLIENT_ERROR, - NM_CLIENT_ERROR_OBJECT_CREATION_FAILED, - "%s", - _("Caller did not specify D-Bus path for object")); - return; - } + g_assert (priv->object && priv->object_manager); + + NM_OBJECT_GET_CLASS (self)->init_dbus (self); init_data = g_slice_new0 (NMObjectInitData); init_data->object = self; init_data->simple = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, init_async); init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL; - _nm_dbus_new_connection_async (cancellable, init_async_got_bus, init_data); + interfaces = g_dbus_object_get_interfaces (priv->object); + g_list_foreach (interfaces, (GFunc) init_if, self); + g_list_free_full (interfaces, g_object_unref); + + init_async_complete (init_data); } static gboolean init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) { GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (initable); + + priv->inited = TRUE; + + /* There are some object properties whose creation couldn't proceed + * because it depended on this object. */ + while (priv->waiters) { + ObjectCreatedData *odata = priv->waiters->data; + + priv->waiters = g_slist_remove (priv->waiters, odata); + object_property_maybe_complete (odata->self); + } if (g_simple_async_result_propagate_error (simple, error)) return FALSE; @@ -1732,7 +1159,7 @@ init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) return TRUE; } -/**************************************************************/ +/*****************************************************************************/ static void nm_object_initable_iface_init (GInitableIface *iface) @@ -1750,9 +1177,6 @@ nm_object_async_initable_iface_init (GAsyncInitableIface *iface) static void nm_object_init (NMObject *object) { - NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); - - priv->proxies = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, g_object_unref); } static void @@ -1762,13 +1186,13 @@ set_property (GObject *object, guint prop_id, NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); switch (prop_id) { - case PROP_PATH: + case PROP_DBUS_OBJECT: /* Construct only */ - priv->path = g_value_dup_string (value); + priv->object = g_value_dup_object (value); break; - case PROP_DBUS_CONNECTION: + case PROP_DBUS_OBJECT_MANAGER: /* Construct only */ - priv->connection = g_value_dup_object (value); + priv->object_manager = g_value_dup_object (value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1784,13 +1208,16 @@ get_property (GObject *object, guint prop_id, switch (prop_id) { case PROP_PATH: - g_value_set_string (value, priv->path); + g_value_set_string (value, nm_object_get_path (NM_OBJECT (object))); break; case PROP_DBUS_CONNECTION: - g_value_set_object (value, priv->connection); + g_value_set_object (value, g_dbus_object_manager_client_get_connection (G_DBUS_OBJECT_MANAGER_CLIENT (priv->object_manager))); + break; + case PROP_DBUS_OBJECT: + g_value_set_object (value, priv->object); break; - case PROP_NM_RUNNING: - g_value_set_boolean (value, priv->nm_running); + case PROP_DBUS_OBJECT_MANAGER: + g_value_set_object (value, priv->object_manager); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); @@ -1809,10 +1236,9 @@ dispose (GObject *object) priv->notify_items = NULL; g_slist_free_full (priv->waiters, odata_free); - g_clear_pointer (&priv->proxies, g_hash_table_unref); - g_clear_object (&priv->properties_proxy); - g_clear_object (&priv->connection); + g_clear_object (&priv->object); + g_clear_object (&priv->object_manager); G_OBJECT_CLASS (nm_object_parent_class)->dispose (object); } @@ -1823,7 +1249,6 @@ finalize (GObject *object) NMObjectPrivate *priv = NM_OBJECT_GET_PRIVATE (object); g_slist_free_full (priv->property_tables, (GDestroyNotify) g_hash_table_destroy); - g_free (priv->path); G_OBJECT_CLASS (nm_object_parent_class)->finalize (object); } @@ -1846,7 +1271,7 @@ nm_object_class_init (NMObjectClass *nm_object_class) /* Properties */ /** - * NMObject:path: + * NMObject:path: (skip) * * The D-Bus object path. **/ @@ -1854,8 +1279,7 @@ nm_object_class_init (NMObjectClass *nm_object_class) (object_class, PROP_PATH, g_param_spec_string (NM_OBJECT_PATH, "", "", NULL, - G_PARAM_READWRITE | - G_PARAM_CONSTRUCT_ONLY | + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** @@ -1867,20 +1291,32 @@ nm_object_class_init (NMObjectClass *nm_object_class) (object_class, PROP_DBUS_CONNECTION, g_param_spec_object (NM_OBJECT_DBUS_CONNECTION, "", "", G_TYPE_DBUS_CONNECTION, + G_PARAM_READABLE | + G_PARAM_STATIC_STRINGS)); + + /** + * NMObject:dbus-object: (skip) + * + * The #GDBusObject of the object. + **/ + g_object_class_install_property + (object_class, PROP_DBUS_OBJECT, + g_param_spec_object (NM_OBJECT_DBUS_OBJECT, "", "", + G_TYPE_DBUS_OBJECT, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); /** - * NMObject:manager-running: (skip) + * NMObject:dbus-object-manager: (skip) * - * Internal use only. - */ + * The #GDBusObjectManager of the object. + **/ g_object_class_install_property - (object_class, PROP_NM_RUNNING, - g_param_spec_boolean (NM_OBJECT_NM_RUNNING, "", "", - FALSE, - G_PARAM_READABLE | - G_PARAM_STATIC_STRINGS)); + (object_class, PROP_DBUS_OBJECT_MANAGER, + g_param_spec_object (NM_OBJECT_DBUS_OBJECT_MANAGER, "", "", + G_TYPE_DBUS_OBJECT_MANAGER, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS)); } - diff --git a/libnm/nm-object.h b/libnm/nm-object.h index fcfc718c..bcf47ba6 100644 --- a/libnm/nm-object.h +++ b/libnm/nm-object.h @@ -39,6 +39,8 @@ G_BEGIN_DECLS #define NM_OBJECT_PATH "path" #define NM_OBJECT_DBUS_CONNECTION "dbus-connection" +#define NM_OBJECT_DBUS_OBJECT "dbus-object" +#define NM_OBJECT_DBUS_OBJECT_MANAGER "dbus-object-manager" /** * NMObject: diff --git a/libnm/nm-property-docs.xml b/libnm/nm-property-docs.xml index 71cbc35a..9d58df94 100644 --- a/libnm/nm-property-docs.xml +++ b/libnm/nm-property-docs.xml @@ -86,6 +86,7 @@ + @@ -98,7 +99,7 @@ - + @@ -157,8 +158,8 @@ - - + + @@ -171,15 +172,15 @@ - + - - + + @@ -208,6 +209,17 @@ + + + + + + + + + + + @@ -249,6 +261,13 @@ + + + + + + + @@ -316,9 +335,9 @@ - - - + + + @@ -328,7 +347,7 @@ - + @@ -336,12 +355,12 @@ - + - + diff --git a/libnm/nm-remote-connection.c b/libnm/nm-remote-connection.c index eb2874a0..fe78f7b8 100644 --- a/libnm/nm-remote-connection.c +++ b/libnm/nm-remote-connection.c @@ -33,7 +33,7 @@ #include "nm-object-private.h" #include "nm-dbus-helpers.h" -#include "nmdbus-settings-connection.h" +#include "introspection/org.freedesktop.NetworkManager.Settings.Connection.h" static void nm_remote_connection_connection_iface_init (NMConnectionInterface *iface); static void nm_remote_connection_initable_iface_init (GInitableIface *iface); @@ -65,7 +65,7 @@ typedef struct { #define NM_REMOTE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionPrivate)) -/****************************************************************/ +/*****************************************************************************/ /** * nm_remote_connection_commit_changes: @@ -557,7 +557,7 @@ nm_remote_connection_get_visible (NMRemoteConnection *connection) return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->visible; } -/****************************************************************/ +/*****************************************************************************/ static void replace_settings (NMRemoteConnection *self, GVariant *new_settings) @@ -615,7 +615,7 @@ updated_cb (NMDBusSettingsConnection *proxy, gpointer user_data) g_object_ref (self)); } -/****************************************************************/ +/*****************************************************************************/ static void init_dbus (NMObject *object) @@ -628,15 +628,9 @@ init_dbus (NMObject *object) NM_OBJECT_CLASS (nm_remote_connection_parent_class)->init_dbus (object); - priv->proxy = NMDBUS_SETTINGS_CONNECTION (_nm_object_get_proxy (object, NM_DBUS_INTERFACE_SETTINGS_CONNECTION)); - g_assert (priv->proxy); - _nm_object_register_properties (object, NM_DBUS_INTERFACE_SETTINGS_CONNECTION, property_info); - - g_signal_connect (priv->proxy, "updated", - G_CALLBACK (updated_cb), object); } static gboolean @@ -646,20 +640,20 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable); GVariant *settings; - if (!nm_remote_connection_parent_initable_iface->init (initable, cancellable, error)) - return FALSE; + priv->proxy = NMDBUS_SETTINGS_CONNECTION (_nm_object_get_proxy (NM_OBJECT (initable), NM_DBUS_INTERFACE_SETTINGS_CONNECTION)); + g_signal_connect (priv->proxy, "updated", G_CALLBACK (updated_cb), initable); - if (!nmdbus_settings_connection_call_get_settings_sync (priv->proxy, - &settings, - cancellable, error)) { - if (error && *error) - g_dbus_error_strip_remote_error (*error); - return FALSE; + if (nmdbus_settings_connection_call_get_settings_sync (priv->proxy, + &settings, + cancellable, + NULL)) { + priv->visible = TRUE; + replace_settings (self, settings); + g_variant_unref (settings); } - priv->visible = TRUE; - replace_settings (self, settings); - g_variant_unref (settings); + if (!nm_remote_connection_parent_initable_iface->init (initable, cancellable, error)) + return FALSE; return TRUE; } @@ -668,6 +662,8 @@ typedef struct { NMRemoteConnection *connection; GCancellable *cancellable; GSimpleAsyncResult *result; + GAsyncInitable *initable; + int io_priority; } NMRemoteConnectionInitData; static void @@ -685,44 +681,35 @@ init_async_complete (NMRemoteConnectionInitData *init_data, GError *error) } static void -init_get_settings_cb (GObject *proxy, - GAsyncResult *result, - gpointer user_data) +init_async_parent_inited (GObject *source, GAsyncResult *result, gpointer user_data) { NMRemoteConnectionInitData *init_data = user_data; - NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection); - GVariant *settings; GError *error = NULL; - if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &settings, - result, &error)) { - g_dbus_error_strip_remote_error (error); - init_async_complete (init_data, error); - return; - } - - priv->visible = TRUE; - replace_settings (init_data->connection, settings); - g_variant_unref (settings); - - init_async_complete (init_data, NULL); + init_async_complete (init_data, error); } static void -init_async_parent_inited (GObject *source, GAsyncResult *result, gpointer user_data) +init_get_settings_cb (GObject *proxy, + GAsyncResult *result, + gpointer user_data) { NMRemoteConnectionInitData *init_data = user_data; - NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection); + NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->initable); + GVariant *settings; GError *error = NULL; - if (!nm_remote_connection_parent_async_initable_iface->init_finish (G_ASYNC_INITABLE (source), result, &error)) { - init_async_complete (init_data, error); - return; + if (!nmdbus_settings_connection_call_get_settings_finish (priv->proxy, &settings, + result, &error)) { + g_error_free (error); + } else { + priv->visible = TRUE; + replace_settings (NM_REMOTE_CONNECTION (init_data->initable), settings); + g_variant_unref (settings); } - nmdbus_settings_connection_call_get_settings (priv->proxy, - init_data->cancellable, - init_get_settings_cb, init_data); + nm_remote_connection_parent_async_initable_iface-> + init_async (init_data->initable, init_data->io_priority, init_data->cancellable, init_async_parent_inited, init_data); } static void @@ -731,26 +718,24 @@ init_async (GAsyncInitable *initable, int io_priority, gpointer user_data) { NMRemoteConnectionInitData *init_data; + NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (initable); init_data = g_slice_new0 (NMRemoteConnectionInitData); - init_data->connection = NM_REMOTE_CONNECTION (initable); init_data->cancellable = cancellable ? g_object_ref (cancellable) : NULL; init_data->result = g_simple_async_result_new (G_OBJECT (initable), callback, user_data, init_async); + init_data->initable = initable; + init_data->io_priority = io_priority; - nm_remote_connection_parent_async_initable_iface-> - init_async (initable, io_priority, cancellable, init_async_parent_inited, init_data); -} + priv->proxy = NMDBUS_SETTINGS_CONNECTION (_nm_object_get_proxy (NM_OBJECT (initable), + NM_DBUS_INTERFACE_SETTINGS_CONNECTION)); -static gboolean -init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error) -{ - GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + g_signal_connect (priv->proxy, "updated", + G_CALLBACK (updated_cb), initable); - if (g_simple_async_result_propagate_error (simple, error)) - return FALSE; - else - return TRUE; + nmdbus_settings_connection_call_get_settings (NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->initable)->proxy, + init_data->cancellable, + init_get_settings_cb, init_data); } static void @@ -782,6 +767,16 @@ constructed (GObject *object) nm_object_get_path (NM_OBJECT (object))); } +static void +dispose (GObject *object) +{ + NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object); + + g_clear_object (&priv->proxy); + + G_OBJECT_CLASS (nm_remote_connection_parent_class)->dispose (object); +} + static void nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) { @@ -790,13 +785,10 @@ nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class) g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_SETTINGS_CONNECTION); - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_SETTINGS_CONNECTION, - NMDBUS_TYPE_SETTINGS_CONNECTION_PROXY); - /* virtual methods */ object_class->constructed = constructed; object_class->get_property = get_property; + object_class->dispose = dispose; nm_object_class->init_dbus = init_dbus; @@ -852,5 +844,4 @@ nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface) nm_remote_connection_parent_async_initable_iface = g_type_interface_peek_parent (iface); iface->init_async = init_async; - iface->init_finish = init_finish; } diff --git a/libnm/nm-remote-settings.c b/libnm/nm-remote-settings.c index b04f4f2a..4d846424 100644 --- a/libnm/nm-remote-settings.c +++ b/libnm/nm-remote-settings.c @@ -33,10 +33,9 @@ #include "nm-remote-connection-private.h" #include "nm-object-private.h" #include "nm-dbus-helpers.h" -#include "nm-object-private.h" #include "nm-core-internal.h" -#include "nmdbus-settings.h" +#include "introspection/org.freedesktop.NetworkManager.Settings.h" G_DEFINE_TYPE (NMRemoteSettings, nm_remote_settings, NM_TYPE_OBJECT) @@ -46,7 +45,6 @@ typedef struct { NMDBusSettings *proxy; GPtrArray *all_connections; GPtrArray *visible_connections; - GCancellable *props_cancellable; /* AddConnectionInfo objects that are waiting for the connection to become initialized */ GSList *add_list; @@ -73,7 +71,7 @@ enum { }; static guint signals[LAST_SIGNAL] = { 0 }; -/**********************************************************************/ +/*****************************************************************************/ typedef struct { NMRemoteSettings *self; @@ -134,9 +132,6 @@ get_connection_by_string (NMRemoteSettings *settings, NMConnection *candidate; int i; - if (!_nm_object_get_nm_running (NM_OBJECT (settings))) - return NULL; - priv = NM_REMOTE_SETTINGS_GET_PRIVATE (settings); for (i = 0; i < priv->visible_connections->len; i++) { @@ -601,66 +596,7 @@ nm_remote_settings_save_hostname_finish (NMRemoteSettings *settings, return g_simple_async_result_get_op_res_gboolean (simple); } -static void -updated_properties (GObject *object, GAsyncResult *result, gpointer user_data) -{ - GError *error = NULL; - - if (!_nm_object_reload_properties_finish (NM_OBJECT (object), result, &error)) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - g_warning ("%s: error reading NMRemoteSettings properties: %s", __func__, error->message); - g_error_free (error); - } -} - -static void -nm_running_changed (GObject *object, - GParamSpec *pspec, - gpointer user_data) -{ - NMRemoteSettings *self = NM_REMOTE_SETTINGS (object); - NMRemoteSettingsPrivate *priv = NM_REMOTE_SETTINGS_GET_PRIVATE (self); - - g_object_freeze_notify (object); - - if (!_nm_object_get_nm_running (NM_OBJECT (self))) { - GPtrArray *connections; - int i; - - nm_clear_g_cancellable (&priv->props_cancellable); - - /* Clear connections */ - connections = priv->all_connections; - priv->all_connections = g_ptr_array_new (); - for (i = 0; i < connections->len; i++) - g_signal_emit (self, signals[CONNECTION_REMOVED], 0, connections->pdata[i]); - g_ptr_array_unref (connections); - - /* Clear properties */ - if (priv->hostname) { - g_free (priv->hostname); - priv->hostname = NULL; - g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_HOSTNAME); - } - - if (priv->can_modify) { - priv->can_modify = FALSE; - g_object_notify (G_OBJECT (self), NM_REMOTE_SETTINGS_CAN_MODIFY); - } - - _nm_object_suppress_property_updates (NM_OBJECT (self), TRUE); - } else { - _nm_object_suppress_property_updates (NM_OBJECT (self), FALSE); - - nm_clear_g_cancellable (&priv->props_cancellable); - priv->props_cancellable = g_cancellable_new (); - _nm_object_reload_properties_async (NM_OBJECT (self), priv->props_cancellable, updated_properties, self); - } - - g_object_thaw_notify (object); -} - -/****************************************************************/ +/*****************************************************************************/ static void nm_remote_settings_init (NMRemoteSettings *self) @@ -688,9 +624,6 @@ init_dbus (NMObject *object) _nm_object_register_properties (object, NM_DBUS_INTERFACE_SETTINGS, property_info); - - g_signal_connect (object, "notify::" NM_OBJECT_NM_RUNNING, - G_CALLBACK (nm_running_changed), object); } static GObject * @@ -736,10 +669,9 @@ dispose (GObject *object) g_clear_pointer (&priv->all_connections, g_ptr_array_unref); } - g_signal_handlers_disconnect_by_func (object, G_CALLBACK (nm_running_changed), self); - g_clear_pointer (&priv->visible_connections, g_ptr_array_unref); g_clear_pointer (&priv->hostname, g_free); + g_clear_object (&priv->proxy); G_OBJECT_CLASS (nm_remote_settings_parent_class)->dispose (object); } @@ -774,9 +706,6 @@ nm_remote_settings_class_init (NMRemoteSettingsClass *class) g_type_class_add_private (class, sizeof (NMRemoteSettingsPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_SETTINGS); - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_SETTINGS, NMDBUS_TYPE_SETTINGS_PROXY); - /* Virtual methods */ object_class->constructor = constructor; object_class->get_property = get_property; diff --git a/libnm/nm-secret-agent-old.c b/libnm/nm-secret-agent-old.c index 5f9ca216..76e4238d 100644 --- a/libnm/nm-secret-agent-old.c +++ b/libnm/nm-secret-agent-old.c @@ -29,8 +29,8 @@ #include "nm-simple-connection.h" #include "nm-core-internal.h" -#include "nmdbus-secret-agent.h" -#include "nmdbus-agent-manager.h" +#include "introspection/org.freedesktop.NetworkManager.SecretAgent.h" +#include "introspection/org.freedesktop.NetworkManager.AgentManager.h" static void nm_secret_agent_old_initable_iface_init (GInitableIface *iface); static void nm_secret_agent_old_async_initable_iface_init (GAsyncInitableIface *iface); @@ -70,7 +70,7 @@ enum { LAST_PROP }; -/*************************************************************/ +/*****************************************************************************/ static void _internal_unregister (NMSecretAgentOld *self) @@ -472,7 +472,7 @@ impl_secret_agent_old_delete_secrets (NMSecretAgentOld *self, g_object_unref (connection); } -/**************************************************************/ +/*****************************************************************************/ static gboolean check_nm_running (NMSecretAgentOld *self, GError **error) @@ -493,7 +493,7 @@ check_nm_running (NMSecretAgentOld *self, GError **error) return FALSE; } -/**************************************************************/ +/*****************************************************************************/ /** * nm_secret_agent_old_register: @@ -877,7 +877,7 @@ nm_secret_agent_old_get_registered (NMSecretAgentOld *self) return NM_SECRET_AGENT_OLD_GET_PRIVATE (self)->registered; } -/**************************************************************/ +/*****************************************************************************/ /** * nm_secret_agent_old_get_secrets: @@ -983,7 +983,7 @@ nm_secret_agent_old_delete_secrets (NMSecretAgentOld *self, user_data); } -/**************************************************************/ +/*****************************************************************************/ static gboolean validate_identifier (const char *identifier) @@ -1046,19 +1046,20 @@ init_sync (GInitable *initable, GCancellable *cancellable, GError **error) { NMSecretAgentOld *self = NM_SECRET_AGENT_OLD (initable); NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (self); - GDBusProxy *proxy; priv->bus = _nm_dbus_new_connection (cancellable, error); if (!priv->bus) return FALSE; - proxy = _nm_dbus_new_proxy_for_connection (priv->bus, - NM_DBUS_PATH_AGENT_MANAGER, - NM_DBUS_INTERFACE_AGENT_MANAGER, - cancellable, error); - if (!proxy) + priv->manager_proxy = nmdbus_agent_manager_proxy_new_sync (priv->bus, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES + | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NM_DBUS_SERVICE, + NM_DBUS_PATH_AGENT_MANAGER, + cancellable, + error); + if (!priv->manager_proxy) return FALSE; - priv->manager_proxy = NMDBUS_AGENT_MANAGER (proxy); init_common (self); @@ -1105,15 +1106,13 @@ init_async_got_proxy (GObject *object, GAsyncResult *result, gpointer user_data) { NMSecretAgentOldInitData *init_data = user_data; NMSecretAgentOldPrivate *priv = NM_SECRET_AGENT_OLD_GET_PRIVATE (init_data->self); - GDBusProxy *proxy; GError *error = NULL; - proxy = _nm_dbus_new_proxy_for_connection_finish (result, &error); - if (!proxy) { + priv->manager_proxy = nmdbus_agent_manager_proxy_new_finish (result, &error); + if (!priv->manager_proxy) { init_async_complete (init_data, error); return; } - priv->manager_proxy = NMDBUS_AGENT_MANAGER (proxy); init_common (init_data->self); @@ -1137,11 +1136,13 @@ init_async_got_bus (GObject *initable, GAsyncResult *result, gpointer user_data) return; } - _nm_dbus_new_proxy_for_connection_async (priv->bus, - NM_DBUS_PATH_AGENT_MANAGER, - NM_DBUS_INTERFACE_AGENT_MANAGER, - init_data->cancellable, - init_async_got_proxy, init_data); + nmdbus_agent_manager_proxy_new (priv->bus, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES + | G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, + NM_DBUS_INTERFACE_AGENT_MANAGER, + NM_DBUS_PATH_AGENT_MANAGER, + init_data->cancellable, + init_async_got_proxy, init_data); } static void @@ -1339,9 +1340,6 @@ nm_secret_agent_old_class_init (NMSecretAgentOldClass *class) G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_AGENT_MANAGER, - NMDBUS_TYPE_AGENT_MANAGER_PROXY); } static void diff --git a/libnm/nm-setting-docs-overrides.xml b/libnm/nm-setting-docs-overrides.xml deleted file mode 100644 index 8cfa2cc0..00000000 --- a/libnm/nm-setting-docs-overrides.xml +++ /dev/null @@ -1,163 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libnm/nm-setting-docs.xml b/libnm/nm-setting-docs.xml deleted file mode 100644 index 0c0c0968..00000000 --- a/libnm/nm-setting-docs.xml +++ /dev/null @@ -1,385 +0,0 @@ - - -]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libnm/nm-settings-docs-overrides.xml b/libnm/nm-settings-docs-overrides.xml new file mode 100644 index 00000000..474b7319 --- /dev/null +++ b/libnm/nm-settings-docs-overrides.xml @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libnm/nm-settings-docs.xml b/libnm/nm-settings-docs.xml new file mode 100644 index 00000000..af8894b8 --- /dev/null +++ b/libnm/nm-settings-docs.xml @@ -0,0 +1,404 @@ + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/libnm/nm-settings-ifcfg-rh-docs.xml b/libnm/nm-settings-ifcfg-rh-docs.xml new file mode 100644 index 00000000..aaf3880e --- /dev/null +++ b/libnm/nm-settings-ifcfg-rh-docs.xml @@ -0,0 +1,331 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libnm/nm-settings-keyfile-docs.xml b/libnm/nm-settings-keyfile-docs.xml new file mode 100644 index 00000000..2b59e9a9 --- /dev/null +++ b/libnm/nm-settings-keyfile-docs.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libnm/nm-types.h b/libnm/nm-types.h index be09daaf..7d224c86 100644 --- a/libnm/nm-types.h +++ b/libnm/nm-types.h @@ -38,6 +38,7 @@ typedef struct _NMDeviceEthernet NMDeviceEthernet; typedef struct _NMDeviceGeneric NMDeviceGeneric; typedef struct _NMDeviceInfiniband NMDeviceInfiniband; typedef struct _NMDeviceIPTunnel NMDeviceIPTunnel; +typedef struct _NMDeviceMacsec NMDeviceMacsec; typedef struct _NMDeviceMacvlan NMDeviceMacvlan; typedef struct _NMDeviceModem NMDeviceModem; typedef struct _NMDeviceOlpcMesh NMDeviceOlpcMesh; diff --git a/libnm/nm-vpn-connection.c b/libnm/nm-vpn-connection.c index 4b96210b..a91a6f69 100644 --- a/libnm/nm-vpn-connection.c +++ b/libnm/nm-vpn-connection.c @@ -30,7 +30,7 @@ #include "nm-active-connection.h" #include "nm-dbus-helpers.h" -#include "nmdbus-vpn-connection.h" +#include "introspection/org.freedesktop.NetworkManager.VPN.Connection.h" G_DEFINE_TYPE (NMVpnConnection, nm_vpn_connection, NM_TYPE_ACTIVE_CONNECTION) @@ -79,7 +79,7 @@ nm_vpn_connection_get_banner (NMVpnConnection *vpn) if (priv->vpn_state != NM_VPN_CONNECTION_STATE_ACTIVATED) return NULL; - return priv->banner; + return nm_str_not_empty (priv->banner); } /** @@ -144,6 +144,7 @@ init_dbus (NMObject *object) proxy = _nm_object_get_proxy (object, NM_DBUS_INTERFACE_VPN_CONNECTION); g_signal_connect (proxy, "vpn-state-changed", G_CALLBACK (vpn_state_changed_proxy), object); + g_object_unref (proxy); } static void @@ -185,10 +186,6 @@ nm_vpn_connection_class_init (NMVpnConnectionClass *connection_class) g_type_class_add_private (connection_class, sizeof (NMVpnConnectionPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_VPN_CONNECTION); - _nm_dbus_register_proxy_type (NM_DBUS_INTERFACE_VPN_CONNECTION, - NMDBUS_TYPE_VPN_CONNECTION_PROXY); - /* virtual methods */ object_class->get_property = get_property; object_class->finalize = finalize; diff --git a/libnm/nm-vpn-editor.h b/libnm/nm-vpn-editor.h index 2ee34525..d450bbd6 100644 --- a/libnm/nm-vpn-editor.h +++ b/libnm/nm-vpn-editor.h @@ -34,9 +34,9 @@ G_BEGIN_DECLS -/**************************************************/ +/*****************************************************************************/ /* Editor interface */ -/**************************************************/ +/*****************************************************************************/ #define NM_TYPE_VPN_EDITOR (nm_vpn_editor_get_type ()) #define NM_VPN_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_EDITOR, NMVpnEditor)) diff --git a/libnm/nm-vpn-plugin-old.c b/libnm/nm-vpn-plugin-old.c index 634e61a2..aff23b20 100644 --- a/libnm/nm-vpn-plugin-old.c +++ b/libnm/nm-vpn-plugin-old.c @@ -34,7 +34,7 @@ #include "nm-core-internal.h" #include "nm-simple-connection.h" -#include "nmdbus-vpn-plugin.h" +#include "introspection/org.freedesktop.NetworkManager.VPN.Plugin.h" #define NM_VPN_PLUGIN_OLD_QUIT_TIMER 180 @@ -534,7 +534,7 @@ impl_vpn_plugin_old_connect_interactive (NMVpnPluginOld *plugin, _connect_generic (plugin, context, connection, details); } -/***************************************************************/ +/*****************************************************************************/ static void impl_vpn_plugin_old_need_secrets (NMVpnPluginOld *plugin, @@ -681,7 +681,7 @@ nm_vpn_plugin_old_secrets_required (NMVpnPluginOld *plugin, g_signal_emit (plugin, signals[SECRETS_REQUIRED], 0, message, hints); } -/***************************************************************/ +/*****************************************************************************/ #define DATA_KEY_TAG "DATA_KEY=" #define DATA_VAL_TAG "DATA_VAL=" @@ -847,7 +847,7 @@ nm_vpn_plugin_old_get_secret_flags (GHashTable *data, return success; } -/***************************************************************/ +/*****************************************************************************/ static void impl_vpn_plugin_old_disconnect (NMVpnPluginOld *plugin, @@ -902,7 +902,7 @@ impl_vpn_plugin_old_set_failure (NMVpnPluginOld *plugin, g_dbus_method_invocation_return_value (context, NULL); } -/*********************************************************************/ +/*****************************************************************************/ static void sigterm_handler (int signum) @@ -924,7 +924,7 @@ setup_unix_signal_handler (void) sigaction (SIGTERM, &action, NULL); } -/*********************************************************************/ +/*****************************************************************************/ static void one_plugin_destroyed (gpointer data, diff --git a/libnm/nm-vpn-service-plugin.c b/libnm/nm-vpn-service-plugin.c index 8272943d..91451ed0 100644 --- a/libnm/nm-vpn-service-plugin.c +++ b/libnm/nm-vpn-service-plugin.c @@ -34,7 +34,7 @@ #include "nm-core-internal.h" #include "nm-simple-connection.h" -#include "nmdbus-vpn-plugin.h" +#include "introspection/org.freedesktop.NetworkManager.VPN.Plugin.h" #define NM_VPN_SERVICE_PLUGIN_QUIT_TIMER 180 @@ -555,7 +555,7 @@ impl_vpn_service_plugin_connect_interactive (NMVpnServicePlugin *plugin, _connect_generic (plugin, context, connection, details); } -/***************************************************************/ +/*****************************************************************************/ static void impl_vpn_service_plugin_need_secrets (NMVpnServicePlugin *plugin, @@ -703,7 +703,7 @@ nm_vpn_service_plugin_secrets_required (NMVpnServicePlugin *plugin, nmdbus_vpn_plugin_emit_secrets_required (priv->dbus_vpn_service_plugin, message, hints); } -/***************************************************************/ +/*****************************************************************************/ #define DATA_KEY_TAG "DATA_KEY=" #define DATA_VAL_TAG "DATA_VAL=" @@ -869,7 +869,7 @@ nm_vpn_service_plugin_get_secret_flags (GHashTable *data, return success; } -/***************************************************************/ +/*****************************************************************************/ static void impl_vpn_service_plugin_disconnect (NMVpnServicePlugin *plugin, @@ -924,7 +924,7 @@ impl_vpn_service_plugin_set_failure (NMVpnServicePlugin *plugin, g_dbus_method_invocation_return_value (context, NULL); } -/*********************************************************************/ +/*****************************************************************************/ static void sigterm_handler (int signum) @@ -946,7 +946,7 @@ setup_unix_signal_handler (void) sigaction (SIGTERM, &action, NULL); } -/*********************************************************************/ +/*****************************************************************************/ static void one_plugin_destroyed (gpointer data, diff --git a/libnm/nm-wimax-nsp.c b/libnm/nm-wimax-nsp.c index d544b0d4..f8c8ca42 100644 --- a/libnm/nm-wimax-nsp.c +++ b/libnm/nm-wimax-nsp.c @@ -172,7 +172,7 @@ nm_wimax_nsp_filter_connections (NMWimaxNsp *nsp, const GPtrArray *connections) return filtered; } -/************************************************************/ +/*****************************************************************************/ static void nm_wimax_nsp_init (NMWimaxNsp *nsp) @@ -239,8 +239,6 @@ nm_wimax_nsp_class_init (NMWimaxNspClass *nsp_class) g_type_class_add_private (nsp_class, sizeof (NMWimaxNspPrivate)); - _nm_object_class_add_interface (nm_object_class, NM_DBUS_INTERFACE_WIMAX_NSP); - /* virtual methods */ object_class->get_property = get_property; object_class->finalize = finalize; diff --git a/libnm/tests/Makefile.am b/libnm/tests/Makefile.am deleted file mode 100644 index 1c65f723..00000000 --- a/libnm/tests/Makefile.am +++ /dev/null @@ -1,65 +0,0 @@ -if ENABLE_TESTS - -AM_CPPFLAGS = \ - -I$(top_srcdir)/shared \ - -I$(top_builddir)/shared \ - -I$(top_srcdir)/libnm \ - -I$(top_builddir)/libnm \ - -I$(top_srcdir)/libnm-core \ - -I$(top_builddir)/libnm-core \ - -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \ - -DTEST_NM_SERVICE=\"$(abs_top_srcdir)/tools/test-networkmanager-service.py\" \ - $(GLIB_CFLAGS) - -LDADD = \ - $(top_builddir)/libnm/libnm.la \ - $(GLIB_LIBS) - -noinst_PROGRAMS = $(TESTS) - -if WITH_VALGRIND -@VALGRIND_RULES@ --launch-dbus -else -LOG_COMPILER = $(top_srcdir)/tools/run-test-dbus-session.sh -endif -TESTS = test-nm-client test-remote-settings-client test-secret-agent - -test_nm_client_SOURCES = \ - $(top_builddir)/shared/nm-test-utils-impl.c \ - $(top_builddir)/shared/nm-test-libnm-utils.h \ - test-nm-client.c - -test_remote_settings_client_SOURCES = \ - $(top_builddir)/shared/nm-test-utils-impl.c \ - $(top_builddir)/shared/nm-test-libnm-utils.h \ - test-remote-settings-client.c - -test_secret_agent_SOURCES = \ - $(top_builddir)/shared/nm-test-utils-impl.c \ - $(top_builddir)/shared/nm-test-libnm-utils.h \ - test-secret-agent.c -endif - -############################################################################### - -noinst_LTLIBRARIES = \ - libnm-vpn-plugin-utils-test.la - -libnm_vpn_plugin_utils_test_la_SOURCES = \ - $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c \ - $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.h \ - $(NULL) - -libnm_vpn_plugin_utils_test_la_CFLAGS = \ - $(GLIB_CFLAGS) \ - -I$(top_srcdir)/shared \ - -I$(top_srcdir)/libnm-core \ - -I$(top_srcdir)/libnm \ - $(NULL) - -libnm_vpn_plugin_utils_test_la_LIBADD = \ - $(GLIB_LIBS) \ - $(NULL) - -############################################################################### - diff --git a/libnm/tests/Makefile.in b/libnm/tests/Makefile.in deleted file mode 100644 index db69ccaa..00000000 --- a/libnm/tests/Makefile.in +++ /dev/null @@ -1,1293 +0,0 @@ -# Makefile.in generated by automake 1.15 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2014 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -@ENABLE_TESTS_TRUE@noinst_PROGRAMS = $(am__EXEEXT_1) -@ENABLE_TESTS_TRUE@TESTS = test-nm-client$(EXEEXT) \ -@ENABLE_TESTS_TRUE@ test-remote-settings-client$(EXEEXT) \ -@ENABLE_TESTS_TRUE@ test-secret-agent$(EXEEXT) -subdir = libnm/tests -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/attributes.m4 \ - $(top_srcdir)/m4/ax_lib_readline.m4 \ - $(top_srcdir)/m4/compiler_options.m4 \ - $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/git-sha-record.m4 \ - $(top_srcdir)/m4/gnome-code-coverage.m4 \ - $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ - $(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intltool.m4 \ - $(top_srcdir)/m4/introspection.m4 $(top_srcdir)/m4/lib-ld.m4 \ - $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ - $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ - $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ - $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ - $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -LTLIBRARIES = $(noinst_LTLIBRARIES) -am__DEPENDENCIES_1 = -libnm_vpn_plugin_utils_test_la_DEPENDENCIES = $(am__DEPENDENCIES_1) -am_libnm_vpn_plugin_utils_test_la_OBJECTS = \ - libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.lo -libnm_vpn_plugin_utils_test_la_OBJECTS = \ - $(am_libnm_vpn_plugin_utils_test_la_OBJECTS) -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -libnm_vpn_plugin_utils_test_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ - $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ - $(libnm_vpn_plugin_utils_test_la_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -@ENABLE_TESTS_TRUE@am__EXEEXT_1 = test-nm-client$(EXEEXT) \ -@ENABLE_TESTS_TRUE@ test-remote-settings-client$(EXEEXT) \ -@ENABLE_TESTS_TRUE@ test-secret-agent$(EXEEXT) -PROGRAMS = $(noinst_PROGRAMS) -am__test_nm_client_SOURCES_DIST = \ - $(top_builddir)/shared/nm-test-utils-impl.c \ - $(top_builddir)/shared/nm-test-libnm-utils.h test-nm-client.c -@ENABLE_TESTS_TRUE@am_test_nm_client_OBJECTS = \ -@ENABLE_TESTS_TRUE@ nm-test-utils-impl.$(OBJEXT) \ -@ENABLE_TESTS_TRUE@ test-nm-client.$(OBJEXT) -test_nm_client_OBJECTS = $(am_test_nm_client_OBJECTS) -test_nm_client_LDADD = $(LDADD) -@ENABLE_TESTS_TRUE@test_nm_client_DEPENDENCIES = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm/libnm.la \ -@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) -am__test_remote_settings_client_SOURCES_DIST = \ - $(top_builddir)/shared/nm-test-utils-impl.c \ - $(top_builddir)/shared/nm-test-libnm-utils.h \ - test-remote-settings-client.c -@ENABLE_TESTS_TRUE@am_test_remote_settings_client_OBJECTS = \ -@ENABLE_TESTS_TRUE@ nm-test-utils-impl.$(OBJEXT) \ -@ENABLE_TESTS_TRUE@ test-remote-settings-client.$(OBJEXT) -test_remote_settings_client_OBJECTS = \ - $(am_test_remote_settings_client_OBJECTS) -test_remote_settings_client_LDADD = $(LDADD) -@ENABLE_TESTS_TRUE@test_remote_settings_client_DEPENDENCIES = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm/libnm.la \ -@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) -am__test_secret_agent_SOURCES_DIST = \ - $(top_builddir)/shared/nm-test-utils-impl.c \ - $(top_builddir)/shared/nm-test-libnm-utils.h \ - test-secret-agent.c -@ENABLE_TESTS_TRUE@am_test_secret_agent_OBJECTS = \ -@ENABLE_TESTS_TRUE@ nm-test-utils-impl.$(OBJEXT) \ -@ENABLE_TESTS_TRUE@ test-secret-agent.$(OBJEXT) -test_secret_agent_OBJECTS = $(am_test_secret_agent_OBJECTS) -test_secret_agent_LDADD = $(LDADD) -@ENABLE_TESTS_TRUE@test_secret_agent_DEPENDENCIES = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm/libnm.la \ -@ENABLE_TESTS_TRUE@ $(am__DEPENDENCIES_1) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__depfiles_maybe = depfiles -am__mv = mv -f -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(libnm_vpn_plugin_utils_test_la_SOURCES) \ - $(test_nm_client_SOURCES) \ - $(test_remote_settings_client_SOURCES) \ - $(test_secret_agent_SOURCES) -DIST_SOURCES = $(libnm_vpn_plugin_utils_test_la_SOURCES) \ - $(am__test_nm_client_SOURCES_DIST) \ - $(am__test_remote_settings_client_SOURCES_DIST) \ - $(am__test_secret_agent_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -ETAGS = etags -CTAGS = ctags -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp \ - $(top_srcdir)/build-aux/test-driver -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -ALL_LINGUAS = @ALL_LINGUAS@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AM_TESTS_FD_REDIRECT = @AM_TESTS_FD_REDIRECT@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BLUEZ5_CFLAGS = @BLUEZ5_CFLAGS@ -BLUEZ5_LIBS = @BLUEZ5_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CODE_COVERAGE_CFLAGS = @CODE_COVERAGE_CFLAGS@ -CODE_COVERAGE_ENABLED = @CODE_COVERAGE_ENABLED@ -CODE_COVERAGE_LDFLAGS = @CODE_COVERAGE_LDFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CXX = @CXX@ -CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ -DBUS_CFLAGS = @DBUS_CFLAGS@ -DBUS_LIBS = @DBUS_LIBS@ -DBUS_SYS_DIR = @DBUS_SYS_DIR@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DHCLIENT_PATH = @DHCLIENT_PATH@ -DHCPCD_PATH = @DHCPCD_PATH@ -DISTRO_NETWORK_SERVICE = @DISTRO_NETWORK_SERVICE@ -DLLTOOL = @DLLTOOL@ -DL_LIBS = @DL_LIBS@ -DNSMASQ_PATH = @DNSMASQ_PATH@ -DNSSEC_TRIGGER_SCRIPT = @DNSSEC_TRIGGER_SCRIPT@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GENHTML = @GENHTML@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ -GLIB_CFLAGS = @GLIB_CFLAGS@ -GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ -GLIB_LIBS = @GLIB_LIBS@ -GLIB_MAKEFILE = @GLIB_MAKEFILE@ -GLIB_MKENUMS = @GLIB_MKENUMS@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GNUTLS_CFLAGS = @GNUTLS_CFLAGS@ -GNUTLS_LIBS = @GNUTLS_LIBS@ -GREP = @GREP@ -GTKDOC_CHECK = @GTKDOC_CHECK@ -GTKDOC_CHECK_PATH = @GTKDOC_CHECK_PATH@ -GTKDOC_DEPS_CFLAGS = @GTKDOC_DEPS_CFLAGS@ -GTKDOC_DEPS_LIBS = @GTKDOC_DEPS_LIBS@ -GTKDOC_MKPDF = @GTKDOC_MKPDF@ -GTKDOC_REBASE = @GTKDOC_REBASE@ -GUDEV_CFLAGS = @GUDEV_CFLAGS@ -GUDEV_LIBS = @GUDEV_LIBS@ -HTML_DIR = @HTML_DIR@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ -INTLTOOL_MERGE = @INTLTOOL_MERGE@ -INTLTOOL_PERL = @INTLTOOL_PERL@ -INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ -INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ -INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ -INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ -INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ -INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ -INTROSPECTION_GENERATE = @INTROSPECTION_GENERATE@ -INTROSPECTION_GIRDIR = @INTROSPECTION_GIRDIR@ -INTROSPECTION_LIBS = @INTROSPECTION_LIBS@ -INTROSPECTION_MAKEFILE = @INTROSPECTION_MAKEFILE@ -INTROSPECTION_SCANNER = @INTROSPECTION_SCANNER@ -INTROSPECTION_TYPELIBDIR = @INTROSPECTION_TYPELIBDIR@ -IPTABLES_PATH = @IPTABLES_PATH@ -JANSSON_CFLAGS = @JANSSON_CFLAGS@ -JANSSON_LIBS = @JANSSON_LIBS@ -KERNEL_FIRMWARE_DIR = @KERNEL_FIRMWARE_DIR@ -LCOV = @LCOV@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LIBAUDIT_CFLAGS = @LIBAUDIT_CFLAGS@ -LIBAUDIT_LIBS = @LIBAUDIT_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBM = @LIBM@ -LIBNDP_CFLAGS = @LIBNDP_CFLAGS@ -LIBNDP_LIBS = @LIBNDP_LIBS@ -LIBNL_CFLAGS = @LIBNL_CFLAGS@ -LIBNL_LIBS = @LIBNL_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ -LIBSOUP_CFLAGS = @LIBSOUP_CFLAGS@ -LIBSOUP_LIBS = @LIBSOUP_LIBS@ -LIBSYSTEMD_CFLAGS = @LIBSYSTEMD_CFLAGS@ -LIBSYSTEMD_LIBS = @LIBSYSTEMD_LIBS@ -LIBTEAMDCTL_CFLAGS = @LIBTEAMDCTL_CFLAGS@ -LIBTEAMDCTL_LIBS = @LIBTEAMDCTL_LIBS@ -LIBTOOL = @LIBTOOL@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LOG_DRIVER = @LOG_DRIVER@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAINT = @MAINT@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MM_GLIB_CFLAGS = @MM_GLIB_CFLAGS@ -MM_GLIB_LIBS = @MM_GLIB_LIBS@ -MOC = @MOC@ -MSGFMT = @MSGFMT@ -MSGFMT_015 = @MSGFMT_015@ -MSGMERGE = @MSGMERGE@ -NEWT_CFLAGS = @NEWT_CFLAGS@ -NEWT_LIBS = @NEWT_LIBS@ -NM = @NM@ -NMEDIT = @NMEDIT@ -NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT = @NM_CONFIG_DEFAULT_AUTH_POLKIT_TEXT@ -NM_CONFIG_DEFAULT_DNS_RC_MANAGER = @NM_CONFIG_DEFAULT_DNS_RC_MANAGER@ -NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT = @NM_CONFIG_DEFAULT_LOGGING_AUDIT_TEXT@ -NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT = @NM_CONFIG_LOGGING_BACKEND_DEFAULT_TEXT@ -NM_MAJOR_VERSION = @NM_MAJOR_VERSION@ -NM_MICRO_VERSION = @NM_MICRO_VERSION@ -NM_MINOR_VERSION = @NM_MINOR_VERSION@ -NM_MODIFY_SYSTEM_POLICY = @NM_MODIFY_SYSTEM_POLICY@ -NM_VERSION = @NM_VERSION@ -NSS_CFLAGS = @NSS_CFLAGS@ -NSS_LIBS = @NSS_LIBS@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -POLKIT_CFLAGS = @POLKIT_CFLAGS@ -POLKIT_LIBS = @POLKIT_LIBS@ -POSUB = @POSUB@ -PPPD_PATH = @PPPD_PATH@ -PPPD_PLUGIN_DIR = @PPPD_PLUGIN_DIR@ -QT_CFLAGS = @QT_CFLAGS@ -QT_LIBS = @QT_LIBS@ -RANLIB = @RANLIB@ -READLINE_LIBS = @READLINE_LIBS@ -SANITIZERS = @SANITIZERS@ -SANITIZER_ENV = @SANITIZER_ENV@ -SED = @SED@ -SELINUX_CFLAGS = @SELINUX_CFLAGS@ -SELINUX_LIBS = @SELINUX_LIBS@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -STRIP = @STRIP@ -SYSTEMD_200_CFLAGS = @SYSTEMD_200_CFLAGS@ -SYSTEMD_200_LIBS = @SYSTEMD_200_LIBS@ -SYSTEMD_INHIBIT_CFLAGS = @SYSTEMD_INHIBIT_CFLAGS@ -SYSTEMD_INHIBIT_LIBS = @SYSTEMD_INHIBIT_LIBS@ -SYSTEMD_JOURNAL_CFLAGS = @SYSTEMD_JOURNAL_CFLAGS@ -SYSTEMD_JOURNAL_LIBS = @SYSTEMD_JOURNAL_LIBS@ -SYSTEMD_LOGIN_CFLAGS = @SYSTEMD_LOGIN_CFLAGS@ -SYSTEMD_LOGIN_LIBS = @SYSTEMD_LOGIN_LIBS@ -SYSTEM_CA_PATH = @SYSTEM_CA_PATH@ -UDEV_DIR = @UDEV_DIR@ -USE_NLS = @USE_NLS@ -UUID_CFLAGS = @UUID_CFLAGS@ -UUID_LIBS = @UUID_LIBS@ -VALGRIND_RULES = @VALGRIND_RULES@ -VAPIGEN = @VAPIGEN@ -VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ -VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ -VERSION = @VERSION@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -intltool__v_merge_options_ = @intltool__v_merge_options_@ -intltool__v_merge_options_0 = @intltool__v_merge_options_0@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -nmbinary = @nmbinary@ -nmconfdir = @nmconfdir@ -nmdatadir = @nmdatadir@ -nmlibdir = @nmlibdir@ -nmrundir = @nmrundir@ -nmstatedir = @nmstatedir@ -oldincludedir = @oldincludedir@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -subdirs = @subdirs@ -sysconfdir = @sysconfdir@ -systemdsystemunitdir = @systemdsystemunitdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ -with_dhclient = @with_dhclient@ -with_dhcpcd = @with_dhcpcd@ -with_netconfig = @with_netconfig@ -with_resolvconf = @with_resolvconf@ -with_valgrind = @with_valgrind@ -@ENABLE_TESTS_TRUE@AM_CPPFLAGS = \ -@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/shared \ -@ENABLE_TESTS_TRUE@ -I$(top_builddir)/shared \ -@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm \ -@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm \ -@ENABLE_TESTS_TRUE@ -I$(top_srcdir)/libnm-core \ -@ENABLE_TESTS_TRUE@ -I$(top_builddir)/libnm-core \ -@ENABLE_TESTS_TRUE@ -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \ -@ENABLE_TESTS_TRUE@ -DTEST_NM_SERVICE=\"$(abs_top_srcdir)/tools/test-networkmanager-service.py\" \ -@ENABLE_TESTS_TRUE@ $(GLIB_CFLAGS) - -@ENABLE_TESTS_TRUE@LDADD = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/libnm/libnm.la \ -@ENABLE_TESTS_TRUE@ $(GLIB_LIBS) - -@ENABLE_TESTS_TRUE@@WITH_VALGRIND_FALSE@LOG_COMPILER = $(top_srcdir)/tools/run-test-dbus-session.sh -@ENABLE_TESTS_TRUE@test_nm_client_SOURCES = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/shared/nm-test-utils-impl.c \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/shared/nm-test-libnm-utils.h \ -@ENABLE_TESTS_TRUE@ test-nm-client.c - -@ENABLE_TESTS_TRUE@test_remote_settings_client_SOURCES = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/shared/nm-test-utils-impl.c \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/shared/nm-test-libnm-utils.h \ -@ENABLE_TESTS_TRUE@ test-remote-settings-client.c - -@ENABLE_TESTS_TRUE@test_secret_agent_SOURCES = \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/shared/nm-test-utils-impl.c \ -@ENABLE_TESTS_TRUE@ $(top_builddir)/shared/nm-test-libnm-utils.h \ -@ENABLE_TESTS_TRUE@ test-secret-agent.c - - -############################################################################### -noinst_LTLIBRARIES = \ - libnm-vpn-plugin-utils-test.la - -libnm_vpn_plugin_utils_test_la_SOURCES = \ - $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c \ - $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.h \ - $(NULL) - -libnm_vpn_plugin_utils_test_la_CFLAGS = \ - $(GLIB_CFLAGS) \ - -I$(top_srcdir)/shared \ - -I$(top_srcdir)/libnm-core \ - -I$(top_srcdir)/libnm \ - $(NULL) - -libnm_vpn_plugin_utils_test_la_LIBADD = \ - $(GLIB_LIBS) \ - $(NULL) - -all: all-am - -.SUFFIXES: -.SUFFIXES: .c .lo .log .o .obj .test .test$(EXEEXT) .trs -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libnm/tests/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --gnu libnm/tests/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): - -clean-noinstLTLIBRARIES: - -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } - -libnm-vpn-plugin-utils-test.la: $(libnm_vpn_plugin_utils_test_la_OBJECTS) $(libnm_vpn_plugin_utils_test_la_DEPENDENCIES) $(EXTRA_libnm_vpn_plugin_utils_test_la_DEPENDENCIES) - $(AM_V_CCLD)$(libnm_vpn_plugin_utils_test_la_LINK) $(libnm_vpn_plugin_utils_test_la_OBJECTS) $(libnm_vpn_plugin_utils_test_la_LIBADD) $(LIBS) - -clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -test-nm-client$(EXEEXT): $(test_nm_client_OBJECTS) $(test_nm_client_DEPENDENCIES) $(EXTRA_test_nm_client_DEPENDENCIES) - @rm -f test-nm-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_nm_client_OBJECTS) $(test_nm_client_LDADD) $(LIBS) - -test-remote-settings-client$(EXEEXT): $(test_remote_settings_client_OBJECTS) $(test_remote_settings_client_DEPENDENCIES) $(EXTRA_test_remote_settings_client_DEPENDENCIES) - @rm -f test-remote-settings-client$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_remote_settings_client_OBJECTS) $(test_remote_settings_client_LDADD) $(LIBS) - -test-secret-agent$(EXEEXT): $(test_secret_agent_OBJECTS) $(test_secret_agent_DEPENDENCIES) $(EXTRA_test_secret_agent_DEPENDENCIES) - @rm -f test-secret-agent$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(test_secret_agent_OBJECTS) $(test_secret_agent_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nm-test-utils-impl.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-nm-client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-remote-settings-client.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test-secret-agent.Po@am__quote@ - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.lo: $(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_vpn_plugin_utils_test_la_CFLAGS) $(CFLAGS) -MT libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.lo -MD -MP -MF $(DEPDIR)/libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.Tpo -c -o libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.lo `test -f '$(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.Tpo $(DEPDIR)/libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c' object='libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libnm_vpn_plugin_utils_test_la_CFLAGS) $(CFLAGS) -c -o libnm_vpn_plugin_utils_test_la-nm-vpn-plugin-utils.lo `test -f '$(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c' || echo '$(srcdir)/'`$(top_srcdir)/shared/nm-utils/nm-vpn-plugin-utils.c - -nm-test-utils-impl.o: $(top_builddir)/shared/nm-test-utils-impl.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm-test-utils-impl.o -MD -MP -MF $(DEPDIR)/nm-test-utils-impl.Tpo -c -o nm-test-utils-impl.o `test -f '$(top_builddir)/shared/nm-test-utils-impl.c' || echo '$(srcdir)/'`$(top_builddir)/shared/nm-test-utils-impl.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nm-test-utils-impl.Tpo $(DEPDIR)/nm-test-utils-impl.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/shared/nm-test-utils-impl.c' object='nm-test-utils-impl.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm-test-utils-impl.o `test -f '$(top_builddir)/shared/nm-test-utils-impl.c' || echo '$(srcdir)/'`$(top_builddir)/shared/nm-test-utils-impl.c - -nm-test-utils-impl.obj: $(top_builddir)/shared/nm-test-utils-impl.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT nm-test-utils-impl.obj -MD -MP -MF $(DEPDIR)/nm-test-utils-impl.Tpo -c -o nm-test-utils-impl.obj `if test -f '$(top_builddir)/shared/nm-test-utils-impl.c'; then $(CYGPATH_W) '$(top_builddir)/shared/nm-test-utils-impl.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/shared/nm-test-utils-impl.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/nm-test-utils-impl.Tpo $(DEPDIR)/nm-test-utils-impl.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_builddir)/shared/nm-test-utils-impl.c' object='nm-test-utils-impl.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o nm-test-utils-impl.obj `if test -f '$(top_builddir)/shared/nm-test-utils-impl.c'; then $(CYGPATH_W) '$(top_builddir)/shared/nm-test-utils-impl.c'; else $(CYGPATH_W) '$(srcdir)/$(top_builddir)/shared/nm-test-utils-impl.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary for $(PACKAGE_STRING)$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test-nm-client.log: test-nm-client$(EXEEXT) - @p='test-nm-client$(EXEEXT)'; \ - b='test-nm-client'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test-remote-settings-client.log: test-remote-settings-client$(EXEEXT) - @p='test-remote-settings-client$(EXEEXT)'; \ - b='test-remote-settings-client'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -test-secret-agent.log: test-secret-agent$(EXEEXT) - @p='test-secret-agent$(EXEEXT)'; \ - b='test-secret-agent'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) - -distdir: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) -installdirs: -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS mostlyclean-am - -distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am check check-TESTS check-am clean \ - clean-generic clean-libtool clean-noinstLTLIBRARIES \ - clean-noinstPROGRAMS cscopelist-am ctags ctags-am distclean \ - distclean-compile distclean-generic distclean-libtool \ - distclean-tags distdir dvi dvi-am html html-am info info-am \ - install install-am install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-pdf install-pdf-am install-ps install-ps-am \ - install-strip installcheck installcheck-am installdirs \ - maintainer-clean maintainer-clean-generic mostlyclean \ - mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ - pdf pdf-am ps ps-am recheck tags tags-am uninstall \ - uninstall-am - -.PRECIOUS: Makefile - - -@ENABLE_TESTS_TRUE@@WITH_VALGRIND_TRUE@@VALGRIND_RULES@ --launch-dbus - -############################################################################### - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/libnm/tests/test-nm-client.c b/libnm/tests/test-nm-client.c index bc219aa3..63822882 100644 --- a/libnm/tests/test-nm-client.c +++ b/libnm/tests/test-nm-client.c @@ -29,7 +29,7 @@ static GMainLoop *loop = NULL; static NMTstcServiceInfo *sinfo; -/*******************************************************************/ +/*****************************************************************************/ static gboolean loop_quit (gpointer user_data) @@ -38,7 +38,7 @@ loop_quit (gpointer user_data) return G_SOURCE_REMOVE; } -/*******************************************************************/ +/*****************************************************************************/ static void devices_notify_cb (NMClient *c, @@ -107,7 +107,7 @@ test_device_added (void) g_clear_pointer (&sinfo, nmtstc_service_cleanup); } -/*******************************************************************/ +/*****************************************************************************/ typedef enum { SIGNAL_FIRST = 0x01, @@ -206,7 +206,7 @@ test_device_added_signal_after_init (void) g_clear_pointer (&sinfo, nmtstc_service_cleanup); } -/*******************************************************************/ +/*****************************************************************************/ static const char *expected_bssid = "66:55:44:33:22:11"; @@ -405,7 +405,7 @@ test_wifi_ap_added_removed (void) g_clear_pointer (&sinfo, nmtstc_service_cleanup); } -/*******************************************************************/ +/*****************************************************************************/ static const char *expected_nsp_name = "Clear"; @@ -604,7 +604,7 @@ test_wimax_nsp_added_removed (void) g_clear_pointer (&sinfo, nmtstc_service_cleanup); } -/*******************************************************************/ +/*****************************************************************************/ typedef struct { GMainLoop *loop; @@ -1228,7 +1228,7 @@ test_device_connection_compatibility (void) g_clear_pointer (&sinfo, nmtstc_service_cleanup); } -/*******************************************************************/ +/*****************************************************************************/ static gboolean _test_connection_invalid_find_connections (gpointer element, gpointer needle, gpointer user_data) @@ -1568,7 +1568,7 @@ test_connection_invalid (void) #undef ASSERT_IDX } -/*******************************************************************/ +/*****************************************************************************/ NMTST_DEFINE (); diff --git a/libnm/tests/test-remote-settings-client.c b/libnm/tests/test-remote-settings-client.c index 8f59656d..f6c37e91 100644 --- a/libnm/tests/test-remote-settings-client.c +++ b/libnm/tests/test-remote-settings-client.c @@ -31,7 +31,7 @@ static NMClient *client = NULL; GDBusConnection *bus = NULL; NMRemoteConnection *remote = NULL; -/*******************************************************************/ +/*****************************************************************************/ static void add_cb (GObject *s, @@ -87,7 +87,7 @@ test_add_connection (void) g_object_unref (connection); } -/*******************************************************************/ +/*****************************************************************************/ static void set_visible_cb (GObject *proxy, @@ -194,7 +194,7 @@ test_make_invisible (void) g_object_unref (proxy); } -/*******************************************************************/ +/*****************************************************************************/ static void vis_new_connection_cb (NMClient *foo, @@ -271,7 +271,7 @@ test_make_visible (void) g_object_unref (proxy); } -/*******************************************************************/ +/*****************************************************************************/ static void deleted_cb (GObject *proxy, @@ -336,9 +336,10 @@ test_remove_connection (void) do { now = time (NULL); g_main_context_iteration (NULL, FALSE); - } while ((done == FALSE) && (now - start < 5)); + if (done && !remote) + break; + } while (now - start < 5); g_assert (done == TRUE); - g_assert (!remote); /* Ensure NMClient no longer has the connection */ @@ -354,7 +355,7 @@ test_remove_connection (void) g_object_unref (proxy); } -/*******************************************************************/ +/*****************************************************************************/ #define TEST_ADD_REMOVE_ID "add-remove-test-connection" @@ -413,7 +414,7 @@ test_add_remove_connection (void) g_object_unref (connection); } -/*******************************************************************/ +/*****************************************************************************/ static void add_bad_cb (GObject *s, @@ -456,7 +457,7 @@ test_add_bad_connection (void) g_assert (remote == NULL); } -/*******************************************************************/ +/*****************************************************************************/ static void save_hostname_cb (GObject *s, @@ -495,7 +496,7 @@ test_save_hostname (void) g_assert (remote == NULL); } -/*******************************************************************/ +/*****************************************************************************/ NMTST_DEFINE (); diff --git a/libnm/tests/test-secret-agent.c b/libnm/tests/test-secret-agent.c index 97561866..77f972f5 100644 --- a/libnm/tests/test-secret-agent.c +++ b/libnm/tests/test-secret-agent.c @@ -28,7 +28,7 @@ #include "nm-test-libnm-utils.h" -/*******************************************************************/ +/*****************************************************************************/ enum { SECRET_REQUESTED, @@ -176,7 +176,7 @@ test_secret_agent_new (void) return agent; } -/*******************************************************************/ +/*****************************************************************************/ typedef struct { NMTstcServiceInfo *sinfo; @@ -341,7 +341,7 @@ test_cleanup (TestSecretAgentData *sadata, gconstpointer test_data) g_free (sadata->con_id); } -/*******************************************************************/ +/*****************************************************************************/ static void connection_activated_none_cb (GObject *c, @@ -371,7 +371,7 @@ test_secret_agent_none (TestSecretAgentData *sadata, gconstpointer test_data) g_main_loop_run (sadata->loop); } -/*******************************************************************/ +/*****************************************************************************/ static char * secrets_requested_no_secrets_cb (TestSecretAgent *agent, @@ -422,7 +422,7 @@ test_secret_agent_no_secrets (TestSecretAgentData *sadata, gconstpointer test_da g_assert_cmpint (sadata->secrets_requested, ==, 1); } -/*******************************************************************/ +/*****************************************************************************/ static void connection_activated_cancel_cb (GObject *c, @@ -473,7 +473,7 @@ test_secret_agent_cancel (TestSecretAgentData *sadata, gconstpointer test_data) g_assert_cmpint (sadata->secrets_requested, ==, 1); } -/*******************************************************************/ +/*****************************************************************************/ static void connection_activated_good_cb (GObject *c, @@ -599,6 +599,12 @@ test_secret_agent_auto_register (void) g_assert_no_error (error); g_assert (nm_secret_agent_old_get_registered (agent)); + /* The GLib ObjectManager doesn't like when we drop the service + * in between it sees the service disappear and the call to + * GetManagedObjects. Give it a chance to do its business. + * Arguably a bug. */ + g_main_context_iteration (NULL, FALSE); + /* Shut down test service */ nmtstc_service_cleanup (sinfo); g_main_loop_run (loop); @@ -609,6 +615,9 @@ test_secret_agent_auto_register (void) g_main_loop_run (loop); g_assert (nm_secret_agent_old_get_registered (agent)); + /* Let ObjectManager initialize (see above). */ + g_main_context_iteration (NULL, FALSE); + /* Shut down test service again */ nmtstc_service_cleanup (sinfo); g_main_loop_run (loop); @@ -618,7 +627,7 @@ test_secret_agent_auto_register (void) g_main_loop_unref (loop); } -/*******************************************************************/ +/*****************************************************************************/ NMTST_DEFINE (); -- cgit 1.3.0-6-gf8a5