summaryrefslogtreecommitdiff
path: root/xpp/perl_modules/Dahdi.pm
diff options
context:
space:
mode:
authorTzafrir Cohen <tzafrir.cohen@xorcom.com>2008-06-19 17:34:36 +0000
committerTzafrir Cohen <tzafrir.cohen@xorcom.com>2008-06-19 17:34:36 +0000
commitda10e87bd6c69c4374de470b7b286c36c823fdc2 (patch)
tree8ae3ddc2b5eff066497697c0c6ec1bc7ee6433ad /xpp/perl_modules/Dahdi.pm
parentc1ae88873823bdc2d884f72cc2b06eab017b97b1 (diff)
XPP tools rename: part 2.
Removed obsolete astribank_hook (not needed) and print_modes (moved to kernel). git-svn-id: http://svn.asterisk.org/svn/dahdi/tools/trunk@4416 a0bf4364-ded3-4de4-8d8a-66a801d63aff
Diffstat (limited to 'xpp/perl_modules/Dahdi.pm')
-rw-r--r--xpp/perl_modules/Dahdi.pm68
1 files changed, 68 insertions, 0 deletions
diff --git a/xpp/perl_modules/Dahdi.pm b/xpp/perl_modules/Dahdi.pm
new file mode 100644
index 0000000..a191556
--- /dev/null
+++ b/xpp/perl_modules/Dahdi.pm
@@ -0,0 +1,68 @@
+package Dahdi;
+#
+# Written by Oron Peled <oron@actcom.co.il>
+# Copyright (C) 2007, Xorcom
+# This program is free software; you can redistribute and/or
+# modify it under the same terms as Perl itself.
+#
+# $Id$
+#
+use strict;
+use Dahdi::Span;
+
+=head1 NAME
+
+Dahdi - Perl interface to Dahdi information
+
+This package allows access from Perl to information about Dahdi
+hardware and loaded Dahdi devices.
+
+=head1 SYNOPSIS
+
+ # Listing channels in analog spans:
+ use Dahdi;
+ # scans system:
+ my @xbuses = Dahdi::spans();
+ for my $span (@spans) {
+ next if ($span->is_digital);
+ $span->num. " - [". $span->type ."] ". $span->name. "\n";
+ for my $chan ($span->chans) {
+ print " - ".$chan->num . " - [". $chan->type. "] ". $chan->fqn". \n";
+ }
+ }
+=cut
+
+my $proc_base = "/proc/dahdi";
+
+=head1 spans()
+
+Returns a list of span objects, ordered by span number.
+
+=cut
+
+sub spans() {
+ my @spans;
+
+ -d $proc_base or return ();
+ foreach my $zfile (glob "$proc_base/*") {
+ $zfile =~ s:$proc_base/::;
+ my $span = Dahdi::Span->new($zfile);
+ push(@spans, $span);
+ }
+ @spans = sort { $a->num <=> $b->num } @spans;
+ return @spans;
+}
+
+=head1 SEE ALSO
+
+Span objects: L<Dahdi::Span>.
+
+Dahdi channels objects: L<Dahdi::Chan>.
+
+Dahdi hardware devices information: L<Dahdi::Hardware>.
+
+Xorcom Astribank -specific information: L<Dahdi::Xpp>.
+
+=cut
+
+1;