Net::Analysis::Constants - some families of constants


Net-Analysis documentation Contained in the Net-Analysis distribution.

Index


Code Index:

NAME

Top

Net::Analysis::Constants - some families of constants

SYNOPSIS

Top

  use Net::Analysis::Constants qw(tcpseshstates tcpflags packetclasses);

  if ($var == PKT_DUP_DATA) {...}

DESCRIPTION

Top

Some useful constants.

EXPORT

None by default.

AUTHOR

Top

Adam B. Worrall, <worrall@cpan.org>

COPYRIGHT AND LICENSE

Top


Net-Analysis documentation Contained in the Net-Analysis distribution.

package Net::Analysis::Constants;
# $Id: Constants.pm 131 2005-10-02 17:24:31Z abworrall $

# {{{ Boilerplate

use 5.008000;
our $VERSION = '0.01';
use strict;
use warnings;

require Exporter;

our @ISA = qw(Exporter);

our @TCPFLAG_CONSTS = (qw(FIN SYN RST PSH ACK URG));

our @SESHSTATE_CONSTS = (qw(SESH_UNDEFINED
                            SESH_CONNECTING
                            SESH_ESTABLISHED
                            SESH_HALF_CLOSED
                            SESH_CLOSED
                           ));

our @PKTCLASS_CONSTS  = qw(PKT_NOCLASS
                           PKT_NONDATA
                           PKT_DATA
                           PKT_DUP_DATA
                           PKT_FUTURE_DATA
                           );

our @EXPORT      = qw();
our @EXPORT_OK   = (@TCPFLAG_CONSTS, @SESHSTATE_CONSTS, @PKTCLASS_CONSTS);
our %EXPORT_TAGS = (all           => [ @EXPORT, @EXPORT_OK ],
                    tcpseshstates => [ @SESHSTATE_CONSTS ],
                    tcpflags      => [ @TCPFLAG_CONSTS ],
                    packetclasses => [ @PKTCLASS_CONSTS ],);

# }}}

# TCP Session states
use constant {
    SESH_UNDEFINED   => 'SESH_UNDEFINED',

    # The main states; sending SYNs, data or FINs. Or all done.
    SESH_CONNECTING  => 'SESH_CONNECTING',
    SESH_ESTABLISHED => 'SESH_ESTABLISHED',
    SESH_HALF_CLOSED => 'SESH_HALF_CLOSED',
    SESH_CLOSED      => 'SESH_CLOSED'
};

# TCP packet flags
use constant {
    FIN => 0x01,
    SYN => 0x02,
    RST => 0x04,
    PSH => 0x08,
    ACK => 0x10,
    URG => 0x20,
};


# How we classify the packet (for reporting
use constant {
    PKT_NOCLASS             => 0, # Should be an error
    PKT_NONDATA             => 1, # Was a bare ACK, or part of setup/teardown
    PKT_DATA                => 2, # Was a juicy data packet
    PKT_DUP_DATA            => 3, # Was a resend of data we already have
    PKT_FUTURE_DATA         => 4, # Was something we weren't expecting
};


1;
__END__
# {{{ POD

# }}}

# {{{ -------------------------={ E N D }=----------------------------------

# Local variables:
# folded-file: t
# end:

# }}}