Class: Spcap::Packet
- Inherits:
-
Object
- Object
- Spcap::Packet
- Defined in:
- lib/spcap/packet.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#caplen ⇒ Object
readonly
Returns the value of attribute caplen.
-
#datalink ⇒ Object
readonly
Returns the value of attribute datalink.
-
#len ⇒ Object
readonly
Returns the value of attribute len.
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(time, data, len, datalink) ⇒ Packet
constructor
A new instance of Packet.
- #ip? ⇒ Boolean
- #length ⇒ Object
- #size ⇒ Object
- #tcp? ⇒ Boolean
- #time_i ⇒ Object
- #udp? ⇒ Boolean
Constructor Details
#initialize(time, data, len, datalink) ⇒ Packet
Returns a new instance of Packet.
5 6 7 8 9 10 11 |
# File 'lib/spcap/packet.rb', line 5 def initialize(time,data,len,datalink) @time = time @raw_data = data @caplen = data.length @len = len @datalink = datalink end |
Instance Attribute Details
#caplen ⇒ Object (readonly)
Returns the value of attribute caplen.
3 4 5 |
# File 'lib/spcap/packet.rb', line 3 def caplen @caplen end |
#datalink ⇒ Object (readonly)
Returns the value of attribute datalink.
3 4 5 |
# File 'lib/spcap/packet.rb', line 3 def datalink @datalink end |
#len ⇒ Object (readonly)
Returns the value of attribute len.
3 4 5 |
# File 'lib/spcap/packet.rb', line 3 def len @len end |
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
3 4 5 |
# File 'lib/spcap/packet.rb', line 3 def raw_data @raw_data end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
3 4 5 |
# File 'lib/spcap/packet.rb', line 3 def time @time end |
Instance Method Details
#length ⇒ Object
14 |
# File 'lib/spcap/packet.rb', line 14 def length ; @len; end |
#size ⇒ Object
13 |
# File 'lib/spcap/packet.rb', line 13 def size ; @len; end |
#time_i ⇒ Object
18 |
# File 'lib/spcap/packet.rb', line 18 def time_i ; self.time.to_i ; end |
#udp? ⇒ Boolean
17 |
# File 'lib/spcap/packet.rb', line 17 def udp? ; self.kind_of?(UDPPacket) ; end |