aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2014-03-25 00:18:32 -0700
committerAleksander Morgado <aleksander@aleksander.es>2014-03-25 17:10:13 +0100
commite4db8c5302e61b84d796e9a84f57fa51cfce2577 (patch)
tree336ab8630466fbf7884de5406650f3b5192f54a4
parent4de728447a1b5825e5a9bd29cc54f196540fb6c1 (diff)
api: add MTU to bearer IP config properties
This patch adds a 'mtu' value to the Ip4Config and Ip6Config property of a Bearer object, which indicates the value of the maximum transmission unit for the established connection when such information is available (e.g. via QMI_WDS_GET_RUNTIME_SETTINGS on a QMI modem or MBIM_CID_IP_CONFIGURATION on a MBIM modem).
-rw-r--r--introspection/org.freedesktop.ModemManager1.Bearer.xml18
-rw-r--r--libmm-glib/mm-bearer-ip-config.c39
-rw-r--r--libmm-glib/mm-bearer-ip-config.h3
3 files changed, 60 insertions, 0 deletions
diff --git a/introspection/org.freedesktop.ModemManager1.Bearer.xml b/introspection/org.freedesktop.ModemManager1.Bearer.xml
index 29e502de..1d2f287b 100644
--- a/introspection/org.freedesktop.ModemManager1.Bearer.xml
+++ b/introspection/org.freedesktop.ModemManager1.Bearer.xml
@@ -157,6 +157,15 @@
</listitem>
</varlistentry>
</variablelist>
+
+ This property may also include the following items when such information is available:
+ <variablelist>
+ <varlistentry><term><literal>"mtu"</literal></term>
+ <listitem>
+ Maximum transmission unit (MTU), given as an unsigned integer value (signature <literal>"u"</literal>).
+ </listitem>
+ </varlistentry>
+ </variablelist>
-->
<property name="Ip4Config" type="a{sv}" access="read" />
@@ -215,6 +224,15 @@
</listitem>
</varlistentry>
</variablelist>
+
+ This property may also include the following items when such information is available:
+ <variablelist>
+ <varlistentry><term><literal>"mtu"</literal></term>
+ <listitem>
+ Maximum transmission unit (MTU), given as an unsigned integer value (signature <literal>"u"</literal>).
+ </listitem>
+ </varlistentry>
+ </variablelist>
-->
<property name="Ip6Config" type="a{sv}" access="read" />
diff --git a/libmm-glib/mm-bearer-ip-config.c b/libmm-glib/mm-bearer-ip-config.c
index e436c392..7ffd7bab 100644
--- a/libmm-glib/mm-bearer-ip-config.c
+++ b/libmm-glib/mm-bearer-ip-config.c
@@ -40,6 +40,7 @@ G_DEFINE_TYPE (MMBearerIpConfig, mm_bearer_ip_config, G_TYPE_OBJECT);
#define PROPERTY_DNS2 "dns2"
#define PROPERTY_DNS3 "dns3"
#define PROPERTY_GATEWAY "gateway"
+#define PROPERTY_MTU "mtu"
struct _MMBearerIpConfigPrivate {
MMBearerIpMethod method;
@@ -47,6 +48,7 @@ struct _MMBearerIpConfigPrivate {
guint prefix;
gchar **dns;
gchar *gateway;
+ guint mtu;
};
/*****************************************************************************/
@@ -189,6 +191,33 @@ mm_bearer_ip_config_set_gateway (MMBearerIpConfig *self,
/*****************************************************************************/
+/**
+ * mm_bearer_ip_config_get_mtu:
+ * @self: a #MMBearerIpConfig.
+ *
+ * Gets the MTU to be used with this bearer.
+ *
+ * Returns: the MTU.
+ */
+guint
+mm_bearer_ip_config_get_mtu (MMBearerIpConfig *self)
+{
+ g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), 0);
+
+ return self->priv->mtu;
+}
+
+void
+mm_bearer_ip_config_set_mtu (MMBearerIpConfig *self,
+ guint mtu)
+{
+ g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self));
+
+ self->priv->mtu = mtu;
+}
+
+/*****************************************************************************/
+
GVariant *
mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self)
{
@@ -246,6 +275,12 @@ mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self)
"{sv}",
PROPERTY_GATEWAY,
g_variant_new_string (self->priv->gateway));
+
+ if (self->priv->mtu)
+ g_variant_builder_add (&builder,
+ "{sv}",
+ PROPERTY_MTU,
+ g_variant_new_uint32 (self->priv->mtu));
}
return g_variant_builder_end (&builder);
@@ -306,6 +341,10 @@ mm_bearer_ip_config_new_from_dictionary (GVariant *dictionary,
mm_bearer_ip_config_set_gateway (
self,
g_variant_get_string (value, NULL));
+ else if (g_str_equal (key, PROPERTY_MTU))
+ mm_bearer_ip_config_set_mtu (
+ self,
+ g_variant_get_uint32 (value));
g_free (key);
g_variant_unref (value);
diff --git a/libmm-glib/mm-bearer-ip-config.h b/libmm-glib/mm-bearer-ip-config.h
index bfd2ea73..898a405d 100644
--- a/libmm-glib/mm-bearer-ip-config.h
+++ b/libmm-glib/mm-bearer-ip-config.h
@@ -60,6 +60,7 @@ const gchar *mm_bearer_ip_config_get_address (MMBearerIpConfig *self);
guint mm_bearer_ip_config_get_prefix (MMBearerIpConfig *self);
const gchar **mm_bearer_ip_config_get_dns (MMBearerIpConfig *self);
const gchar *mm_bearer_ip_config_get_gateway (MMBearerIpConfig *self);
+guint mm_bearer_ip_config_get_mtu (MMBearerIpConfig *self);
/*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */
@@ -84,6 +85,8 @@ void mm_bearer_ip_config_set_dns (MMBearerIpConfig *self,
const gchar **dns);
void mm_bearer_ip_config_set_gateway (MMBearerIpConfig *self,
const gchar *gateway);
+void mm_bearer_ip_config_set_mtu (MMBearerIpConfig *self,
+ guint mtu);
GVariant *mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self);