Category Archives: SIGTRAN

SIGTRAN

Net::SIGTRAN::M3UA

Have released a draft beta version of SCTP Perl Module that is published in CPAN.

Net::SIGTRAN::M3UA – An implementation to create M3UA protol stack to provide SIGTRAN stack implementation in perl. Before installing Net::SIGTRAN::M3UA, make sure that the following package:

$ rpm -qa|grep sctp
lksctp-tools-1.0.6-3.el5
lksctp-tools-devel-1.0.6-3.el5

Alternatively you can download and compile the source from http://lksctp.sourceforge.net.

The following is example source code to get started.

SCTP Server Example

use Net::SIGTRAN::M3UA;
use threads;

my $server=new Net::SIGTRAN::M3UA(
PORT=>12346 ); my $ssock=$server->bind(); if ($ssock) {
my $csock;
while($csock = $server->accept($ssock)) {
print "New Client Connection\n";
my $thr=threads->create(\&processRequest,$server,$csock);
$thr->detach();
}
}

sub processRequest {
my $server=shift;
my $ssock=shift;
my $connSock = $server->accept($ssock);
cmp_ok($connSock,'>',0,'Unable to accept Client Connection');
print "Sending to $connSock\n";
$server->ASPUP($connSock);
$server->ASPUP_ACK($connSock);
$server->ASPAC($connSock,2,0);
$server->ASPAC_ACK($connSock,2,0);
$server->NTFY($connSock,1,2);
$server->DAUD($connSock,12,0,1142);
$server->DAVA($connSock,12,0,1142);
$server->DUNA($connSock,12,0,1142);
my $heartbeat='0005000101ffd8398047021227041120';
$server->BEAT($connSock,$heartbeat);
$server->BEAT_ACK($connSock,$heartbeat);
$server->close($connSock);
}

SCTP Server Example

use Net::SIGTRAN::M3UA;

my $client=new Net::SIGTRAN::M3UA(
HOST=>'127.0.0.1',
PORT=>12346 );

my $csock=$client->connect();
#Read ASPUP
&clientread('ASPUP',$client,$csock);
#Read ASPUP_ACK
&clientread('ASPUP_ACK',$client,$csock);
#Read ASPAC
&clientread('ASPAC',$client,$csock);
#Read ASPAC_ACK
&clientread('ASPAC_ACK', $client,$csock);
#Read NTFY
&clientread('NTFY', $client,$csock);
#Read DAUD
&clientread('DAUD', $client,$csock);
#Read DAVA
&clientread('DAVA', $client,$csock);
#Read DUNA
&clientread('DUNA', $client,$csock);
#Read BEAT
&clientread('BEAT', $client,$csock);
#Read BEAT_ACK
&clientread('BEAT_ACK', $client,$csock);

$client->close($csock);

sub clientread {
my $title=shift;
my $client=shift;
my $csock=shift;
my ($buffer)=$client->readpdu($csock);
if ($buffer) {
if ($buffer->{'M3UA'} =~/Invalid|Unknown/) {
print("Reading $title test");
} else {
print("reading $title test");
print STDERR Dumper($buffer);
}
} else {
print("Reading $title test, Client Socket does not recieve any packet");
}
}

INSTALLATION

To install the module, perform the usual perl module installation procedures. The following is the steps:


perl Makefile.PL
make
make install

Net::SIGTRAN::SCTP

Have released a draft beta version of SCTP Perl Module that is published in CPAN.

This SCTP module is created to access lksctp to provide SCTP implementation. Before installing Net::SIGTRAN::SCTP, make sure that the following package:

$ rpm -qa|grep sctp
lksctp-tools-1.0.6-3.el5
lksctp-tools-devel-1.0.6-3.el5

Alternatively you can download and compile the source from http://lksctp.sourceforge.net.

The following is example source code to get started.

SCTP Server Example

use Net::SIGTRAN::SCTP;
use threads;

my $server=new Net::SIGTRAN::SCTP( PORT=>12345 );
my $ssock=$server->bind();
if ($ssock) {
my $csock;
while($csock = $server->accept($ssock)) {
print "New Client Connection\n";
my $thr=threads->create(\&processRequest,$server,$csock);
$thr->detach();
}
}

sub processRequest {
my $connection=shift;
my $socket=shift;
my ($readlen,$buffer)= $connection->recieve($socket,1000);
print "Recieved ($readlen,$buffer)\n";
}

SCTP Server Example

use Net::SIGTRAN::SCTP;

my $textstring='Hello World';
my $client=new Net::SIGTRAN::SCTP( HOST=>'127.0.0.1', PORT=>12345 );

my $csock=$client->connect();

$client->send($csock,0,length($textstring),$textstring);
$client->close($csock);

INSTALLATION

To install the module, perform the usual perl module installation procedures. The following is the steps:


perl Makefile.PL
make
make install