Class: EventMachine::SFlow::IPv6Data

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ IPv6Data

Returns a new instance of IPv6Data.



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/em-sflow/packet/ipv6_data.rb', line 4

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

  @length, @protocol = data.unpack("NN")
  data.advance(8)

  src = data.unpack("NNNN")
  @src_ip = IPAddr.new((src[0] << 96) + (src[1] << 64) + (src[2] << 32) + src[3], Socket::AF_INET6)
  data.advance(16)

  dst = data.unpack("NNNN")
  @dst_ip = IPAddr.new((dst[0] << 96) + (dst[1] << 64) + (dst[2] << 32) + dst[3], Socket::AF_INET6)
  data.advance(16)

  @src_port, @dst_port, @tcp_flags, @priority = data.unpack("NNNN")
  data.advance(16)
end

Instance Attribute Details

#dst_ipObject

Returns the value of attribute dst_ip.



2
3
4
# File 'lib/em-sflow/packet/ipv6_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/ipv6_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/ipv6_data.rb', line 2

def length
  @length
end

#priorityObject

Returns the value of attribute priority.



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

def priority
  @priority
end

#protocolObject

Returns the value of attribute protocol.



2
3
4
# File 'lib/em-sflow/packet/ipv6_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/ipv6_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/ipv6_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/ipv6_data.rb', line 2

def tcp_flags
  @tcp_flags
end