Class: EventMachine::SFlow::IPv4Data
- Inherits:
-
Object
- Object
- EventMachine::SFlow::IPv4Data
- Defined in:
- lib/em-sflow/packet/ipv4_data.rb
Instance Attribute Summary collapse
-
#dst_ip ⇒ Object
Returns the value of attribute dst_ip.
-
#dst_port ⇒ Object
Returns the value of attribute dst_port.
-
#length ⇒ Object
Returns the value of attribute length.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#src_ip ⇒ Object
Returns the value of attribute src_ip.
-
#src_port ⇒ Object
Returns the value of attribute src_port.
-
#tcp_flags ⇒ Object
Returns the value of attribute tcp_flags.
-
#tos ⇒ Object
Returns the value of attribute tos.
Instance Method Summary collapse
-
#initialize(data) ⇒ IPv4Data
constructor
A new instance of IPv4Data.
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_ip ⇒ Object
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_port ⇒ Object
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 |
#length ⇒ Object
Returns the value of attribute length.
2 3 4 |
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2 def length @length end |
#protocol ⇒ Object
Returns the value of attribute protocol.
2 3 4 |
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2 def protocol @protocol end |
#src_ip ⇒ Object
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_port ⇒ Object
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_flags ⇒ Object
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 |
#tos ⇒ Object
Returns the value of attribute tos.
2 3 4 |
# File 'lib/em-sflow/packet/ipv4_data.rb', line 2 def tos @tos end |