MCPcopy Create free account
hub / github.com/apache/trafficserver / add_operator

Method add_operator

plugins/header_rewrite/ruleset.cc:75–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75bool
76RuleSet::add_operator(Parser &p, const char *filename, int lineno)
77{
78 Operator *op = operator_factory(p.get_op());
79
80 if (nullptr != op) {
81 Dbg(pi_dbg_ctl, " Adding operator: %s(%s)=\"%s\"", p.get_op().c_str(), p.get_arg().c_str(), p.get_value().c_str());
82 op->initialize(p);
83 if (!op->set_hook(_hook)) {
84 delete op;
85 Dbg(pi_dbg_ctl, "in %s:%d: can't use this operator in hook=%s: %s(%s)", filename, lineno, TSHttpHookNameLookup(_hook),
86 p.get_op().c_str(), p.get_arg().c_str());
87 TSError("[%s] in %s:%d: can't use this operator in hook=%s: %s(%s)", PLUGIN_NAME, filename, lineno,
88 TSHttpHookNameLookup(_hook), p.get_op().c_str(), p.get_arg().c_str());
89 return false;
90 }
91
92 // Work on the appropriate operator list
93 OperatorPair &ops = _is_else ? _operators[1] : _operators[0];
94
95 if (nullptr == ops.oper) {
96 ops.oper = op;
97 } else {
98 ops.oper->append(op);
99 }
100
101 // Update some ruleset state based on this new operator
102 ops.oper_mods = static_cast<OperModifiers>(ops.oper_mods | ops.oper->get_oper_modifiers());
103 _ids = static_cast<ResourceIDs>(_ids | ops.oper->get_resource_ids());
104
105 return true;
106 }
107
108 return false;
109}
110
111ResourceIDs
112RuleSet::get_all_resource_ids() const

Callers 1

parse_configMethod · 0.80

Calls 10

operator_factoryFunction · 0.85
TSHttpHookNameLookupFunction · 0.85
get_oper_modifiersMethod · 0.80
TSErrorFunction · 0.70
c_strMethod · 0.45
get_valueMethod · 0.45
initializeMethod · 0.45
set_hookMethod · 0.45
appendMethod · 0.45
get_resource_idsMethod · 0.45

Tested by

no test coverage detected