Net::NBName::NameQuery::RR - NetBIOS Name Query Response Resource Record


Net-NBName documentation Contained in the Net-NBName distribution.

Index


Code Index:

NAME

Top

Net::NBName::NameQuery::RR - NetBIOS Name Query Response Resource Record

DESCRIPTION

Top

Net::NBName::NameQuery::RR represents an ip address entry returned as part of a NetBIOS name query response.

METHODS

Top

$rr->address

Returns the ip address as a dotted quad.

$rr->G

Group flag. Indicates whether the name is a unique or a group name. It is returned as a string: either "UNIQUE" or "GROUP" will be returned.

$rr->ONT

Owner Node Type flag. Indicates if the systems are B, P, H, or M-node. It will be returned as a string.

$rr->as_string

Returns the object's string representation.

SEE ALSO

Top

Net::NBName, Net::NBName::NameQuery

COPYRIGHT

Top


Net-NBName documentation Contained in the Net-NBName distribution.

use strict;
use warnings;

package Net::NBName::NameQuery::RR;

use vars '$VERSION';
$VERSION = "0.26";

use vars '@nodetypes';
@nodetypes = qw/B-node P-node M-node H-node/;

sub new
{
    my $class = shift;
    my $nb_data = shift;
    my ($flags, $packed_address) = unpack("na4", $nb_data);
    my $address = join ".", unpack("C4", $packed_address);

    my $self = {};
    $self->{'address'} = $address;
    $self->{'G'} = ($flags & 2**15) ? "GROUP" : "UNIQUE";
    $self->{'ONT'} = $nodetypes[($flags >> 13) & 3];

    bless $self, $class;
    return $self;
}

sub as_string
{
    my $self = shift;

    return sprintf "%-15s %-6s %-6s\n",
        $self->{'address'},
        $self->{'G'},
        $self->{'ONT'};
}

sub address { return $_[0]->{'address'}; }
sub G { return $_[0]->{'G'}; }
sub ONT { return $_[0]->{'ONT'}; }

1;

__END__