Class: TCWrapper::FilterU32
Constant Summary
- TYPE =
"u32"
- U32_MATCH =
"match"
- U32T_U8 =
"u8"
- U32T_U32 =
"u32"
- U32T_IP =
"ip"
- U32M_IP_DST =
"ip dst"
- U32M_IP_SRC =
"ip src"
- U32M_U32 =
"u32"
Constants inherited from Filter
Constants inherited from Wrapper
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary (collapse)
- - (Object) add_match_ip_dst(ip)
- - (Object) add_match_ip_src(ip)
- - (Object) add_match_u32(value, mask)
-
- (FilterU32) initialize(iface, parent, dest, protocol = Protocol::IP, prio = 0, params = Hash.new)
constructor
A new instance of FilterU32.
-
- (Object) parse_params
params such as: { FilterU32::U32T_IP => [“ip protocol 6 0xff”, “ip sport 80 0xffff”], FilterU32::U32T_U32 => [“0x48545450 0xffffffff at 52”] }.
Methods inherited from Filter
#add_filter_param, #get_cmd, #get_filter_params
Methods inherited from Wrapper
#add_param, #get_cmd, #get_params
Constructor Details
- (FilterU32) initialize(iface, parent, dest, protocol = Protocol::IP, prio = 0, params = Hash.new)
Returns a new instance of FilterU32
17 18 19 20 |
# File 'lib/distem/wrapper/tc/filteru32.rb', line 17 def initialize(iface,parent,dest,protocol=Protocol::IP,prio=0,params=Hash.new) super(iface,parent,dest,protocol,prio,TYPE,params) parse_params end |
Instance Method Details
- (Object) add_match_ip_dst(ip)
43 44 45 46 |
# File 'lib/distem/wrapper/tc/filteru32.rb', line 43 def add_match_ip_dst(ip) add_filter_param(U32_MATCH,U32M_IP_DST + " " + ip) return self end |
- (Object) add_match_ip_src(ip)
48 49 50 51 |
# File 'lib/distem/wrapper/tc/filteru32.rb', line 48 def add_match_ip_src(ip) add_filter_param(U32_MATCH,U32M_IP_SRC + " " + ip) return self end |
- (Object) add_match_u32(value, mask)
38 39 40 41 |
# File 'lib/distem/wrapper/tc/filteru32.rb', line 38 def add_match_u32(value,mask) add_filter_param(U32_MATCH,U32M_U32 + " " + value + " " + mask) return self end |
- (Object) parse_params
params such as:
FilterU32::U32T_IP => ["ip protocol 6 0xff", "ip sport 80 0xffff"],
FilterU32::U32T_U32 => ["0x48545450 0xffffffff at 52"]
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/distem/wrapper/tc/filteru32.rb', line 27 def parse_params oldparams = @params.dup @params.clear oldparams.each do |name,values| values.each do |value| add_param(name,value) end end end |