GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::RNDC::PACKET (3)

.ds Aq ’

NAME

Net::RNDC::Packet - RNDC Protocol V1 Packet Parsing and Generation

CONTENTS

VERSION

version 0.003

SYNOPSIS

To send an RNDC command and get a response:



  use IO::Socket::INET;
  use Net::RNDC::Packet;

  my $buff;
  my $key = aabc;

  my $c = IO::Socket::INET->new(
    PeerAddr => 127.0.0.1:953,
  ) or die "Failed to create a socket: $@ ($!)";

  # Send opener packet
  my $pkt = Net::RNDC::Packet->new(
    key => $key,
  );

  $c->send($pkt->data);

  # Read nonce response
  $c->recv($buff, 4096);

  $pkt->parse($buff);

  # Send command request with nonce
  my $nonce = $pkt->{data}->{_ctrl}{_nonce};

  my $cmd = Net::RNDC::Packet->new(
    key => $key,
    nonce => $nonce,
    data => {type => status},
  );

  $c->send($cmd->data);

  # Read final response
  $c->recv($buff, 4096);

  $cmd->parse($buff);

  my $resp = $cmd->{data}{_data}{text} || command success;

  print "$resp\n";



DESCRIPTION

This package provides low-level RNDC V1 protocol parsing and generation. It allows full control over the data in the sent/received packets.

Currently this is provided by hacking at $pkt->{data}, setter/getter methods will be forthcoming.

    Constructor

new



  my $packet = Net::RNDC::Packet->new(%args);



Arguments:
o <B>keyB> - The Base64 encoded HMAC-MD5 key to sign/verify packets with.
o <B>dataB> - A hashref of data to put in the request of the packet. Currently, BIND only understand commands in the type key. For example:



  data => { type => status },



o <B>nonceB> - The nonce data returned from the remote nameserver. Located in the parsed packet in the _ctrl section:



  nonce => $packet->{data}->{_ctrl}{_nonce},



    Methods

data



  my $binary = $packet->data;



Generates a binary representation of the packet, suitable for sending over the wire.

parse



  if ($packet->parse($binary)) { ... }



Parses data from the wire and populates the current packet with the information, as well as verifies the data with the provided <B>keyB> that was passed to the constructor. Returns 1 on success, 0 on failure. Check error if there’s a failure.

error



  my $err = $packet->error;



Returns a string error, if any, after packet parsing or generation failed.

TODO

o Methods for modifying the different data parts of an RNDC message

SEE ALSO

Net::RNDC - Simple RNDC communication.

Net::RNDC::Session - Manage the 4-packet RNDC session

AUTHOR

Matthew Horsfall (alh) <WolfSage@gmail.com>

LICENSE

You may distribute this code under the same terms as Perl itself.
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::RNDC::PACKET (3) 2013-01-08

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.