Class: DIY::PacketEx

Inherits:
Object
  • Object
show all
Defined in:
lib/diy/pcap.rb

Constant Summary collapse

SEND =
1
RECV =
0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pkt, pos, filename = nil) ⇒ PacketEx

Returns a new instance of PacketEx.



113
114
115
116
117
# File 'lib/diy/pcap.rb', line 113

def initialize( pkt, pos, filename = nil )
  @pkt = pkt
  @pos = pos
  @filename = filename
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



131
132
133
# File 'lib/diy/pcap.rb', line 131

def filename
  @filename
end

#pktObject (readonly)

Returns the value of attribute pkt.



131
132
133
# File 'lib/diy/pcap.rb', line 131

def pkt
  @pkt
end

#posObject (readonly)

Returns the value of attribute pos.



131
132
133
# File 'lib/diy/pcap.rb', line 131

def pos
  @pos
end

Instance Method Details

#sizeObject



127
128
129
# File 'lib/diy/pcap.rb', line 127

def size
  @pkt.size
end

#to_inner?Boolean

Returns:

  • (Boolean)


123
124
125
# File 'lib/diy/pcap.rb', line 123

def to_inner?
  @pos == RECV
end

#to_outer?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/diy/pcap.rb', line 119

def to_outer?
  @pos == SEND
end