jablonka.czprosek.czf

hotsanic

Subversion Repositories:
[/] [branches/] [HotSaNIC-0.5.0-pre6/] [modules/] [networks/] [platform/] [common.pm] - Rev 15 Go to most recent revision

Compare with Previous - Blame - Download


package HotSaNICmod::common;

sub version {
  ($VERSION = '$Revision: 1.6 $') =~ s/.*(\d+\.\d+).*/$1/;
  return "common.pm $VERSION";
  }      

sub configure {
  my %MODCONF=HotSaNICparser::get_moduleconfig(".",(IPTABLES=>"var",INTIF=>"var",EXTIF=>"var",DEVINT=>"array",DEVEXT=>"array",STYLE=>"var"));
  if ($MODCONF{IPTABLES} eq "") { $MODCONF{IPTABLES}=get_netfilter(); }
  if ($MODCONF{STYLE} ne "") { $MODCONF{GRAPH_BASE}=$MODCONF{STYLE}; }
  (my $extif=$MODCONF{EXTIF}) =~ s/,/ /g;
  (my $intif=$MODCONF{INTIF}) =~ s/,/ /g;
  foreach (@{$MODCONF{DEVEXT}}) { push @{$MODCONF{DEV}},"ext,$extif,$_"; }
  foreach (@{$MODCONF{DEVINT}}) { push @{$MODCONF{DEV}},"int,$intif,$_"; }
  return %MODCONF;
  }

sub get_netfilter {
  my @list=grep /iptables$/,HotSaNICparser::locate_files("bin/iptables");
  if (! @list) { @list=grep /ipchains$/,HotSaNICparser::locate_files("bin/ipchains"); }
  my $CMD=shift @list;
  return $CMD;
  }

sub get_names {
  my $entry=shift || ",";

  my $host="";
  my $community="";

  my ($side,$interfaces,$item,$description)=split /,/,$entry;
  $name=$item;
  ($dbname="$side$name") =~ s/\//_/g;
  $file=$dbname;

  return ($host,$community,$item,$dbname,$name,$file,$description);
  }
1;


Powered by WebSVN 2.2.1