pNet-DNS 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Net/DNS/Packet.rb +11 -11
- metadata +2 -2
data/lib/Net/DNS/Packet.rb
CHANGED
@@ -137,20 +137,20 @@ module Net
|
|
137
137
|
# if args[0].is_a? String
|
138
138
|
data = args[0]
|
139
139
|
debug = args[1]
|
140
|
-
debug =
|
140
|
+
debug = false if debug == nil
|
141
141
|
|
142
142
|
#--------------------------------------------------------------
|
143
143
|
# Parse the header section.
|
144
144
|
#--------------------------------------------------------------
|
145
145
|
|
146
|
-
print ";; HEADER SECTION\n" if
|
146
|
+
print ";; HEADER SECTION\n" if debug
|
147
147
|
|
148
148
|
|
149
149
|
packet.header= Net::DNS::Header.new(data)
|
150
150
|
|
151
151
|
raise ArgumentError, "header section incomplete" if packet.header == nil
|
152
152
|
|
153
|
-
print packet.header.inspect if
|
153
|
+
print packet.header.inspect if debug
|
154
154
|
|
155
155
|
offset = Net::DNS::HFIXEDSZ
|
156
156
|
|
@@ -158,7 +158,7 @@ module Net
|
|
158
158
|
# Parse the question/zone section.
|
159
159
|
#--------------------------------------------------------------
|
160
160
|
|
161
|
-
if
|
161
|
+
if debug then
|
162
162
|
print "\n"
|
163
163
|
section = (packet.header.opcode == "UPDATE") ? "ZONE" : "QUESTION"
|
164
164
|
print ";; #{section} SECTION (#{packet.header.qdcount} record #{packet.header.qdcount == 1 ? '' : 's'})\n"
|
@@ -184,7 +184,7 @@ module Net
|
|
184
184
|
# }
|
185
185
|
|
186
186
|
packet.push("question", qobj)
|
187
|
-
if
|
187
|
+
if debug then
|
188
188
|
print ";; "
|
189
189
|
print qobj.inspect
|
190
190
|
end
|
@@ -194,7 +194,7 @@ module Net
|
|
194
194
|
# Parse the answer/prerequisite section.
|
195
195
|
#--------------------------------------------------------------
|
196
196
|
|
197
|
-
if
|
197
|
+
if debug then
|
198
198
|
print "\n"
|
199
199
|
section = (packet.header.opcode == "UPDATE") ? "PREREQUISITE" : "ANSWER"
|
200
200
|
print ";; #{section} SECTION (#{packet.header.ancount} record #{packet.header.ancount == 1 ? '' : 's'})\n"
|
@@ -214,14 +214,14 @@ module Net
|
|
214
214
|
end
|
215
215
|
|
216
216
|
packet.push("answer", rrobj)
|
217
|
-
print rrobj.inspect + "\n" if
|
217
|
+
print rrobj.inspect + "\n" if debug
|
218
218
|
}
|
219
219
|
|
220
220
|
#--------------------------------------------------------------
|
221
221
|
# Parse the authority/update section.
|
222
222
|
#--------------------------------------------------------------
|
223
223
|
|
224
|
-
if
|
224
|
+
if debug then
|
225
225
|
print "\n"
|
226
226
|
section = (packet.header.opcode == "UPDATE") ? "UPDATE" : "AUTHORITY"
|
227
227
|
print ";; #{section} SECTION (#{packet.header.nscount} record#{packet.header.nscount == 1 ? '' : 's'})\n"
|
@@ -242,14 +242,14 @@ module Net
|
|
242
242
|
end
|
243
243
|
|
244
244
|
packet.push("authority", rrobj)
|
245
|
-
print rrobj.inspect + "\n" if
|
245
|
+
print rrobj.inspect + "\n" if debug
|
246
246
|
}
|
247
247
|
|
248
248
|
#--------------------------------------------------------------
|
249
249
|
# Parse the additional section.
|
250
250
|
#--------------------------------------------------------------
|
251
251
|
|
252
|
-
if
|
252
|
+
if debug then
|
253
253
|
print "\n";
|
254
254
|
print ";; ADDITIONAL SECTION (#{packet.header.adcount} record#{packet.header.adcount == 1 ? '' : 's'})\n";
|
255
255
|
end
|
@@ -270,7 +270,7 @@ module Net
|
|
270
270
|
|
271
271
|
|
272
272
|
packet.push("additional", rrobj);
|
273
|
-
print rrobj.inspect + "\n" if
|
273
|
+
print rrobj.inspect + "\n" if debug
|
274
274
|
}
|
275
275
|
packet.header= Net::DNS::Header.new(data)
|
276
276
|
return packet
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: pNet-DNS
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date: 2006-
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2006-12-14 00:00:00 +00:00
|
8
8
|
summary: Ruby port of perl Net::DNS
|
9
9
|
require_paths:
|
10
10
|
- lib
|