Interfaces - The PCXFireWall Interface Definition Object.
use PCXFireWall::Interfaces; my $obj = PCXFireWall::Interfaces->new;
# Define the internal and external Network Interfaces being
# used/protected.
$obj->defineInterface(name => "ppp0", alias => "dialup0",
type => "dynamic");
$obj->defineInterface(name => "eth0", alias => "internal0",
location => "internal", IP => "192.168.0.250");
$obj->defineInterface(name => "eth0:0", alias => "internal1",
location => "internal", IP => "192.168.0.251");
$obj->defineInterface(name => "eth1", alias => "dmz0",
location => "dmz", IP => "192.168.1.250");
# define a new location - vpn $obj->defineLocation(location => "vpn");
# get all dmz interfaces
my %dmzs = $obj->getInterfacesLocatedAt(location => "dmz");
foreach my $interface (keys %dmzs)
{
print "Interface '$interface', type = '$dmzs{$interface}{type}'," .
"alias = '$dmzs{$interface}{alias}', IP = '$dmzs{$interface}{IP}'.\n";
}
Interfaces is the Interface Definition Object for the PCXFireWall.
scalar new(void)
Creates a new instance of the PCXFireWall::Interfaces object.
void defineInterface(name, alias, type, location, IP)
requires: name (ethX), type (static|dynamic),
location (internal|external|dmz|firewall|user defined value)
alias (name used by the shell script)
optional: IP (IP Address)[required if type = static]
returns: nothing
summary: This creates an entry in the interfaces hash that defines
an internal or external network card and it's settings.
The type defaults to static and location defaults to
external, so you don't have to specify them if that is
what you need.
void defineLocation(location)
requires: location
optional:
returns: nothing
summary: This routine allows you to create alternate 'locations' that
your network interfaces can be grouped under than the
default locations of internal, external, firewall and dmz.
%interfaces getInterfacesLocatedAt(location)
requires: location (internal|external|dmz|user defined value)
returns: hash of all interfaces of the specified location.
summary: This routine validates the specified location and then
returns the hash that contains all interfaces defined for
that location.
@(location, type, ip, usingBroadcast, alias) getInfo(int)
This routine takes an interface the user has registered
and looks it up. If it is not found, then an empty array
is returned, else the location, type and ip info is returned as
depicted in the return value.
void usingBroadcast(int)
requires: int - interface to work with
returns: nothing
summary: finds the specified interface and sets the usingBroadcast
flag to 1
interfaces - hash of all interfaces defined by the user.
Format is
interfaces->{location}->{interface name}->{type}
interfaces->{location}->{interface name}->{IP}
interfaces->{location}->{interface name}->{usingBroadcast}
interfaces->{location}->{interface name}->{alias}
NOTE: All data fields are accessible by specifying the object
and pointing to the data member to be modified on the
left-hand side of the assignment.
Ex. $obj->variable($newValue); or $value = $obj->variable;
Xperience, Inc. (mailto:admin at pcxperience.com)
perl(1)