NAME

Net::Silk::TCPFlags - SiLK TCP session flags

SYNOPSIS

use Net::Silk::TCPFlags;

my $f1 = Net::Silk::TCPFlags->new('FSRP');
my $f2 = Net::Silk::TCPFlags->new(5);

my $f3 = $f1 & $f2;

$f1->syn; # true
$f1->ack; # false

print "flags: $f1\n";
print "flags: $f2\n";
print "flags: $f3\n";

$f1->matches("fs/fsau"); # true

DESCRIPTION

Net::Silk::TCPFlags objects represent the eight bits of flags from a TCP session.

METHODS

new($spec)

Returns a new Net::Silk::TCPFlags object. The provide spec can be another TCP flags object, a string, or an integer. If an integer is provided it should be the 8-bit representation of the flags. If a string is provided it should consist of a concatenation of zero or more of the characters F, S, R, P, A, U, E, and C (upper or lower case) representing the FIN, SYN, RST, PSH, ACK, URG, ECE, and CWR flags. Whitespace in the string is ignored.

fin()

Return true if the FIN flag is set on flags, false otherwise.

syn()

Return true if the SYN flag is set on flags, false otherwise.

rst()

Return true if the RST flag is set on flags, false otherwise.

psh()

Return true if the PSH flag is set on flags, false otherwise.

ack()

Return true if the ACK flag is set on flags, false otherwise.

urg()

Return true if the URG flag is set on flags, false otherwise.

ece()

Return true if the ECE flag is set on flags, false otherwise.

cwr()

Return true if the CWR flag is set on flags, false otherwise.

matches($flagmask)

Given a string mask of the form high_flags/mask_flags, return true if the flags match high_flags after being masked with mask_flags, false otherwise. Given a flagmask without the slash (/), return true if all bits in flagmask are set in these flags, i.e. a flagmask without a slash is interpreted as flagmask/flagmask.

int()

Return the numeric representation of these flags.

str()

Return the string representation of these flags. This method is tied to the "" operator and is invoked when quoted.

padded()

Return the whitespace-padded string representation of these flags.

and($flagmask)

Logical AND with the given flags. Bound to the & operator.

or($flagmask)

Logical OR with the given flags. Bound to the | operator.

xor($flagmask)

Logical EXCLUSIVE OR with the given flags. Bound to the ^ operator.

neg

Logical NEGATION of these flags. Bound to the ~ operator.

eq($flags)

String equality with the given flags. Bound to the eq operator.

ne($flags)

String inequality with the given flags. Bound to the ne operator.

eq_num($flags)

Numeric equality with the given flags. Bound to the == operator.

ne_num($flags)

Numeric inequality with the given flags. Bound to the != operator.

cmp($flags)

Comparison (-1, 0, 1) with the given flags. Bound to the cmp operator.

not()

Boolean negation. Returns true if no flags are set, false otherwise. Bound to the ! operator.

OPERATORS

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

""            ==
&             !=
|             cmp
^             <=>
~             int
eq            !
ne

CONSTANTS

The following constants are available for export with the :flags key:

TCP_FIN

A TCPFlags object iwth only the FIN flag set.

TCP_SYN

A TCPFlags object iwth only the SYN flag set.

TCP_RST

A TCPFlags object iwth only the RST flag set.

TCP_PSH

A TCPFlags object iwth only the PSH flag set.

TCP_ACK

A TCPFlags object iwth only the ACK flag set.

TCP_URG

A TCPFlags object iwth only the URG flag set.

TCP_ECE

A TCPFlags object iwth only the ECE flag set.

TCP_CWR

A TCPFlags object iwth only the CWR flag set.

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::ProtoPort, 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.