class Dnsruby::RR::NSAP

Class for DNS Network Service Access Point (NSAP) resource records. RFC 1706.

Attributes

aa[RW]

The RR's administrative authority.

afi[RW]

currently supports only AFI 47 (GOSIP Version 2).

area[RW]

The RR's area identifier.

dfi[RW]

The RR's DSP format identifier.

id[RW]

The RR's system identifier.

idi[RW]

The RR's initial domain identifier.

rd[RW]

The RR's routing domain identifier.

rsvd[W]

The RR's reserved field.

sel[RW]

The RR's NSAP selector.

Public Instance Methods

dsp() click to toggle source

The RR's domain specific part (the DFI, AA, Rsvd, RD, Area, ID, and SEL fields).

# File lib/dnsruby/resource/NSAP.rb, line 52
def dsp
  ret = [@dfi,@aa,rsvd,@rd,@area,@id,@sel].join('')
  return ret
end
idp() click to toggle source

The RR's initial domain part (the AFI and IDI fields).

# File lib/dnsruby/resource/NSAP.rb, line 45
def idp
  ret = [@afi, @idi].join('')
  return ret
end
rsvd() click to toggle source
# File lib/dnsruby/resource/NSAP.rb, line 57
def rsvd
  if (@rsvd==nil)
    return "0000"
  else
    return @rsvd
  end
end
str2bcd(s, bytes) click to toggle source

Usage:  str2bcd(STRING, NUM_BYTES)

Takes a string representing a hex number of arbitrary length and
returns an equivalent BCD string of NUM_BYTES length (with
NUM_BYTES * 2 digits), adding leading zeros if necessary.

# File lib/dnsruby/resource/NSAP.rb, line 72
def str2bcd(s, bytes)
  retval = "";

  digits = bytes * 2;
  string = sprintf("%#{digits}s", s);
  string.tr!(" ","0");

  i=0;
  bytes.times do
    bcd = string[i*2, 2];
    retval += [bcd.to_i(16)].pack("C");
    i+=1
  end

  return retval;
end