diff options
Diffstat (limited to 'libnm-util')
| -rw-r--r-- | libnm-util/Makefile.am | 5 | ||||
| -rw-r--r-- | libnm-util/Makefile.in | 28 | ||||
| -rw-r--r-- | libnm-util/libnm-util.ver | 13 | ||||
| -rw-r--r-- | libnm-util/nm-connection.c | 25 | ||||
| -rw-r--r-- | libnm-util/nm-connection.h | 2 | ||||
| -rw-r--r-- | libnm-util/nm-setting-adsl.c | 461 | ||||
| -rw-r--r-- | libnm-util/nm-setting-adsl.h | 100 | ||||
| -rw-r--r-- | libnm-util/nm-setting-bluetooth.c | 2 | ||||
| -rw-r--r-- | libnm-util/nm-setting-bond.c | 14 | ||||
| -rw-r--r-- | libnm-util/nm-setting-ip6-config.c | 20 | ||||
| -rw-r--r-- | libnm-util/nm-setting-ppp.c | 36 | ||||
| -rw-r--r-- | libnm-util/nm-setting-pppoe.c | 4 | ||||
| -rw-r--r-- | libnm-util/nm-setting-vlan.c | 5 | ||||
| -rw-r--r-- | libnm-util/nm-setting-wireless-security.c | 2 | ||||
| -rw-r--r-- | libnm-util/nm-setting-wireless.c | 47 | ||||
| -rw-r--r-- | libnm-util/nm-setting-wireless.h | 4 | ||||
| -rw-r--r-- | libnm-util/nm-utils-enum-types.c | 21 | ||||
| -rw-r--r-- | libnm-util/nm-utils-enum-types.h | 2 | ||||
| -rw-r--r-- | libnm-util/nm-utils.c | 4 | ||||
| -rw-r--r-- | libnm-util/tests/Makefile.in | 11 | ||||
| -rw-r--r-- | libnm-util/tests/certs/Makefile.in | 11 | ||||
| -rw-r--r-- | libnm-util/tests/test-general.c | 2 |
22 files changed, 766 insertions, 53 deletions
diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index 4d3afc82..76acd99f 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -16,6 +16,7 @@ libnm_util_include_HEADERS = \ nm-connection.h \ nm-setting.h \ nm-setting-8021x.h \ + nm-setting-adsl.h \ nm-setting-bluetooth.h \ nm-setting-bond.h \ nm-setting-connection.h \ @@ -49,6 +50,7 @@ libnm_util_la_csources = \ nm-param-spec-specialized.c \ nm-setting.c \ nm-setting-8021x.c \ + nm-setting-adsl.c \ nm-setting-bluetooth.c \ nm-setting-bond.c \ nm-setting-connection.c \ @@ -147,10 +149,11 @@ introspection_sources = $(libnm_util_include_HEADERS) $(libnm_util_la_csources) NetworkManager-1.0.gir: libnm-util.la NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 +NetworkManager_1_0_gir_EXPORT_PACKAGES = libnm-util NetworkManager_1_0_gir_CFLAGS = $(INCLUDES) -I$(top_srcdir)/libnm-util NetworkManager_1_0_gir_LIBS = libnm-util.la NetworkManager_1_0_gir_FILES = $(introspection_sources) -NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm_ +NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm INTROSPECTION_GIRS += NetworkManager-1.0.gir girdir = $(datadir)/gir-1.0 diff --git a/libnm-util/Makefile.in b/libnm-util/Makefile.in index e17da224..dcff0c62 100644 --- a/libnm-util/Makefile.in +++ b/libnm-util/Makefile.in @@ -64,7 +64,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -105,7 +105,7 @@ libnm_util_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) am__libnm_util_la_SOURCES_DIST = crypto.c nm-connection.c \ nm-param-spec-specialized.c nm-setting.c nm-setting-8021x.c \ - nm-setting-bluetooth.c nm-setting-bond.c \ + nm-setting-adsl.c nm-setting-bluetooth.c nm-setting-bond.c \ nm-setting-connection.c nm-setting-infiniband.c \ nm-setting-ip4-config.c nm-setting-vlan.c \ nm-setting-ip6-config.c nm-setting-ppp.c nm-setting-pppoe.c \ @@ -118,6 +118,7 @@ am__libnm_util_la_SOURCES_DIST = crypto.c nm-connection.c \ am__objects_1 = libnm_util_la-crypto.lo libnm_util_la-nm-connection.lo \ libnm_util_la-nm-param-spec-specialized.lo \ libnm_util_la-nm-setting.lo libnm_util_la-nm-setting-8021x.lo \ + libnm_util_la-nm-setting-adsl.lo \ libnm_util_la-nm-setting-bluetooth.lo \ libnm_util_la-nm-setting-bond.lo \ libnm_util_la-nm-setting-connection.lo \ @@ -302,6 +303,10 @@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ @@ -397,6 +402,9 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VAPIGEN = @VAPIGEN@ +VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ +VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ @@ -435,6 +443,8 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ @@ -464,6 +474,7 @@ libnm_util_include_HEADERS = \ nm-connection.h \ nm-setting.h \ nm-setting-8021x.h \ + nm-setting-adsl.h \ nm-setting-bluetooth.h \ nm-setting-bond.h \ nm-setting-connection.h \ @@ -497,6 +508,7 @@ libnm_util_la_csources = \ nm-param-spec-specialized.c \ nm-setting.c \ nm-setting-8021x.c \ + nm-setting-adsl.c \ nm-setting-bluetooth.c \ nm-setting-bond.c \ nm-setting-connection.c \ @@ -554,10 +566,11 @@ INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir) @HAVE_INTROSPECTION_TRUE@introspection_sources = $(libnm_util_include_HEADERS) $(libnm_util_la_csources) $(top_srcdir)/include/NetworkManager.h $(top_srcdir)/include/NetworkManagerVPN.h @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_INCLUDES = GObject-2.0 DBusGLib-1.0 @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_PACKAGES = gobject-2.0 dbus-glib-1 +@HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_EXPORT_PACKAGES = libnm-util @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_CFLAGS = $(INCLUDES) -I$(top_srcdir)/libnm-util @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_LIBS = libnm-util.la @HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_FILES = $(introspection_sources) -@HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm_ +@HAVE_INTROSPECTION_TRUE@NetworkManager_1_0_gir_SCANNERFLAGS = --warn-all --identifier-prefix=NM --symbol-prefix=nm @HAVE_INTROSPECTION_TRUE@girdir = $(datadir)/gir-1.0 @HAVE_INTROSPECTION_TRUE@gir_DATA = $(INTROSPECTION_GIRS) @HAVE_INTROSPECTION_TRUE@typelibdir = $(libdir)/girepository-1.0 @@ -656,6 +669,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-connection.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-param-spec-specialized.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-setting-8021x.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-setting-adsl.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-setting-bluetooth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-setting-bond.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libnm_util_la-nm-setting-cdma.Plo@am__quote@ @@ -748,6 +762,14 @@ libnm_util_la-nm-setting-8021x.lo: nm-setting-8021x.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnm_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnm_util_la-nm-setting-8021x.lo `test -f 'nm-setting-8021x.c' || echo '$(srcdir)/'`nm-setting-8021x.c +libnm_util_la-nm-setting-adsl.lo: nm-setting-adsl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnm_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnm_util_la-nm-setting-adsl.lo -MD -MP -MF $(DEPDIR)/libnm_util_la-nm-setting-adsl.Tpo -c -o libnm_util_la-nm-setting-adsl.lo `test -f 'nm-setting-adsl.c' || echo '$(srcdir)/'`nm-setting-adsl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_util_la-nm-setting-adsl.Tpo $(DEPDIR)/libnm_util_la-nm-setting-adsl.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='nm-setting-adsl.c' object='libnm_util_la-nm-setting-adsl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnm_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libnm_util_la-nm-setting-adsl.lo `test -f 'nm-setting-adsl.c' || echo '$(srcdir)/'`nm-setting-adsl.c + libnm_util_la-nm-setting-bluetooth.lo: nm-setting-bluetooth.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libnm_util_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libnm_util_la-nm-setting-bluetooth.lo -MD -MP -MF $(DEPDIR)/libnm_util_la-nm-setting-bluetooth.Tpo -c -o libnm_util_la-nm-setting-bluetooth.lo `test -f 'nm-setting-bluetooth.c' || echo '$(srcdir)/'`nm-setting-bluetooth.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libnm_util_la-nm-setting-bluetooth.Tpo $(DEPDIR)/libnm_util_la-nm-setting-bluetooth.Plo diff --git a/libnm-util/libnm-util.ver b/libnm-util/libnm-util.ver index eb3f1f32..9eec05cf 100644 --- a/libnm-util/libnm-util.ver +++ b/libnm-util/libnm-util.ver @@ -15,6 +15,7 @@ global: nm_connection_get_path; nm_connection_get_setting; nm_connection_get_setting_802_1x; + nm_connection_get_setting_adsl; nm_connection_get_setting_bluetooth; nm_connection_get_setting_bond; nm_connection_get_setting_by_name; @@ -171,6 +172,17 @@ global: nm_setting_802_1x_set_phase2_client_cert; nm_setting_802_1x_set_phase2_private_key; nm_setting_802_1x_set_private_key; + nm_setting_adsl_error_get_type; + nm_setting_adsl_error_quark; + nm_setting_adsl_get_encapsulation; + nm_setting_adsl_get_password; + nm_setting_adsl_get_password_flags; + nm_setting_adsl_get_protocol; + nm_setting_adsl_get_type; + nm_setting_adsl_get_username; + nm_setting_adsl_get_vci; + nm_setting_adsl_get_vpi; + nm_setting_adsl_new; nm_setting_bluetooth_error_get_type; nm_setting_bluetooth_error_quark; nm_setting_bluetooth_get_bdaddr; @@ -435,6 +447,7 @@ global: nm_setting_wireless_get_bssid; nm_setting_wireless_get_channel; nm_setting_wireless_get_cloned_mac_address; + nm_setting_wireless_get_hidden; nm_setting_wireless_get_mac_address; nm_setting_wireless_get_mac_address_blacklist; nm_setting_wireless_get_mode; diff --git a/libnm-util/nm-connection.c b/libnm-util/nm-connection.c index 13099998..80a4996d 100644 --- a/libnm-util/nm-connection.c +++ b/libnm-util/nm-connection.c @@ -41,6 +41,7 @@ #include "nm-setting-pppoe.h" #include "nm-setting-wimax.h" #include "nm-setting-wired.h" +#include "nm-setting-adsl.h" #include "nm-setting-wireless.h" #include "nm-setting-wireless-security.h" #include "nm-setting-serial.h" @@ -117,7 +118,7 @@ static guint signals[LAST_SIGNAL] = { 0 }; static GHashTable *registered_settings = NULL; -#define DEFAULT_MAP_SIZE 19 +#define DEFAULT_MAP_SIZE 20 static struct SettingInfo { const char *name; @@ -259,6 +260,11 @@ register_default_settings (void) NM_SETTING_PPPOE_ERROR, 3, TRUE); + register_one_setting (NM_SETTING_ADSL_SETTING_NAME, + NM_TYPE_SETTING_ADSL, + NM_SETTING_ADSL_ERROR, + 3, TRUE); + register_one_setting (NM_SETTING_802_1X_SETTING_NAME, NM_TYPE_SETTING_802_1X, NM_SETTING_802_1X_ERROR, @@ -1625,6 +1631,23 @@ nm_connection_get_setting_wired (NMConnection *connection) } /** + * nm_connection_get_setting_adsl: + * @connection: the #NMConnection + * + * A shortcut to return any #NMSettingAdsl the connection might contain. + * + * Returns: (transfer none): an #NMSettingAdsl if the connection contains one, otherwise NULL + **/ +NMSettingAdsl * +nm_connection_get_setting_adsl (NMConnection *connection) +{ + g_return_val_if_fail (connection != NULL, NULL); + g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL); + + return (NMSettingAdsl *) nm_connection_get_setting (connection, NM_TYPE_SETTING_ADSL); +} + +/** * nm_connection_get_setting_wireless: * @connection: the #NMConnection * diff --git a/libnm-util/nm-connection.h b/libnm-util/nm-connection.h index 6df74f57..ca29d157 100644 --- a/libnm-util/nm-connection.h +++ b/libnm-util/nm-connection.h @@ -46,6 +46,7 @@ #include <nm-setting-vpn.h> #include <nm-setting-wimax.h> #include <nm-setting-wired.h> +#include <nm-setting-adsl.h> #include <nm-setting-wireless.h> #include <nm-setting-wireless-security.h> #include <nm-setting-vlan.h> @@ -199,6 +200,7 @@ NMSettingPPPOE * nm_connection_get_setting_pppoe (NMConnec NMSettingSerial * nm_connection_get_setting_serial (NMConnection *connection); NMSettingVPN * nm_connection_get_setting_vpn (NMConnection *connection); NMSettingWimax * nm_connection_get_setting_wimax (NMConnection *connection); +NMSettingAdsl * nm_connection_get_setting_adsl (NMConnection *connection); NMSettingWired * nm_connection_get_setting_wired (NMConnection *connection); NMSettingWireless * nm_connection_get_setting_wireless (NMConnection *connection); NMSettingWirelessSecurity *nm_connection_get_setting_wireless_security (NMConnection *connection); diff --git a/libnm-util/nm-setting-adsl.c b/libnm-util/nm-setting-adsl.c new file mode 100644 index 00000000..9e31c423 --- /dev/null +++ b/libnm-util/nm-setting-adsl.c @@ -0,0 +1,461 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* + * Dan Williams <dcbw@redhat.com> + * Hicham HAOUARI <hicham.haouari@gmail.com> + * Pantelis Koukousoulas <pktoss@gmail.com> + * + * 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. + * + * (C) Copyright 2007 - 2008 Red Hat, Inc. + */ + +#include "nm-setting-adsl.h" +#include "nm-setting-ppp.h" +#include "nm-setting-private.h" +#include "nm-utils.h" +#include <string.h> + +/** + * SECTION:nm-setting-adsl + * @short_description: Describes ADSL-based properties + * @include: nm-setting-adsl.h + * + * The #NMSettingAdsl object is a #NMSetting subclass that describes + * properties of ADSL connections. + */ + +/** + * nm_setting_adsl_error_quark: + * + * Registers an error quark for #NMSettingAdsl if necessary. + * + * Returns: the error quark used for #NMSettingAdsl errors. + **/ +GQuark +nm_setting_adsl_error_quark (void) +{ + static GQuark quark; + + if (G_UNLIKELY (!quark)) + quark = g_quark_from_static_string ("nm-setting-adsl-error-quark"); + return quark; +} + +G_DEFINE_TYPE (NMSettingAdsl, nm_setting_adsl, NM_TYPE_SETTING) + +#define NM_SETTING_ADSL_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_SETTING_ADSL, NMSettingAdslPrivate)) + +typedef struct { + char * username; + char * password; + NMSettingSecretFlags password_flags; + char * protocol; + char * encapsulation; + guint32 vpi; + guint32 vci; +} NMSettingAdslPrivate; + +enum { + PROP_0, + PROP_USERNAME, + PROP_PASSWORD, + PROP_PASSWORD_FLAGS, + PROP_PROTOCOL, + PROP_ENCAPSULATION, + PROP_VPI, + PROP_VCI, + + LAST_PROP +}; + +/** + * nm_setting_adsl_new: + * + * Creates a new #NMSettingAdsl object with default values. + * + * Returns: the new empty #NMSettingAdsl object + **/ +NMSetting * +nm_setting_adsl_new (void) +{ + return (NMSetting *) g_object_new (NM_TYPE_SETTING_ADSL, NULL); +} + +/** + * nm_setting_adsl_get_username: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingAdsl:username property of the setting + **/ +const char * +nm_setting_adsl_get_username (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), NULL); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->username; +} + +/** + * nm_setting_adsl_get_password: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingAdsl:password property of the setting + **/ +const char * +nm_setting_adsl_get_password (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), NULL); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->password; +} + +/** + * nm_setting_adsl_get_password_flags: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingSecretFlags pertaining to the #NMSettingAdsl:password + **/ +NMSettingSecretFlags +nm_setting_adsl_get_password_flags (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), NM_SETTING_SECRET_FLAG_NONE); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->password_flags; +} + +/** + * nm_setting_adsl_get_protocol: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingAdsl:protocol property of the setting + **/ +const char * +nm_setting_adsl_get_protocol (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), NULL); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->protocol; +} + +/** + * nm_setting_adsl_get_encapsulation: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingAdsl:encapsulation property of the setting + **/ +const char * +nm_setting_adsl_get_encapsulation (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), NULL); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->encapsulation; +} + +/** + * nm_setting_adsl_get_vpi: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingAdsl:vpi property of the setting + **/ +guint32 +nm_setting_adsl_get_vpi (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), 0); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->vpi; +} + +/** + * nm_setting_adsl_get_vci: + * @setting: the #NMSettingAdsl + * + * Returns: the #NMSettingAdsl:vci property of the setting + **/ +guint32 +nm_setting_adsl_get_vci (NMSettingAdsl *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_ADSL (setting), 0); + + return NM_SETTING_ADSL_GET_PRIVATE (setting)->vci; +} + +static gboolean +verify (NMSetting *setting, GSList *all_settings, GError **error) +{ + NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (setting); + + if (!priv->username) { + g_set_error (error, + NM_SETTING_ADSL_ERROR, + NM_SETTING_ADSL_ERROR_MISSING_PROPERTY, + NM_SETTING_ADSL_USERNAME); + return FALSE; + } else if (!strlen (priv->username)) { + g_set_error (error, + NM_SETTING_ADSL_ERROR, + NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, + NM_SETTING_ADSL_USERNAME); + return FALSE; + } + + if (priv->password && !strlen (priv->password)) { + g_set_error (error, + NM_SETTING_ADSL_ERROR, + NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, + NM_SETTING_ADSL_PASSWORD); + return FALSE; + } + + if (strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOA) && + strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_PPPOE) && + strcmp (priv->protocol, NM_SETTING_ADSL_PROTOCOL_IPOATM)) { + g_set_error (error, + NM_SETTING_ADSL_ERROR, + NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, + NM_SETTING_ADSL_PROTOCOL); + return FALSE; + } + + if (strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_VCMUX) && + strcmp (priv->encapsulation, NM_SETTING_ADSL_ENCAPSULATION_LLC) ) { + g_set_error (error, + NM_SETTING_ADSL_ERROR, + NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, + NM_SETTING_ADSL_ENCAPSULATION); + return FALSE; + } + + return TRUE; +} + +static GPtrArray * +need_secrets (NMSetting *setting) +{ + NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (setting); + GPtrArray *secrets = NULL; + + if (priv->password) + return NULL; + + if (!(priv->password_flags & NM_SETTING_SECRET_FLAG_NOT_REQUIRED)) { + secrets = g_ptr_array_sized_new (1); + g_ptr_array_add (secrets, NM_SETTING_ADSL_PASSWORD); + } + + return secrets; +} + +static void +nm_setting_adsl_init (NMSettingAdsl *setting) +{ + g_object_set (setting, NM_SETTING_NAME, NM_SETTING_ADSL_SETTING_NAME, NULL); +} + +static void +finalize (GObject *object) +{ + NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (object); + + g_free (priv->username); + g_free (priv->password); + g_free (priv->protocol); + g_free (priv->encapsulation); + + G_OBJECT_CLASS (nm_setting_adsl_parent_class)->finalize (object); +} + +static void +set_property (GObject *object, guint prop_id, + const GValue *value, GParamSpec *pspec) +{ + NMSettingAdslPrivate *priv = NM_SETTING_ADSL_GET_PRIVATE (object); + + switch (prop_id) { + case PROP_USERNAME: + g_free (priv->username); + priv->username = g_value_dup_string (value); + break; + case PROP_PASSWORD: + g_free (priv->password); + priv->password = g_value_dup_string (value); + break; + case PROP_PASSWORD_FLAGS: + priv->password_flags = g_value_get_uint (value); + break; + case PROP_PROTOCOL: + g_free (priv->protocol); + priv->protocol = g_ascii_strdown (g_value_get_string (value), -1); + break; + case PROP_ENCAPSULATION: + g_free (priv->encapsulation); + priv->encapsulation = g_ascii_strdown (g_value_get_string (value), -1); + break; + case PROP_VPI: + priv->vpi = g_value_get_uint (value); + break; + case PROP_VCI: + priv->vci = g_value_get_uint (value); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +get_property (GObject *object, guint prop_id, + GValue *value, GParamSpec *pspec) +{ + NMSettingAdsl *setting = NM_SETTING_ADSL (object); + + switch (prop_id) { + case PROP_USERNAME: + g_value_set_string (value, nm_setting_adsl_get_username (setting)); + break; + case PROP_PASSWORD: + g_value_set_string (value, nm_setting_adsl_get_password (setting)); + break; + case PROP_PASSWORD_FLAGS: + g_value_set_uint (value, nm_setting_adsl_get_password_flags (setting)); + break; + case PROP_PROTOCOL: + g_value_set_string (value, nm_setting_adsl_get_protocol (setting)); + break; + case PROP_ENCAPSULATION: + g_value_set_string (value, nm_setting_adsl_get_encapsulation (setting)); + break; + case PROP_VPI: + g_value_set_uint (value, nm_setting_adsl_get_vpi (setting)); + break; + case PROP_VCI: + g_value_set_uint (value, nm_setting_adsl_get_vci (setting)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +nm_setting_adsl_class_init (NMSettingAdslClass *setting_class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (setting_class); + NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class); + + g_type_class_add_private (setting_class, sizeof (NMSettingAdslPrivate)); + + /* virtual methods */ + object_class->set_property = set_property; + object_class->get_property = get_property; + object_class->finalize = finalize; + parent_class->verify = verify; + parent_class->need_secrets = need_secrets; + + /* Properties */ + + /** + * NMSettingAdsl:username: + * + * Username used to authenticate with the ADSL service. + **/ + g_object_class_install_property + (object_class, PROP_USERNAME, + g_param_spec_string (NM_SETTING_ADSL_USERNAME, + "Username", + "Username used to authenticate with the pppoa service.", + NULL, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + /** + * NMSettingADSL:password: + * + * Password used to authenticate with the ADSL service. + **/ + g_object_class_install_property + (object_class, PROP_PASSWORD, + g_param_spec_string (NM_SETTING_ADSL_PASSWORD, + "Password", + "Password used to authenticate with the pppoa service.", + NULL, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE | NM_SETTING_PARAM_SECRET)); + + /** + * NMSettingAdsl:password-flags: + * + * Flags indicating how to handle #NMSettingAdsl:password:. + **/ + g_object_class_install_property (object_class, PROP_PASSWORD_FLAGS, + g_param_spec_uint (NM_SETTING_ADSL_PASSWORD_FLAGS, + "Password Flags", + "Flags indicating how to handle the ADSL password.", + NM_SETTING_SECRET_FLAG_NONE, + NM_SETTING_SECRET_FLAGS_ALL, + NM_SETTING_SECRET_FLAG_NONE, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + /** + * NMSettingAdsl:protocol: + * + * ADSL connection protocol, can be pppoa, pppoe or ipoatm. + **/ + g_object_class_install_property + (object_class, PROP_PROTOCOL, + g_param_spec_string (NM_SETTING_ADSL_PROTOCOL, + "Protocol", + "ADSL connection protocol.", + NULL, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + /** + * NMSettingAdsl:encapsulation: + * + * ADSL connection encapsulation, can be vcmux or llc. + **/ + g_object_class_install_property + (object_class, PROP_ENCAPSULATION, + g_param_spec_string (NM_SETTING_ADSL_ENCAPSULATION, + "Encapsulation", + "Encapsulation of ADSL connection", + NULL, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + /** + * NMSettingAdsl:vpi: + * + * ADSL connection vpi. + **/ + g_object_class_install_property + (object_class, PROP_VPI, + g_param_spec_uint (NM_SETTING_ADSL_VPI, + "VPI", + "VPI of ADSL connection", + 0, 65536, 0, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + /** + * NMSettingAdsl:vci: + * + * ADSL connection vci. + **/ + g_object_class_install_property + (object_class, PROP_VCI, + g_param_spec_uint (NM_SETTING_ADSL_VCI, + "VCI", + "VCI of ADSL connection", + 0, 65536, 0, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); +} diff --git a/libnm-util/nm-setting-adsl.h b/libnm-util/nm-setting-adsl.h new file mode 100644 index 00000000..f233c7ed --- /dev/null +++ b/libnm-util/nm-setting-adsl.h @@ -0,0 +1,100 @@ +/* -*- mode: c; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ + +/* + * Dan Williams <dcbw@redhat.com> + * Hicham HAOUARI <hicham.haouari@gmail.com> + * Pantelis Koukousoulas <pantelis@gmail.com> + * + * 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. + * + * (C) Copyright 2007 - 2008 Red Hat, Inc. + */ + +#ifndef NM_SETTING_ADSL_H +#define NM_SETTING_ADSL_H + +#include <nm-setting.h> + +G_BEGIN_DECLS + +#define NM_TYPE_SETTING_ADSL (nm_setting_adsl_get_type ()) +#define NM_SETTING_ADSL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_ADSL, NMSettingAdsl)) +#define NM_SETTING_ADSL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_ADSL, NMSettingAdslClass)) +#define NM_IS_SETTING_ADSL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_ADSL)) +#define NM_IS_SETTING_ADSL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SETTING_ADSL)) +#define NM_SETTING_ADSL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_ADSL, NMSettingAdslClass)) + +#define NM_SETTING_ADSL_SETTING_NAME "adsl" + +/** + * NMSettingAdslError: + * @NM_SETTING_ADSL_ERROR_UNKNOWN: unknown or unclassified error + * @NM_SETTING_ADSL_ERROR_INVALID_PROPERTY: the property was invalid + * @NM_SETTING_ADSL_ERROR_MISSING_PROPERTY: the property was missing and is + * required + */ +typedef enum { + NM_SETTING_ADSL_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/ + NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/ + NM_SETTING_ADSL_ERROR_MISSING_PROPERTY /*< nick=MissingProperty >*/ +} NMSettingAdslError; + +#define NM_SETTING_ADSL_ERROR nm_setting_adsl_error_quark () +GQuark nm_setting_adsl_error_quark (void); + +#define NM_SETTING_ADSL_USERNAME "username" +#define NM_SETTING_ADSL_PASSWORD "password" +#define NM_SETTING_ADSL_PASSWORD_FLAGS "password-flags" +#define NM_SETTING_ADSL_PROTOCOL "protocol" +#define NM_SETTING_ADSL_ENCAPSULATION "encapsulation" +#define NM_SETTING_ADSL_VPI "vpi" +#define NM_SETTING_ADSL_VCI "vci" + +#define NM_SETTING_ADSL_PROTOCOL_PPPOA "pppoa" +#define NM_SETTING_ADSL_PROTOCOL_PPPOE "pppoe" +#define NM_SETTING_ADSL_PROTOCOL_IPOATM "ipoatm" + +#define NM_SETTING_ADSL_ENCAPSULATION_VCMUX "vcmux" +#define NM_SETTING_ADSL_ENCAPSULATION_LLC "llc" + +typedef struct { + NMSetting parent; +} NMSettingAdsl; + +typedef struct { + NMSettingClass parent; + + /* Padding for future expansion */ + void (*_reserved1) (void); + void (*_reserved2) (void); + void (*_reserved3) (void); + void (*_reserved4) (void); +} NMSettingAdslClass; + +GType nm_setting_adsl_get_type (void); + +NMSetting *nm_setting_adsl_new (void); +const char *nm_setting_adsl_get_username (NMSettingAdsl *setting); +const char *nm_setting_adsl_get_password (NMSettingAdsl *setting); +const char *nm_setting_adsl_get_protocol (NMSettingAdsl *setting); +const char *nm_setting_adsl_get_encapsulation (NMSettingAdsl *setting); +guint32 nm_setting_adsl_get_vpi (NMSettingAdsl *setting); +guint32 nm_setting_adsl_get_vci (NMSettingAdsl *setting); +NMSettingSecretFlags nm_setting_adsl_get_password_flags (NMSettingAdsl *setting); + +G_END_DECLS + +#endif /* NM_SETTING_ADSL_H */ diff --git a/libnm-util/nm-setting-bluetooth.c b/libnm-util/nm-setting-bluetooth.c index 6a2fed74..52f0b81e 100644 --- a/libnm-util/nm-setting-bluetooth.c +++ b/libnm-util/nm-setting-bluetooth.c @@ -104,7 +104,7 @@ NMSetting *nm_setting_bluetooth_new (void) const char * nm_setting_bluetooth_get_connection_type (NMSettingBluetooth *setting) { - g_return_val_if_fail (NM_IS_SETTING_BLUETOOTH (setting), 0); + g_return_val_if_fail (NM_IS_SETTING_BLUETOOTH (setting), NULL); return NM_SETTING_BLUETOOTH_GET_PRIVATE (setting)->type; } diff --git a/libnm-util/nm-setting-bond.c b/libnm-util/nm-setting-bond.c index 9f9f4389..b7994f4a 100644 --- a/libnm-util/nm-setting-bond.c +++ b/libnm-util/nm-setting-bond.c @@ -103,7 +103,7 @@ nm_setting_bond_new (void) } /** - * nm_setting_bond_get_interface_name + * nm_setting_bond_get_interface_name: * @setting: the #NMSettingBond * * Returns: the #NMSettingBond:interface-name property of the setting @@ -111,7 +111,7 @@ nm_setting_bond_new (void) const char * nm_setting_bond_get_interface_name (NMSettingBond *setting) { - g_return_val_if_fail (NM_IS_SETTING_BOND (setting), 0); + g_return_val_if_fail (NM_IS_SETTING_BOND (setting), NULL); return NM_SETTING_BOND_GET_PRIVATE (setting)->interface_name; } @@ -288,7 +288,7 @@ nm_setting_bond_remove_option (NMSettingBond *setting, * * Returns a list of valid bond options. * - * Returns: a NULL-terminated array of strings of valid bond options. + * Returns: (transfer none): a NULL-terminated array of strings of valid bond options. **/ const char ** nm_setting_bond_get_valid_options (NMSettingBond *setting) @@ -402,10 +402,10 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) || !value[0] || (strlen (value) > 200) || strchr (value, ' ')) { - g_set_error (error, - NM_SETTING_BOND_ERROR, - NM_SETTING_BOND_ERROR_INVALID_OPTION, - key); + g_set_error_literal (error, + NM_SETTING_BOND_ERROR, + NM_SETTING_BOND_ERROR_INVALID_OPTION, + key); return FALSE; } } diff --git a/libnm-util/nm-setting-ip6-config.c b/libnm-util/nm-setting-ip6-config.c index 45e3e635..67c101dc 100644 --- a/libnm-util/nm-setting-ip6-config.c +++ b/libnm-util/nm-setting-ip6-config.c @@ -149,7 +149,7 @@ nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i) NMSettingIP6ConfigPrivate *priv; - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); + g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); g_return_val_if_fail (i <= g_slist_length (priv->dns), NULL); @@ -631,7 +631,7 @@ nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting) NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting) { - g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); + g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ip6_privacy; } @@ -1210,8 +1210,8 @@ nm_ip6_address_compare (NMIP6Address *address, NMIP6Address *other) const struct in6_addr * nm_ip6_address_get_address (NMIP6Address *address) { - g_return_val_if_fail (address != NULL, 0); - g_return_val_if_fail (address->refcount > 0, 0); + g_return_val_if_fail (address != NULL, NULL); + g_return_val_if_fail (address->refcount > 0, NULL); return &address->address; } @@ -1279,8 +1279,8 @@ nm_ip6_address_set_prefix (NMIP6Address *address, guint32 prefix) const struct in6_addr * nm_ip6_address_get_gateway (NMIP6Address *address) { - g_return_val_if_fail (address != NULL, 0); - g_return_val_if_fail (address->refcount > 0, 0); + g_return_val_if_fail (address != NULL, NULL); + g_return_val_if_fail (address->refcount > 0, NULL); return &address->gateway; } @@ -1427,8 +1427,8 @@ nm_ip6_route_compare (NMIP6Route *route, NMIP6Route *other) const struct in6_addr * nm_ip6_route_get_dest (NMIP6Route *route) { - g_return_val_if_fail (route != NULL, 0); - g_return_val_if_fail (route->refcount > 0, 0); + g_return_val_if_fail (route != NULL, NULL); + g_return_val_if_fail (route->refcount > 0, NULL); return &route->dest; } @@ -1496,8 +1496,8 @@ nm_ip6_route_set_prefix (NMIP6Route *route, guint32 prefix) const struct in6_addr * nm_ip6_route_get_next_hop (NMIP6Route *route) { - g_return_val_if_fail (route != NULL, 0); - g_return_val_if_fail (route->refcount > 0, 0); + g_return_val_if_fail (route != NULL, NULL); + g_return_val_if_fail (route->refcount > 0, NULL); return &route->next_hop; } diff --git a/libnm-util/nm-setting-ppp.c b/libnm-util/nm-setting-ppp.c index 6b1fd5ac..ee9b5f59 100644 --- a/libnm-util/nm-setting-ppp.c +++ b/libnm-util/nm-setting-ppp.c @@ -117,7 +117,7 @@ nm_setting_ppp_new (void) } /** - * nm_setting_wired_get_noauth: + * nm_setting_ppp_get_noauth: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:noauth property of the setting @@ -131,7 +131,7 @@ nm_setting_ppp_get_noauth (NMSettingPPP *setting) } /** - * nm_setting_wired_get_refuse_eap: + * nm_setting_ppp_get_refuse_eap: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:refuse-eap property of the setting @@ -145,7 +145,7 @@ nm_setting_ppp_get_refuse_eap (NMSettingPPP *setting) } /** - * nm_setting_wired_get_refuse_pap: + * nm_setting_ppp_get_refuse_pap: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:refuse-pap property of the setting @@ -159,7 +159,7 @@ nm_setting_ppp_get_refuse_pap (NMSettingPPP *setting) } /** - * nm_setting_wired_get_refuse_chap: + * nm_setting_ppp_get_refuse_chap: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:refuse-chap property of the setting @@ -173,7 +173,7 @@ nm_setting_ppp_get_refuse_chap (NMSettingPPP *setting) } /** - * nm_setting_wired_get_refuse_mschap: + * nm_setting_ppp_get_refuse_mschap: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:refuse-mschap property of the setting @@ -187,7 +187,7 @@ nm_setting_ppp_get_refuse_mschap (NMSettingPPP *setting) } /** - * nm_setting_wired_get_refuse_mschapv2: + * nm_setting_ppp_get_refuse_mschapv2: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:refuse-mschapv2 property of the setting @@ -201,7 +201,7 @@ nm_setting_ppp_get_refuse_mschapv2 (NMSettingPPP *setting) } /** - * nm_setting_wired_get_nobsdcomp: + * nm_setting_ppp_get_nobsdcomp: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:nobsdcomp property of the setting @@ -215,7 +215,7 @@ nm_setting_ppp_get_nobsdcomp (NMSettingPPP *setting) } /** - * nm_setting_wired_get_nodeflate: + * nm_setting_ppp_get_nodeflate: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:nodeflate property of the setting @@ -229,7 +229,7 @@ nm_setting_ppp_get_nodeflate (NMSettingPPP *setting) } /** - * nm_setting_wired_get_no_vj_comp: + * nm_setting_ppp_get_no_vj_comp: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:no-vj-comp property of the setting @@ -243,7 +243,7 @@ nm_setting_ppp_get_no_vj_comp (NMSettingPPP *setting) } /** - * nm_setting_wired_get_require_mppe: + * nm_setting_ppp_get_require_mppe: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:require-mppe property of the setting @@ -257,7 +257,7 @@ nm_setting_ppp_get_require_mppe (NMSettingPPP *setting) } /** - * nm_setting_wired_get_require_mppe_128: + * nm_setting_ppp_get_require_mppe_128: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:require-mppe-128 property of the setting @@ -271,7 +271,7 @@ nm_setting_ppp_get_require_mppe_128 (NMSettingPPP *setting) } /** - * nm_setting_wired_get_mppe_stateful: + * nm_setting_ppp_get_mppe_stateful: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:mppe-stateful property of the setting @@ -285,7 +285,7 @@ nm_setting_ppp_get_mppe_stateful (NMSettingPPP *setting) } /** - * nm_setting_wired_get_crtscts: + * nm_setting_ppp_get_crtscts: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:crtscts property of the setting @@ -299,7 +299,7 @@ nm_setting_ppp_get_crtscts (NMSettingPPP *setting) } /** - * nm_setting_wired_get_baud: + * nm_setting_ppp_get_baud: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:baud property of the setting @@ -313,7 +313,7 @@ nm_setting_ppp_get_baud (NMSettingPPP *setting) } /** - * nm_setting_wired_get_mru: + * nm_setting_ppp_get_mru: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:mru property of the setting @@ -327,7 +327,7 @@ nm_setting_ppp_get_mru (NMSettingPPP *setting) } /** - * nm_setting_wired_get_mtu: + * nm_setting_ppp_get_mtu: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:mtu property of the setting @@ -341,7 +341,7 @@ nm_setting_ppp_get_mtu (NMSettingPPP *setting) } /** - * nm_setting_wired_get_lcp_echo_failure: + * nm_setting_ppp_get_lcp_echo_failure: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:lcp-echo-failure property of the setting @@ -355,7 +355,7 @@ nm_setting_ppp_get_lcp_echo_failure (NMSettingPPP *setting) } /** - * nm_setting_wired_get_lcp_echo_interval: + * nm_setting_ppp_get_lcp_echo_interval: * @setting: the #NMSettingPPP * * Returns: the #NMSettingPPP:lcp-echo-interval property of the setting diff --git a/libnm-util/nm-setting-pppoe.c b/libnm-util/nm-setting-pppoe.c index e25c0926..62c42f01 100644 --- a/libnm-util/nm-setting-pppoe.c +++ b/libnm-util/nm-setting-pppoe.c @@ -105,7 +105,7 @@ nm_setting_pppoe_get_service (NMSettingPPPOE *setting) } /** - * nm_setting_pppoe_get_service: + * nm_setting_pppoe_get_username: * @setting: the #NMSettingPPPOE * * Returns: the #NMSettingPPPOE:username property of the setting @@ -119,7 +119,7 @@ nm_setting_pppoe_get_username (NMSettingPPPOE *setting) } /** - * nm_setting_pppoe_get_service: + * nm_setting_pppoe_get_password: * @setting: the #NMSettingPPPOE * * Returns: the #NMSettingPPPOE:password property of the setting diff --git a/libnm-util/nm-setting-vlan.c b/libnm-util/nm-setting-vlan.c index 71760dca..b65b6197 100644 --- a/libnm-util/nm-setting-vlan.c +++ b/libnm-util/nm-setting-vlan.c @@ -88,6 +88,7 @@ typedef struct { /** * nm_setting_vlan_new: + * * Creates a new #NMSettingVlan object with default values. * * Returns: (transfer full): the new empty #NMSettingVlan object @@ -220,7 +221,7 @@ set_map (NMSettingVlan *self, NMVlanPriorityMap map, GSList *list) } /** - * nm_setting_vlan_add_priority_str + * nm_setting_vlan_add_priority_str: * @setting: the #NMSettingVlan * @map: the type of priority map * @str: the string which contains a priority map, like "3:7" @@ -460,7 +461,7 @@ verify (NMSetting *setting, GSList *all_settings, GError **error) return FALSE; } - if (priv->flags & !(NM_VLAN_FLAG_REORDER_HEADERS | + if (priv->flags & ~(NM_VLAN_FLAG_REORDER_HEADERS | NM_VLAN_FLAG_GVRP | NM_VLAN_FLAG_LOOSE_BINDING)) { g_set_error (error, diff --git a/libnm-util/nm-setting-wireless-security.c b/libnm-util/nm-setting-wireless-security.c index 98473120..336773c8 100644 --- a/libnm-util/nm-setting-wireless-security.c +++ b/libnm-util/nm-setting-wireless-security.c @@ -59,7 +59,7 @@ **/ /** - * nm_setting_wired_error_quark: + * nm_setting_wireless_security_error_quark: * * Registers an error quark for #NMSettingWired if necessary. * diff --git a/libnm-util/nm-setting-wireless.c b/libnm-util/nm-setting-wireless.c index 31882516..f9ed3108 100644 --- a/libnm-util/nm-setting-wireless.c +++ b/libnm-util/nm-setting-wireless.c @@ -19,7 +19,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2007 - 2011 Red Hat, Inc. + * (C) Copyright 2007 - 2012 Red Hat, Inc. * (C) Copyright 2007 - 2008 Novell, Inc. */ @@ -80,6 +80,7 @@ typedef struct { guint32 mtu; GSList *seen_bssids; char *security; + gboolean hidden; } NMSettingWirelessPrivate; enum { @@ -97,6 +98,7 @@ enum { PROP_MTU, PROP_SEEN_BSSIDS, PROP_SEC, + PROP_HIDDEN, LAST_PROP }; @@ -482,6 +484,20 @@ nm_setting_wireless_get_security (NMSettingWireless *setting) } /** + * nm_setting_wireless_get_hidden: + * @setting: the #NMSettingWireless + * + * Returns: the #NMSettingWireless:hidden property of the setting + **/ +gboolean +nm_setting_wireless_get_hidden (NMSettingWireless *setting) +{ + g_return_val_if_fail (NM_IS_SETTING_WIRELESS (setting), FALSE); + + return NM_SETTING_WIRELESS_GET_PRIVATE (setting)->hidden; +} + +/** * nm_setting_wireless_add_seen_bssid: * @setting: the #NMSettingWireless * @bssid: the new BSSID to add to the list @@ -770,6 +786,9 @@ set_property (GObject *object, guint prop_id, g_free (priv->security); priv->security = g_value_dup_string (value); break; + case PROP_HIDDEN: + priv->hidden = g_value_get_boolean (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -822,6 +841,9 @@ get_property (GObject *object, guint prop_id, case PROP_SEC: g_value_set_string (value, nm_setting_wireless_get_security (setting)); break; + case PROP_HIDDEN: + g_value_set_boolean (value, nm_setting_wireless_get_hidden (setting)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1082,4 +1104,27 @@ nm_setting_wireless_class_init (NMSettingWirelessClass *setting_class) NM_SETTING_WIRELESS_SECURITY_SETTING_NAME " setting.", NULL, G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); + + /** + * NMSettingWireless:hidden: + * + * If %TRUE, indicates this network is a non-broadcasting network that + * hides its SSID. In this case various workarounds may take place, such + * as probe-scanning the SSID for more reliable network discovery. However, + * these workarounds expose inherent insecurities with hidden SSID networks, + * and thus hidden SSID networks should be used with caution. + **/ + g_object_class_install_property + (object_class, PROP_HIDDEN, + g_param_spec_boolean (NM_SETTING_WIRELESS_HIDDEN, + "Hidden", + "If TRUE, indicates this network is a non-broadcasting " + "network that hides its SSID. In this case various " + "workarounds may take place, such as probe-scanning " + "the SSID for more reliable network discovery. " + "However, these workarounds expose inherent " + "insecurities with hidden SSID networks, and thus " + "hidden SSID networks should be used with caution.", + FALSE, + G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE)); } diff --git a/libnm-util/nm-setting-wireless.h b/libnm-util/nm-setting-wireless.h index 3182f419..abbf231a 100644 --- a/libnm-util/nm-setting-wireless.h +++ b/libnm-util/nm-setting-wireless.h @@ -76,6 +76,7 @@ GQuark nm_setting_wireless_error_quark (void); #define NM_SETTING_WIRELESS_MTU "mtu" #define NM_SETTING_WIRELESS_SEEN_BSSIDS "seen-bssids" #define NM_SETTING_WIRELESS_SEC "security" +#define NM_SETTING_WIRELESS_HIDDEN "hidden" /** * NM_SETTING_WIRELESS_MODE_ADHOC: @@ -85,7 +86,7 @@ GQuark nm_setting_wireless_error_quark (void); #define NM_SETTING_WIRELESS_MODE_ADHOC "adhoc" /** - * NM_SETTING_WIRELESS_MODE_INFRA + * NM_SETTING_WIRELESS_MODE_INFRA: * * Indicates infrastructure mode where an access point is expected to be present * for this connection. @@ -122,6 +123,7 @@ const GByteArray *nm_setting_wireless_get_cloned_mac_address (NMSettingWireless const GSList *nm_setting_wireless_get_mac_address_blacklist (NMSettingWireless *setting); guint32 nm_setting_wireless_get_mtu (NMSettingWireless *setting); const char *nm_setting_wireless_get_security (NMSettingWireless *setting); +gboolean nm_setting_wireless_get_hidden (NMSettingWireless *setting); gboolean nm_setting_wireless_add_seen_bssid (NMSettingWireless *setting, const char *bssid); diff --git a/libnm-util/nm-utils-enum-types.c b/libnm-util/nm-utils-enum-types.c index dcf51dee..332eb98b 100644 --- a/libnm-util/nm-utils-enum-types.c +++ b/libnm-util/nm-utils-enum-types.c @@ -8,6 +8,7 @@ #include "nm-connection.h" #include "nm-setting.h" #include "nm-setting-8021x.h" +#include "nm-setting-adsl.h" #include "nm-setting-bluetooth.h" #include "nm-setting-bond.h" #include "nm-setting-connection.h" @@ -216,6 +217,26 @@ nm_setting_802_1x_error_get_type (void) return g_define_type_id__volatile; } GType +nm_setting_adsl_error_get_type (void) +{ + static volatile gsize g_define_type_id__volatile = 0; + + if (g_once_init_enter (&g_define_type_id__volatile)) + { + static const GEnumValue values[] = { + { NM_SETTING_ADSL_ERROR_UNKNOWN, "NM_SETTING_ADSL_ERROR_UNKNOWN", "UnknownError" }, + { NM_SETTING_ADSL_ERROR_INVALID_PROPERTY, "NM_SETTING_ADSL_ERROR_INVALID_PROPERTY", "InvalidProperty" }, + { NM_SETTING_ADSL_ERROR_MISSING_PROPERTY, "NM_SETTING_ADSL_ERROR_MISSING_PROPERTY", "MissingProperty" }, + { 0, NULL, NULL } + }; + GType g_define_type_id = + g_enum_register_static (g_intern_static_string ("NMSettingAdslError"), values); + g_once_init_leave (&g_define_type_id__volatile, g_define_type_id); + } + + return g_define_type_id__volatile; +} +GType nm_setting_bluetooth_error_get_type (void) { static volatile gsize g_define_type_id__volatile = 0; diff --git a/libnm-util/nm-utils-enum-types.h b/libnm-util/nm-utils-enum-types.h index d3bcf049..d88fda24 100644 --- a/libnm-util/nm-utils-enum-types.h +++ b/libnm-util/nm-utils-enum-types.h @@ -27,6 +27,8 @@ GType nm_setting_802_1x_ck_scheme_get_type (void) G_GNUC_CONST; #define NM_TYPE_SETTING_802_1X_CK_SCHEME (nm_setting_802_1x_ck_scheme_get_type ()) GType nm_setting_802_1x_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_SETTING_802_1X_ERROR (nm_setting_802_1x_error_get_type ()) +GType nm_setting_adsl_error_get_type (void) G_GNUC_CONST; +#define NM_TYPE_SETTING_ADSL_ERROR (nm_setting_adsl_error_get_type ()) GType nm_setting_bluetooth_error_get_type (void) G_GNUC_CONST; #define NM_TYPE_SETTING_BLUETOOTH_ERROR (nm_setting_bluetooth_error_get_type ()) GType nm_setting_bond_error_get_type (void) G_GNUC_CONST; diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index a8806206..f76d0e10 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -1889,7 +1889,7 @@ nm_utils_ip6_routes_to_gvalue (GSList *list, GValue *value) /* FIXME: the Posix namespace does not exist, and thus neither does the in6_addr struct. Marking (skip) for now */ /** - * nm_utils_ip6_dns_from_gvalue: (skip): + * nm_utils_ip6_dns_from_gvalue: (skip) * @value: a #GValue * * Converts a #GValue containing a #GPtrArray of IP6 DNS, represented as @@ -1925,7 +1925,7 @@ nm_utils_ip6_dns_from_gvalue (const GValue *value) } /** - * nm_utils_ip6_dns_to_gvalue: (skip): + * nm_utils_ip6_dns_to_gvalue: (skip) * @list: a list of #NMIP6Route objects * @value: a pointer to a #GValue into which to place the converted DNS server * addresses, which should be unset by the caller (when no longer needed) with diff --git a/libnm-util/tests/Makefile.in b/libnm-util/tests/Makefile.in index 10a1e20f..fb60d5f4 100644 --- a/libnm-util/tests/Makefile.in +++ b/libnm-util/tests/Makefile.in @@ -50,7 +50,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -232,6 +232,10 @@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ @@ -327,6 +331,9 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VAPIGEN = @VAPIGEN@ +VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ +VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ @@ -365,6 +372,8 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ diff --git a/libnm-util/tests/certs/Makefile.in b/libnm-util/tests/certs/Makefile.in index 17289f48..4f0bab76 100644 --- a/libnm-util/tests/certs/Makefile.in +++ b/libnm-util/tests/certs/Makefile.in @@ -55,7 +55,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/compiler_warnings.m4 \ $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ - $(top_srcdir)/configure.ac + $(top_srcdir)/m4/vapigen.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d @@ -143,6 +143,10 @@ INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ INTLTOOL_MERGE = @INTLTOOL_MERGE@ INTLTOOL_PERL = @INTLTOOL_PERL@ INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_V_MERGE = @INTLTOOL_V_MERGE@ +INTLTOOL_V_MERGE_OPTIONS = @INTLTOOL_V_MERGE_OPTIONS@ +INTLTOOL__v_MERGE_ = @INTLTOOL__v_MERGE_@ +INTLTOOL__v_MERGE_0 = @INTLTOOL__v_MERGE_0@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ INTROSPECTION_CFLAGS = @INTROSPECTION_CFLAGS@ INTROSPECTION_COMPILER = @INTROSPECTION_COMPILER@ @@ -238,6 +242,9 @@ UDEV_BASE_DIR = @UDEV_BASE_DIR@ USE_NLS = @USE_NLS@ UUID_CFLAGS = @UUID_CFLAGS@ UUID_LIBS = @UUID_LIBS@ +VAPIGEN = @VAPIGEN@ +VAPIGEN_MAKEFILE = @VAPIGEN_MAKEFILE@ +VAPIGEN_VAPIDIR = @VAPIGEN_VAPIDIR@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ @@ -276,6 +283,8 @@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ +intltool__v_merge_options_ = @intltool__v_merge_options_@ +intltool__v_merge_options_0 = @intltool__v_merge_options_0@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ diff --git a/libnm-util/tests/test-general.c b/libnm-util/tests/test-general.c index 1eed8887..2acb31b3 100644 --- a/libnm-util/tests/test-general.c +++ b/libnm-util/tests/test-general.c @@ -783,7 +783,7 @@ new_test_connection (void) NMConnection *connection; NMSetting *setting; char *uuid; - gulong timestamp = time (NULL); + guint64 timestamp = time (NULL); connection = nm_connection_new (); |