Class: Scriptroute::IPv4option
- Inherits:
-
Object
- Object
- Scriptroute::IPv4option
show all
- Defined in:
- lib/scriptroute/packets.rb,
lib/scriptroute/packets.rb
Overview
base class for IPv4 options.
Constant Summary
collapse
- IPOPT_EOOL =
0
- IPOPT_EOL =
deprecated, backward compatibility.
0
- IPOPT_NOOP =
1
- IPOPT_TS =
68
- IPOPT_TIMESTAMP =
IPOPT_TS
- IPOPT_RR =
7
- IPOPT_TS_TSONLY =
0
- IPOPT_TS_TSANDADDR =
1
- IPOPT_TS_PRESPEC =
3
- @@creators =
Hash.new
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(*rest) ⇒ IPv4option
Returns a new instance of IPv4option.
282
283
284
285
286
287
288
289
290
|
# File 'lib/scriptroute/packets.rb', line 282
def initialize(*rest)
if(rest.length == 3) then
@ipt_code = rest[0]
@ipt_len = rest[1]
@ipt_ptr = rest[2]
else
@ipt_code, @ipt_len, @ipt_ptr = rest[0].unpack("CCC")
end
end
|
Instance Attribute Details
#ipt_code ⇒ Fixnum
271
272
273
|
# File 'lib/scriptroute/packets.rb', line 271
def ipt_code
@ipt_code
end
|
#ipt_len ⇒ Fixnum
271
272
273
|
# File 'lib/scriptroute/packets.rb', line 271
def ipt_len
@ipt_len
end
|
#ipt_ptr ⇒ Fixnum
271
272
273
|
# File 'lib/scriptroute/packets.rb', line 271
def ipt_ptr
@ipt_ptr
end
|
Class Method Details
.creator(str) ⇒ Object
274
275
276
277
278
279
280
281
|
# File 'lib/scriptroute/packets.rb', line 274
def IPv4option.creator(str)
ipt_code, ipt_len, ipt_ptr = str.unpack("CCC")
if(@@creators[ipt_code]) then
pkt = (@@creators[ipt_code]).call(str)
else
raise "unknown ip option code %d" % ipt_code
end
end
|
Instance Method Details
#to_s ⇒ String
297
298
299
|
# File 'lib/scriptroute/packets.rb', line 297
def to_s
": opt: code %d len %d ptr %d" % [ @ipt_code, @ipt_len, @ipt_ptr ]
end
|