2007-12-10 Tambet Ingo <tambet@gmail.com>

* Replace all occurences of 'UMTS' with 'GSM'.




git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3161 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Tambet Ingo
2007-12-10 09:17:40 +00:00
parent 62546344d8
commit 0bd26c1abe
18 changed files with 329 additions and 325 deletions

View File

@@ -1,3 +1,7 @@
2007-12-10 Tambet Ingo <tambet@gmail.com>
* Replace all occurences of 'UMTS' with 'GSM'.
2007-12-07 Dan Williams <dcbw@redhat.com>
* src/nm-serial-device.c

View File

@@ -34,7 +34,7 @@
#define NM_DBUS_INTERFACE_DEVICE_WIRELESS "org.freedesktop.NetworkManager.Device.Wireless"
#define NM_DBUS_PATH_ACCESS_POINT "/org/freedesktop/NetworkManager/AccessPoint"
#define NM_DBUS_INTERFACE_ACCESS_POINT "org.freedesktop.NetworkManager.AccessPoint"
#define NM_DBUS_INTERFACE_UMTS_DEVICE "org.freedesktop.NetworkManager.Device.Umts"
#define NM_DBUS_INTERFACE_GSM_DEVICE "org.freedesktop.NetworkManager.Device.Gsm"
#define NM_DBUS_SERVICE_USER_SETTINGS "org.freedesktop.NetworkManagerUserSettings"
#define NM_DBUS_SERVICE_SYSTEM_SETTINGS "org.freedesktop.NetworkManagerSystemSettings"
@@ -69,7 +69,7 @@ typedef enum NMDeviceType
DEVICE_TYPE_UNKNOWN = 0,
DEVICE_TYPE_802_3_ETHERNET,
DEVICE_TYPE_802_11_WIRELESS,
DEVICE_TYPE_UMTS
DEVICE_TYPE_GSM
} NMDeviceType;

View File

@@ -35,7 +35,7 @@ libnminclude_HEADERS = \
nm-access-point.h \
nm-ip4-config.h \
nm-settings.h \
nm-umts-device.h \
nm-gsm-device.h \
nm-vpn-connection.h \
nm-vpn-manager.h \
nm-vpn-plugin.h
@@ -53,7 +53,7 @@ libnm_glib_la_SOURCES = \
nm-access-point.c \
nm-ip4-config.c \
nm-settings.c \
nm-umts-device.c \
nm-gsm-device.c \
nm-vpn-connection.c \
nm-vpn-manager.c \
nm-marshal-main.c

View File

@@ -5,7 +5,7 @@
#include "nm-client.h"
#include "nm-device-802-3-ethernet.h"
#include "nm-device-802-11-wireless.h"
#include "nm-umts-device.h"
#include "nm-gsm-device.h"
#include "nm-device-private.h"
#include "nm-marshal.h"
#include <nm-utils.h>
@@ -389,8 +389,8 @@ get_device (NMClient *client, const char *path, gboolean create_if_not_found)
case DEVICE_TYPE_802_11_WIRELESS:
device = NM_DEVICE (nm_device_802_11_wireless_new (connection, path));
break;
case DEVICE_TYPE_UMTS:
device = NM_DEVICE (nm_umts_device_new (connection, path));
case DEVICE_TYPE_GSM:
device = NM_DEVICE (nm_gsm_device_new (connection, path));
break;
default:
device = nm_device_new (connection, path);

View File

@@ -0,0 +1,82 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#include "nm-gsm-device.h"
G_DEFINE_TYPE (NMGsmDevice, nm_gsm_device, NM_TYPE_DEVICE)
#define NM_GSM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_GSM_DEVICE, NMGsmDevicePrivate))
typedef struct {
DBusGProxy *gsm_proxy;
gboolean disposed;
} NMGsmDevicePrivate;
static void
nm_gsm_device_init (NMGsmDevice *device)
{
}
static GObject*
constructor (GType type,
guint n_construct_params,
GObjectConstructParam *construct_params)
{
GObject *object;
NMGsmDevicePrivate *priv;
object = G_OBJECT_CLASS (nm_gsm_device_parent_class)->constructor (type,
n_construct_params,
construct_params);
if (!object)
return NULL;
priv = NM_GSM_DEVICE_GET_PRIVATE (object);
priv->gsm_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
NM_DBUS_SERVICE,
nm_object_get_path (NM_OBJECT (object)),
NM_DBUS_INTERFACE_GSM_DEVICE);
return object;
}
static void
dispose (GObject *object)
{
NMGsmDevicePrivate *priv = NM_GSM_DEVICE_GET_PRIVATE (object);
if (priv->disposed) {
G_OBJECT_CLASS (nm_gsm_device_parent_class)->dispose (object);
return;
}
priv->disposed = TRUE;
g_object_unref (priv->gsm_proxy);
G_OBJECT_CLASS (nm_gsm_device_parent_class)->dispose (object);
}
static void
nm_gsm_device_class_init (NMGsmDeviceClass *device_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (device_class);
g_type_class_add_private (device_class, sizeof (NMGsmDevicePrivate));
/* virtual methods */
object_class->constructor = constructor;
object_class->dispose = dispose;
}
NMGsmDevice *
nm_gsm_device_new (DBusGConnection *connection, const char *path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (path != NULL, NULL);
return (NMGsmDevice *) g_object_new (NM_TYPE_GSM_DEVICE,
NM_OBJECT_CONNECTION, connection,
NM_OBJECT_PATH, path,
NULL);
}

View File

@@ -0,0 +1,32 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_GSM_DEVICE_H
#define NM_GSM_DEVICE_H
#include "nm-device.h"
G_BEGIN_DECLS
#define NM_TYPE_GSM_DEVICE (nm_gsm_device_get_type ())
#define NM_GSM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_GSM_DEVICE, NMGsmDevice))
#define NM_GSM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_GSM_DEVICE, NMGsmDeviceClass))
#define NM_IS_GSM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_GSM_DEVICE))
#define NM_IS_GSM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_GSM_DEVICE))
#define NM_GSM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_GSM_DEVICE, NMGsmDeviceClass))
typedef struct {
NMDevice parent;
} NMGsmDevice;
typedef struct {
NMDeviceClass parent;
} NMGsmDeviceClass;
GType nm_gsm_device_get_type (void);
NMGsmDevice *nm_gsm_device_new (DBusGConnection *connection,
const char *path);
G_END_DECLS
#endif /* NM_GSM_DEVICE_H */

View File

@@ -1,82 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#include "nm-umts-device.h"
G_DEFINE_TYPE (NMUmtsDevice, nm_umts_device, NM_TYPE_DEVICE)
#define NM_UMTS_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_UMTS_DEVICE, NMUmtsDevicePrivate))
typedef struct {
DBusGProxy *umts_proxy;
gboolean disposed;
} NMUmtsDevicePrivate;
static void
nm_umts_device_init (NMUmtsDevice *device)
{
}
static GObject*
constructor (GType type,
guint n_construct_params,
GObjectConstructParam *construct_params)
{
GObject *object;
NMUmtsDevicePrivate *priv;
object = G_OBJECT_CLASS (nm_umts_device_parent_class)->constructor (type,
n_construct_params,
construct_params);
if (!object)
return NULL;
priv = NM_UMTS_DEVICE_GET_PRIVATE (object);
priv->umts_proxy = dbus_g_proxy_new_for_name (nm_object_get_connection (NM_OBJECT (object)),
NM_DBUS_SERVICE,
nm_object_get_path (NM_OBJECT (object)),
NM_DBUS_INTERFACE_UMTS_DEVICE);
return object;
}
static void
dispose (GObject *object)
{
NMUmtsDevicePrivate *priv = NM_UMTS_DEVICE_GET_PRIVATE (object);
if (priv->disposed) {
G_OBJECT_CLASS (nm_umts_device_parent_class)->dispose (object);
return;
}
priv->disposed = TRUE;
g_object_unref (priv->umts_proxy);
G_OBJECT_CLASS (nm_umts_device_parent_class)->dispose (object);
}
static void
nm_umts_device_class_init (NMUmtsDeviceClass *device_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (device_class);
g_type_class_add_private (device_class, sizeof (NMUmtsDevicePrivate));
/* virtual methods */
object_class->constructor = constructor;
object_class->dispose = dispose;
}
NMUmtsDevice *
nm_umts_device_new (DBusGConnection *connection, const char *path)
{
g_return_val_if_fail (connection != NULL, NULL);
g_return_val_if_fail (path != NULL, NULL);
return (NMUmtsDevice *) g_object_new (NM_TYPE_UMTS_DEVICE,
NM_OBJECT_CONNECTION, connection,
NM_OBJECT_PATH, path,
NULL);
}

View File

@@ -1,32 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_UMTS_DEVICE_H
#define NM_UMTS_DEVICE_H
#include "nm-device.h"
G_BEGIN_DECLS
#define NM_TYPE_UMTS_DEVICE (nm_umts_device_get_type ())
#define NM_UMTS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_UMTS_DEVICE, NMUmtsDevice))
#define NM_UMTS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_UMTS_DEVICE, NMUmtsDeviceClass))
#define NM_IS_UMTS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_UMTS_DEVICE))
#define NM_IS_UMTS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_UMTS_DEVICE))
#define NM_UMTS_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_UMTS_DEVICE, NMUmtsDeviceClass))
typedef struct {
NMDevice parent;
} NMUmtsDevice;
typedef struct {
NMDeviceClass parent;
} NMUmtsDeviceClass;
GType nm_umts_device_get_type (void);
NMUmtsDevice *nm_umts_device_new (DBusGConnection *connection,
const char *path);
G_END_DECLS
#endif /* NM_UMTS_DEVICE_H */

View File

@@ -19,7 +19,7 @@ libnm_util_include_HEADERS = \
nm-setting-ip4-config.h \
nm-setting-ppp.h \
nm-setting-serial.h \
nm-setting-umts.h \
nm-setting-gsm.h \
nm-setting-wired.h \
nm-setting-wireless.h \
nm-setting-wireless-security.h \
@@ -35,7 +35,7 @@ libnm_util_la_SOURCES= \
nm-setting-ip4-config.c \
nm-setting-ppp.c \
nm-setting-serial.c \
nm-setting-umts.c \
nm-setting-gsm.c \
nm-setting-wired.c \
nm-setting-wireless.c \
nm-setting-wireless-security.c \

View File

@@ -16,7 +16,7 @@
#include "nm-setting-vpn-properties.h"
#include "nm-setting-serial.h"
#include "nm-setting-umts.h"
#include "nm-setting-gsm.h"
typedef struct {
GHashTable *settings;
@@ -50,7 +50,7 @@ register_default_settings (void)
{ NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_TYPE_SETTING_IP4_CONFIG },
{ NM_SETTING_WIRELESS_SECURITY_SETTING_NAME, NM_TYPE_SETTING_WIRELESS_SECURITY },
{ NM_SETTING_SERIAL_SETTING_NAME, NM_TYPE_SETTING_SERIAL },
{ NM_SETTING_UMTS_SETTING_NAME, NM_TYPE_SETTING_UMTS },
{ NM_SETTING_GSM_SETTING_NAME, NM_TYPE_SETTING_GSM },
{ NM_SETTING_PPP_SETTING_NAME, NM_TYPE_SETTING_PPP },
{ NM_SETTING_VPN_SETTING_NAME, NM_TYPE_SETTING_VPN },
{ NM_SETTING_VPN_PROPERTIES_SETTING_NAME, NM_TYPE_SETTING_VPN_PROPERTIES },

View File

@@ -1,10 +1,10 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#include <string.h>
#include "nm-setting-umts.h"
#include "nm-setting-gsm.h"
#include "nm-utils.h"
G_DEFINE_TYPE (NMSettingUmts, nm_setting_umts, NM_TYPE_SETTING)
G_DEFINE_TYPE (NMSettingGsm, nm_setting_gsm, NM_TYPE_SETTING)
enum {
PROP_0,
@@ -22,15 +22,15 @@ enum {
};
NMSetting *
nm_setting_umts_new (void)
nm_setting_gsm_new (void)
{
return (NMSetting *) g_object_new (NM_TYPE_SETTING_UMTS, NULL);
return (NMSetting *) g_object_new (NM_TYPE_SETTING_GSM, NULL);
}
static gboolean
verify (NMSetting *setting, GSList *all_settings)
{
NMSettingUmts *self = NM_SETTING_UMTS (setting);
NMSettingGsm *self = NM_SETTING_GSM (setting);
if (!self->number || strlen (self->number) < 1) {
nm_warning ("Missing phone number");
@@ -41,15 +41,15 @@ verify (NMSetting *setting, GSList *all_settings)
}
static void
nm_setting_umts_init (NMSettingUmts *setting)
nm_setting_gsm_init (NMSettingGsm *setting)
{
((NMSetting *) setting)->name = g_strdup (NM_SETTING_UMTS_SETTING_NAME);
((NMSetting *) setting)->name = g_strdup (NM_SETTING_GSM_SETTING_NAME);
}
static void
finalize (GObject *object)
{
NMSettingUmts *self = NM_SETTING_UMTS (object);
NMSettingGsm *self = NM_SETTING_GSM (object);
g_free (self->number);
g_free (self->username);
@@ -59,14 +59,14 @@ finalize (GObject *object)
g_free (self->pin);
g_free (self->puk);
G_OBJECT_CLASS (nm_setting_umts_parent_class)->finalize (object);
G_OBJECT_CLASS (nm_setting_gsm_parent_class)->finalize (object);
}
static void
set_property (GObject *object, guint prop_id,
const GValue *value, GParamSpec *pspec)
{
NMSettingUmts *setting = NM_SETTING_UMTS (object);
NMSettingGsm *setting = NM_SETTING_GSM (object);
switch (prop_id) {
case PROP_NUMBER:
@@ -113,7 +113,7 @@ static void
get_property (GObject *object, guint prop_id,
GValue *value, GParamSpec *pspec)
{
NMSettingUmts *setting = NM_SETTING_UMTS (object);
NMSettingGsm *setting = NM_SETTING_GSM (object);
switch (prop_id) {
case PROP_NUMBER:
@@ -150,7 +150,7 @@ get_property (GObject *object, guint prop_id,
}
static void
nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
nm_setting_gsm_class_init (NMSettingGsmClass *setting_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (setting_class);
NMSettingClass *parent_class = NM_SETTING_CLASS (setting_class);
@@ -164,7 +164,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
/* Properties */
g_object_class_install_property
(object_class, PROP_NUMBER,
g_param_spec_string (NM_SETTING_UMTS_NUMBER,
g_param_spec_string (NM_SETTING_GSM_NUMBER,
"Number",
"Number",
NULL,
@@ -172,7 +172,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_USERNAME,
g_param_spec_string (NM_SETTING_UMTS_USERNAME,
g_param_spec_string (NM_SETTING_GSM_USERNAME,
"Username",
"Username",
NULL,
@@ -180,7 +180,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_PASSWORD,
g_param_spec_string (NM_SETTING_UMTS_PASSWORD,
g_param_spec_string (NM_SETTING_GSM_PASSWORD,
"Password",
"Password",
NULL,
@@ -188,7 +188,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_APN,
g_param_spec_string (NM_SETTING_UMTS_APN,
g_param_spec_string (NM_SETTING_GSM_APN,
"APN",
"APN",
NULL,
@@ -196,7 +196,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_NETWORK_ID,
g_param_spec_string (NM_SETTING_UMTS_NETWORK_ID,
g_param_spec_string (NM_SETTING_GSM_NETWORK_ID,
"Network ID",
"Network ID",
NULL,
@@ -204,17 +204,17 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_NETWORK_TYPE,
g_param_spec_int (NM_SETTING_UMTS_NETWORK_TYPE,
g_param_spec_int (NM_SETTING_GSM_NETWORK_TYPE,
"Network type",
"Network type",
NM_UMTS_NETWORK_ANY,
NM_UMTS_NETWORK_PREFER_UMTS,
NM_UMTS_NETWORK_ANY,
NM_GSM_NETWORK_ANY,
NM_GSM_NETWORK_PREFER_GSM,
NM_GSM_NETWORK_ANY,
G_PARAM_READWRITE | NM_SETTING_PARAM_SERIALIZE));
g_object_class_install_property
(object_class, PROP_BAND,
g_param_spec_int (NM_SETTING_UMTS_BAND,
g_param_spec_int (NM_SETTING_GSM_BAND,
"Band",
"Band",
-1, 5, -1, /* FIXME: Use an enum for it */
@@ -222,7 +222,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_PIN,
g_param_spec_string (NM_SETTING_UMTS_PIN,
g_param_spec_string (NM_SETTING_GSM_PIN,
"PIN",
"PIN",
NULL,
@@ -230,7 +230,7 @@ nm_setting_umts_class_init (NMSettingUmtsClass *setting_class)
g_object_class_install_property
(object_class, PROP_PUK,
g_param_spec_string (NM_SETTING_UMTS_PUK,
g_param_spec_string (NM_SETTING_GSM_PUK,
"PUK",
"PUK",
NULL,

View File

@@ -0,0 +1,63 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_SETTING_GSM_H
#define NM_SETTING_GSM_H
#include <nm-setting.h>
G_BEGIN_DECLS
#define NM_TYPE_SETTING_GSM (nm_setting_gsm_get_type ())
#define NM_SETTING_GSM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_GSM, NMSettingGsm))
#define NM_SETTING_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_GSM, NMSettingGsmClass))
#define NM_IS_SETTING_GSM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_GSM))
#define NM_IS_SETTING_GSM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SETTING_GSM))
#define NM_SETTING_GSM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_GSM, NMSettingGsmClass))
#define NM_SETTING_GSM_SETTING_NAME "gsm"
#define NM_SETTING_GSM_NUMBER "number"
#define NM_SETTING_GSM_USERNAME "username"
#define NM_SETTING_GSM_PASSWORD "password"
#define NM_SETTING_GSM_APN "apn"
#define NM_SETTING_GSM_NETWORK_ID "network-id"
#define NM_SETTING_GSM_NETWORK_TYPE "network-type"
#define NM_SETTING_GSM_BAND "band"
#define NM_SETTING_GSM_PIN "pin"
#define NM_SETTING_GSM_PUK "puk"
enum {
NM_GSM_NETWORK_ANY = -1,
NM_GSM_NETWORK_GPRS = 0,
NM_GSM_NETWORK_GSM = 1,
NM_GSM_NETWORK_PREFER_GPRS = 2,
NM_GSM_NETWORK_PREFER_GSM = 3,
};
typedef struct {
NMSetting parent;
char *number; /* For dialing, duh */
char *username;
char *password;
char *apn; /* NULL for dynamic */
char *network_id; /* for manual registration or NULL for automatic */
int network_type; /* One of the NM_GSM_NETWORK_* */
int band;
char *pin;
char *puk;
} NMSettingGsm;
typedef struct {
NMSettingClass parent;
} NMSettingGsmClass;
GType nm_setting_gsm_get_type (void);
NMSetting *nm_setting_gsm_new (void);
G_END_DECLS
#endif /* NM_SETTING_GSM_H */

View File

@@ -1,63 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_SETTING_UMTS_H
#define NM_SETTING_UMTS_H
#include <nm-setting.h>
G_BEGIN_DECLS
#define NM_TYPE_SETTING_UMTS (nm_setting_umts_get_type ())
#define NM_SETTING_UMTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_UMTS, NMSettingUmts))
#define NM_SETTING_UMTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_UMTS, NMSettingUmtsClass))
#define NM_IS_SETTING_UMTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_UMTS))
#define NM_IS_SETTING_UMTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NM_TYPE_SETTING_UMTS))
#define NM_SETTING_UMTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_UMTS, NMSettingUmtsClass))
#define NM_SETTING_UMTS_SETTING_NAME "umts"
#define NM_SETTING_UMTS_NUMBER "number"
#define NM_SETTING_UMTS_USERNAME "username"
#define NM_SETTING_UMTS_PASSWORD "password"
#define NM_SETTING_UMTS_APN "apn"
#define NM_SETTING_UMTS_NETWORK_ID "network-id"
#define NM_SETTING_UMTS_NETWORK_TYPE "network-type"
#define NM_SETTING_UMTS_BAND "band"
#define NM_SETTING_UMTS_PIN "pin"
#define NM_SETTING_UMTS_PUK "puk"
enum {
NM_UMTS_NETWORK_ANY = -1,
NM_UMTS_NETWORK_GPRS = 0,
NM_UMTS_NETWORK_UMTS = 1,
NM_UMTS_NETWORK_PREFER_GPRS = 2,
NM_UMTS_NETWORK_PREFER_UMTS = 3,
};
typedef struct {
NMSetting parent;
char *number; /* For dialing, duh */
char *username;
char *password;
char *apn; /* NULL for dynamic */
char *network_id; /* for manual registration or NULL for automatic */
int network_type; /* One of the NM_UMTS_NETWORK_* */
int band;
char *pin;
char *puk;
} NMSettingUmts;
typedef struct {
NMSettingClass parent;
} NMSettingUmtsClass;
GType nm_setting_umts_get_type (void);
NMSetting *nm_setting_umts_new (void);
G_END_DECLS
#endif /* NM_SETTING_UMTS_H */

View File

@@ -58,8 +58,8 @@ NetworkManager_SOURCES = \
nm-properties-changed-signal.h \
nm-serial-device.c \
nm-serial-device.h \
nm-umts-device.c \
nm-umts-device.h \
nm-gsm-device.c \
nm-gsm-device.h \
autoip.c \
autoip.h \
kernel-types.h \

View File

@@ -1,33 +1,33 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#include <string.h>
#include "nm-umts-device.h"
#include "nm-gsm-device.h"
#include "nm-device-interface.h"
#include "nm-device-private.h"
#include "nm-setting-umts.h"
#include "nm-setting-gsm.h"
#include "nm-utils.h"
G_DEFINE_TYPE (NMUmtsDevice, nm_umts_device, NM_TYPE_SERIAL_DEVICE)
G_DEFINE_TYPE (NMGsmDevice, nm_gsm_device, NM_TYPE_SERIAL_DEVICE)
typedef enum {
NM_UMTS_SECRET_NONE = 0,
NM_UMTS_SECRET_PIN,
NM_UMTS_SECRET_PUK
} NMUmtsSecret;
NM_GSM_SECRET_NONE = 0,
NM_GSM_SECRET_PIN,
NM_GSM_SECRET_PUK
} NMGsmSecret;
#define NM_UMTS_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_UMTS_DEVICE, NMUmtsDevicePrivate))
#define NM_GSM_DEVICE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_GSM_DEVICE, NMGsmDevicePrivate))
typedef struct {
NMUmtsSecret need_secret;
NMGsmSecret need_secret;
guint pending_id;
} NMUmtsDevicePrivate;
} NMGsmDevicePrivate;
static void enter_pin (NMSerialDevice *device, gboolean retry);
static void automatic_registration (NMSerialDevice *device);
NMUmtsDevice *
nm_umts_device_new (const char *udi,
NMGsmDevice *
nm_gsm_device_new (const char *udi,
const char *iface,
const char *driver)
{
@@ -35,7 +35,7 @@ nm_umts_device_new (const char *udi,
g_return_val_if_fail (iface != NULL, NULL);
g_return_val_if_fail (driver != NULL, NULL);
return (NMUmtsDevice *) g_object_new (NM_TYPE_UMTS_DEVICE,
return (NMGsmDevice *) g_object_new (NM_TYPE_GSM_DEVICE,
NM_DEVICE_INTERFACE_UDI, udi,
NM_DEVICE_INTERFACE_IFACE, iface,
NM_DEVICE_INTERFACE_DRIVER, driver,
@@ -43,13 +43,13 @@ nm_umts_device_new (const char *udi,
}
static inline void
umts_device_set_pending (NMUmtsDevice *device, guint pending_id)
gsm_device_set_pending (NMGsmDevice *device, guint pending_id)
{
NM_UMTS_DEVICE_GET_PRIVATE (device)->pending_id = pending_id;
NM_GSM_DEVICE_GET_PRIVATE (device)->pending_id = pending_id;
}
static NMSetting *
umts_device_get_setting (NMUmtsDevice *device, GType setting_type)
gsm_device_get_setting (NMGsmDevice *device, GType setting_type)
{
NMActRequest *req;
NMSetting *setting = NULL;
@@ -73,7 +73,7 @@ dial_done (NMSerialDevice *device,
{
gboolean success = FALSE;
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
switch (reply_index) {
case 0:
@@ -106,12 +106,12 @@ dial_done (NMSerialDevice *device,
static void
do_dial (NMSerialDevice *device)
{
NMSettingUmts *setting;
NMSettingGsm *setting;
char *command;
guint id;
char *responses[] = { "CONNECT", "BUSY", "NO DIAL TONE", "NO CARRIER", NULL };
setting = NM_SETTING_UMTS (umts_device_get_setting (NM_UMTS_DEVICE (device), NM_TYPE_SETTING_UMTS));
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
command = g_strconcat ("ATDT", setting->number, NULL);
nm_serial_device_send_command_string (device, command);
@@ -119,7 +119,7 @@ do_dial (NMSerialDevice *device)
id = nm_serial_device_wait_for_reply (device, 60, responses, dial_done, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
}
@@ -129,7 +129,7 @@ manual_registration_done (NMSerialDevice *device,
int reply_index,
gpointer user_data)
{
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
switch (reply_index) {
case 0:
@@ -149,12 +149,12 @@ manual_registration_done (NMSerialDevice *device,
static void
manual_registration (NMSerialDevice *device)
{
NMSettingUmts *setting;
NMSettingGsm *setting;
char *command;
guint id;
char *responses[] = { "OK", "ERROR", "ERR", NULL };
setting = NM_SETTING_UMTS (umts_device_get_setting (NM_UMTS_DEVICE (device), NM_TYPE_SETTING_UMTS));
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
command = g_strdup_printf ("AT+COPS=1,2,\"%s\"", setting->network_id);
nm_serial_device_send_command_string (device, command);
@@ -162,7 +162,7 @@ manual_registration (NMSerialDevice *device)
id = nm_serial_device_wait_for_reply (device, 30, responses, manual_registration_done, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
}
@@ -172,7 +172,7 @@ get_network_done (NMSerialDevice *device,
const char *response,
gpointer user_data)
{
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
if (response)
nm_info ("Associated with network: %s", response);
@@ -191,7 +191,7 @@ automatic_registration_get_network (NMSerialDevice *device)
nm_serial_device_send_command_string (device, "AT+COPS?");
id = nm_serial_device_get_reply (device, 10, terminators, get_network_done, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
}
@@ -208,7 +208,7 @@ automatic_registration_response (NMSerialDevice *device,
int reply_index,
gpointer user_data)
{
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
switch (reply_index) {
case 0:
@@ -220,7 +220,7 @@ automatic_registration_response (NMSerialDevice *device,
automatic_registration_get_network (device);
break;
case 2:
umts_device_set_pending (NM_UMTS_DEVICE (device),
gsm_device_set_pending (NM_GSM_DEVICE (device),
g_timeout_add (1000, automatic_registration_again, device));
break;
case -1:
@@ -243,7 +243,7 @@ automatic_registration (NMSerialDevice *device)
nm_serial_device_send_command_string (device, "AT+CREG?");
id = nm_serial_device_wait_for_reply (device, 60, responses, automatic_registration_response, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
}
@@ -251,9 +251,9 @@ automatic_registration (NMSerialDevice *device)
static void
do_register (NMSerialDevice *device)
{
NMSettingUmts *setting;
NMSettingGsm *setting;
setting = NM_SETTING_UMTS (umts_device_get_setting (NM_UMTS_DEVICE (device), NM_TYPE_SETTING_UMTS));
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
if (setting->network_id)
manual_registration (device);
@@ -266,9 +266,9 @@ enter_pin_done (NMSerialDevice *device,
int reply_index,
gpointer user_data)
{
NMSettingUmts *setting;
NMSettingGsm *setting;
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
switch (reply_index) {
case 0:
@@ -280,17 +280,17 @@ enter_pin_done (NMSerialDevice *device,
break;
default:
nm_warning ("Invalid secret");
setting = NM_SETTING_UMTS (umts_device_get_setting (NM_UMTS_DEVICE (device), NM_TYPE_SETTING_UMTS));
setting = NM_SETTING_GSM (gsm_device_get_setting (NM_GSM_DEVICE (device), NM_TYPE_SETTING_GSM));
/* Make sure we don't use the invalid PIN/PUK again
as it may lock up the SIM card */
switch (NM_UMTS_DEVICE_GET_PRIVATE (device)->need_secret) {
case NM_UMTS_SECRET_PIN:
switch (NM_GSM_DEVICE_GET_PRIVATE (device)->need_secret) {
case NM_GSM_SECRET_PIN:
g_free (setting->pin);
setting->pin = NULL;
break;
case NM_UMTS_SECRET_PUK:
case NM_GSM_SECRET_PUK:
g_free (setting->puk);
setting->puk = NULL;
break;
@@ -306,7 +306,7 @@ enter_pin_done (NMSerialDevice *device,
static void
enter_pin (NMSerialDevice *device, gboolean retry)
{
NMSettingUmts *setting;
NMSettingGsm *setting;
NMActRequest *req;
NMConnection *connection;
char *secret;
@@ -317,16 +317,16 @@ enter_pin (NMSerialDevice *device, gboolean retry)
connection = nm_act_request_get_connection (req);
g_assert (connection);
setting = NM_SETTING_UMTS (nm_connection_get_setting (connection, NM_TYPE_SETTING_UMTS));
setting = NM_SETTING_GSM (nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM));
switch (NM_UMTS_DEVICE_GET_PRIVATE (device)->need_secret) {
case NM_UMTS_SECRET_PIN:
switch (NM_GSM_DEVICE_GET_PRIVATE (device)->need_secret) {
case NM_GSM_SECRET_PIN:
secret = setting->pin;
secret_setting_name = NM_SETTING_UMTS_PIN;
secret_setting_name = NM_SETTING_GSM_PIN;
break;
case NM_UMTS_SECRET_PUK:
case NM_GSM_SECRET_PUK:
secret = setting->puk;
secret_setting_name = NM_SETTING_UMTS_PIN;
secret_setting_name = NM_SETTING_GSM_PIN;
break;
default:
do_register (device);
@@ -344,7 +344,7 @@ enter_pin (NMSerialDevice *device, gboolean retry)
id = nm_serial_device_wait_for_reply (device, 3, responses, enter_pin_done, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
} else {
@@ -359,18 +359,18 @@ check_pin_done (NMSerialDevice *device,
int reply_index,
gpointer user_data)
{
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
switch (reply_index) {
case 0:
do_register (device);
break;
case 1:
NM_UMTS_DEVICE_GET_PRIVATE (device)->need_secret = NM_UMTS_SECRET_PIN;
NM_GSM_DEVICE_GET_PRIVATE (device)->need_secret = NM_GSM_SECRET_PIN;
enter_pin (device, FALSE);
break;
case 2:
NM_UMTS_DEVICE_GET_PRIVATE (device)->need_secret = NM_UMTS_SECRET_PUK;
NM_GSM_DEVICE_GET_PRIVATE (device)->need_secret = NM_GSM_SECRET_PUK;
enter_pin (device, FALSE);
break;
case -1:
@@ -394,7 +394,7 @@ check_pin (NMSerialDevice *device)
id = nm_serial_device_wait_for_reply (device, 3, responses, check_pin_done, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
}
@@ -404,7 +404,7 @@ init_done (NMSerialDevice *device,
int reply_index,
gpointer user_data)
{
umts_device_set_pending (NM_UMTS_DEVICE (device), 0);
gsm_device_set_pending (NM_GSM_DEVICE (device), 0);
switch (reply_index) {
case 0:
@@ -431,7 +431,7 @@ init_modem (NMSerialDevice *device, gpointer user_data)
id = nm_serial_device_wait_for_reply (device, 10, responses, init_done, NULL);
if (id)
umts_device_set_pending (NM_UMTS_DEVICE (device), id);
gsm_device_set_pending (NM_GSM_DEVICE (device), id);
else
nm_device_state_changed (NM_DEVICE (device), NM_DEVICE_STATE_FAILED);
}
@@ -439,10 +439,10 @@ init_modem (NMSerialDevice *device, gpointer user_data)
static NMActStageReturn
real_act_stage1_prepare (NMDevice *device)
{
NMUmtsDevicePrivate *priv = NM_UMTS_DEVICE_GET_PRIVATE (device);
NMGsmDevicePrivate *priv = NM_GSM_DEVICE_GET_PRIVATE (device);
NMSerialDevice *serial_device = NM_SERIAL_DEVICE (device);
priv->need_secret = NM_UMTS_SECRET_NONE;
priv->need_secret = NM_GSM_SECRET_NONE;
if (!nm_serial_device_open (serial_device))
return NM_ACT_STAGE_RETURN_FAILURE;
@@ -461,20 +461,20 @@ real_get_generic_capabilities (NMDevice *dev)
static gboolean
real_check_connection (NMDevice *dev, NMConnection *connection)
{
NMSettingUmts *umts;
NMSettingGsm *gsm;
umts = (NMSettingUmts *) nm_connection_get_setting (connection, NM_TYPE_SETTING_UMTS);
if (!umts) {
nm_warning ("Connection check failed: umts setting not present.");
gsm = (NMSettingGsm *) nm_connection_get_setting (connection, NM_TYPE_SETTING_GSM);
if (!gsm) {
nm_warning ("Connection check failed: gsm setting not present.");
return FALSE;
}
if (!umts->number) {
if (!gsm->number) {
nm_warning ("Connection check failed: Phone number not set.");
return FALSE;
}
return NM_DEVICE_CLASS (nm_umts_device_parent_class)->check_connection (dev, connection);
return NM_DEVICE_CLASS (nm_gsm_device_parent_class)->check_connection (dev, connection);
}
static void
@@ -487,7 +487,7 @@ real_connection_secrets_updated (NMDevice *dev,
if (nm_device_get_state (dev) != NM_DEVICE_STATE_NEED_AUTH)
return;
if (strcmp (setting_name, NM_SETTING_UMTS_SETTING_NAME) != 0) {
if (strcmp (setting_name, NM_SETTING_GSM_SETTING_NAME) != 0) {
nm_warning ("Ignoring updated secrets for setting '%s'.", setting_name);
return;
}
@@ -503,31 +503,31 @@ real_connection_secrets_updated (NMDevice *dev,
static void
real_deactivate_quickly (NMDevice *device)
{
NMUmtsDevicePrivate *priv = NM_UMTS_DEVICE_GET_PRIVATE (device);
NMGsmDevicePrivate *priv = NM_GSM_DEVICE_GET_PRIVATE (device);
if (priv->pending_id) {
g_source_remove (priv->pending_id);
priv->pending_id = 0;
}
NM_DEVICE_CLASS (nm_umts_device_parent_class)->deactivate_quickly (device);
NM_DEVICE_CLASS (nm_gsm_device_parent_class)->deactivate_quickly (device);
}
/*****************************************************************************/
static void
nm_umts_device_init (NMUmtsDevice *self)
nm_gsm_device_init (NMGsmDevice *self)
{
nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_UMTS);
nm_device_set_device_type (NM_DEVICE (self), DEVICE_TYPE_GSM);
}
static void
nm_umts_device_class_init (NMUmtsDeviceClass *klass)
nm_gsm_device_class_init (NMGsmDeviceClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (object_class, sizeof (NMUmtsDevicePrivate));
g_type_class_add_private (object_class, sizeof (NMGsmDevicePrivate));
device_class->get_generic_capabilities = real_get_generic_capabilities;
device_class->check_connection = real_check_connection;

33
src/nm-gsm-device.h Normal file
View File

@@ -0,0 +1,33 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_GSM_DEVICE_H
#define NM_GSM_DEVICE_H
#include <nm-serial-device.h>
G_BEGIN_DECLS
#define NM_TYPE_GSM_DEVICE (nm_gsm_device_get_type ())
#define NM_GSM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_GSM_DEVICE, NMGsmDevice))
#define NM_GSM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_GSM_DEVICE, NMGsmDeviceClass))
#define NM_IS_GSM_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_GSM_DEVICE))
#define NM_IS_GSM_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_GSM_DEVICE))
#define NM_GSM_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_GSM_DEVICE, NMGsmDeviceClass))
typedef struct {
NMSerialDevice parent;
} NMGsmDevice;
typedef struct {
NMSerialDeviceClass parent;
} NMGsmDeviceClass;
GType nm_gsm_device_get_type (void);
NMGsmDevice *nm_gsm_device_new (const char *udi,
const char *iface,
const char *driver);
G_END_DECLS
#endif /* NM_GSM_DEVICE_H */

View File

@@ -12,7 +12,7 @@
#include "nm-utils.h"
#include "nm-device-802-11-wireless.h"
#include "nm-device-802-3-ethernet.h"
#include "nm-umts-device.h"
#include "nm-gsm-device.h"
/* Killswitch poll frequency in seconds */
#define NM_HAL_MANAGER_KILLSWITCH_POLL_FREQUENCY 6
@@ -205,7 +205,7 @@ modem_device_creator (NMHalManager *manager, const char *udi)
}
if (serial_device && driver_name)
device = (NMDevice *) nm_umts_device_new (udi, serial_device + strlen ("/dev/"), driver_name);
device = (NMDevice *) nm_gsm_device_new (udi, serial_device + strlen ("/dev/"), driver_name);
libhal_free_string (serial_device);
libhal_free_string (driver_name);
@@ -234,9 +234,9 @@ register_built_in_creators (NMHalManager *manager)
creator->creator_fn = wireless_device_creator;
manager->device_creators = g_slist_append (manager->device_creators, creator);
/* Modem */
/* GSM Modem */
creator = g_slice_new0 (DeviceCreator);
creator->device_type_name = g_strdup ("UMTS (GSM)");
creator->device_type_name = g_strdup ("GSM modem");
creator->capability_str = g_strdup ("modem");
creator->is_device_fn = is_modem_device;
creator->creator_fn = modem_device_creator;

View File

@@ -1,33 +0,0 @@
/* -*- Mode: C; tab-width: 5; indent-tabs-mode: t; c-basic-offset: 5 -*- */
#ifndef NM_UMTS_DEVICE_H
#define NM_UMTS_DEVICE_H
#include <nm-serial-device.h>
G_BEGIN_DECLS
#define NM_TYPE_UMTS_DEVICE (nm_umts_device_get_type ())
#define NM_UMTS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_UMTS_DEVICE, NMUmtsDevice))
#define NM_UMTS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_UMTS_DEVICE, NMUmtsDeviceClass))
#define NM_IS_UMTS_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_UMTS_DEVICE))
#define NM_IS_UMTS_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_UMTS_DEVICE))
#define NM_UMTS_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_UMTS_DEVICE, NMUmtsDeviceClass))
typedef struct {
NMSerialDevice parent;
} NMUmtsDevice;
typedef struct {
NMSerialDeviceClass parent;
} NMUmtsDeviceClass;
GType nm_umts_device_get_type (void);
NMUmtsDevice *nm_umts_device_new (const char *udi,
const char *iface,
const char *driver);
G_END_DECLS
#endif /* NM_UMTS_DEVICE_H */