summaryrefslogtreecommitdiffstats
path: root/lib/network/connection/cellular.pm
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-05-25 15:39:46 +0000
committerOlivier Blin <oblin@mandriva.com>2007-05-25 15:39:46 +0000
commit1d37bfdbbe874abd6dcb5563eea19f531de09e1c (patch)
tree74845e43ed8fa59c7aaafd1a87efaa6b0c83c228 /lib/network/connection/cellular.pm
parentc6ba983db7d5a82ee63599e775be0f8211447c72 (diff)
downloaddrakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.gz
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.bz2
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.tar.xz
drakx-net-1d37bfdbbe874abd6dcb5563eea19f531de09e1c.zip
sync with 2007.1 (because of SVN loss)2007.1
Diffstat (limited to 'lib/network/connection/cellular.pm')
-rw-r--r--lib/network/connection/cellular.pm52
1 files changed, 52 insertions, 0 deletions
diff --git a/lib/network/connection/cellular.pm b/lib/network/connection/cellular.pm
new file mode 100644
index 0000000..a9c0d78
--- /dev/null
+++ b/lib/network/connection/cellular.pm
@@ -0,0 +1,52 @@
+package network::connection::cellular;
+
+use base qw(network::connection::ppp);
+
+use strict;
+use common;
+
+my $cellular_d = "/etc/sysconfig/network-scripts/cellular.d";
+
+sub get_providers {
+ require network::connection::providers::cellular;
+ (\%network::connection::providers::cellular::data, '|');
+}
+
+sub get_cellular_settings_file {
+ my ($self) = @_;
+ my $network = $self->get_selected_network or return;
+ $::prefix . $cellular_d . '/' . $network->{name};
+}
+
+sub load_cellular_settings {
+ my ($self) = @_;
+ my $file = $self->get_cellular_settings_file or return;
+ -f $file && { getVarsFromSh($file) };
+}
+
+sub selected_network_is_configured {
+ my ($self) = @_;
+ defined($self->load_cellular_settings);
+}
+
+sub write_cellular_settings {
+ my ($self) = @_;
+ my $file = $self->get_cellular_settings_file or return;
+ setVarsInShMode($file, 0600, { map { (uc($_) => $self->{access}{$_}) } qw(login password apn) });
+}
+
+sub guess_access_settings {
+ my ($self) = @_;
+ my $settings = $self->load_cellular_settings || {};
+ $self->{access}{$_} = $settings->{uc($_)} || $self->{provider}{$_} foreach qw(login password apn);
+}
+
+sub get_access_settings {
+ my ($self) = @_;
+ [
+ { label => N("Access Point Name"), val => \$self->{access}{apn} },
+ @{$self->SUPER::get_access_settings},
+ ];
+}
+
+1;