|
NAMENet::RNDC::Session - Helper package to manage the RNDC 4-packet sessionVERSIONversion 0.003SYNOPSISTo use synchronously as a client:use IO::Socket::INET; use Net::RNDC::Session; my $c = IO::Socket::INET->new( PeerAddr => '127.0.0.1:953', ) or die "Failed to create a socket: $@ ($!)"; # Our response my $response; my $session = Net::RNDC::Session->new( key => 'abcd', command => 'status', is_client => 1, want_write => sub { my $s = shift; $c->send(shift); $s->next; }, want_read => sub { my $s = shift; my $b; $c->recv($b, 4096); $s->next($b); }, want_finish => sub { my $s = shift; $response = shift; }, want_error => sub { my $s = shift; my $err = shift; die "Error: $err\n"; }, ); # Since we call next() in want_read/want_write above, this will do everything $session->start; print "Response: $response\n"; To use asynchronously (for example, with IO::Async): TBD To use as a server: TBD To use asynchronously as a server: TBD DESCRIPTIONThis package is intended to provide the logic for an RNDC client session which can used to run a single command against a remote server and get a response. See "SESSION" below for a description of the RNDC client session logic.This package also supports running sessions as an RNDC server. For simple use of the RNDC protocol, see Net::RNDC. There is no socket logic here, that must be provided to this class through the constructor in the various "want_*" methods. This allows for synchronous/asynchronous use with a little work. This package does generate and parse Net::RNDC::Packets, but the "want_read" and "want_write" methods allow you to peak at this data before it's parsed and before it's sent to the remote end to allow slightly more fine-grained control. To manage the entire process yourself, use Net::RNDC::Packet. SESSIONAn RNDC client session (where one is sending commands to a remote nameserver expecting a response) contains 4 packets.All packets contain a timestamp/expiracy timestamp to denote a packet validity window, as well as an HMAC-MD5 signature of the packets data using a shared private key, and a serial number to identify the packet.
If at any time the remote end disconnects prematurely, this may indicate any of the following (along with normal network issues):
SEE ALSONet::RNDC - Simple RNDC communication.Net::RNDC::Packet - Low level RNDC packet manipulation. AUTHORMatthew Horsfall (alh) <WolfSage@gmail.com>LICENSEYou may distribute this code under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |