Class: TCWrapper::Qdisc

Inherits:
Wrapper show all
Defined in:
lib/distem/wrapper/tc/qdisc.rb

Direct Known Subclasses

QdiscHTB, QdiscNetem, QdiscPrio, QdiscSFQ, QdiscTBF

Constant Summary

WTYPE =
"qdisc"

Constants inherited from Wrapper

Wrapper::CMDBIN

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Wrapper

#add_param, #get_params

Constructor Details

- (Qdisc) initialize(iface, parent, type, params)

Returns a new instance of Qdisc



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/distem/wrapper/tc/qdisc.rb', line 9

def initialize(iface,parent,type,params)
  super(iface,WTYPE,type,params)
  @parent = parent
  #Here @id corresponds to the handle of the current qdisc
  if (@parent.kind_of? QdiscRoot)
    @id = Id.new(@parent.id.major,0)
  else
    @id = Id.new(Id.get_unique_major_id(iface),0)
  end

  if (@parent.kind_of? Class)
    @parentid = @parent.id
  else
    @parentid = Id.new(@parent.id.major,@parent.id.next_minor_id)
  end
end

Instance Attribute Details

- (Object) id (readonly)

Returns the value of attribute id



8
9
10
# File 'lib/distem/wrapper/tc/qdisc.rb', line 8

def id
  @id
end

- (Object) parentid (readonly)

Returns the value of attribute parentid



8
9
10
# File 'lib/distem/wrapper/tc/qdisc.rb', line 8

def parentid
  @parentid
end

Instance Method Details

- (Object) get_cmd(*args)



26
27
28
29
30
31
# File 'lib/distem/wrapper/tc/qdisc.rb', line 26

def get_cmd(*args)
  super(*args) \
    + ((@parent.kind_of? QdiscRoot) ? \
       "root" : "parent " + @parentid.to_s) \
       + " handle " + @id.to_s + " " + @type + " " + get_params
end