Class: Trema::Stats

Inherits:
Object
  • Object
show all
Defined in:
ruby/trema/cli.rb

Defined Under Namespace

Classes: Packet

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ip_dst, tp_dst, ip_src, tp_src, n_pkts, n_octets) ⇒ Stats

Returns a new instance of Stats.



38
39
40
41
42
43
44
45
# File 'ruby/trema/cli.rb', line 38

def initialize ip_dst, tp_dst, ip_src, tp_src, n_pkts, n_octets
  @ip_dst = ip_dst
  @tp_dst = tp_dst.to_i
  @ip_src = ip_src
  @tp_src = tp_src.to_i
  @n_pkts = n_pkts.to_i
  @n_octets = n_octets.to_i
end

Instance Attribute Details

#ip_dstObject (readonly)

Returns the value of attribute ip_dst.



30
31
32
# File 'ruby/trema/cli.rb', line 30

def ip_dst
  @ip_dst
end

#ip_srcObject (readonly)

Returns the value of attribute ip_src.



32
33
34
# File 'ruby/trema/cli.rb', line 32

def ip_src
  @ip_src
end

#n_octetsObject (readonly)

Returns the value of attribute n_octets.



35
36
37
# File 'ruby/trema/cli.rb', line 35

def n_octets
  @n_octets
end

#n_pktsObject (readonly)

Returns the value of attribute n_pkts.



34
35
36
# File 'ruby/trema/cli.rb', line 34

def n_pkts
  @n_pkts
end

#tp_dstObject (readonly)

Returns the value of attribute tp_dst.



31
32
33
# File 'ruby/trema/cli.rb', line 31

def tp_dst
  @tp_dst
end

#tp_srcObject (readonly)

Returns the value of attribute tp_src.



33
34
35
# File 'ruby/trema/cli.rb', line 33

def tp_src
  @tp_src
end

Instance Method Details

#packetsObject



48
49
50
51
52
53
54
# File 'ruby/trema/cli.rb', line 48

def packets
  list = []
  @n_pkts.times do
    list << Packet.new
  end
  list
end