libnm-core: add mtu property to gsm setting

This commit is contained in:
Beniamino Galvani 2016-10-26 10:05:46 +02:00
parent 35d4e8f7a0
commit 5d09183922
3 changed files with 45 additions and 0 deletions

View file

@ -62,6 +62,7 @@ typedef struct {
NMSettingSecretFlags pin_flags;
gboolean home_only;
guint32 mtu;
} NMSettingGsmPrivate;
enum {
@ -78,6 +79,7 @@ enum {
PROP_DEVICE_ID,
PROP_SIM_ID,
PROP_SIM_OPERATOR_ID,
PROP_MTU,
LAST_PROP
};
@ -269,6 +271,22 @@ nm_setting_gsm_get_sim_operator_id (NMSettingGsm *setting)
return NM_SETTING_GSM_GET_PRIVATE (setting)->sim_operator_id;
}
/**
* nm_setting_gsm_get_mtu:
* @setting: the #NMSettingGsm
*
* Returns: the #NMSettingGsm:mtu property of the setting
*
* Since: 1.8
**/
guint32
nm_setting_gsm_get_mtu (NMSettingGsm *setting)
{
g_return_val_if_fail (NM_IS_SETTING_GSM (setting), 0);
return NM_SETTING_GSM_GET_PRIVATE (setting)->mtu;
}
static gboolean
verify (NMSetting *setting, NMConnection *connection, GError **error)
{
@ -524,6 +542,9 @@ set_property (GObject *object, guint prop_id,
g_free (priv->sim_operator_id);
priv->sim_operator_id = g_value_dup_string (value);
break;
case PROP_MTU:
priv->mtu = g_value_get_uint (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -573,6 +594,9 @@ get_property (GObject *object, guint prop_id,
case PROP_SIM_OPERATOR_ID:
g_value_set_string (value, nm_setting_gsm_get_sim_operator_id (setting));
break;
case PROP_MTU:
g_value_set_uint (value, nm_setting_gsm_get_mtu (setting));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -780,6 +804,23 @@ nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
/**
* NMSettingGsm:mtu:
*
* If non-zero, only transmit packets of the specified size or smaller,
* breaking larger packets up into multiple frames.
*
* Since: 1.8
**/
g_object_class_install_property
(object_class, PROP_MTU,
g_param_spec_uint (NM_SETTING_GSM_MTU, "", "",
0, G_MAXUINT32, 0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
NM_SETTING_PARAM_FUZZY_IGNORE |
G_PARAM_STATIC_STRINGS));
/* Ignore incoming deprecated properties */
_nm_setting_class_add_dbus_only_property (parent_class, "allowed-bands",
G_VARIANT_TYPE_UINT32,

View file

@ -52,6 +52,7 @@ G_BEGIN_DECLS
#define NM_SETTING_GSM_DEVICE_ID "device-id"
#define NM_SETTING_GSM_SIM_ID "sim-id"
#define NM_SETTING_GSM_SIM_OPERATOR_ID "sim-operator-id"
#define NM_SETTING_GSM_MTU "mtu"
/**
* NMSettingGsm:
@ -84,6 +85,8 @@ NM_AVAILABLE_IN_1_2
const char *nm_setting_gsm_get_sim_id (NMSettingGsm *setting);
NM_AVAILABLE_IN_1_2
const char *nm_setting_gsm_get_sim_operator_id (NMSettingGsm *setting);
NM_AVAILABLE_IN_1_8
guint32 nm_setting_gsm_get_mtu (NMSettingGsm *setting);
NMSettingSecretFlags nm_setting_gsm_get_pin_flags (NMSettingGsm *setting);
NMSettingSecretFlags nm_setting_gsm_get_password_flags (NMSettingGsm *setting);

View file

@ -1154,4 +1154,5 @@ global:
nm_setting_802_1x_get_phase2_ca_cert_password_flags;
nm_setting_802_1x_get_phase2_client_cert_password;
nm_setting_802_1x_get_phase2_client_cert_password_flags;
nm_setting_gsm_get_mtu;
} libnm_1_6_0;