Class: EventMachine::SFlow::FlowSample

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ FlowSample

Returns a new instance of FlowSample.



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

def initialize data
  data.extend EM::SFlow::BinaryString
  data.extend EM::SFlow::FlowRecord
  
  @records = []
  
  @sequence_number, source_id_class_value, @sampling_rate, @sample_pool, @drop_count, @input_count, @output_count, record_count = data.unpack("NNNNNNNN")
  
  @source_class = source_id_class_value >> 24
  @source_value = source_id_class_value & (2 ** 24 - 1)
  
  data.advance(32)
  
  @records = data.to_flow_records!(record_count)
end

Instance Attribute Details

#drop_countObject

Returns the value of attribute drop_count.



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

def drop_count
  @drop_count
end

#input_countObject

Returns the value of attribute input_count.



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

def input_count
  @input_count
end

#output_countObject

Returns the value of attribute output_count.



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

def output_count
  @output_count
end

#recordsObject

Returns the value of attribute records.



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

def records
  @records
end

#sample_poolObject

Returns the value of attribute sample_pool.



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

def sample_pool
  @sample_pool
end

#sampling_rateObject

Returns the value of attribute sampling_rate.



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

def sampling_rate
  @sampling_rate
end

#sequence_numberObject

Returns the value of attribute sequence_number.



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

def sequence_number
  @sequence_number
end

#source_classObject

Returns the value of attribute source_class.



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

def source_class
  @source_class
end

#source_valueObject

Returns the value of attribute source_value.



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

def source_value
  @source_value
end