Class: TCWrapper::Filter
- Inherits:
-
Wrapper
- Object
- Wrapper
- TCWrapper::Filter
- Defined in:
- lib/distem/wrapper/tc/filter.rb
Direct Known Subclasses
Constant Summary
- WTYPE =
"filter"
Constants inherited from Wrapper
Instance Attribute Summary (collapse)
-
- (Object) id
readonly
Returns the value of attribute id.
-
- (Object) parentid
readonly
Returns the value of attribute parentid.
Instance Method Summary (collapse)
- - (Object) add_filter_param(name, val)
- - (Object) get_cmd(*args)
- - (Object) get_filter_params
-
- (Filter) initialize(iface, parent, dest, protocol, prio, type, params)
constructor
A new instance of Filter.
Methods inherited from Wrapper
Constructor Details
- (Filter) initialize(iface, parent, dest, protocol, prio, type, params)
Returns a new instance of Filter
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/distem/wrapper/tc/filter.rb', line 9 def initialize(iface,parent,dest,protocol,prio,type,params) super(iface,WTYPE,type,params) @parent = parent @dest = dest @protocol = protocol @prio = prio @filterparams = {} @id = Id.new(@parent.id.major,@parent.id.next_minor_id) @parentid = @parent.id if (@dest.kind_of? Qdisc) @destid = @dest.parentid else @destid = @dest.id end end |
Instance Attribute Details
- (Object) id (readonly)
Returns the value of attribute id
7 8 9 |
# File 'lib/distem/wrapper/tc/filter.rb', line 7 def id @id end |
- (Object) parentid (readonly)
Returns the value of attribute parentid
7 8 9 |
# File 'lib/distem/wrapper/tc/filter.rb', line 7 def parentid @parentid end |
Instance Method Details
- (Object) add_filter_param(name, val)
41 42 43 |
# File 'lib/distem/wrapper/tc/filter.rb', line 41 def add_filter_param(name,val) @filterparams[name] = val end |
- (Object) get_cmd(*args)
26 27 28 29 30 31 32 33 |
# File 'lib/distem/wrapper/tc/filter.rb', line 26 def get_cmd(*args) super(*args) \ + ((@parent.kind_of? QdiscRoot) ? \ "root" : "parent " + @parentid.to_s) \ + " protocol " + @protocol + (@prio > 0 ? " prio " + @prio.to_s : "") \ + " " + @type + " " + get_filter_params + " flowid " + @destid.to_s \ + " " + get_params end |
- (Object) get_filter_params
35 36 37 38 39 |
# File 'lib/distem/wrapper/tc/filter.rb', line 35 def get_filter_params ret = "" @filterparams.each{ |name,val| ret += name + " " + val.to_s + " "} return ret end |