Quick Navigator

Search Site

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

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages
Net::RNDC::Packet(3) User Contributed Perl Documentation Net::RNDC::Packet(3)

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

version 0.003

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 => '',
  ) or die "Failed to create a socket: $@ ($!)";
  # Send opener packet
  my $pkt = Net::RNDC::Packet->new(
    key => $key,
  # Read nonce response
  $c->recv($buff, 4096);
  # Send command request with nonce
  my $nonce = $pkt->{data}->{_ctrl}{_nonce};
  my $cmd = Net::RNDC::Packet->new(
    key => $key,
    nonce => $nonce,
    data => {type => 'status'},
  # Read final response
  $c->recv($buff, 4096);
  my $resp = $cmd->{data}{_data}{text} || 'command success';
  print "$resp\n";

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.

  my $packet = Net::RNDC::Packet->new(%args);
key - The Base64 encoded HMAC-MD5 key to sign/verify packets with.
data - 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' },
nonce - The nonce data returned from the remote nameserver. Located in the parsed packet in the _ctrl section:
  nonce => $packet->{data}->{_ctrl}{_nonce},

  my $binary = $packet->data;
Generates a binary representation of the packet, suitable for sending over the wire.
  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 key that was passed to the constructor. Returns 1 on success, 0 on failure. Check "error" if there's a failure.
  my $err = $packet->error;
Returns a string error, if any, after packet parsing or generation failed.

Methods for modifying the different data parts of an RNDC message

Net::RNDC - Simple RNDC communication.
Net::RNDC::Session - Manage the 4-packet RNDC session

Matthew Horsfall (alh) <>

You may distribute this code under the same terms as Perl itself.
2013-01-08 perl v5.28.1

Search for    or go to Top of page |  Section 3 |  Main Index

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