lib/net/dns/names/names.rb in net-dns-0.5.3 vs lib/net/dns/names/names.rb in net-dns-0.6.0
- old
+ new
@@ -1,10 +1,23 @@
-module Net # :nodoc:
+module Net
module DNS
- module Names # :nodoc: all
-
+ module Names
+
+ # Argument Error for class Net::DNS::Names.
+ class ArgumentError < ArgumentError
+ end
+
+ # Base error class.
+ class Error < StandardError
+ end
+
+ # Generic Names Error.
+ class ExpandError < Error
+ end
+
+
INT16SZ = 2
# Expand a compressed name in a DNS Packet object. Please
# see RFC1025 for an explanation of how the compression
# in DNS packets works, how may it be useful and how should
@@ -16,11 +29,11 @@
#
def dn_expand(packet,offset)
name = ""
packetlen = packet.size
while true
- raise ExpandError, "offset is greater than packet lenght!" if packetlen < (offset+1)
+ raise ExpandError, "Offset is greater than packet lenght!" if packetlen < (offset+1)
len = packet.unpack("@#{offset} C")[0]
if len == 0
offset += 1
break
@@ -99,11 +112,8 @@
else
raise ArgumentError, "Invalid FQDN: #{name}"
end
end
- end # module Names
- end # module DNS
-end # module Net
-
-class ExpandError < StandardError # :nodoc:
-end
+ end
+ end
+end
\ No newline at end of file