sub checksum {
my $pkt = shift;
-
return (-unpack('%16C*', $pkt) & 0xFFFF);
}
return (($cksum + $shortsum) & 0xFFFF) == 0;
}
-{
- no warnings qw(once);
- eval join('',<main::DATA>) || die $@ unless caller();
-}
+1;
+
__END__
#
chomp;
test($_);
}
-
-1;
return $self->{listeners}->{$portstr};
}
-#
-# Testing
-#
-
-
-{
- no warnings qw(once);
- eval join('',<main::DATA>) || die $@ unless caller();
-}
-
1;
__END__
- my $config = new Sip::Configuration $ARGV[0];
+=head1 NAME
+
+Sip::Configuration - abstraction/accessor for SIP configs
+
+=head1 SYNOPSIS
+use Sip::Configuration;
+my $config = Sip::Configuration->new($ARGV[0]);
foreach my $acct ($config->accounts) {
- print "Found account '", $acct->name, "', part of '"
+ print "Found account: '", $acct->id, "', part of '";
print $acct->institution, "'\n";
}
-1;
+=cut
+
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
-#
-#
-#
package Sip::Configuration::Account;
use strict;
use warnings;
-use English;
-use Exporter;
sub new {
my ($class, $obj) = @_;
my $type = ref($class) || $class;
if (ref($obj) eq "HASH") {
- # Just bless the object
- return bless $obj, $type;
+ return bless $obj, $type; # Just bless the object
}
return bless {}, $type;
sub id {
my $self = shift;
-
return $self->{id};
}
sub institution {
my $self = shift;
-
return $self->{institution};
}
sub password {
my $self = shift;
-
return $self->{password};
}
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
-#
-#
-#
package Sip::Configuration::Institution;
use strict;
use warnings;
-use English;
-use Exporter;
sub new {
my ($class, $obj) = @_;
my $type = ref($class) || $class;
if (ref($obj) eq "HASH") {
- # Just bless the object
- return bless $obj, $type;
+ return bless $obj, $type; # Just bless the object
}
return bless {}, $type;
sub name {
my $self = shift;
-
return $self->{name};
}
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA 02111-1307 USA
#
-#
-#
-#
package Sip::Configuration::Service;
use strict;
use warnings;
-use English;
-use Exporter;
sub new {
my ($class, $obj) = @_;
my $type = ref($class) || $class;
if (ref($obj) eq "HASH") {
- # Just bless the object
- return bless $obj, $type;
+ return bless $obj, $type; # Just bless the object
}
return bless {}, $type;
sub timeout {
my $self = shift;
-
return $self->{timeout} || $self->SUPER::timeout();
}