Matt Sisk
and 1 contributors

NAME

Net::Silk::ProtoPort - SiLK protocol/port pair

SYNOPSIS

  use Net::Silk::ProtoPort;

  my $pp1 = Net::Silk::ProtoPort(6, 22);
  my $pp2 = Net::Silk::ProtoPort("6:443");

  $pp1 < $pp2; # true

  print "proto: ", $pp1->proto, "\n";
  print " port: ", $pp1->port, "\n";

DESCRIPTION

Net::Silk::ProtoPort objects represent a protocol/port pair which can be used as a key (as opposed to an IP address) in Net::Silk::Pmap files.

METHODS

new($spec)
new($proto, $port)

Returns a new Net::Silk::ProtoPort object. The protocol and port can be provided directly as two arguments, or as an array reference containing the pair, or as a string with a non-digit separator such as "proto:port".

proto()

Return or set the protocol number.

port()

Return or set the port number.

copy()

Return a copy of this object. This method is tied to the = operator.

str()

Return a string representation "port:proto". This method is tied to the "" operator.

num() Return an integer representation of this proto/port pair.
distance($other)

Return an integer representing the absolute value of the distance between this protoport and another.

TIED ARRAY

The Net::Silk::ProtoPort object can be treated as an array, such that $pp->[0], $pp->[1], and @$pp work as expected.

OPERATORS

The following operators are overloaded and work with Net::Silk::ProtoPort objects:

  ""            bool
  +=            =
  +             @{}
  -=
  -
  <=>           cmp
  >             gt
  <             lt
  >=            ge
  <=            le
  ==            eq
  !=            ne

SEE ALSO

Net::Silk, Net::Silk::RWRec, Net::Silk::IPSet, Net::Silk::Bag, Net::Silk::Pmap, Net::Silk::IPWildcard, Net::Silk::Range, Net::Silk::CIDR, Net::Silk::IPAddr, Net::Silk::TCPFlags, Net::Silk::File, Net::Silk::Site, silk(7)

COPYRIGHT & LICENSE

Copyright (C) 2011-2016 by Carnegie Mellon University

Use of the Net-Silk library and related source code is subject to the terms of the following licenses:

GNU Public License (GPL) Rights pursuant to Version 2, June 1991 Government Purpose License Rights (GPLR) pursuant to DFARS 252.227.7013

NO WARRANTY

See GPL.txt and LICENSE.txt for more details.