X-Git-Url: http://git.rot13.org/?p=perl-cwmp.git;a=blobdiff_plain;f=bin%2Facs.pl;h=1b341e78296ff843752a5bb893562e56ee1989bd;hp=ddfa2b8b90480e80777b805f7beed7701848ec7d;hb=344caca0b017590a9a3770a634841892a2c82cb2;hpb=e6d5ba806dd37cebf3d7456af60bff5965fae56f diff --git a/bin/acs.pl b/bin/acs.pl index ddfa2b8..1b341e7 100755 --- a/bin/acs.pl +++ b/bin/acs.pl @@ -8,33 +8,53 @@ use strict; use lib './lib'; use CWMP::Server; +use CWMP::Session; +use CWMP::Vendor; use Getopt::Long; +use Data::Dump qw/dump/; +use File::Find; my $port = 3333; my $debug = 0; my $store_path = './'; my $store_plugin = 'YAML'; +my $create_dump = 1; GetOptions( 'debug+' => \$debug, 'port=i' => \$port, 'store-path=s' => \$store_path, 'store-plugin=s' => \$store_plugin, + 'create_dump!' => \$create_dump, ); +if ( $create_dump ) { + warn "## cleaning dump directory\n" if $debug; + find({ + wanted => sub { + my $path = $File::Find::name; + return if -d $path; + unlink($path) || die "can't remove $path: $!"; + warn "## removed $path\n" if $debug; + }, + no_chdir => 1, + }, 'dump/' ); +} + my $server = CWMP::Server->new({ port => $port, - store => { - module => $store_plugin, - path => $store_path, - debug => $debug, + session => { + store => { + module => $store_plugin, + path => $store_path, + debug => $debug, + }, + create_dump => $create_dump, }, debug => $debug, - default_queue => [ qw/ - GetRPCMethods - GetParameterNames - / ], -# Reboot }); + +CWMP::Vendor->add_triggers; + $server->run();