aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2021-11-26 15:26:05 +0100
committerAleksander Morgado <aleksander@aleksander.es>2021-12-24 14:03:15 +0100
commitf6a91b2250203e0f11f1d9dde9e8f9963e5c62a4 (patch)
tree479e867aad27f42a8c08ae953490508eb7c80a27
parent24e634229d27cd9743c5c5cfa3e6cedd98bf1379 (diff)
libmm-glib: new 'roaming-allowance' in 3GPP profile and bearer properties
-rw-r--r--docs/reference/libmm-glib/libmm-glib-sections.txt4
-rw-r--r--libmm-glib/mm-3gpp-profile.c44
-rw-r--r--libmm-glib/mm-3gpp-profile.h4
-rw-r--r--libmm-glib/mm-bearer-properties.c41
-rw-r--r--libmm-glib/mm-bearer-properties.h4
5 files changed, 97 insertions, 0 deletions
diff --git a/docs/reference/libmm-glib/libmm-glib-sections.txt b/docs/reference/libmm-glib/libmm-glib-sections.txt
index e22be5a6..153d1d80 100644
--- a/docs/reference/libmm-glib/libmm-glib-sections.txt
+++ b/docs/reference/libmm-glib/libmm-glib-sections.txt
@@ -1298,6 +1298,8 @@ mm_bearer_properties_get_multiplex
mm_bearer_properties_set_multiplex
mm_bearer_properties_get_access_type_preference
mm_bearer_properties_set_access_type_preference
+mm_bearer_properties_get_roaming_allowance
+mm_bearer_properties_set_roaming_allowance
<SUBSECTION Private>
mm_bearer_properties_new_from_dictionary
mm_bearer_properties_new_from_string
@@ -1651,6 +1653,8 @@ mm_3gpp_profile_get_access_type_preference
mm_3gpp_profile_set_access_type_preference
mm_3gpp_profile_get_enabled
mm_3gpp_profile_set_enabled
+mm_3gpp_profile_get_roaming_allowance
+mm_3gpp_profile_set_roaming_allowance
<SUBSECTION Private>
mm_3gpp_profile_new_from_dictionary
mm_3gpp_profile_new_from_string
diff --git a/libmm-glib/mm-3gpp-profile.c b/libmm-glib/mm-3gpp-profile.c
index eca2f7e0..b9c66fce 100644
--- a/libmm-glib/mm-3gpp-profile.c
+++ b/libmm-glib/mm-3gpp-profile.c
@@ -47,6 +47,7 @@ G_DEFINE_TYPE (MM3gppProfile, mm_3gpp_profile, G_TYPE_OBJECT)
#define PROPERTY_APN_TYPE "apn-type"
#define PROPERTY_ACCESS_TYPE_PREFERENCE "access-type-preference"
#define PROPERTY_ENABLED "profile-enabled"
+#define PROPERTY_ROAMING_ALLOWANCE "roaming-allowance"
struct _MM3gppProfilePrivate {
gint profile_id;
@@ -57,6 +58,7 @@ struct _MM3gppProfilePrivate {
MMBearerAccessTypePreference access_type_preference;
gboolean enabled;
gboolean enabled_set;
+ MMBearerRoamingAllowance roaming_allowance;
/* Optional authentication settings */
MMBearerAllowedAuth allowed_auth;
@@ -118,6 +120,9 @@ mm_3gpp_profile_cmp (MM3gppProfile *a,
if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED) &&
((a->priv->enabled != b->priv->enabled) || (a->priv->enabled_set != b->priv->enabled_set)))
return FALSE;
+ if (!(flags & MM_3GPP_PROFILE_CMP_FLAGS_NO_ROAMING_ALLOWANCE) &&
+ (a->priv->roaming_allowance != b->priv->roaming_allowance))
+ return FALSE;
return TRUE;
}
@@ -519,6 +524,44 @@ mm_3gpp_profile_get_enabled (MM3gppProfile *self)
/*****************************************************************************/
/**
+ * mm_3gpp_profile_set_roaming_allowance:
+ * @self: a #MM3gppProfile.
+ * @roaming_allowance: a mask of #MMBearerRoamingAllowance values.
+ *
+ * Sets the roaming allowance rules.
+ *
+ * Since: 1.20
+ */
+void
+mm_3gpp_profile_set_roaming_allowance (MM3gppProfile *self,
+ MMBearerRoamingAllowance roaming_allowance)
+{
+ g_return_if_fail (MM_IS_3GPP_PROFILE (self));
+
+ self->priv->roaming_allowance = roaming_allowance;
+}
+
+/**
+ * mm_3gpp_profile_get_roaming_allowance:
+ * @self: a #MM3gppProfile.
+ *
+ * Gets the roaming allowance rules.
+ *
+ * Returns: a mask of #MMBearerRoamingAllowance values.
+ *
+ * Since: 1.20
+ */
+MMBearerRoamingAllowance
+mm_3gpp_profile_get_roaming_allowance (MM3gppProfile *self)
+{
+ g_return_val_if_fail (MM_IS_3GPP_PROFILE (self), MM_BEARER_ROAMING_ALLOWANCE_NONE);
+
+ return self->priv->roaming_allowance;
+}
+
+/*****************************************************************************/
+
+/**
* mm_3gpp_profile_get_dictionary: (skip)
*/
GVariant *
@@ -865,6 +908,7 @@ mm_3gpp_profile_init (MM3gppProfile *self)
self->priv->apn_type = MM_BEARER_APN_TYPE_NONE;
self->priv->access_type_preference = MM_BEARER_ACCESS_TYPE_PREFERENCE_NONE;
self->priv->enabled = TRUE;
+ self->priv->roaming_allowance = MM_BEARER_ROAMING_ALLOWANCE_NONE;
}
static void
diff --git a/libmm-glib/mm-3gpp-profile.h b/libmm-glib/mm-3gpp-profile.h
index ecff787a..7dc491df 100644
--- a/libmm-glib/mm-3gpp-profile.h
+++ b/libmm-glib/mm-3gpp-profile.h
@@ -94,6 +94,8 @@ void mm_3gpp_profile_set_access_type_preference (MM3gppProfile *s
MMBearerAccessTypePreference access_type_preference);
void mm_3gpp_profile_set_enabled (MM3gppProfile *self,
gboolean enabled);
+void mm_3gpp_profile_set_roaming_allowance (MM3gppProfile *self,
+ MMBearerRoamingAllowance roaming_allowance);
gint mm_3gpp_profile_get_profile_id (MM3gppProfile *self);
const gchar *mm_3gpp_profile_get_profile_name (MM3gppProfile *self);
@@ -105,6 +107,7 @@ MMBearerIpFamily mm_3gpp_profile_get_ip_type (MM3gpp
MMBearerApnType mm_3gpp_profile_get_apn_type (MM3gppProfile *self);
MMBearerAccessTypePreference mm_3gpp_profile_get_access_type_preference (MM3gppProfile *self);
gboolean mm_3gpp_profile_get_enabled (MM3gppProfile *self);
+MMBearerRoamingAllowance mm_3gpp_profile_get_roaming_allowance (MM3gppProfile *self);
/*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */
@@ -136,6 +139,7 @@ typedef enum {
MM_3GPP_PROFILE_CMP_FLAGS_NO_IP_TYPE = 1 << 5,
MM_3GPP_PROFILE_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE = 1 << 6,
MM_3GPP_PROFILE_CMP_FLAGS_NO_ENABLED = 1 << 7,
+ MM_3GPP_PROFILE_CMP_FLAGS_NO_ROAMING_ALLOWANCE = 1 << 8,
} MM3gppProfileCmpFlags;
gboolean mm_3gpp_profile_cmp (MM3gppProfile *a,
diff --git a/libmm-glib/mm-bearer-properties.c b/libmm-glib/mm-bearer-properties.c
index c880803b..dad93de9 100644
--- a/libmm-glib/mm-bearer-properties.c
+++ b/libmm-glib/mm-bearer-properties.c
@@ -411,6 +411,44 @@ mm_bearer_properties_get_access_type_preference (MMBearerProperties *self)
/*****************************************************************************/
/**
+ * mm_bearer_properties_set_roaming_allowance:
+ * @self: a #MMBearerProperties.
+ * @roaming_allowance: a mask of #MMBearerRoamingAllowance values
+ *
+ * Sets the roaming allowance rules.
+ *
+ * Since: 1.20
+ */
+void
+mm_bearer_properties_set_roaming_allowance (MMBearerProperties *self,
+ MMBearerRoamingAllowance roaming_allowance)
+{
+ g_return_if_fail (MM_IS_BEARER_PROPERTIES (self));
+
+ mm_3gpp_profile_set_roaming_allowance (self->priv->profile, roaming_allowance);
+}
+
+/**
+ * mm_bearer_properties_get_roaming_allowance:
+ * @self: a #MMBearerProperties.
+ *
+ * Gets the roaming allowance rules.
+ *
+ * Returns: a mask of #MMBearerRoamingAllowance values.
+ *
+ * Since: 1.20
+ */
+MMBearerRoamingAllowance
+mm_bearer_properties_get_roaming_allowance (MMBearerProperties *self)
+{
+ g_return_val_if_fail (MM_IS_BEARER_PROPERTIES (self), MM_BEARER_ROAMING_ALLOWANCE_NONE);
+
+ return mm_3gpp_profile_get_roaming_allowance (self->priv->profile);
+}
+
+/*****************************************************************************/
+
+/**
* mm_bearer_properties_set_allow_roaming:
* @self: a #MMBearerProperties.
* @allow_roaming: boolean value.
@@ -873,6 +911,9 @@ mm_bearer_properties_cmp (MMBearerProperties *a,
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE) &&
(mm_3gpp_profile_get_access_type_preference (a->priv->profile) != mm_3gpp_profile_get_access_type_preference (b->priv->profile)))
return FALSE;
+ if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ROAMING_ALLOWANCE) &&
+ (mm_3gpp_profile_get_roaming_allowance (a->priv->profile) != mm_3gpp_profile_get_roaming_allowance (b->priv->profile)))
+ return FALSE;
if (!(flags & MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ALLOW_ROAMING)) {
if (a->priv->allow_roaming != b->priv->allow_roaming)
return FALSE;
diff --git a/libmm-glib/mm-bearer-properties.h b/libmm-glib/mm-bearer-properties.h
index c0e9c78f..0e6a3471 100644
--- a/libmm-glib/mm-bearer-properties.h
+++ b/libmm-glib/mm-bearer-properties.h
@@ -90,6 +90,8 @@ void mm_bearer_properties_set_multiplex (MMBearerProperties
MMBearerMultiplexSupport multiplex);
void mm_bearer_properties_set_access_type_preference (MMBearerProperties *self,
MMBearerAccessTypePreference access_type_preference);
+void mm_bearer_properties_set_roaming_allowance (MMBearerProperties *self,
+ MMBearerRoamingAllowance roaming_allowance);
const gchar *mm_bearer_properties_get_apn (MMBearerProperties *self);
MMBearerAllowedAuth mm_bearer_properties_get_allowed_auth (MMBearerProperties *self);
@@ -103,6 +105,7 @@ gboolean mm_bearer_properties_get_allow_roaming (MM
MMModemCdmaRmProtocol mm_bearer_properties_get_rm_protocol (MMBearerProperties *self);
MMBearerMultiplexSupport mm_bearer_properties_get_multiplex (MMBearerProperties *self);
MMBearerAccessTypePreference mm_bearer_properties_get_access_type_preference (MMBearerProperties *self);
+MMBearerRoamingAllowance mm_bearer_properties_get_roaming_allowance (MMBearerProperties *self);
/*****************************************************************************/
/* ModemManager/libmm-glib/mmcli specific methods */
@@ -141,6 +144,7 @@ typedef enum {
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_ID = 1 << 5,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_PROFILE_NAME = 1 << 6,
MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ACCESS_TYPE_PREFERENCE = 1 << 7,
+ MM_BEARER_PROPERTIES_CMP_FLAGS_NO_ROAMING_ALLOWANCE = 1 << 8,
} MMBearerPropertiesCmpFlags;
gboolean mm_bearer_properties_cmp (MMBearerProperties *a,