Class: TCWrapper::Class

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

Direct Known Subclasses

ClassHTB

Constant Summary

WTYPE =
"class"

Constants inherited from Wrapper

Wrapper::CMDBIN

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Wrapper

#add_param, #get_params

Constructor Details

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

Returns a new instance of Class



9
10
11
12
13
14
# File 'lib/distem/wrapper/tc/class.rb', line 9

def initialize(iface,parent,type,params)
  super(iface,WTYPE,type,params)
  @parent = parent
  @id = Id.new(@parent.id.major,@parent.id.next_minor_id)
  @parentid = @parent.id
end

Instance Attribute Details

- (Object) id (readonly)

Returns the value of attribute id



7
8
9
# File 'lib/distem/wrapper/tc/class.rb', line 7

def id
  @id
end

- (Object) parentid (readonly)

Returns the value of attribute parentid



7
8
9
# File 'lib/distem/wrapper/tc/class.rb', line 7

def parentid
  @parentid
end

Instance Method Details

- (Object) get_cmd(*args)



16
17
18
19
20
21
22
23
# File 'lib/distem/wrapper/tc/class.rb', line 16

def get_cmd(*args)
  if (@parent.kind_of? QdiscRoot)
    raise "Can't link a class to root directly"
  end

  super(*args) + "parent " + @parentid.to_s + " classid " + @id.to_s + " " \
    + @type + " " + get_params
end