mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 07:00:05 +01:00
all: goodbye libnm-glib
This removes libnm-glib, libnm-glib-vpn, and libnm-util for good. The it has been replaced with libnm since NetworkManager 1.0, disabled by default since 1.12 and no up-to-date distributions ship it for years now. Removing the libraries allows us to: * Remove the horrible hacks that were in place to deal with accidental use of both the new and old library in a single process. * Relief the translators of maintenance burden of similar yet different strings. * Get rid of known bad code without chances of ever getting fixed (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c) * Generally lower the footprint of the releases and our workspace If there are some really really legacy users; they can just build libnm-glib and friends from the NetworkManager-1.16 distribution. The D-Bus API is stable and old libnm-glib will keep working forever. https://github.com/NetworkManager/NetworkManager/pull/308
This commit is contained in:
parent
32e0bf1421
commit
1de8383ad9
214 changed files with 11 additions and 74760 deletions
|
|
@ -12,7 +12,6 @@ addons:
|
||||||
- libtool
|
- libtool
|
||||||
- pkg-config
|
- pkg-config
|
||||||
- intltool
|
- intltool
|
||||||
- libdbus-glib-1-dev
|
|
||||||
- libdbus-1-dev
|
- libdbus-1-dev
|
||||||
- libiw-dev
|
- libiw-dev
|
||||||
- libglib2.0-dev
|
- libglib2.0-dev
|
||||||
|
|
|
||||||
725
Makefile.am
725
Makefile.am
|
|
@ -97,12 +97,6 @@ SUBDIRS += \
|
||||||
docs/libnm \
|
docs/libnm \
|
||||||
docs/api
|
docs/api
|
||||||
|
|
||||||
if WITH_LEGACY_LIBRARIES
|
|
||||||
SUBDIRS += \
|
|
||||||
docs/libnm-util \
|
|
||||||
docs/libnm-glib
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
dflt_cppflags = -std=gnu11
|
dflt_cppflags = -std=gnu11
|
||||||
|
|
@ -160,7 +154,6 @@ check_so_symbols = \
|
||||||
DISTCHECK_CONFIGURE_FLAGS = \
|
DISTCHECK_CONFIGURE_FLAGS = \
|
||||||
--enable-tests=yes \
|
--enable-tests=yes \
|
||||||
--with-valgrind=no \
|
--with-valgrind=no \
|
||||||
--with-libnm-glib=yes \
|
|
||||||
--enable-gtk-doc \
|
--enable-gtk-doc \
|
||||||
--enable-more-warnings=error \
|
--enable-more-warnings=error \
|
||||||
--with-udev-dir=$$dc_install_base/lib/udev \
|
--with-udev-dir=$$dc_install_base/lib/udev \
|
||||||
|
|
@ -172,14 +165,11 @@ DISTCHECK_CONFIGURE_FLAGS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
dist-configure-check:
|
dist-configure-check:
|
||||||
@echo "*** 'make dist' requires '--enable-gtk-doc --enable-introspection --with-libnm-glib'. ***"
|
@echo "*** 'make dist' requires '--enable-gtk-doc --enable-introspection'. ***"
|
||||||
@false
|
@false
|
||||||
if !BUILD_DOCS
|
if !BUILD_DOCS
|
||||||
dist_configure_check += dist-configure-check
|
dist_configure_check += dist-configure-check
|
||||||
endif
|
endif
|
||||||
if !WITH_LEGACY_LIBRARIES
|
|
||||||
dist_configure_check += dist-configure-check
|
|
||||||
endif
|
|
||||||
|
|
||||||
dist: $(dist_configure_check) $(dist_dependencies)
|
dist: $(dist_configure_check) $(dist_dependencies)
|
||||||
|
|
||||||
|
|
@ -187,12 +177,6 @@ DISTCLEANFILES += intltool-extract intltool-merge intltool-update
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
if WITH_LEGACY_LIBRARIES
|
|
||||||
pkgconfig_DATA += NetworkManager.pc
|
|
||||||
endif
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
polkit_policydir = $(datadir)/polkit-1/actions
|
polkit_policydir = $(datadir)/polkit-1/actions
|
||||||
|
|
||||||
dist_polkit_policy_in_in_files = \
|
dist_polkit_policy_in_in_files = \
|
||||||
|
|
@ -1267,36 +1251,6 @@ libnm/libnm.typelib: libnm/libnm.gir
|
||||||
|
|
||||||
INTROSPECTION_GIRS += libnm/NM-1.0.gir
|
INTROSPECTION_GIRS += libnm/NM-1.0.gir
|
||||||
|
|
||||||
if WITH_FAKE_TYPELIBS
|
|
||||||
|
|
||||||
libnm/fake-typelib/NetworkManager.typelib: libnm/fake-typelib/NetworkManager.gir libnm/fake-typelib/.dirstamp
|
|
||||||
$(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
|
|
||||||
|
|
||||||
libnm/fake-typelib/NMClient.typelib: libnm/fake-typelib/NMClient.gir libnm/fake-typelib/.dirstamp
|
|
||||||
$(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
|
|
||||||
|
|
||||||
libnm/fake-typelib/typelibs.c: libnm/fake-typelib/typelibs.gresource.xml libnm/fake-typelib/NetworkManager.typelib libnm/fake-typelib/NMClient.typelib
|
|
||||||
$(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(builddir)/libnm/fake-typelib --generate-source --manual-register
|
|
||||||
|
|
||||||
nodist_libnm_libnm_utils_la_SOURCES = \
|
|
||||||
libnm/fake-typelib/typelibs.c
|
|
||||||
|
|
||||||
CLEANFILES += \
|
|
||||||
libnm/fake-typelib/typelibs.c \
|
|
||||||
libnm/fake-typelib/NMClient.typelib \
|
|
||||||
libnm/fake-typelib/NetworkManager.typelib
|
|
||||||
endif
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
libnm/fake-typelib/NetworkManager.gir \
|
|
||||||
libnm/fake-typelib/NMClient.gir \
|
|
||||||
libnm/fake-typelib/typelibs.gresource.xml \
|
|
||||||
libnm/fake-typelib/meson.build
|
|
||||||
|
|
||||||
if HAVE_INTROSPECTION
|
|
||||||
|
|
||||||
libnm_noinst_data = \
|
libnm_noinst_data = \
|
||||||
libnm/nm-property-docs.xml \
|
libnm/nm-property-docs.xml \
|
||||||
libnm/nm-settings-docs-overrides.xml \
|
libnm/nm-settings-docs-overrides.xml \
|
||||||
|
|
@ -4382,660 +4336,6 @@ CLEANFILES += \
|
||||||
data/NetworkManager-dispatcher.service \
|
data/NetworkManager-dispatcher.service \
|
||||||
data/server.conf
|
data/server.conf
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# libnm-util
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
if WITH_LEGACY_LIBRARIES
|
|
||||||
|
|
||||||
lib_LTLIBRARIES += libnm-util/libnm-util.la
|
|
||||||
|
|
||||||
libnm_util_libnm_util_includedir=$(includedir)/NetworkManager
|
|
||||||
|
|
||||||
libnm_util_cppflags = \
|
|
||||||
$(dflt_cppflags) \
|
|
||||||
-I$(srcdir)/libnm-util \
|
|
||||||
-I$(builddir)/libnm-util \
|
|
||||||
-I$(srcdir)/shared \
|
|
||||||
-I$(builddir)/shared \
|
|
||||||
-DG_LOG_DOMAIN=\""libnm-util"\" \
|
|
||||||
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL \
|
|
||||||
$(GLIB_CFLAGS) \
|
|
||||||
$(DBUS_CFLAGS) \
|
|
||||||
$(UUID_CFLAGS)
|
|
||||||
|
|
||||||
libnm_util_lib_h_pub_real = \
|
|
||||||
shared/nm-version-macros.h \
|
|
||||||
libnm-util/NetworkManager.h \
|
|
||||||
libnm-util/NetworkManagerVPN.h \
|
|
||||||
libnm-util/nm-connection.h \
|
|
||||||
libnm-util/nm-setting.h \
|
|
||||||
libnm-util/nm-setting-8021x.h \
|
|
||||||
libnm-util/nm-setting-adsl.h \
|
|
||||||
libnm-util/nm-setting-bluetooth.h \
|
|
||||||
libnm-util/nm-setting-bond.h \
|
|
||||||
libnm-util/nm-setting-team.h \
|
|
||||||
libnm-util/nm-setting-team-port.h \
|
|
||||||
libnm-util/nm-setting-bridge.h \
|
|
||||||
libnm-util/nm-setting-bridge-port.h \
|
|
||||||
libnm-util/nm-setting-connection.h \
|
|
||||||
libnm-util/nm-setting-dcb.h \
|
|
||||||
libnm-util/nm-setting-infiniband.h \
|
|
||||||
libnm-util/nm-setting-ip4-config.h \
|
|
||||||
libnm-util/nm-setting-vlan.h \
|
|
||||||
libnm-util/nm-setting-ip6-config.h \
|
|
||||||
libnm-util/nm-setting-ppp.h \
|
|
||||||
libnm-util/nm-setting-pppoe.h \
|
|
||||||
libnm-util/nm-setting-serial.h \
|
|
||||||
libnm-util/nm-setting-generic.h \
|
|
||||||
libnm-util/nm-setting-gsm.h \
|
|
||||||
libnm-util/nm-setting-cdma.h \
|
|
||||||
libnm-util/nm-setting-olpc-mesh.h \
|
|
||||||
libnm-util/nm-setting-wimax.h \
|
|
||||||
libnm-util/nm-setting-wired.h \
|
|
||||||
libnm-util/nm-setting-wireless.h \
|
|
||||||
libnm-util/nm-setting-wireless-security.h \
|
|
||||||
libnm-util/nm-setting-vpn.h \
|
|
||||||
libnm-util/nm-utils.h \
|
|
||||||
libnm-util/nm-version.h
|
|
||||||
libnm_util_lib_h_pub_mkenums = \
|
|
||||||
libnm-util/nm-utils-enum-types.h
|
|
||||||
libnm_util_lib_h_priv = \
|
|
||||||
libnm-util/crypto.h \
|
|
||||||
libnm-util/nm-dbus-glib-types.h \
|
|
||||||
libnm-util/nm-gvaluearray-compat.h \
|
|
||||||
libnm-util/nm-param-spec-specialized.h \
|
|
||||||
libnm-util/nm-setting-private.h \
|
|
||||||
libnm-util/nm-utils-private.h
|
|
||||||
|
|
||||||
libnm_util_libnm_util_include_HEADERS = \
|
|
||||||
$(libnm_util_lib_h_pub_real)
|
|
||||||
|
|
||||||
nodist_libnm_util_libnm_util_include_HEADERS = \
|
|
||||||
$(libnm_util_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
libnm_util_lib_c_real = \
|
|
||||||
libnm-util/crypto.c \
|
|
||||||
libnm-util/nm-connection.c \
|
|
||||||
libnm-util/nm-param-spec-specialized.c \
|
|
||||||
libnm-util/nm-setting.c \
|
|
||||||
libnm-util/nm-setting-8021x.c \
|
|
||||||
libnm-util/nm-setting-adsl.c \
|
|
||||||
libnm-util/nm-setting-bluetooth.c \
|
|
||||||
libnm-util/nm-setting-bond.c \
|
|
||||||
libnm-util/nm-setting-team.c \
|
|
||||||
libnm-util/nm-setting-team-port.c \
|
|
||||||
libnm-util/nm-setting-bridge.c \
|
|
||||||
libnm-util/nm-setting-bridge-port.c \
|
|
||||||
libnm-util/nm-setting-connection.c \
|
|
||||||
libnm-util/nm-setting-dcb.c \
|
|
||||||
libnm-util/nm-setting-infiniband.c \
|
|
||||||
libnm-util/nm-setting-ip4-config.c \
|
|
||||||
libnm-util/nm-setting-vlan.c \
|
|
||||||
libnm-util/nm-setting-ip6-config.c \
|
|
||||||
libnm-util/nm-setting-ppp.c \
|
|
||||||
libnm-util/nm-setting-pppoe.c \
|
|
||||||
libnm-util/nm-setting-serial.c \
|
|
||||||
libnm-util/nm-setting-generic.c \
|
|
||||||
libnm-util/nm-setting-gsm.c \
|
|
||||||
libnm-util/nm-setting-cdma.c \
|
|
||||||
libnm-util/nm-setting-olpc-mesh.c \
|
|
||||||
libnm-util/nm-setting-wimax.c \
|
|
||||||
libnm-util/nm-setting-wired.c \
|
|
||||||
libnm-util/nm-setting-wireless.c \
|
|
||||||
libnm-util/nm-setting-wireless-security.c \
|
|
||||||
libnm-util/nm-setting-vpn.c \
|
|
||||||
libnm-util/nm-utils.c \
|
|
||||||
libnm-util/nm-value-transforms.c
|
|
||||||
libnm_util_lib_c_mkenums = \
|
|
||||||
libnm-util/nm-utils-enum-types.c
|
|
||||||
|
|
||||||
libnm_util_libnm_util_la_SOURCES = \
|
|
||||||
$(libnm_util_lib_c_real) \
|
|
||||||
$(libnm_util_lib_h_pub_real) \
|
|
||||||
$(libnm_util_lib_h_priv)
|
|
||||||
|
|
||||||
nodist_libnm_util_libnm_util_la_SOURCES = \
|
|
||||||
$(libnm_util_lib_h_pub_mkenums) \
|
|
||||||
$(libnm_util_lib_c_mkenums)
|
|
||||||
|
|
||||||
$(libnm_util_libnm_util_la_OBJECTS): $(libnm_util_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
libnm_util_libnm_util_la_CPPFLAGS = $(libnm_util_cppflags)
|
|
||||||
|
|
||||||
|
|
||||||
GLIB_GENERATED += \
|
|
||||||
$(libnm_util_lib_h_pub_mkenums) \
|
|
||||||
$(libnm_util_lib_c_mkenums)
|
|
||||||
nm_utils_enum_types_sources = $(filter-out libnm-util/NetworkManager%,$(libnm_util_lib_h_pub_real))
|
|
||||||
|
|
||||||
$(libnm_util_libnm_util_la_OBJECTS): $(libnm_util_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
libnm_util_libnm_util_la_LIBADD = \
|
|
||||||
shared/nm-utils/libnm-utils-base.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS) \
|
|
||||||
$(UUID_LIBS)
|
|
||||||
|
|
||||||
libnm_util_libnm_util_la_LDFLAGS = \
|
|
||||||
-Wl,--version-script=$(srcdir)/libnm-util/libnm-util.ver \
|
|
||||||
-version-info "9:0:7"
|
|
||||||
|
|
||||||
if WITH_GNUTLS
|
|
||||||
libnm_util_cppflags += $(GNUTLS_CFLAGS)
|
|
||||||
libnm_util_lib_c_real += libnm-util/crypto_gnutls.c
|
|
||||||
libnm_util_libnm_util_la_LIBADD += $(GNUTLS_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_NSS
|
|
||||||
libnm_util_cppflags += $(NSS_CFLAGS)
|
|
||||||
libnm_util_lib_c_real += libnm-util/crypto_nss.c
|
|
||||||
libnm_util_libnm_util_la_LIBADD += $(NSS_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
libnm-util/crypto_gnutls.c \
|
|
||||||
libnm-util/crypto_nss.c
|
|
||||||
|
|
||||||
check_ltlibraries += libnm-util/libtest-crypto.la
|
|
||||||
|
|
||||||
libnm_util_libtest_crypto_la_SOURCES = \
|
|
||||||
libnm-util/crypto.c
|
|
||||||
libnm_util_libtest_crypto_la_CPPFLAGS = $(libnm_util_cppflags)
|
|
||||||
libnm_util_libtest_crypto_la_LIBADD = \
|
|
||||||
$(GLIB_LIBS)
|
|
||||||
|
|
||||||
if WITH_GNUTLS
|
|
||||||
libnm_util_libtest_crypto_la_SOURCES += libnm-util/crypto_gnutls.c
|
|
||||||
libnm_util_libtest_crypto_la_LIBADD += $(GNUTLS_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if WITH_NSS
|
|
||||||
libnm_util_libtest_crypto_la_SOURCES += libnm-util/crypto_nss.c
|
|
||||||
libnm_util_libtest_crypto_la_LIBADD += $(NSS_LIBS)
|
|
||||||
endif
|
|
||||||
|
|
||||||
pkgconfig_DATA += libnm-util/libnm-util.pc
|
|
||||||
|
|
||||||
DISTCLEANFILES += libnm-util/libnm-util.pc
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
libnm-util/COPYING \
|
|
||||||
libnm-util/libnm-util.pc.in \
|
|
||||||
libnm-util/libnm-util.ver \
|
|
||||||
libnm-util/nm-utils-enum-types.c.template \
|
|
||||||
libnm-util/nm-utils-enum-types.h.template \
|
|
||||||
libnm-util/meson.build
|
|
||||||
|
|
||||||
if HAVE_INTROSPECTION
|
|
||||||
libnm-util/NetworkManager-1.0.gir: libnm-util/libnm-util.la
|
|
||||||
libnm_util_NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0
|
|
||||||
libnm_util_NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1
|
|
||||||
libnm_util_NetworkManager_1_0_gir_EXPORT_PACKAGES = libnm-util
|
|
||||||
libnm_util_NetworkManager_1_0_gir_CFLAGS = $(AM_CPPFLAGS) -I$(srcdir)/libnm-util
|
|
||||||
libnm_util_NetworkManager_1_0_gir_LIBS = libnm-util/libnm-util.la
|
|
||||||
libnm_util_NetworkManager_1_0_gir_FILES = \
|
|
||||||
$(libnm_util_lib_h_pub_mkenums) \
|
|
||||||
$(libnm_util_lib_h_pub_real) \
|
|
||||||
$(libnm_util_lib_c_mkenums) \
|
|
||||||
$(libnm_util_lib_c_real)
|
|
||||||
libnm_util_NetworkManager_1_0_gir_SCANNERFLAGS = \
|
|
||||||
-I$(srcdir)/shared \
|
|
||||||
-I$(builddir)/shared \
|
|
||||||
-I$(srcdir)/libnm-util \
|
|
||||||
-I$(builddir)/libnm-util \
|
|
||||||
--warn-all --identifier-prefix=NM --symbol-prefix=nm
|
|
||||||
|
|
||||||
libnm-util/NetworkManager-1.0.typelib: libnm-util/NetworkManager-1.0.gir
|
|
||||||
$(INTROSPECTION_COMPILER) "--includedir=$(srcdir)/libnm-util" "--includedir=$(builddir)/libnm-util" $< -o $@
|
|
||||||
|
|
||||||
INTROSPECTION_GIRS += libnm-util/NetworkManager-1.0.gir
|
|
||||||
endif
|
|
||||||
|
|
||||||
check-local-exports-libnm-util: libnm-util/libnm-util.la
|
|
||||||
$(srcdir)/tools/check-exports.sh "$(builddir)/libnm-util/.libs/libnm-util.so" "$(srcdir)/libnm-util/libnm-util.ver"
|
|
||||||
|
|
||||||
check_local += check-local-exports-libnm-util
|
|
||||||
|
|
||||||
dist_dependencies += libnm-util/libnm-util.la
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# libnm-util/tests
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
libnm_util_tests_cppflags = \
|
|
||||||
$(dflt_cppflags) \
|
|
||||||
-I$(srcdir)/shared \
|
|
||||||
-I$(builddir)/shared \
|
|
||||||
-I$(srcdir)/libnm-util \
|
|
||||||
-I$(builddir)/libnm-util \
|
|
||||||
$(GLIB_CFLAGS) \
|
|
||||||
$(DBUS_CFLAGS) \
|
|
||||||
-DNETWORKMANAGER_COMPILATION_TEST \
|
|
||||||
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL \
|
|
||||||
$(SANITIZER_EXEC_CFLAGS) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
libnm_util_tests_ldadd = \
|
|
||||||
libnm-util/libnm-util.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS)
|
|
||||||
|
|
||||||
libnm_util_tests_ldflags = \
|
|
||||||
$(SANITIZER_EXEC_LDFLAGS)
|
|
||||||
|
|
||||||
check_programs += \
|
|
||||||
libnm-util/tests/test-settings-defaults \
|
|
||||||
libnm-util/tests/test-crypto \
|
|
||||||
libnm-util/tests/test-secrets \
|
|
||||||
libnm-util/tests/test-general \
|
|
||||||
libnm-util/tests/test-setting-8021x \
|
|
||||||
libnm-util/tests/test-setting-dcb
|
|
||||||
|
|
||||||
check_programs_norun += \
|
|
||||||
libnm-util/tests/test-libnm-linking
|
|
||||||
|
|
||||||
libnm_util_tests_test_settings_defaults_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_settings_defaults_LDADD = $(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_settings_defaults_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
libnm_util_tests_test_crypto_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_crypto_LDADD = \
|
|
||||||
libnm-util/libtest-crypto.la \
|
|
||||||
$(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_crypto_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
libnm_util_tests_test_secrets_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_secrets_LDADD = $(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_secrets_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
libnm_util_tests_test_general_DEPENDENCIES = libnm-util/tests/test-libnm-linking
|
|
||||||
libnm_util_tests_test_general_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_general_LDADD = $(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_general_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
libnm_util_tests_test_setting_8021x_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_setting_8021x_LDADD = $(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_setting_8021x_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
libnm_util_tests_test_setting_dcb_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_setting_dcb_LDADD = $(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_setting_dcb_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
libnm_util_tests_test_libnm_linking_CPPFLAGS = $(libnm_util_tests_cppflags)
|
|
||||||
libnm_util_tests_test_libnm_linking_LDADD = \
|
|
||||||
libnm/libnm.la \
|
|
||||||
$(libnm_util_tests_ldadd)
|
|
||||||
libnm_util_tests_test_libnm_linking_LDFLAGS = $(libnm_util_tests_ldflags)
|
|
||||||
|
|
||||||
$(libnm_util_tests_test_settings_defaults_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
$(libnm_util_tests_test_crypto_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
$(libnm_util_tests_test_secrets_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
$(libnm_util_tests_test_general_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
$(libnm_util_tests_test_setting_8021x_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
$(libnm_util_tests_test_setting_dcb_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
$(libnm_util_tests_test_libnm_linking_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
libnm-util/tests/meson.build
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# libnm-glib
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
libnm_glib_cppflags = \
|
|
||||||
$(dflt_cppflags) \
|
|
||||||
-I$(srcdir)/shared \
|
|
||||||
-I$(builddir)/shared \
|
|
||||||
-I$(srcdir)/libnm-util \
|
|
||||||
-I$(builddir)/libnm-util \
|
|
||||||
-I$(srcdir)/libnm-glib \
|
|
||||||
-I$(builddir)/libnm-glib \
|
|
||||||
-DG_LOG_DOMAIN=\""libnm-glib"\" \
|
|
||||||
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB \
|
|
||||||
$(DBUS_CFLAGS) \
|
|
||||||
$(GLIB_CFLAGS)
|
|
||||||
|
|
||||||
|
|
||||||
noinst_LTLIBRARIES += libnm-glib/libdeprecated-nm-glib.la
|
|
||||||
|
|
||||||
libnm_glib_libdeprecated_nm_glib_la_SOURCES = \
|
|
||||||
libnm-glib/libnm_glib.h \
|
|
||||||
libnm-glib/libnm_glib.c
|
|
||||||
|
|
||||||
libnm_glib_libdeprecated_nm_glib_la_CPPFLAGS = \
|
|
||||||
$(libnm_glib_cppflags) \
|
|
||||||
-Wno-deprecated-declarations \
|
|
||||||
-Wno-deprecated
|
|
||||||
|
|
||||||
libnm_glib_libdeprecated_nm_glib_la_LIBADD = \
|
|
||||||
$(DBUS_LIBS) \
|
|
||||||
$(GLIB_LIBS)
|
|
||||||
|
|
||||||
libdeprecateddir = $(includedir)/libnm-glib
|
|
||||||
libdeprecated_HEADERS = \
|
|
||||||
libnm-glib/libnm_glib.h
|
|
||||||
|
|
||||||
|
|
||||||
lib_LTLIBRARIES += libnm-glib/libnm-glib.la
|
|
||||||
|
|
||||||
libnm_glib_libnmincludedir = $(includedir)/libnm-glib
|
|
||||||
libnm_glib_libnmvpndir = $(includedir)/libnm-glib
|
|
||||||
|
|
||||||
libnm_glib_lib_h_pub_real = \
|
|
||||||
libnm-glib/nm-object.h \
|
|
||||||
libnm-glib/nm-client.h \
|
|
||||||
libnm-glib/nm-device.h \
|
|
||||||
libnm-glib/nm-device-ethernet.h \
|
|
||||||
libnm-glib/nm-device-infiniband.h \
|
|
||||||
libnm-glib/nm-device-adsl.h \
|
|
||||||
libnm-glib/nm-device-wifi.h \
|
|
||||||
libnm-glib/nm-device-bt.h \
|
|
||||||
libnm-glib/nm-device-olpc-mesh.h \
|
|
||||||
libnm-glib/nm-device-bond.h \
|
|
||||||
libnm-glib/nm-device-team.h \
|
|
||||||
libnm-glib/nm-device-bridge.h \
|
|
||||||
libnm-glib/nm-device-vlan.h \
|
|
||||||
libnm-glib/nm-device-generic.h \
|
|
||||||
libnm-glib/nm-access-point.h \
|
|
||||||
libnm-glib/nm-ip4-config.h \
|
|
||||||
libnm-glib/nm-device-modem.h \
|
|
||||||
libnm-glib/nm-vpn-connection.h \
|
|
||||||
libnm-glib/nm-types.h \
|
|
||||||
libnm-glib/nm-active-connection.h \
|
|
||||||
libnm-glib/nm-dhcp4-config.h \
|
|
||||||
libnm-glib/nm-ip6-config.h \
|
|
||||||
libnm-glib/nm-dhcp6-config.h \
|
|
||||||
libnm-glib/nm-remote-connection.h \
|
|
||||||
libnm-glib/nm-remote-settings.h \
|
|
||||||
libnm-glib/nm-secret-agent.h \
|
|
||||||
libnm-glib/nm-device-wimax.h \
|
|
||||||
libnm-glib/nm-wimax-nsp.h
|
|
||||||
libnm_glib_lib_h_pub_mkenums = \
|
|
||||||
libnm-glib/nm-glib-enum-types.h
|
|
||||||
libnm_glib_lib_h_priv = \
|
|
||||||
libnm-glib/nm-object-private.h \
|
|
||||||
libnm-glib/nm-device-private.h \
|
|
||||||
libnm-glib/nm-types-private.h \
|
|
||||||
libnm-glib/nm-object-cache.h \
|
|
||||||
libnm-glib/nm-remote-connection-private.h \
|
|
||||||
libnm-glib/nm-dbus-helpers-private.h
|
|
||||||
|
|
||||||
libnm_glib_libnminclude_HEADERS = \
|
|
||||||
$(libnm_glib_lib_h_pub_real)
|
|
||||||
nodist_libnm_glib_libnminclude_HEADERS = \
|
|
||||||
$(libnm_glib_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
libnm_glib_vpn_h_real = \
|
|
||||||
libnm-glib/nm-vpn-plugin.h \
|
|
||||||
libnm-glib/nm-vpn-plugin-ui-interface.h \
|
|
||||||
libnm-glib/nm-vpn-plugin-utils.h
|
|
||||||
libnm_glib_vpn_h_mkenums = \
|
|
||||||
libnm-glib/nm-vpn-enum-types.h
|
|
||||||
|
|
||||||
libnm_glib_libnmvpn_HEADERS = \
|
|
||||||
$(libnm_glib_vpn_h_real)
|
|
||||||
|
|
||||||
nodist_libnm_glib_libnmvpn_HEADERS = \
|
|
||||||
$(libnm_glib_vpn_h_mkenums)
|
|
||||||
|
|
||||||
libnm_glib_lib_c_real = \
|
|
||||||
libnm-glib/nm-object.c \
|
|
||||||
libnm-glib/nm-dbus-helpers.c \
|
|
||||||
libnm-glib/nm-client.c \
|
|
||||||
libnm-glib/nm-device.c \
|
|
||||||
libnm-glib/nm-device-ethernet.c \
|
|
||||||
libnm-glib/nm-device-infiniband.c \
|
|
||||||
libnm-glib/nm-device-adsl.c \
|
|
||||||
libnm-glib/nm-device-wifi.c \
|
|
||||||
libnm-glib/nm-device-bt.c \
|
|
||||||
libnm-glib/nm-device-olpc-mesh.c \
|
|
||||||
libnm-glib/nm-device-bond.c \
|
|
||||||
libnm-glib/nm-device-team.c \
|
|
||||||
libnm-glib/nm-device-bridge.c \
|
|
||||||
libnm-glib/nm-device-vlan.c \
|
|
||||||
libnm-glib/nm-device-generic.c \
|
|
||||||
libnm-glib/nm-access-point.c \
|
|
||||||
libnm-glib/nm-ip4-config.c \
|
|
||||||
libnm-glib/nm-device-modem.c \
|
|
||||||
libnm-glib/nm-vpn-connection.c \
|
|
||||||
libnm-glib/nm-types.c \
|
|
||||||
libnm-glib/nm-object-cache.c \
|
|
||||||
libnm-glib/nm-active-connection.c \
|
|
||||||
libnm-glib/nm-dhcp4-config.c \
|
|
||||||
libnm-glib/nm-ip6-config.c \
|
|
||||||
libnm-glib/nm-dhcp6-config.c \
|
|
||||||
libnm-glib/nm-remote-connection.c \
|
|
||||||
libnm-glib/nm-remote-settings.c \
|
|
||||||
libnm-glib/nm-secret-agent.c \
|
|
||||||
libnm-glib/nm-device-wimax.c \
|
|
||||||
libnm-glib/nm-wimax-nsp.c
|
|
||||||
libnm_glib_lib_c_mkenums = \
|
|
||||||
libnm-glib/nm-glib-enum-types.c
|
|
||||||
|
|
||||||
libnm_glib_libnm_glib_la_SOURCES = \
|
|
||||||
$(libnm_glib_lib_c_real) \
|
|
||||||
$(libnm_glib_lib_h_pub_real) \
|
|
||||||
$(libnm_glib_lib_h_priv)
|
|
||||||
|
|
||||||
nodist_libnm_glib_libnm_glib_la_SOURCES = \
|
|
||||||
$(libnm_glib_lib_c_mkenums) \
|
|
||||||
$(libnm_glib_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
libnm_glib_libnm_glib_la_CPPFLAGS = \
|
|
||||||
$(libnm_glib_cppflags) \
|
|
||||||
$(LIBUDEV_CFLAGS) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
libnm_glib_libnm_glib_la_LDFLAGS = \
|
|
||||||
-Wl,--version-script=$(srcdir)/libnm-glib/libnm-glib.ver \
|
|
||||||
-version-info "13:0:9"
|
|
||||||
|
|
||||||
libnm_glib_libnm_glib_la_LIBADD = \
|
|
||||||
libnm-util/libnm-util.la \
|
|
||||||
libnm-glib/libdeprecated-nm-glib.la \
|
|
||||||
shared/nm-utils/libnm-utils-udev.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS) \
|
|
||||||
$(LIBUDEV_LIBS) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
$(libnm_glib_libnm_glib_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
GLIB_GENERATED += \
|
|
||||||
$(libnm_glib_lib_h_pub_mkenums) \
|
|
||||||
$(libnm_glib_lib_c_mkenums)
|
|
||||||
nm_glib_enum_types_sources = $(libnm_glib_lib_h_pub_real)
|
|
||||||
|
|
||||||
$(libnm_glib_libnm_glib_la_OBJECTS): $(libnm_glib_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
check_programs_norun += libnm-glib/libnm-glib-test
|
|
||||||
|
|
||||||
libnm_glib_libnm_glib_test_CFLAGS = $(libnm_glib_cppflags)
|
|
||||||
libnm_glib_libnm_glib_test_LDADD = \
|
|
||||||
libnm-glib/libnm-glib.la \
|
|
||||||
libnm-util/libnm-util.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS)
|
|
||||||
$(libnm_glib_libnm_glib_test_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
lib_LTLIBRARIES += libnm-glib/libnm-glib-vpn.la
|
|
||||||
|
|
||||||
libnm_glib_vpn_c_real = \
|
|
||||||
libnm-glib/nm-vpn-plugin.c \
|
|
||||||
libnm-glib/nm-vpn-plugin-ui-interface.c \
|
|
||||||
libnm-glib/nm-vpn-plugin-utils.c
|
|
||||||
libnm_glib_vpn_c_mkenums = \
|
|
||||||
libnm-glib/nm-vpn-enum-types.c
|
|
||||||
libnm_glib_libnm_glib_vpn_la_SOURCES = \
|
|
||||||
$(libnm_glib_vpn_c_real)
|
|
||||||
nodist_libnm_glib_libnm_glib_vpn_la_SOURCES = \
|
|
||||||
$(libnm_glib_vpn_c_mkenums)
|
|
||||||
libnm_glib_libnm_glib_vpn_la_CPPFLAGS = $(libnm_glib_cppflags)
|
|
||||||
libnm_glib_libnm_glib_vpn_la_LIBADD = \
|
|
||||||
libnm-util/libnm-util.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS)
|
|
||||||
libnm_glib_libnm_glib_vpn_la_LDFLAGS = \
|
|
||||||
-Wl,--version-script=$(srcdir)/libnm-glib/libnm-glib-vpn.ver \
|
|
||||||
-version-info "3:0:2"
|
|
||||||
$(libnm_glib_libnm_glib_vpn_la_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
|
|
||||||
GLIB_GENERATED += \
|
|
||||||
$(libnm_glib_vpn_h_mkenums) \
|
|
||||||
$(libnm_glib_vpn_c_mkenums)
|
|
||||||
nm_vpn_enum_types_sources = $(libnm_glib_vpn_h_real)
|
|
||||||
|
|
||||||
$(libnm_glib_libnm_glib_vpn_la_OBJECTS): $(libnm_glib_vpn_h_mkenums)
|
|
||||||
|
|
||||||
libnm-glib/nm-vpn-plugin-glue.h: introspection/org.freedesktop.NetworkManager.VPN.Plugin.xml
|
|
||||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_vpn_plugin --mode=glib-server --output=$@ $<
|
|
||||||
|
|
||||||
libnm-glib/nm-secret-agent-glue.h: introspection/org.freedesktop.NetworkManager.SecretAgent.xml
|
|
||||||
$(AM_V_GEN) dbus-binding-tool --prefix=nm_secret_agent --mode=glib-server --output=$@ $<
|
|
||||||
|
|
||||||
CLEANFILES += \
|
|
||||||
libnm-glib/nm-vpn-plugin-glue.h \
|
|
||||||
libnm-glib/nm-secret-agent-glue.h
|
|
||||||
|
|
||||||
$(libnm_glib_libnm_glib_vpn_la_OBJECTS): libnm-glib/nm-vpn-plugin-glue.h
|
|
||||||
$(libnm_glib_libnm_glib_la_OBJECTS): libnm-glib/nm-secret-agent-glue.h
|
|
||||||
|
|
||||||
|
|
||||||
pkgconfig_DATA += \
|
|
||||||
libnm-glib/libnm-glib.pc \
|
|
||||||
libnm-glib/libnm-glib-vpn.pc
|
|
||||||
|
|
||||||
DISTCLEANFILES += \
|
|
||||||
libnm-glib/libnm-glib.pc \
|
|
||||||
libnm-glib/libnm-glib.pc
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
libnm-glib/libnm-glib.pc.in \
|
|
||||||
libnm-glib/libnm-glib-vpn.pc.in \
|
|
||||||
libnm-glib/libnm-glib.ver \
|
|
||||||
libnm-glib/libnm-glib-vpn.ver \
|
|
||||||
libnm-glib/nm-vpn-enum-types.c.template \
|
|
||||||
libnm-glib/nm-vpn-enum-types.h.template \
|
|
||||||
libnm-glib/nm-glib-enum-types.c.template \
|
|
||||||
libnm-glib/nm-glib-enum-types.h.template \
|
|
||||||
libnm-glib/meson.build
|
|
||||||
|
|
||||||
if HAVE_INTROSPECTION
|
|
||||||
libnm-glib/NMClient-1.0.gir: libnm-glib/libnm-glib.la $(builddir)/libnm-util/NetworkManager-1.0.gir
|
|
||||||
libnm_glib_NMClient_1_0_gir_INCLUDES = Gio-2.0 DBusGLib-1.0
|
|
||||||
libnm_glib_NMClient_1_0_gir_PACKAGES = gio-2.0 dbus-glib-1
|
|
||||||
libnm_glib_NMClient_1_0_gir_EXPORT_PACKAGES = libnm-glib libnm-glib-vpn
|
|
||||||
libnm_glib_NMClient_1_0_gir_CFLAGS = $(libnm_glib_cppflags)
|
|
||||||
libnm_glib_NMClient_1_0_gir_LIBS = \
|
|
||||||
libnm-glib/libnm-glib.la \
|
|
||||||
libnm-util/libnm-util.la
|
|
||||||
libnm_glib_NMClient_1_0_gir_FILES = \
|
|
||||||
$(libnm_glib_lib_h_pub_mkenums) \
|
|
||||||
$(libnm_glib_lib_h_pub_real) \
|
|
||||||
$(libnm_glib_lib_c_mkenums) \
|
|
||||||
$(libnm_glib_lib_c_real)
|
|
||||||
libnm_glib_NMClient_1_0_gir_SCANNERFLAGS = \
|
|
||||||
-I$(srcdir)/libnm-util \
|
|
||||||
-I$(builddir)/libnm-util \
|
|
||||||
-I$(srcdir)/libnm-glib \
|
|
||||||
-I$(builddir)/libnm-glib \
|
|
||||||
--warn-all --identifier-prefix=NM --symbol-prefix=nm \
|
|
||||||
--include-uninstalled=$(builddir)/libnm-util/NetworkManager-1.0.gir
|
|
||||||
|
|
||||||
libnm-glib/NMClient-1.0.typelib: libnm-glib/NMClient-1.0.gir
|
|
||||||
$(INTROSPECTION_COMPILER) "--includedir=$(srcdir)/libnm-util" "--includedir=$(builddir)/libnm-util" $< -o $@
|
|
||||||
|
|
||||||
INTROSPECTION_GIRS += libnm-glib/NMClient-1.0.gir
|
|
||||||
endif
|
|
||||||
|
|
||||||
check-local-exports-libnm-glib:
|
|
||||||
$(srcdir)/tools/check-exports.sh $(builddir)/libnm-glib/.libs/libnm-glib.so $(srcdir)/libnm-glib/libnm-glib.ver
|
|
||||||
|
|
||||||
check_local += check-local-exports-libnm-glib
|
|
||||||
|
|
||||||
dist_dependencies += \
|
|
||||||
libnm-glib/libnm-glib.la \
|
|
||||||
libnm-glib/libnm-glib-vpn.la
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
# libnm-glib/tests
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
libnm_glib_tests_cppflags = \
|
|
||||||
$(dflt_cppflags) \
|
|
||||||
-I$(srcdir)/shared \
|
|
||||||
-I$(builddir)/shared \
|
|
||||||
-I$(srcdir)/libnm-util \
|
|
||||||
-I$(builddir)/libnm-util \
|
|
||||||
-I$(srcdir)/libnm-glib \
|
|
||||||
-DNETWORKMANAGER_COMPILATION_TEST \
|
|
||||||
-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB \
|
|
||||||
$(GLIB_CFLAGS) \
|
|
||||||
$(DBUS_CFLAGS) \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
if HAVE_INTROSPECTION
|
|
||||||
check-local-libnm-glib-nm-client: libnm-glib/tests/test-nm-client
|
|
||||||
( $(LOG_COMPILER) "$(builddir)/libnm-glib/tests/test-nm-client"; r="$$?"; test "$$r" = 0 -o "$$r" = 77 ) || \
|
|
||||||
( $(LOG_COMPILER) "$(builddir)/libnm-glib/tests/test-nm-client"; r="$$?"; test "$$r" = 0 -o "$$r" = 77 ) || \
|
|
||||||
( $(LOG_COMPILER) "$(builddir)/libnm-glib/tests/test-nm-client"; r="$$?"; test "$$r" = 0 -o "$$r" = 77 ) || \
|
|
||||||
( $(LOG_COMPILER) "$(builddir)/libnm-glib/tests/test-nm-client"; r="$$?"; test "$$r" = 0 -o "$$r" = 77 ) || \
|
|
||||||
( $(LOG_COMPILER) "$(builddir)/libnm-glib/tests/test-nm-client"; r="$$?"; test "$$r" = 0 -o "$$r" = 77 ) || \
|
|
||||||
false
|
|
||||||
|
|
||||||
check_local += check-local-libnm-glib-nm-client
|
|
||||||
endif
|
|
||||||
check_programs_norun += libnm-glib/tests/test-nm-client
|
|
||||||
|
|
||||||
if HAVE_INTROSPECTION
|
|
||||||
check_programs += libnm-glib/tests/test-remote-settings-client
|
|
||||||
else
|
|
||||||
check_programs_norun += libnm-glib/tests/test-remote-settings-client
|
|
||||||
endif
|
|
||||||
|
|
||||||
libnm_glib_tests_test_nm_client_CPPFLAGS = $(libnm_glib_tests_cppflags)
|
|
||||||
|
|
||||||
libnm_glib_tests_test_nm_client_SOURCES = \
|
|
||||||
shared/nm-test-utils-impl.c \
|
|
||||||
shared/nm-test-libnm-utils.h \
|
|
||||||
libnm-glib/tests/test-nm-client.c
|
|
||||||
|
|
||||||
libnm_glib_tests_test_nm_client_LDADD = \
|
|
||||||
libnm-util/libnm-util.la \
|
|
||||||
libnm-glib/libnm-glib.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS)
|
|
||||||
|
|
||||||
$(libnm_glib_tests_test_nm_client_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
|
|
||||||
libnm_glib_tests_test_remote_settings_client_CPPFLAGS = $(libnm_glib_tests_cppflags)
|
|
||||||
|
|
||||||
libnm_glib_tests_test_remote_settings_client_SOURCES = \
|
|
||||||
shared/nm-test-utils-impl.c \
|
|
||||||
shared/nm-test-libnm-utils.h \
|
|
||||||
libnm-glib/tests/test-remote-settings-client.c
|
|
||||||
|
|
||||||
libnm_glib_tests_test_remote_settings_client_LDADD = \
|
|
||||||
libnm-util/libnm-util.la \
|
|
||||||
libnm-glib/libnm-glib.la \
|
|
||||||
$(GLIB_LIBS) \
|
|
||||||
$(DBUS_LIBS)
|
|
||||||
|
|
||||||
$(libnm_glib_tests_test_remote_settings_client_OBJECTS): $(libnm_core_lib_h_pub_mkenums)
|
|
||||||
|
|
||||||
# tools/test-networkmanager-service.py uses libnm's typelib. Ensure it
|
|
||||||
# is built first.
|
|
||||||
$(libnm_glib_tests_test_nm_client_OBJECTS): $(libnm_NM_1_0_typelib)
|
|
||||||
$(libnm_glib_tests_test_remote_settings_client_OBJECTS): $(libnm_NM_1_0_typelib)
|
|
||||||
|
|
||||||
endif
|
|
||||||
|
|
||||||
EXTRA_DIST += \
|
|
||||||
libnm-glib/tests/meson.build
|
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# man
|
# man
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
@ -5160,29 +4460,12 @@ if ENABLE_VAPIGEN
|
||||||
VAPIGEN_VAPIS += \
|
VAPIGEN_VAPIS += \
|
||||||
vapi/libnm.vapi
|
vapi/libnm.vapi
|
||||||
|
|
||||||
if WITH_LEGACY_LIBRARIES
|
|
||||||
VAPIGEN_VAPIS += \
|
|
||||||
vapi/libnm-util.vapi \
|
|
||||||
vapi/libnm-glib.vapi
|
|
||||||
endif
|
|
||||||
|
|
||||||
vapi/libnm.vapi: $(builddir)/libnm/NM-1.0.gir vapi/libnm.deps vapi/NM-1.0.metadata
|
vapi/libnm.vapi: $(builddir)/libnm/NM-1.0.gir vapi/libnm.deps vapi/NM-1.0.metadata
|
||||||
vapi/libnm-util.vapi: $(builddir)/libnm-util/NetworkManager-1.0.gir vapi/libnm-util.deps vapi/NetworkManager-1.0.metadata
|
|
||||||
vapi/libnm-glib.vapi: $(builddir)/libnm-glib/NMClient-1.0.gir vapi/libnm-glib.deps vapi/NMClient-1.0.metadata vapi/libnm-util.vapi
|
|
||||||
|
|
||||||
vapi_libnm_vapi_METADATADIRS = $(srcdir)/vapi
|
vapi_libnm_vapi_METADATADIRS = $(srcdir)/vapi
|
||||||
vapi_libnm_vapi_FILES = $(builddir)/libnm/NM-1.0.gir
|
vapi_libnm_vapi_FILES = $(builddir)/libnm/NM-1.0.gir
|
||||||
vapi_libnm_vapi_DEPS = gio-2.0
|
vapi_libnm_vapi_DEPS = gio-2.0
|
||||||
|
|
||||||
vapi_libnm_util_vapi_METADATADIRS = $(srcdir)/vapi
|
|
||||||
vapi_libnm_util_vapi_FILES = $(builddir)/libnm-util/NetworkManager-1.0.gir
|
|
||||||
|
|
||||||
vapi_libnm_glib_vapi_METADATADIRS = $(srcdir)/vapi
|
|
||||||
vapi_libnm_glib_vapi_FILES = $(builddir)/libnm-glib/NMClient-1.0.gir
|
|
||||||
vapi_libnm_glib_vapi_VAPIDIRS = $(builddir)/vapi
|
|
||||||
vapi_libnm_glib_vapi_GIRDIRS = $(builddir)/libnm-util
|
|
||||||
vapi_libnm_glib_vapi_DEPS = gio-2.0 dbus-glib-1 libnm-util
|
|
||||||
|
|
||||||
vapi_DATA += \
|
vapi_DATA += \
|
||||||
$(VAPIGEN_VAPIS) \
|
$(VAPIGEN_VAPIS) \
|
||||||
$(VAPIGEN_VAPIS:.vapi=.deps)
|
$(VAPIGEN_VAPIS:.vapi=.deps)
|
||||||
|
|
@ -5193,11 +4476,7 @@ endif
|
||||||
|
|
||||||
EXTRA_DIST += \
|
EXTRA_DIST += \
|
||||||
vapi/NM-1.0.metadata \
|
vapi/NM-1.0.metadata \
|
||||||
vapi/NetworkManager-1.0.metadata \
|
|
||||||
vapi/NMClient-1.0.metadata \
|
|
||||||
vapi/libnm.deps \
|
vapi/libnm.deps \
|
||||||
vapi/libnm-util.deps \
|
|
||||||
vapi/libnm-glib.deps \
|
|
||||||
vapi/meson.build
|
vapi/meson.build
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
@ -5322,7 +4601,7 @@ uninstall-hook: $(uninstall_hook)
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
cscope:
|
cscope:
|
||||||
cscope -b -q -R -sshared -ssrc -slibnm-core -slibnm -slibnm-glib -slibnm-util -sclients;
|
cscope -b -q -R -sshared -ssrc -slibnm-core -slibnm -sclients;
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
|
|
||||||
3
NEWS
3
NEWS
|
|
@ -8,6 +8,9 @@ The API is subject to change and not guaranteed to be compatible
|
||||||
with the later release.
|
with the later release.
|
||||||
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
||||||
|
|
||||||
|
* The libnm-glib library, deprecated in favor of libnm since NetworkManager 1.0,
|
||||||
|
and disabled by default since NetworkManager 1.12 has now been removed.
|
||||||
|
|
||||||
=============================================
|
=============================================
|
||||||
NetworkManager-1.16
|
NetworkManager-1.16
|
||||||
Overview of changes since NetworkManager-1.14
|
Overview of changes since NetworkManager-1.14
|
||||||
|
|
|
||||||
|
|
@ -28,5 +28,5 @@ AUTOPOINT='intltoolize --automake --copy' autoreconf --force --install --verbose
|
||||||
|
|
||||||
cd $olddir
|
cd $olddir
|
||||||
if test -z "$NOCONFIGURE"; then
|
if test -z "$NOCONFIGURE"; then
|
||||||
exec $srcdir/configure --enable-maintainer-mode --enable-more-warnings=error --enable-gtk-doc --enable-introspection --with-libnm-glib "$@"
|
exec $srcdir/configure --enable-maintainer-mode --enable-more-warnings=error --enable-gtk-doc --enable-introspection "$@"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -197,9 +197,6 @@
|
||||||
/* Define if you have dhcpcd */
|
/* Define if you have dhcpcd */
|
||||||
#mesondefine WITH_DHCPCD
|
#mesondefine WITH_DHCPCD
|
||||||
|
|
||||||
/* Define for libnm to prevent GIR from loading libnm-glib */
|
|
||||||
#mesondefine WITH_FAKE_TYPELIBS
|
|
||||||
|
|
||||||
/* Define if JANSSON is enabled */
|
/* Define if JANSSON is enabled */
|
||||||
#mesondefine WITH_JANSSON
|
#mesondefine WITH_JANSSON
|
||||||
|
|
||||||
|
|
|
||||||
36
configure.ac
36
configure.ac
|
|
@ -256,34 +256,6 @@ AC_SUBST(GLIB_LIBS)
|
||||||
|
|
||||||
GOBJECT_INTROSPECTION_CHECK([0.9.6])
|
GOBJECT_INTROSPECTION_CHECK([0.9.6])
|
||||||
|
|
||||||
AC_ARG_WITH(libnm-glib,
|
|
||||||
AS_HELP_STRING([--with-libnm-glib],
|
|
||||||
[build legacy libraries]))
|
|
||||||
fake_typelibs=no
|
|
||||||
if test "$with_libnm_glib" == "yes"; then
|
|
||||||
PKG_CHECK_MODULES(DBUS, dbus-1 >= 1.1 dbus-glib-1 >= 0.94, :,
|
|
||||||
[AC_MSG_FAILURE([$DBUS_PKG_ERRORS
|
|
||||||
|
|
||||||
Configure with --without-libnm-glib if you do not need the legacy libraries])
|
|
||||||
])
|
|
||||||
|
|
||||||
if test "${found_introspection}" = "yes"; then
|
|
||||||
AC_PATH_PROG(GLIB_COMPILE_RESOURCES, glib-compile-resources)
|
|
||||||
if ! test x"$GLIB_COMPILE_RESOURCES" = x""; then
|
|
||||||
fake_typelibs=yes
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
with_libnm_glib=no
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(WITH_LEGACY_LIBRARIES, test "$with_libnm_glib" == "yes")
|
|
||||||
if test "$fake_typelibs" = "yes"; then
|
|
||||||
AC_DEFINE(WITH_FAKE_TYPELIBS, 1, [Define for libnm to prevent GIR from loading libnm-glib])
|
|
||||||
else
|
|
||||||
AC_DEFINE(WITH_FAKE_TYPELIBS, 0, [Define for libnm to prevent GIR from loading libnm-glib])
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(WITH_FAKE_TYPELIBS, test "${fake_typelibs}" = "yes")
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([LIBUDEV], [libudev >= 175])
|
PKG_CHECK_MODULES([LIBUDEV], [libudev >= 175])
|
||||||
|
|
||||||
# Qt4
|
# Qt4
|
||||||
|
|
@ -1274,17 +1246,10 @@ AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
shared/nm-version-macros.h
|
shared/nm-version-macros.h
|
||||||
libnm/libnm.pc
|
libnm/libnm.pc
|
||||||
libnm-util/libnm-util.pc
|
|
||||||
libnm-glib/libnm-glib.pc
|
|
||||||
libnm-glib/libnm-glib-vpn.pc
|
|
||||||
po/Makefile.in
|
po/Makefile.in
|
||||||
data/org.freedesktop.NetworkManager.policy.in
|
data/org.freedesktop.NetworkManager.policy.in
|
||||||
docs/api/Makefile
|
docs/api/Makefile
|
||||||
docs/api/version.xml
|
docs/api/version.xml
|
||||||
docs/libnm-glib/Makefile
|
|
||||||
docs/libnm-glib/version.xml
|
|
||||||
docs/libnm-util/Makefile
|
|
||||||
docs/libnm-util/version.xml
|
|
||||||
docs/libnm/Makefile
|
docs/libnm/Makefile
|
||||||
docs/libnm/version.xml
|
docs/libnm/version.xml
|
||||||
NetworkManager.pc
|
NetworkManager.pc
|
||||||
|
|
@ -1333,7 +1298,6 @@ echo " ofono: $with_ofono"
|
||||||
echo " concheck: $enable_concheck"
|
echo " concheck: $enable_concheck"
|
||||||
echo " libteamdctl: $enable_teamdctl"
|
echo " libteamdctl: $enable_teamdctl"
|
||||||
echo " ovs: $enable_ovs"
|
echo " ovs: $enable_ovs"
|
||||||
echo " libnm-glib: $with_libnm_glib"
|
|
||||||
echo " nmcli: $build_nmcli"
|
echo " nmcli: $build_nmcli"
|
||||||
echo " nmtui: $build_nmtui"
|
echo " nmtui: $build_nmtui"
|
||||||
echo " iwd: $ac_with_iwd"
|
echo " iwd: $ac_with_iwd"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,6 @@ install \
|
||||||
bzip2 \
|
bzip2 \
|
||||||
cscope \
|
cscope \
|
||||||
dbus-devel \
|
dbus-devel \
|
||||||
dbus-glib-devel \
|
|
||||||
dbus-python \
|
dbus-python \
|
||||||
dbus-x11 \
|
dbus-x11 \
|
||||||
dhclient \
|
dhclient \
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,6 @@
|
||||||
# Note that it contains __PLACEHOLDERS__ that will be replaced by the accompanying 'build.sh' script.
|
# Note that it contains __PLACEHOLDERS__ that will be replaced by the accompanying 'build.sh' script.
|
||||||
|
|
||||||
|
|
||||||
%global dbus_glib_version 0.100
|
|
||||||
|
|
||||||
%global wireless_tools_version 1:28-0pre9
|
%global wireless_tools_version 1:28-0pre9
|
||||||
|
|
||||||
%global wpa_supplicant_version 1:1.1
|
%global wpa_supplicant_version 1:1.1
|
||||||
|
|
@ -60,11 +58,6 @@
|
||||||
%bcond_with test
|
%bcond_with test
|
||||||
%bcond_with lto
|
%bcond_with lto
|
||||||
%bcond_with sanitizer
|
%bcond_with sanitizer
|
||||||
%if 0%{?fedora} > 28 || 0%{?rhel} > 7
|
|
||||||
%bcond_with libnm_glib
|
|
||||||
%else
|
|
||||||
%bcond_without libnm_glib
|
|
||||||
%endif
|
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
%bcond_without connectivity_fedora
|
%bcond_without connectivity_fedora
|
||||||
%else
|
%else
|
||||||
|
|
@ -156,7 +149,6 @@ BuildRequires: intltool
|
||||||
BuildRequires: gettext-devel
|
BuildRequires: gettext-devel
|
||||||
|
|
||||||
BuildRequires: dbus-devel >= %{dbus_version}
|
BuildRequires: dbus-devel >= %{dbus_version}
|
||||||
BuildRequires: dbus-glib-devel >= %{dbus_glib_version}
|
|
||||||
%if 0%{?fedora}
|
%if 0%{?fedora}
|
||||||
BuildRequires: wireless-tools-devel >= %{wireless_tools_version}
|
BuildRequires: wireless-tools-devel >= %{wireless_tools_version}
|
||||||
%endif
|
%endif
|
||||||
|
|
@ -344,37 +336,6 @@ This package contains NetworkManager support for PPP.
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%package glib
|
|
||||||
Summary: Libraries for adding NetworkManager support to applications (old API).
|
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: dbus >= %{dbus_version}
|
|
||||||
Requires: dbus-glib >= %{dbus_glib_version}
|
|
||||||
Conflicts: NetworkManager-libnm < %{epoch}:%{version}-%{release}
|
|
||||||
|
|
||||||
%description glib
|
|
||||||
This package contains the libraries that make it easier to use some
|
|
||||||
NetworkManager functionality from applications that use glib. This is
|
|
||||||
the older NetworkManager API. See also NetworkManager-libnm.
|
|
||||||
|
|
||||||
|
|
||||||
%package glib-devel
|
|
||||||
Summary: Header files for adding NetworkManager support to applications (old API).
|
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: %{name}-glib%{?_isa} = %{epoch}:%{version}-%{release}
|
|
||||||
Requires: glib2-devel
|
|
||||||
Requires: pkgconfig
|
|
||||||
Requires: dbus-glib-devel >= %{dbus_glib_version}
|
|
||||||
Provides: %{name}-devel = %{epoch}:%{version}-%{release}
|
|
||||||
Provides: %{name}-devel%{?_isa} = %{epoch}:%{version}-%{release}
|
|
||||||
Obsoletes: %{name}-devel < %{epoch}:%{version}-%{release}
|
|
||||||
|
|
||||||
%description glib-devel
|
|
||||||
This package contains the header and pkg-config files for development
|
|
||||||
applications using NetworkManager functionality from applications that
|
|
||||||
use glib.
|
|
||||||
This is the older NetworkManager API. See also NetworkManager-libnm-devel.
|
|
||||||
|
|
||||||
|
|
||||||
%package libnm
|
%package libnm
|
||||||
Summary: Libraries for adding NetworkManager support to applications (new API).
|
Summary: Libraries for adding NetworkManager support to applications (new API).
|
||||||
Group: Development/Libraries
|
Group: Development/Libraries
|
||||||
|
|
@ -566,12 +527,7 @@ by nm-connection-editor and nm-applet in a non-graphical environment.
|
||||||
-Dconfig_plugins_default='ifcfg-rh' \
|
-Dconfig_plugins_default='ifcfg-rh' \
|
||||||
-Dconfig_dns_rc_manager_default=symlink \
|
-Dconfig_dns_rc_manager_default=symlink \
|
||||||
-Dconfig_logging_backend_default=journal \
|
-Dconfig_logging_backend_default=journal \
|
||||||
-Djson_validation=true \
|
-Djson_validation=true
|
||||||
%if %{with libnm_glib}
|
|
||||||
-Dlibnm_glib=true
|
|
||||||
%else
|
|
||||||
-Dlibnm_glib=false
|
|
||||||
%endif
|
|
||||||
|
|
||||||
%meson_build
|
%meson_build
|
||||||
|
|
||||||
|
|
@ -687,12 +643,7 @@ intltoolize --automake --copy --force
|
||||||
--with-config-plugins-default='ifcfg-rh' \
|
--with-config-plugins-default='ifcfg-rh' \
|
||||||
--with-config-dns-rc-manager-default=symlink \
|
--with-config-dns-rc-manager-default=symlink \
|
||||||
--with-config-logging-backend-default=journal \
|
--with-config-logging-backend-default=journal \
|
||||||
--enable-json-validation \
|
--enable-json-validation
|
||||||
%if %{with libnm_glib}
|
|
||||||
--with-libnm-glib
|
|
||||||
%else
|
|
||||||
--without-libnm-glib
|
|
||||||
%endif
|
|
||||||
|
|
||||||
make %{?_smp_mflags}
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
|
@ -802,9 +753,6 @@ fi
|
||||||
|
|
||||||
|
|
||||||
%if 0%{?fedora} < 28
|
%if 0%{?fedora} < 28
|
||||||
%post glib -p /sbin/ldconfig
|
|
||||||
%postun glib -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%post libnm -p /sbin/ldconfig
|
%post libnm -p /sbin/ldconfig
|
||||||
%postun libnm -p /sbin/ldconfig
|
%postun libnm -p /sbin/ldconfig
|
||||||
%endif
|
%endif
|
||||||
|
|
@ -913,47 +861,6 @@ fi
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
|
||||||
%if %{with libnm_glib}
|
|
||||||
%files glib -f %{name}.lang
|
|
||||||
%{_libdir}/libnm-glib.so.*
|
|
||||||
%{_libdir}/libnm-glib-vpn.so.*
|
|
||||||
%{_libdir}/libnm-util.so.*
|
|
||||||
%{_libdir}/girepository-1.0/NetworkManager-1.0.typelib
|
|
||||||
%{_libdir}/girepository-1.0/NMClient-1.0.typelib
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
%if %{with libnm_glib}
|
|
||||||
%files glib-devel
|
|
||||||
%dir %{_includedir}/libnm-glib
|
|
||||||
%dir %{_includedir}/%{name}
|
|
||||||
%{_includedir}/libnm-glib/*.h
|
|
||||||
%{_includedir}/%{name}/%{name}.h
|
|
||||||
%{_includedir}/%{name}/NetworkManagerVPN.h
|
|
||||||
%{_includedir}/%{name}/nm-setting*.h
|
|
||||||
%{_includedir}/%{name}/nm-connection.h
|
|
||||||
%{_includedir}/%{name}/nm-utils-enum-types.h
|
|
||||||
%{_includedir}/%{name}/nm-utils.h
|
|
||||||
%{_includedir}/%{name}/nm-version.h
|
|
||||||
%{_includedir}/%{name}/nm-version-macros.h
|
|
||||||
%{_libdir}/pkgconfig/libnm-glib.pc
|
|
||||||
%{_libdir}/pkgconfig/libnm-glib-vpn.pc
|
|
||||||
%{_libdir}/pkgconfig/libnm-util.pc
|
|
||||||
%{_libdir}/pkgconfig/%{name}.pc
|
|
||||||
%{_libdir}/libnm-glib.so
|
|
||||||
%{_libdir}/libnm-glib-vpn.so
|
|
||||||
%{_libdir}/libnm-util.so
|
|
||||||
%{_datadir}/gir-1.0/NetworkManager-1.0.gir
|
|
||||||
%{_datadir}/gir-1.0/NMClient-1.0.gir
|
|
||||||
%dir %{_datadir}/gtk-doc/html/libnm-glib
|
|
||||||
%{_datadir}/gtk-doc/html/libnm-glib/*
|
|
||||||
%dir %{_datadir}/gtk-doc/html/libnm-util
|
|
||||||
%{_datadir}/gtk-doc/html/libnm-util/*
|
|
||||||
%{_datadir}/vala/vapi/libnm-*.deps
|
|
||||||
%{_datadir}/vala/vapi/libnm-*.vapi
|
|
||||||
%endif
|
|
||||||
|
|
||||||
|
|
||||||
%files libnm -f %{name}.lang
|
%files libnm -f %{name}.lang
|
||||||
%{_libdir}/libnm.so.*
|
%{_libdir}/libnm.so.*
|
||||||
%{_libdir}/girepository-1.0/NM-1.0.typelib
|
%{_libdir}/girepository-1.0/NM-1.0.typelib
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,6 @@ run_autotools() {
|
||||||
--enable-tests=yes \
|
--enable-tests=yes \
|
||||||
--with-crypto=$_WITH_CRYPTO \
|
--with-crypto=$_WITH_CRYPTO \
|
||||||
\
|
\
|
||||||
--with-libnm-glib=yes \
|
|
||||||
--with-iwd=yes \
|
--with-iwd=yes \
|
||||||
--with-ofono=yes \
|
--with-ofono=yes \
|
||||||
--enable-teamdctl=$_WITH_LIBTEAM \
|
--enable-teamdctl=$_WITH_LIBTEAM \
|
||||||
|
|
@ -167,7 +166,6 @@ run_meson() {
|
||||||
-D crypto=$_WITH_CRYPTO \
|
-D crypto=$_WITH_CRYPTO \
|
||||||
-D docs=$_WITH_DOCS \
|
-D docs=$_WITH_DOCS \
|
||||||
\
|
\
|
||||||
-D libnm_glib=true \
|
|
||||||
-D iwd=true \
|
-D iwd=true \
|
||||||
-D ofono=true \
|
-D ofono=true \
|
||||||
-D teamdctl=$_WITH_LIBTEAM \
|
-D teamdctl=$_WITH_LIBTEAM \
|
||||||
|
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
|
||||||
AUTOMAKE_OPTIONS = 1.6
|
|
||||||
|
|
||||||
# The name of the module
|
|
||||||
DOC_MODULE=libnm-glib
|
|
||||||
|
|
||||||
# The top-level SGML file.
|
|
||||||
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml
|
|
||||||
|
|
||||||
# The directory containing the source code. Relative to $(srcdir).
|
|
||||||
# gtk-doc will search all .c & .h files beneath here for inline comments
|
|
||||||
# documenting functions and macros.
|
|
||||||
DOC_SOURCE_DIR=$(top_srcdir)/libnm-glib
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-scan.
|
|
||||||
SCAN_OPTIONS=
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-mkdb.
|
|
||||||
MKDB_OPTIONS=--sgml-mode --output-format=xml
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-fixref.
|
|
||||||
FIXXREF_OPTIONS=
|
|
||||||
|
|
||||||
# Used for dependencies.
|
|
||||||
HFILE_GLOB=$(top_srcdir)/libnm-glib/*.h
|
|
||||||
CFILE_GLOB=$(top_srcdir)/libnm-glib/*.c
|
|
||||||
|
|
||||||
# Header files to ignore when scanning.
|
|
||||||
IGNORE_HFILES= \
|
|
||||||
common.h \
|
|
||||||
nm-dbus-helpers-private.h \
|
|
||||||
nm-device-private.h \
|
|
||||||
nm-object-cache.h \
|
|
||||||
nm-object-private.h \
|
|
||||||
nm-remote-connection-private.h \
|
|
||||||
nm-types-private.h \
|
|
||||||
nm-secret-agent-glue.h \
|
|
||||||
nm-vpn-plugin-glue.h
|
|
||||||
|
|
||||||
# Images to copy into HTML directory.
|
|
||||||
HTML_IMAGES = libnm-glib.png
|
|
||||||
|
|
||||||
# Extra XML files that are included by $(DOC_MAIN_SGML_FILE).
|
|
||||||
content_files = version.xml
|
|
||||||
|
|
||||||
# Other files to distribute.
|
|
||||||
extra_files = libnm-glib.png
|
|
||||||
|
|
||||||
|
|
||||||
# CFLAGS and LDFLAGS for compiling scan program. Only needed
|
|
||||||
# if $(DOC_MODULE).types is non-empty.
|
|
||||||
GTKDOC_CFLAGS = \
|
|
||||||
-I$(top_srcdir)/shared \
|
|
||||||
-I$(top_builddir)/shared \
|
|
||||||
-I$(top_srcdir)/libnm-util \
|
|
||||||
-I$(top_builddir)/libnm-util \
|
|
||||||
-I$(top_srcdir)/libnm-glib \
|
|
||||||
-I$(top_builddir)/libnm-glib \
|
|
||||||
-DNM_VERSION_MIN_REQUIRED=NM_VERSION_0_9_8 \
|
|
||||||
$(GLIB_CFLAGS) \
|
|
||||||
$(DBUS_CFLAGS)
|
|
||||||
|
|
||||||
GTKDOC_LIBS = \
|
|
||||||
$(top_builddir)/libnm-glib/libnm-glib.la \
|
|
||||||
$(GLIB_LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
# include common portion ...
|
|
||||||
include $(top_srcdir)/gtk-doc.make
|
|
||||||
|
|
||||||
EXTRA_DIST += version.xml.in meson.build
|
|
||||||
|
|
||||||
CLEANFILES += \
|
|
||||||
libnm-glib-sections.txt \
|
|
||||||
libnm-glib-overrides.txt \
|
|
||||||
html/* \
|
|
||||||
tmpl/* \
|
|
||||||
xml/*
|
|
||||||
|
|
||||||
|
|
@ -1,117 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
|
|
||||||
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
|
|
||||||
<!ENTITY version SYSTEM "version.xml">
|
|
||||||
]>
|
|
||||||
|
|
||||||
<book id="index" xmlns:xi="http://www.w3.org/2003/XInclude">
|
|
||||||
<bookinfo>
|
|
||||||
<title>libnm-glib Reference Manual</title>
|
|
||||||
<releaseinfo>
|
|
||||||
for libnm-glib &version;
|
|
||||||
The latest version of this documentation can be found on-line at
|
|
||||||
<ulink url="https://developer.gnome.org/libnm-glib/stable/">https://developer.gnome.org/libnm-glib/stable/</ulink>.
|
|
||||||
</releaseinfo>
|
|
||||||
|
|
||||||
<copyright>
|
|
||||||
<year>2012</year>
|
|
||||||
<year>2013</year>
|
|
||||||
<year>2014</year>
|
|
||||||
<year>2015</year>
|
|
||||||
<year>2016</year>
|
|
||||||
<year>2017</year>
|
|
||||||
<year>2018</year>
|
|
||||||
<holder>The NetworkManager Authors</holder>
|
|
||||||
</copyright>
|
|
||||||
|
|
||||||
<legalnotice>
|
|
||||||
<para>
|
|
||||||
Permission is granted to copy, distribute and/or modify this
|
|
||||||
document under the terms of the <citetitle>GNU Free
|
|
||||||
Documentation License</citetitle>, Version 1.1 or any later
|
|
||||||
version published by the Free Software Foundation with no
|
|
||||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
|
||||||
Texts. You may obtain a copy of the <citetitle>GNU Free
|
|
||||||
Documentation License</citetitle> from the Free Software
|
|
||||||
Foundation by visiting <ulink type="http"
|
|
||||||
url="http://www.fsf.org">their Web site</ulink> or by writing
|
|
||||||
to:
|
|
||||||
|
|
||||||
<address>
|
|
||||||
The Free Software Foundation, Inc.,
|
|
||||||
<street>51 Franklin Street</street> - Fifth Floor,
|
|
||||||
<city>Boston</city>, <state>MA</state> <postcode>02110-1301</postcode>,
|
|
||||||
<country>USA</country>
|
|
||||||
</address>
|
|
||||||
</para>
|
|
||||||
</legalnotice>
|
|
||||||
</bookinfo>
|
|
||||||
|
|
||||||
<chapter id="ref-overview">
|
|
||||||
<title>Object Overview</title>
|
|
||||||
<para>
|
|
||||||
libnm-glib maps closely to the actual D-Bus API that NetworkManager
|
|
||||||
provides, simply wrapping the remote D-Bus objects as native GObjects,
|
|
||||||
mapping D-Bus signals and properties to GObject signals and properties,
|
|
||||||
and providing helpful accessor and utility functions. As such, objects
|
|
||||||
in the libnm-glib API have the same properties, behavior, signals, and
|
|
||||||
semantics as the NM D-Bus API.
|
|
||||||
</para>
|
|
||||||
<para>
|
|
||||||
The following is a rough overview of the libnm-glib object structure and
|
|
||||||
how to use the various parts of it:
|
|
||||||
<mediaobject id="libnm-glib-overview">
|
|
||||||
<imageobject>
|
|
||||||
<imagedata fileref="libnm-glib.png" format="PNG"/>
|
|
||||||
</imageobject>
|
|
||||||
</mediaobject>
|
|
||||||
</para>
|
|
||||||
</chapter>
|
|
||||||
|
|
||||||
<chapter>
|
|
||||||
<title>libnm-glib API Reference</title>
|
|
||||||
<xi:include href="xml/nm-client.xml"/>
|
|
||||||
<xi:include href="xml/nm-active-connection.xml"/>
|
|
||||||
<xi:include href="xml/nm-device.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-ethernet.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-wifi.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-modem.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-bt.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-wimax.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-adsl.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-bond.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-bridge.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-team.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-generic.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-infiniband.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-vlan.xml"/>
|
|
||||||
<xi:include href="xml/nm-device-olpc-mesh.xml"/>
|
|
||||||
<xi:include href="xml/nm-wimax-nsp.xml"/>
|
|
||||||
<xi:include href="xml/nm-access-point.xml"/>
|
|
||||||
<xi:include href="xml/nm-ip4-config.xml"/>
|
|
||||||
<xi:include href="xml/nm-ip6-config.xml"/>
|
|
||||||
<xi:include href="xml/nm-dhcp4-config.xml"/>
|
|
||||||
<xi:include href="xml/nm-dhcp6-config.xml"/>
|
|
||||||
<xi:include href="xml/nm-object.xml"/>
|
|
||||||
<xi:include href="xml/nm-remote-connection.xml"/>
|
|
||||||
<xi:include href="xml/nm-remote-settings.xml"/>
|
|
||||||
<xi:include href="xml/nm-types.xml"/>
|
|
||||||
<xi:include href="xml/nm-secret-agent.xml"/>
|
|
||||||
<xi:include href="xml/nm-vpn-connection.xml"/>
|
|
||||||
<xi:include href="xml/nm-vpn-plugin.xml"/>
|
|
||||||
<xi:include href="xml/nm-vpn-plugin-ui-interface.xml"/>
|
|
||||||
<xi:include href="xml/nm-vpn-plugin-utils.xml"/>
|
|
||||||
</chapter>
|
|
||||||
|
|
||||||
<chapter id="object-tree">
|
|
||||||
<title>Object Hierarchy</title>
|
|
||||||
<xi:include href="xml/tree_index.sgml"/>
|
|
||||||
</chapter>
|
|
||||||
<index id="api-index-full">
|
|
||||||
<title>API Index</title>
|
|
||||||
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
|
||||||
</index>
|
|
||||||
|
|
||||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
|
||||||
</book>
|
|
||||||
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 80 KiB |
|
|
@ -1,893 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
|
||||||
|
|
||||||
<svg
|
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
||||||
xmlns:cc="http://creativecommons.org/ns#"
|
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
|
||||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
|
||||||
width="1052.3622"
|
|
||||||
height="744.09448"
|
|
||||||
id="svg2"
|
|
||||||
version="1.1"
|
|
||||||
inkscape:version="0.48.1 r9760"
|
|
||||||
sodipodi:docname="libnm-glib.svg">
|
|
||||||
<defs
|
|
||||||
id="defs4">
|
|
||||||
<marker
|
|
||||||
inkscape:stockid="Arrow1Lend"
|
|
||||||
orient="auto"
|
|
||||||
refY="0"
|
|
||||||
refX="0"
|
|
||||||
id="Arrow1Lend"
|
|
||||||
style="overflow:visible">
|
|
||||||
<path
|
|
||||||
id="path4069"
|
|
||||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
|
||||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
|
|
||||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
|
||||||
inkscape:connector-curvature="0" />
|
|
||||||
</marker>
|
|
||||||
<marker
|
|
||||||
inkscape:stockid="Arrow1Lend"
|
|
||||||
orient="auto"
|
|
||||||
refY="0"
|
|
||||||
refX="0"
|
|
||||||
id="Arrow1Lend-2"
|
|
||||||
style="overflow:visible">
|
|
||||||
<path
|
|
||||||
id="path4069-0"
|
|
||||||
d="M 0,0 5,-5 -12.5,0 5,5 0,0 z"
|
|
||||||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;marker-start:none"
|
|
||||||
transform="matrix(-0.8,0,0,-0.8,-10,0)"
|
|
||||||
inkscape:connector-curvature="0" />
|
|
||||||
</marker>
|
|
||||||
</defs>
|
|
||||||
<sodipodi:namedview
|
|
||||||
id="base"
|
|
||||||
pagecolor="#ffffff"
|
|
||||||
bordercolor="#666666"
|
|
||||||
borderopacity="1.0"
|
|
||||||
inkscape:pageopacity="0.0"
|
|
||||||
inkscape:pageshadow="2"
|
|
||||||
inkscape:zoom="0.98994949"
|
|
||||||
inkscape:cx="433.76249"
|
|
||||||
inkscape:cy="491.18568"
|
|
||||||
inkscape:document-units="px"
|
|
||||||
inkscape:current-layer="layer1"
|
|
||||||
showgrid="false"
|
|
||||||
inkscape:window-width="1280"
|
|
||||||
inkscape:window-height="739"
|
|
||||||
inkscape:window-x="0"
|
|
||||||
inkscape:window-y="26"
|
|
||||||
inkscape:window-maximized="1" />
|
|
||||||
<metadata
|
|
||||||
id="metadata7">
|
|
||||||
<rdf:RDF>
|
|
||||||
<cc:Work
|
|
||||||
rdf:about="">
|
|
||||||
<dc:format>image/svg+xml</dc:format>
|
|
||||||
<dc:type
|
|
||||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
|
||||||
<dc:title></dc:title>
|
|
||||||
</cc:Work>
|
|
||||||
</rdf:RDF>
|
|
||||||
</metadata>
|
|
||||||
<g
|
|
||||||
inkscape:label="Layer 1"
|
|
||||||
inkscape:groupmode="layer"
|
|
||||||
id="layer1"
|
|
||||||
transform="translate(0,-308.2677)">
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="283.85287"
|
|
||||||
y="97.768028"
|
|
||||||
id="text3783"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3787"
|
|
||||||
x="283.85287"
|
|
||||||
y="97.768028"></tspan></text>
|
|
||||||
<flowRoot
|
|
||||||
xml:space="preserve"
|
|
||||||
id="flowRoot3789"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"><flowRegion
|
|
||||||
id="flowRegion3791"><rect
|
|
||||||
id="rect3793"
|
|
||||||
width="139.40105"
|
|
||||||
height="113.13708"
|
|
||||||
x="265.6701"
|
|
||||||
y="97.768028" /></flowRegion><flowPara
|
|
||||||
id="flowPara3795"></flowPara></flowRoot> <flowRoot
|
|
||||||
xml:space="preserve"
|
|
||||||
id="flowRoot3797"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"><flowRegion
|
|
||||||
id="flowRegion3799"><rect
|
|
||||||
id="rect3801"
|
|
||||||
width="208.09143"
|
|
||||||
height="133.34013"
|
|
||||||
x="273.75134"
|
|
||||||
y="121.00153"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans" /></flowRegion><flowPara
|
|
||||||
id="flowPara3803"></flowPara></flowRoot> <flowRoot
|
|
||||||
xml:space="preserve"
|
|
||||||
id="flowRoot3825"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"><flowRegion
|
|
||||||
id="flowRegion3827"><rect
|
|
||||||
id="rect3829"
|
|
||||||
width="175.76654"
|
|
||||||
height="41.416256"
|
|
||||||
x="28.284271"
|
|
||||||
y="88.676651" /></flowRegion><flowPara
|
|
||||||
id="flowPara3831">Propr</flowPara></flowRoot> <g
|
|
||||||
id="g5635"
|
|
||||||
transform="translate(-64.649763,3.0507627)">
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
id="text3755-0"
|
|
||||||
y="341.21481"
|
|
||||||
x="573.86121"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
|
||||||
y="341.21481"
|
|
||||||
x="573.86121"
|
|
||||||
id="tspan3757-1"
|
|
||||||
sodipodi:role="line">NMClient</tspan></text>
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
id="text3833-6"
|
|
||||||
y="357.37726"
|
|
||||||
x="529.33325"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
id="tspan3837-8"
|
|
||||||
y="357.37726"
|
|
||||||
x="529.33325"
|
|
||||||
sodipodi:role="line">Base object; provides access to</tspan><tspan
|
|
||||||
id="tspan4548"
|
|
||||||
y="369.87726"
|
|
||||||
x="529.33325"
|
|
||||||
sodipodi:role="line">network device objects, active</tspan><tspan
|
|
||||||
id="tspan4550"
|
|
||||||
y="382.37726"
|
|
||||||
x="529.33325"
|
|
||||||
sodipodi:role="line">network connection objects and</tspan><tspan
|
|
||||||
id="tspan4552"
|
|
||||||
y="394.87726"
|
|
||||||
x="529.33325"
|
|
||||||
sodipodi:role="line">general network state information</tspan></text>
|
|
||||||
</g>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="104.07935"
|
|
||||||
y="372.52951"
|
|
||||||
id="text3833-6-7"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="104.07935"
|
|
||||||
y="372.52951"
|
|
||||||
id="tspan4552-6" /></text>
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:2.85214233;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985"
|
|
||||||
width="209.21587"
|
|
||||||
height="312.09604"
|
|
||||||
x="12.270507"
|
|
||||||
y="319.61136" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
|
||||||
x="40.322777"
|
|
||||||
y="344.24524"
|
|
||||||
id="text3755"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757"
|
|
||||||
x="40.322777"
|
|
||||||
y="344.24524"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold">NMRemoteSettings</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="19.192902"
|
|
||||||
y="360.40768"
|
|
||||||
id="text3833"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.192902"
|
|
||||||
y="360.40768"
|
|
||||||
id="tspan3839">Retrieves, adds, and notifes of changes</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.192902"
|
|
||||||
y="372.90768"
|
|
||||||
id="tspan3837">to network configuration objects</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.192902"
|
|
||||||
y="385.40768"
|
|
||||||
id="tspan4682">(called NMRemoteConnections) </tspan></text>
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:1.13669348;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8"
|
|
||||||
width="176.20061"
|
|
||||||
height="82.832512"
|
|
||||||
x="29.077385"
|
|
||||||
y="403.84424" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
x="38.158276"
|
|
||||||
y="424.04724"
|
|
||||||
id="text3755-3"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8"
|
|
||||||
x="38.158276"
|
|
||||||
y="424.04724"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMRemoteConnection</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="36.03054"
|
|
||||||
y="443.60046"
|
|
||||||
id="text3833-0"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="36.03054"
|
|
||||||
y="443.60046"
|
|
||||||
id="tspan3837-7">The basic unit of network</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="36.03054"
|
|
||||||
y="456.10046"
|
|
||||||
id="tspan3873">configuration information,</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="36.03054"
|
|
||||||
y="468.60046"
|
|
||||||
id="tspan3875">contains all settings required to</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="36.03054"
|
|
||||||
y="481.10046"
|
|
||||||
id="tspan3877">connect to a specific network.</tspan></text>
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.68221813;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-4"
|
|
||||||
width="176.20061"
|
|
||||||
height="29.837376"
|
|
||||||
x="28.067242"
|
|
||||||
y="494.75793" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
x="37.148129"
|
|
||||||
y="514.96094"
|
|
||||||
id="text3755-3-9"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-0"
|
|
||||||
x="37.148129"
|
|
||||||
y="514.96094"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMRemoteConnection</tspan></text>
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.68221813;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-4-6"
|
|
||||||
width="176.20061"
|
|
||||||
height="29.837376"
|
|
||||||
x="28.06724"
|
|
||||||
y="532.36725" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
x="37.148129"
|
|
||||||
y="552.57025"
|
|
||||||
id="text3755-3-9-3"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-0-8"
|
|
||||||
x="37.148129"
|
|
||||||
y="552.57025"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMRemoteConnection</tspan></text>
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.68221813;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-4-8"
|
|
||||||
width="176.20061"
|
|
||||||
height="29.837376"
|
|
||||||
x="28.067238"
|
|
||||||
y="569.74286" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
x="37.148125"
|
|
||||||
y="589.94586"
|
|
||||||
id="text3755-3-9-6"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-0-6"
|
|
||||||
x="37.148125"
|
|
||||||
y="589.94586"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMRemoteConnection</tspan></text>
|
|
||||||
<g
|
|
||||||
id="g5581">
|
|
||||||
<path
|
|
||||||
transform="translate(24,308.27784)"
|
|
||||||
d="m 75.76144,306.19336 a 3.5355339,3.5355339 0 1 1 -7.071068,0 3.5355339,3.5355339 0 1 1 7.071068,0 z"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
id="path4776"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
sodipodi:type="arc" />
|
|
||||||
<path
|
|
||||||
d="m 75.76144,306.19336 a 3.5355339,3.5355339 0 1 1 -7.071068,0 3.5355339,3.5355339 0 1 1 7.071068,0 z"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
id="path4776-1"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
sodipodi:type="arc"
|
|
||||||
transform="translate(44.950515,308.27784)" />
|
|
||||||
<path
|
|
||||||
d="m 75.76144,306.19336 a 3.5355339,3.5355339 0 1 1 -7.071068,0 3.5355339,3.5355339 0 1 1 7.071068,0 z"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
id="path4776-1-4"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
sodipodi:type="arc"
|
|
||||||
transform="translate(65.901025,308.27784)" />
|
|
||||||
</g>
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#c30000;stroke-width:2.71445656;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-5"
|
|
||||||
width="641.21594"
|
|
||||||
height="454.62848"
|
|
||||||
x="286.68472"
|
|
||||||
y="321.29346" />
|
|
||||||
<g
|
|
||||||
id="g5644"
|
|
||||||
transform="translate(348.50263,-5.0507629)">
|
|
||||||
<rect
|
|
||||||
y="466.47369"
|
|
||||||
x="346.26532"
|
|
||||||
height="68.182198"
|
|
||||||
width="176.20061"
|
|
||||||
id="rect2985-8-9"
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:1.03128445;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982" />
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
id="text3755-3-5"
|
|
||||||
y="486.6767"
|
|
||||||
x="400.8031"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
y="486.6767"
|
|
||||||
x="400.8031"
|
|
||||||
id="tspan3757-8-00"
|
|
||||||
sodipodi:role="line">NMDevice</tspan></text>
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
id="text3833-0-5"
|
|
||||||
y="501.17917"
|
|
||||||
x="353.21848"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
id="tspan3877-3"
|
|
||||||
y="501.17917"
|
|
||||||
x="353.21848"
|
|
||||||
sodipodi:role="line">Represents a known network</tspan><tspan
|
|
||||||
id="tspan5003"
|
|
||||||
y="513.6792"
|
|
||||||
x="353.21848"
|
|
||||||
sodipodi:role="line">interface that may be used to</tspan><tspan
|
|
||||||
id="tspan5005"
|
|
||||||
y="526.1792"
|
|
||||||
x="353.21848"
|
|
||||||
sodipodi:role="line">connect to a network</tspan></text>
|
|
||||||
</g>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="706.53918"
|
|
||||||
y="144.96414"
|
|
||||||
id="text5191"
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="matrix(0.91955281,0.39296645,-0.39296645,0.91955281,0,0)"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan5193"
|
|
||||||
x="706.53918"
|
|
||||||
y="144.96414">nm_client_get_devices()</tspan></text>
|
|
||||||
<g
|
|
||||||
id="g5623"
|
|
||||||
transform="translate(-419.9159,137.94419)">
|
|
||||||
<rect
|
|
||||||
y="447.99072"
|
|
||||||
x="721.03192"
|
|
||||||
height="96.526291"
|
|
||||||
width="176.20061"
|
|
||||||
id="rect2985-8-9-7"
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:1.22705996;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982" />
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
id="text3755-3-5-9"
|
|
||||||
y="465.92065"
|
|
||||||
x="740.21436"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
y="465.92065"
|
|
||||||
x="740.21436"
|
|
||||||
id="tspan3757-8-00-9"
|
|
||||||
sodipodi:role="line">NMActiveConnection</tspan></text>
|
|
||||||
<text
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
id="text3833-0-5-2"
|
|
||||||
y="478.42313"
|
|
||||||
x="723.98505"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
xml:space="preserve"><tspan
|
|
||||||
id="tspan5005-7"
|
|
||||||
y="478.42313"
|
|
||||||
x="723.98505"
|
|
||||||
sodipodi:role="line">Represents an active connection</tspan><tspan
|
|
||||||
id="tspan5236"
|
|
||||||
y="490.92313"
|
|
||||||
x="723.98505"
|
|
||||||
sodipodi:role="line">to a specific network, using</tspan><tspan
|
|
||||||
id="tspan5238"
|
|
||||||
y="503.42313"
|
|
||||||
x="723.98505"
|
|
||||||
sodipodi:role="line">settings from an</tspan><tspan
|
|
||||||
id="tspan5240"
|
|
||||||
y="515.9231"
|
|
||||||
x="723.98505"
|
|
||||||
sodipodi:role="line">NMRemoteConnection,and</tspan><tspan
|
|
||||||
id="tspan5449"
|
|
||||||
y="528.4231"
|
|
||||||
x="723.98505"
|
|
||||||
sodipodi:role="line">provided by on or more NMDevice</tspan><tspan
|
|
||||||
id="tspan5451"
|
|
||||||
y="540.9231"
|
|
||||||
x="723.98505"
|
|
||||||
sodipodi:role="line">objects.</tspan></text>
|
|
||||||
</g>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="270.79764"
|
|
||||||
y="722.53766"
|
|
||||||
id="text5191-5"
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="matrix(0.94281033,-0.33332969,0.33332969,0.94281033,0,0)"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan5193-8"
|
|
||||||
x="270.79764"
|
|
||||||
y="722.53766">nm_active_connection_get_devices()</tspan></text>
|
|
||||||
<g
|
|
||||||
id="g6720"
|
|
||||||
transform="translate(-23.213166,-3.4365595)">
|
|
||||||
<g
|
|
||||||
transform="translate(320.19803,-24.89035)"
|
|
||||||
id="g5561">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.54146165;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-3-4"
|
|
||||||
width="126.1828"
|
|
||||||
height="26.245613"
|
|
||||||
x="397.53818"
|
|
||||||
y="597.80267" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="419.1745"
|
|
||||||
y="615.39911"
|
|
||||||
id="text3755-3-5-1-8"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-00-3-7"
|
|
||||||
x="419.1745"
|
|
||||||
y="615.39911"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMDeviceWifi</tspan></text>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
transform="translate(175.74622,-53.780741)"
|
|
||||||
id="g5566">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.54146165;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-3-5"
|
|
||||||
width="126.1828"
|
|
||||||
height="26.245613"
|
|
||||||
x="541.98999"
|
|
||||||
y="659.422" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="552.62244"
|
|
||||||
y="677.01843"
|
|
||||||
id="text3755-3-5-1-9"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="552.62244"
|
|
||||||
y="677.01843"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
id="tspan5526">NMDeviceModem</tspan></text>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
transform="translate(390.90872,-24.082284)"
|
|
||||||
id="g5571">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.54146165;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-3-2"
|
|
||||||
width="126.1828"
|
|
||||||
height="26.245613"
|
|
||||||
x="326.82748"
|
|
||||||
y="662.45251" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="330"
|
|
||||||
y="680.04895"
|
|
||||||
id="text3755-3-5-1-7"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-00-3-1"
|
|
||||||
x="330"
|
|
||||||
y="680.04895"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMDeviceInfiniband</tspan></text>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
transform="translate(278.7818,-37.820326)"
|
|
||||||
id="g5576">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.54146165;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-3-7"
|
|
||||||
width="126.1828"
|
|
||||||
height="26.245613"
|
|
||||||
x="438.95441"
|
|
||||||
y="708.91949" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="442.65225"
|
|
||||||
y="726.51593"
|
|
||||||
id="text3755-3-5-1-0"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="442.65225"
|
|
||||||
y="726.51593"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
id="tspan5552">NMDeviceBluetooth</tspan></text>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
id="g5581-7"
|
|
||||||
transform="translate(663.65119,96.47973)">
|
|
||||||
<path
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="path4776-10"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
d="m 75.76144,306.19336 c 0,1.95262 -1.582912,3.53553 -3.535534,3.53553 -1.952621,0 -3.535534,-1.58291 -3.535534,-3.53553 0,-1.95262 1.582913,-3.53553 3.535534,-3.53553 1.952622,0 3.535534,1.58291 3.535534,3.53553 z"
|
|
||||||
transform="translate(24,308.27784)" />
|
|
||||||
<path
|
|
||||||
transform="translate(44.950515,308.27784)"
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="path4776-1-0"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
d="m 75.76144,306.19336 c 0,1.95262 -1.582912,3.53553 -3.535534,3.53553 -1.952621,0 -3.535534,-1.58291 -3.535534,-3.53553 0,-1.95262 1.582913,-3.53553 3.535534,-3.53553 1.952622,0 3.535534,1.58291 3.535534,3.53553 z" />
|
|
||||||
<path
|
|
||||||
transform="translate(65.901025,308.27784)"
|
|
||||||
sodipodi:type="arc"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="path4776-1-4-7"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
d="m 75.76144,306.19336 c 0,1.95262 -1.582912,3.53553 -3.535534,3.53553 -1.952621,0 -3.535534,-1.58291 -3.535534,-3.53553 0,-1.95262 1.582913,-3.53553 3.535534,-3.53553 1.952622,0 3.535534,1.58291 3.535534,3.53553 z" />
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
transform="translate(371.71582,-10.142135)"
|
|
||||||
id="g5556">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.54146165;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-3"
|
|
||||||
width="126.1828"
|
|
||||||
height="26.245613"
|
|
||||||
x="346.02039"
|
|
||||||
y="550.3255" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="352.6069"
|
|
||||||
y="567.92194"
|
|
||||||
id="text3755-3-5-1"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-00-3"
|
|
||||||
x="352.6069"
|
|
||||||
y="567.92194"
|
|
||||||
style="font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMDeviceEthernet</tspan></text>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<path
|
|
||||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
|
||||||
d="M 553.56359,93.556243 699.43095,153.15523"
|
|
||||||
id="path6047"
|
|
||||||
inkscape:connector-type="polyline"
|
|
||||||
inkscape:connector-curvature="3"
|
|
||||||
inkscape:connection-end="#g5644"
|
|
||||||
inkscape:connection-end-point="d4"
|
|
||||||
transform="translate(0,308.2677)" />
|
|
||||||
<path
|
|
||||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
|
||||||
d="M 477.31663,294.89252 694.76795,218.28417"
|
|
||||||
id="path6231"
|
|
||||||
inkscape:connector-type="polyline"
|
|
||||||
inkscape:connector-curvature="3"
|
|
||||||
inkscape:connection-start="#g5623"
|
|
||||||
inkscape:connection-start-point="d4"
|
|
||||||
inkscape:connection-end="#g5644"
|
|
||||||
inkscape:connection-end-point="d4"
|
|
||||||
transform="translate(0,308.2677)" />
|
|
||||||
<path
|
|
||||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend)"
|
|
||||||
d="M 537.40115,93.556243 419.9937,277.66721"
|
|
||||||
id="path6415"
|
|
||||||
inkscape:connector-type="polyline"
|
|
||||||
inkscape:connector-curvature="3"
|
|
||||||
inkscape:connection-end="#g5623"
|
|
||||||
inkscape:connection-end-point="d4"
|
|
||||||
transform="translate(0,308.2677)" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="-235.89041"
|
|
||||||
y="662.71521"
|
|
||||||
id="text5191-5-1"
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="matrix(0.53998594,-0.84167404,0.84167404,0.53998594,0,0)"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan5193-8-5"
|
|
||||||
x="-235.89041"
|
|
||||||
y="662.71521">nm_client_get_active_connections()</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="824.3454"
|
|
||||||
y="617.99652"
|
|
||||||
id="text6932"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan6934"
|
|
||||||
x="824.3454"
|
|
||||||
y="617.99652">(Device subclasses)</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="685.34247"
|
|
||||||
y="161.22107"
|
|
||||||
id="text5191-9"
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="matrix(0.91955281,0.39296645,-0.39296645,0.91955281,0,0)"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan5193-1"
|
|
||||||
x="685.34247"
|
|
||||||
y="161.22107">Gets all known interfaces</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="251.42001"
|
|
||||||
y="738.39777"
|
|
||||||
id="text5191-5-5"
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="matrix(0.94354535,-0.33124338,0.33124338,0.94354535,0,0)"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan5193-8-1"
|
|
||||||
x="251.42001"
|
|
||||||
y="738.39777">Gets interfaces used by this active connection</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:9px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="-227.90929"
|
|
||||||
y="680.09265"
|
|
||||||
id="text5191-5-1-7"
|
|
||||||
sodipodi:linespacing="125%"
|
|
||||||
transform="matrix(0.54025777,-0.84149958,0.84149958,0.54025777,0,0)"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan5193-8-5-2"
|
|
||||||
x="-227.90929"
|
|
||||||
y="680.09265">Gets all active network connections</tspan></text>
|
|
||||||
<path
|
|
||||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Lend-2)"
|
|
||||||
d="M 314.15744,683.6768 C 282.94516,704.65454 170.8596,719.38945 163.64471,598.82399"
|
|
||||||
id="path7053"
|
|
||||||
inkscape:connector-curvature="0"
|
|
||||||
sodipodi:nodetypes="cc" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="19.152279"
|
|
||||||
y="706.91034"
|
|
||||||
id="text7239"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan7241"
|
|
||||||
x="19.152279"
|
|
||||||
y="706.91034">Retrieve the NMRemoteConnection that provides</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.152279"
|
|
||||||
y="719.41034"
|
|
||||||
id="tspan7243">configuration settings for the NMActiveConnection</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.152279"
|
|
||||||
y="731.91034"
|
|
||||||
id="tspan7245">by getting its object path with</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.152279"
|
|
||||||
y="744.41034"
|
|
||||||
id="tspan7247">nm_active_connection_get_connection() and then</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.152279"
|
|
||||||
y="756.91034"
|
|
||||||
id="tspan7249">passing the returned path to</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="19.152279"
|
|
||||||
y="769.41034"
|
|
||||||
id="tspan7251">nm_remote_settings_get_connection_by_path()</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
|
||||||
x="10.101524"
|
|
||||||
y="653.3316"
|
|
||||||
id="text7253"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan7255"
|
|
||||||
x="10.101524"
|
|
||||||
y="653.3316">Network</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="10.101524"
|
|
||||||
y="675.8316"
|
|
||||||
id="tspan7278">Configuration</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:18px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold"
|
|
||||||
x="284.19009"
|
|
||||||
y="798.65869"
|
|
||||||
id="text7253-4"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan7255-8"
|
|
||||||
x="284.19009"
|
|
||||||
y="798.65869">Network Control</tspan></text>
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:10px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans"
|
|
||||||
x="701.04297"
|
|
||||||
y="363.09201"
|
|
||||||
id="text7239-7"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="701.04297"
|
|
||||||
y="363.09201"
|
|
||||||
id="tspan7251-6">Connect to a network by calling</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="701.04297"
|
|
||||||
y="375.59201"
|
|
||||||
id="tspan7336">nm_client_activate_connection() and</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="701.04297"
|
|
||||||
y="388.09201"
|
|
||||||
id="tspan7338">passing the NMDevice to use, along with</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="701.04297"
|
|
||||||
y="400.59201"
|
|
||||||
id="tspan7342">the NMRemoteConnection that contains</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="701.04297"
|
|
||||||
y="413.09201"
|
|
||||||
id="tspan7346">the settings that describe how to connect</tspan><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
x="701.04297"
|
|
||||||
y="425.59201"
|
|
||||||
id="tspan7350">to that network</tspan></text>
|
|
||||||
<g
|
|
||||||
id="g5623-9"
|
|
||||||
transform="translate(-369.71587,253.62599)">
|
|
||||||
<g
|
|
||||||
id="g7418"
|
|
||||||
transform="translate(-28.915799,-13.111678)">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.57918203;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-7-5"
|
|
||||||
width="155.24031"
|
|
||||||
height="24.408838"
|
|
||||||
x="721.03192"
|
|
||||||
y="447.99072" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
x="725.99634"
|
|
||||||
y="465.41437"
|
|
||||||
id="text3755-3-5-9-3"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-00-9-0"
|
|
||||||
x="725.99634"
|
|
||||||
y="465.41437"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMActiveConnection</tspan></text>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
transform="translate(-28.915799,18.947049)"
|
|
||||||
id="g7418-5">
|
|
||||||
<rect
|
|
||||||
style="fill:none;stroke:#01003d;stroke-width:0.57918203;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
id="rect2985-8-9-7-5-7"
|
|
||||||
width="155.24031"
|
|
||||||
height="24.408838"
|
|
||||||
x="721.03192"
|
|
||||||
y="447.99072" />
|
|
||||||
<text
|
|
||||||
xml:space="preserve"
|
|
||||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
|
|
||||||
x="725.99634"
|
|
||||||
y="465.41437"
|
|
||||||
id="text3755-3-5-9-3-7"
|
|
||||||
sodipodi:linespacing="125%"><tspan
|
|
||||||
sodipodi:role="line"
|
|
||||||
id="tspan3757-8-00-9-0-0"
|
|
||||||
x="725.99634"
|
|
||||||
y="465.41437"
|
|
||||||
style="font-size:14px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans">NMActiveConnection</tspan></text>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
<g
|
|
||||||
transform="translate(282.84399,143.9366)"
|
|
||||||
id="g5581-6">
|
|
||||||
<path
|
|
||||||
transform="translate(24,308.27784)"
|
|
||||||
d="m 75.76144,306.19336 c 0,1.95262 -1.582912,3.53553 -3.535534,3.53553 -1.952621,0 -3.535534,-1.58291 -3.535534,-3.53553 0,-1.95262 1.582913,-3.53553 3.535534,-3.53553 1.952622,0 3.535534,1.58291 3.535534,3.53553 z"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
id="path4776-6"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
sodipodi:type="arc" />
|
|
||||||
<path
|
|
||||||
d="m 75.76144,306.19336 c 0,1.95262 -1.582912,3.53553 -3.535534,3.53553 -1.952621,0 -3.535534,-1.58291 -3.535534,-3.53553 0,-1.95262 1.582913,-3.53553 3.535534,-3.53553 1.952622,0 3.535534,1.58291 3.535534,3.53553 z"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
id="path4776-1-2"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
sodipodi:type="arc"
|
|
||||||
transform="translate(44.950515,308.27784)" />
|
|
||||||
<path
|
|
||||||
d="m 75.76144,306.19336 c 0,1.95262 -1.582912,3.53553 -3.535534,3.53553 -1.952621,0 -3.535534,-1.58291 -3.535534,-3.53553 0,-1.95262 1.582913,-3.53553 3.535534,-3.53553 1.952622,0 3.535534,1.58291 3.535534,3.53553 z"
|
|
||||||
sodipodi:ry="3.5355339"
|
|
||||||
sodipodi:rx="3.5355339"
|
|
||||||
sodipodi:cy="306.19336"
|
|
||||||
sodipodi:cx="72.225906"
|
|
||||||
id="path4776-1-4-6"
|
|
||||||
style="fill:#000000;fill-opacity:1;stroke:#01003d;stroke-width:0;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:10.49999982"
|
|
||||||
sodipodi:type="arc"
|
|
||||||
transform="translate(65.901025,308.27784)" />
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 46 KiB |
|
|
@ -1,55 +0,0 @@
|
||||||
#include "nm-client.h"
|
|
||||||
#include "nm-object.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-device-ethernet.h"
|
|
||||||
#include "nm-device-wifi.h"
|
|
||||||
#include "nm-device-modem.h"
|
|
||||||
#include "nm-device-bt.h"
|
|
||||||
#include "nm-device-wimax.h"
|
|
||||||
#include "nm-device-olpc-mesh.h"
|
|
||||||
#include "nm-device-adsl.h"
|
|
||||||
#include "nm-device-infiniband.h"
|
|
||||||
#include "nm-device-bond.h"
|
|
||||||
#include "nm-device-bridge.h"
|
|
||||||
#include "nm-device-team.h"
|
|
||||||
#include "nm-device-generic.h"
|
|
||||||
#include "nm-device-vlan.h"
|
|
||||||
#include "nm-access-point.h"
|
|
||||||
#include "nm-ip4-config.h"
|
|
||||||
#include "nm-ip6-config.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
#include "nm-dhcp4-config.h"
|
|
||||||
#include "nm-dhcp6-config.h"
|
|
||||||
#include "nm-remote-settings.h"
|
|
||||||
#include "nm-remote-connection.h"
|
|
||||||
#include "nm-secret-agent.h"
|
|
||||||
#include "nm-vpn-connection.h"
|
|
||||||
|
|
||||||
nm_client_get_type
|
|
||||||
nm_object_get_type
|
|
||||||
nm_device_get_type
|
|
||||||
nm_device_ethernet_get_type
|
|
||||||
nm_device_wifi_get_type
|
|
||||||
nm_device_modem_get_type
|
|
||||||
nm_device_bt_get_type
|
|
||||||
nm_device_wimax_get_type
|
|
||||||
nm_device_olpc_mesh_get_type
|
|
||||||
nm_device_adsl_get_type
|
|
||||||
nm_device_infiniband_get_type
|
|
||||||
nm_device_bond_get_type
|
|
||||||
nm_device_bridge_get_type
|
|
||||||
nm_device_team_get_type
|
|
||||||
nm_device_generic_get_type
|
|
||||||
nm_device_vlan_get_type
|
|
||||||
nm_wimax_nsp_get_type
|
|
||||||
nm_access_point_get_type
|
|
||||||
nm_ip4_config_get_type
|
|
||||||
nm_ip6_config_get_type
|
|
||||||
nm_active_connection_get_type
|
|
||||||
nm_dhcp4_config_get_type
|
|
||||||
nm_dhcp6_config_get_type
|
|
||||||
nm_remote_settings_get_type
|
|
||||||
nm_remote_connection_get_type
|
|
||||||
nm_secret_agent_get_type
|
|
||||||
nm_vpn_connection_get_type
|
|
||||||
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
doc_module = libnm_glib_name
|
|
||||||
|
|
||||||
private_headers = [
|
|
||||||
'common.h',
|
|
||||||
'nm-dbus-helpers-private.h',
|
|
||||||
'nm-device-private.h',
|
|
||||||
'nm-object-cache.h',
|
|
||||||
'nm-object-private.h',
|
|
||||||
'nm-remote-connection-private.h',
|
|
||||||
'nm-types-private.h',
|
|
||||||
'nm-secret-agent-glue.h',
|
|
||||||
'nm-vpn-plugin-glue.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
input: version_xml + '.in',
|
|
||||||
output: version_xml,
|
|
||||||
configuration: version_conf,
|
|
||||||
)
|
|
||||||
|
|
||||||
gnome.gtkdoc(
|
|
||||||
doc_module,
|
|
||||||
main_xml: doc_module + '-docs.xml',
|
|
||||||
src_dir: join_paths(meson.source_root(), 'libnm-glib'),
|
|
||||||
dependencies: [
|
|
||||||
libnm_glib_dep,
|
|
||||||
libnm_glib_vpn_dep,
|
|
||||||
],
|
|
||||||
scan_args: [
|
|
||||||
'--rebuild-types',
|
|
||||||
'--rebuild-sections',
|
|
||||||
'--ignore-headers=' + ' '.join(private_headers),
|
|
||||||
],
|
|
||||||
scanobjs_args: '--type-init-func="g_type_init();"',
|
|
||||||
fixxref_args: '--html-dir=' + join_paths(nm_prefix, gnome.gtkdoc_html_dir(doc_module)),
|
|
||||||
gobject_typesfile: doc_module + '.types',
|
|
||||||
html_assets: doc_module + '.png',
|
|
||||||
install: true,
|
|
||||||
)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
@VERSION@
|
|
||||||
|
|
@ -1,74 +0,0 @@
|
||||||
## Process this file with automake to produce Makefile.in
|
|
||||||
AUTOMAKE_OPTIONS = 1.6
|
|
||||||
|
|
||||||
# The name of the module
|
|
||||||
DOC_MODULE=libnm-util
|
|
||||||
|
|
||||||
# The top-level SGML file.
|
|
||||||
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
|
|
||||||
|
|
||||||
# The directory containing the source code. Relative to $(srcdir).
|
|
||||||
# gtk-doc will search all .c & .h files beneath here for inline comments
|
|
||||||
# documenting functions and macros.
|
|
||||||
DOC_SOURCE_DIR= \
|
|
||||||
$(top_builddir)/libnm-util \
|
|
||||||
$(top_srcdir)/libnm-util
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-scan.
|
|
||||||
SCAN_OPTIONS=--rebuild-types --rebuild-sections
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-mkdb.
|
|
||||||
MKDB_OPTIONS=--sgml-mode --output-format=xml
|
|
||||||
|
|
||||||
# Extra options to supply to gtkdoc-fixref.
|
|
||||||
FIXXREF_OPTIONS=
|
|
||||||
|
|
||||||
# Used for dependencies.
|
|
||||||
HFILE_GLOB=$(top_srcdir)/libnm-util/*.h
|
|
||||||
CFILE_GLOB=$(top_srcdir)/libnm-util/*.c
|
|
||||||
|
|
||||||
# Header files to ignore when scanning.
|
|
||||||
IGNORE_HFILES= \
|
|
||||||
crypto.h \
|
|
||||||
nm-utils-private.h \
|
|
||||||
nm-setting-private.h \
|
|
||||||
nm-param-spec-specialized.h \
|
|
||||||
nm-test-utils.h \
|
|
||||||
nm-version.h
|
|
||||||
|
|
||||||
# Images to copy into HTML directory.
|
|
||||||
HTML_IMAGES =
|
|
||||||
|
|
||||||
# Extra XML files that are included by $(DOC_MAIN_SGML_FILE).
|
|
||||||
content_files = version.xml
|
|
||||||
|
|
||||||
# Other files to distribute.
|
|
||||||
extra_files =
|
|
||||||
|
|
||||||
|
|
||||||
# CFLAGS and LDFLAGS for compiling scan program. Only needed
|
|
||||||
# if $(DOC_MODULE).types is non-empty.
|
|
||||||
GTKDOC_CFLAGS = \
|
|
||||||
-I$(top_srcdir)/libnm-util \
|
|
||||||
-DNM_VERSION_MIN_REQUIRED=NM_VERSION_0_9_8 \
|
|
||||||
$(GLIB_CFLAGS) \
|
|
||||||
$(DBUS_CFLAGS)
|
|
||||||
|
|
||||||
GTKDOC_LIBS = \
|
|
||||||
$(top_builddir)/libnm-util/libnm-util.la \
|
|
||||||
$(GLIB_LIBS)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# include common portion ...
|
|
||||||
include $(top_srcdir)/gtk-doc.make
|
|
||||||
|
|
||||||
EXTRA_DIST += version.xml.in meson.build
|
|
||||||
|
|
||||||
CLEANFILES += \
|
|
||||||
libnm-util-sections.txt \
|
|
||||||
libnm-util-overrides.txt \
|
|
||||||
html/* \
|
|
||||||
tmpl/* \
|
|
||||||
xml/*
|
|
||||||
|
|
||||||
|
|
@ -1,96 +0,0 @@
|
||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
|
||||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
|
||||||
[
|
|
||||||
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
|
||||||
<!ENTITY version SYSTEM "version.xml">
|
|
||||||
]>
|
|
||||||
<book id="index">
|
|
||||||
<bookinfo>
|
|
||||||
<title>libnm-util Reference Manual</title>
|
|
||||||
<releaseinfo>
|
|
||||||
for libnm-util &version;
|
|
||||||
The latest version of this documentation can be found on-line at
|
|
||||||
<ulink url="https://developer.gnome.org/libnm-util/stable/">https://developer.gnome.org/libnm-util/stable/</ulink>.
|
|
||||||
</releaseinfo>
|
|
||||||
|
|
||||||
<copyright>
|
|
||||||
<year>2012</year>
|
|
||||||
<year>2013</year>
|
|
||||||
<year>2014</year>
|
|
||||||
<year>2015</year>
|
|
||||||
<year>2016</year>
|
|
||||||
<year>2017</year>
|
|
||||||
<year>2018</year>
|
|
||||||
<holder>The NetworkManager Authors</holder>
|
|
||||||
</copyright>
|
|
||||||
|
|
||||||
<legalnotice>
|
|
||||||
<para>
|
|
||||||
Permission is granted to copy, distribute and/or modify this
|
|
||||||
document under the terms of the <citetitle>GNU Free
|
|
||||||
Documentation License</citetitle>, Version 1.1 or any later
|
|
||||||
version published by the Free Software Foundation with no
|
|
||||||
Invariant Sections, no Front-Cover Texts, and no Back-Cover
|
|
||||||
Texts. You may obtain a copy of the <citetitle>GNU Free
|
|
||||||
Documentation License</citetitle> from the Free Software
|
|
||||||
Foundation by visiting <ulink type="http"
|
|
||||||
url="http://www.fsf.org">their Web site</ulink> or by writing
|
|
||||||
to:
|
|
||||||
|
|
||||||
<address>
|
|
||||||
The Free Software Foundation, Inc.,
|
|
||||||
<street>51 Franklin Street</street> - Fifth Floor,
|
|
||||||
<city>Boston</city>, <state>MA</state> <postcode>02110-1301</postcode>,
|
|
||||||
<country>USA</country>
|
|
||||||
</address>
|
|
||||||
</para>
|
|
||||||
</legalnotice>
|
|
||||||
</bookinfo>
|
|
||||||
|
|
||||||
<chapter>
|
|
||||||
<title>libnm-util API Reference</title>
|
|
||||||
<xi:include href="xml/nm-connection.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-connection.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-wired.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-wireless.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-wireless-security.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-bluetooth.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-serial.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-cdma.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-gsm.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-wimax.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-bond.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-bridge.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-bridge-port.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-team.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-team-port.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-generic.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-infiniband.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-vlan.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-olpc-mesh.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-adsl.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-dcb.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-8021x.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-ip4-config.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-ip6-config.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-ppp.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-pppoe.xml"/>
|
|
||||||
<xi:include href="xml/nm-setting-vpn.xml"/>
|
|
||||||
<xi:include href="xml/nm-utils.xml"/>
|
|
||||||
<xi:include href="xml/NetworkManager.xml"/>
|
|
||||||
<xi:include href="xml/NetworkManagerVPN.xml"/>
|
|
||||||
|
|
||||||
</chapter>
|
|
||||||
<chapter id="object-tree">
|
|
||||||
<title>Object Hierarchy</title>
|
|
||||||
<xi:include href="xml/tree_index.sgml"/>
|
|
||||||
</chapter>
|
|
||||||
<index id="api-index-full">
|
|
||||||
<title>API Index</title>
|
|
||||||
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
|
||||||
</index>
|
|
||||||
|
|
||||||
<xi:include href="xml/annotation-glossary.xml"><xi:fallback /></xi:include>
|
|
||||||
</book>
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
doc_module = libnm_util_name
|
|
||||||
|
|
||||||
private_headers = [
|
|
||||||
'crypto.h',
|
|
||||||
'nm-utils-private.h',
|
|
||||||
'nm-setting-private.h',
|
|
||||||
'nm-param-spec-specialized.h',
|
|
||||||
'nm-test-utils.h',
|
|
||||||
'nm-version.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
configure_file(
|
|
||||||
input: version_xml + '.in',
|
|
||||||
output: version_xml,
|
|
||||||
configuration: version_conf,
|
|
||||||
)
|
|
||||||
|
|
||||||
gnome.gtkdoc(
|
|
||||||
doc_module,
|
|
||||||
main_xml: doc_module + '-docs.sgml',
|
|
||||||
src_dir: libnm_util_inc,
|
|
||||||
dependencies: libnm_util_dep,
|
|
||||||
scan_args: [
|
|
||||||
'--rebuild-types',
|
|
||||||
'--rebuild-sections',
|
|
||||||
'--ignore-headers=' + ' '.join(private_headers),
|
|
||||||
],
|
|
||||||
scanobjs_args: '--type-init-func="g_type_init();"',
|
|
||||||
fixxref_args: '--html-dir=' + join_paths(nm_prefix, gnome.gtkdoc_html_dir(doc_module)),
|
|
||||||
gobject_typesfile: doc_module + '.types',
|
|
||||||
install: true,
|
|
||||||
)
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
@VERSION@
|
|
||||||
|
|
@ -6,11 +6,6 @@ version_xml = 'version.xml'
|
||||||
subdir('libnm')
|
subdir('libnm')
|
||||||
subdir('api')
|
subdir('api')
|
||||||
|
|
||||||
if enable_libnm_glib
|
|
||||||
subdir('libnm-util')
|
|
||||||
subdir('libnm-glib')
|
|
||||||
endif
|
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'check-docs',
|
'check-docs',
|
||||||
find_program(join_paths(meson.source_root(), 'tools', 'check-docs.sh')),
|
find_program(join_paths(meson.source_root(), 'tools', 'check-docs.sh')),
|
||||||
|
|
|
||||||
|
|
@ -2612,21 +2612,6 @@ static void
|
||||||
nm_setting_class_init (NMSettingClass *setting_class)
|
nm_setting_class_init (NMSettingClass *setting_class)
|
||||||
{
|
{
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
|
||||||
GModule *self_module;
|
|
||||||
gpointer func;
|
|
||||||
|
|
||||||
/* loading libnm and legacy libraries libnm-util/libnm-glib at the same
|
|
||||||
* time is not supported. The reason is, that both libraries use the same
|
|
||||||
* glib type names ("NMSetting"), and glib does not support namespacing
|
|
||||||
* to allow for that.
|
|
||||||
*
|
|
||||||
* Arbitrarily, add a check here, see whether a known symbol from libnm-util
|
|
||||||
* is present. If it is, it indicates that the process is borked and we
|
|
||||||
* abort. */
|
|
||||||
self_module = g_module_open (NULL, 0);
|
|
||||||
if (g_module_symbol (self_module, "nm_util_get_private", &func))
|
|
||||||
g_error ("libnm-util symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported");
|
|
||||||
g_module_close (self_module);
|
|
||||||
|
|
||||||
g_type_class_add_private (setting_class, sizeof (NMSettingPrivate));
|
g_type_class_add_private (setting_class, sizeof (NMSettingPrivate));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,426 +0,0 @@
|
||||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* libnm_glib -- Access network status & information from glib applications
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along
|
|
||||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2007 - 2008 Novell, Inc.
|
|
||||||
* Copyright (C) 2007 - 2008 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <signal.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <sys/socket.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <arpa/inet.h>
|
|
||||||
|
|
||||||
#include "nm-client.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-device-ethernet.h"
|
|
||||||
#include "nm-device-wifi.h"
|
|
||||||
#include "nm-device-generic.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
#include "nm-vpn-connection.h"
|
|
||||||
#include "nm-setting-ip4-config.h"
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
test_wireless_enabled (NMClient *client)
|
|
||||||
{
|
|
||||||
gboolean wireless;
|
|
||||||
|
|
||||||
wireless = nm_client_wireless_get_enabled (client);
|
|
||||||
g_print ("Wireless enabled? %s\n", wireless ? "yes" : "no");
|
|
||||||
|
|
||||||
// nm_client_wireless_set_enabled (client, !wireless);
|
|
||||||
|
|
||||||
wireless = nm_client_wireless_hardware_get_enabled (client);
|
|
||||||
g_print ("Wireless HW enabled? %s\n", wireless ? "yes" : "no");
|
|
||||||
|
|
||||||
// nm_client_wireless_set_enabled (client, !wireless);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
test_get_state (NMClient *client)
|
|
||||||
{
|
|
||||||
guint state;
|
|
||||||
|
|
||||||
state = nm_client_get_state (client);
|
|
||||||
g_print ("Current state: %d\n", state);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
ip4_address_as_string (guint32 ip)
|
|
||||||
{
|
|
||||||
char buf[INET_ADDRSTRLEN+1];
|
|
||||||
guint32 tmp_addr;
|
|
||||||
|
|
||||||
memset (&buf, '\0', sizeof (buf));
|
|
||||||
tmp_addr = ip;
|
|
||||||
|
|
||||||
if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) {
|
|
||||||
return g_strdup (buf);
|
|
||||||
} else {
|
|
||||||
g_warning ("%s: error converting IP4 address 0x%X",
|
|
||||||
__func__, ntohl (tmp_addr));
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_ip4_config (NMIP4Config *cfg)
|
|
||||||
{
|
|
||||||
char *tmp;
|
|
||||||
const GArray *array;
|
|
||||||
const GPtrArray *ptr_array;
|
|
||||||
GSList *iter;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (iter = (GSList *) nm_ip4_config_get_addresses (cfg); iter; iter = g_slist_next (iter)) {
|
|
||||||
NMIP4Address *addr = iter->data;
|
|
||||||
guint32 u;
|
|
||||||
|
|
||||||
tmp = ip4_address_as_string (nm_ip4_address_get_address (addr));
|
|
||||||
g_print ("IP4 address: %s\n", tmp);
|
|
||||||
g_free (tmp);
|
|
||||||
|
|
||||||
u = nm_ip4_address_get_prefix (addr);
|
|
||||||
tmp = ip4_address_as_string (nm_utils_ip4_prefix_to_netmask (u));
|
|
||||||
g_print ("IP4 prefix: %d (%s)\n", u, tmp);
|
|
||||||
g_free (tmp);
|
|
||||||
|
|
||||||
tmp = ip4_address_as_string (nm_ip4_address_get_gateway (addr));
|
|
||||||
g_print ("IP4 gateway: %s\n\n", tmp);
|
|
||||||
g_free (tmp);
|
|
||||||
}
|
|
||||||
|
|
||||||
array = nm_ip4_config_get_nameservers (cfg);
|
|
||||||
if (array) {
|
|
||||||
g_print ("IP4 DNS:\n");
|
|
||||||
for (i = 0; i < array->len; i++) {
|
|
||||||
tmp = ip4_address_as_string (g_array_index (array, guint32, i));
|
|
||||||
g_print ("\t%s\n", tmp);
|
|
||||||
g_free (tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ptr_array = nm_ip4_config_get_domains (cfg);
|
|
||||||
if (ptr_array) {
|
|
||||||
g_print ("IP4 domains:\n");
|
|
||||||
for (i = 0; i < ptr_array->len; i++)
|
|
||||||
g_print ("\t%s\n", (const char *) g_ptr_array_index (ptr_array, i));
|
|
||||||
}
|
|
||||||
|
|
||||||
array = nm_ip4_config_get_wins_servers (cfg);
|
|
||||||
if (array) {
|
|
||||||
g_print ("IP4 WINS:\n");
|
|
||||||
for (i = 0; i < array->len; i++) {
|
|
||||||
tmp = ip4_address_as_string (g_array_index (array, guint32, i));
|
|
||||||
g_print ("\t%s\n", tmp);
|
|
||||||
g_free (tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
print_one_dhcp4_option (gpointer key, gpointer data, gpointer user_data)
|
|
||||||
{
|
|
||||||
const char *option = (const char *) key;
|
|
||||||
const char *value = (const char *) data;
|
|
||||||
|
|
||||||
g_print (" %s: %s\n", option, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_dhcp4_config (NMDHCP4Config *config)
|
|
||||||
{
|
|
||||||
GHashTable *options = NULL;
|
|
||||||
|
|
||||||
if (!config)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_print ("\nDHCP4 Options:\n");
|
|
||||||
g_print ("-------------------------------------\n");
|
|
||||||
|
|
||||||
g_object_get (G_OBJECT (config), NM_DHCP4_CONFIG_OPTIONS, &options, NULL);
|
|
||||||
g_hash_table_foreach (options, print_one_dhcp4_option, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_access_point (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
const GByteArray * ssid;
|
|
||||||
const char * str;
|
|
||||||
|
|
||||||
ssid = nm_access_point_get_ssid (ap);
|
|
||||||
g_print ("\tSsid: %s\n",
|
|
||||||
ssid ? nm_utils_escape_ssid (ssid->data, ssid->len) : "(none)");
|
|
||||||
|
|
||||||
str = nm_access_point_get_bssid (ap);
|
|
||||||
g_print ("\tMAC Address: %s\n", str);
|
|
||||||
|
|
||||||
g_print ("\tFlags: 0x%X\n", nm_access_point_get_flags (ap));
|
|
||||||
g_print ("\tWPA Flags: 0x%X\n", nm_access_point_get_wpa_flags (ap));
|
|
||||||
g_print ("\tRSN Flags: 0x%X\n", nm_access_point_get_rsn_flags (ap));
|
|
||||||
g_print ("\tFrequency: %u\n", nm_access_point_get_frequency (ap));
|
|
||||||
|
|
||||||
g_print ("\tMode: %d\n", nm_access_point_get_mode (ap));
|
|
||||||
g_print ("\tRate: %d\n", nm_access_point_get_max_bitrate (ap));
|
|
||||||
g_print ("\tStrength: %d\n", nm_access_point_get_strength (ap));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_wireless (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
const char *str;
|
|
||||||
const GPtrArray *aps;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_print ("Mode: %d\n", nm_device_wifi_get_mode (device));
|
|
||||||
g_print ("Bitrate: %d\n", nm_device_wifi_get_bitrate (device));
|
|
||||||
|
|
||||||
str = nm_device_wifi_get_hw_address (device);
|
|
||||||
g_print ("MAC: %s\n", str);
|
|
||||||
|
|
||||||
g_print ("AccessPoints:\n");
|
|
||||||
aps = nm_device_wifi_get_access_points (device);
|
|
||||||
for (i = 0; aps && (i < aps->len); i++) {
|
|
||||||
dump_access_point (NM_ACCESS_POINT (g_ptr_array_index (aps, i)));
|
|
||||||
g_print ("\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_generic (NMDeviceGeneric *device)
|
|
||||||
{
|
|
||||||
g_print ("HW address: %s\n", nm_device_generic_get_hw_address (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_wired (NMDeviceEthernet *device)
|
|
||||||
{
|
|
||||||
const char *str;
|
|
||||||
|
|
||||||
g_print ("Speed: %d\n", nm_device_ethernet_get_speed (device));
|
|
||||||
|
|
||||||
str = nm_device_ethernet_get_hw_address (device);
|
|
||||||
g_print ("MAC: %s\n", str);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dump_device (NMDevice *device)
|
|
||||||
{
|
|
||||||
const char *str;
|
|
||||||
NMDeviceState state;
|
|
||||||
|
|
||||||
str = nm_device_get_iface (device);
|
|
||||||
g_print ("Interface: %s\n", str);
|
|
||||||
|
|
||||||
str = nm_device_get_udi (device);
|
|
||||||
g_print ("Udi: %s\n", str);
|
|
||||||
|
|
||||||
str = nm_device_get_driver (device);
|
|
||||||
g_print ("Driver: %s\n", str);
|
|
||||||
|
|
||||||
str = nm_device_get_vendor (device);
|
|
||||||
g_print ("Vendor: %s\n", str);
|
|
||||||
|
|
||||||
str = nm_device_get_product (device);
|
|
||||||
g_print ("Product: %s\n", str);
|
|
||||||
|
|
||||||
state = nm_device_get_state (device);
|
|
||||||
g_print ("State: %d\n", state);
|
|
||||||
|
|
||||||
if (state == NM_DEVICE_STATE_ACTIVATED)
|
|
||||||
dump_ip4_config (nm_device_get_ip4_config (device));
|
|
||||||
|
|
||||||
if (NM_IS_DEVICE_ETHERNET (device))
|
|
||||||
dump_wired (NM_DEVICE_ETHERNET (device));
|
|
||||||
else if (NM_IS_DEVICE_WIFI (device))
|
|
||||||
dump_wireless (NM_DEVICE_WIFI (device));
|
|
||||||
else if (NM_IS_DEVICE_GENERIC (device))
|
|
||||||
dump_generic (NM_DEVICE_GENERIC (device));
|
|
||||||
|
|
||||||
dump_dhcp4_config (nm_device_get_dhcp4_config (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
test_devices (NMClient *client)
|
|
||||||
{
|
|
||||||
const GPtrArray *devices;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
devices = nm_client_get_devices (client);
|
|
||||||
g_print ("Got devices:\n");
|
|
||||||
if (!devices) {
|
|
||||||
g_print (" NONE\n");
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < devices->len; i++) {
|
|
||||||
NMDevice *device = g_ptr_array_index (devices, i);
|
|
||||||
dump_device (device);
|
|
||||||
g_print ("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
active_connections_changed (NMClient *client, GParamSpec *pspec, gpointer user_data)
|
|
||||||
{
|
|
||||||
const GPtrArray *connections;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
g_print ("Active connections changed:\n");
|
|
||||||
connections = nm_client_get_active_connections (client);
|
|
||||||
for (i = 0; connections && (i < connections->len); i++) {
|
|
||||||
NMActiveConnection *connection;
|
|
||||||
const GPtrArray *devices;
|
|
||||||
|
|
||||||
connection = g_ptr_array_index (connections, i);
|
|
||||||
g_print (" %s\n", nm_object_get_path (NM_OBJECT (connection)));
|
|
||||||
devices = nm_active_connection_get_devices (connection);
|
|
||||||
for (j = 0; devices && j < devices->len; j++)
|
|
||||||
g_print (" %s\n", nm_device_get_udi (g_ptr_array_index (devices, j)));
|
|
||||||
if (NM_IS_VPN_CONNECTION (connection))
|
|
||||||
g_print (" VPN base connection: %s\n", nm_active_connection_get_specific_object (connection));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
show_active_connection_device (gpointer data, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMDevice *device = NM_DEVICE (data);
|
|
||||||
|
|
||||||
g_print (" %s\n", nm_device_get_udi (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
test_get_active_connections (NMClient *client)
|
|
||||||
{
|
|
||||||
const GPtrArray *connections;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
g_print ("Active connections:\n");
|
|
||||||
connections = nm_client_get_active_connections (client);
|
|
||||||
for (i = 0; connections && (i < connections->len); i++) {
|
|
||||||
const GPtrArray *devices;
|
|
||||||
|
|
||||||
g_print (" %s\n", nm_object_get_path (g_ptr_array_index (connections, i)));
|
|
||||||
devices = nm_active_connection_get_devices (g_ptr_array_index (connections, i));
|
|
||||||
if (devices)
|
|
||||||
g_ptr_array_foreach ((GPtrArray *) devices, show_active_connection_device, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
device_state_changed (NMDevice *device, GParamSpec *pspec, gpointer user_data)
|
|
||||||
{
|
|
||||||
g_print ("Device state changed: %s %d\n",
|
|
||||||
nm_device_get_iface (device),
|
|
||||||
nm_device_get_state (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
device_added_cb (NMClient *client, NMDevice *device, gpointer user_data)
|
|
||||||
{
|
|
||||||
g_print ("New device added\n");
|
|
||||||
dump_device (device);
|
|
||||||
g_signal_connect (G_OBJECT (device), "notify::state",
|
|
||||||
(GCallback) device_state_changed, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
device_removed_cb (NMClient *client, NMDevice *device, gpointer user_data)
|
|
||||||
{
|
|
||||||
g_print ("Device removed\n");
|
|
||||||
dump_device (device);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
manager_running (NMClient *client, GParamSpec *pspec, gpointer user_data)
|
|
||||||
{
|
|
||||||
if (nm_client_get_manager_running (client)) {
|
|
||||||
g_print ("NM appeared\n");
|
|
||||||
test_wireless_enabled (client);
|
|
||||||
test_get_state (client);
|
|
||||||
test_get_active_connections (client);
|
|
||||||
test_devices (client);
|
|
||||||
} else
|
|
||||||
g_print ("NM disappeared\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static GMainLoop *loop = NULL;
|
|
||||||
|
|
||||||
static void
|
|
||||||
signal_handler (int signo)
|
|
||||||
{
|
|
||||||
if (signo == SIGINT || signo == SIGTERM) {
|
|
||||||
g_message ("Caught signal %d, shutting down...", signo);
|
|
||||||
g_main_loop_quit (loop);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
setup_signals (void)
|
|
||||||
{
|
|
||||||
struct sigaction action;
|
|
||||||
sigset_t mask;
|
|
||||||
|
|
||||||
sigemptyset (&mask);
|
|
||||||
action.sa_handler = signal_handler;
|
|
||||||
action.sa_mask = mask;
|
|
||||||
action.sa_flags = 0;
|
|
||||||
sigaction (SIGTERM, &action, NULL);
|
|
||||||
sigaction (SIGINT, &action, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main (int argc, char *argv[])
|
|
||||||
{
|
|
||||||
NMClient *client;
|
|
||||||
|
|
||||||
client = nm_client_new ();
|
|
||||||
if (!client) {
|
|
||||||
exit (1);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_signal_connect (client, "notify::" NM_CLIENT_MANAGER_RUNNING,
|
|
||||||
G_CALLBACK (manager_running), NULL);
|
|
||||||
g_signal_connect (client, "notify::" NM_CLIENT_ACTIVE_CONNECTIONS,
|
|
||||||
G_CALLBACK (active_connections_changed), NULL);
|
|
||||||
manager_running (client, NULL, NULL);
|
|
||||||
|
|
||||||
g_signal_connect (client, "device-added",
|
|
||||||
G_CALLBACK (device_added_cb), NULL);
|
|
||||||
g_signal_connect (client, "device-removed",
|
|
||||||
G_CALLBACK (device_removed_cb), NULL);
|
|
||||||
|
|
||||||
loop = g_main_loop_new (NULL, FALSE);
|
|
||||||
setup_signals ();
|
|
||||||
g_main_loop_run (loop);
|
|
||||||
|
|
||||||
g_object_unref (client);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: libnm-glib-vpn
|
|
||||||
Description: Convenience library for NetworkManager VPN plugins
|
|
||||||
Version: @VERSION@
|
|
||||||
Requires: NetworkManager >= @VERSION@ glib-2.0 dbus-glib-1
|
|
||||||
Cflags: -I${includedir}/libnm-glib
|
|
||||||
Libs: -L${libdir} -lnm-glib-vpn
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
{
|
|
||||||
global:
|
|
||||||
nm_vpn_plugin_disconnect;
|
|
||||||
nm_vpn_plugin_error_get_type;
|
|
||||||
nm_vpn_plugin_error_quark;
|
|
||||||
nm_vpn_plugin_failure;
|
|
||||||
nm_vpn_plugin_get_connection;
|
|
||||||
nm_vpn_plugin_get_state;
|
|
||||||
nm_vpn_plugin_get_type;
|
|
||||||
nm_vpn_plugin_secrets_required;
|
|
||||||
nm_vpn_plugin_set_ip4_config;
|
|
||||||
nm_vpn_plugin_set_login_banner;
|
|
||||||
nm_vpn_plugin_set_state;
|
|
||||||
nm_vpn_plugin_ui_interface_delete_connection;
|
|
||||||
nm_vpn_plugin_ui_interface_export;
|
|
||||||
nm_vpn_plugin_ui_interface_get_capabilities;
|
|
||||||
nm_vpn_plugin_ui_interface_get_suggested_name;
|
|
||||||
nm_vpn_plugin_ui_interface_get_type;
|
|
||||||
nm_vpn_plugin_ui_interface_import;
|
|
||||||
nm_vpn_plugin_ui_interface_ui_factory;
|
|
||||||
nm_vpn_plugin_ui_widget_interface_get_type;
|
|
||||||
nm_vpn_plugin_ui_widget_interface_get_widget;
|
|
||||||
nm_vpn_plugin_ui_widget_interface_save_secrets;
|
|
||||||
nm_vpn_plugin_ui_widget_interface_update_connection;
|
|
||||||
nm_vpn_plugin_utils_get_secret_flags;
|
|
||||||
nm_vpn_plugin_utils_read_vpn_details;
|
|
||||||
local:
|
|
||||||
*;
|
|
||||||
};
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: libnm-glib
|
|
||||||
Description: Convenience library for clients of NetworkManager
|
|
||||||
Version: @VERSION@
|
|
||||||
Requires: libnm-util >= @VERSION@ NetworkManager >= @VERSION@ gobject-2.0 dbus-glib-1
|
|
||||||
Cflags: -I${includedir}/libnm-glib
|
|
||||||
Libs: -L${libdir} -lnm-glib
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,309 +0,0 @@
|
||||||
{
|
|
||||||
global:
|
|
||||||
libnm_glib_get_network_state;
|
|
||||||
libnm_glib_init;
|
|
||||||
libnm_glib_register_callback;
|
|
||||||
libnm_glib_shutdown;
|
|
||||||
libnm_glib_unregister_callback;
|
|
||||||
nm_access_point_connection_valid;
|
|
||||||
nm_access_point_filter_connections;
|
|
||||||
nm_access_point_get_bssid;
|
|
||||||
nm_access_point_get_flags;
|
|
||||||
nm_access_point_get_frequency;
|
|
||||||
nm_access_point_get_hw_address;
|
|
||||||
nm_access_point_get_last_seen;
|
|
||||||
nm_access_point_get_max_bitrate;
|
|
||||||
nm_access_point_get_mode;
|
|
||||||
nm_access_point_get_rsn_flags;
|
|
||||||
nm_access_point_get_ssid;
|
|
||||||
nm_access_point_get_strength;
|
|
||||||
nm_access_point_get_type;
|
|
||||||
nm_access_point_get_wpa_flags;
|
|
||||||
nm_access_point_new;
|
|
||||||
nm_active_connection_get_connection;
|
|
||||||
nm_active_connection_get_connection_type;
|
|
||||||
nm_active_connection_get_default6;
|
|
||||||
nm_active_connection_get_default;
|
|
||||||
nm_active_connection_get_devices;
|
|
||||||
nm_active_connection_get_dhcp4_config;
|
|
||||||
nm_active_connection_get_dhcp6_config;
|
|
||||||
nm_active_connection_get_id;
|
|
||||||
nm_active_connection_get_ip4_config;
|
|
||||||
nm_active_connection_get_ip6_config;
|
|
||||||
nm_active_connection_get_master;
|
|
||||||
nm_active_connection_get_specific_object;
|
|
||||||
nm_active_connection_get_state;
|
|
||||||
nm_active_connection_get_type;
|
|
||||||
nm_active_connection_get_uuid;
|
|
||||||
nm_active_connection_get_vpn;
|
|
||||||
nm_active_connection_new;
|
|
||||||
nm_client_activate_connection;
|
|
||||||
nm_client_add_and_activate_connection;
|
|
||||||
nm_client_check_connectivity;
|
|
||||||
nm_client_check_connectivity_async;
|
|
||||||
nm_client_check_connectivity_finish;
|
|
||||||
nm_client_deactivate_connection;
|
|
||||||
nm_client_error_get_type;
|
|
||||||
nm_client_error_quark;
|
|
||||||
nm_client_get_activating_connection;
|
|
||||||
nm_client_get_active_connections;
|
|
||||||
nm_client_get_all_devices;
|
|
||||||
nm_client_get_connectivity;
|
|
||||||
nm_client_get_device_by_iface;
|
|
||||||
nm_client_get_device_by_path;
|
|
||||||
nm_client_get_devices;
|
|
||||||
nm_client_get_logging;
|
|
||||||
nm_client_get_manager_running;
|
|
||||||
nm_client_get_permission_result;
|
|
||||||
nm_client_get_primary_connection;
|
|
||||||
nm_client_get_startup;
|
|
||||||
nm_client_get_state;
|
|
||||||
nm_client_get_type;
|
|
||||||
nm_client_get_version;
|
|
||||||
nm_client_networking_get_enabled;
|
|
||||||
nm_client_networking_set_enabled;
|
|
||||||
nm_client_new;
|
|
||||||
nm_client_new_async;
|
|
||||||
nm_client_new_finish;
|
|
||||||
nm_client_permission_get_type;
|
|
||||||
nm_client_permission_result_get_type;
|
|
||||||
nm_client_set_logging;
|
|
||||||
nm_client_sleep;
|
|
||||||
nm_client_wimax_get_enabled;
|
|
||||||
nm_client_wimax_hardware_get_enabled;
|
|
||||||
nm_client_wimax_set_enabled;
|
|
||||||
nm_client_wireless_get_enabled;
|
|
||||||
nm_client_wireless_hardware_get_enabled;
|
|
||||||
nm_client_wireless_set_enabled;
|
|
||||||
nm_client_wwan_get_enabled;
|
|
||||||
nm_client_wwan_hardware_get_enabled;
|
|
||||||
nm_client_wwan_set_enabled;
|
|
||||||
nm_device_adsl_error_get_type;
|
|
||||||
nm_device_adsl_error_quark;
|
|
||||||
nm_device_adsl_get_carrier;
|
|
||||||
nm_device_adsl_get_type;
|
|
||||||
nm_device_adsl_new;
|
|
||||||
nm_device_bond_error_get_type;
|
|
||||||
nm_device_bond_error_quark;
|
|
||||||
nm_device_bond_get_carrier;
|
|
||||||
nm_device_bond_get_hw_address;
|
|
||||||
nm_device_bond_get_slaves;
|
|
||||||
nm_device_bond_get_type;
|
|
||||||
nm_device_bond_new;
|
|
||||||
nm_device_bridge_error_get_type;
|
|
||||||
nm_device_bridge_error_quark;
|
|
||||||
nm_device_bridge_get_carrier;
|
|
||||||
nm_device_bridge_get_hw_address;
|
|
||||||
nm_device_bridge_get_slaves;
|
|
||||||
nm_device_bridge_get_type;
|
|
||||||
nm_device_bridge_new;
|
|
||||||
nm_device_bt_error_get_type;
|
|
||||||
nm_device_bt_error_quark;
|
|
||||||
nm_device_bt_get_capabilities;
|
|
||||||
nm_device_bt_get_hw_address;
|
|
||||||
nm_device_bt_get_name;
|
|
||||||
nm_device_bt_get_type;
|
|
||||||
nm_device_bt_new;
|
|
||||||
nm_device_connection_compatible;
|
|
||||||
nm_device_connection_valid;
|
|
||||||
nm_device_delete;
|
|
||||||
nm_device_disambiguate_names;
|
|
||||||
nm_device_disconnect;
|
|
||||||
nm_device_error_get_type;
|
|
||||||
nm_device_error_quark;
|
|
||||||
nm_device_ethernet_error_get_type;
|
|
||||||
nm_device_ethernet_error_quark;
|
|
||||||
nm_device_ethernet_get_carrier;
|
|
||||||
nm_device_ethernet_get_hw_address;
|
|
||||||
nm_device_ethernet_get_permanent_hw_address;
|
|
||||||
nm_device_ethernet_get_speed;
|
|
||||||
nm_device_ethernet_get_type;
|
|
||||||
nm_device_ethernet_new;
|
|
||||||
nm_device_filter_connections;
|
|
||||||
nm_device_generic_error_get_type;
|
|
||||||
nm_device_generic_error_quark;
|
|
||||||
nm_device_generic_get_hw_address;
|
|
||||||
nm_device_generic_get_type;
|
|
||||||
nm_device_generic_new;
|
|
||||||
nm_device_get_active_connection;
|
|
||||||
nm_device_get_autoconnect;
|
|
||||||
nm_device_get_available_connections;
|
|
||||||
nm_device_get_capabilities;
|
|
||||||
nm_device_get_description;
|
|
||||||
nm_device_get_device_type;
|
|
||||||
nm_device_get_dhcp4_config;
|
|
||||||
nm_device_get_dhcp6_config;
|
|
||||||
nm_device_get_driver;
|
|
||||||
nm_device_get_driver_version;
|
|
||||||
nm_device_get_firmware_missing;
|
|
||||||
nm_device_get_firmware_version;
|
|
||||||
nm_device_get_hw_address;
|
|
||||||
nm_device_get_iface;
|
|
||||||
nm_device_get_ip4_config;
|
|
||||||
nm_device_get_ip6_config;
|
|
||||||
nm_device_get_ip_iface;
|
|
||||||
nm_device_get_managed;
|
|
||||||
nm_device_get_mtu;
|
|
||||||
nm_device_get_physical_port_id;
|
|
||||||
nm_device_get_product;
|
|
||||||
nm_device_get_setting_type;
|
|
||||||
nm_device_get_state;
|
|
||||||
nm_device_get_state_reason;
|
|
||||||
nm_device_get_type;
|
|
||||||
nm_device_get_type_description;
|
|
||||||
nm_device_get_udi;
|
|
||||||
nm_device_get_vendor;
|
|
||||||
nm_device_infiniband_error_get_type;
|
|
||||||
nm_device_infiniband_error_quark;
|
|
||||||
nm_device_infiniband_get_carrier;
|
|
||||||
nm_device_infiniband_get_hw_address;
|
|
||||||
nm_device_infiniband_get_type;
|
|
||||||
nm_device_infiniband_new;
|
|
||||||
nm_device_is_real;
|
|
||||||
nm_device_is_software;
|
|
||||||
nm_device_modem_error_get_type;
|
|
||||||
nm_device_modem_error_quark;
|
|
||||||
nm_device_modem_get_current_capabilities;
|
|
||||||
nm_device_modem_get_modem_capabilities;
|
|
||||||
nm_device_modem_get_type;
|
|
||||||
nm_device_new;
|
|
||||||
nm_device_olpc_mesh_error_get_type;
|
|
||||||
nm_device_olpc_mesh_error_quark;
|
|
||||||
nm_device_olpc_mesh_get_active_channel;
|
|
||||||
nm_device_olpc_mesh_get_companion;
|
|
||||||
nm_device_olpc_mesh_get_hw_address;
|
|
||||||
nm_device_olpc_mesh_get_type;
|
|
||||||
nm_device_olpc_mesh_new;
|
|
||||||
nm_device_set_autoconnect;
|
|
||||||
nm_device_set_managed;
|
|
||||||
nm_device_team_error_get_type;
|
|
||||||
nm_device_team_error_quark;
|
|
||||||
nm_device_team_get_carrier;
|
|
||||||
nm_device_team_get_hw_address;
|
|
||||||
nm_device_team_get_slaves;
|
|
||||||
nm_device_team_get_type;
|
|
||||||
nm_device_team_new;
|
|
||||||
nm_device_vlan_error_get_type;
|
|
||||||
nm_device_vlan_error_quark;
|
|
||||||
nm_device_vlan_get_carrier;
|
|
||||||
nm_device_vlan_get_hw_address;
|
|
||||||
nm_device_vlan_get_parent;
|
|
||||||
nm_device_vlan_get_type;
|
|
||||||
nm_device_vlan_get_vlan_id;
|
|
||||||
nm_device_vlan_new;
|
|
||||||
nm_device_wifi_error_get_type;
|
|
||||||
nm_device_wifi_error_quark;
|
|
||||||
nm_device_wifi_get_access_point_by_path;
|
|
||||||
nm_device_wifi_get_access_points;
|
|
||||||
nm_device_wifi_get_active_access_point;
|
|
||||||
nm_device_wifi_get_bitrate;
|
|
||||||
nm_device_wifi_get_capabilities;
|
|
||||||
nm_device_wifi_get_hw_address;
|
|
||||||
nm_device_wifi_get_mode;
|
|
||||||
nm_device_wifi_get_permanent_hw_address;
|
|
||||||
nm_device_wifi_get_type;
|
|
||||||
nm_device_wifi_new;
|
|
||||||
nm_device_wifi_request_scan_simple;
|
|
||||||
nm_device_wimax_error_get_type;
|
|
||||||
nm_device_wimax_error_quark;
|
|
||||||
nm_device_wimax_get_active_nsp;
|
|
||||||
nm_device_wimax_get_bsid;
|
|
||||||
nm_device_wimax_get_center_frequency;
|
|
||||||
nm_device_wimax_get_cinr;
|
|
||||||
nm_device_wimax_get_hw_address;
|
|
||||||
nm_device_wimax_get_nsp_by_path;
|
|
||||||
nm_device_wimax_get_nsps;
|
|
||||||
nm_device_wimax_get_rssi;
|
|
||||||
nm_device_wimax_get_tx_power;
|
|
||||||
nm_device_wimax_get_type;
|
|
||||||
nm_device_wimax_new;
|
|
||||||
nm_dhcp4_config_get_one_option;
|
|
||||||
nm_dhcp4_config_get_options;
|
|
||||||
nm_dhcp4_config_get_type;
|
|
||||||
nm_dhcp4_config_new;
|
|
||||||
nm_dhcp6_config_get_one_option;
|
|
||||||
nm_dhcp6_config_get_options;
|
|
||||||
nm_dhcp6_config_get_type;
|
|
||||||
nm_dhcp6_config_new;
|
|
||||||
nm_ip4_config_get_addresses;
|
|
||||||
nm_ip4_config_get_domains;
|
|
||||||
nm_ip4_config_get_gateway;
|
|
||||||
nm_ip4_config_get_nameservers;
|
|
||||||
nm_ip4_config_get_routes;
|
|
||||||
nm_ip4_config_get_searches;
|
|
||||||
nm_ip4_config_get_type;
|
|
||||||
nm_ip4_config_get_wins_servers;
|
|
||||||
nm_ip4_config_new;
|
|
||||||
nm_ip6_address_array_get_type;
|
|
||||||
nm_ip6_address_object_array_get_type;
|
|
||||||
nm_ip6_config_get_addresses;
|
|
||||||
nm_ip6_config_get_domains;
|
|
||||||
nm_ip6_config_get_gateway;
|
|
||||||
nm_ip6_config_get_nameserver;
|
|
||||||
nm_ip6_config_get_nameservers;
|
|
||||||
nm_ip6_config_get_num_nameservers;
|
|
||||||
nm_ip6_config_get_routes;
|
|
||||||
nm_ip6_config_get_searches;
|
|
||||||
nm_ip6_config_get_type;
|
|
||||||
nm_ip6_config_new;
|
|
||||||
nm_ip6_route_object_array_get_type;
|
|
||||||
nm_object_array_get_type;
|
|
||||||
nm_object_error_get_type;
|
|
||||||
nm_object_error_quark;
|
|
||||||
nm_object_get_connection;
|
|
||||||
nm_object_get_path;
|
|
||||||
nm_object_get_type;
|
|
||||||
nm_remote_connection_commit_changes;
|
|
||||||
nm_remote_connection_commit_changes_unsaved;
|
|
||||||
nm_remote_connection_delete;
|
|
||||||
nm_remote_connection_error_get_type;
|
|
||||||
nm_remote_connection_error_quark;
|
|
||||||
nm_remote_connection_get_secrets;
|
|
||||||
nm_remote_connection_get_type;
|
|
||||||
nm_remote_connection_get_unsaved;
|
|
||||||
nm_remote_connection_new;
|
|
||||||
nm_remote_connection_save;
|
|
||||||
nm_remote_settings_add_connection;
|
|
||||||
nm_remote_settings_add_connection_unsaved;
|
|
||||||
nm_remote_settings_error_get_type;
|
|
||||||
nm_remote_settings_error_quark;
|
|
||||||
nm_remote_settings_get_connection_by_id;
|
|
||||||
nm_remote_settings_get_connection_by_path;
|
|
||||||
nm_remote_settings_get_connection_by_uuid;
|
|
||||||
nm_remote_settings_get_type;
|
|
||||||
nm_remote_settings_list_connections;
|
|
||||||
nm_remote_settings_load_connections;
|
|
||||||
nm_remote_settings_new;
|
|
||||||
nm_remote_settings_new_async;
|
|
||||||
nm_remote_settings_new_finish;
|
|
||||||
nm_remote_settings_reload_connections;
|
|
||||||
nm_remote_settings_save_hostname;
|
|
||||||
nm_secret_agent_capabilities_get_type;
|
|
||||||
nm_secret_agent_delete_secrets;
|
|
||||||
nm_secret_agent_error_get_type;
|
|
||||||
nm_secret_agent_error_quark;
|
|
||||||
nm_secret_agent_get_registered;
|
|
||||||
nm_secret_agent_get_secrets;
|
|
||||||
nm_secret_agent_get_secrets_flags_get_type;
|
|
||||||
nm_secret_agent_get_type;
|
|
||||||
nm_secret_agent_register;
|
|
||||||
nm_secret_agent_save_secrets;
|
|
||||||
nm_secret_agent_unregister;
|
|
||||||
nm_ssid_get_type;
|
|
||||||
nm_string_array_get_type;
|
|
||||||
nm_uint_array_get_type;
|
|
||||||
nm_vpn_connection_get_banner;
|
|
||||||
nm_vpn_connection_get_type;
|
|
||||||
nm_vpn_connection_get_vpn_state;
|
|
||||||
nm_vpn_connection_new;
|
|
||||||
nm_wimax_nsp_connection_valid;
|
|
||||||
nm_wimax_nsp_filter_connections;
|
|
||||||
nm_wimax_nsp_get_name;
|
|
||||||
nm_wimax_nsp_get_network_type;
|
|
||||||
nm_wimax_nsp_get_signal_quality;
|
|
||||||
nm_wimax_nsp_get_type;
|
|
||||||
nm_wimax_nsp_network_type_get_type;
|
|
||||||
nm_wimax_nsp_new;
|
|
||||||
local:
|
|
||||||
*;
|
|
||||||
};
|
|
||||||
|
|
@ -1,580 +0,0 @@
|
||||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* libnm_glib -- Access network status & information from glib applications
|
|
||||||
*
|
|
||||||
* 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 (C) 2005 - 2008 Red Hat, Inc.
|
|
||||||
* Copyright (C) 2005 - 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <dbus/dbus.h>
|
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "libnm_glib.h"
|
|
||||||
|
|
||||||
#define DBUS_NO_SERVICE_ERROR "org.freedesktop.DBus.Error.ServiceDoesNotExist"
|
|
||||||
|
|
||||||
struct libnm_glib_ctx
|
|
||||||
{
|
|
||||||
unsigned char check;
|
|
||||||
|
|
||||||
GMainContext * g_main_ctx;
|
|
||||||
GMainLoop * g_main_loop;
|
|
||||||
DBusConnection * dbus_con;
|
|
||||||
guint dbus_watcher;
|
|
||||||
guint dbus_watch_interval;
|
|
||||||
|
|
||||||
gboolean thread_done;
|
|
||||||
gboolean thread_inited;
|
|
||||||
GThread * thread;
|
|
||||||
|
|
||||||
GSList * callbacks;
|
|
||||||
GMutex * callbacks_lock;
|
|
||||||
guint callback_id_last;
|
|
||||||
|
|
||||||
libnm_glib_state nm_state;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct libnm_glib_callback
|
|
||||||
{
|
|
||||||
guint id;
|
|
||||||
GMainContext * gmain_ctx;
|
|
||||||
libnm_glib_ctx * libnm_glib_ctx;
|
|
||||||
libnm_glib_callback_func func;
|
|
||||||
gpointer user_data;
|
|
||||||
} libnm_glib_callback;
|
|
||||||
|
|
||||||
static void _libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx);
|
|
||||||
static DBusConnection * _libnm_glib_dbus_init (gpointer *user_data, GMainContext *context);
|
|
||||||
static void _libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state);
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_nm_state_cb (DBusPendingCall *pcall, void *user_data)
|
|
||||||
{
|
|
||||||
DBusMessage *reply;
|
|
||||||
libnm_glib_ctx *ctx = (libnm_glib_ctx *) user_data;
|
|
||||||
NMState nm_state;
|
|
||||||
|
|
||||||
g_return_if_fail (pcall != NULL);
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
if (!(reply = dbus_pending_call_steal_reply (pcall)))
|
|
||||||
goto out;
|
|
||||||
|
|
||||||
if (dbus_message_get_type (reply) == DBUS_MESSAGE_TYPE_ERROR)
|
|
||||||
{
|
|
||||||
DBusError err;
|
|
||||||
|
|
||||||
dbus_error_init (&err);
|
|
||||||
dbus_set_error_from_message (&err, reply);
|
|
||||||
fprintf (stderr, "%s: dbus returned an error.\n (%s) %s\n", __func__, err.name, err.message);
|
|
||||||
dbus_error_free (&err);
|
|
||||||
dbus_message_unref (reply);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dbus_message_get_args (reply, NULL, DBUS_TYPE_UINT32, &nm_state, DBUS_TYPE_INVALID))
|
|
||||||
_libnm_glib_update_state (ctx, nm_state);
|
|
||||||
|
|
||||||
dbus_message_unref (reply);
|
|
||||||
|
|
||||||
out:
|
|
||||||
dbus_pending_call_unref (pcall);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_get_nm_state (libnm_glib_ctx *ctx)
|
|
||||||
{
|
|
||||||
DBusMessage *message;
|
|
||||||
DBusPendingCall *pcall = NULL;
|
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "state")))
|
|
||||||
{
|
|
||||||
dbus_connection_send_with_reply (ctx->dbus_con, message, &pcall, -1);
|
|
||||||
if (pcall)
|
|
||||||
dbus_pending_call_set_notify (pcall, _libnm_glib_nm_state_cb, ctx, NULL);
|
|
||||||
dbus_message_unref (message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
_libnm_glib_callback_helper (gpointer user_data)
|
|
||||||
{
|
|
||||||
libnm_glib_callback *cb_data = (libnm_glib_callback *)user_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (cb_data != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (cb_data->func != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (cb_data->libnm_glib_ctx != NULL, FALSE);
|
|
||||||
|
|
||||||
(*(cb_data->func)) (cb_data->libnm_glib_ctx, cb_data->user_data);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_schedule_single_callback (libnm_glib_ctx *ctx,
|
|
||||||
libnm_glib_callback *callback)
|
|
||||||
{
|
|
||||||
GSource *source;
|
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
g_return_if_fail (callback != NULL);
|
|
||||||
|
|
||||||
callback->libnm_glib_ctx = ctx;
|
|
||||||
|
|
||||||
source = g_idle_source_new ();
|
|
||||||
g_source_set_callback (source, _libnm_glib_callback_helper, callback, NULL);
|
|
||||||
g_source_attach (source, callback->gmain_ctx);
|
|
||||||
g_source_unref (source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_unschedule_single_callback (libnm_glib_ctx *ctx,
|
|
||||||
libnm_glib_callback *callback)
|
|
||||||
{
|
|
||||||
GSource *source;
|
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
g_return_if_fail (callback != NULL);
|
|
||||||
|
|
||||||
source = g_main_context_find_source_by_user_data (callback->gmain_ctx, callback);
|
|
||||||
if (source)
|
|
||||||
g_source_destroy (source);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_call_callbacks (libnm_glib_ctx *ctx)
|
|
||||||
{
|
|
||||||
GSList *elem;
|
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
g_mutex_lock (ctx->callbacks_lock);
|
|
||||||
for (elem = ctx->callbacks; elem; elem = g_slist_next (elem))
|
|
||||||
{
|
|
||||||
libnm_glib_callback *callback = (libnm_glib_callback *)(elem->data);
|
|
||||||
if (callback)
|
|
||||||
_libnm_glib_schedule_single_callback (ctx, callback);
|
|
||||||
}
|
|
||||||
g_mutex_unlock (ctx->callbacks_lock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_update_state (libnm_glib_ctx *ctx, NMState state)
|
|
||||||
{
|
|
||||||
libnm_glib_state old_state;
|
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
old_state = ctx->nm_state;
|
|
||||||
switch (state) {
|
|
||||||
case NM_STATE_CONNECTED_LOCAL:
|
|
||||||
case NM_STATE_CONNECTED_SITE:
|
|
||||||
case NM_STATE_CONNECTED_GLOBAL:
|
|
||||||
ctx->nm_state = LIBNM_ACTIVE_NETWORK_CONNECTION;
|
|
||||||
break;
|
|
||||||
case NM_STATE_ASLEEP:
|
|
||||||
case NM_STATE_CONNECTING:
|
|
||||||
case NM_STATE_DISCONNECTED:
|
|
||||||
case NM_STATE_DISCONNECTING:
|
|
||||||
ctx->nm_state = LIBNM_NO_NETWORK_CONNECTION;
|
|
||||||
break;
|
|
||||||
case NM_STATE_UNKNOWN:
|
|
||||||
default:
|
|
||||||
ctx->nm_state = LIBNM_NO_NETWORKMANAGER;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (old_state != ctx->nm_state)
|
|
||||||
_libnm_glib_call_callbacks (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static DBusHandlerResult
|
|
||||||
_libnm_glib_dbus_filter (DBusConnection *connection,
|
|
||||||
DBusMessage *message,
|
|
||||||
void *user_data)
|
|
||||||
{
|
|
||||||
libnm_glib_ctx *ctx = (libnm_glib_ctx *)user_data;
|
|
||||||
gboolean handled = TRUE;
|
|
||||||
DBusError error;
|
|
||||||
|
|
||||||
g_return_val_if_fail (ctx != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
||||||
g_return_val_if_fail (connection != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
||||||
g_return_val_if_fail (message != NULL, DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
||||||
|
|
||||||
dbus_error_init (&error);
|
|
||||||
if (dbus_message_is_signal (message, DBUS_INTERFACE_LOCAL, "Disconnected"))
|
|
||||||
{
|
|
||||||
/* Try to reactivate our connection to dbus on the next pass through the event loop */
|
|
||||||
ctx->nm_state = LIBNM_NO_DBUS;
|
|
||||||
dbus_connection_close (ctx->dbus_con);
|
|
||||||
dbus_connection_unref (ctx->dbus_con);
|
|
||||||
ctx->dbus_con = NULL;
|
|
||||||
_libnm_glib_schedule_dbus_watcher (ctx);
|
|
||||||
}
|
|
||||||
else if (dbus_message_is_signal (message, DBUS_INTERFACE_DBUS, "NameOwnerChanged"))
|
|
||||||
{
|
|
||||||
/* New signal for dbus 0.23... */
|
|
||||||
char *service;
|
|
||||||
char *old_owner;
|
|
||||||
char *new_owner;
|
|
||||||
|
|
||||||
if ( dbus_message_get_args (message, &error,
|
|
||||||
DBUS_TYPE_STRING, &service,
|
|
||||||
DBUS_TYPE_STRING, &old_owner,
|
|
||||||
DBUS_TYPE_STRING, &new_owner,
|
|
||||||
DBUS_TYPE_INVALID))
|
|
||||||
{
|
|
||||||
if (strcmp (service, NM_DBUS_SERVICE) == 0)
|
|
||||||
{
|
|
||||||
gboolean old_owner_good = (old_owner && (strlen (old_owner) > 0));
|
|
||||||
gboolean new_owner_good = (new_owner && (strlen (new_owner) > 0));
|
|
||||||
|
|
||||||
if (!old_owner_good && new_owner_good) /* Equivalent to old ServiceCreated signal */
|
|
||||||
_libnm_glib_get_nm_state (ctx);
|
|
||||||
else if (old_owner_good && !new_owner_good) /* Equivalent to old ServiceDeleted signal */
|
|
||||||
ctx->nm_state = LIBNM_NO_NETWORKMANAGER;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if ( dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNowActive")
|
|
||||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceNoLongerActive")
|
|
||||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DeviceActivating")
|
|
||||||
|| dbus_message_is_signal (message, NM_DBUS_INTERFACE, "DevicesChanged"))
|
|
||||||
{
|
|
||||||
_libnm_glib_get_nm_state (ctx);
|
|
||||||
}
|
|
||||||
else if (dbus_message_is_signal (message, NM_DBUS_INTERFACE, "StateChanged"))
|
|
||||||
{
|
|
||||||
NMState state = NM_STATE_UNKNOWN;
|
|
||||||
|
|
||||||
dbus_message_get_args (message, &error, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INVALID);
|
|
||||||
_libnm_glib_update_state (ctx, state);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
handled = FALSE;
|
|
||||||
|
|
||||||
if (dbus_error_is_set (&error))
|
|
||||||
dbus_error_free (&error);
|
|
||||||
|
|
||||||
return (handled ? DBUS_HANDLER_RESULT_HANDLED : DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* libnm_glib_dbus_init
|
|
||||||
*
|
|
||||||
* Initialize a connection to dbus and set up our callbacks.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static DBusConnection *
|
|
||||||
_libnm_glib_dbus_init (gpointer *user_data, GMainContext *context)
|
|
||||||
{
|
|
||||||
DBusConnection *connection = NULL;
|
|
||||||
DBusError error;
|
|
||||||
|
|
||||||
dbus_error_init (&error);
|
|
||||||
connection = dbus_bus_get_private (DBUS_BUS_SYSTEM, &error);
|
|
||||||
if (dbus_error_is_set (&error))
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s: error, %s raised:\n %s\n\n", __func__, error.name, error.message);
|
|
||||||
dbus_error_free (&error);
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
if (!connection)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (!dbus_connection_add_filter (connection, _libnm_glib_dbus_filter, user_data, NULL))
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
dbus_connection_set_exit_on_disconnect (connection, FALSE);
|
|
||||||
dbus_connection_setup_with_g_main (connection, context);
|
|
||||||
|
|
||||||
dbus_error_init (&error);
|
|
||||||
dbus_bus_add_match (connection,
|
|
||||||
"type='signal',"
|
|
||||||
"interface='" DBUS_INTERFACE_DBUS "',"
|
|
||||||
"sender='" DBUS_SERVICE_DBUS "'",
|
|
||||||
&error);
|
|
||||||
if (dbus_error_is_set (&error))
|
|
||||||
dbus_error_free (&error);
|
|
||||||
|
|
||||||
dbus_error_init (&error);
|
|
||||||
dbus_bus_add_match (connection,
|
|
||||||
"type='signal',"
|
|
||||||
"interface='" NM_DBUS_INTERFACE "',"
|
|
||||||
"path='" NM_DBUS_PATH "',"
|
|
||||||
"sender='" NM_DBUS_SERVICE "'",
|
|
||||||
&error);
|
|
||||||
if (dbus_error_is_set (&error))
|
|
||||||
dbus_error_free (&error);
|
|
||||||
|
|
||||||
return (connection);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* libnm_glib_dbus_watcher
|
|
||||||
*
|
|
||||||
* Repeatedly try to re-activate the connection to dbus.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static gboolean
|
|
||||||
_libnm_glib_dbus_watcher (gpointer user_data)
|
|
||||||
{
|
|
||||||
libnm_glib_ctx *ctx = (libnm_glib_ctx *)user_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (ctx != NULL, FALSE);
|
|
||||||
|
|
||||||
ctx->dbus_watcher = 0;
|
|
||||||
|
|
||||||
if (!ctx->dbus_con)
|
|
||||||
ctx->dbus_con = _libnm_glib_dbus_init ((gpointer)ctx, ctx->g_main_ctx);
|
|
||||||
|
|
||||||
if (ctx->dbus_con)
|
|
||||||
{
|
|
||||||
/* Get NM's state right away after we reconnect */
|
|
||||||
_libnm_glib_get_nm_state (ctx);
|
|
||||||
ctx->dbus_watch_interval = 1000;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Wait 3 seconds longer each time we fail to reconnect to dbus,
|
|
||||||
* with a maximum wait of one minute.
|
|
||||||
*/
|
|
||||||
ctx->dbus_watch_interval = MIN(ctx->dbus_watch_interval + 3000, 60000);
|
|
||||||
|
|
||||||
/* Reschule ourselves if we _still_ don't have a connection to dbus */
|
|
||||||
_libnm_glib_schedule_dbus_watcher (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* libnm_glib_schedule_dbus_watcher
|
|
||||||
*
|
|
||||||
* Schedule an idle handler in our main loop to repeatedly
|
|
||||||
* attempt to re-activate the dbus connection until connected.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
_libnm_glib_schedule_dbus_watcher (libnm_glib_ctx *ctx)
|
|
||||||
{
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
if (ctx->dbus_watcher == 0)
|
|
||||||
{
|
|
||||||
GSource *source = g_timeout_source_new (ctx->dbus_watch_interval);
|
|
||||||
g_source_set_callback (source, _libnm_glib_dbus_watcher, (gpointer) ctx, NULL);
|
|
||||||
ctx->dbus_watcher = g_source_attach (source, ctx->g_main_ctx);
|
|
||||||
g_source_unref (source);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* libnm_glib_dbus_worker
|
|
||||||
*
|
|
||||||
* Main thread for libnm
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
static gpointer
|
|
||||||
_libnm_glib_dbus_worker (gpointer user_data)
|
|
||||||
{
|
|
||||||
libnm_glib_ctx *ctx = (libnm_glib_ctx *)user_data;
|
|
||||||
|
|
||||||
g_return_val_if_fail (ctx != NULL, NULL);
|
|
||||||
|
|
||||||
/* If dbus isn't up yet, schedule an idle handler to check for dbus.
|
|
||||||
* We also need a way to reconnect to dbus if the connection ever goes
|
|
||||||
* down. Should probably be done by a timeout polling dbus_connection_is_connected()
|
|
||||||
* or by getting connection status out of libdbus or something.
|
|
||||||
*/
|
|
||||||
if (!(ctx->dbus_con = _libnm_glib_dbus_init ((gpointer) ctx, ctx->g_main_ctx)))
|
|
||||||
_libnm_glib_schedule_dbus_watcher (ctx);
|
|
||||||
else
|
|
||||||
_libnm_glib_get_nm_state (ctx);
|
|
||||||
|
|
||||||
ctx->thread_inited = TRUE;
|
|
||||||
g_main_loop_run (ctx->g_main_loop);
|
|
||||||
ctx->thread_done = TRUE;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_libnm_glib_ctx_free (libnm_glib_ctx *ctx)
|
|
||||||
{
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
if (ctx->check == 0xDD)
|
|
||||||
{
|
|
||||||
fprintf (stderr, "%s: context %p already freed!\n", __func__, ctx);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->g_main_ctx)
|
|
||||||
g_main_context_unref (ctx->g_main_ctx);
|
|
||||||
if (ctx->g_main_loop)
|
|
||||||
g_main_loop_unref (ctx->g_main_loop);
|
|
||||||
|
|
||||||
if (ctx->dbus_con)
|
|
||||||
{
|
|
||||||
dbus_connection_close (ctx->dbus_con);
|
|
||||||
dbus_connection_unref (ctx->dbus_con);
|
|
||||||
ctx->dbus_con = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ctx->callbacks_lock)
|
|
||||||
g_mutex_free (ctx->callbacks_lock);
|
|
||||||
|
|
||||||
g_slist_free_full (ctx->callbacks, g_free);
|
|
||||||
|
|
||||||
if (ctx->thread)
|
|
||||||
g_thread_join (ctx->thread);
|
|
||||||
|
|
||||||
memset (ctx, 0, sizeof (libnm_glib_ctx));
|
|
||||||
memset (&(ctx->check), 0xDD, sizeof (ctx->check));
|
|
||||||
g_free (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
static libnm_glib_ctx *
|
|
||||||
_libnm_glib_ctx_new (void)
|
|
||||||
{
|
|
||||||
libnm_glib_ctx *ctx = g_malloc0 (sizeof (libnm_glib_ctx));
|
|
||||||
|
|
||||||
if (!(ctx->g_main_ctx = g_main_context_new ()))
|
|
||||||
goto error;
|
|
||||||
if (!(ctx->g_main_loop = g_main_loop_new (ctx->g_main_ctx, FALSE)))
|
|
||||||
goto error;
|
|
||||||
if (!(ctx->callbacks_lock = g_mutex_new ()))
|
|
||||||
goto error;
|
|
||||||
ctx->dbus_watch_interval = 1000;
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
|
|
||||||
error:
|
|
||||||
_libnm_glib_ctx_free (ctx);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
libnm_glib_ctx *
|
|
||||||
libnm_glib_init (void)
|
|
||||||
{
|
|
||||||
libnm_glib_ctx *ctx = NULL;
|
|
||||||
|
|
||||||
if (!g_thread_supported ())
|
|
||||||
g_thread_init (NULL);
|
|
||||||
dbus_g_thread_init ();
|
|
||||||
|
|
||||||
if (!(ctx = _libnm_glib_ctx_new ()))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
ctx->thread = g_thread_create (_libnm_glib_dbus_worker, ctx, TRUE, NULL);
|
|
||||||
if (!ctx->thread)
|
|
||||||
goto error;
|
|
||||||
|
|
||||||
/* Wait until initialization of the thread */
|
|
||||||
while (!ctx->thread_inited)
|
|
||||||
g_usleep (G_USEC_PER_SEC / 20);
|
|
||||||
|
|
||||||
return ctx;
|
|
||||||
|
|
||||||
error:
|
|
||||||
_libnm_glib_ctx_free (ctx);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
libnm_glib_shutdown (libnm_glib_ctx *ctx)
|
|
||||||
{
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
|
|
||||||
g_main_loop_quit (ctx->g_main_loop);
|
|
||||||
while (!ctx->thread_done)
|
|
||||||
g_usleep (G_USEC_PER_SEC / 20);
|
|
||||||
|
|
||||||
_libnm_glib_ctx_free (ctx);
|
|
||||||
}
|
|
||||||
|
|
||||||
libnm_glib_state
|
|
||||||
libnm_glib_get_network_state (const libnm_glib_ctx *ctx)
|
|
||||||
{
|
|
||||||
if (!ctx)
|
|
||||||
return LIBNM_INVALID_CONTEXT;
|
|
||||||
|
|
||||||
return ctx->nm_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
guint
|
|
||||||
libnm_glib_register_callback (libnm_glib_ctx *ctx,
|
|
||||||
libnm_glib_callback_func func,
|
|
||||||
gpointer user_data,
|
|
||||||
GMainContext *g_main_ctx)
|
|
||||||
{
|
|
||||||
libnm_glib_callback *callback = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (ctx != NULL, 0);
|
|
||||||
g_return_val_if_fail (func != NULL, 0);
|
|
||||||
|
|
||||||
callback = g_malloc0 (sizeof (libnm_glib_callback));
|
|
||||||
|
|
||||||
callback->id = ++ (ctx->callback_id_last);
|
|
||||||
callback->func = func;
|
|
||||||
callback->gmain_ctx = g_main_ctx;
|
|
||||||
callback->libnm_glib_ctx = ctx;
|
|
||||||
callback->user_data = user_data;
|
|
||||||
|
|
||||||
g_mutex_lock (ctx->callbacks_lock);
|
|
||||||
ctx->callbacks = g_slist_append (ctx->callbacks, callback);
|
|
||||||
_libnm_glib_schedule_single_callback (ctx, callback);
|
|
||||||
g_mutex_unlock (ctx->callbacks_lock);
|
|
||||||
|
|
||||||
return (callback->id);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
libnm_glib_unregister_callback (libnm_glib_ctx *ctx,
|
|
||||||
guint id)
|
|
||||||
{
|
|
||||||
GSList *elem;
|
|
||||||
|
|
||||||
g_return_if_fail (ctx != NULL);
|
|
||||||
g_return_if_fail (id > 0);
|
|
||||||
|
|
||||||
g_mutex_lock (ctx->callbacks_lock);
|
|
||||||
elem = ctx->callbacks;
|
|
||||||
while (elem)
|
|
||||||
{
|
|
||||||
libnm_glib_callback *callback = (libnm_glib_callback *)(elem->data);
|
|
||||||
if (callback && (callback->id == id))
|
|
||||||
{
|
|
||||||
_libnm_glib_unschedule_single_callback (ctx, callback);
|
|
||||||
ctx->callbacks = g_slist_remove_link (ctx->callbacks, elem);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
elem = g_slist_next (elem);
|
|
||||||
}
|
|
||||||
g_mutex_unlock (ctx->callbacks_lock);
|
|
||||||
}
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
|
||||||
/*
|
|
||||||
* libnm_glib -- Access network status & information from glib applications
|
|
||||||
*
|
|
||||||
* 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 (C) 2005 - 2008 Red Hat, Inc.
|
|
||||||
* Copyright (C) 2005 - 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _LIB_NM_H_
|
|
||||||
#define _LIB_NM_H_
|
|
||||||
|
|
||||||
#ifndef NM_DISABLE_DEPRECATED
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
typedef enum libnm_glib_state
|
|
||||||
{
|
|
||||||
LIBNM_NO_DBUS = 0,
|
|
||||||
LIBNM_NO_NETWORKMANAGER,
|
|
||||||
LIBNM_NO_NETWORK_CONNECTION,
|
|
||||||
LIBNM_ACTIVE_NETWORK_CONNECTION,
|
|
||||||
LIBNM_INVALID_CONTEXT
|
|
||||||
} libnm_glib_state G_GNUC_DEPRECATED;
|
|
||||||
|
|
||||||
typedef struct libnm_glib_ctx libnm_glib_ctx G_GNUC_DEPRECATED;
|
|
||||||
|
|
||||||
typedef void (*libnm_glib_callback_func) (libnm_glib_ctx *libnm_ctx, gpointer user_data) G_GNUC_DEPRECATED;
|
|
||||||
|
|
||||||
G_GNUC_DEPRECATED libnm_glib_ctx * libnm_glib_init (void);
|
|
||||||
G_GNUC_DEPRECATED void libnm_glib_shutdown (libnm_glib_ctx *ctx);
|
|
||||||
|
|
||||||
G_GNUC_DEPRECATED libnm_glib_state libnm_glib_get_network_state (const libnm_glib_ctx *ctx);
|
|
||||||
|
|
||||||
G_GNUC_DEPRECATED guint libnm_glib_register_callback (libnm_glib_ctx *ctx, libnm_glib_callback_func func, gpointer user_data, GMainContext *g_main_ctx);
|
|
||||||
G_GNUC_DEPRECATED void libnm_glib_unregister_callback (libnm_glib_ctx *ctx, guint id);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DISABLE_DEPRECATED */
|
|
||||||
|
|
||||||
#endif /* _LIB_NM_H_ */
|
|
||||||
|
|
@ -1,286 +0,0 @@
|
||||||
libnm_glib_inc = include_directories('.')
|
|
||||||
|
|
||||||
dbus_binding_tool = find_program('dbus-binding-tool')
|
|
||||||
|
|
||||||
common_deps = [
|
|
||||||
dbus_dep,
|
|
||||||
dbus_glib_dep,
|
|
||||||
shared_nm_utils_base_dep,
|
|
||||||
]
|
|
||||||
|
|
||||||
common_cflags = [
|
|
||||||
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB',
|
|
||||||
]
|
|
||||||
|
|
||||||
cflags = common_cflags + [
|
|
||||||
'-DG_LOG_DOMAIN="@0@"'.format(libnm_glib_name),
|
|
||||||
]
|
|
||||||
|
|
||||||
vpn_headers = files(
|
|
||||||
'nm-vpn-plugin.h',
|
|
||||||
'nm-vpn-plugin-ui-interface.h',
|
|
||||||
'nm-vpn-plugin-utils.h',
|
|
||||||
)
|
|
||||||
|
|
||||||
headers = files(
|
|
||||||
'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.h',
|
|
||||||
'nm-device-infiniband.h',
|
|
||||||
'nm-device-modem.h',
|
|
||||||
'nm-device-olpc-mesh.h',
|
|
||||||
'nm-device-team.h',
|
|
||||||
'nm-device-vlan.h',
|
|
||||||
'nm-device-wifi.h',
|
|
||||||
'nm-device-wimax.h',
|
|
||||||
'nm-dhcp4-config.h',
|
|
||||||
'nm-dhcp6-config.h',
|
|
||||||
'nm-ip4-config.h',
|
|
||||||
'nm-ip6-config.h',
|
|
||||||
'nm-object.h',
|
|
||||||
'nm-remote-connection.h',
|
|
||||||
'nm-remote-settings.h',
|
|
||||||
'nm-secret-agent.h',
|
|
||||||
'nm-types.h',
|
|
||||||
'nm-vpn-connection.h',
|
|
||||||
'nm-wimax-nsp.h',
|
|
||||||
)
|
|
||||||
|
|
||||||
deprecated_headers = files('libnm_glib.h')
|
|
||||||
|
|
||||||
install_headers(
|
|
||||||
headers + vpn_headers + deprecated_headers,
|
|
||||||
subdir: libnm_glib_name,
|
|
||||||
)
|
|
||||||
|
|
||||||
libdeprecated_nm_glib = static_library(
|
|
||||||
'deprecated-nm-glib',
|
|
||||||
sources: 'libnm_glib.c',
|
|
||||||
include_directories: libnm_util_inc,
|
|
||||||
dependencies: common_deps,
|
|
||||||
c_args: cflags + [
|
|
||||||
'-Wno-deprecated-declarations',
|
|
||||||
'-Wno-deprecated',
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
sources = files(
|
|
||||||
'nm-vpn-plugin.c',
|
|
||||||
'nm-vpn-plugin-ui-interface.c',
|
|
||||||
'nm-vpn-plugin-utils.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
glue = 'nm-vpn-plugin-glue.h'
|
|
||||||
|
|
||||||
enum_types = 'nm-vpn-enum-types'
|
|
||||||
|
|
||||||
libnm_glib_vpn_enum = gnome.mkenums(
|
|
||||||
enum_types,
|
|
||||||
sources: vpn_headers,
|
|
||||||
identifier_prefix: nm_id_prefix,
|
|
||||||
c_template: enum_types + '.c.template',
|
|
||||||
h_template: enum_types + '.h.template',
|
|
||||||
install_header: true,
|
|
||||||
install_dir: libnm_glib_pkgincludedir,
|
|
||||||
)
|
|
||||||
|
|
||||||
linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')
|
|
||||||
|
|
||||||
libnm_glib_vpn = shared_library(
|
|
||||||
'nm-glib-vpn',
|
|
||||||
sources: files(
|
|
||||||
'nm-vpn-plugin.c',
|
|
||||||
'nm-vpn-plugin-ui-interface.c',
|
|
||||||
'nm-vpn-plugin-utils.c',
|
|
||||||
) + [
|
|
||||||
custom_target(
|
|
||||||
glue,
|
|
||||||
input: ifaces_vpn_plugin_xml,
|
|
||||||
output: glue,
|
|
||||||
command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'],
|
|
||||||
),
|
|
||||||
] + libnm_glib_vpn_enum,
|
|
||||||
version: libnm_glib_vpn_version,
|
|
||||||
dependencies: common_deps + [libnm_util_dep],
|
|
||||||
c_args: cflags,
|
|
||||||
link_args: [
|
|
||||||
'-Wl,--version-script,@0@'.format(linker_script),
|
|
||||||
],
|
|
||||||
link_depends: linker_script,
|
|
||||||
install: true,
|
|
||||||
)
|
|
||||||
|
|
||||||
libnm_glib_vpn_dep = declare_dependency(
|
|
||||||
include_directories: libnm_glib_inc,
|
|
||||||
link_with: libnm_glib_vpn,
|
|
||||||
)
|
|
||||||
|
|
||||||
pkg.generate(
|
|
||||||
libraries: libnm_glib_vpn,
|
|
||||||
version: nm_version,
|
|
||||||
name: libnm_glib_vpn_name,
|
|
||||||
description: 'Convenience library for NetworkManager VPN plugins',
|
|
||||||
filebase: libnm_glib_vpn_name,
|
|
||||||
subdirs: libnm_glib_name,
|
|
||||||
requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1',
|
|
||||||
variables: 'exec_prefix=${prefix}',
|
|
||||||
)
|
|
||||||
|
|
||||||
libnm_glib_sources = files(
|
|
||||||
'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.c',
|
|
||||||
'nm-device-ethernet.c',
|
|
||||||
'nm-device-generic.c',
|
|
||||||
'nm-device-infiniband.c',
|
|
||||||
'nm-device-olpc-mesh.c',
|
|
||||||
'nm-device-modem.c',
|
|
||||||
'nm-device-team.c',
|
|
||||||
'nm-device-vlan.c',
|
|
||||||
'nm-device-wifi.c',
|
|
||||||
'nm-device-wimax.c',
|
|
||||||
'nm-dhcp4-config.c',
|
|
||||||
'nm-dhcp6-config.c',
|
|
||||||
'nm-ip4-config.c',
|
|
||||||
'nm-ip6-config.c',
|
|
||||||
'nm-object.c',
|
|
||||||
'nm-object-cache.c',
|
|
||||||
'nm-remote-connection.c',
|
|
||||||
'nm-remote-settings.c',
|
|
||||||
'nm-secret-agent.c',
|
|
||||||
'nm-types.c',
|
|
||||||
'nm-vpn-connection.c',
|
|
||||||
'nm-wimax-nsp.c',
|
|
||||||
)
|
|
||||||
|
|
||||||
glue = 'nm-secret-agent-glue.h'
|
|
||||||
|
|
||||||
nm_secret_agent_glue = custom_target(
|
|
||||||
glue,
|
|
||||||
input: ifaces_secret_agent_xml,
|
|
||||||
output: glue,
|
|
||||||
command: [dbus_binding_tool, '--prefix=nm_secret_agent', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'],
|
|
||||||
)
|
|
||||||
|
|
||||||
enum_types = 'nm-glib-enum-types'
|
|
||||||
|
|
||||||
libnm_glib_enum = gnome.mkenums(
|
|
||||||
enum_types,
|
|
||||||
sources: headers,
|
|
||||||
identifier_prefix: nm_id_prefix,
|
|
||||||
c_template: enum_types + '.c.template',
|
|
||||||
h_template: enum_types + '.h.template',
|
|
||||||
install_header: true,
|
|
||||||
install_dir: libnm_glib_pkgincludedir,
|
|
||||||
)
|
|
||||||
|
|
||||||
linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
|
|
||||||
|
|
||||||
libnm_glib = shared_library(
|
|
||||||
'nm-glib',
|
|
||||||
sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue],
|
|
||||||
version: libnm_glib_version,
|
|
||||||
dependencies: common_deps + [
|
|
||||||
libnm_util_dep,
|
|
||||||
libudev_dep,
|
|
||||||
shared_nm_utils_udev_dep,
|
|
||||||
],
|
|
||||||
c_args: cflags,
|
|
||||||
link_whole: libdeprecated_nm_glib,
|
|
||||||
link_args: [
|
|
||||||
'-Wl,--version-script,@0@'.format(linker_script),
|
|
||||||
],
|
|
||||||
link_depends: linker_script,
|
|
||||||
install: true,
|
|
||||||
)
|
|
||||||
|
|
||||||
libnm_glib_dep = declare_dependency(
|
|
||||||
include_directories: libnm_glib_inc,
|
|
||||||
link_with: libnm_glib,
|
|
||||||
)
|
|
||||||
|
|
||||||
pkg.generate(
|
|
||||||
libraries: libnm_glib,
|
|
||||||
version: nm_version,
|
|
||||||
name: libnm_glib_name,
|
|
||||||
description: 'Convenience library for clients of NetworkManager',
|
|
||||||
filebase: libnm_glib_name,
|
|
||||||
subdirs: libnm_glib_name,
|
|
||||||
requires: 'libnm-util >= ' + nm_version + ' NetworkManager >= ' + nm_version + ' gobject-2.0 dbus-glib-1',
|
|
||||||
variables: 'exec_prefix=${prefix}',
|
|
||||||
)
|
|
||||||
|
|
||||||
if enable_introspection
|
|
||||||
gir_sources = libnm_glib_sources + headers + libnm_glib_enum
|
|
||||||
|
|
||||||
libnm_glib_gir = gnome.generate_gir(
|
|
||||||
libnm_glib,
|
|
||||||
sources: gir_sources,
|
|
||||||
dependencies: [
|
|
||||||
dbus_glib_dep,
|
|
||||||
libnm_glib_dep,
|
|
||||||
libnm_util_gir_dep,
|
|
||||||
],
|
|
||||||
nsversion: nm_gir_version,
|
|
||||||
namespace: 'NMClient',
|
|
||||||
identifier_prefix: nm_id_prefix,
|
|
||||||
symbol_prefix: nm_id_prefix.to_lower(),
|
|
||||||
export_packages: [libnm_glib_name, libnm_glib_vpn_name],
|
|
||||||
includes: [
|
|
||||||
'DBusGLib-1.0',
|
|
||||||
'Gio-2.0',
|
|
||||||
],
|
|
||||||
extra_args: cflags + [
|
|
||||||
'--include-uninstalled=' + libnm_util_gir[0].full_path(),
|
|
||||||
],
|
|
||||||
install: true,
|
|
||||||
)
|
|
||||||
endif
|
|
||||||
|
|
||||||
name = libnm_glib_name + '-test'
|
|
||||||
|
|
||||||
executable(
|
|
||||||
name,
|
|
||||||
name + '.c',
|
|
||||||
dependencies: common_deps + [libnm_util_dep],
|
|
||||||
c_args: cflags,
|
|
||||||
link_with: libnm_glib,
|
|
||||||
)
|
|
||||||
|
|
||||||
test(
|
|
||||||
'check-local-exports-' + libnm_glib_name,
|
|
||||||
check_exports,
|
|
||||||
args: [libnm_glib.full_path(), linker_script],
|
|
||||||
)
|
|
||||||
|
|
||||||
if enable_tests
|
|
||||||
subdir('tests')
|
|
||||||
endif
|
|
||||||
|
|
||||||
pkg.generate(
|
|
||||||
version: nm_version,
|
|
||||||
name: nm_name,
|
|
||||||
description: 'System for maintaining active network connection',
|
|
||||||
filebase: nm_name,
|
|
||||||
subdirs: nm_name,
|
|
||||||
requires: '',
|
|
||||||
variables: [
|
|
||||||
'exec_prefix=${prefix}',
|
|
||||||
'libgnome_serverdir=' + nm_libexecdir,
|
|
||||||
'plugindir=' + nm_vpndir,
|
|
||||||
'configdir=' + nm_pkgconfdir,
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
@ -1,720 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-connection.h"
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-wireless.h"
|
|
||||||
#include "nm-setting-wireless-security.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
#include "nm-access-point.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMAccessPoint, nm_access_point, NM_TYPE_OBJECT)
|
|
||||||
|
|
||||||
#define NM_ACCESS_POINT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACCESS_POINT, NMAccessPointPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
NM80211ApFlags flags;
|
|
||||||
NM80211ApSecurityFlags wpa_flags;
|
|
||||||
NM80211ApSecurityFlags rsn_flags;
|
|
||||||
GByteArray *ssid;
|
|
||||||
guint32 frequency;
|
|
||||||
char *bssid;
|
|
||||||
NM80211Mode mode;
|
|
||||||
guint32 max_bitrate;
|
|
||||||
guint8 strength;
|
|
||||||
int last_seen;
|
|
||||||
} NMAccessPointPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_FLAGS,
|
|
||||||
PROP_WPA_FLAGS,
|
|
||||||
PROP_RSN_FLAGS,
|
|
||||||
PROP_SSID,
|
|
||||||
PROP_FREQUENCY,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_MODE,
|
|
||||||
PROP_MAX_BITRATE,
|
|
||||||
PROP_STRENGTH,
|
|
||||||
PROP_BSSID,
|
|
||||||
PROP_LAST_SEEN,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBusobject path of the access point
|
|
||||||
*
|
|
||||||
* Creates a new #NMAccessPoint.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new access point
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_access_point_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
return (GObject *) g_object_new (NM_TYPE_ACCESS_POINT,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_flags:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the flags of the access point.
|
|
||||||
*
|
|
||||||
* Returns: the flags
|
|
||||||
**/
|
|
||||||
NM80211ApFlags
|
|
||||||
nm_access_point_get_flags (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_FLAGS_NONE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_wpa_flags:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the WPA (version 1) flags of the access point.
|
|
||||||
*
|
|
||||||
* Returns: the WPA flags
|
|
||||||
**/
|
|
||||||
NM80211ApSecurityFlags
|
|
||||||
nm_access_point_get_wpa_flags (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_SEC_NONE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->wpa_flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_rsn_flags:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the RSN (Robust Secure Network, ie WPA version 2) flags of the access
|
|
||||||
* point.
|
|
||||||
*
|
|
||||||
* Returns: the RSN flags
|
|
||||||
**/
|
|
||||||
NM80211ApSecurityFlags
|
|
||||||
nm_access_point_get_rsn_flags (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NM_802_11_AP_SEC_NONE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->rsn_flags;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_ssid:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the SSID of the access point.
|
|
||||||
*
|
|
||||||
* Returns: the #GByteArray containing the SSID. This is the internal copy used by the
|
|
||||||
* access point, and must not be modified.
|
|
||||||
**/
|
|
||||||
const GByteArray *
|
|
||||||
nm_access_point_get_ssid (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->ssid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_frequency:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the frequency of the access point in MHz.
|
|
||||||
*
|
|
||||||
* Returns: the frequency in MHz
|
|
||||||
**/
|
|
||||||
guint32
|
|
||||||
nm_access_point_get_frequency (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->frequency;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_bssid:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the Basic Service Set ID (BSSID) of the Wi-Fi access point.
|
|
||||||
*
|
|
||||||
* Returns: the BSSID of the access point. This is an internal string and must
|
|
||||||
* not be modified or freed.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_access_point_get_bssid (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->bssid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_hw_address:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the access point.
|
|
||||||
*
|
|
||||||
* Returns: the hardware address of the access point. This is the internal string used by the
|
|
||||||
* access point and must not be modified.
|
|
||||||
*
|
|
||||||
* Deprecated: 0.9: Use nm_access_point_get_bssid() instead.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_access_point_get_hw_address (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
return nm_access_point_get_bssid (ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_mode:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the mode of the access point.
|
|
||||||
*
|
|
||||||
* Returns: the mode
|
|
||||||
**/
|
|
||||||
NM80211Mode
|
|
||||||
nm_access_point_get_mode (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_max_bitrate:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the maximum bit rate of the access point in kbit/s.
|
|
||||||
*
|
|
||||||
* Returns: the maximum bit rate (kbit/s)
|
|
||||||
**/
|
|
||||||
guint32
|
|
||||||
nm_access_point_get_max_bitrate (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->max_bitrate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_strength:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Gets the current signal strength of the access point as a percentage.
|
|
||||||
*
|
|
||||||
* Returns: the signal strength (0 to 100)
|
|
||||||
**/
|
|
||||||
guint8
|
|
||||||
nm_access_point_get_strength (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->strength;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_get_last_seen:
|
|
||||||
* @ap: a #NMAccessPoint
|
|
||||||
*
|
|
||||||
* Returns the timestamp (in CLOCK_BOOTTIME seconds) for the last time the
|
|
||||||
* access point was found in scan results. A value of -1 means the access
|
|
||||||
* point has not been found in a scan.
|
|
||||||
*
|
|
||||||
* Returns: the last seen time in seconds
|
|
||||||
*
|
|
||||||
* Since: 1.2
|
|
||||||
**/
|
|
||||||
int
|
|
||||||
nm_access_point_get_last_seen (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACCESS_POINT (ap), -1);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (ap));
|
|
||||||
return NM_ACCESS_POINT_GET_PRIVATE (ap)->last_seen;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_connection_valid:
|
|
||||||
* @ap: an #NMAccessPoint to validate @connection against
|
|
||||||
* @connection: an #NMConnection to validate against @ap
|
|
||||||
*
|
|
||||||
* Validates a given connection against a given Wi-Fi access point to ensure that
|
|
||||||
* the connection may be activated with that AP. The connection must match the
|
|
||||||
* @ap's SSID, (if given) BSSID, and other attributes like security settings,
|
|
||||||
* channel, band, etc.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the connection may be activated with this Wi-Fi AP,
|
|
||||||
* %FALSE if it cannot be.
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_access_point_connection_valid (NMAccessPoint *ap, NMConnection *connection)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingWireless *s_wifi;
|
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
|
||||||
const char *ctype, *ap_bssid_str;
|
|
||||||
const GByteArray *setting_ssid;
|
|
||||||
const GByteArray *ap_ssid;
|
|
||||||
const GByteArray *setting_bssid;
|
|
||||||
const char *setting_mode;
|
|
||||||
NM80211Mode ap_mode;
|
|
||||||
const char *setting_band;
|
|
||||||
guint32 ap_freq, setting_chan, ap_chan;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
if (!s_con)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (!ctype || !nm_streq (ctype, NM_SETTING_WIRELESS_SETTING_NAME))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
s_wifi = nm_connection_get_setting_wireless (connection);
|
|
||||||
if (!s_wifi)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* SSID checks */
|
|
||||||
ap_ssid = nm_access_point_get_ssid (ap);
|
|
||||||
if (!ap_ssid)
|
|
||||||
return FALSE;
|
|
||||||
setting_ssid = nm_setting_wireless_get_ssid (s_wifi);
|
|
||||||
if ( !setting_ssid
|
|
||||||
|| setting_ssid->len != ap_ssid->len
|
|
||||||
|| memcmp (setting_ssid->data, ap_ssid->data, ap_ssid->len) != 0)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
/* BSSID checks */
|
|
||||||
ap_bssid_str = nm_access_point_get_bssid (ap);
|
|
||||||
if (!ap_bssid_str)
|
|
||||||
return FALSE;
|
|
||||||
setting_bssid = nm_setting_wireless_get_bssid (s_wifi);
|
|
||||||
if (setting_bssid) {
|
|
||||||
struct ether_addr addr;
|
|
||||||
|
|
||||||
g_return_val_if_fail (setting_bssid->len == ETH_ALEN, FALSE);
|
|
||||||
|
|
||||||
if (!ether_aton_r (ap_bssid_str, &addr))
|
|
||||||
return FALSE;
|
|
||||||
if (memcmp (addr.ether_addr_octet, setting_bssid->data, ETH_ALEN) != 0)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mode */
|
|
||||||
ap_mode = nm_access_point_get_mode (ap);
|
|
||||||
if (ap_mode == NM_802_11_MODE_UNKNOWN)
|
|
||||||
return FALSE;
|
|
||||||
setting_mode = nm_setting_wireless_get_mode (s_wifi);
|
|
||||||
if (setting_mode && ap_mode) {
|
|
||||||
if (!strcmp (setting_mode, "infrastructure") && (ap_mode != NM_802_11_MODE_INFRA))
|
|
||||||
return FALSE;
|
|
||||||
if (!strcmp (setting_mode, "adhoc") && (ap_mode != NM_802_11_MODE_ADHOC))
|
|
||||||
return FALSE;
|
|
||||||
/* Hotspot never matches against APs as it's a device-specific mode. */
|
|
||||||
if (!strcmp (setting_mode, "ap"))
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Band and Channel/Frequency */
|
|
||||||
ap_freq = nm_access_point_get_frequency (ap);
|
|
||||||
if (ap_freq) {
|
|
||||||
setting_band = nm_setting_wireless_get_band (s_wifi);
|
|
||||||
if (g_strcmp0 (setting_band, "a") == 0) {
|
|
||||||
if (ap_freq < 4915 || ap_freq > 5825)
|
|
||||||
return FALSE;
|
|
||||||
} else if (g_strcmp0 (setting_band, "bg") == 0) {
|
|
||||||
if (ap_freq < 2412 || ap_freq > 2484)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
setting_chan = nm_setting_wireless_get_channel (s_wifi);
|
|
||||||
if (setting_chan) {
|
|
||||||
ap_chan = nm_utils_wifi_freq_to_channel (ap_freq);
|
|
||||||
if (setting_chan != ap_chan)
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
s_wsec = nm_connection_get_setting_wireless_security (connection);
|
|
||||||
if (!nm_setting_wireless_ap_security_compatible (s_wifi,
|
|
||||||
s_wsec,
|
|
||||||
nm_access_point_get_flags (ap),
|
|
||||||
nm_access_point_get_wpa_flags (ap),
|
|
||||||
nm_access_point_get_rsn_flags (ap),
|
|
||||||
ap_mode))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_access_point_filter_connections:
|
|
||||||
* @ap: an #NMAccessPoint to filter connections for
|
|
||||||
* @connections: (element-type NMConnection): a list of
|
|
||||||
* #NMConnection objects to filter
|
|
||||||
*
|
|
||||||
* Filters a given list of connections for a given #NMAccessPoint object and
|
|
||||||
* return connections which may be activated with the access point. Any
|
|
||||||
* returned connections will match the @ap's SSID and (if given) BSSID and
|
|
||||||
* other attributes like security settings, channel, etc.
|
|
||||||
*
|
|
||||||
* To obtain the list of connections that are compatible with this access point,
|
|
||||||
* use nm_remote_settings_list_connections() and then filter the returned list
|
|
||||||
* for a given #NMDevice using nm_device_filter_connections() and finally
|
|
||||||
* filter that list with this function.
|
|
||||||
*
|
|
||||||
* Returns: (transfer container) (element-type NMConnection): a
|
|
||||||
* list of #NMConnection objects that could be activated with the given @ap.
|
|
||||||
* The elements of the list are owned by their creator and should not be freed
|
|
||||||
* by the caller, but the returned list itself is owned by the caller and should
|
|
||||||
* be freed with g_slist_free() when it is no longer required.
|
|
||||||
**/
|
|
||||||
GSList *
|
|
||||||
nm_access_point_filter_connections (NMAccessPoint *ap, const GSList *connections)
|
|
||||||
{
|
|
||||||
GSList *filtered = NULL;
|
|
||||||
const GSList *iter;
|
|
||||||
|
|
||||||
for (iter = connections; iter; iter = g_slist_next (iter)) {
|
|
||||||
NMConnection *candidate = NM_CONNECTION (iter->data);
|
|
||||||
|
|
||||||
if (nm_access_point_connection_valid (ap, candidate))
|
|
||||||
filtered = g_slist_prepend (filtered, candidate);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_slist_reverse (filtered);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_access_point_init (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
NM_ACCESS_POINT_GET_PRIVATE (ap)->last_seen = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_access_point_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->ssid)
|
|
||||||
g_byte_array_free (priv->ssid, TRUE);
|
|
||||||
|
|
||||||
g_free (priv->bssid);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_access_point_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMAccessPoint *ap = NM_ACCESS_POINT (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_FLAGS:
|
|
||||||
g_value_set_uint (value, nm_access_point_get_flags (ap));
|
|
||||||
break;
|
|
||||||
case PROP_WPA_FLAGS:
|
|
||||||
g_value_set_uint (value, nm_access_point_get_wpa_flags (ap));
|
|
||||||
break;
|
|
||||||
case PROP_RSN_FLAGS:
|
|
||||||
g_value_set_uint (value, nm_access_point_get_rsn_flags (ap));
|
|
||||||
break;
|
|
||||||
case PROP_SSID:
|
|
||||||
g_value_set_boxed (value, nm_access_point_get_ssid (ap));
|
|
||||||
break;
|
|
||||||
case PROP_FREQUENCY:
|
|
||||||
g_value_set_uint (value, nm_access_point_get_frequency (ap));
|
|
||||||
break;
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_access_point_get_bssid (ap));
|
|
||||||
break;
|
|
||||||
case PROP_BSSID:
|
|
||||||
g_value_set_string (value, nm_access_point_get_bssid (ap));
|
|
||||||
break;
|
|
||||||
case PROP_MODE:
|
|
||||||
g_value_set_uint (value, nm_access_point_get_mode (ap));
|
|
||||||
break;
|
|
||||||
case PROP_MAX_BITRATE:
|
|
||||||
g_value_set_uint (value, nm_access_point_get_max_bitrate (ap));
|
|
||||||
break;
|
|
||||||
case PROP_STRENGTH:
|
|
||||||
g_value_set_uchar (value, nm_access_point_get_strength (ap));
|
|
||||||
break;
|
|
||||||
case PROP_LAST_SEEN:
|
|
||||||
g_value_set_int (value, nm_access_point_get_last_seen (ap));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ssid (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
if (!_nm_ssid_demarshal (value, (GByteArray **) field))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
_nm_object_queue_notify (object, NM_ACCESS_POINT_SSID);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMAccessPoint *ap)
|
|
||||||
{
|
|
||||||
NMAccessPointPrivate *priv = NM_ACCESS_POINT_GET_PRIVATE (ap);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_ACCESS_POINT_FLAGS, &priv->flags },
|
|
||||||
{ NM_ACCESS_POINT_WPA_FLAGS, &priv->wpa_flags },
|
|
||||||
{ NM_ACCESS_POINT_RSN_FLAGS, &priv->rsn_flags },
|
|
||||||
{ NM_ACCESS_POINT_SSID, &priv->ssid, demarshal_ssid },
|
|
||||||
{ NM_ACCESS_POINT_FREQUENCY, &priv->frequency },
|
|
||||||
{ NM_ACCESS_POINT_HW_ADDRESS, &priv->bssid },
|
|
||||||
{ NM_ACCESS_POINT_MODE, &priv->mode },
|
|
||||||
{ NM_ACCESS_POINT_MAX_BITRATE, &priv->max_bitrate },
|
|
||||||
{ NM_ACCESS_POINT_STRENGTH, &priv->strength },
|
|
||||||
{ NM_ACCESS_POINT_LAST_SEEN, &priv->last_seen },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (ap),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMAccessPointPrivate *priv;
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_access_point_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv = NM_ACCESS_POINT_GET_PRIVATE (object);
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_ACCESS_POINT);
|
|
||||||
register_properties (NM_ACCESS_POINT (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_access_point_class_init (NMAccessPointClass *ap_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (ap_class, sizeof (NMAccessPointPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:flags:
|
|
||||||
*
|
|
||||||
* The flags of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_FLAGS,
|
|
||||||
g_param_spec_uint (NM_ACCESS_POINT_FLAGS, "", "",
|
|
||||||
NM_802_11_AP_FLAGS_NONE,
|
|
||||||
NM_802_11_AP_FLAGS_PRIVACY,
|
|
||||||
NM_802_11_AP_FLAGS_NONE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:wpa-flags:
|
|
||||||
*
|
|
||||||
* The WPA flags of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_WPA_FLAGS,
|
|
||||||
g_param_spec_uint (NM_ACCESS_POINT_WPA_FLAGS, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:rsn-flags:
|
|
||||||
*
|
|
||||||
* The RSN flags of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_RSN_FLAGS,
|
|
||||||
g_param_spec_uint (NM_ACCESS_POINT_RSN_FLAGS, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:ssid:
|
|
||||||
*
|
|
||||||
* The SSID of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SSID,
|
|
||||||
g_param_spec_boxed (NM_ACCESS_POINT_SSID, "", "",
|
|
||||||
NM_TYPE_SSID,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:frequency:
|
|
||||||
*
|
|
||||||
* The frequency of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_FREQUENCY,
|
|
||||||
g_param_spec_uint (NM_ACCESS_POINT_FREQUENCY, "", "",
|
|
||||||
0, 10000, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:bssid:
|
|
||||||
*
|
|
||||||
* The BSSID of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_BSSID,
|
|
||||||
g_param_spec_string (NM_ACCESS_POINT_BSSID, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware address of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_ACCESS_POINT_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:mode:
|
|
||||||
*
|
|
||||||
* The mode of the access point; either "infrastructure" (a central
|
|
||||||
* coordinator of the wireless network allowing clients to connect) or
|
|
||||||
* "ad-hoc" (a network with no central controller).
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_MODE,
|
|
||||||
g_param_spec_uint (NM_ACCESS_POINT_MODE, "", "",
|
|
||||||
NM_802_11_MODE_ADHOC, NM_802_11_MODE_INFRA, NM_802_11_MODE_INFRA,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:max-bitrate:
|
|
||||||
*
|
|
||||||
* The maximum bit rate of the access point in kbit/s.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_MAX_BITRATE,
|
|
||||||
g_param_spec_uint (NM_ACCESS_POINT_MAX_BITRATE, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:strength:
|
|
||||||
*
|
|
||||||
* The current signal strength of the access point.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_STRENGTH,
|
|
||||||
g_param_spec_uchar (NM_ACCESS_POINT_STRENGTH, "", "",
|
|
||||||
0, G_MAXUINT8, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMAccessPoint:last-seen:
|
|
||||||
*
|
|
||||||
* The timestamp (in CLOCK_BOOTTIME seconds) for the last time the
|
|
||||||
* access point was found in scan results. A value of -1 means the
|
|
||||||
* access point has not been found in a scan.
|
|
||||||
*
|
|
||||||
* Since: 1.2
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_LAST_SEEN,
|
|
||||||
g_param_spec_int (NM_ACCESS_POINT_LAST_SEEN, "", "",
|
|
||||||
-1, G_MAXINT, -1,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,98 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_ACCESS_POINT_H
|
|
||||||
#define NM_ACCESS_POINT_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-connection.h"
|
|
||||||
#include "nm-object.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_ACCESS_POINT (nm_access_point_get_type ())
|
|
||||||
#define NM_ACCESS_POINT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACCESS_POINT, NMAccessPoint))
|
|
||||||
#define NM_ACCESS_POINT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ACCESS_POINT, NMAccessPointClass))
|
|
||||||
#define NM_IS_ACCESS_POINT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ACCESS_POINT))
|
|
||||||
#define NM_IS_ACCESS_POINT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACCESS_POINT))
|
|
||||||
#define NM_ACCESS_POINT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACCESS_POINT, NMAccessPointClass))
|
|
||||||
|
|
||||||
#define NM_ACCESS_POINT_FLAGS "flags"
|
|
||||||
#define NM_ACCESS_POINT_WPA_FLAGS "wpa-flags"
|
|
||||||
#define NM_ACCESS_POINT_RSN_FLAGS "rsn-flags"
|
|
||||||
#define NM_ACCESS_POINT_SSID "ssid"
|
|
||||||
#define NM_ACCESS_POINT_BSSID "bssid"
|
|
||||||
#define NM_ACCESS_POINT_FREQUENCY "frequency"
|
|
||||||
#define NM_ACCESS_POINT_MODE "mode"
|
|
||||||
#define NM_ACCESS_POINT_MAX_BITRATE "max-bitrate"
|
|
||||||
#define NM_ACCESS_POINT_STRENGTH "strength"
|
|
||||||
#define NM_ACCESS_POINT_LAST_SEEN "last-seen"
|
|
||||||
|
|
||||||
/* DEPRECATED */
|
|
||||||
#define NM_ACCESS_POINT_HW_ADDRESS "hw-address"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMAccessPoint;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMAccessPointClass;
|
|
||||||
|
|
||||||
GType nm_access_point_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_access_point_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
NM80211ApFlags nm_access_point_get_flags (NMAccessPoint *ap);
|
|
||||||
NM80211ApSecurityFlags nm_access_point_get_wpa_flags (NMAccessPoint *ap);
|
|
||||||
NM80211ApSecurityFlags nm_access_point_get_rsn_flags (NMAccessPoint *ap);
|
|
||||||
const GByteArray * nm_access_point_get_ssid (NMAccessPoint *ap);
|
|
||||||
const char * nm_access_point_get_bssid (NMAccessPoint *ap);
|
|
||||||
guint32 nm_access_point_get_frequency (NMAccessPoint *ap);
|
|
||||||
NM80211Mode nm_access_point_get_mode (NMAccessPoint *ap);
|
|
||||||
guint32 nm_access_point_get_max_bitrate (NMAccessPoint *ap);
|
|
||||||
guint8 nm_access_point_get_strength (NMAccessPoint *ap);
|
|
||||||
NM_AVAILABLE_IN_1_2
|
|
||||||
int nm_access_point_get_last_seen (NMAccessPoint *ap);
|
|
||||||
|
|
||||||
GSList * nm_access_point_filter_connections (NMAccessPoint *ap,
|
|
||||||
const GSList *connections);
|
|
||||||
|
|
||||||
gboolean nm_access_point_connection_valid (NMAccessPoint *ap,
|
|
||||||
NMConnection *connection);
|
|
||||||
|
|
||||||
/* DEPRECATED */
|
|
||||||
NM_DEPRECATED_IN_0_9_10
|
|
||||||
const char * nm_access_point_get_hw_address (NMAccessPoint *ap);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_ACCESS_POINT_H */
|
|
||||||
|
|
@ -1,851 +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 - 2014 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-connection.h"
|
|
||||||
#include "nm-vpn-connection.h"
|
|
||||||
#include "nm-dbus-helpers-private.h"
|
|
||||||
|
|
||||||
static GType _nm_active_connection_type_for_path (DBusGConnection *connection,
|
|
||||||
const char *path);
|
|
||||||
static void _nm_active_connection_type_for_path_async (DBusGConnection *connection,
|
|
||||||
const char *path,
|
|
||||||
NMObjectTypeCallbackFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (NMActiveConnection, nm_active_connection, NM_TYPE_OBJECT,
|
|
||||||
_nm_object_register_type_func (g_define_type_id,
|
|
||||||
_nm_active_connection_type_for_path,
|
|
||||||
_nm_active_connection_type_for_path_async);
|
|
||||||
)
|
|
||||||
|
|
||||||
#define NM_ACTIVE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *connection;
|
|
||||||
char *id;
|
|
||||||
char *uuid;
|
|
||||||
char *type;
|
|
||||||
char *specific_object;
|
|
||||||
GPtrArray *devices;
|
|
||||||
NMActiveConnectionState state;
|
|
||||||
gboolean is_default;
|
|
||||||
NMIP4Config *ip4_config;
|
|
||||||
NMDHCP4Config *dhcp4_config;
|
|
||||||
gboolean is_default6;
|
|
||||||
NMIP6Config *ip6_config;
|
|
||||||
NMDHCP6Config *dhcp6_config;
|
|
||||||
gboolean is_vpn;
|
|
||||||
char *master;
|
|
||||||
} NMActiveConnectionPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_CONNECTION,
|
|
||||||
PROP_ID,
|
|
||||||
PROP_UUID,
|
|
||||||
PROP_TYPE,
|
|
||||||
PROP_SPECIFIC_OBJECT,
|
|
||||||
PROP_DEVICES,
|
|
||||||
PROP_STATE,
|
|
||||||
PROP_DEFAULT,
|
|
||||||
PROP_IP4_CONFIG,
|
|
||||||
PROP_DHCP4_CONFIG,
|
|
||||||
PROP_DEFAULT6,
|
|
||||||
PROP_IP6_CONFIG,
|
|
||||||
PROP_DHCP6_CONFIG,
|
|
||||||
PROP_VPN,
|
|
||||||
PROP_MASTER,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMActiveConnection.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new active connection
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_active_connection_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
return g_object_new (NM_TYPE_ACTIVE_CONNECTION,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
_nm_active_connection_type_for_path (DBusGConnection *connection,
|
|
||||||
const char *path)
|
|
||||||
{
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
GError *error = NULL;
|
|
||||||
GValue value = G_VALUE_INIT;
|
|
||||||
GType type;
|
|
||||||
|
|
||||||
proxy = _nm_dbus_new_proxy_for_connection (connection, path, DBUS_INTERFACE_PROPERTIES);
|
|
||||||
if (!proxy) {
|
|
||||||
g_warning ("%s: couldn't create D-Bus object proxy.", __func__);
|
|
||||||
return G_TYPE_INVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Have to create an NMVPNConnection if it's a VPN connection, otherwise
|
|
||||||
* a plain NMActiveConnection.
|
|
||||||
*/
|
|
||||||
if (dbus_g_proxy_call (proxy,
|
|
||||||
"Get", &error,
|
|
||||||
G_TYPE_STRING, NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
|
|
||||||
G_TYPE_STRING, "Vpn",
|
|
||||||
G_TYPE_INVALID,
|
|
||||||
G_TYPE_VALUE, &value, G_TYPE_INVALID)) {
|
|
||||||
if (g_value_get_boolean (&value))
|
|
||||||
type = NM_TYPE_VPN_CONNECTION;
|
|
||||||
else
|
|
||||||
type = NM_TYPE_ACTIVE_CONNECTION;
|
|
||||||
} else {
|
|
||||||
g_warning ("Error in getting active connection 'Vpn' property: %s",
|
|
||||||
error->message);
|
|
||||||
g_error_free (error);
|
|
||||||
type = G_TYPE_INVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (proxy);
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGConnection *connection;
|
|
||||||
NMObjectTypeCallbackFunc callback;
|
|
||||||
gpointer user_data;
|
|
||||||
} NMActiveConnectionAsyncData;
|
|
||||||
|
|
||||||
static void
|
|
||||||
async_got_type (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMActiveConnectionAsyncData *async_data = user_data;
|
|
||||||
GValue value = G_VALUE_INIT;
|
|
||||||
const char *path = dbus_g_proxy_get_path (proxy);
|
|
||||||
GError *error = NULL;
|
|
||||||
GType type;
|
|
||||||
|
|
||||||
if (dbus_g_proxy_end_call (proxy, call, &error,
|
|
||||||
G_TYPE_VALUE, &value,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
if (g_value_get_boolean (&value))
|
|
||||||
type = NM_TYPE_VPN_CONNECTION;
|
|
||||||
else
|
|
||||||
type = NM_TYPE_ACTIVE_CONNECTION;
|
|
||||||
} else {
|
|
||||||
g_warning ("%s: could not read properties for %s: %s", __func__, path, error->message);
|
|
||||||
type = G_TYPE_INVALID;
|
|
||||||
}
|
|
||||||
|
|
||||||
async_data->callback (type, async_data->user_data);
|
|
||||||
|
|
||||||
g_object_unref (proxy);
|
|
||||||
g_slice_free (NMActiveConnectionAsyncData, async_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_active_connection_type_for_path_async (DBusGConnection *connection,
|
|
||||||
const char *path,
|
|
||||||
NMObjectTypeCallbackFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMActiveConnectionAsyncData *async_data;
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
async_data = g_slice_new (NMActiveConnectionAsyncData);
|
|
||||||
async_data->connection = connection;
|
|
||||||
async_data->callback = callback;
|
|
||||||
async_data->user_data = user_data;
|
|
||||||
|
|
||||||
proxy = _nm_dbus_new_proxy_for_connection (connection, path, DBUS_INTERFACE_PROPERTIES);
|
|
||||||
dbus_g_proxy_begin_call (proxy, "Get",
|
|
||||||
async_got_type, async_data, NULL,
|
|
||||||
G_TYPE_STRING, NM_DBUS_INTERFACE_ACTIVE_CONNECTION,
|
|
||||||
G_TYPE_STRING, "Vpn",
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_connection:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the #NMConnection's DBus object path. This is often used with
|
|
||||||
* nm_remote_settings_get_connection_by_path() to retrieve the
|
|
||||||
* #NMRemoteConnection object that describes the connection.
|
|
||||||
*
|
|
||||||
* Returns: the object path of the #NMConnection which this #NMActiveConnection
|
|
||||||
* is an active instance of. This is the internal string used by the
|
|
||||||
* connection, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_active_connection_get_connection (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_id:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the #NMConnection's ID.
|
|
||||||
*
|
|
||||||
* Returns: the ID of the #NMConnection that backs the #NMActiveConnection.
|
|
||||||
* This is the internal string used by the connection, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_active_connection_get_id (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_uuid:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the #NMConnection's UUID.
|
|
||||||
*
|
|
||||||
* Returns: the UUID of the #NMConnection that backs the #NMActiveConnection.
|
|
||||||
* This is the internal string used by the connection, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_active_connection_get_uuid (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->uuid;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_connection_type:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the #NMConnection's type.
|
|
||||||
*
|
|
||||||
* Returns: the type of the #NMConnection that backs the #NMActiveConnection.
|
|
||||||
* This is the internal string used by the connection, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_active_connection_get_connection_type (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_specific_object:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the "specific object" used at the activation.
|
|
||||||
*
|
|
||||||
* Returns: the specific object's DBus path. This is the internal string used by the
|
|
||||||
* connection, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_active_connection_get_specific_object (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->specific_object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_devices:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the #NMDevices used for the active connections.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMDevice): the #GPtrArray containing #NMDevices.
|
|
||||||
* This is the internal copy used by the connection, and must not be modified.
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_active_connection_get_devices (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return handle_ptr_array_return (NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->devices);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_state:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the active connection's state.
|
|
||||||
*
|
|
||||||
* Returns: the state
|
|
||||||
**/
|
|
||||||
NMActiveConnectionState
|
|
||||||
nm_active_connection_get_state (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NM_ACTIVE_CONNECTION_STATE_UNKNOWN);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_default:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Whether the active connection is the default IPv4 one (that is, is used for
|
|
||||||
* the default IPv4 route and DNS information).
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the active connection is the default IPv4 connection
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_active_connection_get_default (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->is_default;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_ip4_config:
|
|
||||||
* @connection: an #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the current #NMIP4Config associated with the #NMActiveConnection.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the #NMIP4Config, or %NULL if the
|
|
||||||
* connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|
|
||||||
* state.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
NMIP4Config *
|
|
||||||
nm_active_connection_get_ip4_config (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip4_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_dhcp4_config:
|
|
||||||
* @connection: an #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the current #NMDHCP4Config (if any) associated with the
|
|
||||||
* #NMActiveConnection.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the #NMDHCP4Config, or %NULL if the
|
|
||||||
* connection does not use DHCP, or is not in the
|
|
||||||
* %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
NMDHCP4Config *
|
|
||||||
nm_active_connection_get_dhcp4_config (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp4_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_default6:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Whether the active connection is the default IPv6 one (that is, is used for
|
|
||||||
* the default IPv6 route and DNS information).
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the active connection is the default IPv6 connection
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_active_connection_get_default6 (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->is_default6;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_ip6_config:
|
|
||||||
* @connection: an #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the current #NMIP6Config associated with the #NMActiveConnection.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the #NMIP6Config, or %NULL if the
|
|
||||||
* connection is not in the %NM_ACTIVE_CONNECTION_STATE_ACTIVATED
|
|
||||||
* state.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
NMIP6Config *
|
|
||||||
nm_active_connection_get_ip6_config (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->ip6_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_dhcp6_config:
|
|
||||||
* @connection: an #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the current #NMDHCP6Config (if any) associated with the
|
|
||||||
* #NMActiveConnection.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the #NMDHCP6Config, or %NULL if the
|
|
||||||
* connection does not use DHCPv6, or is not in the
|
|
||||||
* %NM_ACTIVE_CONNECTION_STATE_ACTIVATED state.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
NMDHCP6Config *
|
|
||||||
nm_active_connection_get_dhcp6_config (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->dhcp6_config;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_vpn:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Whether the active connection is a VPN connection.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the active connection is a VPN connection
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_active_connection_get_vpn (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->is_vpn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_active_connection_get_master:
|
|
||||||
* @connection: a #NMActiveConnection
|
|
||||||
*
|
|
||||||
* Gets the path to the master #NMDevice of the connection.
|
|
||||||
*
|
|
||||||
* Returns: the path of the master #NMDevice of the #NMActiveConnection.
|
|
||||||
* This is the internal string used by the connection, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_active_connection_get_master (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_ACTIVE_CONNECTION (connection), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (connection));
|
|
||||||
return NM_ACTIVE_CONNECTION_GET_PRIVATE (connection)->master;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_active_connection_init (NMActiveConnection *ap)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->devices) {
|
|
||||||
g_ptr_array_set_free_func (priv->devices, g_object_unref);
|
|
||||||
g_ptr_array_free (priv->devices, TRUE);
|
|
||||||
priv->devices = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_clear_object (&priv->ip4_config);
|
|
||||||
g_clear_object (&priv->dhcp4_config);
|
|
||||||
g_clear_object (&priv->ip6_config);
|
|
||||||
g_clear_object (&priv->dhcp6_config);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_active_connection_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->connection);
|
|
||||||
g_free (priv->id);
|
|
||||||
g_free (priv->uuid);
|
|
||||||
g_free (priv->type);
|
|
||||||
g_free (priv->specific_object);
|
|
||||||
g_free (priv->master);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_active_connection_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMActiveConnection *self = NM_ACTIVE_CONNECTION (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_CONNECTION:
|
|
||||||
g_value_set_string (value, nm_active_connection_get_connection (self));
|
|
||||||
break;
|
|
||||||
case PROP_ID:
|
|
||||||
g_value_set_string (value, nm_active_connection_get_id (self));
|
|
||||||
break;
|
|
||||||
case PROP_UUID:
|
|
||||||
g_value_set_string (value, nm_active_connection_get_uuid (self));
|
|
||||||
break;
|
|
||||||
case PROP_TYPE:
|
|
||||||
g_value_set_string (value, nm_active_connection_get_connection_type (self));
|
|
||||||
break;
|
|
||||||
case PROP_SPECIFIC_OBJECT:
|
|
||||||
g_value_set_boxed (value, nm_active_connection_get_specific_object (self));
|
|
||||||
break;
|
|
||||||
case PROP_DEVICES:
|
|
||||||
g_value_set_boxed (value, nm_active_connection_get_devices (self));
|
|
||||||
break;
|
|
||||||
case PROP_STATE:
|
|
||||||
g_value_set_uint (value, nm_active_connection_get_state (self));
|
|
||||||
break;
|
|
||||||
case PROP_DEFAULT:
|
|
||||||
g_value_set_boolean (value, nm_active_connection_get_default (self));
|
|
||||||
break;
|
|
||||||
case PROP_IP4_CONFIG:
|
|
||||||
g_value_set_object (value, nm_active_connection_get_ip4_config (self));
|
|
||||||
break;
|
|
||||||
case PROP_DHCP4_CONFIG:
|
|
||||||
g_value_set_object (value, nm_active_connection_get_dhcp4_config (self));
|
|
||||||
break;
|
|
||||||
case PROP_DEFAULT6:
|
|
||||||
g_value_set_boolean (value, nm_active_connection_get_default6 (self));
|
|
||||||
break;
|
|
||||||
case PROP_IP6_CONFIG:
|
|
||||||
g_value_set_object (value, nm_active_connection_get_ip6_config (self));
|
|
||||||
break;
|
|
||||||
case PROP_DHCP6_CONFIG:
|
|
||||||
g_value_set_object (value, nm_active_connection_get_dhcp6_config (self));
|
|
||||||
break;
|
|
||||||
case PROP_VPN:
|
|
||||||
g_value_set_boolean (value, nm_active_connection_get_vpn (self));
|
|
||||||
break;
|
|
||||||
case PROP_MASTER:
|
|
||||||
g_value_set_string (value, nm_active_connection_get_master (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMActiveConnection *connection)
|
|
||||||
{
|
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (connection);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_ACTIVE_CONNECTION_CONNECTION, &priv->connection },
|
|
||||||
{ NM_ACTIVE_CONNECTION_ID, &priv->id },
|
|
||||||
{ NM_ACTIVE_CONNECTION_UUID, &priv->uuid },
|
|
||||||
{ NM_ACTIVE_CONNECTION_TYPE, &priv->type },
|
|
||||||
{ NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, &priv->specific_object },
|
|
||||||
{ NM_ACTIVE_CONNECTION_DEVICES, &priv->devices, NULL, NM_TYPE_DEVICE },
|
|
||||||
{ NM_ACTIVE_CONNECTION_STATE, &priv->state },
|
|
||||||
{ NM_ACTIVE_CONNECTION_DEFAULT, &priv->is_default },
|
|
||||||
{ NM_ACTIVE_CONNECTION_IP4_CONFIG, &priv->ip4_config, NULL, NM_TYPE_IP4_CONFIG },
|
|
||||||
{ NM_ACTIVE_CONNECTION_DHCP4_CONFIG, &priv->dhcp4_config, NULL, NM_TYPE_DHCP4_CONFIG },
|
|
||||||
{ NM_ACTIVE_CONNECTION_DEFAULT6, &priv->is_default6 },
|
|
||||||
{ NM_ACTIVE_CONNECTION_IP6_CONFIG, &priv->ip6_config, NULL, NM_TYPE_IP6_CONFIG },
|
|
||||||
{ NM_ACTIVE_CONNECTION_DHCP6_CONFIG, &priv->dhcp6_config, NULL, NM_TYPE_DHCP6_CONFIG },
|
|
||||||
{ NM_ACTIVE_CONNECTION_VPN, &priv->is_vpn },
|
|
||||||
{ NM_ACTIVE_CONNECTION_MASTER, &priv->master },
|
|
||||||
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (connection),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_active_connection_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_ACTIVE_CONNECTION);
|
|
||||||
register_properties (NM_ACTIVE_CONNECTION (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_active_connection_class_init (NMActiveConnectionClass *ap_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (ap_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (ap_class, sizeof (NMActiveConnectionPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:connection:
|
|
||||||
*
|
|
||||||
* The connection's path of the active connection.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CONNECTION,
|
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_CONNECTION, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:id:
|
|
||||||
*
|
|
||||||
* The active connection's ID
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ID,
|
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_ID, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:uuid:
|
|
||||||
*
|
|
||||||
* The active connection's UUID
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_UUID,
|
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_UUID, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:type:
|
|
||||||
*
|
|
||||||
* The active connection's type
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_TYPE,
|
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_TYPE, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:specific-object:
|
|
||||||
*
|
|
||||||
* The specific object's path of the active connection.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SPECIFIC_OBJECT,
|
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:device:
|
|
||||||
*
|
|
||||||
* The devices (#NMDevice) of the active connection.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DEVICES,
|
|
||||||
g_param_spec_boxed (NM_ACTIVE_CONNECTION_DEVICES, "", "",
|
|
||||||
NM_TYPE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:state:
|
|
||||||
*
|
|
||||||
* The state of the active connection.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_STATE,
|
|
||||||
g_param_spec_uint (NM_ACTIVE_CONNECTION_STATE, "", "",
|
|
||||||
NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
|
|
||||||
NM_ACTIVE_CONNECTION_STATE_DEACTIVATING,
|
|
||||||
NM_ACTIVE_CONNECTION_STATE_UNKNOWN,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:default:
|
|
||||||
*
|
|
||||||
* Whether the active connection is the default IPv4 one.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DEFAULT,
|
|
||||||
g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:ip4-config:
|
|
||||||
*
|
|
||||||
* The #NMIP4Config of the connection.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_IP4_CONFIG,
|
|
||||||
g_param_spec_object (NM_ACTIVE_CONNECTION_IP4_CONFIG, "", "",
|
|
||||||
NM_TYPE_IP4_CONFIG,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:dhcp4-config:
|
|
||||||
*
|
|
||||||
* The #NMDHCP4Config of the connection.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DHCP4_CONFIG,
|
|
||||||
g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP4_CONFIG, "", "",
|
|
||||||
NM_TYPE_DHCP4_CONFIG,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:default6:
|
|
||||||
*
|
|
||||||
* Whether the active connection is the default IPv6 one.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DEFAULT6,
|
|
||||||
g_param_spec_boolean (NM_ACTIVE_CONNECTION_DEFAULT6, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:ip6-config:
|
|
||||||
*
|
|
||||||
* The #NMIP6Config of the connection.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_IP6_CONFIG,
|
|
||||||
g_param_spec_object (NM_ACTIVE_CONNECTION_IP6_CONFIG, "", "",
|
|
||||||
NM_TYPE_IP6_CONFIG,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:dhcp6-config:
|
|
||||||
*
|
|
||||||
* The #NMDHCP6Config of the connection.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DHCP6_CONFIG,
|
|
||||||
g_param_spec_object (NM_ACTIVE_CONNECTION_DHCP6_CONFIG, "", "",
|
|
||||||
NM_TYPE_DHCP6_CONFIG,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:vpn:
|
|
||||||
*
|
|
||||||
* Whether the active connection is a VPN connection.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_VPN,
|
|
||||||
g_param_spec_boolean (NM_ACTIVE_CONNECTION_VPN, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMActiveConnection:master:
|
|
||||||
*
|
|
||||||
* The path of the master device if one exists.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_MASTER,
|
|
||||||
g_param_spec_string (NM_ACTIVE_CONNECTION_MASTER, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,105 +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 - 2014 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_ACTIVE_CONNECTION_H
|
|
||||||
#define NM_ACTIVE_CONNECTION_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "nm-object.h"
|
|
||||||
#include "nm-connection.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-ip4-config.h"
|
|
||||||
#include "nm-dhcp4-config.h"
|
|
||||||
#include "nm-ip6-config.h"
|
|
||||||
#include "nm-dhcp6-config.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type ())
|
|
||||||
#define NM_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnection))
|
|
||||||
#define NM_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
|
|
||||||
#define NM_IS_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ACTIVE_CONNECTION))
|
|
||||||
#define NM_IS_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACTIVE_CONNECTION))
|
|
||||||
#define NM_ACTIVE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
|
|
||||||
|
|
||||||
#define NM_ACTIVE_CONNECTION_CONNECTION "connection"
|
|
||||||
#define NM_ACTIVE_CONNECTION_ID "id"
|
|
||||||
#define NM_ACTIVE_CONNECTION_UUID "uuid"
|
|
||||||
#define NM_ACTIVE_CONNECTION_TYPE "type"
|
|
||||||
#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object"
|
|
||||||
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
|
|
||||||
#define NM_ACTIVE_CONNECTION_STATE "state"
|
|
||||||
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
|
|
||||||
#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
|
|
||||||
#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
|
|
||||||
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
|
|
||||||
#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
|
|
||||||
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
|
|
||||||
#define NM_ACTIVE_CONNECTION_VPN "vpn"
|
|
||||||
#define NM_ACTIVE_CONNECTION_MASTER "master"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMActiveConnection;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMActiveConnectionClass;
|
|
||||||
|
|
||||||
GType nm_active_connection_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_active_connection_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char * nm_active_connection_get_connection (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_active_connection_get_id (NMActiveConnection *connection);
|
|
||||||
const char * nm_active_connection_get_uuid (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_active_connection_get_connection_type (NMActiveConnection *connection);
|
|
||||||
const char * nm_active_connection_get_specific_object (NMActiveConnection *connection);
|
|
||||||
const GPtrArray *nm_active_connection_get_devices (NMActiveConnection *connection);
|
|
||||||
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *connection);
|
|
||||||
const char * nm_active_connection_get_master (NMActiveConnection *connection);
|
|
||||||
gboolean nm_active_connection_get_default (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
NMIP4Config * nm_active_connection_get_ip4_config (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
NMDHCP4Config *nm_active_connection_get_dhcp4_config (NMActiveConnection *connection);
|
|
||||||
gboolean nm_active_connection_get_default6 (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
NMIP6Config * nm_active_connection_get_ip6_config (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
NMDHCP6Config *nm_active_connection_get_dhcp6_config (NMActiveConnection *connection);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
gboolean nm_active_connection_get_vpn (NMActiveConnection *connection);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_ACTIVE_CONNECTION_H */
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,269 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_CLIENT_H
|
|
||||||
#define NM_CLIENT_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-object.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
#include "nm-vpn-connection.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_CLIENT (nm_client_get_type ())
|
|
||||||
#define NM_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_CLIENT, NMClient))
|
|
||||||
#define NM_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_CLIENT, NMClientClass))
|
|
||||||
#define NM_IS_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_CLIENT))
|
|
||||||
#define NM_IS_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_CLIENT))
|
|
||||||
#define NM_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_CLIENT, NMClientClass))
|
|
||||||
|
|
||||||
#define NM_CLIENT_VERSION "version"
|
|
||||||
#define NM_CLIENT_STATE "state"
|
|
||||||
#define NM_CLIENT_STARTUP "startup"
|
|
||||||
#define NM_CLIENT_MANAGER_RUNNING "manager-running"
|
|
||||||
#define NM_CLIENT_NETWORKING_ENABLED "networking-enabled"
|
|
||||||
#define NM_CLIENT_WIRELESS_ENABLED "wireless-enabled"
|
|
||||||
#define NM_CLIENT_WIRELESS_HARDWARE_ENABLED "wireless-hardware-enabled"
|
|
||||||
#define NM_CLIENT_WWAN_ENABLED "wwan-enabled"
|
|
||||||
#define NM_CLIENT_WWAN_HARDWARE_ENABLED "wwan-hardware-enabled"
|
|
||||||
#define NM_CLIENT_WIMAX_ENABLED "wimax-enabled"
|
|
||||||
#define NM_CLIENT_WIMAX_HARDWARE_ENABLED "wimax-hardware-enabled"
|
|
||||||
#define NM_CLIENT_ACTIVE_CONNECTIONS "active-connections"
|
|
||||||
#define NM_CLIENT_CONNECTIVITY "connectivity"
|
|
||||||
#define NM_CLIENT_PRIMARY_CONNECTION "primary-connection"
|
|
||||||
#define NM_CLIENT_ACTIVATING_CONNECTION "activating-connection"
|
|
||||||
#define NM_CLIENT_DEVICES "devices"
|
|
||||||
#define NM_CLIENT_ALL_DEVICES "all-devices"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMClientPermission:
|
|
||||||
* @NM_CLIENT_PERMISSION_NONE: unknown or no permission
|
|
||||||
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK: controls whether networking
|
|
||||||
* can be globally enabled or disabled
|
|
||||||
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI: controls whether Wi-Fi can be
|
|
||||||
* globally enabled or disabled
|
|
||||||
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN: controls whether WWAN (3G) can be
|
|
||||||
* globally enabled or disabled
|
|
||||||
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX: controls whether WiMAX can be
|
|
||||||
* globally enabled or disabled
|
|
||||||
* @NM_CLIENT_PERMISSION_SLEEP_WAKE: controls whether the client can ask
|
|
||||||
* NetworkManager to sleep and wake
|
|
||||||
* @NM_CLIENT_PERMISSION_NETWORK_CONTROL: controls whether networking connections
|
|
||||||
* can be started, stopped, and changed
|
|
||||||
* @NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED: controls whether a password
|
|
||||||
* protected Wi-Fi hotspot can be created
|
|
||||||
* @NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN: controls whether an open Wi-Fi hotspot
|
|
||||||
* can be created
|
|
||||||
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM: controls whether connections
|
|
||||||
* that are available to all users can be modified
|
|
||||||
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN: controls whether connections
|
|
||||||
* owned by the current user can be modified
|
|
||||||
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME: controls whether the
|
|
||||||
* persistent hostname can be changed
|
|
||||||
* @NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS: modify persistent global
|
|
||||||
* DNS configuration
|
|
||||||
* @NM_CLIENT_PERMISSION_RELOAD: controls access to Reload.
|
|
||||||
* persistent hostname can be changed
|
|
||||||
* @NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK: permission to create checkpoints.
|
|
||||||
* @NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS: controls whether device
|
|
||||||
* statistics can be globally enabled or disabled
|
|
||||||
* @NM_CLIENT_PERMISSION_LAST: a reserved boundary value
|
|
||||||
*
|
|
||||||
* #NMClientPermission values indicate various permissions that NetworkManager
|
|
||||||
* clients can obtain to perform certain tasks on behalf of the current user.
|
|
||||||
**/
|
|
||||||
typedef enum {
|
|
||||||
NM_CLIENT_PERMISSION_NONE = 0,
|
|
||||||
NM_CLIENT_PERMISSION_ENABLE_DISABLE_NETWORK = 1,
|
|
||||||
NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIFI = 2,
|
|
||||||
NM_CLIENT_PERMISSION_ENABLE_DISABLE_WWAN = 3,
|
|
||||||
NM_CLIENT_PERMISSION_ENABLE_DISABLE_WIMAX = 4,
|
|
||||||
NM_CLIENT_PERMISSION_SLEEP_WAKE = 5,
|
|
||||||
NM_CLIENT_PERMISSION_NETWORK_CONTROL = 6,
|
|
||||||
NM_CLIENT_PERMISSION_WIFI_SHARE_PROTECTED = 7,
|
|
||||||
NM_CLIENT_PERMISSION_WIFI_SHARE_OPEN = 8,
|
|
||||||
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_SYSTEM = 9,
|
|
||||||
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_OWN = 10,
|
|
||||||
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_HOSTNAME = 11,
|
|
||||||
NM_CLIENT_PERMISSION_SETTINGS_MODIFY_GLOBAL_DNS = 12,
|
|
||||||
NM_CLIENT_PERMISSION_RELOAD = 13,
|
|
||||||
NM_CLIENT_PERMISSION_CHECKPOINT_ROLLBACK = 14,
|
|
||||||
NM_CLIENT_PERMISSION_ENABLE_DISABLE_STATISTICS = 15,
|
|
||||||
|
|
||||||
NM_CLIENT_PERMISSION_LAST = 15,
|
|
||||||
} NMClientPermission;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMClientPermissionResult:
|
|
||||||
* @NM_CLIENT_PERMISSION_RESULT_UNKNOWN: unknown or no authorization
|
|
||||||
* @NM_CLIENT_PERMISSION_RESULT_YES: the permission is available
|
|
||||||
* @NM_CLIENT_PERMISSION_RESULT_AUTH: authorization is necessary before the
|
|
||||||
* permission is available
|
|
||||||
* @NM_CLIENT_PERMISSION_RESULT_NO: permission to perform the operation is
|
|
||||||
* denied by system policy
|
|
||||||
*
|
|
||||||
* #NMClientPermissionResult values indicate what authorizations and permissions
|
|
||||||
* the user requires to obtain a given #NMClientPermission
|
|
||||||
**/
|
|
||||||
typedef enum {
|
|
||||||
NM_CLIENT_PERMISSION_RESULT_UNKNOWN = 0,
|
|
||||||
NM_CLIENT_PERMISSION_RESULT_YES,
|
|
||||||
NM_CLIENT_PERMISSION_RESULT_AUTH,
|
|
||||||
NM_CLIENT_PERMISSION_RESULT_NO
|
|
||||||
} NMClientPermissionResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMClientError:
|
|
||||||
* @NM_CLIENT_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_CLIENT_ERROR_MANAGER_NOT_RUNNING: an operation that requires NetworkManager
|
|
||||||
* failed because NetworkManager is not running
|
|
||||||
*
|
|
||||||
* Describes errors that may result from operations involving a #NMClient.
|
|
||||||
**/
|
|
||||||
typedef enum {
|
|
||||||
NM_CLIENT_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_CLIENT_ERROR_MANAGER_NOT_RUNNING, /*< nick=ManagerNotRunning >*/
|
|
||||||
} NMClientError;
|
|
||||||
|
|
||||||
#define NM_CLIENT_ERROR nm_client_error_quark ()
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GQuark nm_client_error_quark (void);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMClient;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*device_added) (NMClient *client, NMDevice *device);
|
|
||||||
void (*device_removed) (NMClient *client, NMDevice *device);
|
|
||||||
void (*permission_changed) (NMClient *client,
|
|
||||||
NMClientPermission permission,
|
|
||||||
NMClientPermissionResult result);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMClientClass;
|
|
||||||
|
|
||||||
GType nm_client_get_type (void);
|
|
||||||
|
|
||||||
NMClient *nm_client_new (void);
|
|
||||||
|
|
||||||
void nm_client_new_async (GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
NMClient *nm_client_new_finish (GAsyncResult *result,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
const GPtrArray *nm_client_get_devices (NMClient *client);
|
|
||||||
NM_AVAILABLE_IN_1_2
|
|
||||||
const GPtrArray *nm_client_get_all_devices(NMClient *client);
|
|
||||||
NMDevice *nm_client_get_device_by_path (NMClient *client, const char *object_path);
|
|
||||||
NMDevice *nm_client_get_device_by_iface (NMClient *client, const char *iface);
|
|
||||||
|
|
||||||
typedef void (*NMClientActivateFn) (NMClient *client,
|
|
||||||
NMActiveConnection *active_connection,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_client_activate_connection (NMClient *client,
|
|
||||||
NMConnection *connection,
|
|
||||||
NMDevice *device,
|
|
||||||
const char *specific_object,
|
|
||||||
NMClientActivateFn callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
typedef void (*NMClientAddActivateFn) (NMClient *client,
|
|
||||||
NMActiveConnection *connection,
|
|
||||||
const char *new_connection_path,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_client_add_and_activate_connection (NMClient *client,
|
|
||||||
NMConnection *partial,
|
|
||||||
NMDevice *device,
|
|
||||||
const char *specific_object,
|
|
||||||
NMClientAddActivateFn callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_client_deactivate_connection (NMClient *client, NMActiveConnection *active);
|
|
||||||
|
|
||||||
gboolean nm_client_networking_get_enabled (NMClient *client);
|
|
||||||
void nm_client_networking_set_enabled (NMClient *client, gboolean enabled);
|
|
||||||
|
|
||||||
gboolean nm_client_wireless_get_enabled (NMClient *client);
|
|
||||||
void nm_client_wireless_set_enabled (NMClient *client, gboolean enabled);
|
|
||||||
gboolean nm_client_wireless_hardware_get_enabled (NMClient *client);
|
|
||||||
|
|
||||||
gboolean nm_client_wwan_get_enabled (NMClient *client);
|
|
||||||
void nm_client_wwan_set_enabled (NMClient *client, gboolean enabled);
|
|
||||||
gboolean nm_client_wwan_hardware_get_enabled (NMClient *client);
|
|
||||||
|
|
||||||
gboolean nm_client_wimax_get_enabled (NMClient *client);
|
|
||||||
void nm_client_wimax_set_enabled (NMClient *client, gboolean enabled);
|
|
||||||
gboolean nm_client_wimax_hardware_get_enabled (NMClient *client);
|
|
||||||
|
|
||||||
const char *nm_client_get_version (NMClient *client);
|
|
||||||
NMState nm_client_get_state (NMClient *client);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
gboolean nm_client_get_startup (NMClient *client);
|
|
||||||
gboolean nm_client_get_manager_running (NMClient *client);
|
|
||||||
const GPtrArray *nm_client_get_active_connections (NMClient *client);
|
|
||||||
void nm_client_sleep (NMClient *client, gboolean sleep_);
|
|
||||||
|
|
||||||
NMClientPermissionResult nm_client_get_permission_result (NMClient *client,
|
|
||||||
NMClientPermission permission);
|
|
||||||
|
|
||||||
gboolean nm_client_get_logging (NMClient *client, char **level, char **domains, GError **error);
|
|
||||||
gboolean nm_client_set_logging (NMClient *client, const char *level, const char *domains, GError **error);
|
|
||||||
|
|
||||||
NMConnectivityState nm_client_get_connectivity (NMClient *client);
|
|
||||||
|
|
||||||
NMConnectivityState nm_client_check_connectivity (NMClient *client,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GError **error);
|
|
||||||
void nm_client_check_connectivity_async (NMClient *client,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
NMConnectivityState nm_client_check_connectivity_finish (NMClient *client,
|
|
||||||
GAsyncResult *result,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
NMActiveConnection *nm_client_get_primary_connection (NMClient *client);
|
|
||||||
NMActiveConnection *nm_client_get_activating_connection (NMClient *client);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_CLIENT_H */
|
|
||||||
|
|
@ -1,33 +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 2013 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DBUS_HELPERS_PRIVATE_H
|
|
||||||
#define NM_DBUS_HELPERS_PRIVATE_H
|
|
||||||
|
|
||||||
#include <dbus/dbus.h>
|
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
|
|
||||||
DBusGConnection *_nm_dbus_new_connection (GError **error);
|
|
||||||
|
|
||||||
DBusGProxy * _nm_dbus_new_proxy_for_connection (DBusGConnection *connection,
|
|
||||||
const char *path,
|
|
||||||
const char *interface);
|
|
||||||
|
|
||||||
#endif /* NM_DBUS_HELPERS_PRIVATE_H */
|
|
||||||
|
|
@ -1,47 +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 2013 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <dbus/dbus.h>
|
|
||||||
#include <dbus/dbus-glib-lowlevel.h>
|
|
||||||
|
|
||||||
#include "nm-dbus-helpers-private.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
|
|
||||||
DBusGConnection *
|
|
||||||
_nm_dbus_new_connection (GError **error)
|
|
||||||
{
|
|
||||||
DBusGConnection *connection = NULL;
|
|
||||||
|
|
||||||
if (connection == NULL)
|
|
||||||
connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, error);
|
|
||||||
|
|
||||||
return connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
DBusGProxy *
|
|
||||||
_nm_dbus_new_proxy_for_connection (DBusGConnection *connection,
|
|
||||||
const char *path,
|
|
||||||
const char *interface)
|
|
||||||
{
|
|
||||||
return dbus_g_proxy_new_for_name (connection, NM_DBUS_SERVICE, path, interface);
|
|
||||||
}
|
|
||||||
|
|
@ -1,245 +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.
|
|
||||||
*
|
|
||||||
* author: Pantelis Koukousoulas <pktoss@gmail.com>
|
|
||||||
* Copyright 2009 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include "nm-device-adsl.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
|
|
||||||
#include "nm-setting-adsl.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceAdsl, nm_device_adsl, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_ADSL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ADSL, NMDeviceAdslPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
gboolean carrier;
|
|
||||||
|
|
||||||
gboolean disposed;
|
|
||||||
} NMDeviceAdslPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_CARRIER,
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_adsl_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceAdsl if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceAdsl errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_adsl_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-adsl-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_adsl_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceAdsl.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_adsl_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_ADSL,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_adsl_get_carrier:
|
|
||||||
* @device: a #NMDeviceAdsl
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_adsl_get_carrier (NMDeviceAdsl *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_ADSL (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_ADSL_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingAdsl *s_adsl;
|
|
||||||
const char *ctype;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_ADSL_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_ADSL_ERROR, NM_DEVICE_ADSL_ERROR_NOT_ADSL_CONNECTION,
|
|
||||||
"The connection was not an ADSL connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_adsl = nm_connection_get_setting_adsl (connection);
|
|
||||||
if (!s_adsl) {
|
|
||||||
g_set_error (error, NM_DEVICE_ADSL_ERROR, NM_DEVICE_ADSL_ERROR_INVALID_ADSL_CONNECTION,
|
|
||||||
"The connection was not a valid ADSL connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_adsl_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceAdsl *device)
|
|
||||||
{
|
|
||||||
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_ADSL_CARRIER, &priv->carrier },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_adsl_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_ADSL);
|
|
||||||
register_properties (NM_DEVICE_ADSL (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceAdslPrivate *priv = NM_DEVICE_ADSL_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->disposed) {
|
|
||||||
G_OBJECT_CLASS (nm_device_adsl_parent_class)->dispose (object);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->disposed = TRUE;
|
|
||||||
|
|
||||||
g_object_unref (priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_adsl_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
G_OBJECT_CLASS (nm_device_adsl_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceAdsl *device = NM_DEVICE_ADSL (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_adsl_get_carrier (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (adsl_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (adsl_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
/**
|
|
||||||
* NMDeviceAdsl:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_ADSL_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,75 +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 2011 Pantelis Koukousoulas <pktoss@gmail.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_ADSL_H
|
|
||||||
#define NM_DEVICE_ADSL_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_ADSL (nm_device_adsl_get_type ())
|
|
||||||
#define NM_DEVICE_ADSL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_ADSL, NMDeviceAdsl))
|
|
||||||
#define NM_DEVICE_ADSL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_ADSL, NMDeviceAdslClass))
|
|
||||||
#define NM_IS_DEVICE_ADSL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_ADSL))
|
|
||||||
#define NM_IS_DEVICE_ADSL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_ADSL))
|
|
||||||
#define NM_DEVICE_ADSL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_ADSL, NMDeviceAdslClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceAdslError:
|
|
||||||
* @NM_DEVICE_ADSL_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_ADSL_ERROR_NOT_ADSL_CONNECTION: the connection was not of ADSL type
|
|
||||||
* @NM_DEVICE_ADSL_ERROR_INVALID_ADSL_CONNECTION: the ADSL connection was invalid
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_ADSL_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_ADSL_ERROR_NOT_ADSL_CONNECTION, /*< nick=NotAdslConnection >*/
|
|
||||||
NM_DEVICE_ADSL_ERROR_INVALID_ADSL_CONNECTION, /*< nick=InvalidAdslConnection >*/
|
|
||||||
} NMDeviceAdslError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_ADSL_ERROR nm_device_adsl_error_quark ()
|
|
||||||
GQuark nm_device_adsl_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_ADSL_CARRIER "carrier"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceAdsl;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceAdslClass;
|
|
||||||
|
|
||||||
GType nm_device_adsl_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_adsl_new (DBusGConnection *connection, const char *path);
|
|
||||||
gboolean nm_device_adsl_get_carrier (NMDeviceAdsl *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_ADSL_H */
|
|
||||||
|
|
@ -1,346 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-bond.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
#include "nm-device-bond.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-types.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceBond, nm_device_bond, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_BOND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BOND, NMDeviceBondPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
gboolean carrier;
|
|
||||||
GPtrArray *slaves;
|
|
||||||
} NMDeviceBondPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_CARRIER,
|
|
||||||
PROP_SLAVES,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bond_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceBond if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceBond errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_bond_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-bond-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bond_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceBond.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_bond_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_BOND,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bond_get_hw_address:
|
|
||||||
* @device: a #NMDeviceBond
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceBond
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_bond_get_hw_address (NMDeviceBond *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BOND (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BOND_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bond_get_carrier:
|
|
||||||
* @device: a #NMDeviceBond
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_bond_get_carrier (NMDeviceBond *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BOND (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BOND_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bond_get_slaves:
|
|
||||||
* @device: a #NMDeviceBond
|
|
||||||
*
|
|
||||||
* Gets the devices currently enslaved to @device.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMDevice): the #GPtrArray containing
|
|
||||||
* #NMDevices that are slaves of @device. This is the internal
|
|
||||||
* copy used by the device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.6.4
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_device_bond_get_slaves (NMDeviceBond *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BOND (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return handle_ptr_array_return (NM_DEVICE_BOND_GET_PRIVATE (device)->slaves);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingBond *s_bond;
|
|
||||||
const char *ctype, *dev_iface_name, *bond_iface_name;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_BOND_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_BOND_ERROR, NM_DEVICE_BOND_ERROR_NOT_BOND_CONNECTION,
|
|
||||||
"The connection was not a bond connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_bond = nm_connection_get_setting_bond (connection);
|
|
||||||
if (!s_bond) {
|
|
||||||
g_set_error (error, NM_DEVICE_BOND_ERROR, NM_DEVICE_BOND_ERROR_INVALID_BOND_CONNECTION,
|
|
||||||
"The connection was not a valid bond connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_iface_name = nm_device_get_iface (device);
|
|
||||||
bond_iface_name = nm_setting_bond_get_interface_name (s_bond);
|
|
||||||
if (g_strcmp0 (dev_iface_name, bond_iface_name) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_BOND_ERROR, NM_DEVICE_BOND_ERROR_INTERFACE_MISMATCH,
|
|
||||||
"The interfaces of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: check slaves? */
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_bond_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_BOND;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_hw_address (NMDevice *device)
|
|
||||||
{
|
|
||||||
return nm_device_bond_get_hw_address (NM_DEVICE_BOND (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_bond_init (NMDeviceBond *device)
|
|
||||||
{
|
|
||||||
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BOND);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDeviceBond *device)
|
|
||||||
{
|
|
||||||
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_BOND_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_BOND_CARRIER, &priv->carrier },
|
|
||||||
{ NM_DEVICE_BOND_SLAVES, &priv->slaves, NULL, NM_TYPE_DEVICE },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bond_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BOND);
|
|
||||||
register_properties (NM_DEVICE_BOND (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
if (priv->slaves) {
|
|
||||||
g_ptr_array_set_free_func (priv->slaves, g_object_unref);
|
|
||||||
g_ptr_array_free (priv->slaves, TRUE);
|
|
||||||
priv->slaves = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bond_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBondPrivate *priv = NM_DEVICE_BOND_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bond_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceBond *device = NM_DEVICE_BOND (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_bond_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_bond_get_carrier (device));
|
|
||||||
break;
|
|
||||||
case PROP_SLAVES:
|
|
||||||
g_value_set_boxed (value, nm_device_bond_get_slaves (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_bond_class_init (NMDeviceBondClass *bond_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (bond_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (bond_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (bond_class, sizeof (NMDeviceBondPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBond:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_BOND_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBond:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_BOND_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBond:slaves:
|
|
||||||
*
|
|
||||||
* The devices (#NMDevice) enslaved to the bond device.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SLAVES,
|
|
||||||
g_param_spec_boxed (NM_DEVICE_BOND_SLAVES, "", "",
|
|
||||||
NM_TYPE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_BOND_H
|
|
||||||
#define NM_DEVICE_BOND_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_BOND (nm_device_bond_get_type ())
|
|
||||||
#define NM_DEVICE_BOND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_BOND, NMDeviceBond))
|
|
||||||
#define NM_DEVICE_BOND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_BOND, NMDeviceBondClass))
|
|
||||||
#define NM_IS_DEVICE_BOND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_BOND))
|
|
||||||
#define NM_IS_DEVICE_BOND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BOND))
|
|
||||||
#define NM_DEVICE_BOND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BOND, NMDeviceBondClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBondError:
|
|
||||||
* @NM_DEVICE_BOND_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_BOND_ERROR_NOT_BOND_CONNECTION: the connection was not of bond type
|
|
||||||
* @NM_DEVICE_BOND_ERROR_INVALID_BOND_CONNECTION: the bond connection was invalid
|
|
||||||
* @NM_DEVICE_BOND_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_BOND_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_BOND_ERROR_NOT_BOND_CONNECTION, /*< nick=NotBondConnection >*/
|
|
||||||
NM_DEVICE_BOND_ERROR_INVALID_BOND_CONNECTION, /*< nick=InvalidBondConnection >*/
|
|
||||||
NM_DEVICE_BOND_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
|
|
||||||
} NMDeviceBondError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_BOND_ERROR nm_device_bond_error_quark ()
|
|
||||||
GQuark nm_device_bond_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_BOND_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_BOND_CARRIER "carrier"
|
|
||||||
#define NM_DEVICE_BOND_SLAVES "slaves"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceBond;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceBondClass;
|
|
||||||
|
|
||||||
GType nm_device_bond_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_bond_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char *nm_device_bond_get_hw_address (NMDeviceBond *device);
|
|
||||||
gboolean nm_device_bond_get_carrier (NMDeviceBond *device);
|
|
||||||
const GPtrArray *nm_device_bond_get_slaves (NMDeviceBond *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_BOND_H */
|
|
||||||
|
|
@ -1,358 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-bridge.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
#include "nm-device-bridge.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-types.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceBridge, nm_device_bridge, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgePrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
gboolean carrier;
|
|
||||||
GPtrArray *slaves;
|
|
||||||
} NMDeviceBridgePrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_CARRIER,
|
|
||||||
PROP_SLAVES,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bridge_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceBridge if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceBridge errors.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_bridge_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-bridge-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bridge_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceBridge.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_bridge_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_BRIDGE,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bridge_get_hw_address:
|
|
||||||
* @device: a #NMDeviceBridge
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceBridge
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_bridge_get_hw_address (NMDeviceBridge *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BRIDGE_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bridge_get_carrier:
|
|
||||||
* @device: a #NMDeviceBridge
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_bridge_get_carrier (NMDeviceBridge *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BRIDGE_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bridge_get_slaves:
|
|
||||||
* @device: a #NMDeviceBridge
|
|
||||||
*
|
|
||||||
* Gets the devices currently enslaved to @device.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMDevice): the #GPtrArray containing
|
|
||||||
* #NMDevices that are slaves of @device. This is the internal
|
|
||||||
* copy used by the device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_device_bridge_get_slaves (NMDeviceBridge *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BRIDGE (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return handle_ptr_array_return (NM_DEVICE_BRIDGE_GET_PRIVATE (device)->slaves);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingBridge *s_bridge;
|
|
||||||
const char *ctype, *dev_iface_name, *bridge_iface_name;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_BRIDGE_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_BRIDGE_ERROR, NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION,
|
|
||||||
"The connection was not a bridge connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_bridge = nm_connection_get_setting_bridge (connection);
|
|
||||||
if (!s_bridge) {
|
|
||||||
g_set_error (error, NM_DEVICE_BRIDGE_ERROR, NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION,
|
|
||||||
"The connection was not a valid bridge connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_iface_name = nm_device_get_iface (device);
|
|
||||||
bridge_iface_name = nm_setting_bridge_get_interface_name (s_bridge);
|
|
||||||
if (g_strcmp0 (dev_iface_name, bridge_iface_name) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_BRIDGE_ERROR, NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH,
|
|
||||||
"The interfaces of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: check ports? */
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_bridge_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_BRIDGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_hw_address (NMDevice *device)
|
|
||||||
{
|
|
||||||
return nm_device_bridge_get_hw_address (NM_DEVICE_BRIDGE (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_bridge_init (NMDeviceBridge *device)
|
|
||||||
{
|
|
||||||
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_BRIDGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDeviceBridge *device)
|
|
||||||
{
|
|
||||||
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_BRIDGE_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_BRIDGE_CARRIER, &priv->carrier },
|
|
||||||
{ NM_DEVICE_BRIDGE_SLAVES, &priv->slaves, NULL, NM_TYPE_DEVICE },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bridge_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BRIDGE);
|
|
||||||
register_properties (NM_DEVICE_BRIDGE (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
if (priv->slaves) {
|
|
||||||
g_ptr_array_set_free_func (priv->slaves, g_object_unref);
|
|
||||||
g_ptr_array_free (priv->slaves, TRUE);
|
|
||||||
priv->slaves = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bridge_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBridgePrivate *priv = NM_DEVICE_BRIDGE_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bridge_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceBridge *device = NM_DEVICE_BRIDGE (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_bridge_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_bridge_get_carrier (device));
|
|
||||||
break;
|
|
||||||
case PROP_SLAVES:
|
|
||||||
g_value_set_boxed (value, nm_device_bridge_get_slaves (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_bridge_class_init (NMDeviceBridgeClass *bridge_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (bridge_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (bridge_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (bridge_class, sizeof (NMDeviceBridgePrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBridge:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_BRIDGE_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBridge:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_BRIDGE_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBridge:slaves:
|
|
||||||
*
|
|
||||||
* The devices (#NMDevice) enslaved to the bridge device.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SLAVES,
|
|
||||||
g_param_spec_boxed (NM_DEVICE_BRIDGE_SLAVES, "", "",
|
|
||||||
NM_TYPE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,84 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_BRIDGE_H
|
|
||||||
#define NM_DEVICE_BRIDGE_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_BRIDGE (nm_device_bridge_get_type ())
|
|
||||||
#define NM_DEVICE_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridge))
|
|
||||||
#define NM_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass))
|
|
||||||
#define NM_IS_DEVICE_BRIDGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_BRIDGE))
|
|
||||||
#define NM_IS_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BRIDGE))
|
|
||||||
#define NM_DEVICE_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBridgeError:
|
|
||||||
* @NM_DEVICE_BRIDGE_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION: the connection was not of bridge type
|
|
||||||
* @NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION: the bridge connection was invalid
|
|
||||||
* @NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_BRIDGE_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_BRIDGE_ERROR_NOT_BRIDGE_CONNECTION, /*< nick=NotBridgeConnection >*/
|
|
||||||
NM_DEVICE_BRIDGE_ERROR_INVALID_BRIDGE_CONNECTION, /*< nick=InvalidBridgeConnection >*/
|
|
||||||
NM_DEVICE_BRIDGE_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
|
|
||||||
} NMDeviceBridgeError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_BRIDGE_ERROR nm_device_bridge_error_quark ()
|
|
||||||
GQuark nm_device_bridge_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_BRIDGE_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_BRIDGE_CARRIER "carrier"
|
|
||||||
#define NM_DEVICE_BRIDGE_SLAVES "slaves"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceBridge;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceBridgeClass;
|
|
||||||
|
|
||||||
GType nm_device_bridge_get_type (void);
|
|
||||||
|
|
||||||
GObject * nm_device_bridge_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char *nm_device_bridge_get_hw_address (NMDeviceBridge *device);
|
|
||||||
gboolean nm_device_bridge_get_carrier (NMDeviceBridge *device);
|
|
||||||
const GPtrArray *nm_device_bridge_get_slaves (NMDeviceBridge *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_BRIDGE_H */
|
|
||||||
|
|
@ -1,372 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-bluetooth.h"
|
|
||||||
|
|
||||||
#include "nm-device-bt.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceBt, nm_device_bt, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_BT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BT, NMDeviceBtPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
char *name;
|
|
||||||
guint32 bt_capabilities;
|
|
||||||
} NMDeviceBtPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_NAME,
|
|
||||||
PROP_BT_CAPABILITIES,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bt_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceBt if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceBt errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_bt_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-bt-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bt_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceBt.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_bt_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
return g_object_new (NM_TYPE_DEVICE_BT,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bt_get_hw_address:
|
|
||||||
* @device: a #NMDeviceBt
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceBt
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_bt_get_hw_address (NMDeviceBt *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BT (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BT_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bt_get_name:
|
|
||||||
* @device: a #NMDeviceBt
|
|
||||||
*
|
|
||||||
* Gets the name of the #NMDeviceBt.
|
|
||||||
*
|
|
||||||
* Returns: the name of the device
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_bt_get_name (NMDeviceBt *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BT (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BT_GET_PRIVATE (device)->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_bt_get_capabilities:
|
|
||||||
* @device: a #NMDeviceBt
|
|
||||||
*
|
|
||||||
* Returns the Bluetooth device's usable capabilities.
|
|
||||||
*
|
|
||||||
* Returns: a combination of #NMBluetoothCapabilities
|
|
||||||
**/
|
|
||||||
NMBluetoothCapabilities
|
|
||||||
nm_device_bt_get_capabilities (NMDeviceBt *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_BT (device), NM_BT_CAPABILITY_NONE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_BT_GET_PRIVATE (device)->bt_capabilities;
|
|
||||||
}
|
|
||||||
|
|
||||||
static NMBluetoothCapabilities
|
|
||||||
get_connection_bt_type (NMConnection *connection)
|
|
||||||
{
|
|
||||||
NMSettingBluetooth *s_bt;
|
|
||||||
const char *bt_type;
|
|
||||||
|
|
||||||
s_bt = nm_connection_get_setting_bluetooth (connection);
|
|
||||||
if (!s_bt)
|
|
||||||
return NM_BT_CAPABILITY_NONE;
|
|
||||||
|
|
||||||
bt_type = nm_setting_bluetooth_get_connection_type (s_bt);
|
|
||||||
g_assert (bt_type);
|
|
||||||
|
|
||||||
if (!strcmp (bt_type, NM_SETTING_BLUETOOTH_TYPE_DUN))
|
|
||||||
return NM_BT_CAPABILITY_DUN;
|
|
||||||
else if (!strcmp (bt_type, NM_SETTING_BLUETOOTH_TYPE_PANU))
|
|
||||||
return NM_BT_CAPABILITY_NAP;
|
|
||||||
|
|
||||||
return NM_BT_CAPABILITY_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingBluetooth *s_bt;
|
|
||||||
const char *ctype;
|
|
||||||
const GByteArray *mac;
|
|
||||||
const char *hw_str;
|
|
||||||
struct ether_addr *hw_mac;
|
|
||||||
NMBluetoothCapabilities dev_caps;
|
|
||||||
NMBluetoothCapabilities bt_type;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_BLUETOOTH_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_BT_ERROR, NM_DEVICE_BT_ERROR_NOT_BT_CONNECTION,
|
|
||||||
"The connection was not a Bluetooth connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_bt = nm_connection_get_setting_bluetooth (connection);
|
|
||||||
if (!s_bt) {
|
|
||||||
g_set_error (error, NM_DEVICE_BT_ERROR, NM_DEVICE_BT_ERROR_INVALID_BT_CONNECTION,
|
|
||||||
"The connection was not a valid Bluetooth connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check BT address */
|
|
||||||
hw_str = nm_device_bt_get_hw_address (NM_DEVICE_BT (device));
|
|
||||||
if (hw_str) {
|
|
||||||
hw_mac = ether_aton (hw_str);
|
|
||||||
if (!hw_mac) {
|
|
||||||
g_set_error (error, NM_DEVICE_BT_ERROR, NM_DEVICE_BT_ERROR_INVALID_DEVICE_MAC,
|
|
||||||
"Invalid device MAC address.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
mac = nm_setting_bluetooth_get_bdaddr (s_bt);
|
|
||||||
if (mac && hw_mac && memcmp (mac->data, hw_mac->ether_addr_octet, ETH_ALEN)) {
|
|
||||||
g_set_error (error, NM_DEVICE_BT_ERROR, NM_DEVICE_BT_ERROR_MAC_MISMATCH,
|
|
||||||
"The MACs of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_caps = nm_device_bt_get_capabilities (NM_DEVICE_BT (device));
|
|
||||||
bt_type = get_connection_bt_type (connection);
|
|
||||||
if (!(bt_type & dev_caps)) {
|
|
||||||
g_set_error (error, NM_DEVICE_BT_ERROR, NM_DEVICE_BT_ERROR_MISSING_DEVICE_CAPS,
|
|
||||||
"The device missed BT capabilities required by the connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_bt_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_BLUETOOTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceBt *device)
|
|
||||||
{
|
|
||||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_BT_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_BT_NAME, &priv->name },
|
|
||||||
{ NM_DEVICE_BT_CAPABILITIES, &priv->bt_capabilities },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bt_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_BLUETOOTH);
|
|
||||||
register_properties (NM_DEVICE_BT (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bt_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
g_free (priv->name);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_bt_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceBt *device = NM_DEVICE_BT (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_bt_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_NAME:
|
|
||||||
g_value_set_string (value, nm_device_bt_get_name (device));
|
|
||||||
break;
|
|
||||||
case PROP_BT_CAPABILITIES:
|
|
||||||
g_value_set_uint (value, nm_device_bt_get_capabilities (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_bt_class_init (NMDeviceBtClass *bt_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (bt_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (bt_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (bt_class, sizeof (NMDeviceBtPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBt:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_BT_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBt:name:
|
|
||||||
*
|
|
||||||
* The name of the bluetooth device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_NAME,
|
|
||||||
g_param_spec_string (NM_DEVICE_BT_NAME, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBt:bt-capabilities:
|
|
||||||
*
|
|
||||||
* The device's bluetooth capabilities, a combination of #NMBluetoothCapabilities.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_BT_CAPABILITIES,
|
|
||||||
g_param_spec_uint (NM_DEVICE_BT_CAPABILITIES, "", "",
|
|
||||||
NM_BT_CAPABILITY_NONE, G_MAXUINT32, NM_BT_CAPABILITY_NONE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -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 - 2012 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_BT_H
|
|
||||||
#define NM_DEVICE_BT_H
|
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_BT (nm_device_bt_get_type ())
|
|
||||||
#define NM_DEVICE_BT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_BT, NMDeviceBt))
|
|
||||||
#define NM_DEVICE_BT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_BT, NMDeviceBtClass))
|
|
||||||
#define NM_IS_DEVICE_BT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_BT))
|
|
||||||
#define NM_IS_DEVICE_BT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BT))
|
|
||||||
#define NM_DEVICE_BT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BT, NMDeviceBtClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceBtError:
|
|
||||||
* @NM_DEVICE_BT_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_BT_ERROR_NOT_BT_CONNECTION: the connection was not of bluetooth type
|
|
||||||
* @NM_DEVICE_BT_ERROR_INVALID_BT_CONNECTION: the bluetooth connection was invalid
|
|
||||||
* @NM_DEVICE_BT_ERROR_INVALID_DEVICE_MAC: the device's MAC was invalid
|
|
||||||
* @NM_DEVICE_BT_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
|
|
||||||
* @NM_DEVICE_BT_ERROR_MISSING_DEVICE_CAPS: the device missed required capabilities
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_BT_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_BT_ERROR_NOT_BT_CONNECTION, /*< nick=NotBtConnection >*/
|
|
||||||
NM_DEVICE_BT_ERROR_INVALID_BT_CONNECTION, /*< nick=InvalidBtConnection >*/
|
|
||||||
NM_DEVICE_BT_ERROR_INVALID_DEVICE_MAC, /*< nick=InvalidDeviceMac >*/
|
|
||||||
NM_DEVICE_BT_ERROR_MAC_MISMATCH, /*< nick=MacMismatch >*/
|
|
||||||
NM_DEVICE_BT_ERROR_MISSING_DEVICE_CAPS, /*< nick=MissingDeviceCaps >*/
|
|
||||||
} NMDeviceBtError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_BT_ERROR nm_device_bt_error_quark ()
|
|
||||||
GQuark nm_device_bt_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_BT_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_BT_NAME "name"
|
|
||||||
#define NM_DEVICE_BT_CAPABILITIES "bt-capabilities"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceBt;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceBtClass;
|
|
||||||
|
|
||||||
GType nm_device_bt_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_bt_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char *nm_device_bt_get_hw_address (NMDeviceBt *device);
|
|
||||||
|
|
||||||
const char *nm_device_bt_get_name (NMDeviceBt *device);
|
|
||||||
|
|
||||||
NMBluetoothCapabilities nm_device_bt_get_capabilities (NMDeviceBt *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_BT_H */
|
|
||||||
|
|
@ -1,391 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-wired.h"
|
|
||||||
#include "nm-setting-pppoe.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)
|
|
||||||
|
|
||||||
#define NM_DEVICE_ETHERNET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
char *perm_hw_address;
|
|
||||||
guint32 speed;
|
|
||||||
gboolean carrier;
|
|
||||||
} NMDeviceEthernetPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_PERM_HW_ADDRESS,
|
|
||||||
PROP_SPEED,
|
|
||||||
PROP_CARRIER,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_ethernet_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceEthernet if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceEthernet errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_ethernet_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-ethernet-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_ethernet_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceEthernet.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_ethernet_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_ETHERNET,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_ethernet_get_hw_address:
|
|
||||||
* @device: a #NMDeviceEthernet
|
|
||||||
*
|
|
||||||
* Gets the active hardware (MAC) address of the #NMDeviceEthernet
|
|
||||||
*
|
|
||||||
* Returns: the active hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_ethernet_get_hw_address (NMDeviceEthernet *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_ethernet_get_permanent_hw_address:
|
|
||||||
* @device: a #NMDeviceEthernet
|
|
||||||
*
|
|
||||||
* Gets the permanent hardware (MAC) address of the #NMDeviceEthernet
|
|
||||||
*
|
|
||||||
* Returns: the permanent hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->perm_hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_ethernet_get_speed:
|
|
||||||
* @device: a #NMDeviceEthernet
|
|
||||||
*
|
|
||||||
* Gets the speed of the #NMDeviceEthernet in Mbit/s.
|
|
||||||
*
|
|
||||||
* Returns: the speed of the device in Mbit/s
|
|
||||||
**/
|
|
||||||
guint32
|
|
||||||
nm_device_ethernet_get_speed (NMDeviceEthernet *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_ethernet_get_carrier:
|
|
||||||
* @device: a #NMDeviceEthernet
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_ethernet_get_carrier (NMDeviceEthernet *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_ETHERNET (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_ETHERNET_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingWired *s_wired;
|
|
||||||
const char *ctype;
|
|
||||||
gboolean is_pppoe = FALSE;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (!strcmp (ctype, NM_SETTING_PPPOE_SETTING_NAME))
|
|
||||||
is_pppoe = TRUE;
|
|
||||||
else if (strcmp (ctype, NM_SETTING_WIRED_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_ETHERNET_ERROR, NM_DEVICE_ETHERNET_ERROR_NOT_ETHERNET_CONNECTION,
|
|
||||||
"The connection was not a wired or PPPoE connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_wired = nm_connection_get_setting_wired (connection);
|
|
||||||
/* Wired setting optional for PPPoE */
|
|
||||||
if (!is_pppoe && !s_wired) {
|
|
||||||
g_set_error (error, NM_DEVICE_ETHERNET_ERROR, NM_DEVICE_ETHERNET_ERROR_INVALID_ETHERNET_CONNECTION,
|
|
||||||
"The connection was not a valid Ethernet connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (s_wired) {
|
|
||||||
const GByteArray *mac;
|
|
||||||
const char *perm_str;
|
|
||||||
struct ether_addr *perm_mac;
|
|
||||||
|
|
||||||
/* FIXME: filter using s390 subchannels when they are exported over the bus */
|
|
||||||
|
|
||||||
/* Check MAC address */
|
|
||||||
perm_str = nm_device_ethernet_get_permanent_hw_address (NM_DEVICE_ETHERNET (device));
|
|
||||||
if (perm_str) {
|
|
||||||
perm_mac = ether_aton (perm_str);
|
|
||||||
if (!perm_mac) {
|
|
||||||
g_set_error (error, NM_DEVICE_ETHERNET_ERROR, NM_DEVICE_ETHERNET_ERROR_INVALID_DEVICE_MAC,
|
|
||||||
"Invalid device MAC address.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
mac = nm_setting_wired_get_mac_address (s_wired);
|
|
||||||
if (mac && perm_mac && memcmp (mac->data, perm_mac->ether_addr_octet, ETH_ALEN)) {
|
|
||||||
g_set_error (error, NM_DEVICE_ETHERNET_ERROR, NM_DEVICE_ETHERNET_ERROR_MAC_MISMATCH,
|
|
||||||
"The MACs of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_ethernet_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_WIRED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceEthernet *device)
|
|
||||||
{
|
|
||||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_ETHERNET_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS, &priv->perm_hw_address },
|
|
||||||
{ NM_DEVICE_ETHERNET_SPEED, &priv->speed },
|
|
||||||
{ NM_DEVICE_ETHERNET_CARRIER, &priv->carrier },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_WIRED);
|
|
||||||
register_properties (NM_DEVICE_ETHERNET (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceEthernetPrivate *priv = NM_DEVICE_ETHERNET_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
g_free (priv->perm_hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_ethernet_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceEthernet *device = NM_DEVICE_ETHERNET (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_ethernet_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_PERM_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_ethernet_get_permanent_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_SPEED:
|
|
||||||
g_value_set_uint (value, nm_device_ethernet_get_speed (device));
|
|
||||||
break;
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_ethernet_get_carrier (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_ethernet_class_init (NMDeviceEthernetClass *eth_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (eth_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (eth_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (eth_class, sizeof (NMDeviceEthernetPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceEthernet:hw-address:
|
|
||||||
*
|
|
||||||
* The active hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_ETHERNET_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceEthernet:perm-hw-address:
|
|
||||||
*
|
|
||||||
* The permanent hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_PERM_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceEthernet:speed:
|
|
||||||
*
|
|
||||||
* The speed of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SPEED,
|
|
||||||
g_param_spec_uint (NM_DEVICE_ETHERNET_SPEED, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceEthernet:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_ETHERNET_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,87 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_ETHERNET_H
|
|
||||||
#define NM_DEVICE_ETHERNET_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_ETHERNET (nm_device_ethernet_get_type ())
|
|
||||||
#define NM_DEVICE_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernet))
|
|
||||||
#define NM_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass))
|
|
||||||
#define NM_IS_DEVICE_ETHERNET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_ETHERNET))
|
|
||||||
#define NM_IS_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_ETHERNET))
|
|
||||||
#define NM_DEVICE_ETHERNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceEthernetError:
|
|
||||||
* @NM_DEVICE_ETHERNET_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_ETHERNET_ERROR_NOT_ETHERNET_CONNECTION: the connection was not of Ethernet or PPPoE type
|
|
||||||
* @NM_DEVICE_ETHERNET_ERROR_INVALID_ETHERNET_CONNECTION: the Ethernet connection was invalid
|
|
||||||
* @NM_DEVICE_ETHERNET_ERROR_INVALID_DEVICE_MAC: the device's MAC was invalid
|
|
||||||
* @NM_DEVICE_ETHERNET_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_ETHERNET_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_ETHERNET_ERROR_NOT_ETHERNET_CONNECTION, /*< nick=NotEthernetConnection >*/
|
|
||||||
NM_DEVICE_ETHERNET_ERROR_INVALID_ETHERNET_CONNECTION, /*< nick=InvalidEthernetConnection >*/
|
|
||||||
NM_DEVICE_ETHERNET_ERROR_INVALID_DEVICE_MAC, /*< nick=InvalidDeviceMac >*/
|
|
||||||
NM_DEVICE_ETHERNET_ERROR_MAC_MISMATCH, /*< nick=MacMismatch >*/
|
|
||||||
} NMDeviceEthernetError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_ETHERNET_ERROR nm_device_ethernet_error_quark ()
|
|
||||||
GQuark nm_device_ethernet_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_ETHERNET_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS "perm-hw-address"
|
|
||||||
#define NM_DEVICE_ETHERNET_SPEED "speed"
|
|
||||||
#define NM_DEVICE_ETHERNET_CARRIER "carrier"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceEthernet;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceEthernetClass;
|
|
||||||
|
|
||||||
GType nm_device_ethernet_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_ethernet_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char * nm_device_ethernet_get_hw_address (NMDeviceEthernet *device);
|
|
||||||
const char * nm_device_ethernet_get_permanent_hw_address (NMDeviceEthernet *device);
|
|
||||||
guint32 nm_device_ethernet_get_speed (NMDeviceEthernet *device);
|
|
||||||
gboolean nm_device_ethernet_get_carrier (NMDeviceEthernet *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_ETHERNET_H */
|
|
||||||
|
|
@ -1,310 +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 2013 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-device-generic.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-setting-generic.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceGeneric, nm_device_generic, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_GENERIC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_GENERIC, NMDeviceGenericPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
char *type_description;
|
|
||||||
} NMDeviceGenericPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_TYPE_DESCRIPTION,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_generic_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceGeneric if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceGeneric errors.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_generic_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-generic-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_generic_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceGeneric.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_generic_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_GENERIC,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_generic_get_hw_address:
|
|
||||||
* @device: a #NMDeviceGeneric
|
|
||||||
*
|
|
||||||
* Gets the hardware address of the #NMDeviceGeneric
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_generic_get_hw_address (NMDeviceGeneric *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_GENERIC (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_GENERIC_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_type_description (NMDevice *device)
|
|
||||||
{
|
|
||||||
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (device);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return priv->type_description;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_hw_address (NMDevice *device)
|
|
||||||
{
|
|
||||||
return nm_device_generic_get_hw_address (NM_DEVICE_GENERIC (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
const char *ctype, *iface_name;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_GENERIC_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_GENERIC_ERROR, NM_DEVICE_GENERIC_ERROR_NOT_GENERIC_CONNECTION,
|
|
||||||
"The connection was not a generic connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
iface_name = nm_setting_connection_get_interface_name (s_con);
|
|
||||||
if (!iface_name) {
|
|
||||||
g_set_error (error, NM_DEVICE_GENERIC_ERROR, NM_DEVICE_GENERIC_ERROR_MISSING_INTERFACE_NAME,
|
|
||||||
"The connection did not specify an interface name.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_generic_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceGeneric *device)
|
|
||||||
{
|
|
||||||
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_GENERIC_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_GENERIC_TYPE_DESCRIPTION, &priv->type_description },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
_device_type_to_interface (NMDeviceType type)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
case NM_DEVICE_TYPE_GENERIC:
|
|
||||||
return NM_DBUS_INTERFACE_DEVICE_GENERIC;
|
|
||||||
case NM_DEVICE_TYPE_TUN:
|
|
||||||
return NM_DBUS_INTERFACE_DEVICE_TUN;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
|
|
||||||
NMDeviceType type;
|
|
||||||
DBusGConnection *connection;
|
|
||||||
const char *path, *interface;
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_generic_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
g_object_get (object,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, &connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, &path,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
type = _nm_device_type_for_path (connection, path);
|
|
||||||
interface = _device_type_to_interface (type);
|
|
||||||
|
|
||||||
if (interface) {
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, interface);
|
|
||||||
register_properties (NM_DEVICE_GENERIC (object));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_generic_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
g_free (priv->type_description);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_generic_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceGenericPrivate *priv = NM_DEVICE_GENERIC_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
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);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_generic_class_init (NMDeviceGenericClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
|
|
||||||
|
|
||||||
g_type_class_add_private (klass, sizeof (NMDeviceGenericPrivate));
|
|
||||||
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
|
|
||||||
device_class->get_type_description = get_type_description;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceGeneric:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_GENERIC_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceGeneric:type-description:
|
|
||||||
*
|
|
||||||
* A description of the specific type of device this is, or %NULL
|
|
||||||
* if not known.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_TYPE_DESCRIPTION,
|
|
||||||
g_param_spec_string (NM_DEVICE_GENERIC_TYPE_DESCRIPTION, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,79 +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 2013 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_GENERIC_H
|
|
||||||
#define NM_DEVICE_GENERIC_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_GENERIC (nm_device_generic_get_type ())
|
|
||||||
#define NM_DEVICE_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_GENERIC, NMDeviceGeneric))
|
|
||||||
#define NM_DEVICE_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_GENERIC, NMDeviceGenericClass))
|
|
||||||
#define NM_IS_DEVICE_GENERIC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_GENERIC))
|
|
||||||
#define NM_IS_DEVICE_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_GENERIC))
|
|
||||||
#define NM_DEVICE_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_GENERIC, NMDeviceGenericClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceGenericError:
|
|
||||||
* @NM_DEVICE_GENERIC_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_GENERIC_ERROR_NOT_GENERIC_CONNECTION: the connection was not of generic type
|
|
||||||
* @NM_DEVICE_GENERIC_ERROR_MISSING_INTERFACE_NAME: the connection did not specify the interface name
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_GENERIC_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_GENERIC_ERROR_NOT_GENERIC_CONNECTION, /*< nick=NotGenericConnection >*/
|
|
||||||
NM_DEVICE_GENERIC_ERROR_MISSING_INTERFACE_NAME, /*< nick=MissingInterfaceName >*/
|
|
||||||
} NMDeviceGenericError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_GENERIC_ERROR nm_device_generic_error_quark ()
|
|
||||||
GQuark nm_device_generic_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_GENERIC_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_GENERIC_TYPE_DESCRIPTION "type-description"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceGeneric;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceGenericClass;
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GType nm_device_generic_get_type (void);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GObject *nm_device_generic_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char *nm_device_generic_get_hw_address (NMDeviceGeneric *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_GENERIC_H */
|
|
||||||
|
|
@ -1,310 +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 2011 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <linux/if_infiniband.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-infiniband.h"
|
|
||||||
#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)
|
|
||||||
|
|
||||||
#define NM_DEVICE_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
gboolean carrier;
|
|
||||||
} NMDeviceInfinibandPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_CARRIER,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_infiniband_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceInfiniband if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceInfiniband errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_infiniband_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-infiniband-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_infiniband_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceInfiniband.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_infiniband_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_INFINIBAND,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_infiniband_get_hw_address:
|
|
||||||
* @device: a #NMDeviceInfiniband
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceInfiniband
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_infiniband_get_hw_address (NMDeviceInfiniband *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_infiniband_get_carrier:
|
|
||||||
* @device: a #NMDeviceInfiniband
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_infiniband_get_carrier (NMDeviceInfiniband *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_INFINIBAND (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_INFINIBAND_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingInfiniband *s_infiniband;
|
|
||||||
const char *ctype, *hwaddr_str;
|
|
||||||
const GByteArray *mac;
|
|
||||||
guint8 *hwaddr, hwaddr_buf[INFINIBAND_ALEN];
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_INFINIBAND_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_INFINIBAND_ERROR, NM_DEVICE_INFINIBAND_ERROR_NOT_INFINIBAND_CONNECTION,
|
|
||||||
"The connection was not a InfiniBand connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_infiniband = nm_connection_get_setting_infiniband (connection);
|
|
||||||
if (!s_infiniband) {
|
|
||||||
g_set_error (error, NM_DEVICE_INFINIBAND_ERROR, NM_DEVICE_INFINIBAND_ERROR_INVALID_INFINIBAND_CONNECTION,
|
|
||||||
"The connection was not a valid InfiniBand connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
hwaddr_str = nm_device_infiniband_get_hw_address (NM_DEVICE_INFINIBAND (device));
|
|
||||||
if (hwaddr_str) {
|
|
||||||
hwaddr = nm_utils_hwaddr_aton (hwaddr_str, ARPHRD_INFINIBAND, hwaddr_buf);
|
|
||||||
if (!hwaddr) {
|
|
||||||
g_set_error (error, NM_DEVICE_INFINIBAND_ERROR, NM_DEVICE_INFINIBAND_ERROR_INVALID_DEVICE_MAC,
|
|
||||||
"Invalid device MAC address.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
mac = nm_setting_infiniband_get_mac_address (s_infiniband);
|
|
||||||
|
|
||||||
/* We only match against the last 8 bytes */
|
|
||||||
if (mac && hwaddr && memcmp (mac->data + INFINIBAND_ALEN - 8, hwaddr + INFINIBAND_ALEN - 8, 8)) {
|
|
||||||
g_set_error (error, NM_DEVICE_INFINIBAND_ERROR, NM_DEVICE_INFINIBAND_ERROR_MAC_MISMATCH,
|
|
||||||
"The MACs of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_INFINIBAND;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceInfiniband *device)
|
|
||||||
{
|
|
||||||
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_INFINIBAND_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_INFINIBAND_CARRIER, &priv->carrier },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_infiniband_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_INFINIBAND);
|
|
||||||
register_properties (NM_DEVICE_INFINIBAND (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_infiniband_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceInfinibandPrivate *priv = NM_DEVICE_INFINIBAND_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_infiniband_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceInfiniband *device = NM_DEVICE_INFINIBAND (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_infiniband_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_infiniband_get_carrier (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_infiniband_class_init (NMDeviceInfinibandClass *ib_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (ib_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (ib_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (ib_class, sizeof (NMDeviceInfinibandPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceInfiniband:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_INFINIBAND_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceInfiniband:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_INFINIBAND_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,82 +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 2011 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_INFINIBAND_H
|
|
||||||
#define NM_DEVICE_INFINIBAND_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_INFINIBAND (nm_device_infiniband_get_type ())
|
|
||||||
#define NM_DEVICE_INFINIBAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfiniband))
|
|
||||||
#define NM_DEVICE_INFINIBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandClass))
|
|
||||||
#define NM_IS_DEVICE_INFINIBAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_INFINIBAND))
|
|
||||||
#define NM_IS_DEVICE_INFINIBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_INFINIBAND))
|
|
||||||
#define NM_DEVICE_INFINIBAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceInfinibandError:
|
|
||||||
* @NM_DEVICE_INFINIBAND_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_INFINIBAND_ERROR_NOT_INFINIBAND_CONNECTION: the connection was not of InfiniBand type
|
|
||||||
* @NM_DEVICE_INFINIBAND_ERROR_INVALID_INFINIBAND_CONNECTION: the InfiniBand connection was invalid
|
|
||||||
* @NM_DEVICE_INFINIBAND_ERROR_INVALID_DEVICE_MAC: the device's MAC was invalid
|
|
||||||
* @NM_DEVICE_INFINIBAND_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_INFINIBAND_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_INFINIBAND_ERROR_NOT_INFINIBAND_CONNECTION, /*< nick=NotInfinibandConnection >*/
|
|
||||||
NM_DEVICE_INFINIBAND_ERROR_INVALID_INFINIBAND_CONNECTION, /*< nick=InvalidInfinibandConnection >*/
|
|
||||||
NM_DEVICE_INFINIBAND_ERROR_INVALID_DEVICE_MAC, /*< nick=InvalidDeviceMac >*/
|
|
||||||
NM_DEVICE_INFINIBAND_ERROR_MAC_MISMATCH, /*< nick=MacMismatch >*/
|
|
||||||
} NMDeviceInfinibandError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_INFINIBAND_ERROR nm_device_infiniband_error_quark ()
|
|
||||||
GQuark nm_device_infiniband_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_INFINIBAND_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_INFINIBAND_CARRIER "carrier"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceInfiniband;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceInfinibandClass;
|
|
||||||
|
|
||||||
GType nm_device_infiniband_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_infiniband_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char * nm_device_infiniband_get_hw_address (NMDeviceInfiniband *device);
|
|
||||||
gboolean nm_device_infiniband_get_carrier (NMDeviceInfiniband *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_INFINIBAND_H */
|
|
||||||
|
|
@ -1,290 +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 2011 - 2012 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-gsm.h"
|
|
||||||
#include "nm-setting-cdma.h"
|
|
||||||
|
|
||||||
#include "nm-device-modem.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceModem, nm_device_modem, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_MODEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_MODEM, NMDeviceModemPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
NMDeviceModemCapabilities caps;
|
|
||||||
NMDeviceModemCapabilities current_caps;
|
|
||||||
} NMDeviceModemPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_MODEM_CAPS,
|
|
||||||
PROP_CURRENT_CAPS,
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_modem_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceModem if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceModem errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_modem_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-modem-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_modem_get_modem_capabilities:
|
|
||||||
* @self: a #NMDeviceModem
|
|
||||||
*
|
|
||||||
* Returns a bitfield of the generic access technology families the modem
|
|
||||||
* supports. Not all capabilities are available concurrently however; some
|
|
||||||
* may require a firmware reload or reinitialization.
|
|
||||||
*
|
|
||||||
* Returns: the generic access technology families the modem supports
|
|
||||||
**/
|
|
||||||
NMDeviceModemCapabilities
|
|
||||||
nm_device_modem_get_modem_capabilities (NMDeviceModem *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_MODEM (self), NM_DEVICE_MODEM_CAPABILITY_NONE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_MODEM_GET_PRIVATE (self)->caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_modem_get_current_capabilities:
|
|
||||||
* @self: a #NMDeviceModem
|
|
||||||
*
|
|
||||||
* Returns a bitfield of the generic access technology families the modem
|
|
||||||
* supports without a firmware reload or reinitialization. This value
|
|
||||||
* represents the network types the modem can immediately connect to.
|
|
||||||
*
|
|
||||||
* Returns: the generic access technology families the modem supports without
|
|
||||||
* a firmware reload or other reinitialization
|
|
||||||
**/
|
|
||||||
NMDeviceModemCapabilities
|
|
||||||
nm_device_modem_get_current_capabilities (NMDeviceModem *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_MODEM (self), NM_DEVICE_MODEM_CAPABILITY_NONE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_MODEM_GET_PRIVATE (self)->current_caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_type_description (NMDevice *device)
|
|
||||||
{
|
|
||||||
NMDeviceModemCapabilities caps;
|
|
||||||
|
|
||||||
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
|
|
||||||
if (caps & NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS)
|
|
||||||
return "gsm";
|
|
||||||
else if (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)
|
|
||||||
return "cdma";
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define MODEM_CAPS_3GPP(caps) (caps & (NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS | \
|
|
||||||
NM_DEVICE_MODEM_CAPABILITY_LTE))
|
|
||||||
|
|
||||||
#define MODEM_CAPS_3GPP2(caps) (caps & (NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO))
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingGsm *s_gsm;
|
|
||||||
NMSettingCdma *s_cdma;
|
|
||||||
const char *ctype;
|
|
||||||
NMDeviceModemCapabilities current_caps;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if ( strcmp (ctype, NM_SETTING_GSM_SETTING_NAME) != 0
|
|
||||||
&& strcmp (ctype, NM_SETTING_CDMA_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_MODEM_ERROR, NM_DEVICE_MODEM_ERROR_NOT_MODEM_CONNECTION,
|
|
||||||
"The connection was not a modem connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_gsm = nm_connection_get_setting_gsm (connection);
|
|
||||||
s_cdma = nm_connection_get_setting_cdma (connection);
|
|
||||||
if (!s_cdma && !s_gsm) {
|
|
||||||
g_set_error (error, NM_DEVICE_MODEM_ERROR, NM_DEVICE_MODEM_ERROR_INVALID_MODEM_CONNECTION,
|
|
||||||
"The connection was not a valid modem connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
current_caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
|
|
||||||
if (!(s_gsm && MODEM_CAPS_3GPP (current_caps)) && !(s_cdma && MODEM_CAPS_3GPP2 (current_caps))) {
|
|
||||||
g_set_error (error, NM_DEVICE_MODEM_ERROR, NM_DEVICE_MODEM_ERROR_MISSING_DEVICE_CAPS,
|
|
||||||
"The device missed capabilities required by the GSM/CDMA connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_modem_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
NMDeviceModemCapabilities caps;
|
|
||||||
|
|
||||||
caps = nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device));
|
|
||||||
if (caps & (NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS | NM_DEVICE_MODEM_CAPABILITY_LTE))
|
|
||||||
return NM_TYPE_SETTING_GSM;
|
|
||||||
else if (caps & NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)
|
|
||||||
return NM_TYPE_SETTING_CDMA;
|
|
||||||
else
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceModem *device)
|
|
||||||
{
|
|
||||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_MODEM_MODEM_CAPABILITIES, &priv->caps },
|
|
||||||
{ NM_DEVICE_MODEM_CURRENT_CAPABILITIES, &priv->current_caps },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_modem_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_MODEM);
|
|
||||||
register_properties (NM_DEVICE_MODEM (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceModem *self = NM_DEVICE_MODEM (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_MODEM_CAPS:
|
|
||||||
g_value_set_uint (value, nm_device_modem_get_modem_capabilities (self));
|
|
||||||
break;
|
|
||||||
case PROP_CURRENT_CAPS:
|
|
||||||
g_value_set_uint (value, nm_device_modem_get_current_capabilities (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceModemPrivate *priv = NM_DEVICE_MODEM_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_modem_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_modem_class_init (NMDeviceModemClass *modem_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (modem_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (modem_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (modem_class, sizeof (NMDeviceModemPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
|
|
||||||
device_class->get_type_description = get_type_description;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceModem:modem-capabilities:
|
|
||||||
*
|
|
||||||
* The generic family of access technologies the modem supports. Not all
|
|
||||||
* capabilities are available at the same time however; some modems require
|
|
||||||
* a firmware reload or other reinitialization to switch between eg
|
|
||||||
* CDMA/EVDO and GSM/UMTS.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_MODEM_CAPS,
|
|
||||||
g_param_spec_uint (NM_DEVICE_MODEM_MODEM_CAPABILITIES, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceModem:current-capabilities:
|
|
||||||
*
|
|
||||||
* The generic family of access technologies the modem currently supports
|
|
||||||
* without a firmware reload or reinitialization.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CURRENT_CAPS,
|
|
||||||
g_param_spec_uint (NM_DEVICE_MODEM_CURRENT_CAPABILITIES, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,79 +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 2011 - 2012 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_MODEM_H
|
|
||||||
#define NM_DEVICE_MODEM_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_MODEM (nm_device_modem_get_type ())
|
|
||||||
#define NM_DEVICE_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_MODEM, NMDeviceModem))
|
|
||||||
#define NM_DEVICE_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_MODEM, NMDeviceModemClass))
|
|
||||||
#define NM_IS_DEVICE_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_MODEM))
|
|
||||||
#define NM_IS_DEVICE_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_MODEM))
|
|
||||||
#define NM_DEVICE_MODEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_MODEM, NMDeviceModemClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceModemError:
|
|
||||||
* @NM_DEVICE_MODEM_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_MODEM_ERROR_NOT_MODEM_CONNECTION: the connection was not of modem type
|
|
||||||
* @NM_DEVICE_MODEM_ERROR_INVALID_MODEM_CONNECTION: the modem connection was invalid
|
|
||||||
* @NM_DEVICE_MODEM_ERROR_MISSING_DEVICE_CAPS: the device missed required capabilities
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_MODEM_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_MODEM_ERROR_NOT_MODEM_CONNECTION, /*< nick=NotModemConnection >*/
|
|
||||||
NM_DEVICE_MODEM_ERROR_INVALID_MODEM_CONNECTION, /*< nick=InvalidModemConnection >*/
|
|
||||||
NM_DEVICE_MODEM_ERROR_MISSING_DEVICE_CAPS, /*< nick=MissingDeviceCaps >*/
|
|
||||||
} NMDeviceModemError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_MODEM_ERROR nm_device_modem_error_quark ()
|
|
||||||
GQuark nm_device_modem_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_MODEM_MODEM_CAPABILITIES "modem-capabilities"
|
|
||||||
#define NM_DEVICE_MODEM_CURRENT_CAPABILITIES "current-capabilities"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceModem;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceModemClass;
|
|
||||||
|
|
||||||
GType nm_device_modem_get_type (void);
|
|
||||||
|
|
||||||
NMDeviceModemCapabilities nm_device_modem_get_modem_capabilities (NMDeviceModem *self);
|
|
||||||
NMDeviceModemCapabilities nm_device_modem_get_current_capabilities (NMDeviceModem *self);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_MODEM_H */
|
|
||||||
|
|
@ -1,325 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#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"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceOlpcMesh, nm_device_olpc_mesh, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_OLPC_MESH_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_OLPC_MESH, NMDeviceOlpcMeshPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
NMDeviceWifi *companion;
|
|
||||||
guint32 active_channel;
|
|
||||||
} NMDeviceOlpcMeshPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_COMPANION,
|
|
||||||
PROP_ACTIVE_CHANNEL,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_olpc_mesh_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceOlpcMesh if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceOlpcMesh errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_olpc_mesh_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-olpc-mesh-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_olpc_mesh_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceOlpcMesh.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new OlpcMesh device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_olpc_mesh_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_OLPC_MESH,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_olpc_mesh_get_hw_address:
|
|
||||||
* @device: a #NMDeviceOlpcMesh
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceOlpcMesh
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_olpc_mesh_get_hw_address (NMDeviceOlpcMesh *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_OLPC_MESH (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_olpc_mesh_get_companion:
|
|
||||||
* @device: a #NMDeviceOlpcMesh
|
|
||||||
*
|
|
||||||
* Gets the companion device of the #NMDeviceOlpcMesh.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the companion of the device of %NULL
|
|
||||||
**/
|
|
||||||
NMDeviceWifi *
|
|
||||||
nm_device_olpc_mesh_get_companion (NMDeviceOlpcMesh *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_OLPC_MESH (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->companion;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_olpc_mesh_get_active_channel:
|
|
||||||
* @device: a #NMDeviceOlpcMesh
|
|
||||||
*
|
|
||||||
* Returns the active channel of the #NMDeviceOlpcMesh device.
|
|
||||||
*
|
|
||||||
* Returns: active channel of the device
|
|
||||||
**/
|
|
||||||
guint32
|
|
||||||
nm_device_olpc_mesh_get_active_channel (NMDeviceOlpcMesh *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_OLPC_MESH (device), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_OLPC_MESH_GET_PRIVATE (device)->active_channel;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_hw_address (NMDevice *device)
|
|
||||||
{
|
|
||||||
return nm_device_olpc_mesh_get_hw_address (NM_DEVICE_OLPC_MESH (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingOlpcMesh *s_olpc_mesh;
|
|
||||||
const char *ctype;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_OLPC_MESH_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_OLPC_MESH_ERROR, NM_DEVICE_OLPC_MESH_ERROR_NOT_OLPC_MESH_CONNECTION,
|
|
||||||
"The connection was not a Olpc Mesh connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_olpc_mesh = nm_connection_get_setting_olpc_mesh (connection);
|
|
||||||
if (!s_olpc_mesh) {
|
|
||||||
g_set_error (error, NM_DEVICE_OLPC_MESH_ERROR, NM_DEVICE_OLPC_MESH_ERROR_INVALID_OLPC_MESH_CONNECTION,
|
|
||||||
"The connection was not a valid Olpc Mesh connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_olpc_mesh_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceOlpcMesh *device)
|
|
||||||
{
|
|
||||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_OLPC_MESH_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_OLPC_MESH_COMPANION, &priv->companion, NULL, NM_TYPE_DEVICE_WIFI },
|
|
||||||
{ NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL, &priv->active_channel },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_OLPC_MESH);
|
|
||||||
register_properties (NM_DEVICE_OLPC_MESH (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->companion);
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceOlpcMeshPrivate *priv = NM_DEVICE_OLPC_MESH_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_olpc_mesh_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceOlpcMesh *device = NM_DEVICE_OLPC_MESH (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_olpc_mesh_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_COMPANION:
|
|
||||||
g_value_set_object (value, nm_device_olpc_mesh_get_companion (device));
|
|
||||||
break;
|
|
||||||
case PROP_ACTIVE_CHANNEL:
|
|
||||||
g_value_set_uint (value, nm_device_olpc_mesh_get_active_channel (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *olpc_mesh_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (olpc_mesh_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (olpc_mesh_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (olpc_mesh_class, sizeof (NMDeviceOlpcMeshPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceOlpcMesh:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_OLPC_MESH_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceOlpcMesh:companion:
|
|
||||||
*
|
|
||||||
* The companion device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_COMPANION,
|
|
||||||
g_param_spec_object (NM_DEVICE_OLPC_MESH_COMPANION, "", "",
|
|
||||||
NM_TYPE_DEVICE_WIFI,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceOlpcMesh:active-channel:
|
|
||||||
*
|
|
||||||
* The device's active channel.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ACTIVE_CHANNEL,
|
|
||||||
g_param_spec_uint (NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_OLPC_MESH_H
|
|
||||||
#define NM_DEVICE_OLPC_MESH_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-device-wifi.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_OLPC_MESH (nm_device_olpc_mesh_get_type ())
|
|
||||||
#define NM_DEVICE_OLPC_MESH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_OLPC_MESH, NMDeviceOlpcMesh))
|
|
||||||
#define NM_DEVICE_OLPC_MESH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_OLPC_MESH, NMDeviceOlpcMeshClass))
|
|
||||||
#define NM_IS_DEVICE_OLPC_MESH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_OLPC_MESH))
|
|
||||||
#define NM_IS_DEVICE_OLPC_MESH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_OLPC_MESH))
|
|
||||||
#define NM_DEVICE_OLPC_MESH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_OLPC_MESH, NMDeviceOlpcMeshClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceOlpcMeshError:
|
|
||||||
* @NM_DEVICE_OLPC_MESH_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_OLPC_MESH_ERROR_NOT_OLPC_MESH_CONNECTION: the connection was not of Olpc Mesh type
|
|
||||||
* @NM_DEVICE_OLPC_MESH_ERROR_INVALID_OLPC_MESH_CONNECTION: the Olpc Mesh connection was invalid
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_OLPC_MESH_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_OLPC_MESH_ERROR_NOT_OLPC_MESH_CONNECTION, /*< nick=NotOlpcMeshConnection >*/
|
|
||||||
NM_DEVICE_OLPC_MESH_ERROR_INVALID_OLPC_MESH_CONNECTION, /*< nick=InvalidOlpcMeshConnection >*/
|
|
||||||
} NMDeviceOlpcMeshError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_OLPC_MESH_ERROR nm_device_olpc_mesh_error_quark ()
|
|
||||||
GQuark nm_device_olpc_mesh_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_OLPC_MESH_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_OLPC_MESH_COMPANION "companion"
|
|
||||||
#define NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL "active-channel"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceOlpcMesh;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceOlpcMeshClass;
|
|
||||||
|
|
||||||
GType nm_device_olpc_mesh_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_olpc_mesh_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char *nm_device_olpc_mesh_get_hw_address (NMDeviceOlpcMesh *device);
|
|
||||||
NMDeviceWifi *nm_device_olpc_mesh_get_companion (NMDeviceOlpcMesh *device);
|
|
||||||
guint32 nm_device_olpc_mesh_get_active_channel (NMDeviceOlpcMesh *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_OLPC_MESH_H */
|
|
||||||
|
|
@ -1,27 +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);
|
|
||||||
NMDeviceType _nm_device_type_for_path (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_PRIVATE_H */
|
|
||||||
|
|
@ -1,352 +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 2013 Jiri Pirko <jiri@resnulli.us>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-team.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
#include "nm-device-team.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-types.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceTeam, nm_device_team, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_TEAM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_TEAM, NMDeviceTeamPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
gboolean carrier;
|
|
||||||
GPtrArray *slaves;
|
|
||||||
} NMDeviceTeamPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_CARRIER,
|
|
||||||
PROP_SLAVES,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_team_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceTeam if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceTeam errors.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_team_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-team-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_team_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceTeam.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_team_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_TEAM,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_team_get_hw_address:
|
|
||||||
* @device: a #NMDeviceTeam
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceTeam
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_team_get_hw_address (NMDeviceTeam *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_TEAM_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_team_get_carrier:
|
|
||||||
* @device: a #NMDeviceTeam
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_team_get_carrier (NMDeviceTeam *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_TEAM_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_team_get_slaves:
|
|
||||||
* @device: a #NMDeviceTeam
|
|
||||||
*
|
|
||||||
* Gets the devices currently enslaved to @device.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMDevice): the #GPtrArray containing
|
|
||||||
* #NMDevices that are slaves of @device. This is the internal
|
|
||||||
* copy used by the device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_device_team_get_slaves (NMDeviceTeam *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_TEAM (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return handle_ptr_array_return (NM_DEVICE_TEAM_GET_PRIVATE (device)->slaves);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_hw_address (NMDevice *device)
|
|
||||||
{
|
|
||||||
return nm_device_team_get_hw_address (NM_DEVICE_TEAM (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingTeam *s_team;
|
|
||||||
const char *ctype, *dev_iface_name, *team_iface_name;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_TEAM_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_TEAM_ERROR, NM_DEVICE_TEAM_ERROR_NOT_TEAM_CONNECTION,
|
|
||||||
"The connection was not a team connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_team = nm_connection_get_setting_team (connection);
|
|
||||||
if (!s_team) {
|
|
||||||
g_set_error (error, NM_DEVICE_TEAM_ERROR, NM_DEVICE_TEAM_ERROR_INVALID_TEAM_CONNECTION,
|
|
||||||
"The connection was not a valid team connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_iface_name = nm_device_get_iface (device);
|
|
||||||
team_iface_name = nm_setting_team_get_interface_name (s_team);
|
|
||||||
if (g_strcmp0 (dev_iface_name, team_iface_name) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_TEAM_ERROR, NM_DEVICE_TEAM_ERROR_INTERFACE_MISMATCH,
|
|
||||||
"The interfaces of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: check slaves? */
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_team_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_TEAM;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_team_init (NMDeviceTeam *device)
|
|
||||||
{
|
|
||||||
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_TEAM);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDeviceTeam *device)
|
|
||||||
{
|
|
||||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_TEAM_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_TEAM_CARRIER, &priv->carrier },
|
|
||||||
{ NM_DEVICE_TEAM_SLAVES, &priv->slaves, NULL, NM_TYPE_DEVICE },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_team_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_TEAM);
|
|
||||||
register_properties (NM_DEVICE_TEAM (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
if (priv->slaves) {
|
|
||||||
g_ptr_array_set_free_func (priv->slaves, g_object_unref);
|
|
||||||
g_ptr_array_free (priv->slaves, TRUE);
|
|
||||||
priv->slaves = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_team_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_team_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceTeam *device = NM_DEVICE_TEAM (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_team_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_team_get_carrier (device));
|
|
||||||
break;
|
|
||||||
case PROP_SLAVES:
|
|
||||||
g_value_set_boxed (value, nm_device_team_get_slaves (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_team_class_init (NMDeviceTeamClass *team_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (team_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (team_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (team_class, sizeof (NMDeviceTeamPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceTeam:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_TEAM_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceTeam:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_TEAM_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceTeam:slaves:
|
|
||||||
*
|
|
||||||
* The devices (#NMDevice) enslaved to the team device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SLAVES,
|
|
||||||
g_param_spec_boxed (NM_DEVICE_TEAM_SLAVES, "", "",
|
|
||||||
NM_TYPE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,85 +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 2013 Jiri Pirko <jiri@resnulli.us>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_TEAM_H
|
|
||||||
#define NM_DEVICE_TEAM_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_TEAM (nm_device_team_get_type ())
|
|
||||||
#define NM_DEVICE_TEAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_TEAM, NMDeviceTeam))
|
|
||||||
#define NM_DEVICE_TEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_TEAM, NMDeviceTeamClass))
|
|
||||||
#define NM_IS_DEVICE_TEAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_TEAM))
|
|
||||||
#define NM_IS_DEVICE_TEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_TEAM))
|
|
||||||
#define NM_DEVICE_TEAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_TEAM, NMDeviceTeamClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceTeamError:
|
|
||||||
* @NM_DEVICE_TEAM_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_TEAM_ERROR_NOT_TEAM_CONNECTION: the connection was not of team type
|
|
||||||
* @NM_DEVICE_TEAM_ERROR_INVALID_TEAM_CONNECTION: the team connection was invalid
|
|
||||||
* @NM_DEVICE_TEAM_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_TEAM_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_TEAM_ERROR_NOT_TEAM_CONNECTION, /*< nick=NotTeamConnection >*/
|
|
||||||
NM_DEVICE_TEAM_ERROR_INVALID_TEAM_CONNECTION, /*< nick=InvalidTeamConnection >*/
|
|
||||||
NM_DEVICE_TEAM_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
|
|
||||||
} NMDeviceTeamError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_TEAM_ERROR nm_device_team_error_quark ()
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GQuark nm_device_team_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_TEAM_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_TEAM_CARRIER "carrier"
|
|
||||||
#define NM_DEVICE_TEAM_SLAVES "slaves"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceTeam;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceTeamClass;
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GType nm_device_team_get_type (void);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GObject *nm_device_team_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char *nm_device_team_get_hw_address (NMDeviceTeam *device);
|
|
||||||
gboolean nm_device_team_get_carrier (NMDeviceTeam *device);
|
|
||||||
const GPtrArray *nm_device_team_get_slaves (NMDeviceTeam *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_TEAM_H */
|
|
||||||
|
|
@ -1,390 +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 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-vlan.h"
|
|
||||||
#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)
|
|
||||||
|
|
||||||
#define NM_DEVICE_VLAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_VLAN, NMDeviceVlanPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
gboolean carrier;
|
|
||||||
NMDevice *parent;
|
|
||||||
guint vlan_id;
|
|
||||||
} NMDeviceVlanPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_CARRIER,
|
|
||||||
PROP_PARENT,
|
|
||||||
PROP_VLAN_ID,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_vlan_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceVlan if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceVlan errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_vlan_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-vlan-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_vlan_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceVlan.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_vlan_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_VLAN,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_vlan_get_hw_address:
|
|
||||||
* @device: a #NMDeviceVlan
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceVlan
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_vlan_get_hw_address (NMDeviceVlan *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_vlan_get_carrier:
|
|
||||||
* @device: a #NMDeviceVlan
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the device has carrier
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_device_vlan_get_carrier (NMDeviceVlan *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_VLAN_GET_PRIVATE (device)->carrier;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_vlan_get_parent:
|
|
||||||
* @device: a #NMDeviceVlan
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the device's parent device
|
|
||||||
*
|
|
||||||
* Since: 1.0
|
|
||||||
**/
|
|
||||||
NMDevice *
|
|
||||||
nm_device_vlan_get_parent (NMDeviceVlan *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_VLAN_GET_PRIVATE (device)->parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_vlan_get_vlan_id:
|
|
||||||
* @device: a #NMDeviceVlan
|
|
||||||
*
|
|
||||||
* Returns: the device's VLAN ID
|
|
||||||
**/
|
|
||||||
guint
|
|
||||||
nm_device_vlan_get_vlan_id (NMDeviceVlan *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_VLAN (device), FALSE);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_VLAN_GET_PRIVATE (device)->vlan_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingVlan *s_vlan;
|
|
||||||
NMSettingWired *s_wired;
|
|
||||||
const char *ctype, *dev_iface_name, *vlan_iface_name;
|
|
||||||
const GByteArray *mac_address;
|
|
||||||
char *mac_address_str;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_VLAN_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_NOT_VLAN_CONNECTION,
|
|
||||||
"The connection was not a VLAN connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_vlan = nm_connection_get_setting_vlan (connection);
|
|
||||||
if (!s_vlan) {
|
|
||||||
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_INVALID_VLAN_CONNECTION,
|
|
||||||
"The connection was not a valid VLAN connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nm_setting_vlan_get_id (s_vlan) != nm_device_vlan_get_vlan_id (NM_DEVICE_VLAN (device))) {
|
|
||||||
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_ID_MISMATCH,
|
|
||||||
"The VLAN identifiers of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_iface_name = nm_device_get_iface (device);
|
|
||||||
vlan_iface_name = nm_setting_vlan_get_interface_name (s_vlan);
|
|
||||||
if (vlan_iface_name && g_strcmp0 (dev_iface_name, vlan_iface_name) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_INTERFACE_MISMATCH,
|
|
||||||
"The interfaces of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_wired = nm_connection_get_setting_wired (connection);
|
|
||||||
if (s_wired)
|
|
||||||
mac_address = nm_setting_wired_get_mac_address (s_wired);
|
|
||||||
else
|
|
||||||
mac_address = NULL;
|
|
||||||
if (mac_address) {
|
|
||||||
mac_address_str = nm_utils_hwaddr_ntoa_len (mac_address->data, mac_address->len);
|
|
||||||
if (!g_strcmp0 (mac_address_str, NM_DEVICE_VLAN_GET_PRIVATE (device)->hw_address)) {
|
|
||||||
g_set_error (error, NM_DEVICE_VLAN_ERROR, NM_DEVICE_VLAN_ERROR_MAC_MISMATCH,
|
|
||||||
"The hardware address of the device and the connection didn't match.");
|
|
||||||
}
|
|
||||||
g_free (mac_address_str);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_vlan_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_VLAN;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
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
|
|
||||||
register_properties (NMDeviceVlan *device)
|
|
||||||
{
|
|
||||||
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_VLAN_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_VLAN_CARRIER, &priv->carrier },
|
|
||||||
{ NM_DEVICE_VLAN_PARENT, &priv->parent, NULL, NM_TYPE_DEVICE },
|
|
||||||
{ NM_DEVICE_VLAN_VLAN_ID, &priv->vlan_id },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_vlan_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_VLAN);
|
|
||||||
register_properties (NM_DEVICE_VLAN (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_clear_object (&priv->parent);
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_vlan_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceVlanPrivate *priv = NM_DEVICE_VLAN_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_vlan_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceVlan *device = NM_DEVICE_VLAN (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_vlan_get_hw_address (device));
|
|
||||||
break;
|
|
||||||
case PROP_CARRIER:
|
|
||||||
g_value_set_boolean (value, nm_device_vlan_get_carrier (device));
|
|
||||||
break;
|
|
||||||
case PROP_PARENT:
|
|
||||||
g_value_set_object (value, nm_device_vlan_get_parent (device));
|
|
||||||
break;
|
|
||||||
case PROP_VLAN_ID:
|
|
||||||
g_value_set_uint (value, nm_device_vlan_get_vlan_id (device));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_vlan_class_init (NMDeviceVlanClass *vlan_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (vlan_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (vlan_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (vlan_class, sizeof (NMDeviceVlanPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceVlan:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_VLAN_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceVlan:carrier:
|
|
||||||
*
|
|
||||||
* Whether the device has carrier.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CARRIER,
|
|
||||||
g_param_spec_boolean (NM_DEVICE_VLAN_CARRIER, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceVlan:parent:
|
|
||||||
*
|
|
||||||
* The devices's parent device.
|
|
||||||
*
|
|
||||||
* Since: 1.0
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_PARENT,
|
|
||||||
g_param_spec_object (NM_DEVICE_VLAN_PARENT, "", "",
|
|
||||||
NM_TYPE_DEVICE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceVlan:vlan-id:
|
|
||||||
*
|
|
||||||
* The device's VLAN ID.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_VLAN_ID,
|
|
||||||
g_param_spec_uint (NM_DEVICE_VLAN_VLAN_ID, "", "",
|
|
||||||
0, 4095, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
@ -1,89 +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 2012 - 2014 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_VLAN_H
|
|
||||||
#define NM_DEVICE_VLAN_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_VLAN (nm_device_vlan_get_type ())
|
|
||||||
#define NM_DEVICE_VLAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_VLAN, NMDeviceVlan))
|
|
||||||
#define NM_DEVICE_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_VLAN, NMDeviceVlanClass))
|
|
||||||
#define NM_IS_DEVICE_VLAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_VLAN))
|
|
||||||
#define NM_IS_DEVICE_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_VLAN))
|
|
||||||
#define NM_DEVICE_VLAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_VLAN, NMDeviceVlanClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceVlanError:
|
|
||||||
* @NM_DEVICE_VLAN_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_VLAN_ERROR_NOT_VLAN_CONNECTION: the connection was not of VLAN type
|
|
||||||
* @NM_DEVICE_VLAN_ERROR_INVALID_VLAN_CONNECTION: the VLAN connection was invalid
|
|
||||||
* @NM_DEVICE_VLAN_ERROR_ID_MISMATCH: the VLAN identifiers of the connection and the device mismatched
|
|
||||||
* @NM_DEVICE_VLAN_ERROR_INTERFACE_MISMATCH: the interfaces of the connection and the device mismatched
|
|
||||||
* @NM_DEVICE_VLAN_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_VLAN_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_VLAN_ERROR_NOT_VLAN_CONNECTION, /*< nick=NotVlanConnection >*/
|
|
||||||
NM_DEVICE_VLAN_ERROR_INVALID_VLAN_CONNECTION, /*< nick=InvalidVlanConnection >*/
|
|
||||||
NM_DEVICE_VLAN_ERROR_ID_MISMATCH, /*< nick=IdMismatch >*/
|
|
||||||
NM_DEVICE_VLAN_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
|
|
||||||
NM_DEVICE_VLAN_ERROR_MAC_MISMATCH, /*< nick=MacMismatch >*/
|
|
||||||
} NMDeviceVlanError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_VLAN_ERROR nm_device_vlan_error_quark ()
|
|
||||||
GQuark nm_device_vlan_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_VLAN_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_VLAN_CARRIER "carrier"
|
|
||||||
#define NM_DEVICE_VLAN_PARENT "parent"
|
|
||||||
#define NM_DEVICE_VLAN_VLAN_ID "vlan-id"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceVlan;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceVlanClass;
|
|
||||||
|
|
||||||
GType nm_device_vlan_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_vlan_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char * nm_device_vlan_get_hw_address (NMDeviceVlan *device);
|
|
||||||
gboolean nm_device_vlan_get_carrier (NMDeviceVlan *device);
|
|
||||||
NM_AVAILABLE_IN_1_0
|
|
||||||
NMDevice * nm_device_vlan_get_parent (NMDeviceVlan *device);
|
|
||||||
guint nm_device_vlan_get_vlan_id (NMDeviceVlan *device);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_VLAN_H */
|
|
||||||
|
|
@ -1,837 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-wireless.h"
|
|
||||||
#include "nm-setting-wireless-security.h"
|
|
||||||
|
|
||||||
#include "nm-device-wifi.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-object-cache.h"
|
|
||||||
#include "nm-dbus-glib-types.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceWifi, nm_device_wifi, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_WIFI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_WIFI, NMDeviceWifiPrivate))
|
|
||||||
|
|
||||||
void _nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device, gboolean enabled);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceWifi *device;
|
|
||||||
NMDeviceWifiRequestScanFn callback;
|
|
||||||
gpointer user_data;
|
|
||||||
} RequestScanInfo;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
char *perm_hw_address;
|
|
||||||
NM80211Mode mode;
|
|
||||||
guint32 rate;
|
|
||||||
NMAccessPoint *active_ap;
|
|
||||||
NMDeviceWifiCapabilities wireless_caps;
|
|
||||||
GPtrArray *aps;
|
|
||||||
|
|
||||||
DBusGProxyCall *scan_call;
|
|
||||||
RequestScanInfo *scan_info;
|
|
||||||
} NMDeviceWifiPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_PERM_HW_ADDRESS,
|
|
||||||
PROP_MODE,
|
|
||||||
PROP_BITRATE,
|
|
||||||
PROP_ACTIVE_ACCESS_POINT,
|
|
||||||
PROP_WIRELESS_CAPABILITIES,
|
|
||||||
PROP_ACCESS_POINTS,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
ACCESS_POINT_ADDED,
|
|
||||||
ACCESS_POINT_REMOVED,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceWifi if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceWifi errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_wifi_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-wifi-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceWifi.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new Wi-Fi device
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_wifi_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_WIFI,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_hw_address:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets the actual hardware (MAC) address of the #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Returns: the actual hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_wifi_get_hw_address (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_WIFI_GET_PRIVATE (device)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_permanent_hw_address:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets the permanent hardware (MAC) address of the #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Returns: the permanent hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_wifi_get_permanent_hw_address (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_WIFI_GET_PRIVATE (device)->perm_hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_mode:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets the #NMDeviceWifi mode.
|
|
||||||
*
|
|
||||||
* Returns: the mode
|
|
||||||
**/
|
|
||||||
NM80211Mode
|
|
||||||
nm_device_wifi_get_mode (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_WIFI_GET_PRIVATE (device)->mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_bitrate:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets the bit rate of the #NMDeviceWifi in kbit/s.
|
|
||||||
*
|
|
||||||
* Returns: the bit rate (kbit/s)
|
|
||||||
**/
|
|
||||||
guint32
|
|
||||||
nm_device_wifi_get_bitrate (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
NMDeviceState state;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), 0);
|
|
||||||
|
|
||||||
state = nm_device_get_state (NM_DEVICE (device));
|
|
||||||
switch (state) {
|
|
||||||
case NM_DEVICE_STATE_IP_CONFIG:
|
|
||||||
case NM_DEVICE_STATE_IP_CHECK:
|
|
||||||
case NM_DEVICE_STATE_SECONDARIES:
|
|
||||||
case NM_DEVICE_STATE_ACTIVATED:
|
|
||||||
case NM_DEVICE_STATE_DEACTIVATING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_WIFI_GET_PRIVATE (device)->rate;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_capabilities:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets the Wi-Fi capabilities of the #NMDeviceWifi.
|
|
||||||
*
|
|
||||||
* Returns: the capabilities
|
|
||||||
**/
|
|
||||||
NMDeviceWifiCapabilities
|
|
||||||
nm_device_wifi_get_capabilities (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_WIFI_GET_PRIVATE (device)->wireless_caps;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_active_access_point:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets the active #NMAccessPoint.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the access point or %NULL if none is active
|
|
||||||
**/
|
|
||||||
NMAccessPoint *
|
|
||||||
nm_device_wifi_get_active_access_point (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
NMDeviceState state;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);
|
|
||||||
|
|
||||||
state = nm_device_get_state (NM_DEVICE (device));
|
|
||||||
switch (state) {
|
|
||||||
case NM_DEVICE_STATE_PREPARE:
|
|
||||||
case NM_DEVICE_STATE_CONFIG:
|
|
||||||
case NM_DEVICE_STATE_NEED_AUTH:
|
|
||||||
case NM_DEVICE_STATE_IP_CONFIG:
|
|
||||||
case NM_DEVICE_STATE_IP_CHECK:
|
|
||||||
case NM_DEVICE_STATE_SECONDARIES:
|
|
||||||
case NM_DEVICE_STATE_ACTIVATED:
|
|
||||||
case NM_DEVICE_STATE_DEACTIVATING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return NM_DEVICE_WIFI_GET_PRIVATE (device)->active_ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_access_points:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
*
|
|
||||||
* Gets all the scanned access points of the #NMDeviceWifi.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMAccessPoint): a #GPtrArray containing all the
|
|
||||||
* scanned #NMAccessPoints.
|
|
||||||
* The returned array is owned by the client and should not be modified.
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_device_wifi_get_access_points (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return handle_ptr_array_return (NM_DEVICE_WIFI_GET_PRIVATE (device)->aps);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_get_access_point_by_path:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
* @path: the object path of the access point
|
|
||||||
*
|
|
||||||
* Gets a #NMAccessPoint by path.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the access point or %NULL if none is found.
|
|
||||||
**/
|
|
||||||
NMAccessPoint *
|
|
||||||
nm_device_wifi_get_access_point_by_path (NMDeviceWifi *device,
|
|
||||||
const char *path)
|
|
||||||
{
|
|
||||||
const GPtrArray *aps;
|
|
||||||
int i;
|
|
||||||
NMAccessPoint *ap = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIFI (device), NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
aps = nm_device_wifi_get_access_points (device);
|
|
||||||
if (!aps)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < aps->len; i++) {
|
|
||||||
NMAccessPoint *candidate = g_ptr_array_index (aps, i);
|
|
||||||
if (!strcmp (nm_object_get_path (NM_OBJECT (candidate)), path)) {
|
|
||||||
ap = candidate;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return ap;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
request_scan_cb (DBusGProxy *proxy,
|
|
||||||
DBusGProxyCall *call,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
RequestScanInfo *info = user_data;
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (info->device);
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_INVALID);
|
|
||||||
|
|
||||||
if (info->callback)
|
|
||||||
info->callback (info->device, error, info->user_data);
|
|
||||||
|
|
||||||
g_clear_error (&error);
|
|
||||||
g_slice_free (RequestScanInfo, info);
|
|
||||||
|
|
||||||
priv->scan_call = NULL;
|
|
||||||
priv->scan_info = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wifi_request_scan_simple:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
* @callback: (scope async) (allow-none): the function to call when the call is done
|
|
||||||
* @user_data: (closure): user data to pass to the callback function
|
|
||||||
*
|
|
||||||
* Request NM to scan for access points on the #NMDeviceWifi. This function only
|
|
||||||
* instructs NM to perform scanning. Use nm_device_wifi_get_access_points()
|
|
||||||
* to get available access points.
|
|
||||||
*
|
|
||||||
* Since: 0.9.8
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
nm_device_wifi_request_scan_simple (NMDeviceWifi *device,
|
|
||||||
NMDeviceWifiRequestScanFn callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
RequestScanInfo *info;
|
|
||||||
GHashTable *options;
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device);
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_DEVICE_WIFI (device));
|
|
||||||
|
|
||||||
/* If a scan is in progress, just return */
|
|
||||||
if (priv->scan_call)
|
|
||||||
return;
|
|
||||||
|
|
||||||
options = g_hash_table_new (g_str_hash, g_str_equal);
|
|
||||||
|
|
||||||
info = g_slice_new0 (RequestScanInfo);
|
|
||||||
info->device = device;
|
|
||||||
info->callback = callback;
|
|
||||||
info->user_data = user_data;
|
|
||||||
|
|
||||||
priv->scan_info = info;
|
|
||||||
priv->scan_call = dbus_g_proxy_begin_call (NM_DEVICE_WIFI_GET_PRIVATE (device)->proxy, "RequestScan",
|
|
||||||
request_scan_cb, info, NULL,
|
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT, options,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
|
|
||||||
g_hash_table_unref (options);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clean_up_aps (NMDeviceWifi *self, gboolean notify)
|
|
||||||
{
|
|
||||||
NMDeviceWifiPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_DEVICE_WIFI (self));
|
|
||||||
|
|
||||||
priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (priv->active_ap) {
|
|
||||||
g_object_unref (priv->active_ap);
|
|
||||||
priv->active_ap = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->aps) {
|
|
||||||
while (priv->aps->len) {
|
|
||||||
NMAccessPoint *ap = NM_ACCESS_POINT (g_ptr_array_index (priv->aps, 0));
|
|
||||||
|
|
||||||
if (notify)
|
|
||||||
g_signal_emit (self, signals[ACCESS_POINT_REMOVED], 0, ap);
|
|
||||||
g_ptr_array_remove (priv->aps, ap);
|
|
||||||
g_object_unref (ap);
|
|
||||||
}
|
|
||||||
g_ptr_array_free (priv->aps, TRUE);
|
|
||||||
priv->aps = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* _nm_device_wifi_set_wireless_enabled:
|
|
||||||
* @device: a #NMDeviceWifi
|
|
||||||
* @enabled: %TRUE to enable the device
|
|
||||||
*
|
|
||||||
* Enables or disables the wireless device.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
_nm_device_wifi_set_wireless_enabled (NMDeviceWifi *device,
|
|
||||||
gboolean enabled)
|
|
||||||
{
|
|
||||||
g_return_if_fail (NM_IS_DEVICE_WIFI (device));
|
|
||||||
|
|
||||||
if (!enabled)
|
|
||||||
clean_up_aps (device, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WPA_CAPS (NM_WIFI_DEVICE_CAP_CIPHER_TKIP | \
|
|
||||||
NM_WIFI_DEVICE_CAP_CIPHER_CCMP | \
|
|
||||||
NM_WIFI_DEVICE_CAP_WPA | \
|
|
||||||
NM_WIFI_DEVICE_CAP_RSN)
|
|
||||||
|
|
||||||
#define RSN_CAPS (NM_WIFI_DEVICE_CAP_CIPHER_CCMP | NM_WIFI_DEVICE_CAP_RSN)
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
has_proto (NMSettingWirelessSecurity *s_wsec, const char *proto)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < nm_setting_wireless_security_get_num_protos (s_wsec); i++) {
|
|
||||||
if (g_strcmp0 (proto, nm_setting_wireless_security_get_proto (s_wsec, i)) == 0)
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingWireless *s_wifi;
|
|
||||||
NMSettingWirelessSecurity *s_wsec;
|
|
||||||
const char *ctype;
|
|
||||||
const GByteArray *mac;
|
|
||||||
const char *hw_str;
|
|
||||||
struct ether_addr *hw_mac;
|
|
||||||
NMDeviceWifiCapabilities wifi_caps;
|
|
||||||
const char *key_mgmt;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_WIRELESS_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_NOT_WIFI_CONNECTION,
|
|
||||||
"The connection was not a Wi-Fi connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_wifi = nm_connection_get_setting_wireless (connection);
|
|
||||||
if (!s_wifi) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_INVALID_WIFI_CONNECTION,
|
|
||||||
"The connection was not a valid Wi-Fi connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check MAC address */
|
|
||||||
hw_str = nm_device_wifi_get_permanent_hw_address (NM_DEVICE_WIFI (device));
|
|
||||||
if (hw_str) {
|
|
||||||
hw_mac = ether_aton (hw_str);
|
|
||||||
if (!hw_mac) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_INVALID_DEVICE_MAC,
|
|
||||||
"Invalid device MAC address.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
mac = nm_setting_wireless_get_mac_address (s_wifi);
|
|
||||||
if (mac && hw_mac && memcmp (mac->data, hw_mac->ether_addr_octet, ETH_ALEN)) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_MAC_MISMATCH,
|
|
||||||
"The MACs of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check device capabilities; we assume all devices can do WEP at least */
|
|
||||||
wifi_caps = nm_device_wifi_get_capabilities (NM_DEVICE_WIFI (device));
|
|
||||||
|
|
||||||
s_wsec = nm_connection_get_setting_wireless_security (connection);
|
|
||||||
if (s_wsec) {
|
|
||||||
/* Connection has security, verify it against the device's capabilities */
|
|
||||||
key_mgmt = nm_setting_wireless_security_get_key_mgmt (s_wsec);
|
|
||||||
if ( !g_strcmp0 (key_mgmt, "wpa-none")
|
|
||||||
|| !g_strcmp0 (key_mgmt, "wpa-psk")
|
|
||||||
|| !g_strcmp0 (key_mgmt, "wpa-eap")) {
|
|
||||||
|
|
||||||
/* Is device only WEP capable? */
|
|
||||||
if (!(wifi_caps & WPA_CAPS)) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_WPA_CAPS,
|
|
||||||
"The device missed WPA capabilities required by the connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure WPA2/RSN-only connections don't get chosen for WPA-only cards */
|
|
||||||
if (has_proto (s_wsec, "rsn") && !has_proto (s_wsec, "wpa") && !(wifi_caps & RSN_CAPS)) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_RSN_CAPS,
|
|
||||||
"The device missed WPA2/RSN capabilities required by the connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_wifi_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_WIRELESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
get_hw_address (NMDevice *device)
|
|
||||||
{
|
|
||||||
return nm_device_wifi_get_hw_address (NM_DEVICE_WIFI (device));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_wifi_init (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
_nm_device_set_device_type (NM_DEVICE (device), NM_DEVICE_TYPE_WIFI);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceWifi *self = NM_DEVICE_WIFI (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_wifi_get_hw_address (self));
|
|
||||||
break;
|
|
||||||
case PROP_PERM_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_wifi_get_permanent_hw_address (self));
|
|
||||||
break;
|
|
||||||
case PROP_MODE:
|
|
||||||
g_value_set_uint (value, nm_device_wifi_get_mode (self));
|
|
||||||
break;
|
|
||||||
case PROP_BITRATE:
|
|
||||||
g_value_set_uint (value, nm_device_wifi_get_bitrate (self));
|
|
||||||
break;
|
|
||||||
case PROP_ACTIVE_ACCESS_POINT:
|
|
||||||
g_value_set_object (value, nm_device_wifi_get_active_access_point (self));
|
|
||||||
break;
|
|
||||||
case PROP_WIRELESS_CAPABILITIES:
|
|
||||||
g_value_set_uint (value, nm_device_wifi_get_capabilities (self));
|
|
||||||
break;
|
|
||||||
case PROP_ACCESS_POINTS:
|
|
||||||
g_value_set_boxed (value, nm_device_wifi_get_access_points (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMDeviceWifi *self = NM_DEVICE_WIFI (device);
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
switch (nm_device_get_state (device)) {
|
|
||||||
case NM_DEVICE_STATE_UNKNOWN:
|
|
||||||
case NM_DEVICE_STATE_UNMANAGED:
|
|
||||||
case NM_DEVICE_STATE_UNAVAILABLE:
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
_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);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDeviceWifi *device)
|
|
||||||
{
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (device);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_WIFI_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS, &priv->perm_hw_address },
|
|
||||||
{ NM_DEVICE_WIFI_MODE, &priv->mode },
|
|
||||||
{ NM_DEVICE_WIFI_BITRATE, &priv->rate },
|
|
||||||
{ NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT, &priv->active_ap, NULL, NM_TYPE_ACCESS_POINT },
|
|
||||||
{ NM_DEVICE_WIFI_CAPABILITIES, &priv->wireless_caps },
|
|
||||||
{ NM_DEVICE_WIFI_ACCESS_POINTS, &priv->aps, NULL, NM_TYPE_ACCESS_POINT, "access-point" },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (device),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
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;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT);
|
|
||||||
|
|
||||||
priv->rate = 0;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIFI_BITRATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_wifi_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_WIRELESS);
|
|
||||||
register_properties (NM_DEVICE_WIFI (object));
|
|
||||||
|
|
||||||
g_signal_connect (NM_DEVICE (object),
|
|
||||||
"notify::" NM_DEVICE_STATE,
|
|
||||||
G_CALLBACK (state_changed_cb),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (object);
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
if (priv->scan_call) {
|
|
||||||
g_set_error_literal (&error, NM_DEVICE_WIFI_ERROR, NM_DEVICE_WIFI_ERROR_UNKNOWN,
|
|
||||||
"Wi-Fi device was destroyed");
|
|
||||||
if (priv->scan_info) {
|
|
||||||
if (priv->scan_info->callback)
|
|
||||||
priv->scan_info->callback (NULL, error, priv->scan_info->user_data);
|
|
||||||
g_slice_free (RequestScanInfo, priv->scan_info);
|
|
||||||
priv->scan_info = NULL;
|
|
||||||
}
|
|
||||||
g_clear_error (&error);
|
|
||||||
|
|
||||||
dbus_g_proxy_cancel_call (priv->proxy, priv->scan_call);
|
|
||||||
priv->scan_call = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
clean_up_aps (NM_DEVICE_WIFI (object), FALSE);
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_wifi_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceWifiPrivate *priv = NM_DEVICE_WIFI_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
g_free (priv->perm_hw_address);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_wifi_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_wifi_class_init (NMDeviceWifiClass *wifi_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (wifi_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (wifi_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (wifi_class, sizeof (NMDeviceWifiPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
wifi_class->access_point_removed = access_point_removed;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_WIFI_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:perm-hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_PERM_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:mode:
|
|
||||||
*
|
|
||||||
* The mode of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_MODE,
|
|
||||||
g_param_spec_uint (NM_DEVICE_WIFI_MODE, "", "",
|
|
||||||
NM_802_11_MODE_UNKNOWN, NM_802_11_MODE_AP, NM_802_11_MODE_INFRA,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:bitrate:
|
|
||||||
*
|
|
||||||
* The bit rate of the device in kbit/s.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_BITRATE,
|
|
||||||
g_param_spec_uint (NM_DEVICE_WIFI_BITRATE, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:active-access-point:
|
|
||||||
*
|
|
||||||
* The active #NMAccessPoint of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ACTIVE_ACCESS_POINT,
|
|
||||||
g_param_spec_object (NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT, "", "",
|
|
||||||
NM_TYPE_ACCESS_POINT,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:wireless-capabilities:
|
|
||||||
*
|
|
||||||
* The wireless capabilities of the device.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_WIRELESS_CAPABILITIES,
|
|
||||||
g_param_spec_uint (NM_DEVICE_WIFI_CAPABILITIES, "", "",
|
|
||||||
0, G_MAXUINT32, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi:access-points:
|
|
||||||
*
|
|
||||||
* List of all Wi-Fi access points the device can see.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ACCESS_POINTS,
|
|
||||||
g_param_spec_boxed (NM_DEVICE_WIFI_ACCESS_POINTS, "", "",
|
|
||||||
NM_TYPE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/* signals */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi::access-point-added:
|
|
||||||
* @device: the Wi-Fi device that received the signal
|
|
||||||
* @ap: the new access point
|
|
||||||
*
|
|
||||||
* Notifies that a #NMAccessPoint is added to the Wi-Fi device.
|
|
||||||
**/
|
|
||||||
signals[ACCESS_POINT_ADDED] =
|
|
||||||
g_signal_new ("access-point-added",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_added),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__OBJECT,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
G_TYPE_OBJECT);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifi::access-point-removed:
|
|
||||||
* @device: the Wi-Fi device that received the signal
|
|
||||||
* @ap: the removed access point
|
|
||||||
*
|
|
||||||
* Notifies that a #NMAccessPoint is removed from the Wi-Fi device.
|
|
||||||
**/
|
|
||||||
signals[ACCESS_POINT_REMOVED] =
|
|
||||||
g_signal_new ("access-point-removed",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMDeviceWifiClass, access_point_removed),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__OBJECT,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
G_TYPE_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
@ -1,115 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_WIFI_H
|
|
||||||
#define NM_DEVICE_WIFI_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-access-point.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_WIFI (nm_device_wifi_get_type ())
|
|
||||||
#define NM_DEVICE_WIFI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_WIFI, NMDeviceWifi))
|
|
||||||
#define NM_DEVICE_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_WIFI, NMDeviceWifiClass))
|
|
||||||
#define NM_IS_DEVICE_WIFI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_WIFI))
|
|
||||||
#define NM_IS_DEVICE_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIFI))
|
|
||||||
#define NM_DEVICE_WIFI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIFI, NMDeviceWifiClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWifiError:
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_NOT_WIFI_CONNECTION: the connection was not of Wi-Fi type
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_INVALID_WIFI_CONNECTION: the Wi-Fi connection was invalid
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_INVALID_DEVICE_MAC: the device's MAC was invalid
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_WPA_CAPS: the device missed WPA capabilities
|
|
||||||
* required by the connection
|
|
||||||
* @NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_RSN_CAPS: the device missed RSN capabilities
|
|
||||||
* required by the connection
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_WIFI_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_WIFI_ERROR_NOT_WIFI_CONNECTION, /*< nick=NotWifiConnection >*/
|
|
||||||
NM_DEVICE_WIFI_ERROR_INVALID_WIFI_CONNECTION, /*< nick=InvalidWifiConnection >*/
|
|
||||||
NM_DEVICE_WIFI_ERROR_INVALID_DEVICE_MAC, /*< nick=InvalidDeviceMac >*/
|
|
||||||
NM_DEVICE_WIFI_ERROR_MAC_MISMATCH, /*< nick=MacMismatch >*/
|
|
||||||
NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_WPA_CAPS, /*< nick=MissingDeviceWpaCaps >*/
|
|
||||||
NM_DEVICE_WIFI_ERROR_MISSING_DEVICE_RSN_CAPS, /*< nick=MissingDeviceRsnCaps >*/
|
|
||||||
} NMDeviceWifiError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_WIFI_ERROR nm_device_wifi_error_quark ()
|
|
||||||
GQuark nm_device_wifi_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_WIFI_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS "perm-hw-address"
|
|
||||||
#define NM_DEVICE_WIFI_MODE "mode"
|
|
||||||
#define NM_DEVICE_WIFI_BITRATE "bitrate"
|
|
||||||
#define NM_DEVICE_WIFI_ACTIVE_ACCESS_POINT "active-access-point"
|
|
||||||
#define NM_DEVICE_WIFI_CAPABILITIES "wireless-capabilities"
|
|
||||||
#define NM_DEVICE_WIFI_ACCESS_POINTS "access-points"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceWifi;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*access_point_added) (NMDeviceWifi *device, NMAccessPoint *ap);
|
|
||||||
void (*access_point_removed) (NMDeviceWifi *device, NMAccessPoint *ap);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDeviceWifiClass;
|
|
||||||
|
|
||||||
GType nm_device_wifi_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_device_wifi_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char * nm_device_wifi_get_hw_address (NMDeviceWifi *device);
|
|
||||||
const char * nm_device_wifi_get_permanent_hw_address (NMDeviceWifi *device);
|
|
||||||
NM80211Mode nm_device_wifi_get_mode (NMDeviceWifi *device);
|
|
||||||
guint32 nm_device_wifi_get_bitrate (NMDeviceWifi *device);
|
|
||||||
NMDeviceWifiCapabilities nm_device_wifi_get_capabilities (NMDeviceWifi *device);
|
|
||||||
NMAccessPoint * nm_device_wifi_get_active_access_point (NMDeviceWifi *device);
|
|
||||||
|
|
||||||
NMAccessPoint * nm_device_wifi_get_access_point_by_path (NMDeviceWifi *device,
|
|
||||||
const char *path);
|
|
||||||
|
|
||||||
const GPtrArray * nm_device_wifi_get_access_points (NMDeviceWifi *device);
|
|
||||||
|
|
||||||
typedef void (*NMDeviceWifiRequestScanFn) (NMDeviceWifi *device,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
void nm_device_wifi_request_scan_simple (NMDeviceWifi *device,
|
|
||||||
NMDeviceWifiRequestScanFn callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_WIFI_H */
|
|
||||||
|
|
@ -1,795 +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 2011 - 2012 Red Hat, Inc.
|
|
||||||
* Copyright 2009 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <netinet/ether.h>
|
|
||||||
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-setting-wimax.h"
|
|
||||||
|
|
||||||
#include "nm-device-wimax.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-object-cache.h"
|
|
||||||
#include "nm-dbus-glib-types.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-device-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDeviceWimax, nm_device_wimax, NM_TYPE_DEVICE)
|
|
||||||
|
|
||||||
#define NM_DEVICE_WIMAX_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxPrivate))
|
|
||||||
|
|
||||||
void _nm_device_wimax_set_wireless_enabled (NMDeviceWimax *wimax, gboolean enabled);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *hw_address;
|
|
||||||
NMWimaxNsp *active_nsp;
|
|
||||||
GPtrArray *nsps;
|
|
||||||
|
|
||||||
guint center_freq;
|
|
||||||
int rssi;
|
|
||||||
int cinr;
|
|
||||||
int tx_power;
|
|
||||||
char *bsid;
|
|
||||||
} NMDeviceWimaxPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_HW_ADDRESS,
|
|
||||||
PROP_ACTIVE_NSP,
|
|
||||||
PROP_CENTER_FREQ,
|
|
||||||
PROP_RSSI,
|
|
||||||
PROP_CINR,
|
|
||||||
PROP_TX_POWER,
|
|
||||||
PROP_BSID,
|
|
||||||
PROP_NSPS,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
NSP_ADDED,
|
|
||||||
NSP_REMOVED,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMDeviceWimax if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMDeviceWimax errors.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_device_wimax_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-device-wimax-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the D-Bus object path of the WiMAX device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDeviceWimax.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new WiMAX device
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_device_wimax_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
GObject *device;
|
|
||||||
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
device = g_object_new (NM_TYPE_DEVICE_WIMAX,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (device));
|
|
||||||
return device;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_hw_address:
|
|
||||||
* @wimax: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets the hardware (MAC) address of the #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Returns: the hardware address. This is the internal string used by the
|
|
||||||
* device, and must not be modified.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_wimax_get_hw_address (NMDeviceWimax *wimax)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (wimax));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->hw_address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_active_nsp:
|
|
||||||
* @wimax: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets the active #NMWimaxNsp.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): the access point or %NULL if none is active
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
NMWimaxNsp *
|
|
||||||
nm_device_wimax_get_active_nsp (NMDeviceWimax *wimax)
|
|
||||||
{
|
|
||||||
NMDeviceState state;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
|
|
||||||
|
|
||||||
state = nm_device_get_state (NM_DEVICE (wimax));
|
|
||||||
switch (state) {
|
|
||||||
case NM_DEVICE_STATE_PREPARE:
|
|
||||||
case NM_DEVICE_STATE_CONFIG:
|
|
||||||
case NM_DEVICE_STATE_NEED_AUTH:
|
|
||||||
case NM_DEVICE_STATE_IP_CONFIG:
|
|
||||||
case NM_DEVICE_STATE_IP_CHECK:
|
|
||||||
case NM_DEVICE_STATE_SECONDARIES:
|
|
||||||
case NM_DEVICE_STATE_ACTIVATED:
|
|
||||||
case NM_DEVICE_STATE_DEACTIVATING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (wimax));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->active_nsp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_nsps:
|
|
||||||
* @wimax: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets all the scanned NSPs of the #NMDeviceWimax.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMWimaxNsp): a #GPtrArray containing
|
|
||||||
* all the scanned #NMWimaxNsps.
|
|
||||||
* The returned array is owned by the client and should not be modified.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_device_wimax_get_nsps (NMDeviceWimax *wimax)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (wimax));
|
|
||||||
return handle_ptr_array_return (NM_DEVICE_WIMAX_GET_PRIVATE (wimax)->nsps);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_nsp_by_path:
|
|
||||||
* @wimax: a #NMDeviceWimax
|
|
||||||
* @path: the object path of the NSP
|
|
||||||
*
|
|
||||||
* Gets a #NMWimaxNsp by path.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): the access point or %NULL if none is found.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
NMWimaxNsp *
|
|
||||||
nm_device_wimax_get_nsp_by_path (NMDeviceWimax *wimax,
|
|
||||||
const char *path)
|
|
||||||
{
|
|
||||||
const GPtrArray *nsps;
|
|
||||||
int i;
|
|
||||||
NMWimaxNsp *nsp = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (wimax), NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
nsps = nm_device_wimax_get_nsps (wimax);
|
|
||||||
if (!nsps)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
for (i = 0; i < nsps->len; i++) {
|
|
||||||
NMWimaxNsp *candidate = g_ptr_array_index (nsps, i);
|
|
||||||
if (!strcmp (nm_object_get_path (NM_OBJECT (candidate)), path)) {
|
|
||||||
nsp = candidate;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nsp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clean_up_nsps (NMDeviceWimax *self, gboolean notify)
|
|
||||||
{
|
|
||||||
NMDeviceWimaxPrivate *priv;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_DEVICE_WIMAX (self));
|
|
||||||
|
|
||||||
priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (priv->active_nsp) {
|
|
||||||
g_object_unref (priv->active_nsp);
|
|
||||||
priv->active_nsp = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->nsps) {
|
|
||||||
while (priv->nsps->len) {
|
|
||||||
NMWimaxNsp *nsp = NM_WIMAX_NSP (g_ptr_array_index (priv->nsps, 0));
|
|
||||||
|
|
||||||
if (notify)
|
|
||||||
g_signal_emit (self, signals[NSP_REMOVED], 0, nsp);
|
|
||||||
g_ptr_array_remove (priv->nsps, nsp);
|
|
||||||
g_object_unref (nsp);
|
|
||||||
}
|
|
||||||
g_ptr_array_free (priv->nsps, TRUE);
|
|
||||||
priv->nsps = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_center_frequency:
|
|
||||||
* @self: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets the center frequency (in KHz) of the radio channel the device is using
|
|
||||||
* to communicate with the network when connected. Has no meaning when the
|
|
||||||
* device is not connected.
|
|
||||||
*
|
|
||||||
* Returns: the center frequency in KHz, or 0
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
guint
|
|
||||||
nm_device_wimax_get_center_frequency (NMDeviceWimax *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (self)->center_freq;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_rssi:
|
|
||||||
* @self: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets the RSSI of the current radio link in dBm. This value indicates how
|
|
||||||
* strong the raw received RF signal from the base station is, but does not
|
|
||||||
* indicate the overall quality of the radio link. Has no meaning when the
|
|
||||||
* device is not connected.
|
|
||||||
*
|
|
||||||
* Returns: the RSSI in dBm, or 0
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
int
|
|
||||||
nm_device_wimax_get_rssi (NMDeviceWimax *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (self)->rssi;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_cinr:
|
|
||||||
* @self: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets the CINR (Carrier to Interference + Noise Ratio) of the current radio
|
|
||||||
* link in dB. CINR is a more accurate measure of radio link quality. Has no
|
|
||||||
* meaning when the device is not connected.
|
|
||||||
*
|
|
||||||
* Returns: the CINR in dB, or 0
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
int
|
|
||||||
nm_device_wimax_get_cinr (NMDeviceWimax *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (self)->cinr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_tx_power:
|
|
||||||
* @self: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Average power of the last burst transmitted by the device, in units of
|
|
||||||
* 0.5 dBm. i.e. a TxPower of -11 represents an actual device TX power of
|
|
||||||
* -5.5 dBm. Has no meaning when the device is not connected.
|
|
||||||
*
|
|
||||||
* Returns: the TX power in dBm, or 0
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
int
|
|
||||||
nm_device_wimax_get_tx_power (NMDeviceWimax *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (self)->tx_power;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_device_wimax_get_bsid:
|
|
||||||
* @self: a #NMDeviceWimax
|
|
||||||
*
|
|
||||||
* Gets the ID of the serving Base Station when the device is connected.
|
|
||||||
*
|
|
||||||
* Returns: the ID of the serving Base Station, or %NULL
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_device_wimax_get_bsid (NMDeviceWimax *self)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DEVICE_WIMAX (self), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (self));
|
|
||||||
return NM_DEVICE_WIMAX_GET_PRIVATE (self)->bsid;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
|
|
||||||
{
|
|
||||||
NMSettingConnection *s_con;
|
|
||||||
NMSettingWimax *s_wimax;
|
|
||||||
const char *ctype;
|
|
||||||
const GByteArray *mac;
|
|
||||||
const char *hw_str;
|
|
||||||
struct ether_addr *hw_mac;
|
|
||||||
|
|
||||||
s_con = nm_connection_get_setting_connection (connection);
|
|
||||||
g_assert (s_con);
|
|
||||||
|
|
||||||
ctype = nm_setting_connection_get_connection_type (s_con);
|
|
||||||
if (strcmp (ctype, NM_SETTING_WIMAX_SETTING_NAME) != 0) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_NOT_WIMAX_CONNECTION,
|
|
||||||
"The connection was not a Wimax connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
s_wimax = nm_connection_get_setting_wimax (connection);
|
|
||||||
if (!s_wimax) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_INVALID_WIMAX_CONNECTION,
|
|
||||||
"The connection was not a valid Wimax connection.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check MAC address */
|
|
||||||
hw_str = nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device));
|
|
||||||
if (hw_str) {
|
|
||||||
hw_mac = ether_aton (hw_str);
|
|
||||||
if (!hw_mac) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_INVALID_DEVICE_MAC,
|
|
||||||
"Invalid device MAC address.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
mac = nm_setting_wimax_get_mac_address (s_wimax);
|
|
||||||
if (mac && hw_mac && memcmp (mac->data, hw_mac->ether_addr_octet, ETH_ALEN)) {
|
|
||||||
g_set_error (error, NM_DEVICE_WIMAX_ERROR, NM_DEVICE_WIMAX_ERROR_MAC_MISMATCH,
|
|
||||||
"The MACs of the device and the connection didn't match.");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NM_DEVICE_CLASS (nm_device_wimax_parent_class)->connection_compatible (device, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GType
|
|
||||||
get_setting_type (NMDevice *device)
|
|
||||||
{
|
|
||||||
return NM_TYPE_SETTING_WIMAX;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDeviceWimax *self = NM_DEVICE_WIMAX (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_HW_ADDRESS:
|
|
||||||
g_value_set_string (value, nm_device_wimax_get_hw_address (self));
|
|
||||||
break;
|
|
||||||
case PROP_ACTIVE_NSP:
|
|
||||||
g_value_set_object (value, nm_device_wimax_get_active_nsp (self));
|
|
||||||
break;
|
|
||||||
case PROP_CENTER_FREQ:
|
|
||||||
g_value_set_uint (value, nm_device_wimax_get_center_frequency (self));
|
|
||||||
break;
|
|
||||||
case PROP_RSSI:
|
|
||||||
g_value_set_int (value, nm_device_wimax_get_rssi (self));
|
|
||||||
break;
|
|
||||||
case PROP_CINR:
|
|
||||||
g_value_set_int (value, nm_device_wimax_get_cinr (self));
|
|
||||||
break;
|
|
||||||
case PROP_TX_POWER:
|
|
||||||
g_value_set_int (value, nm_device_wimax_get_tx_power (self));
|
|
||||||
break;
|
|
||||||
case PROP_BSID:
|
|
||||||
g_value_set_string (value, nm_device_wimax_get_bsid (self));
|
|
||||||
break;
|
|
||||||
case PROP_NSPS:
|
|
||||||
g_value_set_boxed (value, nm_device_wimax_get_nsps (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clear_link_status (NMDeviceWimax *self)
|
|
||||||
{
|
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (priv->center_freq) {
|
|
||||||
priv->center_freq = 0;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_CENTER_FREQUENCY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->rssi) {
|
|
||||||
priv->rssi = 0;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_RSSI);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->cinr) {
|
|
||||||
priv->cinr = 0;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_CINR);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->tx_power) {
|
|
||||||
priv->tx_power = 0;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_TX_POWER);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->bsid) {
|
|
||||||
g_free (priv->bsid);
|
|
||||||
priv->bsid = NULL;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_BSID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
state_changed_cb (NMDevice *device, GParamSpec *pspec, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMDeviceWimax *self = NM_DEVICE_WIMAX (device);
|
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
|
|
||||||
NMDeviceState state;
|
|
||||||
|
|
||||||
state = nm_device_get_state (device);
|
|
||||||
switch (state) {
|
|
||||||
case NM_DEVICE_STATE_UNKNOWN:
|
|
||||||
case NM_DEVICE_STATE_UNMANAGED:
|
|
||||||
case NM_DEVICE_STATE_UNAVAILABLE:
|
|
||||||
case NM_DEVICE_STATE_DISCONNECTED:
|
|
||||||
case NM_DEVICE_STATE_FAILED:
|
|
||||||
if (priv->active_nsp) {
|
|
||||||
g_object_unref (priv->active_nsp);
|
|
||||||
priv->active_nsp = NULL;
|
|
||||||
}
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (device), NM_DEVICE_WIMAX_ACTIVE_NSP);
|
|
||||||
clear_link_status (self);
|
|
||||||
break;
|
|
||||||
case NM_DEVICE_STATE_PREPARE:
|
|
||||||
case NM_DEVICE_STATE_CONFIG:
|
|
||||||
case NM_DEVICE_STATE_NEED_AUTH:
|
|
||||||
case NM_DEVICE_STATE_IP_CONFIG:
|
|
||||||
clear_link_status (self);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDeviceWimax *wimax)
|
|
||||||
{
|
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (wimax);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DEVICE_WIMAX_HW_ADDRESS, &priv->hw_address },
|
|
||||||
{ NM_DEVICE_WIMAX_ACTIVE_NSP, &priv->active_nsp, NULL, NM_TYPE_WIMAX_NSP },
|
|
||||||
{ NM_DEVICE_WIMAX_CENTER_FREQUENCY, &priv->center_freq },
|
|
||||||
{ NM_DEVICE_WIMAX_RSSI, &priv->rssi },
|
|
||||||
{ NM_DEVICE_WIMAX_CINR, &priv->cinr },
|
|
||||||
{ NM_DEVICE_WIMAX_TX_POWER, &priv->tx_power },
|
|
||||||
{ NM_DEVICE_WIMAX_BSID, &priv->bsid },
|
|
||||||
{ NM_DEVICE_WIMAX_NSPS, &priv->nsps, NULL, NM_TYPE_WIMAX_NSP, "nsp" },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (wimax),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nsp_removed (NMDeviceWimax *self, NMWimaxNsp *nsp)
|
|
||||||
{
|
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (nsp == priv->active_nsp) {
|
|
||||||
g_object_unref (priv->active_nsp);
|
|
||||||
priv->active_nsp = NULL;
|
|
||||||
_nm_object_queue_notify (NM_OBJECT (self), NM_DEVICE_WIMAX_ACTIVE_NSP);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_wimax_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DEVICE_WIMAX);
|
|
||||||
register_properties (NM_DEVICE_WIMAX (object));
|
|
||||||
|
|
||||||
g_signal_connect (object,
|
|
||||||
"notify::" NM_DEVICE_STATE,
|
|
||||||
G_CALLBACK (state_changed_cb),
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMDeviceWimaxPrivate *priv = NM_DEVICE_WIMAX_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->hw_address) {
|
|
||||||
g_free (priv->hw_address);
|
|
||||||
priv->hw_address = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->bsid) {
|
|
||||||
g_free (priv->bsid);
|
|
||||||
priv->bsid = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
clean_up_nsps (NM_DEVICE_WIMAX (object), FALSE);
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_device_wimax_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_device_wimax_class_init (NMDeviceWimaxClass *wimax_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (wimax_class);
|
|
||||||
NMDeviceClass *device_class = NM_DEVICE_CLASS (wimax_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (wimax_class, sizeof (NMDeviceWimaxPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
device_class->connection_compatible = connection_compatible;
|
|
||||||
device_class->get_setting_type = get_setting_type;
|
|
||||||
device_class->get_hw_address = get_hw_address;
|
|
||||||
wimax_class->nsp_removed = nsp_removed;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:hw-address:
|
|
||||||
*
|
|
||||||
* The hardware (MAC) address of the device.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_HW_ADDRESS,
|
|
||||||
g_param_spec_string (NM_DEVICE_WIMAX_HW_ADDRESS, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:active-nsp:
|
|
||||||
*
|
|
||||||
* The active #NMWimaxNsp of the device.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ACTIVE_NSP,
|
|
||||||
g_param_spec_object (NM_DEVICE_WIMAX_ACTIVE_NSP, "", "",
|
|
||||||
NM_TYPE_WIMAX_NSP,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:center-frequency:
|
|
||||||
*
|
|
||||||
* The center frequency (in KHz) of the radio channel the device is using to
|
|
||||||
* communicate with the network when connected. Has no meaning when the
|
|
||||||
* device is not connected.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CENTER_FREQ,
|
|
||||||
g_param_spec_uint (NM_DEVICE_WIMAX_CENTER_FREQUENCY, "", "",
|
|
||||||
0, G_MAXUINT, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:rssi:
|
|
||||||
*
|
|
||||||
* RSSI of the current radio link in dBm. This value indicates how strong
|
|
||||||
* the raw received RF signal from the base station is, but does not
|
|
||||||
* indicate the overall quality of the radio link. Has no meaning when the
|
|
||||||
* device is not connected.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_RSSI,
|
|
||||||
g_param_spec_int (NM_DEVICE_WIMAX_RSSI, "", "",
|
|
||||||
G_MININT, G_MAXINT, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:cinr:
|
|
||||||
*
|
|
||||||
* CINR (Carrier to Interference + Noise Ratio) of the current radio link
|
|
||||||
* in dB. CINR is a more accurate measure of radio link quality. Has no
|
|
||||||
* meaning when the device is not connected.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_CINR,
|
|
||||||
g_param_spec_int (NM_DEVICE_WIMAX_CINR, "", "",
|
|
||||||
G_MININT, G_MAXINT, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:tx-power:
|
|
||||||
*
|
|
||||||
* Average power of the last burst transmitted by the device, in units of
|
|
||||||
* 0.5 dBm. i.e. a TxPower of -11 represents an actual device TX power of
|
|
||||||
* -5.5 dBm. Has no meaning when the device is not connected.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_TX_POWER,
|
|
||||||
g_param_spec_int (NM_DEVICE_WIMAX_TX_POWER, "", "",
|
|
||||||
G_MININT, G_MAXINT, 0,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:bsid:
|
|
||||||
*
|
|
||||||
* The ID of the serving base station as received from the network. Has
|
|
||||||
* no meaning when the device is not connected.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_BSID,
|
|
||||||
g_param_spec_string (NM_DEVICE_WIMAX_BSID, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax:nsps:
|
|
||||||
*
|
|
||||||
* List of all WiMAX Network Service Providers the device can see.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_NSPS,
|
|
||||||
g_param_spec_boxed (NM_DEVICE_WIMAX_NSPS, "", "",
|
|
||||||
NM_TYPE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/* signals */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax::nsp-added:
|
|
||||||
* @self: the wimax device that received the signal
|
|
||||||
* @nsp: the new NSP
|
|
||||||
*
|
|
||||||
* Notifies that a #NMWimaxNsp is added to the wimax device.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
signals[NSP_ADDED] =
|
|
||||||
g_signal_new ("nsp-added",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_added),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__OBJECT,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
G_TYPE_OBJECT);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimax::nsp-removed:
|
|
||||||
* @self: the wimax device that received the signal
|
|
||||||
* @nsp: the removed NSP
|
|
||||||
*
|
|
||||||
* Notifies that a #NMWimaxNsp is removed from the wimax device.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.2: WiMAX is no longer supported.
|
|
||||||
**/
|
|
||||||
signals[NSP_REMOVED] =
|
|
||||||
g_signal_new ("nsp-removed",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMDeviceWimaxClass, nsp_removed),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__OBJECT,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
G_TYPE_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
@ -1,109 +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 2011 - 2012 Red Hat, Inc.
|
|
||||||
* Copyright 2009 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_WIMAX_H
|
|
||||||
#define NM_DEVICE_WIMAX_H
|
|
||||||
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-wimax-nsp.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE_WIMAX (nm_device_wimax_get_type ())
|
|
||||||
#define NM_DEVICE_WIMAX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_WIMAX, NMDeviceWimax))
|
|
||||||
#define NM_DEVICE_WIMAX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxClass))
|
|
||||||
#define NM_IS_DEVICE_WIMAX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_WIMAX))
|
|
||||||
#define NM_IS_DEVICE_WIMAX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIMAX))
|
|
||||||
#define NM_DEVICE_WIMAX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceWimaxError:
|
|
||||||
* @NM_DEVICE_WIMAX_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_WIMAX_ERROR_NOT_WIMAX_CONNECTION: the connection was not of WiMax type
|
|
||||||
* @NM_DEVICE_WIMAX_ERROR_INVALID_WIMAX_CONNECTION: the WiMax connection was invalid
|
|
||||||
* @NM_DEVICE_WIMAX_ERROR_INVALID_DEVICE_MAC: the device's MAC was invalid
|
|
||||||
* @NM_DEVICE_WIMAX_ERROR_MAC_MISMATCH: the MACs of the connection and the device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_WIMAX_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_WIMAX_ERROR_NOT_WIMAX_CONNECTION, /*< nick=NotWimaxConnection >*/
|
|
||||||
NM_DEVICE_WIMAX_ERROR_INVALID_WIMAX_CONNECTION, /*< nick=InvalidWimaxConnection >*/
|
|
||||||
NM_DEVICE_WIMAX_ERROR_INVALID_DEVICE_MAC, /*< nick=InvalidDeviceMac >*/
|
|
||||||
NM_DEVICE_WIMAX_ERROR_MAC_MISMATCH, /*< nick=MacMismatch >*/
|
|
||||||
} NMDeviceWimaxError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_WIMAX_ERROR nm_device_wimax_error_quark ()
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
GQuark nm_device_wimax_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_WIMAX_HW_ADDRESS "hw-address"
|
|
||||||
#define NM_DEVICE_WIMAX_ACTIVE_NSP "active-nsp"
|
|
||||||
#define NM_DEVICE_WIMAX_CENTER_FREQUENCY "center-frequency"
|
|
||||||
#define NM_DEVICE_WIMAX_RSSI "rssi"
|
|
||||||
#define NM_DEVICE_WIMAX_CINR "cinr"
|
|
||||||
#define NM_DEVICE_WIMAX_TX_POWER "tx-power"
|
|
||||||
#define NM_DEVICE_WIMAX_BSID "bsid"
|
|
||||||
#define NM_DEVICE_WIMAX_NSPS "nsps"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDevice parent;
|
|
||||||
} NMDeviceWimax;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMDeviceClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*nsp_added) (NMDeviceWimax *self, NMWimaxNsp *nsp);
|
|
||||||
void (*nsp_removed) (NMDeviceWimax *self, NMWimaxNsp *nsp);
|
|
||||||
} NMDeviceWimaxClass;
|
|
||||||
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
GType nm_device_wimax_get_type (void);
|
|
||||||
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
GObject *nm_device_wimax_new (DBusGConnection *connection,
|
|
||||||
const char *path);
|
|
||||||
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
const char *nm_device_wimax_get_hw_address (NMDeviceWimax *wimax);
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
NMWimaxNsp *nm_device_wimax_get_active_nsp (NMDeviceWimax *wimax);
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
NMWimaxNsp *nm_device_wimax_get_nsp_by_path (NMDeviceWimax *wimax,
|
|
||||||
const char *path);
|
|
||||||
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
const GPtrArray *nm_device_wimax_get_nsps (NMDeviceWimax *wimax);
|
|
||||||
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
guint nm_device_wimax_get_center_frequency (NMDeviceWimax *self);
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
int nm_device_wimax_get_rssi (NMDeviceWimax *self);
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
int nm_device_wimax_get_cinr (NMDeviceWimax *self);
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
int nm_device_wimax_get_tx_power (NMDeviceWimax *self);
|
|
||||||
NM_DEPRECATED_IN_1_2
|
|
||||||
const char * nm_device_wimax_get_bsid (NMDeviceWimax *self);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_WIMAX_H */
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,191 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2013 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DEVICE_H
|
|
||||||
#define NM_DEVICE_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-object.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-ip4-config.h"
|
|
||||||
#include "nm-dhcp4-config.h"
|
|
||||||
#include "nm-ip6-config.h"
|
|
||||||
#include "nm-dhcp6-config.h"
|
|
||||||
#include "nm-connection.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DEVICE (nm_device_get_type ())
|
|
||||||
#define NM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE, NMDevice))
|
|
||||||
#define NM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE, NMDeviceClass))
|
|
||||||
#define NM_IS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE))
|
|
||||||
#define NM_IS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE))
|
|
||||||
#define NM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE, NMDeviceClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDeviceError:
|
|
||||||
* @NM_DEVICE_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_DEVICE_ERROR_INTERFACE_MISMATCH: the interface names of the connection and the
|
|
||||||
* device mismatched
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_DEVICE_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_DEVICE_ERROR_INTERFACE_MISMATCH, /*< nick=InterfaceMismatch >*/
|
|
||||||
} NMDeviceError;
|
|
||||||
|
|
||||||
#define NM_DEVICE_ERROR nm_device_error_quark ()
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GQuark nm_device_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_DEVICE_DEVICE_TYPE "device-type"
|
|
||||||
#define NM_DEVICE_UDI "udi"
|
|
||||||
#define NM_DEVICE_INTERFACE "interface"
|
|
||||||
#define NM_DEVICE_IP_INTERFACE "ip-interface"
|
|
||||||
#define NM_DEVICE_DRIVER "driver"
|
|
||||||
#define NM_DEVICE_DRIVER_VERSION "driver-version"
|
|
||||||
#define NM_DEVICE_FIRMWARE_VERSION "firmware-version"
|
|
||||||
#define NM_DEVICE_CAPABILITIES "capabilities"
|
|
||||||
#define NM_DEVICE_REAL "real"
|
|
||||||
#define NM_DEVICE_MANAGED "managed"
|
|
||||||
#define NM_DEVICE_AUTOCONNECT "autoconnect"
|
|
||||||
#define NM_DEVICE_FIRMWARE_MISSING "firmware-missing"
|
|
||||||
#define NM_DEVICE_IP4_CONFIG "ip4-config"
|
|
||||||
#define NM_DEVICE_DHCP4_CONFIG "dhcp4-config"
|
|
||||||
#define NM_DEVICE_IP6_CONFIG "ip6-config"
|
|
||||||
#define NM_DEVICE_DHCP6_CONFIG "dhcp6-config"
|
|
||||||
#define NM_DEVICE_STATE "state"
|
|
||||||
#define NM_DEVICE_STATE_REASON "state-reason"
|
|
||||||
#define NM_DEVICE_ACTIVE_CONNECTION "active-connection"
|
|
||||||
#define NM_DEVICE_AVAILABLE_CONNECTIONS "available-connections"
|
|
||||||
#define NM_DEVICE_VENDOR "vendor"
|
|
||||||
#define NM_DEVICE_PRODUCT "product"
|
|
||||||
#define NM_DEVICE_PHYSICAL_PORT_ID "physical-port-id"
|
|
||||||
#define NM_DEVICE_MTU "mtu"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMDevice;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*state_changed) (NMDevice *device,
|
|
||||||
NMDeviceState new_state,
|
|
||||||
NMDeviceState old_state,
|
|
||||||
NMDeviceStateReason reason);
|
|
||||||
|
|
||||||
gboolean (*connection_compatible) (NMDevice *device,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
const char * (*get_type_description) (NMDevice *device);
|
|
||||||
const char * (*get_hw_address) (NMDevice *device);
|
|
||||||
|
|
||||||
GType (*get_setting_type) (NMDevice *device);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
} NMDeviceClass;
|
|
||||||
|
|
||||||
GType nm_device_get_type (void);
|
|
||||||
|
|
||||||
GObject * nm_device_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
const char * nm_device_get_iface (NMDevice *device);
|
|
||||||
const char * nm_device_get_ip_iface (NMDevice *device);
|
|
||||||
NMDeviceType nm_device_get_device_type (NMDevice *device);
|
|
||||||
const char * nm_device_get_udi (NMDevice *device);
|
|
||||||
const char * nm_device_get_driver (NMDevice *device);
|
|
||||||
const char * nm_device_get_driver_version (NMDevice *device);
|
|
||||||
const char * nm_device_get_firmware_version (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_device_get_type_description (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_device_get_hw_address (NMDevice *device);
|
|
||||||
NMDeviceCapabilities nm_device_get_capabilities (NMDevice *device);
|
|
||||||
gboolean nm_device_get_managed (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_1_2
|
|
||||||
void nm_device_set_managed (NMDevice *device, gboolean managed);
|
|
||||||
gboolean nm_device_get_autoconnect (NMDevice *device);
|
|
||||||
void nm_device_set_autoconnect (NMDevice *device, gboolean autoconnect);
|
|
||||||
gboolean nm_device_get_firmware_missing (NMDevice *device);
|
|
||||||
NMIP4Config * nm_device_get_ip4_config (NMDevice *device);
|
|
||||||
NMDHCP4Config * nm_device_get_dhcp4_config (NMDevice *device);
|
|
||||||
NMIP6Config * nm_device_get_ip6_config (NMDevice *device);
|
|
||||||
NMDHCP6Config * nm_device_get_dhcp6_config (NMDevice *device);
|
|
||||||
NMDeviceState nm_device_get_state (NMDevice *device);
|
|
||||||
NMDeviceState nm_device_get_state_reason (NMDevice *device, NMDeviceStateReason *reason);
|
|
||||||
NMActiveConnection * nm_device_get_active_connection(NMDevice *device);
|
|
||||||
const GPtrArray * nm_device_get_available_connections(NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_device_get_physical_port_id (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
guint32 nm_device_get_mtu (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_1_0
|
|
||||||
gboolean nm_device_is_software (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_1_2
|
|
||||||
gboolean nm_device_is_real (NMDevice *device);
|
|
||||||
|
|
||||||
const char * nm_device_get_product (NMDevice *device);
|
|
||||||
const char * nm_device_get_vendor (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_device_get_description (NMDevice *device);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
char ** nm_device_disambiguate_names (NMDevice **devices,
|
|
||||||
int num_devices);
|
|
||||||
|
|
||||||
typedef void (*NMDeviceCallbackFn) (NMDevice *device, GError *error, gpointer user_data);
|
|
||||||
|
|
||||||
void nm_device_disconnect (NMDevice *device,
|
|
||||||
NMDeviceCallbackFn callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_1_0
|
|
||||||
void nm_device_delete (NMDevice *device,
|
|
||||||
NMDeviceCallbackFn callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
GSList * nm_device_filter_connections (NMDevice *device,
|
|
||||||
const GSList *connections);
|
|
||||||
|
|
||||||
gboolean nm_device_connection_valid (NMDevice *device,
|
|
||||||
NMConnection *connection);
|
|
||||||
|
|
||||||
gboolean nm_device_connection_compatible (NMDevice *device,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
GType nm_device_get_setting_type (NMDevice *device);
|
|
||||||
|
|
||||||
/* Deprecated */
|
|
||||||
NM_DEPRECATED_IN_1_0
|
|
||||||
typedef void (*NMDeviceDeactivateFn) (NMDevice *device, GError *error, gpointer user_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DEVICE_H */
|
|
||||||
|
|
@ -1,218 +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 - 2011 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-dhcp4-config.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDHCP4Config, nm_dhcp4_config, NM_TYPE_OBJECT)
|
|
||||||
|
|
||||||
#define NM_DHCP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP4_CONFIG, NMDHCP4ConfigPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
GHashTable *options;
|
|
||||||
} NMDHCP4ConfigPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_OPTIONS,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_dhcp4_config_init (NMDHCP4Config *config)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_dhcp4_options (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
GHashTable *new_options;
|
|
||||||
GHashTableIter iter;
|
|
||||||
const char *key;
|
|
||||||
GValue *opt;
|
|
||||||
|
|
||||||
g_hash_table_remove_all (priv->options);
|
|
||||||
|
|
||||||
new_options = g_value_get_boxed (value);
|
|
||||||
if (new_options) {
|
|
||||||
g_hash_table_iter_init (&iter, new_options);
|
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &opt))
|
|
||||||
g_hash_table_insert (priv->options, g_strdup (key), g_value_dup_string (opt));
|
|
||||||
}
|
|
||||||
|
|
||||||
_nm_object_queue_notify (object, NM_DHCP4_CONFIG_OPTIONS);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDHCP4Config *config)
|
|
||||||
{
|
|
||||||
NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (config);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DHCP4_CONFIG_OPTIONS, &priv->options, demarshal_dhcp4_options },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (config),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DHCP4_CONFIG);
|
|
||||||
register_properties (NM_DHCP4_CONFIG (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDHCP4ConfigPrivate *priv = NM_DHCP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->options)
|
|
||||||
g_hash_table_destroy (priv->options);
|
|
||||||
|
|
||||||
g_object_unref (priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_dhcp4_config_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDHCP4Config *self = NM_DHCP4_CONFIG (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_OPTIONS:
|
|
||||||
g_value_set_boxed (value, nm_dhcp4_config_get_options (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_dhcp4_config_class_init (NMDHCP4ConfigClass *config_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (config_class, sizeof (NMDHCP4ConfigPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDHCP4Config:options: (type GHashTable(utf8,GObject.Value)):
|
|
||||||
*
|
|
||||||
* The #GHashTable containing options of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_OPTIONS,
|
|
||||||
g_param_spec_boxed (NM_DHCP4_CONFIG_OPTIONS, "", "",
|
|
||||||
G_TYPE_HASH_TABLE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_dhcp4_config_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @object_path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDHCP4Config.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new configuration
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (object_path != NULL, NULL);
|
|
||||||
|
|
||||||
return (GObject *) g_object_new (NM_TYPE_DHCP4_CONFIG,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, object_path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_dhcp4_config_get_options:
|
|
||||||
* @config: a #NMDHCP4Config
|
|
||||||
*
|
|
||||||
* Gets all the options contained in the configuration.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none) (element-type utf8 GObject.Value): the #GHashTable containing strings for keys and values.
|
|
||||||
* This is the internal copy used by the configuration, and must not be modified.
|
|
||||||
**/
|
|
||||||
GHashTable *
|
|
||||||
nm_dhcp4_config_get_options (NMDHCP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DHCP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_DHCP4_CONFIG_GET_PRIVATE (config)->options;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_dhcp4_config_get_one_option:
|
|
||||||
* @config: a #NMDHCP4Config
|
|
||||||
* @option: the option to retrieve
|
|
||||||
*
|
|
||||||
* Gets one option by option name.
|
|
||||||
*
|
|
||||||
* Returns: the configuration option's value. This is the internal string used by the
|
|
||||||
* configuration, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_dhcp4_config_get_one_option (NMDHCP4Config *config, const char *option)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DHCP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
return g_hash_table_lookup (nm_dhcp4_config_get_options (config), option);
|
|
||||||
}
|
|
||||||
|
|
@ -1,66 +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.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DHCP4_CONFIG_H
|
|
||||||
#define NM_DHCP4_CONFIG_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-object.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DHCP4_CONFIG (nm_dhcp4_config_get_type ())
|
|
||||||
#define NM_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP4_CONFIG, NMDHCP4Config))
|
|
||||||
#define NM_DHCP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DHCP4_CONFIG, NMDHCP4ConfigClass))
|
|
||||||
#define NM_IS_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP4_CONFIG))
|
|
||||||
#define NM_IS_DHCP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP4_CONFIG))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMDHCP4Config;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDHCP4ConfigClass;
|
|
||||||
|
|
||||||
#define NM_DHCP4_CONFIG_OPTIONS "options"
|
|
||||||
|
|
||||||
GType nm_dhcp4_config_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_dhcp4_config_new (DBusGConnection *connection, const char *object_path);
|
|
||||||
|
|
||||||
GHashTable * nm_dhcp4_config_get_options (NMDHCP4Config *config);
|
|
||||||
|
|
||||||
const char * nm_dhcp4_config_get_one_option (NMDHCP4Config *config, const char *option);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DHCP4_CONFIG_H */
|
|
||||||
|
|
@ -1,218 +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 - 2011 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-dhcp6-config.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMDHCP6Config, nm_dhcp6_config, NM_TYPE_OBJECT)
|
|
||||||
|
|
||||||
#define NM_DHCP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DHCP6_CONFIG, NMDHCP6ConfigPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
GHashTable *options;
|
|
||||||
} NMDHCP6ConfigPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_OPTIONS,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_dhcp6_config_init (NMDHCP6Config *config)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_dhcp6_options (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
GHashTable *new_options;
|
|
||||||
GHashTableIter iter;
|
|
||||||
const char *key;
|
|
||||||
GValue *opt;
|
|
||||||
|
|
||||||
g_hash_table_remove_all (priv->options);
|
|
||||||
|
|
||||||
new_options = g_value_get_boxed (value);
|
|
||||||
if (new_options) {
|
|
||||||
g_hash_table_iter_init (&iter, new_options);
|
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &opt))
|
|
||||||
g_hash_table_insert (priv->options, g_strdup (key), g_value_dup_string (opt));
|
|
||||||
}
|
|
||||||
|
|
||||||
_nm_object_queue_notify (object, NM_DHCP6_CONFIG_OPTIONS);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMDHCP6Config *config)
|
|
||||||
{
|
|
||||||
NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (config);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_DHCP6_CONFIG_OPTIONS, &priv->options, demarshal_dhcp6_options },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (config),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->options = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_DHCP6_CONFIG);
|
|
||||||
register_properties (NM_DHCP6_CONFIG (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMDHCP6ConfigPrivate *priv = NM_DHCP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
if (priv->options)
|
|
||||||
g_hash_table_destroy (priv->options);
|
|
||||||
|
|
||||||
g_object_unref (priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_dhcp6_config_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMDHCP6Config *self = NM_DHCP6_CONFIG (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_OPTIONS:
|
|
||||||
g_value_set_boxed (value, nm_dhcp6_config_get_options (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_dhcp6_config_class_init (NMDHCP6ConfigClass *config_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (config_class, sizeof (NMDHCP6ConfigPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMDHCP6Config:options: (type GHashTable(utf8,GObject.Value)):
|
|
||||||
*
|
|
||||||
* The #GHashTable containing options of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_OPTIONS,
|
|
||||||
g_param_spec_boxed (NM_DHCP6_CONFIG_OPTIONS, "", "",
|
|
||||||
G_TYPE_HASH_TABLE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_dhcp6_config_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @object_path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMDHCP6Config.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new configuration
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_dhcp6_config_new (DBusGConnection *connection, const char *object_path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (object_path != NULL, NULL);
|
|
||||||
|
|
||||||
return (GObject *) g_object_new (NM_TYPE_DHCP6_CONFIG,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, object_path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_dhcp6_config_get_options:
|
|
||||||
* @config: a #NMDHCP6Config
|
|
||||||
*
|
|
||||||
* Gets all the options contained in the configuration.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none) (element-type utf8 GObject.Value): the #GHashTable containing strings for keys and values.
|
|
||||||
* This is the internal copy used by the configuration, and must not be modified.
|
|
||||||
**/
|
|
||||||
GHashTable *
|
|
||||||
nm_dhcp6_config_get_options (NMDHCP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DHCP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_DHCP6_CONFIG_GET_PRIVATE (config)->options;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_dhcp6_config_get_one_option:
|
|
||||||
* @config: a #NMDHCP6Config
|
|
||||||
* @option: the option to retrieve
|
|
||||||
*
|
|
||||||
* Gets one option by option name.
|
|
||||||
*
|
|
||||||
* Returns: the configuration option's value. This is the internal string used by the
|
|
||||||
* configuration, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_dhcp6_config_get_one_option (NMDHCP6Config *config, const char *option)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_DHCP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
return g_hash_table_lookup (nm_dhcp6_config_get_options (config), option);
|
|
||||||
}
|
|
||||||
|
|
@ -1,66 +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 - 2010 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_DHCP6_CONFIG_H
|
|
||||||
#define NM_DHCP6_CONFIG_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-object.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_DHCP6_CONFIG (nm_dhcp6_config_get_type ())
|
|
||||||
#define NM_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP6_CONFIG, NMDHCP6Config))
|
|
||||||
#define NM_DHCP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DHCP6_CONFIG, NMDHCP6ConfigClass))
|
|
||||||
#define NM_IS_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DHCP6_CONFIG))
|
|
||||||
#define NM_IS_DHCP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DHCP6_CONFIG))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMDHCP6Config;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMDHCP6ConfigClass;
|
|
||||||
|
|
||||||
#define NM_DHCP6_CONFIG_OPTIONS "options"
|
|
||||||
|
|
||||||
GType nm_dhcp6_config_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_dhcp6_config_new (DBusGConnection *connection, const char *object_path);
|
|
||||||
|
|
||||||
GHashTable * nm_dhcp6_config_get_options (NMDHCP6Config *config);
|
|
||||||
|
|
||||||
const char * nm_dhcp6_config_get_one_option (NMDHCP6Config *config, const char *option);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_DHCP6_CONFIG_H */
|
|
||||||
|
|
@ -1,62 +0,0 @@
|
||||||
/*** BEGIN file-header ***/
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "nm-glib-enum-types.h"
|
|
||||||
|
|
||||||
#include "nm-object.h"
|
|
||||||
#include "nm-client.h"
|
|
||||||
#include "nm-device.h"
|
|
||||||
#include "nm-device-ethernet.h"
|
|
||||||
#include "nm-device-infiniband.h"
|
|
||||||
#include "nm-device-adsl.h"
|
|
||||||
#include "nm-device-wifi.h"
|
|
||||||
#include "nm-device-bt.h"
|
|
||||||
#include "nm-device-olpc-mesh.h"
|
|
||||||
#include "nm-device-bond.h"
|
|
||||||
#include "nm-device-team.h"
|
|
||||||
#include "nm-device-bridge.h"
|
|
||||||
#include "nm-device-vlan.h"
|
|
||||||
#include "nm-device-generic.h"
|
|
||||||
#include "nm-access-point.h"
|
|
||||||
#include "nm-ip4-config.h"
|
|
||||||
#include "nm-device-modem.h"
|
|
||||||
#include "nm-vpn-connection.h"
|
|
||||||
#include "nm-types.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
#include "nm-dhcp4-config.h"
|
|
||||||
#include "nm-ip6-config.h"
|
|
||||||
#include "nm-dhcp6-config.h"
|
|
||||||
#include "nm-remote-connection.h"
|
|
||||||
#include "nm-remote-settings.h"
|
|
||||||
#include "nm-secret-agent.h"
|
|
||||||
#include "nm-device-wimax.h"
|
|
||||||
#include "nm-wimax-nsp.h"
|
|
||||||
/*** END file-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-header ***/
|
|
||||||
GType
|
|
||||||
@enum_name@_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize g_define_type_id__volatile = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
|
||||||
{
|
|
||||||
static const G@Type@Value values[] = {
|
|
||||||
/*** END value-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-production ***/
|
|
||||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
|
||||||
/*** END value-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-tail ***/
|
|
||||||
{ 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
GType g_define_type_id =
|
|
||||||
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
|
||||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_define_type_id__volatile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** END value-tail ***/
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
/*** BEGIN file-header ***/
|
|
||||||
#ifndef __NM_GLIB_ENUM_TYPES_H__
|
|
||||||
#define __NM_GLIB_ENUM_TYPES_H__
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
/*** END file-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN enumeration-production ***/
|
|
||||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
|
||||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
|
||||||
|
|
||||||
/*** END enumeration-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN file-tail ***/
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __NM_GLIB_ENUM_TYPES_H__ */
|
|
||||||
/*** END file-tail ***/
|
|
||||||
|
|
@ -1,472 +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 - 2011 Novell, Inc.
|
|
||||||
* Copyright 2008 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-setting-ip4-config.h"
|
|
||||||
#include "nm-ip4-config.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMIP4Config, nm_ip4_config, NM_TYPE_OBJECT)
|
|
||||||
|
|
||||||
#define NM_IP4_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP4_CONFIG, NMIP4ConfigPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *gateway;
|
|
||||||
GSList *addresses;
|
|
||||||
GSList *routes;
|
|
||||||
GArray *nameservers;
|
|
||||||
GPtrArray *domains;
|
|
||||||
GPtrArray *searches;
|
|
||||||
GArray *wins;
|
|
||||||
} NMIP4ConfigPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_GATEWAY,
|
|
||||||
PROP_ADDRESSES,
|
|
||||||
PROP_ROUTES,
|
|
||||||
PROP_NAMESERVERS,
|
|
||||||
PROP_DOMAINS,
|
|
||||||
PROP_SEARCHES,
|
|
||||||
PROP_WINS_SERVERS,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_ip4_config_init (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ip4_address_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
|
|
||||||
priv->addresses = NULL;
|
|
||||||
|
|
||||||
priv->addresses = nm_utils_ip4_addresses_from_gvalue (value);
|
|
||||||
_nm_object_queue_notify (object, NM_IP4_CONFIG_ADDRESSES);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ip4_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
if (!_nm_uint_array_demarshal (value, (GArray **) field))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (!strcmp (pspec->name, NM_IP4_CONFIG_NAMESERVERS))
|
|
||||||
_nm_object_queue_notify (object, NM_IP4_CONFIG_NAMESERVERS);
|
|
||||||
else if (!strcmp (pspec->name, NM_IP4_CONFIG_WINS_SERVERS))
|
|
||||||
_nm_object_queue_notify (object, NM_IP4_CONFIG_WINS_SERVERS);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_string_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
if (!_nm_string_array_demarshal (value, (GPtrArray **) field))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
_nm_object_queue_notify (object, pspec->name);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ip4_routes_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
|
|
||||||
priv->routes = NULL;
|
|
||||||
|
|
||||||
priv->routes = nm_utils_ip4_routes_from_gvalue (value);
|
|
||||||
_nm_object_queue_notify (object, NM_IP4_CONFIG_ROUTES);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (config);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_IP4_CONFIG_GATEWAY, &priv->gateway, },
|
|
||||||
{ NM_IP4_CONFIG_ADDRESSES, &priv->addresses, demarshal_ip4_address_array },
|
|
||||||
{ NM_IP4_CONFIG_ROUTES, &priv->routes, demarshal_ip4_routes_array },
|
|
||||||
{ NM_IP4_CONFIG_NAMESERVERS, &priv->nameservers, demarshal_ip4_array },
|
|
||||||
{ NM_IP4_CONFIG_DOMAINS, &priv->domains, demarshal_string_array },
|
|
||||||
{ NM_IP4_CONFIG_SEARCHES, &priv->searches, demarshal_string_array },
|
|
||||||
{ NM_IP4_CONFIG_WINS_SERVERS, &priv->wins, demarshal_ip4_array },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (config),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_ip4_config_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_IP4_CONFIG);
|
|
||||||
register_properties (NM_IP4_CONFIG (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->gateway);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip4_address_unref);
|
|
||||||
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip4_route_unref);
|
|
||||||
|
|
||||||
if (priv->nameservers)
|
|
||||||
g_array_free (priv->nameservers, TRUE);
|
|
||||||
|
|
||||||
if (priv->wins)
|
|
||||||
g_array_free (priv->wins, TRUE);
|
|
||||||
|
|
||||||
if (priv->domains) {
|
|
||||||
g_ptr_array_set_free_func (priv->domains, g_free);
|
|
||||||
g_ptr_array_free (priv->domains, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->searches) {
|
|
||||||
g_ptr_array_set_free_func (priv->searches, g_free);
|
|
||||||
g_ptr_array_free (priv->searches, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_ip4_config_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMIP4Config *self = NM_IP4_CONFIG (object);
|
|
||||||
NMIP4ConfigPrivate *priv = NM_IP4_CONFIG_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_GATEWAY:
|
|
||||||
g_value_set_string (value, nm_ip4_config_get_gateway (self));
|
|
||||||
break;
|
|
||||||
case PROP_ADDRESSES:
|
|
||||||
nm_utils_ip4_addresses_to_gvalue (priv->addresses, value);
|
|
||||||
break;
|
|
||||||
case PROP_ROUTES:
|
|
||||||
nm_utils_ip4_routes_to_gvalue (priv->routes, value);
|
|
||||||
break;
|
|
||||||
case PROP_NAMESERVERS:
|
|
||||||
g_value_set_boxed (value, nm_ip4_config_get_nameservers (self));
|
|
||||||
break;
|
|
||||||
case PROP_DOMAINS:
|
|
||||||
g_value_set_boxed (value, nm_ip4_config_get_domains (self));
|
|
||||||
break;
|
|
||||||
case PROP_SEARCHES:
|
|
||||||
g_value_set_boxed (value, nm_ip4_config_get_searches (self));
|
|
||||||
break;
|
|
||||||
case PROP_WINS_SERVERS:
|
|
||||||
g_value_set_boxed (value, nm_ip4_config_get_wins_servers (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_ip4_config_class_init (NMIP4ConfigClass *config_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (config_class, sizeof (NMIP4ConfigPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:gateway:
|
|
||||||
*
|
|
||||||
* The IP4 gateway address of the configuration as string.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_GATEWAY,
|
|
||||||
g_param_spec_string (NM_IP4_CONFIG_GATEWAY, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:addresses:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing #NMIP4Address<!-- -->es of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ADDRESSES,
|
|
||||||
g_param_spec_pointer (NM_IP4_CONFIG_ADDRESSES, "", "",
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:routes:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing #NMSettingIP4Route<!-- -->s of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ROUTES,
|
|
||||||
g_param_spec_pointer (NM_IP4_CONFIG_ROUTES, "", "",
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:nameservers:
|
|
||||||
*
|
|
||||||
* The #GArray containing name servers (#guint32s) of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_NAMESERVERS,
|
|
||||||
g_param_spec_boxed (NM_IP4_CONFIG_NAMESERVERS, "", "",
|
|
||||||
NM_TYPE_UINT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:domains:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing domain strings of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DOMAINS,
|
|
||||||
g_param_spec_boxed (NM_IP4_CONFIG_DOMAINS, "", "",
|
|
||||||
NM_TYPE_STRING_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:searches:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing dns search strings of the configuration.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SEARCHES,
|
|
||||||
g_param_spec_boxed (NM_IP4_CONFIG_SEARCHES, "", "",
|
|
||||||
NM_TYPE_STRING_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP4Config:wins-servers:
|
|
||||||
*
|
|
||||||
* The #GArray containing WINS servers (#guint32s) of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_WINS_SERVERS,
|
|
||||||
g_param_spec_boxed (NM_IP4_CONFIG_WINS_SERVERS, "", "",
|
|
||||||
NM_TYPE_UINT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @object_path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMIP4Config.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new IP4 configuration
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_ip4_config_new (DBusGConnection *connection, const char *object_path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (object_path != NULL, NULL);
|
|
||||||
|
|
||||||
return (GObject *) g_object_new (NM_TYPE_IP4_CONFIG,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, object_path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_gateway:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the IP4 gateway address.
|
|
||||||
*
|
|
||||||
* Returns: the IP4 address of the gateway.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_ip4_config_get_gateway (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP4_CONFIG_GET_PRIVATE (config)->gateway;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_addresses:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the IP4 addresses (containing the address, prefix, and gateway).
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMIP4Address): the #GSList containing #NMIP4Address<!-- -->es.
|
|
||||||
* This is the internal copy used by the configuration and must not be modified.
|
|
||||||
**/
|
|
||||||
const GSList *
|
|
||||||
nm_ip4_config_get_addresses (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP4_CONFIG_GET_PRIVATE (config)->addresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_nameservers:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the domain name servers (DNS).
|
|
||||||
*
|
|
||||||
* Returns: (element-type guint32): the #GArray containing #guint32s.
|
|
||||||
* This is the internal copy used by the configuration and must not be
|
|
||||||
* modified.
|
|
||||||
**/
|
|
||||||
const GArray *
|
|
||||||
nm_ip4_config_get_nameservers (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP4_CONFIG_GET_PRIVATE (config)->nameservers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_domains:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the domain names.
|
|
||||||
*
|
|
||||||
* Returns: (element-type utf8): the #GPtrArray containing domains as strings. This is the
|
|
||||||
* internal copy used by the configuration, and must not be modified.
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_ip4_config_get_domains (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return handle_ptr_array_return (NM_IP4_CONFIG_GET_PRIVATE (config)->domains);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_searches:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the dns searches.
|
|
||||||
*
|
|
||||||
* Returns: (element-type utf8): the #GPtrArray containing dns searches as strings. This is the
|
|
||||||
* internal copy used by the configuration, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_ip4_config_get_searches (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return handle_ptr_array_return (NM_IP4_CONFIG_GET_PRIVATE (config)->searches);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_wins_servers:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the Windows Internet Name Service servers (WINS).
|
|
||||||
*
|
|
||||||
* Returns: (element-type guint32): the #GArray containing #guint32s.
|
|
||||||
* This is the internal copy used by the configuration and must not be
|
|
||||||
* modified.
|
|
||||||
**/
|
|
||||||
const GArray *
|
|
||||||
nm_ip4_config_get_wins_servers (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP4_CONFIG_GET_PRIVATE (config)->wins;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip4_config_get_routes:
|
|
||||||
* @config: a #NMIP4Config
|
|
||||||
*
|
|
||||||
* Gets the routes.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMIP4Route): the #GSList containing
|
|
||||||
* #NMIP4Route<!-- -->s. This is the internal copy used by the configuration,
|
|
||||||
* and must not be modified.
|
|
||||||
**/
|
|
||||||
const GSList *
|
|
||||||
nm_ip4_config_get_routes (NMIP4Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP4_CONFIG_GET_PRIVATE (config)->routes;
|
|
||||||
}
|
|
||||||
|
|
@ -1,79 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2008 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_IP4_CONFIG_H
|
|
||||||
#define NM_IP4_CONFIG_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-object.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_IP4_CONFIG (nm_ip4_config_get_type ())
|
|
||||||
#define NM_IP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IP4_CONFIG, NMIP4Config))
|
|
||||||
#define NM_IP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_IP4_CONFIG, NMIP4ConfigClass))
|
|
||||||
#define NM_IS_IP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_IP4_CONFIG))
|
|
||||||
#define NM_IS_IP4_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP4_CONFIG))
|
|
||||||
#define NM_IP4_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP4_CONFIG, NMIP4ConfigClass))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMIP4Config;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMIP4ConfigClass;
|
|
||||||
|
|
||||||
#define NM_IP4_CONFIG_GATEWAY "gateway"
|
|
||||||
#define NM_IP4_CONFIG_ADDRESSES "addresses"
|
|
||||||
#define NM_IP4_CONFIG_ROUTES "routes"
|
|
||||||
#define NM_IP4_CONFIG_NAMESERVERS "nameservers"
|
|
||||||
#define NM_IP4_CONFIG_DOMAINS "domains"
|
|
||||||
#define NM_IP4_CONFIG_SEARCHES "searches"
|
|
||||||
#define NM_IP4_CONFIG_WINS_SERVERS "wins-servers"
|
|
||||||
|
|
||||||
GType nm_ip4_config_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_ip4_config_new (DBusGConnection *connection, const char *object_path);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_ip4_config_get_gateway (NMIP4Config *config);
|
|
||||||
const GSList * nm_ip4_config_get_addresses (NMIP4Config *config);
|
|
||||||
const GSList * nm_ip4_config_get_routes (NMIP4Config *config);
|
|
||||||
const GArray * nm_ip4_config_get_nameservers (NMIP4Config *config);
|
|
||||||
const GPtrArray *nm_ip4_config_get_domains (NMIP4Config *config);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const GPtrArray *nm_ip4_config_get_searches (NMIP4Config *config);
|
|
||||||
const GArray * nm_ip4_config_get_wins_servers (NMIP4Config *config);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_IP4_CONFIG_H */
|
|
||||||
|
|
@ -1,498 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2008 - 2014 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-setting-ip6-config.h"
|
|
||||||
#include "nm-ip6-config.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMIP6Config, nm_ip6_config, NM_TYPE_OBJECT)
|
|
||||||
|
|
||||||
#define NM_IP6_CONFIG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_IP6_CONFIG, NMIP6ConfigPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
|
|
||||||
char *gateway;
|
|
||||||
GSList *addresses;
|
|
||||||
GSList *routes;
|
|
||||||
GSList *nameservers;
|
|
||||||
GPtrArray *domains;
|
|
||||||
GPtrArray *searches;
|
|
||||||
} NMIP6ConfigPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_GATEWAY,
|
|
||||||
PROP_ADDRESSES,
|
|
||||||
PROP_ROUTES,
|
|
||||||
PROP_NAMESERVERS,
|
|
||||||
PROP_DOMAINS,
|
|
||||||
PROP_SEARCHES,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @object_path: the DBus object path of the device
|
|
||||||
*
|
|
||||||
* Creates a new #NMIP6Config.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new IP6 configuration
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_ip6_config_new (DBusGConnection *connection, const char *object_path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (object_path != NULL, NULL);
|
|
||||||
|
|
||||||
return (GObject *) g_object_new (NM_TYPE_IP6_CONFIG,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, object_path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ip6_address_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
|
|
||||||
priv->addresses = NULL;
|
|
||||||
|
|
||||||
priv->addresses = nm_utils_ip6_addresses_from_gvalue (value);
|
|
||||||
_nm_object_queue_notify (object, NM_IP6_CONFIG_ADDRESSES);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ip6_nameserver_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
if (!_nm_ip6_address_array_demarshal (value, (GSList **) field))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (pspec && !strcmp (pspec->name, NM_IP6_CONFIG_NAMESERVERS))
|
|
||||||
_nm_object_queue_notify (object, NM_IP6_CONFIG_NAMESERVERS);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_domains (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
if (!_nm_string_array_demarshal (value, (GPtrArray **) field))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
_nm_object_queue_notify (object, NM_IP6_CONFIG_DOMAINS);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_searches (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
if (!_nm_string_array_demarshal (value, (GPtrArray **) field))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
_nm_object_queue_notify (object, NM_IP6_CONFIG_SEARCHES);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
demarshal_ip6_routes_array (NMObject *object, GParamSpec *pspec, GValue *value, gpointer field)
|
|
||||||
{
|
|
||||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
|
|
||||||
priv->routes = NULL;
|
|
||||||
|
|
||||||
priv->routes = nm_utils_ip6_routes_from_gvalue (value);
|
|
||||||
_nm_object_queue_notify (object, NM_IP6_CONFIG_ROUTES);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_IP6_CONFIG_GATEWAY, &priv->gateway, },
|
|
||||||
{ NM_IP6_CONFIG_ADDRESSES, &priv->addresses, demarshal_ip6_address_array },
|
|
||||||
{ NM_IP6_CONFIG_ROUTES, &priv->routes, demarshal_ip6_routes_array },
|
|
||||||
{ NM_IP6_CONFIG_NAMESERVERS, &priv->nameservers, demarshal_ip6_nameserver_array },
|
|
||||||
{ NM_IP6_CONFIG_DOMAINS, &priv->domains, demarshal_domains },
|
|
||||||
{ NM_IP6_CONFIG_SEARCHES, &priv->searches, demarshal_searches },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (config),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_gateway:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the IP6 gateway.
|
|
||||||
*
|
|
||||||
* Returns: the IPv6 gateway of the configuration.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_ip6_config_get_gateway (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP6_CONFIG_GET_PRIVATE (config)->gateway;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_addresses:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the IP6 addresses (containing the address, prefix, and gateway).
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMIP6Address): the #GSList containing
|
|
||||||
* #NMIP6Address<!-- -->es. This is the internal copy used by the configuration
|
|
||||||
* and must not be modified.
|
|
||||||
**/
|
|
||||||
const GSList *
|
|
||||||
nm_ip6_config_get_addresses (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP6_CONFIG_GET_PRIVATE (config)->addresses;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_num_nameservers:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the number of the domain name servers in the configuration.
|
|
||||||
*
|
|
||||||
* Returns: the number of domain name servers
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
guint32
|
|
||||||
nm_ip6_config_get_num_nameservers (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), 0);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return g_slist_length (NM_IP6_CONFIG_GET_PRIVATE (config)->nameservers);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_nameserver:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
* @idx: index of the nameserver to return
|
|
||||||
*
|
|
||||||
* Gets the domain name server at index @idx in the configuration.
|
|
||||||
*
|
|
||||||
* Returns: (array fixed-size=16) (element-type guint8) (transfer none):
|
|
||||||
* the IPv6 address of domain name server at index @iidx
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const struct in6_addr *
|
|
||||||
nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx)
|
|
||||||
{
|
|
||||||
NMIP6ConfigPrivate *priv;
|
|
||||||
GSList *item;
|
|
||||||
guint32 i = 0;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
priv = NM_IP6_CONFIG_GET_PRIVATE (config);
|
|
||||||
|
|
||||||
for (item = priv->nameservers; item && i < idx; i++)
|
|
||||||
item = item->next;
|
|
||||||
|
|
||||||
g_return_val_if_fail (item, NULL);
|
|
||||||
return item ? (const struct in6_addr *) item->data : NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: like in libnm_util, in6_addr is not introspectable, so skipping here */
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_nameservers: (skip)
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the domain name servers (DNS).
|
|
||||||
*
|
|
||||||
* Returns: a #GSList containing elements of type 'struct in6_addr' which
|
|
||||||
* contain the addresses of nameservers of the configuration. This is the
|
|
||||||
* internal copy used by the configuration and must not be modified.
|
|
||||||
**/
|
|
||||||
const GSList *
|
|
||||||
nm_ip6_config_get_nameservers (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP6_CONFIG_GET_PRIVATE (config)->nameservers;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_domains:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the domain names.
|
|
||||||
*
|
|
||||||
* Returns: (element-type utf8): the #GPtrArray containing domains as strings.
|
|
||||||
* This is the internal copy used by the configuration, and must not be modified.
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_ip6_config_get_domains (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return handle_ptr_array_return (NM_IP6_CONFIG_GET_PRIVATE (config)->domains);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_searches:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the dns searches.
|
|
||||||
*
|
|
||||||
* Returns: (element-type utf8): the #GPtrArray containing dns searches as strings.
|
|
||||||
* This is the internal copy used by the configuration, and must not be modified.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
const GPtrArray *
|
|
||||||
nm_ip6_config_get_searches (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return handle_ptr_array_return (NM_IP6_CONFIG_GET_PRIVATE (config)->searches);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_ip6_config_get_routes:
|
|
||||||
* @config: a #NMIP6Config
|
|
||||||
*
|
|
||||||
* Gets the routes.
|
|
||||||
*
|
|
||||||
* Returns: (element-type NMIP6Route): the #GSList containing
|
|
||||||
* #NMIP6Route<!-- -->s. This is the internal copy used by the configuration,
|
|
||||||
* and must not be modified.
|
|
||||||
**/
|
|
||||||
const GSList *
|
|
||||||
nm_ip6_config_get_routes (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_IP6_CONFIG (config), NULL);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (config));
|
|
||||||
return NM_IP6_CONFIG_GET_PRIVATE (config)->routes;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_ip6_config_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_IP6_CONFIG);
|
|
||||||
register_properties (NM_IP6_CONFIG (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->gateway);
|
|
||||||
|
|
||||||
g_slist_free_full (priv->addresses, (GDestroyNotify) nm_ip6_address_unref);
|
|
||||||
g_slist_free_full (priv->routes, (GDestroyNotify) nm_ip6_route_unref);
|
|
||||||
g_slist_free_full (priv->nameservers, g_free);
|
|
||||||
|
|
||||||
if (priv->domains) {
|
|
||||||
g_ptr_array_set_free_func (priv->domains, g_free);
|
|
||||||
g_ptr_array_free (priv->domains, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (priv->searches) {
|
|
||||||
g_ptr_array_set_free_func (priv->searches, g_free);
|
|
||||||
g_ptr_array_free (priv->searches, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_object_unref (priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_ip6_config_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMIP6Config *self = NM_IP6_CONFIG (object);
|
|
||||||
NMIP6ConfigPrivate *priv = NM_IP6_CONFIG_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_GATEWAY:
|
|
||||||
g_value_set_string (value, nm_ip6_config_get_gateway (self));
|
|
||||||
break;
|
|
||||||
case PROP_ADDRESSES:
|
|
||||||
nm_utils_ip6_addresses_to_gvalue (priv->addresses, value);
|
|
||||||
break;
|
|
||||||
case PROP_ROUTES:
|
|
||||||
nm_utils_ip6_routes_to_gvalue (priv->routes, value);
|
|
||||||
break;
|
|
||||||
case PROP_NAMESERVERS:
|
|
||||||
g_value_set_boxed (value, nm_ip6_config_get_nameservers (self));
|
|
||||||
break;
|
|
||||||
case PROP_DOMAINS:
|
|
||||||
g_value_set_boxed (value, nm_ip6_config_get_domains (self));
|
|
||||||
break;
|
|
||||||
case PROP_SEARCHES:
|
|
||||||
g_value_set_boxed (value, nm_ip6_config_get_searches (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_ip6_config_init (NMIP6Config *config)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_ip6_config_class_init (NMIP6ConfigClass *config_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (config_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (config_class, sizeof (NMIP6ConfigPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP6Config:gateway:
|
|
||||||
*
|
|
||||||
* The IPv6 gateway as string
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_GATEWAY,
|
|
||||||
g_param_spec_string (NM_IP6_CONFIG_GATEWAY, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP6Config:addresses:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing the IPv6 addresses; use
|
|
||||||
* nm_utils_ip6_addresses_from_gvalue() to return a #GSList of
|
|
||||||
* #NMSettingIP6Address objects that is more usable than the raw data.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ADDRESSES,
|
|
||||||
g_param_spec_boxed (NM_IP6_CONFIG_ADDRESSES, "", "",
|
|
||||||
NM_TYPE_IP6_ADDRESS_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP6Config:routes:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing the IPv6 routes; use
|
|
||||||
* nm_utils_ip6_routes_from_gvalue() to return a #GSList of
|
|
||||||
* #NMSettingIP6Address objects that is more usable than the raw data.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_ROUTES,
|
|
||||||
g_param_spec_boxed (NM_IP6_CONFIG_ROUTES, "", "",
|
|
||||||
NM_TYPE_IP6_ROUTE_OBJECT_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP6Config:nameservers:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing elements of type 'struct ip6_addr' which
|
|
||||||
* contain the addresses of nameservers of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_NAMESERVERS,
|
|
||||||
g_param_spec_boxed (NM_IP6_CONFIG_NAMESERVERS, "", "",
|
|
||||||
NM_TYPE_IP6_ADDRESS_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP6Config:domains:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing domain strings of the configuration.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DOMAINS,
|
|
||||||
g_param_spec_boxed (NM_IP6_CONFIG_DOMAINS, "", "",
|
|
||||||
NM_TYPE_STRING_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMIP6Config:searches:
|
|
||||||
*
|
|
||||||
* The #GPtrArray containing dns search strings of the configuration.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_SEARCHES,
|
|
||||||
g_param_spec_boxed (NM_IP6_CONFIG_SEARCHES, "", "",
|
|
||||||
NM_TYPE_STRING_ARRAY,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,81 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2008 - 2014 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_IP6_CONFIG_H
|
|
||||||
#define NM_IP6_CONFIG_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-object.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_IP6_CONFIG (nm_ip6_config_get_type ())
|
|
||||||
#define NM_IP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IP6_CONFIG, NMIP6Config))
|
|
||||||
#define NM_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_IP6_CONFIG, NMIP6ConfigClass))
|
|
||||||
#define NM_IS_IP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_IP6_CONFIG))
|
|
||||||
#define NM_IS_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_IP6_CONFIG))
|
|
||||||
#define NM_IP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_IP6_CONFIG, NMIP6ConfigClass))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObject parent;
|
|
||||||
} NMIP6Config;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMObjectClass parent;
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMIP6ConfigClass;
|
|
||||||
|
|
||||||
#define NM_IP6_CONFIG_GATEWAY "gateway"
|
|
||||||
#define NM_IP6_CONFIG_ADDRESSES "addresses"
|
|
||||||
#define NM_IP6_CONFIG_ROUTES "routes"
|
|
||||||
#define NM_IP6_CONFIG_NAMESERVERS "nameservers"
|
|
||||||
#define NM_IP6_CONFIG_DOMAINS "domains"
|
|
||||||
#define NM_IP6_CONFIG_SEARCHES "searches"
|
|
||||||
|
|
||||||
GType nm_ip6_config_get_type (void);
|
|
||||||
|
|
||||||
GObject *nm_ip6_config_new (DBusGConnection *connection, const char *object_path);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const char * nm_ip6_config_get_gateway (NMIP6Config *config);
|
|
||||||
const GSList * nm_ip6_config_get_addresses (NMIP6Config *config);
|
|
||||||
const GSList * nm_ip6_config_get_routes (NMIP6Config *config);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
guint32 nm_ip6_config_get_num_nameservers (NMIP6Config *config);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const struct in6_addr *nm_ip6_config_get_nameserver (NMIP6Config *config, guint32 idx);
|
|
||||||
const GSList * nm_ip6_config_get_nameservers (NMIP6Config *config);
|
|
||||||
const GPtrArray * nm_ip6_config_get_domains (NMIP6Config *config);
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
const GPtrArray * nm_ip6_config_get_searches (NMIP6Config *config);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_IP6_CONFIG_H */
|
|
||||||
|
|
@ -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 <string.h>
|
|
||||||
|
|
||||||
#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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -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 */
|
|
||||||
|
|
@ -1,93 +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 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_OBJECT_PRIVATE_H
|
|
||||||
#define NM_OBJECT_PRIVATE_H
|
|
||||||
|
|
||||||
#include "nm-object.h"
|
|
||||||
|
|
||||||
void _nm_object_ensure_inited (NMObject *object);
|
|
||||||
|
|
||||||
typedef gboolean (*PropertyMarshalFunc) (NMObject *object,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
GValue *value,
|
|
||||||
gpointer field);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const char *name;
|
|
||||||
gpointer field;
|
|
||||||
PropertyMarshalFunc func;
|
|
||||||
GType object_type;
|
|
||||||
const char *signal_prefix;
|
|
||||||
} NMPropertiesInfo;
|
|
||||||
|
|
||||||
DBusGProxy *_nm_object_new_proxy (NMObject *self,
|
|
||||||
const char *path,
|
|
||||||
const char *interface);
|
|
||||||
|
|
||||||
void _nm_object_register_properties (NMObject *object,
|
|
||||||
DBusGProxy *proxy,
|
|
||||||
const NMPropertiesInfo *info);
|
|
||||||
|
|
||||||
gboolean _nm_object_reload_properties (NMObject *object, GError **error);
|
|
||||||
|
|
||||||
void _nm_object_reload_properties_async (NMObject *object,
|
|
||||||
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);
|
|
||||||
|
|
||||||
/* DBus property accessors */
|
|
||||||
|
|
||||||
void _nm_object_reload_property (NMObject *object,
|
|
||||||
const char *interface,
|
|
||||||
const char *prop_name);
|
|
||||||
|
|
||||||
void _nm_object_set_property (NMObject *object,
|
|
||||||
const char *interface,
|
|
||||||
const char *prop_name,
|
|
||||||
GValue *value);
|
|
||||||
|
|
||||||
static inline const GPtrArray *
|
|
||||||
handle_ptr_array_return (GPtrArray *array)
|
|
||||||
{
|
|
||||||
/* zero-length is special-case; return NULL */
|
|
||||||
if (!array || !array->len)
|
|
||||||
return NULL;
|
|
||||||
return array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* object demarshalling support */
|
|
||||||
typedef GType (*NMObjectTypeFunc) (DBusGConnection *connection, const char *path);
|
|
||||||
typedef void (*NMObjectTypeCallbackFunc) (GType type, gpointer user_data);
|
|
||||||
typedef void (*NMObjectTypeAsyncFunc) (DBusGConnection *connection,
|
|
||||||
const char *path,
|
|
||||||
NMObjectTypeCallbackFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void _nm_object_register_type_func (GType base_type, NMObjectTypeFunc type_func,
|
|
||||||
NMObjectTypeAsyncFunc type_async_func);
|
|
||||||
|
|
||||||
#endif /* NM_OBJECT_PRIVATE_H */
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,91 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_OBJECT_H
|
|
||||||
#define NM_OBJECT_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
|
|
||||||
#include "nm-version.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_OBJECT (nm_object_get_type ())
|
|
||||||
#define NM_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_OBJECT, NMObject))
|
|
||||||
#define NM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_OBJECT, NMObjectClass))
|
|
||||||
#define NM_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_OBJECT))
|
|
||||||
#define NM_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_OBJECT))
|
|
||||||
#define NM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_OBJECT, NMObjectClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMObjectError:
|
|
||||||
* @NM_OBJECT_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_OBJECT_ERROR_OBJECT_CREATION_FAILURE: an error ocured while creating an #NMObject
|
|
||||||
*
|
|
||||||
* Describes errors that may result from operations involving a #NMObject.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
typedef enum {
|
|
||||||
NM_OBJECT_ERROR_UNKNOWN = 0,
|
|
||||||
NM_OBJECT_ERROR_OBJECT_CREATION_FAILURE,
|
|
||||||
} NMObjectError;
|
|
||||||
|
|
||||||
#define NM_OBJECT_ERROR nm_object_error_quark ()
|
|
||||||
GQuark nm_object_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_OBJECT_DBUS_CONNECTION "dbus-connection"
|
|
||||||
#define NM_OBJECT_DBUS_PATH "dbus-path"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GObject parent;
|
|
||||||
} NMObject;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GObjectClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
/* The "object-creation-failed" signal is PRIVATE for libnm-glib and
|
|
||||||
* is not meant for any external usage. It indicates that an error
|
|
||||||
* occurred during creation of an object.
|
|
||||||
*/
|
|
||||||
void (*object_creation_failed) (NMObject *master_object,
|
|
||||||
GError *error,
|
|
||||||
char *failed_path);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMObjectClass;
|
|
||||||
|
|
||||||
GType nm_object_get_type (void);
|
|
||||||
|
|
||||||
DBusGConnection *nm_object_get_connection (NMObject *object);
|
|
||||||
const char *nm_object_get_path (NMObject *object);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_OBJECT_H */
|
|
||||||
|
|
@ -1,33 +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 2009 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __NM_REMOTE_CONNECTION_PRIVATE_H__
|
|
||||||
#define __NM_REMOTE_CONNECTION_PRIVATE_H__
|
|
||||||
|
|
||||||
#define NM_REMOTE_CONNECTION_INIT_RESULT "init-result"
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
NM_REMOTE_CONNECTION_INIT_RESULT_UNKNOWN = 0,
|
|
||||||
NM_REMOTE_CONNECTION_INIT_RESULT_SUCCESS,
|
|
||||||
NM_REMOTE_CONNECTION_INIT_RESULT_ERROR,
|
|
||||||
NM_REMOTE_CONNECTION_INIT_RESULT_INVISIBLE,
|
|
||||||
} NMRemoteConnectionInitResult;
|
|
||||||
|
|
||||||
#endif /* __NM_REMOTE_CONNECTION_PRIVATE__ */
|
|
||||||
|
|
@ -1,954 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
#include "nm-setting-connection.h"
|
|
||||||
#include "nm-remote-connection.h"
|
|
||||||
#include "nm-remote-connection-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-dbus-glib-types.h"
|
|
||||||
#include "nm-dbus-helpers-private.h"
|
|
||||||
#include "nm-setting-private.h"
|
|
||||||
|
|
||||||
#define NM_REMOTE_CONNECTION_BUS "bus"
|
|
||||||
#define NM_REMOTE_CONNECTION_DBUS_CONNECTION "dbus-connection"
|
|
||||||
#define NM_REMOTE_CONNECTION_DBUS_PATH "dbus-path"
|
|
||||||
|
|
||||||
static void nm_remote_connection_initable_iface_init (GInitableIface *iface);
|
|
||||||
static void nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (NMRemoteConnection, nm_remote_connection, NM_TYPE_CONNECTION,
|
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_INITABLE, nm_remote_connection_initable_iface_init);
|
|
||||||
G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, nm_remote_connection_async_initable_iface_init);
|
|
||||||
)
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_BUS,
|
|
||||||
PROP_DBUS_CONNECTION,
|
|
||||||
PROP_DBUS_PATH,
|
|
||||||
PROP_UNSAVED,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
UPDATED,
|
|
||||||
REMOVED,
|
|
||||||
VISIBLE,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
|
||||||
|
|
||||||
typedef struct RemoteCall RemoteCall;
|
|
||||||
typedef void (*RemoteCallFetchResultCb) (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error);
|
|
||||||
|
|
||||||
struct RemoteCall {
|
|
||||||
NMRemoteConnection *self;
|
|
||||||
DBusGProxyCall *call;
|
|
||||||
RemoteCallFetchResultCb fetch_result_cb;
|
|
||||||
GFunc callback;
|
|
||||||
gpointer user_data;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGConnection *bus;
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
DBusGProxy *props_proxy;
|
|
||||||
gboolean proxy_is_destroyed;
|
|
||||||
GSList *calls;
|
|
||||||
|
|
||||||
gboolean inited;
|
|
||||||
gboolean unsaved;
|
|
||||||
|
|
||||||
gboolean visible;
|
|
||||||
} NMRemoteConnectionPrivate;
|
|
||||||
|
|
||||||
#define NM_REMOTE_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionPrivate))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_error_quark:
|
|
||||||
*
|
|
||||||
* Registers an error quark for #NMRemoteConnection if necessary.
|
|
||||||
*
|
|
||||||
* Returns: the error quark used for #NMRemoteConnection errors.
|
|
||||||
**/
|
|
||||||
GQuark
|
|
||||||
nm_remote_connection_error_quark (void)
|
|
||||||
{
|
|
||||||
static GQuark quark = 0;
|
|
||||||
|
|
||||||
if (G_UNLIKELY (quark == 0))
|
|
||||||
quark = g_quark_from_static_string ("nm-remote-connection-error-quark");
|
|
||||||
return quark;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_remote_connection_ensure_inited (NMRemoteConnection *self)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
if (!priv->inited) {
|
|
||||||
if (!g_initable_init (G_INITABLE (self), NULL, &error)) {
|
|
||||||
/* Don't warn when the call times out because the settings service can't
|
|
||||||
* be activated or whatever.
|
|
||||||
*/
|
|
||||||
if (!g_error_matches (error, DBUS_GERROR, DBUS_GERROR_NO_REPLY)) {
|
|
||||||
g_warning ("%s: (NMRemoteConnection) error initializing: %s\n",
|
|
||||||
__func__, error->message);
|
|
||||||
}
|
|
||||||
g_error_free (error);
|
|
||||||
}
|
|
||||||
priv->inited = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
remote_call_dbus_cb (DBusGProxy *proxy, DBusGProxyCall *proxy_call, gpointer user_data)
|
|
||||||
{
|
|
||||||
RemoteCall *call = user_data;
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (call->self);
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
g_assert ( (!proxy && !proxy_call && priv->proxy_is_destroyed) ||
|
|
||||||
( proxy && proxy_call && !priv->proxy_is_destroyed && proxy == priv->proxy) );
|
|
||||||
|
|
||||||
if (priv->proxy_is_destroyed) {
|
|
||||||
error = g_error_new_literal (NM_REMOTE_CONNECTION_ERROR,
|
|
||||||
NM_REMOTE_CONNECTION_ERROR_DISCONNECTED,
|
|
||||||
_("Disconnected by D-Bus"));
|
|
||||||
}
|
|
||||||
call->fetch_result_cb (call, proxy_call, error);
|
|
||||||
g_clear_error (&error);
|
|
||||||
|
|
||||||
priv->calls = g_slist_remove (priv->calls, call);
|
|
||||||
g_object_unref (call->self);
|
|
||||||
g_free (call);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
remote_call_cleanup_cb (void *user_data)
|
|
||||||
{
|
|
||||||
remote_call_dbus_cb (NULL, NULL, user_data);
|
|
||||||
return G_SOURCE_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static RemoteCall *
|
|
||||||
remote_call_new (NMRemoteConnection *self,
|
|
||||||
RemoteCallFetchResultCb fetch_result_cb,
|
|
||||||
GFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
RemoteCall *call;
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
g_assert (fetch_result_cb);
|
|
||||||
|
|
||||||
if (priv->proxy_is_destroyed && !callback)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
call = g_malloc0 (sizeof (RemoteCall));
|
|
||||||
call->self = g_object_ref (self);
|
|
||||||
call->fetch_result_cb = fetch_result_cb;
|
|
||||||
call->user_data = user_data;
|
|
||||||
call->callback = callback;
|
|
||||||
|
|
||||||
if (priv->proxy_is_destroyed) {
|
|
||||||
g_idle_add (remote_call_cleanup_cb, call);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
priv->calls = g_slist_prepend (priv->calls, call);
|
|
||||||
return call;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
proxy_set_destroyed (NMRemoteConnection *self)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
if (priv->proxy_is_destroyed) {
|
|
||||||
g_assert (!priv->calls);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->proxy_is_destroyed = TRUE;
|
|
||||||
|
|
||||||
priv->calls = g_slist_reverse (priv->calls);
|
|
||||||
while (priv->calls)
|
|
||||||
remote_call_dbus_cb (NULL, NULL, priv->calls->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
proxy_destroy_cb (DBusGProxy* proxy, gpointer user_data) {
|
|
||||||
proxy_set_destroyed (user_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
result_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionResultFunc func = (NMRemoteConnectionResultFunc)(void (*) (void)) call->callback;
|
|
||||||
GError *local_error = NULL;
|
|
||||||
|
|
||||||
if (!error) {
|
|
||||||
dbus_g_proxy_end_call (NM_REMOTE_CONNECTION_GET_PRIVATE (call->self)->proxy,
|
|
||||||
proxy_call, &local_error, G_TYPE_INVALID);
|
|
||||||
error = local_error;
|
|
||||||
}
|
|
||||||
if (func)
|
|
||||||
(*func) (call->self, error, call->user_data);
|
|
||||||
g_clear_error (&local_error);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_commit_changes:
|
|
||||||
* @connection: the #NMRemoteConnection
|
|
||||||
* @callback: (scope async) (allow-none): a function to be called when the
|
|
||||||
* commit completes
|
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
|
||||||
*
|
|
||||||
* Send any local changes to the settings and properties of this connection to
|
|
||||||
* NetworkManager, which will immediately save them to disk.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
nm_remote_connection_commit_changes (NMRemoteConnection *self,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv;
|
|
||||||
RemoteCall *call;
|
|
||||||
GHashTable *settings;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_REMOTE_CONNECTION (self));
|
|
||||||
|
|
||||||
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
call = remote_call_new (self, result_cb, (GFunc)(void (*) (void)) callback, user_data);
|
|
||||||
if (!call)
|
|
||||||
return;
|
|
||||||
|
|
||||||
settings = nm_connection_to_hash (NM_CONNECTION (self), NM_SETTING_HASH_FLAG_ALL);
|
|
||||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "Update",
|
|
||||||
remote_call_dbus_cb, call, NULL,
|
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, settings,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
g_assert (call->call);
|
|
||||||
g_hash_table_destroy (settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_commit_changes_unsaved:
|
|
||||||
* @connection: the #NMRemoteConnection
|
|
||||||
* @callback: (scope async) (allow-none): a function to be called when the
|
|
||||||
* commit completes
|
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
|
||||||
*
|
|
||||||
* Send any local changes to the settings and properties of this connection to
|
|
||||||
* NetworkManager. The changes are not saved to disk until either
|
|
||||||
* nm_remote_connection_save() or nm_remote_connection_commit_changes() is
|
|
||||||
* called.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
nm_remote_connection_commit_changes_unsaved (NMRemoteConnection *connection,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv;
|
|
||||||
GHashTable *settings = NULL;
|
|
||||||
RemoteCall *call;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
|
|
||||||
|
|
||||||
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
|
|
||||||
|
|
||||||
call = remote_call_new (connection, result_cb, (GFunc)(void (*) (void)) callback, user_data);
|
|
||||||
if (!call)
|
|
||||||
return;
|
|
||||||
|
|
||||||
settings = nm_connection_to_hash (NM_CONNECTION (connection), NM_SETTING_HASH_FLAG_ALL);
|
|
||||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "UpdateUnsaved",
|
|
||||||
remote_call_dbus_cb, call, NULL,
|
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, settings,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
g_assert (call->call);
|
|
||||||
g_hash_table_destroy (settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_save:
|
|
||||||
* @connection: the #NMRemoteConnection
|
|
||||||
* @callback: (scope async) (allow-none): a function to be called when the
|
|
||||||
* save completes
|
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
|
||||||
*
|
|
||||||
* Saves the connection to disk if the connection has changes that have not yet
|
|
||||||
* been written to disk, or if the connection has never been saved.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
nm_remote_connection_save (NMRemoteConnection *connection,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv;
|
|
||||||
RemoteCall *call;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_REMOTE_CONNECTION (connection));
|
|
||||||
|
|
||||||
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (connection);
|
|
||||||
|
|
||||||
call = remote_call_new (connection, result_cb, (GFunc)(void (*) (void)) callback, user_data);
|
|
||||||
if (!call)
|
|
||||||
return;
|
|
||||||
|
|
||||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "Save", remote_call_dbus_cb, call, NULL, G_TYPE_INVALID);
|
|
||||||
g_assert (call->call);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_delete:
|
|
||||||
* @connection: the #NMRemoteConnection
|
|
||||||
* @callback: (scope async) (allow-none): a function to be called when the delete completes
|
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
|
||||||
*
|
|
||||||
* Delete the connection.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
nm_remote_connection_delete (NMRemoteConnection *self,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv;
|
|
||||||
RemoteCall *call;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_REMOTE_CONNECTION (self));
|
|
||||||
|
|
||||||
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
call = remote_call_new (self, result_cb, (GFunc)(void (*) (void)) callback, user_data);
|
|
||||||
if (!call)
|
|
||||||
return;
|
|
||||||
|
|
||||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "Delete",
|
|
||||||
remote_call_dbus_cb, call, NULL,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
g_assert (call->call);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_secrets_cb (RemoteCall *call, DBusGProxyCall *proxy_call, GError *error)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionGetSecretsFunc func = (NMRemoteConnectionGetSecretsFunc)(void (*) (void)) call->callback;
|
|
||||||
GHashTable *secrets = NULL;
|
|
||||||
GError *local_error = NULL;
|
|
||||||
|
|
||||||
if (!error) {
|
|
||||||
dbus_g_proxy_end_call (NM_REMOTE_CONNECTION_GET_PRIVATE (call->self)->proxy,
|
|
||||||
proxy_call, &local_error,
|
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &secrets,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
error = local_error;
|
|
||||||
}
|
|
||||||
if (func)
|
|
||||||
(*func) (call->self, error ? NULL : secrets, error, call->user_data);
|
|
||||||
g_clear_error (&local_error);
|
|
||||||
if (secrets)
|
|
||||||
g_hash_table_destroy (secrets);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_get_secrets:
|
|
||||||
* @connection: the #NMRemoteConnection
|
|
||||||
* @setting_name: the #NMSetting object name to get secrets for
|
|
||||||
* @callback: (scope async): a function to be called when the update completes;
|
|
||||||
* must not be %NULL
|
|
||||||
* @user_data: (closure): caller-specific data to be passed to @callback
|
|
||||||
*
|
|
||||||
* Request the connection's secrets.
|
|
||||||
**/
|
|
||||||
void
|
|
||||||
nm_remote_connection_get_secrets (NMRemoteConnection *self,
|
|
||||||
const char *setting_name,
|
|
||||||
NMRemoteConnectionGetSecretsFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv;
|
|
||||||
RemoteCall *call;
|
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_REMOTE_CONNECTION (self));
|
|
||||||
g_return_if_fail (callback != NULL);
|
|
||||||
|
|
||||||
priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
call = remote_call_new (self, get_secrets_cb, (GFunc)(void (*) (void)) callback, user_data);
|
|
||||||
if (!call)
|
|
||||||
return;
|
|
||||||
|
|
||||||
call->call = dbus_g_proxy_begin_call (priv->proxy, "GetSecrets",
|
|
||||||
remote_call_dbus_cb, call, NULL,
|
|
||||||
G_TYPE_STRING, setting_name,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
g_assert (call->call);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_get_unsaved:
|
|
||||||
* @connection: the #NMRemoteConnection
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the remote connection contains changes that have not
|
|
||||||
* been saved to disk, %FALSE if the connection is the same as its on-disk
|
|
||||||
* representation.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_remote_connection_get_unsaved (NMRemoteConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_REMOTE_CONNECTION (connection), FALSE);
|
|
||||||
|
|
||||||
_nm_remote_connection_ensure_inited (connection);
|
|
||||||
return NM_REMOTE_CONNECTION_GET_PRIVATE (connection)->unsaved;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
updated_get_settings_cb (DBusGProxy *proxy,
|
|
||||||
DBusGProxyCall *call,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnection *self = user_data;
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
GHashTable *new_settings;
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
dbus_g_proxy_end_call (proxy, call, &error,
|
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &new_settings,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
if (error) {
|
|
||||||
GHashTable *hash;
|
|
||||||
|
|
||||||
g_error_free (error);
|
|
||||||
|
|
||||||
/* Connection is no longer visible to this user. Let the settings
|
|
||||||
* service handle this via 'visible'. The settings service will emit
|
|
||||||
* the "removed" signal for us since it handles the lifetime of this
|
|
||||||
* object.
|
|
||||||
*/
|
|
||||||
hash = g_hash_table_new (g_str_hash, g_str_equal);
|
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (self), hash);
|
|
||||||
g_hash_table_destroy (hash);
|
|
||||||
|
|
||||||
priv->visible = FALSE;
|
|
||||||
g_signal_emit (self, signals[VISIBLE], 0, FALSE);
|
|
||||||
} else {
|
|
||||||
gs_unref_object NMRemoteConnection *self_alive = NULL;
|
|
||||||
|
|
||||||
self_alive = g_object_ref (self);
|
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (self), new_settings);
|
|
||||||
g_signal_emit (self, signals[UPDATED], 0, new_settings);
|
|
||||||
g_hash_table_destroy (new_settings);
|
|
||||||
|
|
||||||
/* Settings service will handle announcing the connection to clients */
|
|
||||||
if (priv->visible == FALSE) {
|
|
||||||
priv->visible = TRUE;
|
|
||||||
g_signal_emit (self, signals[VISIBLE], 0, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
updated_cb (DBusGProxy *proxy, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnection *self = NM_REMOTE_CONNECTION (user_data);
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
/* The connection got updated; request the replacement settings */
|
|
||||||
if (!priv->proxy_is_destroyed) {
|
|
||||||
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
|
|
||||||
updated_get_settings_cb, self, NULL,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
removed_cb (DBusGProxy *proxy, gpointer user_data)
|
|
||||||
{
|
|
||||||
g_signal_emit (G_OBJECT (user_data), signals[REMOVED], 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
properties_changed_cb (DBusGProxy *proxy,
|
|
||||||
GHashTable *properties,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnection *self = NM_REMOTE_CONNECTION (user_data);
|
|
||||||
GHashTableIter iter;
|
|
||||||
const char *key;
|
|
||||||
GValue *value;
|
|
||||||
|
|
||||||
g_hash_table_iter_init (&iter, properties);
|
|
||||||
while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value)) {
|
|
||||||
if (!strcmp (key, "Unsaved")) {
|
|
||||||
NM_REMOTE_CONNECTION_GET_PRIVATE (self)->unsaved = g_value_get_boolean (value);
|
|
||||||
g_object_notify (G_OBJECT (self), NM_REMOTE_CONNECTION_UNSAVED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_remote_connection_new:
|
|
||||||
* @bus: a valid and connected D-Bus connection
|
|
||||||
* @path: the D-Bus path of the connection as exported by the settings service
|
|
||||||
*
|
|
||||||
* Creates a new object representing the remote connection.
|
|
||||||
*
|
|
||||||
* Returns: the new remote connection object on success, or %NULL on failure
|
|
||||||
**/
|
|
||||||
NMRemoteConnection *
|
|
||||||
nm_remote_connection_new (DBusGConnection *bus,
|
|
||||||
const char *path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (bus != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
return (NMRemoteConnection *) g_object_new (NM_TYPE_REMOTE_CONNECTION,
|
|
||||||
NM_REMOTE_CONNECTION_BUS, bus,
|
|
||||||
NM_CONNECTION_PATH, path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_remote_connection_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
g_assert (priv->bus);
|
|
||||||
g_assert (nm_connection_get_path (NM_CONNECTION (object)));
|
|
||||||
|
|
||||||
priv->proxy = _nm_dbus_new_proxy_for_connection (priv->bus,
|
|
||||||
nm_connection_get_path (NM_CONNECTION (object)),
|
|
||||||
NM_DBUS_IFACE_SETTINGS_CONNECTION);
|
|
||||||
g_assert (priv->proxy);
|
|
||||||
dbus_g_proxy_set_default_timeout (priv->proxy, G_MAXINT);
|
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "Updated", G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (priv->proxy, "Updated", G_CALLBACK (updated_cb), object, NULL);
|
|
||||||
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "Removed", G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (priv->proxy, "Removed", G_CALLBACK (removed_cb), object, NULL);
|
|
||||||
|
|
||||||
g_signal_connect (priv->proxy, "destroy", G_CALLBACK (proxy_destroy_cb), object);
|
|
||||||
|
|
||||||
/* Monitor properties */
|
|
||||||
dbus_g_object_register_marshaller (g_cclosure_marshal_VOID__BOXED,
|
|
||||||
G_TYPE_NONE,
|
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "PropertiesChanged",
|
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (priv->proxy, "PropertiesChanged",
|
|
||||||
G_CALLBACK (properties_changed_cb),
|
|
||||||
object,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
priv->props_proxy = _nm_dbus_new_proxy_for_connection (priv->bus,
|
|
||||||
nm_connection_get_path (NM_CONNECTION (object)),
|
|
||||||
DBUS_INTERFACE_PROPERTIES);
|
|
||||||
g_assert (priv->props_proxy);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
init_sync (GInitable *initable, GCancellable *cancellable, GError **error)
|
|
||||||
{
|
|
||||||
NMRemoteConnection *self = NM_REMOTE_CONNECTION (initable);
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
GHashTable *hash;
|
|
||||||
gs_unref_object NMRemoteConnection *self_alive = NULL;
|
|
||||||
|
|
||||||
if (!dbus_g_proxy_call (priv->proxy, "GetSettings", error,
|
|
||||||
G_TYPE_INVALID,
|
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &hash,
|
|
||||||
G_TYPE_INVALID))
|
|
||||||
return FALSE;
|
|
||||||
priv->visible = TRUE;
|
|
||||||
self_alive = g_object_ref (self);
|
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (self), hash);
|
|
||||||
g_signal_emit (self, signals[UPDATED], 0, hash);
|
|
||||||
g_hash_table_destroy (hash);
|
|
||||||
|
|
||||||
/* Get properties */
|
|
||||||
hash = NULL;
|
|
||||||
if (!dbus_g_proxy_call (priv->props_proxy, "GetAll", error,
|
|
||||||
G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS_CONNECTION,
|
|
||||||
G_TYPE_INVALID,
|
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT, &hash,
|
|
||||||
G_TYPE_INVALID))
|
|
||||||
return FALSE;
|
|
||||||
properties_changed_cb (priv->props_proxy, hash, NM_REMOTE_CONNECTION (initable));
|
|
||||||
g_hash_table_destroy (hash);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMRemoteConnection *connection;
|
|
||||||
GSimpleAsyncResult *result;
|
|
||||||
} NMRemoteConnectionInitData;
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_async_complete (NMRemoteConnectionInitData *init_data, GError *error)
|
|
||||||
{
|
|
||||||
if (error)
|
|
||||||
g_simple_async_result_take_error (init_data->result, error);
|
|
||||||
else {
|
|
||||||
g_simple_async_result_set_op_res_gboolean (init_data->result, TRUE);
|
|
||||||
NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection)->inited = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_simple_async_result_complete (init_data->result);
|
|
||||||
g_object_unref (init_data->result);
|
|
||||||
g_slice_free (NMRemoteConnectionInitData, init_data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_async_got_properties (DBusGProxy *proxy, DBusGProxyCall *call, gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionInitData *init_data = user_data;
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
|
|
||||||
GHashTable *props;
|
|
||||||
GError *error = NULL;
|
|
||||||
|
|
||||||
if (dbus_g_proxy_end_call (proxy, call, &error,
|
|
||||||
DBUS_TYPE_G_MAP_OF_VARIANT, &props,
|
|
||||||
G_TYPE_INVALID)) {
|
|
||||||
properties_changed_cb (priv->props_proxy, props, init_data->connection);
|
|
||||||
g_hash_table_destroy (props);
|
|
||||||
}
|
|
||||||
init_async_complete (init_data, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_get_settings_cb (DBusGProxy *proxy,
|
|
||||||
DBusGProxyCall *call,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionInitData *init_data = user_data;
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (init_data->connection);
|
|
||||||
GHashTable *settings;
|
|
||||||
GError *error = NULL;
|
|
||||||
gs_unref_object NMRemoteConnection *self_alive = NULL;
|
|
||||||
|
|
||||||
dbus_g_proxy_end_call (proxy, call, &error,
|
|
||||||
DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
if (error) {
|
|
||||||
init_async_complete (init_data, error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->visible = TRUE;
|
|
||||||
self_alive = g_object_ref (init_data->connection);
|
|
||||||
_nm_connection_replace_settings (NM_CONNECTION (init_data->connection), settings);
|
|
||||||
g_signal_emit (init_data->connection, signals[UPDATED], 0, settings);
|
|
||||||
g_hash_table_destroy (settings);
|
|
||||||
|
|
||||||
/* Grab properties */
|
|
||||||
dbus_g_proxy_begin_call (priv->props_proxy, "GetAll",
|
|
||||||
init_async_got_properties, init_data, NULL,
|
|
||||||
G_TYPE_STRING, NM_DBUS_IFACE_SETTINGS_CONNECTION,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_async (GAsyncInitable *initable, int io_priority,
|
|
||||||
GCancellable *cancellable, GAsyncReadyCallback callback,
|
|
||||||
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->result = g_simple_async_result_new (G_OBJECT (initable), callback,
|
|
||||||
user_data, init_async);
|
|
||||||
if (cancellable)
|
|
||||||
g_simple_async_result_set_check_cancellable (init_data->result, cancellable);
|
|
||||||
|
|
||||||
dbus_g_proxy_begin_call (priv->proxy, "GetSettings",
|
|
||||||
init_get_settings_cb, init_data, NULL,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
init_finish (GAsyncInitable *initable, GAsyncResult *result, GError **error)
|
|
||||||
{
|
|
||||||
GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
|
|
||||||
|
|
||||||
if (g_simple_async_result_propagate_error (simple, error))
|
|
||||||
return FALSE;
|
|
||||||
else
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_remote_connection_init (NMRemoteConnection *self)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static GObject *
|
|
||||||
constructor (GType type, guint n_construct_properties,
|
|
||||||
GObjectConstructParam *construct_properties)
|
|
||||||
{
|
|
||||||
static GParamSpec *nm_connection_path = NULL;
|
|
||||||
static GParamSpec *nm_remote_connection_dbus_path = NULL;
|
|
||||||
int i, path_index = -1, dbus_path_index = -1;
|
|
||||||
|
|
||||||
if (!nm_connection_path) {
|
|
||||||
nm_connection_path =
|
|
||||||
g_object_class_find_property (g_type_class_peek (NM_TYPE_CONNECTION),
|
|
||||||
NM_CONNECTION_PATH);
|
|
||||||
nm_remote_connection_dbus_path =
|
|
||||||
g_object_class_find_property (g_type_class_peek (NM_TYPE_REMOTE_CONNECTION),
|
|
||||||
NM_REMOTE_CONNECTION_DBUS_PATH);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the two properties */
|
|
||||||
for (i = 0; i < n_construct_properties; i++) {
|
|
||||||
if (construct_properties[i].pspec == nm_connection_path)
|
|
||||||
path_index = i;
|
|
||||||
else if (construct_properties[i].pspec == nm_remote_connection_dbus_path)
|
|
||||||
dbus_path_index = i;
|
|
||||||
}
|
|
||||||
g_assert (path_index != -1 && dbus_path_index != -1);
|
|
||||||
|
|
||||||
/* If NMRemoteConnection:dbus-path is set, and NMConnection:path
|
|
||||||
* is not, then copy the value of the former to the latter.
|
|
||||||
*/
|
|
||||||
if (g_value_get_string (construct_properties[dbus_path_index].value) &&
|
|
||||||
!g_value_get_string (construct_properties[path_index].value))
|
|
||||||
construct_properties[path_index].value = construct_properties[dbus_path_index].value;
|
|
||||||
|
|
||||||
return G_OBJECT_CLASS (nm_remote_connection_parent_class)->
|
|
||||||
constructor (type, n_construct_properties, construct_properties);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object, guint prop_id,
|
|
||||||
GValue *value, GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
_nm_remote_connection_ensure_inited (NM_REMOTE_CONNECTION (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_UNSAVED:
|
|
||||||
g_value_set_boolean (value, NM_REMOTE_CONNECTION_GET_PRIVATE (object)->unsaved);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
set_property (GObject *object, guint prop_id,
|
|
||||||
const GValue *value, GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_BUS:
|
|
||||||
case PROP_DBUS_CONNECTION:
|
|
||||||
/* construct-only */
|
|
||||||
/* priv->bus is set from either of two properties so that it (a) remains
|
|
||||||
* backwards compatible with the previous "bus" property, and that (b)
|
|
||||||
* it can be created just like an NMObject using the "dbus-connection",
|
|
||||||
* even though it's not a subclass of NMObject. So don't overwrite the
|
|
||||||
* a valid value that the other property set with NULL, if one of the
|
|
||||||
* properties isn't specified at construction time.
|
|
||||||
*/
|
|
||||||
if (!priv->bus)
|
|
||||||
priv->bus = g_value_dup_boxed (value);
|
|
||||||
break;
|
|
||||||
case PROP_DBUS_PATH:
|
|
||||||
/* Don't need to do anything; see constructor(). */
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
dispose (GObject *object)
|
|
||||||
{
|
|
||||||
NMRemoteConnection *self = NM_REMOTE_CONNECTION (object);
|
|
||||||
NMRemoteConnectionPrivate *priv = NM_REMOTE_CONNECTION_GET_PRIVATE (self);
|
|
||||||
|
|
||||||
proxy_set_destroyed (self);
|
|
||||||
|
|
||||||
if (priv->proxy) {
|
|
||||||
g_signal_handlers_disconnect_by_func (priv->proxy, proxy_destroy_cb, object);
|
|
||||||
g_clear_object (&priv->proxy);
|
|
||||||
}
|
|
||||||
g_clear_object (&priv->props_proxy);
|
|
||||||
|
|
||||||
if (priv->bus) {
|
|
||||||
dbus_g_connection_unref (priv->bus);
|
|
||||||
priv->bus = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_remote_connection_parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_remote_connection_class_init (NMRemoteConnectionClass *remote_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (remote_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (object_class, sizeof (NMRemoteConnectionPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructor = constructor;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->set_property = set_property;
|
|
||||||
object_class->dispose = dispose;
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
|
|
||||||
/* Properties */
|
|
||||||
/**
|
|
||||||
* NMRemoteConnection:bus:
|
|
||||||
*
|
|
||||||
* The #DBusGConnection that the #NMRemoteConnection is connected to.
|
|
||||||
*/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_BUS,
|
|
||||||
g_param_spec_boxed (NM_REMOTE_CONNECTION_BUS, "", "",
|
|
||||||
DBUS_TYPE_G_CONNECTION,
|
|
||||||
G_PARAM_WRITABLE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/* These are needed so _nm_object_create() can create NMRemoteConnections */
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DBUS_CONNECTION,
|
|
||||||
g_param_spec_boxed (NM_REMOTE_CONNECTION_DBUS_CONNECTION, "", "",
|
|
||||||
DBUS_TYPE_G_CONNECTION,
|
|
||||||
G_PARAM_WRITABLE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_DBUS_PATH,
|
|
||||||
g_param_spec_string (NM_REMOTE_CONNECTION_DBUS_PATH, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_WRITABLE |
|
|
||||||
G_PARAM_CONSTRUCT_ONLY |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMRemoteConnection:unsaved:
|
|
||||||
*
|
|
||||||
* %TRUE if the remote connection contains changes that have not been saved
|
|
||||||
* to disk, %FALSE if the connection is the same as its on-disk representation.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_UNSAVED,
|
|
||||||
g_param_spec_boolean (NM_REMOTE_CONNECTION_UNSAVED, "", "",
|
|
||||||
FALSE,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
/**
|
|
||||||
* NMRemoteConnection::updated:
|
|
||||||
* @connection: a #NMConnection
|
|
||||||
*
|
|
||||||
* This signal is emitted when a connection changes, and it is
|
|
||||||
* still visible to the user.
|
|
||||||
*/
|
|
||||||
signals[UPDATED] =
|
|
||||||
g_signal_new (NM_REMOTE_CONNECTION_UPDATED,
|
|
||||||
G_TYPE_FROM_CLASS (remote_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMRemoteConnectionClass, updated),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__VOID,
|
|
||||||
G_TYPE_NONE, 0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMRemoteConnection::removed:
|
|
||||||
* @connection: a #NMConnection
|
|
||||||
*
|
|
||||||
* This signal is emitted when a connection is either deleted or becomes
|
|
||||||
* invisible to the current user.
|
|
||||||
*/
|
|
||||||
signals[REMOVED] =
|
|
||||||
g_signal_new (NM_REMOTE_CONNECTION_REMOVED,
|
|
||||||
G_TYPE_FROM_CLASS (remote_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMRemoteConnectionClass, removed),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__VOID,
|
|
||||||
G_TYPE_NONE, 0);
|
|
||||||
|
|
||||||
/* Private signal */
|
|
||||||
signals[VISIBLE] =
|
|
||||||
g_signal_new ("visible",
|
|
||||||
G_TYPE_FROM_CLASS (remote_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
0, NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__BOOLEAN,
|
|
||||||
G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_remote_connection_initable_iface_init (GInitableIface *iface)
|
|
||||||
{
|
|
||||||
iface->init = init_sync;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_remote_connection_async_initable_iface_init (GAsyncInitableIface *iface)
|
|
||||||
{
|
|
||||||
iface->init_async = init_async;
|
|
||||||
iface->init_finish = init_finish;
|
|
||||||
}
|
|
||||||
|
|
@ -1,148 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __NM_REMOTE_CONNECTION_H__
|
|
||||||
#define __NM_REMOTE_CONNECTION_H__
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
|
|
||||||
#include "nm-connection.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_REMOTE_CONNECTION (nm_remote_connection_get_type ())
|
|
||||||
#define NM_REMOTE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnection))
|
|
||||||
#define NM_REMOTE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionClass))
|
|
||||||
#define NM_IS_REMOTE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_REMOTE_CONNECTION))
|
|
||||||
#define NM_IS_REMOTE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_CONNECTION))
|
|
||||||
#define NM_REMOTE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_CONNECTION, NMRemoteConnectionClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMRemoteConnectionError:
|
|
||||||
* @NM_REMOTE_CONNECTION_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_REMOTE_CONNECTION_ERROR_DISCONNECTED: dbus disconnected
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_REMOTE_CONNECTION_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_REMOTE_CONNECTION_ERROR_DISCONNECTED, /*< nick=Disconnected >*/
|
|
||||||
} NMRemoteConnectionError;
|
|
||||||
|
|
||||||
#define NM_REMOTE_CONNECTION_ERROR (nm_remote_connection_error_quark ())
|
|
||||||
GQuark nm_remote_connection_error_quark (void);
|
|
||||||
|
|
||||||
/* Properties */
|
|
||||||
#define NM_REMOTE_CONNECTION_UNSAVED "unsaved"
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
#define NM_REMOTE_CONNECTION_UPDATED "updated"
|
|
||||||
#define NM_REMOTE_CONNECTION_REMOVED "removed"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMConnection parent;
|
|
||||||
} NMRemoteConnection;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMConnectionClass parent_class;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*updated) (NMRemoteConnection *connection,
|
|
||||||
GHashTable *new_settings);
|
|
||||||
|
|
||||||
void (*removed) (NMRemoteConnection *connection);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMRemoteConnectionClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMRemoteConnectionResultFunc:
|
|
||||||
* @connection: the connection for which an operation was performed
|
|
||||||
* @error: on failure, a descriptive error
|
|
||||||
* @user_data: user data passed to function which began the operation
|
|
||||||
*
|
|
||||||
* Called when NetworkManager has finished an asynchronous operation on a
|
|
||||||
* connection, like commit changes, deleting, saving, etc.
|
|
||||||
*/
|
|
||||||
typedef void (*NMRemoteConnectionResultFunc) (NMRemoteConnection *connection,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/* Backwards compatibility */
|
|
||||||
typedef NMRemoteConnectionResultFunc NMRemoteConnectionCommitFunc;
|
|
||||||
typedef NMRemoteConnectionResultFunc NMRemoteConnectionDeleteFunc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMRemoteConnectionGetSecretsFunc:
|
|
||||||
* @connection: the connection for which secrets were requested
|
|
||||||
* @secrets: (element-type utf8 GLib.HashTable): on success, a hash table of
|
|
||||||
* hash tables, with each inner hash mapping a setting property to a #GValue
|
|
||||||
* containing that property's value
|
|
||||||
* @error: on failure, a descriptive error
|
|
||||||
* @user_data: user data passed to nm_remote_connection_get_secrets()
|
|
||||||
*
|
|
||||||
* Called when NetworkManager returns secrets in response to a request for
|
|
||||||
* secrets via nm_remote_connection_get_secrets().
|
|
||||||
*/
|
|
||||||
typedef void (*NMRemoteConnectionGetSecretsFunc) (NMRemoteConnection *connection,
|
|
||||||
GHashTable *secrets,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
GType nm_remote_connection_get_type (void);
|
|
||||||
|
|
||||||
NMRemoteConnection *nm_remote_connection_new (DBusGConnection *bus,
|
|
||||||
const char *path);
|
|
||||||
|
|
||||||
void nm_remote_connection_commit_changes (NMRemoteConnection *connection,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
void nm_remote_connection_commit_changes_unsaved (NMRemoteConnection *connection,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
void nm_remote_connection_save (NMRemoteConnection *connection,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_remote_connection_delete (NMRemoteConnection *connection,
|
|
||||||
NMRemoteConnectionResultFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_remote_connection_get_secrets (NMRemoteConnection *connection,
|
|
||||||
const char *setting_name,
|
|
||||||
NMRemoteConnectionGetSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
gboolean nm_remote_connection_get_unsaved (NMRemoteConnection *connection);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __NM_REMOTE_CONNECTION__ */
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,159 +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 Novell, Inc.
|
|
||||||
* Copyright 2009 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_REMOTE_SETTINGS_H
|
|
||||||
#define NM_REMOTE_SETTINGS_H
|
|
||||||
|
|
||||||
#include <gio/gio.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-connection.h"
|
|
||||||
#include "nm-remote-connection.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_REMOTE_SETTINGS (nm_remote_settings_get_type ())
|
|
||||||
#define NM_REMOTE_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettings))
|
|
||||||
#define NM_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
|
|
||||||
#define NM_IS_REMOTE_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_REMOTE_SETTINGS))
|
|
||||||
#define NM_IS_REMOTE_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_REMOTE_SETTINGS))
|
|
||||||
#define NM_REMOTE_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettingsClass))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMRemoteSettingsError:
|
|
||||||
* @NM_REMOTE_SETTINGS_ERROR_UNKNOWN: unknown or unclassified error
|
|
||||||
* @NM_REMOTE_SETTINGS_ERROR_CONNECTION_REMOVED: the #NMRemoteConnection object
|
|
||||||
* was removed before it was completely initialized
|
|
||||||
* @NM_REMOTE_SETTINGS_ERROR_CONNECTION_UNAVAILABLE: the #NMRemoteConnection object
|
|
||||||
* is not visible or otherwise unreadable
|
|
||||||
* @NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE: NetworkManager is not running.
|
|
||||||
* (Since 0.9.10)
|
|
||||||
*
|
|
||||||
* Describes errors that may result from operations involving a #NMRemoteSettings.
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
typedef enum {
|
|
||||||
NM_REMOTE_SETTINGS_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
|
|
||||||
NM_REMOTE_SETTINGS_ERROR_CONNECTION_REMOVED, /*< nick=ConnectionRemoved >*/
|
|
||||||
NM_REMOTE_SETTINGS_ERROR_CONNECTION_UNAVAILABLE, /*< nick=ConnectionUnavailable >*/
|
|
||||||
NM_REMOTE_SETTINGS_ERROR_SERVICE_UNAVAILABLE, /*< nick=ServiceUnavailable >*/
|
|
||||||
} NMRemoteSettingsError;
|
|
||||||
|
|
||||||
#define NM_REMOTE_SETTINGS_ERROR nm_remote_settings_error_quark ()
|
|
||||||
GQuark nm_remote_settings_error_quark (void);
|
|
||||||
|
|
||||||
#define NM_REMOTE_SETTINGS_BUS "bus"
|
|
||||||
#define NM_REMOTE_SETTINGS_SERVICE_RUNNING "service-running"
|
|
||||||
#define NM_REMOTE_SETTINGS_HOSTNAME "hostname"
|
|
||||||
#define NM_REMOTE_SETTINGS_CAN_MODIFY "can-modify"
|
|
||||||
|
|
||||||
#define NM_REMOTE_SETTINGS_NEW_CONNECTION "new-connection"
|
|
||||||
#define NM_REMOTE_SETTINGS_CONNECTIONS_READ "connections-read"
|
|
||||||
|
|
||||||
typedef struct _NMRemoteSettings NMRemoteSettings;
|
|
||||||
typedef struct _NMRemoteSettingsClass NMRemoteSettingsClass;
|
|
||||||
|
|
||||||
typedef void (*NMRemoteSettingsAddConnectionFunc) (NMRemoteSettings *settings,
|
|
||||||
NMRemoteConnection *connection,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
typedef void (*NMRemoteSettingsLoadConnectionsFunc) (NMRemoteSettings *settings,
|
|
||||||
char **failures,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
typedef void (*NMRemoteSettingsSaveHostnameFunc) (NMRemoteSettings *settings,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
struct _NMRemoteSettings {
|
|
||||||
GObject parent;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _NMRemoteSettingsClass {
|
|
||||||
GObjectClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*new_connection) (NMRemoteSettings *settings,
|
|
||||||
NMRemoteConnection *connection);
|
|
||||||
|
|
||||||
void (*connections_read) (NMRemoteSettings *settings);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType nm_remote_settings_get_type (void);
|
|
||||||
|
|
||||||
NMRemoteSettings *nm_remote_settings_new (DBusGConnection *bus);
|
|
||||||
|
|
||||||
void nm_remote_settings_new_async (DBusGConnection *bus,
|
|
||||||
GCancellable *cancellable,
|
|
||||||
GAsyncReadyCallback callback,
|
|
||||||
gpointer user_data);
|
|
||||||
NMRemoteSettings *nm_remote_settings_new_finish (GAsyncResult *result,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
GSList *nm_remote_settings_list_connections (NMRemoteSettings *settings);
|
|
||||||
|
|
||||||
NMRemoteConnection *nm_remote_settings_get_connection_by_id (NMRemoteSettings *settings,
|
|
||||||
const char *id);
|
|
||||||
|
|
||||||
NMRemoteConnection * nm_remote_settings_get_connection_by_path (NMRemoteSettings *settings,
|
|
||||||
const char *path);
|
|
||||||
|
|
||||||
NMRemoteConnection *nm_remote_settings_get_connection_by_uuid (NMRemoteSettings *settings,
|
|
||||||
const char *uuid);
|
|
||||||
|
|
||||||
gboolean nm_remote_settings_add_connection (NMRemoteSettings *settings,
|
|
||||||
NMConnection *connection,
|
|
||||||
NMRemoteSettingsAddConnectionFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
gboolean nm_remote_settings_add_connection_unsaved (NMRemoteSettings *settings,
|
|
||||||
NMConnection *connection,
|
|
||||||
NMRemoteSettingsAddConnectionFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
gboolean nm_remote_settings_load_connections (NMRemoteSettings *settings,
|
|
||||||
char **filenames,
|
|
||||||
char ***failures,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
NM_AVAILABLE_IN_0_9_10
|
|
||||||
gboolean nm_remote_settings_reload_connections (NMRemoteSettings *settings,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean nm_remote_settings_save_hostname (NMRemoteSettings *settings,
|
|
||||||
const char *hostname,
|
|
||||||
NMRemoteSettingsSaveHostnameFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_REMOTE_SETTINGS_H */
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,307 +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 2010 - 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_SECRET_AGENT_H
|
|
||||||
#define NM_SECRET_AGENT_H
|
|
||||||
|
|
||||||
#include "nm-connection.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_SECRET_AGENT_ERROR (nm_secret_agent_error_quark ())
|
|
||||||
|
|
||||||
GQuark nm_secret_agent_error_quark (void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMSecretAgentError:
|
|
||||||
* @NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED: the caller (ie, NetworkManager) is not
|
|
||||||
* authorized to make this request
|
|
||||||
* @NM_SECRET_AGENT_ERROR_INVALID_CONNECTION: the connection for which secrets
|
|
||||||
* were requested could not be found
|
|
||||||
* @NM_SECRET_AGENT_ERROR_USER_CANCELED: the request was canceled by the user
|
|
||||||
* @NM_SECRET_AGENT_ERROR_AGENT_CANCELED: the agent canceled the request
|
|
||||||
* because it was requested to do so by NetworkManager
|
|
||||||
* @NM_SECRET_AGENT_ERROR_INTERNAL_ERROR: some internal error in the agent caused
|
|
||||||
* the request to fail
|
|
||||||
* @NM_SECRET_AGENT_ERROR_NO_SECRETS: the agent cannot find any secrets for this
|
|
||||||
* connection
|
|
||||||
*
|
|
||||||
* #NMSecretAgentError values are passed by secret agents back to NetworkManager
|
|
||||||
* when they encounter problems retrieving secrets on behalf of NM.
|
|
||||||
*/
|
|
||||||
typedef enum {
|
|
||||||
NM_SECRET_AGENT_ERROR_NOT_AUTHORIZED = 0, /*< nick=NotAuthorized >*/
|
|
||||||
NM_SECRET_AGENT_ERROR_INVALID_CONNECTION, /*< nick=InvalidConnection >*/
|
|
||||||
NM_SECRET_AGENT_ERROR_USER_CANCELED, /*< nick=UserCanceled >*/
|
|
||||||
NM_SECRET_AGENT_ERROR_AGENT_CANCELED, /*< nick=AgentCanceled >*/
|
|
||||||
NM_SECRET_AGENT_ERROR_INTERNAL_ERROR, /*< nick=InternalError >*/
|
|
||||||
NM_SECRET_AGENT_ERROR_NO_SECRETS, /*< nick=NoSecrets >*/
|
|
||||||
} NMSecretAgentError;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMSecretAgentCapabilities:
|
|
||||||
* @NM_SECRET_AGENT_CAPABILITY_NONE: the agent supports no special capabilities
|
|
||||||
* @NM_SECRET_AGENT_CAPABILITY_VPN_HINTS: the agent supports sending hints given
|
|
||||||
* by the <literal>get_secrets</literal> class method to VPN plugin
|
|
||||||
* authentication dialogs.
|
|
||||||
* @NM_SECRET_AGENT_CAPABILITY_LAST: bounds checking value; should not be used.
|
|
||||||
*
|
|
||||||
* #NMSecretAgentCapabilities indicate various capabilities of the agent.
|
|
||||||
*
|
|
||||||
* Since: 0.9.10
|
|
||||||
*/
|
|
||||||
typedef enum /*< flags >*/ {
|
|
||||||
NM_SECRET_AGENT_CAPABILITY_NONE = 0x0,
|
|
||||||
NM_SECRET_AGENT_CAPABILITY_VPN_HINTS = 0x1,
|
|
||||||
|
|
||||||
/* boundary value */
|
|
||||||
NM_SECRET_AGENT_CAPABILITY_LAST = NM_SECRET_AGENT_CAPABILITY_VPN_HINTS
|
|
||||||
} NMSecretAgentCapabilities;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMSecretAgentGetSecretsFlags:
|
|
||||||
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE: no special behavior; by default no
|
|
||||||
* user interaction is allowed and requests for secrets are fulfilled from
|
|
||||||
* persistent storage, or if no secrets are available an error is returned.
|
|
||||||
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION: allows the request to
|
|
||||||
* interact with the user, possibly prompting via UI for secrets if any are
|
|
||||||
* required, or if none are found in persistent storage.
|
|
||||||
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW: explicitly prompt for new
|
|
||||||
* secrets from the user. This flag signals that NetworkManager thinks any
|
|
||||||
* existing secrets are invalid or wrong. This flag implies that interaction
|
|
||||||
* is allowed.
|
|
||||||
* @NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED: set if the request was
|
|
||||||
* initiated by user-requested action via the D-Bus interface, as opposed to
|
|
||||||
* automatically initiated by NetworkManager in response to (for example) scan
|
|
||||||
* results or carrier changes.
|
|
||||||
*
|
|
||||||
* #NMSecretAgentGetSecretsFlags values modify the behavior of a GetSecrets request.
|
|
||||||
*/
|
|
||||||
typedef enum /*< flags >*/ {
|
|
||||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_NONE = 0x0,
|
|
||||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION = 0x1,
|
|
||||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW = 0x2,
|
|
||||||
NM_SECRET_AGENT_GET_SECRETS_FLAG_USER_REQUESTED = 0x4
|
|
||||||
} NMSecretAgentGetSecretsFlags;
|
|
||||||
|
|
||||||
#define NM_TYPE_SECRET_AGENT (nm_secret_agent_get_type ())
|
|
||||||
#define NM_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgent))
|
|
||||||
#define NM_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SECRET_AGENT, NMSecretAgentClass))
|
|
||||||
#define NM_IS_SECRET_AGENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SECRET_AGENT))
|
|
||||||
#define NM_IS_SECRET_AGENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SECRET_AGENT))
|
|
||||||
#define NM_SECRET_AGENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SECRET_AGENT, NMSecretAgentClass))
|
|
||||||
|
|
||||||
#define NM_SECRET_AGENT_IDENTIFIER "identifier"
|
|
||||||
#define NM_SECRET_AGENT_AUTO_REGISTER "auto-register"
|
|
||||||
#define NM_SECRET_AGENT_REGISTERED "registered"
|
|
||||||
#define NM_SECRET_AGENT_CAPABILITIES "capabilities"
|
|
||||||
|
|
||||||
#define NM_SECRET_AGENT_REGISTRATION_RESULT "registration-result"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GObject parent;
|
|
||||||
} NMSecretAgent;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMSecretAgentGetSecretsFunc:
|
|
||||||
* @agent: the secret agent object
|
|
||||||
* @connection: (transfer none): the connection for which secrets were requested,
|
|
||||||
* note that this object will be unrefed after the callback has returned, use
|
|
||||||
* g_object_ref()/g_object_unref() if you want to use this object after the callback
|
|
||||||
* has returned
|
|
||||||
* @secrets: (element-type utf8 GLib.HashTable): the #GHashTable containing
|
|
||||||
* the requested secrets in the same format as an #NMConnection hash (as
|
|
||||||
* created by nm_connection_to_hash() for example). Each key in @secrets
|
|
||||||
* should be the name of a #NMSetting object (like "802-11-wireless-security")
|
|
||||||
* and each value should be a #GHashTable. The sub-hashes map string:#GValue
|
|
||||||
* where the string is the setting property name (like "psk") and the value
|
|
||||||
* is the secret
|
|
||||||
* @error: if the secrets request failed, give a descriptive error here
|
|
||||||
* @user_data: caller-specific data to be passed to the function
|
|
||||||
*
|
|
||||||
* Called as a result of a request by NM to retrieve secrets. When the
|
|
||||||
* #NMSecretAgent subclass has finished retrieving secrets and is ready to
|
|
||||||
* return them, or to return an error, this function should be called with
|
|
||||||
* those secrets or the error.
|
|
||||||
*
|
|
||||||
* To easily create the hash table to return the Wi-Fi PSK, you could do
|
|
||||||
* something like this:
|
|
||||||
* <example>
|
|
||||||
* <title>Creating a secrets hash</title>
|
|
||||||
* <programlisting>
|
|
||||||
* NMConnection *secrets;
|
|
||||||
* NMSettingWirelessSecurity *s_wsec;
|
|
||||||
* GHashTable *secrets_hash;
|
|
||||||
*
|
|
||||||
* secrets = nm_connection_new ();
|
|
||||||
* s_wsec = (NMSettingWirelessSecurity *) nm_setting_wireless_security_new ();
|
|
||||||
* g_object_set (G_OBJECT (s_wsec),
|
|
||||||
* NM_SETTING_WIRELESS_SECURITY_PSK, "my really cool PSK",
|
|
||||||
* NULL);
|
|
||||||
* nm_connection_add_setting (secrets, NM_SETTING (s_wsec));
|
|
||||||
* secrets_hash = nm_connection_to_hash (secrets, NM_SETTING_HASH_FLAG_ALL);
|
|
||||||
*
|
|
||||||
* (call the NMSecretAgentGetSecretsFunc with secrets_hash)
|
|
||||||
*
|
|
||||||
* g_object_unref (secrets);
|
|
||||||
* g_hash_table_unref (secrets_hash);
|
|
||||||
* </programlisting>
|
|
||||||
* </example>
|
|
||||||
*/
|
|
||||||
typedef void (*NMSecretAgentGetSecretsFunc) (NMSecretAgent *agent,
|
|
||||||
NMConnection *connection,
|
|
||||||
GHashTable *secrets,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMSecretAgentSaveSecretsFunc:
|
|
||||||
* @agent: the secret agent object
|
|
||||||
* @connection: (transfer none): the connection for which secrets were to be saved,
|
|
||||||
* note that this object will be unrefed after the callback has returned, use
|
|
||||||
* g_object_ref()/g_object_unref() if you want to use this object after the callback
|
|
||||||
* has returned
|
|
||||||
* @error: if the saving secrets failed, give a descriptive error here
|
|
||||||
* @user_data: caller-specific data to be passed to the function
|
|
||||||
*
|
|
||||||
* Called as a result of a request by NM to save secrets. When the
|
|
||||||
* #NMSecretAgent subclass has finished saving the secrets, this function
|
|
||||||
* should be called.
|
|
||||||
*/
|
|
||||||
typedef void (*NMSecretAgentSaveSecretsFunc) (NMSecretAgent *agent,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMSecretAgentDeleteSecretsFunc:
|
|
||||||
* @agent: the secret agent object
|
|
||||||
* @connection: (transfer none): the connection for which secrets were to be deleted,
|
|
||||||
* note that this object will be unrefed after the callback has returned, use
|
|
||||||
* g_object_ref()/g_object_unref() if you want to use this object after the callback
|
|
||||||
* has returned
|
|
||||||
* @error: if the deleting secrets failed, give a descriptive error here
|
|
||||||
* @user_data: caller-specific data to be passed to the function
|
|
||||||
*
|
|
||||||
* Called as a result of a request by NM to delete secrets. When the
|
|
||||||
* #NMSecretAgent subclass has finished deleting the secrets, this function
|
|
||||||
* should be called.
|
|
||||||
*/
|
|
||||||
typedef void (*NMSecretAgentDeleteSecretsFunc) (NMSecretAgent *agent,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError *error,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GObjectClass parent;
|
|
||||||
|
|
||||||
/* Virtual methods for subclasses */
|
|
||||||
|
|
||||||
/* Called when the subclass should retrieve and return secrets. Subclass
|
|
||||||
* must copy or reference any arguments it may require after returning from
|
|
||||||
* this method, as the arguments will freed (except for 'self', 'callback',
|
|
||||||
* and 'user_data' of course). If the request is canceled, the callback
|
|
||||||
* should still be called, but with the NM_SECRET_AGENT_ERROR_AGENT_CANCELED
|
|
||||||
* error.
|
|
||||||
*/
|
|
||||||
void (*get_secrets) (NMSecretAgent *self,
|
|
||||||
NMConnection *connection,
|
|
||||||
const char *connection_path,
|
|
||||||
const char *setting_name,
|
|
||||||
const char **hints,
|
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/* Called when the subclass should cancel an outstanding request to
|
|
||||||
* get secrets for a given connection. Canceling the request MUST
|
|
||||||
* call the callback that was passed along with the initial get_secrets
|
|
||||||
* call, sending the NM_SECRET_AGENT_ERROR/NM_SECRET_AGENT_ERROR_AGENT_CANCELED
|
|
||||||
* error to that callback.
|
|
||||||
*/
|
|
||||||
void (*cancel_get_secrets) (NMSecretAgent *self,
|
|
||||||
const char *connection_path,
|
|
||||||
const char *setting_name);
|
|
||||||
|
|
||||||
/* Called when the subclass should save the secrets contained in the
|
|
||||||
* connection to backing storage. Subclass must copy or reference any
|
|
||||||
* arguments it may require after returning from this method, as the
|
|
||||||
* arguments will freed (except for 'self', 'callback', and 'user_data'
|
|
||||||
* of course).
|
|
||||||
*/
|
|
||||||
void (*save_secrets) (NMSecretAgent *self,
|
|
||||||
NMConnection *connection,
|
|
||||||
const char *connection_path,
|
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/* Called when the subclass should delete the secrets contained in the
|
|
||||||
* connection from backing storage. Subclass must copy or reference any
|
|
||||||
* arguments it may require after returning from this method, as the
|
|
||||||
* arguments will freed (except for 'self', 'callback', and 'user_data'
|
|
||||||
* of course).
|
|
||||||
*/
|
|
||||||
void (*delete_secrets) (NMSecretAgent *self,
|
|
||||||
NMConnection *connection,
|
|
||||||
const char *connection_path,
|
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*registration_result) (NMSecretAgent *agent, GError *error);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMSecretAgentClass;
|
|
||||||
|
|
||||||
GType nm_secret_agent_get_type (void);
|
|
||||||
|
|
||||||
gboolean nm_secret_agent_register (NMSecretAgent *self);
|
|
||||||
|
|
||||||
gboolean nm_secret_agent_unregister (NMSecretAgent *self);
|
|
||||||
|
|
||||||
gboolean nm_secret_agent_get_registered (NMSecretAgent *self);
|
|
||||||
|
|
||||||
void nm_secret_agent_get_secrets (NMSecretAgent *self,
|
|
||||||
NMConnection *connection,
|
|
||||||
const char *setting_name,
|
|
||||||
const char **hints,
|
|
||||||
NMSecretAgentGetSecretsFlags flags,
|
|
||||||
NMSecretAgentGetSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_secret_agent_save_secrets (NMSecretAgent *self,
|
|
||||||
NMConnection *connection,
|
|
||||||
NMSecretAgentSaveSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
void nm_secret_agent_delete_secrets (NMSecretAgent *self,
|
|
||||||
NMConnection *connection,
|
|
||||||
NMSecretAgentDeleteSecretsFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_SECRET_AGENT_H */
|
|
||||||
|
|
@ -1,33 +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 - 2008 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_TYPES_PRIVATE_H
|
|
||||||
#define NM_TYPES_PRIVATE_H
|
|
||||||
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-types.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
|
|
||||||
gboolean _nm_ssid_demarshal (GValue *value, GByteArray **dest);
|
|
||||||
gboolean _nm_uint_array_demarshal (GValue *value, GArray **dest);
|
|
||||||
gboolean _nm_string_array_demarshal (GValue *value, GPtrArray **dest);
|
|
||||||
gboolean _nm_ip6_address_array_demarshal (GValue *value, GSList **dest);
|
|
||||||
|
|
||||||
#endif /* NM_TYPES_PRIVATE_H */
|
|
||||||
|
|
@ -1,375 +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 <dbus/dbus-glib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-types.h"
|
|
||||||
#include "nm-types-private.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-object-cache.h"
|
|
||||||
#include "nm-dbus-glib-types.h"
|
|
||||||
#include "nm-setting-ip6-config.h"
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_ssid_copy (GByteArray *src)
|
|
||||||
{
|
|
||||||
GByteArray *dest;
|
|
||||||
|
|
||||||
dest = g_byte_array_sized_new (src->len);
|
|
||||||
g_byte_array_append (dest, src->data, src->len);
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_ssid_free (GByteArray *ssid)
|
|
||||||
{
|
|
||||||
g_byte_array_free (ssid, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_ssid_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMSsid"),
|
|
||||||
(GBoxedCopyFunc) _nm_ssid_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_ssid_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_nm_ssid_demarshal (GValue *value, GByteArray **dest)
|
|
||||||
{
|
|
||||||
GByteArray *array;
|
|
||||||
|
|
||||||
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_UCHAR_ARRAY))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (*dest) {
|
|
||||||
g_boxed_free (NM_TYPE_SSID, *dest);
|
|
||||||
*dest = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
array = (GByteArray *) g_value_get_boxed (value);
|
|
||||||
if (array && (array->len > 0)) {
|
|
||||||
*dest = g_byte_array_sized_new (array->len);
|
|
||||||
(*dest)->len = array->len;
|
|
||||||
memcpy ((*dest)->data, array->data, array->len);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_uint_array_copy (GArray *src)
|
|
||||||
{
|
|
||||||
GArray *dest;
|
|
||||||
|
|
||||||
dest = g_array_sized_new (FALSE, TRUE, sizeof (guint32), src->len);
|
|
||||||
g_array_append_vals (dest, src->data, src->len);
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_uint_array_free (GArray *array)
|
|
||||||
{
|
|
||||||
g_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_uint_array_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMUintArray"),
|
|
||||||
(GBoxedCopyFunc) _nm_uint_array_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_uint_array_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_nm_uint_array_demarshal (GValue *value, GArray **dest)
|
|
||||||
{
|
|
||||||
GArray *array;
|
|
||||||
|
|
||||||
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_UINT_ARRAY))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (*dest) {
|
|
||||||
g_boxed_free (NM_TYPE_UINT_ARRAY, *dest);
|
|
||||||
*dest = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
array = (GArray *) g_value_get_boxed (value);
|
|
||||||
if (array && (array->len > 0)) {
|
|
||||||
*dest = g_array_sized_new (FALSE, TRUE, sizeof (guint32), array->len);
|
|
||||||
g_array_append_vals (*dest, array->data, array->len);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_string_array_copy (GPtrArray *src)
|
|
||||||
{
|
|
||||||
GPtrArray *dest;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
dest = g_ptr_array_sized_new (src->len);
|
|
||||||
for (i = 0; i < src->len; i++)
|
|
||||||
g_ptr_array_add (dest, g_strdup (g_ptr_array_index (src, i)));
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_string_array_free (GPtrArray *array)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < array->len; i++)
|
|
||||||
g_free (g_ptr_array_index (array, i));
|
|
||||||
g_ptr_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_string_array_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMStringArray"),
|
|
||||||
(GBoxedCopyFunc) _nm_string_array_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_string_array_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_nm_string_array_demarshal (GValue *value, GPtrArray **dest)
|
|
||||||
{
|
|
||||||
char **array;
|
|
||||||
|
|
||||||
if (!G_VALUE_HOLDS (value, G_TYPE_STRV))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (*dest) {
|
|
||||||
g_boxed_free (NM_TYPE_STRING_ARRAY, *dest);
|
|
||||||
*dest = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
array = (char **) g_value_get_boxed (value);
|
|
||||||
if (array && array[0]) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
*dest = g_ptr_array_new ();
|
|
||||||
for (i = 0; array[i]; i++)
|
|
||||||
g_ptr_array_add (*dest, g_strdup (array[i]));
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_object_array_copy (GPtrArray *src)
|
|
||||||
{
|
|
||||||
GPtrArray *dest;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
dest = g_ptr_array_sized_new (src->len);
|
|
||||||
for (i = 0; i < src->len; i++)
|
|
||||||
g_ptr_array_add (dest, g_object_ref (g_ptr_array_index (src, i)));
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_object_array_free (GPtrArray *array)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < array->len; i++)
|
|
||||||
g_object_unref (g_ptr_array_index (array, i));
|
|
||||||
g_ptr_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_object_array_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMObjectArray"),
|
|
||||||
(GBoxedCopyFunc) _nm_object_array_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_object_array_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_ip6_address_object_array_copy (GPtrArray *src)
|
|
||||||
{
|
|
||||||
GPtrArray *dest;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
dest = g_ptr_array_sized_new (src->len);
|
|
||||||
for (i = 0; i < src->len; i++)
|
|
||||||
g_ptr_array_add (dest, nm_ip6_address_dup (g_ptr_array_index (src, i)));
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_ip6_address_object_array_free (GPtrArray *array)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < array->len; i++)
|
|
||||||
nm_ip6_address_unref (g_ptr_array_index (array, i));
|
|
||||||
g_ptr_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_ip6_address_object_array_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMIP6AddressObjectArray"),
|
|
||||||
(GBoxedCopyFunc) _nm_ip6_address_object_array_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_ip6_address_object_array_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_ip6_address_array_copy (GPtrArray *src)
|
|
||||||
{
|
|
||||||
GPtrArray *dest;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
dest = g_ptr_array_sized_new (src->len);
|
|
||||||
for (i = 0; i < src->len; i++) {
|
|
||||||
struct in6_addr *addr = g_ptr_array_index (src, i);
|
|
||||||
struct in6_addr *copy;
|
|
||||||
|
|
||||||
copy = g_malloc0 (sizeof (struct in6_addr));
|
|
||||||
memcpy (copy, addr, sizeof (struct in6_addr));
|
|
||||||
g_ptr_array_add (dest, copy);
|
|
||||||
}
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_ip6_address_array_free (GPtrArray *array)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < array->len; i++)
|
|
||||||
g_free (g_ptr_array_index (array, i));
|
|
||||||
g_ptr_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_ip6_address_array_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMIP6AddressArray"),
|
|
||||||
(GBoxedCopyFunc) _nm_ip6_address_array_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_ip6_address_array_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_nm_ip6_address_array_demarshal (GValue *value, GSList **dest)
|
|
||||||
{
|
|
||||||
GPtrArray *array;
|
|
||||||
|
|
||||||
if (!G_VALUE_HOLDS (value, DBUS_TYPE_G_ARRAY_OF_ARRAY_OF_UCHAR))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (*dest) {
|
|
||||||
g_slist_free_full (*dest, g_free);
|
|
||||||
*dest = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
array = (GPtrArray *) g_value_get_boxed (value);
|
|
||||||
if (array && array->len) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < array->len; i++) {
|
|
||||||
GByteArray *bytearray = (GByteArray *) g_ptr_array_index (array, i);
|
|
||||||
struct in6_addr *addr;
|
|
||||||
|
|
||||||
addr = g_malloc0 (sizeof (struct in6_addr));
|
|
||||||
memcpy (addr->s6_addr, bytearray->data, bytearray->len);
|
|
||||||
*dest = g_slist_append (*dest, addr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static gpointer
|
|
||||||
_nm_ip6_route_object_array_copy (GPtrArray *src)
|
|
||||||
{
|
|
||||||
GPtrArray *dest;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
dest = g_ptr_array_sized_new (src->len);
|
|
||||||
for (i = 0; i < src->len; i++)
|
|
||||||
g_ptr_array_add (dest, nm_ip6_route_dup (g_ptr_array_index (src, i)));
|
|
||||||
return dest;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_nm_ip6_route_object_array_free (GPtrArray *array)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < array->len; i++)
|
|
||||||
nm_ip6_route_unref (g_ptr_array_index (array, i));
|
|
||||||
g_ptr_array_free (array, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_ip6_route_object_array_get_type (void)
|
|
||||||
{
|
|
||||||
static GType our_type = 0;
|
|
||||||
|
|
||||||
if (our_type == 0)
|
|
||||||
our_type = g_boxed_type_register_static (g_intern_static_string ("NMIP6RouteObjectArray"),
|
|
||||||
(GBoxedCopyFunc) _nm_ip6_route_object_array_copy,
|
|
||||||
(GBoxedFreeFunc) _nm_ip6_route_object_array_free);
|
|
||||||
return our_type;
|
|
||||||
}
|
|
||||||
|
|
@ -1,54 +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_TYPES_H
|
|
||||||
#define NM_TYPES_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
#include "nm-glib-enum-types.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_SSID (nm_ssid_get_type ())
|
|
||||||
GType nm_ssid_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define NM_TYPE_UINT_ARRAY (nm_uint_array_get_type ())
|
|
||||||
GType nm_uint_array_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define NM_TYPE_STRING_ARRAY (nm_string_array_get_type ())
|
|
||||||
GType nm_string_array_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define NM_TYPE_OBJECT_ARRAY (nm_object_array_get_type ())
|
|
||||||
GType nm_object_array_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define NM_TYPE_IP6_ADDRESS_OBJECT_ARRAY (nm_ip6_address_object_array_get_type ())
|
|
||||||
GType nm_ip6_address_object_array_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define NM_TYPE_IP6_ADDRESS_ARRAY (nm_ip6_address_array_get_type ())
|
|
||||||
GType nm_ip6_address_array_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
#define NM_TYPE_IP6_ROUTE_OBJECT_ARRAY (nm_ip6_route_object_array_get_type ())
|
|
||||||
GType nm_ip6_route_object_array_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_TYPES_H */
|
|
||||||
|
|
@ -1,270 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2012 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-vpn-connection.h"
|
|
||||||
#include "NetworkManager.h"
|
|
||||||
#include "nm-utils.h"
|
|
||||||
#include "nm-object-private.h"
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (NMVPNConnection, nm_vpn_connection, NM_TYPE_ACTIVE_CONNECTION)
|
|
||||||
|
|
||||||
#define NM_VPN_CONNECTION_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_VPN_CONNECTION, NMVPNConnectionPrivate))
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
DBusGProxy *proxy;
|
|
||||||
char *banner;
|
|
||||||
NMVPNConnectionState vpn_state;
|
|
||||||
} NMVPNConnectionPrivate;
|
|
||||||
|
|
||||||
enum {
|
|
||||||
PROP_0,
|
|
||||||
PROP_VPN_STATE,
|
|
||||||
PROP_BANNER,
|
|
||||||
|
|
||||||
LAST_PROP
|
|
||||||
};
|
|
||||||
|
|
||||||
enum {
|
|
||||||
VPN_STATE_CHANGED,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
static guint signals[LAST_SIGNAL] = { 0 };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_vpn_connection_new:
|
|
||||||
* @connection: the #DBusGConnection
|
|
||||||
* @path: the DBus object path of the new connection
|
|
||||||
*
|
|
||||||
* Creates a new #NMVPNConnection.
|
|
||||||
*
|
|
||||||
* Returns: (transfer full): a new connection object
|
|
||||||
**/
|
|
||||||
GObject *
|
|
||||||
nm_vpn_connection_new (DBusGConnection *connection, const char *path)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (connection != NULL, NULL);
|
|
||||||
g_return_val_if_fail (path != NULL, NULL);
|
|
||||||
|
|
||||||
return g_object_new (NM_TYPE_VPN_CONNECTION,
|
|
||||||
NM_OBJECT_DBUS_CONNECTION, connection,
|
|
||||||
NM_OBJECT_DBUS_PATH, path,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_vpn_connection_get_banner:
|
|
||||||
* @vpn: a #NMVPNConnection
|
|
||||||
*
|
|
||||||
* Gets the VPN login banner of the active #NMVPNConnection.
|
|
||||||
*
|
|
||||||
* Returns: the VPN login banner of the VPN connection. This is the internal
|
|
||||||
* string used by the connection, and must not be modified.
|
|
||||||
**/
|
|
||||||
const char *
|
|
||||||
nm_vpn_connection_get_banner (NMVPNConnection *vpn)
|
|
||||||
{
|
|
||||||
NMVPNConnectionPrivate *priv;
|
|
||||||
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_CONNECTION (vpn), NULL);
|
|
||||||
|
|
||||||
priv = NM_VPN_CONNECTION_GET_PRIVATE (vpn);
|
|
||||||
|
|
||||||
/* We need to update vpn_state first in case it's unknown. */
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (vpn));
|
|
||||||
|
|
||||||
if (priv->vpn_state != NM_VPN_CONNECTION_STATE_ACTIVATED)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return priv->banner;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_vpn_connection_get_vpn_state:
|
|
||||||
* @vpn: a #NMVPNConnection
|
|
||||||
*
|
|
||||||
* Gets the current #NMVPNConnection state.
|
|
||||||
*
|
|
||||||
* Returns: the VPN state of the active VPN connection.
|
|
||||||
**/
|
|
||||||
NMVPNConnectionState
|
|
||||||
nm_vpn_connection_get_vpn_state (NMVPNConnection *vpn)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_CONNECTION (vpn), NM_VPN_CONNECTION_STATE_UNKNOWN);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (vpn));
|
|
||||||
return NM_VPN_CONNECTION_GET_PRIVATE (vpn)->vpn_state;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
vpn_state_changed_proxy (DBusGProxy *proxy,
|
|
||||||
NMVPNConnectionState vpn_state,
|
|
||||||
NMVPNConnectionStateReason reason,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
NMVPNConnection *connection = NM_VPN_CONNECTION (user_data);
|
|
||||||
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
|
||||||
|
|
||||||
if (priv->vpn_state != vpn_state) {
|
|
||||||
priv->vpn_state = vpn_state;
|
|
||||||
g_signal_emit (connection, signals[VPN_STATE_CHANGED], 0, vpn_state, reason);
|
|
||||||
g_object_notify (G_OBJECT (connection), NM_VPN_CONNECTION_VPN_STATE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_vpn_connection_init (NMVPNConnection *connection)
|
|
||||||
{
|
|
||||||
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
|
||||||
|
|
||||||
priv->vpn_state = NM_VPN_CONNECTION_STATE_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
register_properties (NMVPNConnection *connection)
|
|
||||||
{
|
|
||||||
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
|
|
||||||
const NMPropertiesInfo property_info[] = {
|
|
||||||
{ NM_VPN_CONNECTION_BANNER, &priv->banner },
|
|
||||||
{ NM_VPN_CONNECTION_VPN_STATE, &priv->vpn_state },
|
|
||||||
{ NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
_nm_object_register_properties (NM_OBJECT (connection),
|
|
||||||
priv->proxy,
|
|
||||||
property_info);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
constructed (GObject *object)
|
|
||||||
{
|
|
||||||
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_vpn_connection_parent_class)->constructed (object);
|
|
||||||
|
|
||||||
priv->proxy = _nm_object_new_proxy (NM_OBJECT (object), NULL, NM_DBUS_INTERFACE_VPN_CONNECTION);
|
|
||||||
|
|
||||||
dbus_g_object_register_marshaller (g_cclosure_marshal_generic,
|
|
||||||
G_TYPE_NONE,
|
|
||||||
G_TYPE_UINT, G_TYPE_UINT,
|
|
||||||
G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_add_signal (priv->proxy, "VpnStateChanged", G_TYPE_UINT, G_TYPE_UINT, G_TYPE_INVALID);
|
|
||||||
dbus_g_proxy_connect_signal (priv->proxy,
|
|
||||||
"VpnStateChanged",
|
|
||||||
G_CALLBACK (vpn_state_changed_proxy),
|
|
||||||
object,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
register_properties (NM_VPN_CONNECTION (object));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
finalize (GObject *object)
|
|
||||||
{
|
|
||||||
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (object);
|
|
||||||
|
|
||||||
g_free (priv->banner);
|
|
||||||
g_object_unref (priv->proxy);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (nm_vpn_connection_parent_class)->finalize (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
get_property (GObject *object,
|
|
||||||
guint prop_id,
|
|
||||||
GValue *value,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
NMVPNConnection *self = NM_VPN_CONNECTION (object);
|
|
||||||
|
|
||||||
_nm_object_ensure_inited (NM_OBJECT (object));
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case PROP_VPN_STATE:
|
|
||||||
g_value_set_uint (value, nm_vpn_connection_get_vpn_state (self));
|
|
||||||
break;
|
|
||||||
case PROP_BANNER:
|
|
||||||
g_value_set_string (value, nm_vpn_connection_get_banner (self));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
nm_vpn_connection_class_init (NMVPNConnectionClass *connection_class)
|
|
||||||
{
|
|
||||||
GObjectClass *object_class = G_OBJECT_CLASS (connection_class);
|
|
||||||
|
|
||||||
g_type_class_add_private (connection_class, sizeof (NMVPNConnectionPrivate));
|
|
||||||
|
|
||||||
/* virtual methods */
|
|
||||||
object_class->constructed = constructed;
|
|
||||||
object_class->get_property = get_property;
|
|
||||||
object_class->finalize = finalize;
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVPNConnection:vpn-state:
|
|
||||||
*
|
|
||||||
* The VPN state of the active VPN connection.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_VPN_STATE,
|
|
||||||
g_param_spec_uint (NM_VPN_CONNECTION_VPN_STATE, "", "",
|
|
||||||
NM_VPN_CONNECTION_STATE_UNKNOWN,
|
|
||||||
NM_VPN_CONNECTION_STATE_DISCONNECTED,
|
|
||||||
NM_VPN_CONNECTION_STATE_UNKNOWN,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVPNConnection:banner:
|
|
||||||
*
|
|
||||||
* The VPN login banner of the active VPN connection.
|
|
||||||
**/
|
|
||||||
g_object_class_install_property
|
|
||||||
(object_class, PROP_BANNER,
|
|
||||||
g_param_spec_string (NM_VPN_CONNECTION_BANNER, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/* signals */
|
|
||||||
signals[VPN_STATE_CHANGED] =
|
|
||||||
g_signal_new ("vpn-state-changed",
|
|
||||||
G_OBJECT_CLASS_TYPE (object_class),
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMVPNConnectionClass, vpn_state_changed),
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
G_TYPE_NONE, 2,
|
|
||||||
G_TYPE_UINT, G_TYPE_UINT);
|
|
||||||
}
|
|
||||||
|
|
@ -1,73 +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 - 2008 Novell, Inc.
|
|
||||||
* Copyright 2007 - 2010 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_VPN_CONNECTION_H
|
|
||||||
#define NM_VPN_CONNECTION_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <dbus/dbus-glib.h>
|
|
||||||
#include "nm-active-connection.h"
|
|
||||||
#include "NetworkManagerVPN.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define NM_TYPE_VPN_CONNECTION (nm_vpn_connection_get_type ())
|
|
||||||
#define NM_VPN_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_CONNECTION, NMVPNConnection))
|
|
||||||
#define NM_VPN_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_VPN_CONNECTION, NMVPNConnectionClass))
|
|
||||||
#define NM_IS_VPN_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_CONNECTION))
|
|
||||||
#define NM_IS_VPN_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_VPN_CONNECTION))
|
|
||||||
#define NM_VPN_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_VPN_CONNECTION, NMVPNConnectionClass))
|
|
||||||
|
|
||||||
#define NM_VPN_CONNECTION_VPN_STATE "vpn-state"
|
|
||||||
#define NM_VPN_CONNECTION_BANNER "banner"
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMActiveConnection parent;
|
|
||||||
} NMVPNConnection;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
NMActiveConnectionClass parent;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
void (*vpn_state_changed) (NMVPNConnection *connection,
|
|
||||||
NMVPNConnectionState state,
|
|
||||||
NMVPNConnectionStateReason reason);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
} NMVPNConnectionClass;
|
|
||||||
|
|
||||||
GType nm_vpn_connection_get_type (void);
|
|
||||||
|
|
||||||
GObject * nm_vpn_connection_new (DBusGConnection *connection, const char *path);
|
|
||||||
|
|
||||||
NMVPNConnectionState nm_vpn_connection_get_vpn_state (NMVPNConnection *vpn);
|
|
||||||
const char * nm_vpn_connection_get_banner (NMVPNConnection *vpn);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_VPN_CONNECTION_H */
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
/*** BEGIN file-header ***/
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "nm-vpn-enum-types.h"
|
|
||||||
|
|
||||||
#include "nm-vpn-plugin.h"
|
|
||||||
#include "nm-vpn-plugin-ui-interface.h"
|
|
||||||
#include "nm-vpn-plugin-utils.h"
|
|
||||||
/*** END file-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-header ***/
|
|
||||||
GType
|
|
||||||
@enum_name@_get_type (void)
|
|
||||||
{
|
|
||||||
static volatile gsize g_define_type_id__volatile = 0;
|
|
||||||
|
|
||||||
if (g_once_init_enter (&g_define_type_id__volatile))
|
|
||||||
{
|
|
||||||
static const G@Type@Value values[] = {
|
|
||||||
/*** END value-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-production ***/
|
|
||||||
{ @VALUENAME@, "@VALUENAME@", "@valuenick@" },
|
|
||||||
/*** END value-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN value-tail ***/
|
|
||||||
{ 0, NULL, NULL }
|
|
||||||
};
|
|
||||||
GType g_define_type_id =
|
|
||||||
g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
|
|
||||||
g_once_init_leave (&g_define_type_id__volatile, g_define_type_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_define_type_id__volatile;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*** END value-tail ***/
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
/*** BEGIN file-header ***/
|
|
||||||
#ifndef __NM_VPN_ENUM_TYPES_H__
|
|
||||||
#define __NM_VPN_ENUM_TYPES_H__
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
/*** END file-header ***/
|
|
||||||
|
|
||||||
/*** BEGIN enumeration-production ***/
|
|
||||||
GType @enum_name@_get_type (void) G_GNUC_CONST;
|
|
||||||
#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ (@enum_name@_get_type ())
|
|
||||||
|
|
||||||
/*** END enumeration-production ***/
|
|
||||||
|
|
||||||
/*** BEGIN file-tail ***/
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __NM_VPN_ENUM_TYPES_H__ */
|
|
||||||
/*** END file-tail ***/
|
|
||||||
|
|
@ -1,246 +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 - 2010 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include "nm-vpn-plugin-ui-interface.h"
|
|
||||||
|
|
||||||
static void
|
|
||||||
interface_init (gpointer g_iface)
|
|
||||||
{
|
|
||||||
static gboolean initialized = FALSE;
|
|
||||||
|
|
||||||
if (initialized)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Properties */
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVPNPluginUiInterface:name:
|
|
||||||
*
|
|
||||||
* Short display name of the VPN plugin.
|
|
||||||
*/
|
|
||||||
g_object_interface_install_property (g_iface,
|
|
||||||
g_param_spec_string (NM_VPN_PLUGIN_UI_INTERFACE_NAME, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVPNPluginUiInterface:desc:
|
|
||||||
*
|
|
||||||
* Longer description of the VPN plugin.
|
|
||||||
*/
|
|
||||||
g_object_interface_install_property (g_iface,
|
|
||||||
g_param_spec_string (NM_VPN_PLUGIN_UI_INTERFACE_DESC, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVPNPluginUiInterface:service:
|
|
||||||
*
|
|
||||||
* D-Bus service name of the plugin's VPN service.
|
|
||||||
*/
|
|
||||||
g_object_interface_install_property (g_iface,
|
|
||||||
g_param_spec_string (NM_VPN_PLUGIN_UI_INTERFACE_SERVICE, "", "",
|
|
||||||
NULL,
|
|
||||||
G_PARAM_READABLE |
|
|
||||||
G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
initialized = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_vpn_plugin_ui_interface_get_type (void)
|
|
||||||
{
|
|
||||||
static GType vpn_plugin_ui_interface_type = 0;
|
|
||||||
|
|
||||||
if (!vpn_plugin_ui_interface_type) {
|
|
||||||
const GTypeInfo vpn_plugin_ui_interface_info = {
|
|
||||||
sizeof (NMVpnPluginUiInterface), /* class_size */
|
|
||||||
interface_init, /* base_init */
|
|
||||||
NULL, /* base_finalize */
|
|
||||||
NULL,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
0,
|
|
||||||
0, /* n_preallocs */
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
vpn_plugin_ui_interface_type = g_type_register_static (G_TYPE_INTERFACE,
|
|
||||||
"NMVpnPluginUiInterface",
|
|
||||||
&vpn_plugin_ui_interface_info,
|
|
||||||
0);
|
|
||||||
|
|
||||||
g_type_interface_add_prerequisite (vpn_plugin_ui_interface_type, G_TYPE_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return vpn_plugin_ui_interface_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
NMVpnPluginUiWidgetInterface *
|
|
||||||
nm_vpn_plugin_ui_interface_ui_factory (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_INTERFACE (iface), NULL);
|
|
||||||
|
|
||||||
return NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->ui_factory (iface, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
guint32
|
|
||||||
nm_vpn_plugin_ui_interface_get_capabilities (NMVpnPluginUiInterface *iface)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_INTERFACE (iface), 0);
|
|
||||||
|
|
||||||
return NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->get_capabilities (iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
NMConnection *
|
|
||||||
nm_vpn_plugin_ui_interface_import (NMVpnPluginUiInterface *iface,
|
|
||||||
const char *path,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_INTERFACE (iface), NULL);
|
|
||||||
|
|
||||||
if (nm_vpn_plugin_ui_interface_get_capabilities (iface) & NM_VPN_PLUGIN_UI_CAPABILITY_IMPORT) {
|
|
||||||
g_return_val_if_fail (NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->import_from_file != NULL, NULL);
|
|
||||||
return NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->import_from_file (iface, path, error);
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_vpn_plugin_ui_interface_export (NMVpnPluginUiInterface *iface,
|
|
||||||
const char *path,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_INTERFACE (iface), FALSE);
|
|
||||||
|
|
||||||
if (nm_vpn_plugin_ui_interface_get_capabilities (iface) & NM_VPN_PLUGIN_UI_CAPABILITY_EXPORT) {
|
|
||||||
g_return_val_if_fail (NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->export_to_file != NULL, FALSE);
|
|
||||||
return NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->export_to_file (iface, path, connection, error);
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *
|
|
||||||
nm_vpn_plugin_ui_interface_get_suggested_name (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_INTERFACE (iface), NULL);
|
|
||||||
|
|
||||||
if (NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->get_suggested_name)
|
|
||||||
return NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE (iface)->get_suggested_name (iface, connection);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
/* Deprecated and no longer used */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
widget_interface_init (gpointer g_iface)
|
|
||||||
{
|
|
||||||
GType iface_type = G_TYPE_FROM_INTERFACE (g_iface);
|
|
||||||
static gboolean initialized = FALSE;
|
|
||||||
|
|
||||||
if (initialized)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Signals */
|
|
||||||
g_signal_new ("changed",
|
|
||||||
iface_type,
|
|
||||||
G_SIGNAL_RUN_FIRST,
|
|
||||||
G_STRUCT_OFFSET (NMVpnPluginUiWidgetInterface, changed),
|
|
||||||
NULL, NULL,
|
|
||||||
g_cclosure_marshal_VOID__VOID,
|
|
||||||
G_TYPE_NONE, 0);
|
|
||||||
|
|
||||||
initialized = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
nm_vpn_plugin_ui_widget_interface_get_type (void)
|
|
||||||
{
|
|
||||||
static GType vpn_plugin_ui_widget_interface_type = 0;
|
|
||||||
|
|
||||||
if (!vpn_plugin_ui_widget_interface_type) {
|
|
||||||
const GTypeInfo vpn_plugin_ui_widget_interface_info = {
|
|
||||||
sizeof (NMVpnPluginUiWidgetInterface), /* class_size */
|
|
||||||
widget_interface_init, /* base_init */
|
|
||||||
NULL, /* base_finalize */
|
|
||||||
NULL,
|
|
||||||
NULL, /* class_finalize */
|
|
||||||
NULL, /* class_data */
|
|
||||||
0,
|
|
||||||
0, /* n_preallocs */
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
vpn_plugin_ui_widget_interface_type = g_type_register_static (G_TYPE_INTERFACE,
|
|
||||||
"NMVpnPluginUiWidgetInterface",
|
|
||||||
&vpn_plugin_ui_widget_interface_info,
|
|
||||||
0);
|
|
||||||
|
|
||||||
g_type_interface_add_prerequisite (vpn_plugin_ui_widget_interface_type, G_TYPE_OBJECT);
|
|
||||||
}
|
|
||||||
|
|
||||||
return vpn_plugin_ui_widget_interface_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
GObject *
|
|
||||||
nm_vpn_plugin_ui_widget_interface_get_widget (NMVpnPluginUiWidgetInterface *iface)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_WIDGET_INTERFACE (iface), NULL);
|
|
||||||
|
|
||||||
return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->get_widget (iface);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidgetInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (NM_IS_VPN_PLUGIN_UI_WIDGET_INTERFACE (iface), FALSE);
|
|
||||||
|
|
||||||
if (error)
|
|
||||||
g_return_val_if_fail (*error == NULL, FALSE);
|
|
||||||
|
|
||||||
return NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (iface)->update_connection (iface, connection, error);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error)
|
|
||||||
{
|
|
||||||
/* Deprecated and no longer used */
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
@ -1,271 +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 - 2010 Red Hat, Inc.
|
|
||||||
* Copyright 2008 Novell, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_VPN_PLUGIN_UI_INTERFACE_H
|
|
||||||
#define NM_VPN_PLUGIN_UI_INTERFACE_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include "nm-connection.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
typedef struct _NMVpnPluginUiInterface NMVpnPluginUiInterface;
|
|
||||||
typedef struct _NMVpnPluginUiWidgetInterface NMVpnPluginUiWidgetInterface;
|
|
||||||
|
|
||||||
/* Plugin's factory function that returns a GObject that implements
|
|
||||||
* NMVpnPluginUiInterface.
|
|
||||||
*/
|
|
||||||
typedef NMVpnPluginUiInterface * (*NMVpnPluginUiFactory) (GError **error);
|
|
||||||
NMVpnPluginUiInterface *nm_vpn_plugin_ui_factory (GError **error);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* Plugin interface */
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#define NM_TYPE_VPN_PLUGIN_UI_INTERFACE (nm_vpn_plugin_ui_interface_get_type ())
|
|
||||||
#define NM_VPN_PLUGIN_UI_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_PLUGIN_UI_INTERFACE, NMVpnPluginUiInterface))
|
|
||||||
#define NM_IS_VPN_PLUGIN_UI_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_PLUGIN_UI_INTERFACE))
|
|
||||||
#define NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_VPN_PLUGIN_UI_INTERFACE, NMVpnPluginUiInterface))
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVpnPluginUiCapability:
|
|
||||||
* @NM_VPN_PLUGIN_UI_CAPABILITY_NONE: unknown or no capability
|
|
||||||
* @NM_VPN_PLUGIN_UI_CAPABILITY_IMPORT: the plugin can import new connections
|
|
||||||
* @NM_VPN_PLUGIN_UI_CAPABILITY_EXPORT: the plugin can export connections
|
|
||||||
* @NM_VPN_PLUGIN_UI_CAPABILITY_IPV6: the plugin supports IPv6 addressing
|
|
||||||
*
|
|
||||||
* Flags that indicate to UI programs certain capabilities of the plugin.
|
|
||||||
**/
|
|
||||||
typedef enum /*< flags >*/ {
|
|
||||||
NM_VPN_PLUGIN_UI_CAPABILITY_NONE = 0x00,
|
|
||||||
NM_VPN_PLUGIN_UI_CAPABILITY_IMPORT = 0x01,
|
|
||||||
NM_VPN_PLUGIN_UI_CAPABILITY_EXPORT = 0x02,
|
|
||||||
NM_VPN_PLUGIN_UI_CAPABILITY_IPV6 = 0x04
|
|
||||||
} NMVpnPluginUiCapability;
|
|
||||||
|
|
||||||
/* Short display name of the VPN plugin */
|
|
||||||
#define NM_VPN_PLUGIN_UI_INTERFACE_NAME "name"
|
|
||||||
|
|
||||||
/* Longer description of the VPN plugin */
|
|
||||||
#define NM_VPN_PLUGIN_UI_INTERFACE_DESC "desc"
|
|
||||||
|
|
||||||
/* D-Bus service name of the plugin's VPN service */
|
|
||||||
#define NM_VPN_PLUGIN_UI_INTERFACE_SERVICE "service"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* NMVpnPluginUiInterfaceProp:
|
|
||||||
* @NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME: the VPN plugin's name
|
|
||||||
* @NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC: description of the VPN plugin and what
|
|
||||||
* VPN services it supports
|
|
||||||
* @NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE: the D-Bus service name used by the
|
|
||||||
* plugin's VPN service daemon
|
|
||||||
*
|
|
||||||
* #GObject property numbers that plugins should override to provide certain
|
|
||||||
* information to UI programs.
|
|
||||||
**/
|
|
||||||
typedef enum {
|
|
||||||
/* private */
|
|
||||||
NM_VPN_PLUGIN_UI_INTERFACE_PROP_FIRST = 0x1000,
|
|
||||||
|
|
||||||
/* public */
|
|
||||||
NM_VPN_PLUGIN_UI_INTERFACE_PROP_NAME = NM_VPN_PLUGIN_UI_INTERFACE_PROP_FIRST,
|
|
||||||
NM_VPN_PLUGIN_UI_INTERFACE_PROP_DESC,
|
|
||||||
NM_VPN_PLUGIN_UI_INTERFACE_PROP_SERVICE
|
|
||||||
} NMVpnPluginUiInterfaceProp;
|
|
||||||
|
|
||||||
struct _NMVpnPluginUiInterface {
|
|
||||||
GTypeInterface g_iface;
|
|
||||||
|
|
||||||
/* Plugin's factory function that returns a GObject that implements
|
|
||||||
* NMVpnPluginUiWidgetInterface, pre-filled with values from 'connection'
|
|
||||||
* if non-NULL.
|
|
||||||
*/
|
|
||||||
NMVpnPluginUiWidgetInterface * (*ui_factory) (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Plugin's capabiltity function that returns a bitmask of capabilities
|
|
||||||
* described by NM_VPN_PLUGIN_UI_CAPABILITY_* defines.
|
|
||||||
*/
|
|
||||||
guint32 (*get_capabilities) (NMVpnPluginUiInterface *iface);
|
|
||||||
|
|
||||||
/* Try to import a connection from the specified path. On success, return a
|
|
||||||
* partial NMConnection object. On error, return NULL and set 'error' with
|
|
||||||
* additional information. Note that 'error' can be NULL, in which case no
|
|
||||||
* additional error information should be provided.
|
|
||||||
*/
|
|
||||||
NMConnection * (*import_from_file) (NMVpnPluginUiInterface *iface,
|
|
||||||
const char *path,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Export the given connection to the specified path. Return TRUE on success.
|
|
||||||
* On error, return FALSE and set 'error' with additional error information.
|
|
||||||
* Note that 'error' can be NULL, in which case no additional error information
|
|
||||||
* should be provided.
|
|
||||||
*/
|
|
||||||
gboolean (*export_to_file) (NMVpnPluginUiInterface *iface,
|
|
||||||
const char *path,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* For a given connection, return a suggested file name. Returned value should
|
|
||||||
* be NULL or a suggested file name allocated via g_malloc/g_new/etc to be freed
|
|
||||||
* by the caller.
|
|
||||||
*/
|
|
||||||
char * (*get_suggested_name) (NMVpnPluginUiInterface *iface, NMConnection *connection);
|
|
||||||
|
|
||||||
/* Deprecated and no longer used */
|
|
||||||
gboolean (*delete_connection) (NMVpnPluginUiInterface *iface, NMConnection *connection, GError **error);
|
|
||||||
|
|
||||||
/* Padding for future expansion */
|
|
||||||
void (*_reserved1) (void);
|
|
||||||
void (*_reserved2) (void);
|
|
||||||
void (*_reserved3) (void);
|
|
||||||
void (*_reserved4) (void);
|
|
||||||
void (*_reserved5) (void);
|
|
||||||
void (*_reserved6) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType nm_vpn_plugin_ui_interface_get_type (void);
|
|
||||||
|
|
||||||
NMVpnPluginUiWidgetInterface *nm_vpn_plugin_ui_interface_ui_factory (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
guint32 nm_vpn_plugin_ui_interface_get_capabilities (NMVpnPluginUiInterface *iface);
|
|
||||||
|
|
||||||
NMConnection *nm_vpn_plugin_ui_interface_import (NMVpnPluginUiInterface *iface,
|
|
||||||
const char *path,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
gboolean nm_vpn_plugin_ui_interface_export (NMVpnPluginUiInterface *iface,
|
|
||||||
const char *path,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
char *nm_vpn_plugin_ui_interface_get_suggested_name (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection);
|
|
||||||
|
|
||||||
/* Deprecated and no longer used */
|
|
||||||
NM_DEPRECATED_IN_0_9_10
|
|
||||||
gboolean nm_vpn_plugin_ui_interface_delete_connection (NMVpnPluginUiInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/*****************************************************************************/
|
|
||||||
/* UI widget interface */
|
|
||||||
/*****************************************************************************/
|
|
||||||
|
|
||||||
#define NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE (nm_vpn_plugin_ui_widget_interface_get_type ())
|
|
||||||
#define NM_VPN_PLUGIN_UI_WIDGET_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE, NMVpnPluginUiWidgetInterface))
|
|
||||||
#define NM_IS_VPN_PLUGIN_UI_WIDGET_INTERFACE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE))
|
|
||||||
#define NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE, NMVpnPluginUiWidgetInterface))
|
|
||||||
|
|
||||||
struct _NMVpnPluginUiWidgetInterface {
|
|
||||||
GTypeInterface g_iface;
|
|
||||||
|
|
||||||
/* Return the GtkWidget for the VPN's UI */
|
|
||||||
GObject * (*get_widget) (NMVpnPluginUiWidgetInterface *iface);
|
|
||||||
|
|
||||||
/* Called to save the user-entered options to the connection object. Should
|
|
||||||
* return FALSE and set 'error' if the current options are invalid. 'error'
|
|
||||||
* should contain enough information for the plugin to determine which UI
|
|
||||||
* widget is invalid at a later point in time. For example, creating unique
|
|
||||||
* error codes for what error occurred and populating the message field
|
|
||||||
* of 'error' with the name of the invalid property.
|
|
||||||
*/
|
|
||||||
gboolean (*update_connection) (NMVpnPluginUiWidgetInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Deprecated and no longer used */
|
|
||||||
gboolean (*save_secrets) (NMVpnPluginUiWidgetInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Emitted when the value of a UI widget changes. May trigger a validity
|
|
||||||
* check via update_connection() to write values to the connection */
|
|
||||||
void (*changed) (NMVpnPluginUiWidgetInterface *iface);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType nm_vpn_plugin_ui_widget_interface_get_type (void);
|
|
||||||
|
|
||||||
GObject * nm_vpn_plugin_ui_widget_interface_get_widget (NMVpnPluginUiWidgetInterface *iface);
|
|
||||||
|
|
||||||
gboolean nm_vpn_plugin_ui_widget_interface_update_connection (NMVpnPluginUiWidgetInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
/* Deprecated and no longer used */
|
|
||||||
NM_DEPRECATED_IN_0_9_10
|
|
||||||
gboolean nm_vpn_plugin_ui_widget_interface_save_secrets (NMVpnPluginUiWidgetInterface *iface,
|
|
||||||
NMConnection *connection,
|
|
||||||
GError **error);
|
|
||||||
|
|
||||||
#ifdef NM_VPN_LIBNM_COMPAT
|
|
||||||
#define nm_vpn_editor_plugin_factory nm_vpn_plugin_ui_factory
|
|
||||||
|
|
||||||
#define NM_TYPE_VPN_EDITOR_PLUGIN NM_TYPE_VPN_PLUGIN_UI_INTERFACE
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN(obj) NM_VPN_PLUGIN_UI_INTERFACE(obj)
|
|
||||||
#define NM_IS_VPN_EDITOR_PLUGIN(obj) NM_IS_VPN_PLUGIN_UI_INTERFACE(obj)
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_GET_INTERFACE(obj) NM_VPN_PLUGIN_UI_INTERFACE_GET_INTERFACE(obj)
|
|
||||||
|
|
||||||
#define NMVpnEditorPluginCapability NMVpnPluginUiCapability
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_CAPABILITY_NONE NM_VPN_PLUGIN_UI_CAPABILITY_NONE
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_CAPABILITY_IMPORT NM_VPN_PLUGIN_UI_CAPABILITY_IMPORT
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_CAPABILITY_EXPORT NM_VPN_PLUGIN_UI_CAPABILITY_EXPORT
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6 NM_VPN_PLUGIN_UI_CAPABILITY_IPV6
|
|
||||||
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_NAME NM_VPN_PLUGIN_UI_INTERFACE_NAME
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_DESCRIPTION NM_VPN_PLUGIN_UI_INTERFACE_DESC
|
|
||||||
#define NM_VPN_EDITOR_PLUGIN_SERVICE NM_VPN_PLUGIN_UI_INTERFACE_SERVICE
|
|
||||||
|
|
||||||
#define NMVpnEditorPlugin NMVpnPluginUiInterface
|
|
||||||
#define NMVpnEditorPluginInterface NMVpnPluginUiInterface
|
|
||||||
|
|
||||||
#define get_editor ui_factory
|
|
||||||
#define get_suggested_filename get_suggested_name
|
|
||||||
|
|
||||||
#define nm_vpn_editor_plugin_get_type nm_vpn_plugin_ui_interface_get_type
|
|
||||||
#define nm_vpn_editor_plugin_get_editor nm_vpn_plugin_ui_interface_ui_factory
|
|
||||||
#define nm_vpn_editor_plugin_get_capabilities nm_vpn_plugin_ui_interface_get_capabilities
|
|
||||||
#define nm_vpn_editor_plugin_import nm_vpn_plugin_ui_interface_import
|
|
||||||
#define nm_vpn_editor_plugin_export nm_vpn_plugin_ui_interface_export
|
|
||||||
#define nm_vpn_editor_plugin_get_suggested_filename nm_vpn_plugin_ui_interface_get_suggested_name
|
|
||||||
|
|
||||||
#define NM_TYPE_VPN_EDITOR NM_TYPE_VPN_PLUGIN_UI_WIDGET_INTERFACE
|
|
||||||
#define NM_VPN_EDITOR(obj) NM_VPN_PLUGIN_UI_WIDGET_INTERFACE (obj)
|
|
||||||
#define NM_IS_VPN_EDITOR(obj) NM_IS_VPN_PLUGIN_UI_WIDGET_INTERFACE (obj)
|
|
||||||
#define NM_VPN_EDITOR_GET_INTERFACE(obj) NM_VPN_PLUGIN_UI_WIDGET_INTERFACE_GET_INTERFACE (obj)
|
|
||||||
|
|
||||||
#define NMVpnEditor NMVpnPluginUiWidgetInterface
|
|
||||||
#define NMVpnEditorInterface NMVpnPluginUiWidgetInterface
|
|
||||||
|
|
||||||
#define nm_vpn_editor_get_type nm_vpn_plugin_ui_widget_interface_get_type
|
|
||||||
#define nm_vpn_editor_get_widget nm_vpn_plugin_ui_widget_interface_get_widget
|
|
||||||
#define nm_vpn_editor_update_connection nm_vpn_plugin_ui_widget_interface_update_connection
|
|
||||||
|
|
||||||
#endif /* NM_VPN_LIBNM_COMPAT */
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_VPN_PLUGIN_UI_INTERFACE_H */
|
|
||||||
|
|
@ -1,189 +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 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "nm-default.h"
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "nm-vpn-plugin-utils.h"
|
|
||||||
#include "nm-vpn-plugin.h"
|
|
||||||
#include "nm-setting-private.h"
|
|
||||||
#include "nm-dbus-glib-types.h"
|
|
||||||
|
|
||||||
#define DATA_KEY_TAG "DATA_KEY="
|
|
||||||
#define DATA_VAL_TAG "DATA_VAL="
|
|
||||||
#define SECRET_KEY_TAG "SECRET_KEY="
|
|
||||||
#define SECRET_VAL_TAG "SECRET_VAL="
|
|
||||||
|
|
||||||
static void
|
|
||||||
free_secret (gpointer data)
|
|
||||||
{
|
|
||||||
char *secret = data;
|
|
||||||
|
|
||||||
memset (secret, 0, strlen (secret));
|
|
||||||
g_free (secret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_vpn_plugin_utils_read_vpn_details:
|
|
||||||
* @fd: file descriptor to read from, usually stdin (0)
|
|
||||||
* @out_data: (out) (transfer full): on successful return, a hash table
|
|
||||||
* (mapping char*:char*) containing the key/value pairs of VPN data items
|
|
||||||
* @out_secrets: (out) (transfer full): on successful return, a hash table
|
|
||||||
* (mapping char*:char*) containing the key/value pairsof VPN secrets
|
|
||||||
*
|
|
||||||
* Parses key/value pairs from a file descriptor (normally stdin) passed by
|
|
||||||
* an applet when the applet calls the authentication dialog of the VPN plugin.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if reading values was successful, %FALSE if not
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_vpn_plugin_utils_read_vpn_details (int fd,
|
|
||||||
GHashTable **out_data,
|
|
||||||
GHashTable **out_secrets)
|
|
||||||
{
|
|
||||||
GHashTable *data, *secrets;
|
|
||||||
gboolean success = FALSE;
|
|
||||||
char *key = NULL, *val = NULL;
|
|
||||||
GString *line;
|
|
||||||
char c;
|
|
||||||
|
|
||||||
if (out_data)
|
|
||||||
g_return_val_if_fail (*out_data == NULL, FALSE);
|
|
||||||
if (out_secrets)
|
|
||||||
g_return_val_if_fail (*out_secrets == NULL, FALSE);
|
|
||||||
|
|
||||||
data = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
|
|
||||||
secrets = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, free_secret);
|
|
||||||
|
|
||||||
line = g_string_new (NULL);
|
|
||||||
|
|
||||||
/* Read stdin for data and secret items until we get a DONE */
|
|
||||||
while (1) {
|
|
||||||
ssize_t nr;
|
|
||||||
GHashTable *hash = NULL;
|
|
||||||
|
|
||||||
nr = read (fd, &c, 1);
|
|
||||||
if (nr == -1) {
|
|
||||||
if (errno == EAGAIN) {
|
|
||||||
g_usleep (100);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (c != '\n') {
|
|
||||||
g_string_append_c (line, c);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check for the finish marker */
|
|
||||||
if (strcmp (line->str, "DONE") == 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* Otherwise it's a data/secret item */
|
|
||||||
if (strncmp (line->str, DATA_KEY_TAG, strlen (DATA_KEY_TAG)) == 0) {
|
|
||||||
hash = data;
|
|
||||||
key = g_strdup (line->str + strlen (DATA_KEY_TAG));
|
|
||||||
} else if (strncmp (line->str, DATA_VAL_TAG, strlen (DATA_VAL_TAG)) == 0) {
|
|
||||||
hash = data;
|
|
||||||
val = g_strdup (line->str + strlen (DATA_VAL_TAG));
|
|
||||||
} else if (strncmp (line->str, SECRET_KEY_TAG, strlen (SECRET_KEY_TAG)) == 0) {
|
|
||||||
hash = secrets;
|
|
||||||
key = g_strdup (line->str + strlen (SECRET_KEY_TAG));
|
|
||||||
} else if (strncmp (line->str, SECRET_VAL_TAG, strlen (SECRET_VAL_TAG)) == 0) {
|
|
||||||
hash = secrets;
|
|
||||||
val = g_strdup (line->str + strlen (SECRET_VAL_TAG));
|
|
||||||
}
|
|
||||||
g_string_truncate (line, 0);
|
|
||||||
|
|
||||||
if (key && val && hash) {
|
|
||||||
g_hash_table_insert (hash, key, val);
|
|
||||||
key = NULL;
|
|
||||||
val = NULL;
|
|
||||||
success = TRUE; /* Got at least one value */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
if (out_data)
|
|
||||||
*out_data = data;
|
|
||||||
else
|
|
||||||
g_hash_table_destroy (data);
|
|
||||||
|
|
||||||
if (out_secrets)
|
|
||||||
*out_secrets = secrets;
|
|
||||||
else
|
|
||||||
g_hash_table_destroy (secrets);
|
|
||||||
} else {
|
|
||||||
g_hash_table_destroy (data);
|
|
||||||
g_hash_table_destroy (secrets);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_string_free (line, TRUE);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* nm_vpn_plugin_utils_get_secret_flags:
|
|
||||||
* @data: hash table containing VPN key/value pair data items
|
|
||||||
* @secret_name: VPN secret key name for which to retrieve flags for
|
|
||||||
* @out_flags: (out): on success, the flags associated with @secret_name
|
|
||||||
*
|
|
||||||
* Given a VPN secret key name, attempts to find the corresponding flags data
|
|
||||||
* item in @data. If found, converts the flags data item to
|
|
||||||
* #NMSettingSecretFlags and returns it.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the flag data item was found and successfully converted
|
|
||||||
* to flags, %FALSE if not
|
|
||||||
**/
|
|
||||||
gboolean
|
|
||||||
nm_vpn_plugin_utils_get_secret_flags (GHashTable *data,
|
|
||||||
const char *secret_name,
|
|
||||||
NMSettingSecretFlags *out_flags)
|
|
||||||
{
|
|
||||||
char *flag_name;
|
|
||||||
const char *val;
|
|
||||||
unsigned long tmp;
|
|
||||||
gboolean success = FALSE;
|
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (secret_name != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (out_flags != NULL, FALSE);
|
|
||||||
g_return_val_if_fail (*out_flags == NM_SETTING_SECRET_FLAG_NONE, FALSE);
|
|
||||||
|
|
||||||
flag_name = g_strdup_printf ("%s-flags", secret_name);
|
|
||||||
|
|
||||||
/* Try new flags value first */
|
|
||||||
val = g_hash_table_lookup (data, flag_name);
|
|
||||||
if (val) {
|
|
||||||
errno = 0;
|
|
||||||
tmp = strtoul (val, NULL, 10);
|
|
||||||
if (errno == 0 && tmp <= NM_SETTING_SECRET_FLAGS_ALL) {
|
|
||||||
*out_flags = (NMSettingSecretFlags) tmp;
|
|
||||||
success = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_free (flag_name);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
@ -1,39 +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 2011 Red Hat, Inc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef NM_VPN_PLUGIN_UTILS_H
|
|
||||||
#define NM_VPN_PLUGIN_UTILS_H
|
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
#include "nm-setting.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
gboolean nm_vpn_plugin_utils_read_vpn_details (int fd,
|
|
||||||
GHashTable **out_data,
|
|
||||||
GHashTable **out_secrets);
|
|
||||||
|
|
||||||
gboolean nm_vpn_plugin_utils_get_secret_flags (GHashTable *data,
|
|
||||||
const char *secret_name,
|
|
||||||
NMSettingSecretFlags *out_flags);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* NM_VPN_PLUGIN_UTILS_H */
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue