The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::NSCA::Client::InitialPacket - Implements initial packet for the NSCA protocol

VERSION

This documentation refers to Net::NSCA::Client::InitialPacket version 0.002

SYNOPSIS

  use Net::NSCA::Client::InitialPacket;

  # Create a packet from scratch
  my $packet = Net::NSCA::Client::InitialPacket->new(
    initialization_vector => $iv,
    unix_timestamp        => time(),
  );

  # Create a packet recieved from over the network
  my $recieved_packet = Net::NSCA::Client::InitialPacket->new($recieved_data);

DESCRIPTION

Represents the initial packet used in the NSCA protocol.

CONSTRUCTOR

This is fully object-oriented, and as such before any method can be used, the constructor needs to be called to create an object to work with.

new

This will construct a new object.

new(%attributes)

%attributes is a HASH where the keys are attributes (specified in the "ATTRIBUTES" section).

new($attributes)

$attributes is a HASHREF where the keys are attributes (specified in the "ATTRIBUTES" section).

new($packet_string)

$packet_string is a string of the data packet in the network form.

ATTRIBUTES

  # Set an attribute
  $object->attribute_name($new_value);

  # Get an attribute
  my $value = $object->attribute_name;

initialization_vector

This is a binary string, which is the exact length of the constant "$INITIALIZATION_VECTOR_LENGTH". If a string less than this length is provided, then it is automatically padded with NULLs. If not specified, this will default to random bytes generated by a Crypt::Random.

unix_timestamp

This is a UNIX timestamp, which is an integer specifying the number of non-leap seconds since the UNIX epoch. If not specified, this will default to the current timestamp, provided by time().

METHODS

to_string

This methods returns the string representation of the initial packet. This string representation is what will be sent over the network.

CONSTANTS

Constants provided by this library are protected by the Readonly module.

$INITIALIZATION_VECTOR_LENGTH

This is the length of the "initialization_vector".

DEPENDENCIES

AUTHOR

Douglas Christopher Wilson, <doug at somethingdoug.com>

BUGS AND LIMITATIONS

Please report any bugs or feature requests to bug-net-nsca-client at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Net-NSCA-Client. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

I highly encourage the submission of bugs and enhancements to my modules.

LICENSE AND COPYRIGHT

Copyright 2009 Douglas Christopher Wilson.

This program is free software; you can redistribute it and/or modify it under the terms of either:

  • the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or

  • the Artistic License version 2.0.