Matt Sisk
and 1 contributors

NAME

Net::WDNS::Msg - Perl interface for libwdns messages

SYNOPSIS

  use Net::WDNS qw(:func);

  ... # get raw DNS packet

  my $msg = parse_message($pkt);
  print $msg->as_str, "\n";

DESCRIPTION

Net::WDNS::Msg is an object interface to libwdns messages that allows introspection and rendering as human-readable strings.

CONSTRUCTOR

new($pkt)

Creates a new Net::WDNS::Msg object from a raw (wire-format) DNS packet. A slightly faster way to get message objects is to use the parse_message() function provided by Net::WDNS.

METHODS

id()

Return the numeric id of this message.

flags()

Return a hash of flags and their statuses (0 or 1) for this message. Flags include qr, aa, tc, rd, ra, ad, and cd.

flags_raw()

Return the raw bit-encoded integer reprenting the flags.

rcode()

Return the string version of the rcode.

rcode_num()

Return the numeric rcode.

opcode()

Return the string version of the rcode.

opcode_num()

Return the numeric opcode.

question()

Return the QUESTION section of this message as an array (array ref in scalar context) containing Net::WDNS::Question objects.

answer()

Return the ANSWER section of this message as an array (array ref in scalar context) containing Net::WDNS::RR objects.

authority()

Return the AUTHORITY section of this message as an array (array ref in scalar context) containing Net::WDNS::RR objects.

additional()

Return the ADDITIONAL section of this message as an array (array ref in scalar context) containing Net::WDNS::RR objects.

as_str()

Return a human-readable string representing this message. Message objects are also overloaded to render as strings when double-quoted.

msg()

Return the underlying raw message structure, suitable for passing to some utility functions provided by Net::WDNS.

SEE ALSO

Net::WDNS, Net::WDNS::Question, Net::WDNS::RR, Net::Nmsg

The wdns library can be downloaded from: https://github.com/farsightsec/wdns

AUTHOR

Matthew Sisk, <sisk@cert.org>

COPYRIGHT AND LICENSE

Copyright (C) 2014 by Carnegie Mellon University

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, as published by the Free Software Foundation, under the terms pursuant to Version 2, June 1991.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.