Module: Pcap::Savefile::EasyIO
- Included in:
- GlobalHeader, GlobalHeader, Packet, Packet
- Defined in:
- lib/pcap/savefile.rb
Overview
helper
Instance Method Summary collapse
- #i32(io) ⇒ Object
- #u16(io) ⇒ Object
- #u32(io) ⇒ Object
- #wi32(io, i32) ⇒ Object
- #wu16(io, u16) ⇒ Object
-
#wu32(io, u32) ⇒ Object
write in little endian order.
Instance Method Details
#i32(io) ⇒ Object
31 32 33 |
# File 'lib/pcap/savefile.rb', line 31 def i32(io) io.read(4).unpack("l")[0] end |
#u16(io) ⇒ Object
35 36 37 |
# File 'lib/pcap/savefile.rb', line 35 def u16(io) io.read(2).unpack("v")[0] end |
#u32(io) ⇒ Object
27 28 29 |
# File 'lib/pcap/savefile.rb', line 27 def u32(io) io.read(4).unpack("V")[0] end |
#wi32(io, i32) ⇒ Object
17 18 19 20 |
# File 'lib/pcap/savefile.rb', line 17 def wi32(io, i32) s = [i32].pack("l") io.write(s) end |
#wu16(io, u16) ⇒ Object
22 23 24 25 |
# File 'lib/pcap/savefile.rb', line 22 def wu16(io, u16) s = [u16].pack("v") io.write(s) end |
#wu32(io, u32) ⇒ Object
write in little endian order
12 13 14 15 |
# File 'lib/pcap/savefile.rb', line 12 def wu32(io, u32) s = [u32].pack("V") io.write(s) end |