libnm-util: add nm_setting_gsm_get_home_only()

For roaming control.
This commit is contained in:
Dan Williams 2010-03-16 23:52:37 -07:00
parent 4af1cc2661
commit d924003320
4 changed files with 42 additions and 4 deletions

View file

@ -59,7 +59,7 @@ libnm_util_la_SOURCES= \
libnm_util_la_LIBADD = $(GLIB_LIBS) $(DBUS_LIBS) $(UUID_LIBS)
libnm_util_la_LDFLAGS = -Wl,--version-script=$(srcdir)/libnm-util.ver \
-version-info "3:0:2"
-version-info "4:0:3"
if WITH_GNUTLS
libnm_util_la_SOURCES += crypto_gnutls.c

View file

@ -135,6 +135,7 @@ global:
nm_setting_gsm_get_band;
nm_setting_gsm_get_pin;
nm_setting_gsm_get_puk;
nm_setting_gsm_get_home_only;
nm_setting_ip4_config_error_get_type;
nm_setting_ip4_config_error_quark;
nm_setting_ip4_config_get_type;

View file

@ -19,7 +19,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* (C) Copyright 2007 - 2008 Red Hat, Inc.
* (C) Copyright 2007 - 2010 Red Hat, Inc.
* (C) Copyright 2007 - 2008 Novell, Inc.
*/
@ -80,6 +80,8 @@ typedef struct {
guint32 allowed_bands; /* A bitfield of NM_SETTING_GSM_BAND_* */
char *pin;
gboolean home_only;
} NMSettingGsmPrivate;
enum {
@ -94,6 +96,7 @@ enum {
PROP_PIN,
PROP_PUK,
PROP_ALLOWED_BANDS,
PROP_HOME_ONLY,
LAST_PROP
};
@ -191,6 +194,14 @@ nm_setting_gsm_get_puk (NMSettingGsm *setting)
return NULL;
}
gboolean
nm_setting_gsm_get_home_only (NMSettingGsm *setting)
{
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), FALSE);
return NM_SETTING_GSM_GET_PRIVATE (setting)->home_only;
}
static gboolean
verify (NMSetting *setting, GSList *all_settings, GError **error)
{
@ -356,6 +367,9 @@ set_property (GObject *object, guint prop_id,
if (str && strlen (str))
g_warning ("Tried to set deprecated property " NM_SETTING_GSM_SETTING_NAME "/" NM_SETTING_GSM_PUK);
break;
case PROP_HOME_ONLY:
priv->home_only = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -401,6 +415,9 @@ get_property (GObject *object, guint prop_id,
/* deprecated */
g_value_set_int (value, -1);
break;
case PROP_HOME_ONLY:
g_value_set_boolean (value, nm_setting_gsm_get_home_only (setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -572,7 +589,8 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
|| NM_SETTING_GSM_BAND_U800
|| NM_SETTING_GSM_BAND_U850
|| NM_SETTING_GSM_BAND_U900
|| NM_SETTING_GSM_BAND_U17IX,
|| NM_SETTING_GSM_BAND_U17IX
|| NM_SETTING_GSM_BAND_U1900,
NM_SETTING_GSM_BAND_ANY,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | NM_SETTING_PARAM_SERIALIZE));
@ -593,6 +611,22 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
NULL,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE | NM_SETTING_PARAM_SECRET));
/**
* NMSettingGsm:home-only:
*
* When TRUE, only connections to the home network will be allowed.
* Connections to roaming networks will not be made.
**/
g_object_class_install_property
(object_class, PROP_HOME_ONLY,
g_param_spec_boolean (NM_SETTING_GSM_HOME_ONLY,
"PIN",
"When TRUE, only connections to the home network will "
"be allowed. Connections to roaming networks will "
"not be made.",
FALSE,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
/* Deprecated properties */
/**
* NMSettingGsm:puk:

View file

@ -19,7 +19,7 @@
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* (C) Copyright 2007 - 2008 Red Hat, Inc.
* (C) Copyright 2007 - 2010 Red Hat, Inc.
* (C) Copyright 2007 - 2008 Novell, Inc.
*/
@ -61,6 +61,7 @@ GQuark nm_setting_gsm_error_quark (void);
#define NM_SETTING_GSM_NETWORK_TYPE "network-type"
#define NM_SETTING_GSM_ALLOWED_BANDS "allowed-bands"
#define NM_SETTING_GSM_PIN "pin"
#define NM_SETTING_GSM_HOME_ONLY "home-only"
/* DEPRECATED & UNUSED */
#define NM_SETTING_GSM_PUK "puk"
@ -95,6 +96,7 @@ typedef enum {
NM_SETTING_GSM_BAND_U850 = 0x00000200, /* WCDMA 3GPP UMTS 850 MHz (Class V) */
NM_SETTING_GSM_BAND_U900 = 0x00000400, /* WCDMA 3GPP UMTS 900 MHz (Class VIII) */
NM_SETTING_GSM_BAND_U17IX = 0x00000800, /* WCDMA 3GPP UMTS 1700 MHz (Class IX) */
NM_SETTING_GSM_BAND_U1900 = 0x00001000, /* WCDMA 3GPP UMTS 1900 MHz (Class II) */
} NMSettingGsmNetworkBand;
typedef struct {
@ -122,6 +124,7 @@ const char *nm_setting_gsm_get_network_id (NMSettingGsm *setting);
int nm_setting_gsm_get_network_type (NMSettingGsm *setting);
guint32 nm_setting_gsm_get_allowed_bands (NMSettingGsm *setting);
const char *nm_setting_gsm_get_pin (NMSettingGsm *setting);
gboolean nm_setting_gsm_get_home_only (NMSettingGsm *setting);
/* DEPRECATED & UNUSED */
const char *nm_setting_gsm_get_puk (NMSettingGsm *setting);