示例#1
0
 public RuleBuilder(IpTablesSystem system, String nfbpf, Dictionary<int, IpTablesRuleSet> ruleSets, FunctionRegistry functions = null)
 {
     if (functions == null)
     {
         functions = new FunctionRegistry();
     }
     _system = system.System;
     _nfbpf = nfbpf;
     var chainsDict =
         ruleSets.Select((a) => new KeyValuePair<int, IpTablesChainSet>(a.Key, a.Value.Chains))
             .ToDictionary((a) => a.Key, (a) => a.Value);
     _dcr = new DynamicChainRegister(system, chainsDict);
     _formatDb = new DynamicDictionary<object>(_mappings);
     _ruleSets = ruleSets;
     _interpreter = new Interpreter();
     _interpreter.SetVariable("var", _mappings);
     functions.LoadFunctions(_interpreter);
 }