diff options
-rw-r--r-- | libmm-common/Makefile.am | 8 | ||||
-rw-r--r-- | libmm-common/libmm-common.h | 2 | ||||
-rw-r--r-- | libmm-common/mm-bearer-ip-config.c (renamed from libmm-common/mm-common-bearer-ip-config.c) | 126 | ||||
-rw-r--r-- | libmm-common/mm-bearer-ip-config.h | 73 | ||||
-rw-r--r-- | libmm-common/mm-common-bearer-ip-config.h | 73 | ||||
-rw-r--r-- | libmm-glib/Makefile.am | 3 | ||||
-rw-r--r-- | libmm-glib/mm-bearer-ip-config.c | 56 | ||||
-rw-r--r-- | libmm-glib/mm-bearer-ip-config.h | 39 | ||||
-rw-r--r-- | libmm-glib/mm-bearer.c | 4 | ||||
-rw-r--r-- | libmm-glib/mm-bearer.h | 1 | ||||
-rw-r--r-- | plugins/iridium/mm-bearer-iridium.c | 14 | ||||
-rw-r--r-- | plugins/novatel/mm-broadband-bearer-novatel.c | 14 | ||||
-rw-r--r-- | src/mm-bearer.c | 12 | ||||
-rw-r--r-- | src/mm-bearer.h | 4 | ||||
-rw-r--r-- | src/mm-broadband-bearer.c | 38 | ||||
-rw-r--r-- | src/mm-broadband-bearer.h | 8 |
16 files changed, 205 insertions, 270 deletions
diff --git a/libmm-common/Makefile.am b/libmm-common/Makefile.am index 2af348d4..c712079c 100644 --- a/libmm-common/Makefile.am +++ b/libmm-common/Makefile.am @@ -153,7 +153,7 @@ mm-common-simple-properties.c: mm-errors-types.h mm-enums-types.h mm-common-connect-properties.c: mm-errors-types.h mm-common-bearer-properties.c: mm-errors-types.h mm-sms-properties.c: mm-errors-types.h -mm-common-bearer-ip-config.c: mm-errors-types.h +mm-bearer-ip-config.c: mm-errors-types.h mm-common-location-3gpp.c: mm-errors-types.h mm-errors-quarks.c: mm-errors-types.h mm-unlock-retries.c: mm-enums-types.h @@ -167,7 +167,7 @@ include_HEADERS = \ mm-common-connect-properties.h \ mm-common-bearer-properties.h \ mm-sms-properties.h \ - mm-common-bearer-ip-config.h \ + mm-bearer-ip-config.h \ mm-common-location-3gpp.h \ mm-unlock-retries.h \ mm-gdbus-manager.h \ @@ -192,8 +192,8 @@ libmm_common_la_SOURCES = \ mm-common-bearer-properties.c \ mm-sms-properties.h \ mm-sms-properties.c \ - mm-common-bearer-ip-config.h \ - mm-common-bearer-ip-config.c \ + mm-bearer-ip-config.h \ + mm-bearer-ip-config.c \ mm-common-location-3gpp.h \ mm-common-location-3gpp.c \ mm-unlock-retries.h \ diff --git a/libmm-common/libmm-common.h b/libmm-common/libmm-common.h index 7e266f37..f53d2bcf 100644 --- a/libmm-common/libmm-common.h +++ b/libmm-common/libmm-common.h @@ -30,7 +30,7 @@ #include "mm-common-connect-properties.h" #include "mm-sms-properties.h" #include "mm-common-bearer-properties.h" -#include "mm-common-bearer-ip-config.h" +#include "mm-bearer-ip-config.h" #include "mm-common-location-3gpp.h" #include "mm-unlock-retries.h" #include "mm-gdbus-manager.h" diff --git a/libmm-common/mm-common-bearer-ip-config.c b/libmm-common/mm-bearer-ip-config.c index bcc65c30..06e7830e 100644 --- a/libmm-common/mm-common-bearer-ip-config.c +++ b/libmm-common/mm-bearer-ip-config.c @@ -16,9 +16,9 @@ #include <string.h> #include "mm-errors-types.h" -#include "mm-common-bearer-ip-config.h" +#include "mm-bearer-ip-config.h" -G_DEFINE_TYPE (MMCommonBearerIpConfig, mm_common_bearer_ip_config, G_TYPE_OBJECT); +G_DEFINE_TYPE (MMBearerIpConfig, mm_bearer_ip_config, G_TYPE_OBJECT); #define PROPERTY_METHOD "method" #define PROPERTY_ADDRESS "address" @@ -28,7 +28,7 @@ G_DEFINE_TYPE (MMCommonBearerIpConfig, mm_common_bearer_ip_config, G_TYPE_OBJECT #define PROPERTY_DNS3 "dns3" #define PROPERTY_GATEWAY "gateway" -struct _MMCommonBearerIpConfigPrivate { +struct _MMBearerIpConfigPrivate { MMBearerIpMethod method; gchar *address; guint prefix; @@ -39,39 +39,49 @@ struct _MMCommonBearerIpConfigPrivate { /*****************************************************************************/ void -mm_common_bearer_ip_config_set_method (MMCommonBearerIpConfig *self, - MMBearerIpMethod method) +mm_bearer_ip_config_set_method (MMBearerIpConfig *self, + MMBearerIpMethod method) { + g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self)); + self->priv->method = method; } void -mm_common_bearer_ip_config_set_address (MMCommonBearerIpConfig *self, - const gchar *address) +mm_bearer_ip_config_set_address (MMBearerIpConfig *self, + const gchar *address) { + g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self)); + g_free (self->priv->address); self->priv->address = g_strdup (address); } void -mm_common_bearer_ip_config_set_prefix (MMCommonBearerIpConfig *self, - guint prefix) +mm_bearer_ip_config_set_prefix (MMBearerIpConfig *self, + guint prefix) { + g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self)); + self->priv->prefix = prefix; } void -mm_common_bearer_ip_config_set_dns (MMCommonBearerIpConfig *self, - const gchar **dns) +mm_bearer_ip_config_set_dns (MMBearerIpConfig *self, + const gchar **dns) { + g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self)); + g_strfreev (self->priv->dns); self->priv->dns = g_strdupv ((gchar **)dns); } void -mm_common_bearer_ip_config_set_gateway (MMCommonBearerIpConfig *self, - const gchar *gateway) +mm_bearer_ip_config_set_gateway (MMBearerIpConfig *self, + const gchar *gateway) { + g_return_if_fail (MM_IS_BEARER_IP_CONFIG (self)); + g_free (self->priv->gateway); self->priv->gateway = g_strdup (gateway); } @@ -79,45 +89,57 @@ mm_common_bearer_ip_config_set_gateway (MMCommonBearerIpConfig *self, /*****************************************************************************/ MMBearerIpMethod -mm_common_bearer_ip_config_get_method (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_get_method (MMBearerIpConfig *self) { + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), MM_BEARER_IP_METHOD_UNKNOWN); + return self->priv->method; } const gchar * -mm_common_bearer_ip_config_get_address (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_get_address (MMBearerIpConfig *self) { + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); + return self->priv->address; } guint -mm_common_bearer_ip_config_get_prefix (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_get_prefix (MMBearerIpConfig *self) { + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), 0); + return self->priv->prefix; } const gchar ** -mm_common_bearer_ip_config_get_dns (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_get_dns (MMBearerIpConfig *self) { + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); + return (const gchar **)self->priv->dns; } const gchar * -mm_common_bearer_ip_config_get_gateway (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_get_gateway (MMBearerIpConfig *self) { + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); + return self->priv->gateway; } /*****************************************************************************/ GVariant * -mm_common_bearer_ip_config_get_dictionary (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self) { GVariantBuilder builder; /* We do allow self==NULL. We'll just report method=unknown in this case */ - g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + if (self) + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); g_variant_builder_add (&builder, "{sv}", PROPERTY_METHOD, @@ -172,34 +194,44 @@ mm_common_bearer_ip_config_get_dictionary (MMCommonBearerIpConfig *self) /*****************************************************************************/ -MMCommonBearerIpConfig * -mm_common_bearer_ip_config_new_from_dictionary (GVariant *dictionary, - GError **error) +MMBearerIpConfig * +mm_bearer_ip_config_new_from_dictionary (GVariant *dictionary, + GError **error) { GVariantIter iter; gchar *key; GVariant *value; - MMCommonBearerIpConfig *self; + MMBearerIpConfig *self; gchar *dns_array[4] = { 0 }; gboolean method_received = FALSE; - self = mm_common_bearer_ip_config_new (); + self = mm_bearer_ip_config_new (); if (!dictionary) return self; + if (!g_variant_is_of_type (dictionary, G_VARIANT_TYPE ("a{sv}"))) { + g_set_error (error, + MM_CORE_ERROR, + MM_CORE_ERROR_INVALID_ARGS, + "Cannot create IP config from dictionary: " + "invalid variant type received"); + g_object_unref (self); + return NULL; + } + g_variant_iter_init (&iter, dictionary); while (g_variant_iter_next (&iter, "{sv}", &key, &value)) { if (g_str_equal (key, PROPERTY_METHOD)) { method_received = TRUE; - mm_common_bearer_ip_config_set_method ( + mm_bearer_ip_config_set_method ( self, (MMBearerIpMethod) g_variant_get_uint32 (value)); } else if (g_str_equal (key, PROPERTY_ADDRESS)) - mm_common_bearer_ip_config_set_address ( + mm_bearer_ip_config_set_address ( self, g_variant_get_string (value, NULL)); else if (g_str_equal (key, PROPERTY_PREFIX)) - mm_common_bearer_ip_config_set_prefix ( + mm_bearer_ip_config_set_prefix ( self, g_variant_get_uint32 (value)); else if (g_str_equal (key, PROPERTY_DNS1)) { @@ -212,7 +244,7 @@ mm_common_bearer_ip_config_new_from_dictionary (GVariant *dictionary, g_free (dns_array[2]); dns_array[2] = g_variant_dup_string (value, NULL); } else if (g_str_equal (key, PROPERTY_GATEWAY)) - mm_common_bearer_ip_config_set_gateway ( + mm_bearer_ip_config_set_gateway ( self, g_variant_get_string (value, NULL)); @@ -221,7 +253,7 @@ mm_common_bearer_ip_config_new_from_dictionary (GVariant *dictionary, } if (dns_array[0]) - mm_common_bearer_ip_config_set_dns (self, (const gchar **)dns_array); + mm_bearer_ip_config_set_dns (self, (const gchar **)dns_array); if (!method_received) { g_set_error (error, @@ -240,15 +272,17 @@ mm_common_bearer_ip_config_new_from_dictionary (GVariant *dictionary, /*****************************************************************************/ -MMCommonBearerIpConfig * -mm_common_bearer_ip_config_dup (MMCommonBearerIpConfig *orig) +MMBearerIpConfig * +mm_bearer_ip_config_dup (MMBearerIpConfig *orig) { GVariant *dict; - MMCommonBearerIpConfig *copy; + MMBearerIpConfig *copy; GError *error = NULL; - dict = mm_common_bearer_ip_config_get_dictionary (orig); - copy = mm_common_bearer_ip_config_new_from_dictionary (dict, &error); + g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (orig), NULL); + + dict = mm_bearer_ip_config_get_dictionary (orig); + copy = mm_bearer_ip_config_new_from_dictionary (dict, &error); g_assert_no_error (error); g_variant_unref (dict); @@ -257,19 +291,19 @@ mm_common_bearer_ip_config_dup (MMCommonBearerIpConfig *orig) /*****************************************************************************/ -MMCommonBearerIpConfig * -mm_common_bearer_ip_config_new (void) +MMBearerIpConfig * +mm_bearer_ip_config_new (void) { - return (MM_COMMON_BEARER_IP_CONFIG ( - g_object_new (MM_TYPE_COMMON_BEARER_IP_CONFIG, NULL))); + return (MM_BEARER_IP_CONFIG ( + g_object_new (MM_TYPE_BEARER_IP_CONFIG, NULL))); } static void -mm_common_bearer_ip_config_init (MMCommonBearerIpConfig *self) +mm_bearer_ip_config_init (MMBearerIpConfig *self) { self->priv = G_TYPE_INSTANCE_GET_PRIVATE ((self), - MM_TYPE_COMMON_BEARER_IP_CONFIG, - MMCommonBearerIpConfigPrivate); + MM_TYPE_BEARER_IP_CONFIG, + MMBearerIpConfigPrivate); /* Some defaults */ self->priv->method = MM_BEARER_IP_METHOD_UNKNOWN; @@ -278,21 +312,21 @@ mm_common_bearer_ip_config_init (MMCommonBearerIpConfig *self) static void finalize (GObject *object) { - MMCommonBearerIpConfig *self = MM_COMMON_BEARER_IP_CONFIG (object); + MMBearerIpConfig *self = MM_BEARER_IP_CONFIG (object); g_free (self->priv->address); g_free (self->priv->gateway); g_strfreev (self->priv->dns); - G_OBJECT_CLASS (mm_common_bearer_ip_config_parent_class)->finalize (object); + G_OBJECT_CLASS (mm_bearer_ip_config_parent_class)->finalize (object); } static void -mm_common_bearer_ip_config_class_init (MMCommonBearerIpConfigClass *klass) +mm_bearer_ip_config_class_init (MMBearerIpConfigClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); - g_type_class_add_private (object_class, sizeof (MMCommonBearerIpConfigPrivate)); + g_type_class_add_private (object_class, sizeof (MMBearerIpConfigPrivate)); object_class->finalize = finalize; } diff --git a/libmm-common/mm-bearer-ip-config.h b/libmm-common/mm-bearer-ip-config.h new file mode 100644 index 00000000..7fc6dd69 --- /dev/null +++ b/libmm-common/mm-bearer-ip-config.h @@ -0,0 +1,73 @@ +/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program 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 General Public License for more details: + * + * Copyright (C) 2012 Google, Inc. + */ + +#ifndef MM_BEARER_IP_CONFIG_H +#define MM_BEARER_IP_CONFIG_H + +#include <ModemManager.h> +#include <glib-object.h> + +G_BEGIN_DECLS + +#define MM_TYPE_BEARER_IP_CONFIG (mm_bearer_ip_config_get_type ()) +#define MM_BEARER_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_BEARER_IP_CONFIG, MMBearerIpConfig)) +#define MM_BEARER_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_BEARER_IP_CONFIG, MMBearerIpConfigClass)) +#define MM_IS_BEARER_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_BEARER_IP_CONFIG)) +#define MM_IS_BEARER_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_BEARER_IP_CONFIG)) +#define MM_BEARER_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_BEARER_IP_CONFIG, MMBearerIpConfigClass)) + +typedef struct _MMBearerIpConfig MMBearerIpConfig; +typedef struct _MMBearerIpConfigClass MMBearerIpConfigClass; +typedef struct _MMBearerIpConfigPrivate MMBearerIpConfigPrivate; + +struct _MMBearerIpConfig { + GObject parent; + MMBearerIpConfigPrivate *priv; +}; + +struct _MMBearerIpConfigClass { + GObjectClass parent; +}; + +GType mm_bearer_ip_config_get_type (void); + +MMBearerIpConfig *mm_bearer_ip_config_new (void); +MMBearerIpConfig *mm_bearer_ip_config_new_from_dictionary (GVariant *dictionary, + GError **error); + +MMBearerIpConfig *mm_bearer_ip_config_dup (MMBearerIpConfig *orig); + +MMBearerIpMethod mm_bearer_ip_config_get_method (MMBearerIpConfig *self); +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); + +void mm_bearer_ip_config_set_method (MMBearerIpConfig *self, + MMBearerIpMethod ip_method); +void mm_bearer_ip_config_set_address (MMBearerIpConfig *self, + const gchar *address); +void mm_bearer_ip_config_set_prefix (MMBearerIpConfig *self, + guint prefix); +void mm_bearer_ip_config_set_dns (MMBearerIpConfig *self, + const gchar **dns); +void mm_bearer_ip_config_set_gateway (MMBearerIpConfig *self, + const gchar *gateway); + +GVariant *mm_bearer_ip_config_get_dictionary (MMBearerIpConfig *self); + +G_END_DECLS + +#endif /* MM_BEARER_IP_CONFIG_H */ diff --git a/libmm-common/mm-common-bearer-ip-config.h b/libmm-common/mm-common-bearer-ip-config.h deleted file mode 100644 index 4dab99b5..00000000 --- a/libmm-common/mm-common-bearer-ip-config.h +++ /dev/null @@ -1,73 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details: - * - * Copyright (C) 2012 Google, Inc. - */ - -#ifndef MM_COMMON_BEARER_IP_CONFIG_H -#define MM_COMMON_BEARER_IP_CONFIG_H - -#include <ModemManager.h> -#include <glib-object.h> - -G_BEGIN_DECLS - -#define MM_TYPE_COMMON_BEARER_IP_CONFIG (mm_common_bearer_ip_config_get_type ()) -#define MM_COMMON_BEARER_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MM_TYPE_COMMON_BEARER_IP_CONFIG, MMCommonBearerIpConfig)) -#define MM_COMMON_BEARER_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MM_TYPE_COMMON_BEARER_IP_CONFIG, MMCommonBearerIpConfigClass)) -#define MM_IS_COMMON_BEARER_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MM_TYPE_COMMON_BEARER_IP_CONFIG)) -#define MM_IS_COMMON_BEARER_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MM_TYPE_COMMON_BEARER_IP_CONFIG)) -#define MM_COMMON_BEARER_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MM_TYPE_COMMON_BEARER_IP_CONFIG, MMCommonBearerIpConfigClass)) - -typedef struct _MMCommonBearerIpConfig MMCommonBearerIpConfig; -typedef struct _MMCommonBearerIpConfigClass MMCommonBearerIpConfigClass; -typedef struct _MMCommonBearerIpConfigPrivate MMCommonBearerIpConfigPrivate; - -struct _MMCommonBearerIpConfig { - GObject parent; - MMCommonBearerIpConfigPrivate *priv; -}; - -struct _MMCommonBearerIpConfigClass { - GObjectClass parent; -}; - -GType mm_common_bearer_ip_config_get_type (void); - -MMCommonBearerIpConfig *mm_common_bearer_ip_config_new (void); -MMCommonBearerIpConfig *mm_common_bearer_ip_config_new_from_dictionary (GVariant *dictionary, - GError **error); - -MMCommonBearerIpConfig *mm_common_bearer_ip_config_dup (MMCommonBearerIpConfig *orig); - -MMBearerIpMethod mm_common_bearer_ip_config_get_method (MMCommonBearerIpConfig *self); -const gchar *mm_common_bearer_ip_config_get_address (MMCommonBearerIpConfig *self); -guint mm_common_bearer_ip_config_get_prefix (MMCommonBearerIpConfig *self); -const gchar **mm_common_bearer_ip_config_get_dns (MMCommonBearerIpConfig *self); -const gchar *mm_common_bearer_ip_config_get_gateway (MMCommonBearerIpConfig *self); - -void mm_common_bearer_ip_config_set_method (MMCommonBearerIpConfig *self, - MMBearerIpMethod ip_method); -void mm_common_bearer_ip_config_set_address (MMCommonBearerIpConfig *self, - const gchar *address); -void mm_common_bearer_ip_config_set_prefix (MMCommonBearerIpConfig *self, - guint prefix); -void mm_common_bearer_ip_config_set_dns (MMCommonBearerIpConfig *self, - const gchar **dns); -void mm_common_bearer_ip_config_set_gateway (MMCommonBearerIpConfig *self, - const gchar *gateway); - -GVariant *mm_common_bearer_ip_config_get_dictionary (MMCommonBearerIpConfig *self); - -G_END_DECLS - -#endif /* MM_COMMON_BEARER_IP_CONFIG_H */ diff --git a/libmm-glib/Makefile.am b/libmm-glib/Makefile.am index a44312a0..a0ebc353 100644 --- a/libmm-glib/Makefile.am +++ b/libmm-glib/Makefile.am @@ -42,8 +42,6 @@ libmm_glib_la_SOURCES = \ mm-modem-messaging.c \ mm-bearer-properties.h \ mm-bearer-properties.c \ - mm-bearer-ip-config.h \ - mm-bearer-ip-config.c \ mm-bearer.h \ mm-bearer.c @@ -64,5 +62,4 @@ include_HEADERS = \ mm-sim.h \ mm-sms.h \ mm-bearer-properties.h \ - mm-bearer-ip-config.h \ mm-bearer.h diff --git a/libmm-glib/mm-bearer-ip-config.c b/libmm-glib/mm-bearer-ip-config.c deleted file mode 100644 index b964e408..00000000 --- a/libmm-glib/mm-bearer-ip-config.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details: - * - * Copyright (C) 2012 Google, Inc. - */ - -#include "mm-bearer-ip-config.h" - -MMBearerIpMethod -mm_bearer_ip_config_get_method (MMBearerIpConfig *self) -{ - g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), MM_BEARER_IP_METHOD_UNKNOWN); - - return mm_common_bearer_ip_config_get_method (self); -} - -const gchar * -mm_bearer_ip_config_get_address (MMBearerIpConfig *self) -{ - g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); - - return mm_common_bearer_ip_config_get_address (self); -} - -guint -mm_bearer_ip_config_get_prefix (MMBearerIpConfig *self) -{ - g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), 0); - - return mm_common_bearer_ip_config_get_prefix (self); -} - -const gchar ** -mm_bearer_ip_config_get_dns (MMBearerIpConfig *self) -{ - g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); - - return mm_common_bearer_ip_config_get_dns (self); -} - -const gchar * -mm_bearer_ip_config_get_gateway (MMBearerIpConfig *self) -{ - g_return_val_if_fail (MM_IS_BEARER_IP_CONFIG (self), NULL); - - return mm_common_bearer_ip_config_get_gateway (self); -} diff --git a/libmm-glib/mm-bearer-ip-config.h b/libmm-glib/mm-bearer-ip-config.h deleted file mode 100644 index ff2882bc..00000000 --- a/libmm-glib/mm-bearer-ip-config.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program 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 General Public License for more details: - * - * Copyright (C) 2012 Google, Inc. - */ - -#ifndef MM_BEARER_IP_CONFIG_H -#define MM_BEARER_IP_CONFIG_H - -#include <ModemManager.h> -#include <glib-object.h> - -#include <libmm-common.h> - -G_BEGIN_DECLS - -typedef MMCommonBearerIpConfig MMBearerIpConfig; -#define MM_TYPE_BEARER_IP_CONFIG(o) MM_TYPE_COMMON_BEARER_IP_CONFIG (o) -#define MM_BEARER_IP_CONFIG(o) MM_COMMON_BEARER_IP_CONFIG(o) -#define MM_IS_BEARER_IP_CONFIG(o) MM_IS_COMMON_BEARER_IP_CONFIG(o) - -MMBearerIpMethod mm_bearer_ip_config_get_method (MMBearerIpConfig *self); -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); - -G_END_DECLS - -#endif /* MM_BEARER_IP_CONFIG_H */ diff --git a/libmm-glib/mm-bearer.c b/libmm-glib/mm-bearer.c index 6aae79da..e815aa50 100644 --- a/libmm-glib/mm-bearer.c +++ b/libmm-glib/mm-bearer.c @@ -155,7 +155,7 @@ mm_bearer_get_ipv4_config (MMBearer *self) g_return_val_if_fail (MM_IS_BEARER (self), NULL); variant = mm_gdbus_bearer_dup_ip4_config (MM_GDBUS_BEARER (self)); - config = mm_common_bearer_ip_config_new_from_dictionary (variant, &error); + config = mm_bearer_ip_config_new_from_dictionary (variant, &error); if (!config) { g_warning ("Couldn't create IP config: '%s'", error->message); g_error_free (error); @@ -175,7 +175,7 @@ mm_bearer_get_ipv6_config (MMBearer *self) g_return_val_if_fail (MM_IS_BEARER (self), NULL); variant = mm_gdbus_bearer_dup_ip6_config (MM_GDBUS_BEARER (self)); - config = mm_common_bearer_ip_config_new_from_dictionary (variant, &error); + config = mm_bearer_ip_config_new_from_dictionary (variant, &error); if (!config) { g_warning ("Couldn't create IP config: '%s'", error->message); g_error_free (error); diff --git a/libmm-glib/mm-bearer.h b/libmm-glib/mm-bearer.h index 19b50f16..cf54695d 100644 --- a/libmm-glib/mm-bearer.h +++ b/libmm-glib/mm-bearer.h @@ -27,7 +27,6 @@ #include <libmm-common.h> #include "mm-bearer-properties.h" -#include "mm-bearer-ip-config.h" G_BEGIN_DECLS diff --git a/plugins/iridium/mm-bearer-iridium.c b/plugins/iridium/mm-bearer-iridium.c index c38f05e2..43b19a23 100644 --- a/plugins/iridium/mm-bearer-iridium.c +++ b/plugins/iridium/mm-bearer-iridium.c @@ -38,8 +38,8 @@ G_DEFINE_TYPE (MMBearerIridium, mm_bearer_iridium, MM_TYPE_BEARER); typedef struct { MMPort *data; - MMCommonBearerIpConfig *ipv4_config; - MMCommonBearerIpConfig *ipv6_config; + MMBearerIpConfig *ipv4_config; + MMBearerIpConfig *ipv6_config; } ConnectResult; static void @@ -76,8 +76,8 @@ static gboolean connect_finish (MMBearer *self, GAsyncResult *res, MMPort **data, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error) { ConnectResult *result; @@ -137,7 +137,7 @@ dial_ready (MMBaseModem *modem, GAsyncResult *res, ConnectContext *ctx) { - MMCommonBearerIpConfig *config; + MMBearerIpConfig *config; ConnectResult *result; /* DO NOT check for cancellable here. If we got here without errors, the @@ -161,8 +161,8 @@ dial_ready (MMBaseModem *modem, mm_port_set_connected (MM_PORT (mm_base_modem_get_port_primary (modem)), TRUE); /* Build IP config; always PPP based */ - config = mm_common_bearer_ip_config_new (); - mm_common_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_PPP); + config = mm_bearer_ip_config_new (); + mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_PPP); /* Build result */ result = g_new0 (ConnectResult, 1); diff --git a/plugins/novatel/mm-broadband-bearer-novatel.c b/plugins/novatel/mm-broadband-bearer-novatel.c index e519029a..7abac790 100644 --- a/plugins/novatel/mm-broadband-bearer-novatel.c +++ b/plugins/novatel/mm-broadband-bearer-novatel.c @@ -90,10 +90,10 @@ detailed_connect_context_complete_and_free (DetailedConnectContext *ctx) static void detailed_connect_context_complete_and_free_successful (DetailedConnectContext *ctx) { - MMCommonBearerIpConfig *config; + MMBearerIpConfig *config; - config = mm_common_bearer_ip_config_new (); - mm_common_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP); + config = mm_bearer_ip_config_new (); + mm_bearer_ip_config_set_method (config, MM_BEARER_IP_METHOD_DHCP); g_simple_async_result_set_op_res_gpointer (ctx->result, config, (GDestroyNotify)g_object_unref); @@ -104,11 +104,11 @@ detailed_connect_context_complete_and_free_successful (DetailedConnectContext *c static gboolean connect_3gpp_finish (MMBroadbandBearer *self, GAsyncResult *res, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error) { - MMCommonBearerIpConfig *config; + MMBearerIpConfig *config; if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) return FALSE; @@ -150,7 +150,7 @@ connect_3gpp_qmistatus_ready (MMBaseModem *modem, mm_dbg("Error: '%s'", result); if (ctx->retries > 0) { ctx->retries--; - mm_dbg("Retrying status check in a second. %d retries left.", + mm_dbg("Retrying status check in a second. %d retries left.", ctx->retries); g_timeout_add_seconds(1, (GSourceFunc)connect_3gpp_qmistatus, ctx); return; diff --git a/src/mm-bearer.c b/src/mm-bearer.c index 68f45a62..358b0265 100644 --- a/src/mm-bearer.c +++ b/src/mm-bearer.c @@ -120,8 +120,8 @@ connect_ready (MMBearer *self, GError *error = NULL; gboolean launch_disconnect = FALSE; MMPort *data = NULL; - MMCommonBearerIpConfig *ipv4_config = NULL; - MMCommonBearerIpConfig *ipv6_config = NULL; + MMBearerIpConfig *ipv4_config = NULL; + MMBearerIpConfig *ipv6_config = NULL; /* NOTE: connect() implementations *MUST* handle cancellations themselves */ if (!MM_BEARER_GET_CLASS (self)->connect_finish (self, @@ -170,10 +170,10 @@ connect_ready (MMBearer *self, mm_gdbus_bearer_set_interface (MM_GDBUS_BEARER (self), mm_port_get_device (data)); mm_gdbus_bearer_set_ip4_config ( MM_GDBUS_BEARER (self), - mm_common_bearer_ip_config_get_dictionary (ipv4_config)); + mm_bearer_ip_config_get_dictionary (ipv4_config)); mm_gdbus_bearer_set_ip6_config ( MM_GDBUS_BEARER (self), - mm_common_bearer_ip_config_get_dictionary (ipv6_config)); + mm_bearer_ip_config_get_dictionary (ipv6_config)); g_clear_object (&data); g_clear_object (&ipv4_config); @@ -742,9 +742,9 @@ mm_bearer_init (MMBearer *self) mm_gdbus_bearer_set_properties (MM_GDBUS_BEARER (self), NULL); mm_gdbus_bearer_set_ip_timeout (MM_GDBUS_BEARER (self), MM_BEARER_IP_TIMEOUT_DEFAULT); mm_gdbus_bearer_set_ip4_config (MM_GDBUS_BEARER (self), - mm_common_bearer_ip_config_get_dictionary (NULL)); + mm_bearer_ip_config_get_dictionary (NULL)); mm_gdbus_bearer_set_ip6_config (MM_GDBUS_BEARER (self), - mm_common_bearer_ip_config_get_dictionary (NULL)); + mm_bearer_ip_config_get_dictionary (NULL)); } static void diff --git a/src/mm-bearer.h b/src/mm-bearer.h index 474a5552..161f3be4 100644 --- a/src/mm-bearer.h +++ b/src/mm-bearer.h @@ -64,8 +64,8 @@ struct _MMBearerClass { gboolean (* connect_finish) (MMBearer *bearer, GAsyncResult *res, MMPort **data, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error); /* Disconnect this bearer */ diff --git a/src/mm-broadband-bearer.c b/src/mm-broadband-bearer.c index a63b08ff..de919226 100644 --- a/src/mm-broadband-bearer.c +++ b/src/mm-broadband-bearer.c @@ -150,11 +150,11 @@ typedef struct { static gboolean detailed_connect_finish (MMBroadbandBearer *self, GAsyncResult *res, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error) { - MMCommonBearerIpConfig *config; + MMBearerIpConfig *config; if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error)) return FALSE; @@ -183,14 +183,14 @@ detailed_connect_context_complete_and_free (DetailedConnectContext *ctx) static void detailed_connect_context_complete_and_free_successful (DetailedConnectContext *ctx) { - MMCommonBearerIpConfig *config; + MMBearerIpConfig *config; /* If serial port, set PPP method. Otherwise, assume DHCP is needed. */ - config = mm_common_bearer_ip_config_new (); - mm_common_bearer_ip_config_set_method (config, - (MM_IS_AT_SERIAL_PORT (ctx->data) ? - MM_BEARER_IP_METHOD_PPP : - MM_BEARER_IP_METHOD_DHCP)); + config = mm_bearer_ip_config_new (); + mm_bearer_ip_config_set_method (config, + (MM_IS_AT_SERIAL_PORT (ctx->data) ? + MM_BEARER_IP_METHOD_PPP : + MM_BEARER_IP_METHOD_DHCP)); g_simple_async_result_set_op_res_gpointer (ctx->result, config, (GDestroyNotify)g_object_unref); @@ -924,8 +924,8 @@ connect_3gpp (MMBroadbandBearer *self, typedef struct { MMPort *data; - MMCommonBearerIpConfig *ipv4_config; - MMCommonBearerIpConfig *ipv6_config; + MMBearerIpConfig *ipv4_config; + MMBearerIpConfig *ipv6_config; } ConnectResult; static void @@ -959,8 +959,8 @@ static gboolean connect_finish (MMBearer *self, GAsyncResult *res, MMPort **data, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error) { ConnectResult *result; @@ -979,8 +979,8 @@ connect_finish (MMBearer *self, static void connect_succeeded (ConnectContext *ctx, ConnectionType connection_type, - MMCommonBearerIpConfig *ipv4_config, - MMCommonBearerIpConfig *ipv6_config) + MMBearerIpConfig *ipv4_config, + MMBearerIpConfig *ipv6_config) { ConnectResult *result; @@ -1023,8 +1023,8 @@ connect_cdma_ready (MMBroadbandBearer *self, ConnectContext *ctx) { GError *error = NULL; - MMCommonBearerIpConfig *ipv4_config = NULL; - MMCommonBearerIpConfig *ipv6_config = NULL; + MMBearerIpConfig *ipv4_config = NULL; + MMBearerIpConfig *ipv6_config = NULL; if (!MM_BROADBAND_BEARER_GET_CLASS (self)->connect_cdma_finish (self, res, @@ -1042,8 +1042,8 @@ connect_3gpp_ready (MMBroadbandBearer *self, ConnectContext *ctx) { GError *error = NULL; - MMCommonBearerIpConfig *ipv4_config = NULL; - MMCommonBearerIpConfig *ipv6_config = NULL; + MMBearerIpConfig *ipv4_config = NULL; + MMBearerIpConfig *ipv6_config = NULL; if (!MM_BROADBAND_BEARER_GET_CLASS (self)->connect_3gpp_finish (self, res, diff --git a/src/mm-broadband-bearer.h b/src/mm-broadband-bearer.h index 9aa17256..0a2398b5 100644 --- a/src/mm-broadband-bearer.h +++ b/src/mm-broadband-bearer.h @@ -62,8 +62,8 @@ struct _MMBroadbandBearerClass { gpointer user_data); gboolean (* connect_3gpp_finish) (MMBroadbandBearer *self, GAsyncResult *res, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error); /* Dialing sub-part of 3GPP connection */ @@ -101,8 +101,8 @@ struct _MMBroadbandBearerClass { gpointer user_data); gboolean (* connect_cdma_finish) (MMBroadbandBearer *self, GAsyncResult *res, - MMCommonBearerIpConfig **ipv4_config, - MMCommonBearerIpConfig **ipv6_config, + MMBearerIpConfig **ipv4_config, + MMBearerIpConfig **ipv6_config, GError **error); /* Full CDMA disconnection sequence */ |