Class: Spcap::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/spcap/factory.rb

Overview

132 Stream Control Transmission Protocol SCTP

Class Method Summary collapse

Class Method Details

.get_packet(time, raw_data, len, linklayer_header_type) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/spcap/factory.rb', line 10

def self.get_packet(time,raw_data,len,linklayer_header_type)
  if ( ( ( raw_data.getbyte(0) & 0xF0) / 16 ) == 4 )
    if raw_data.getbyte(9) == 6 
      return TCPPacket.new(time,raw_data,len,linklayer_header_type)
    end
  end
  
  p = Packet.new(time,raw_data,len,linklayer_header_type)
  Logger.warn "Spcap::Factory only support TCP over IPv4 packet other packet are dropped Packet Headher : [#{raw_data[0,16].unpack("H*").first}]"
  return p
end