Class: Jruby::Pcap::Packet

Inherits:
Object
  • Object
show all
Defined in:
lib/jruby-pcap/packet.rb

Instance Method Summary collapse

Constructor Details

#initialize(packet, handle) ⇒ Packet

Returns a new instance of Packet.



6
7
8
9
# File 'lib/jruby-pcap/packet.rb', line 6

def initialize(packet, handle)
  @packet = packet
  @handle = handle
end

Instance Method Details

#ipv4Object



15
16
17
# File 'lib/jruby-pcap/packet.rb', line 15

def ipv4
  Frame.new(@handle, @packet.get(IpV4Packet))
end

#timestampObject



11
12
13
# File 'lib/jruby-pcap/packet.rb', line 11

def timestamp
  @handle.get_timestamp_ints * 1000
end

#to_sObject



19
20
21
# File 'lib/jruby-pcap/packet.rb', line 19

def to_s
  @packet.to_s
end