Class: EventMachine::SFlow::IPv4Data

Inherits:
Object
  • Object
show all
Defined in:
lib/em-sflow/packet/ipv4_data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ IPv4Data

Returns a new instance of IPv4Data.



4
5
6
7
8
9
10
11
12
# File 'lib/em-sflow/packet/ipv4_data.rb', line 4

def initialize data
  data.extend EventMachine::SFlow::BinaryString

  @length, @protocol, src, dst, @src_port, @dst_port, @tcp_flags, @tos = data.unpack("NNNNNNNN")
  data.advance(32)

  @src_ip = IPAddr.new(src, Socket::AF_INET)
  @dst_ip = IPAddr.new(dst, Socket::AF_INET)
end

Instance Attribute Details

#dst_ipObject

Returns the value of attribute dst_ip.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def dst_ip
  @dst_ip
end

#dst_portObject

Returns the value of attribute dst_port.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def dst_port
  @dst_port
end

#lengthObject

Returns the value of attribute length.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def length
  @length
end

#protocolObject

Returns the value of attribute protocol.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def protocol
  @protocol
end

#src_ipObject

Returns the value of attribute src_ip.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def src_ip
  @src_ip
end

#src_portObject

Returns the value of attribute src_port.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def src_port
  @src_port
end

#tcp_flagsObject

Returns the value of attribute tcp_flags.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def tcp_flags
  @tcp_flags
end

#tosObject

Returns the value of attribute tos.



2
3
4
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2

def tos
  @tos
end