本文整理汇总了C++中PolicyRule::getBranch方法的典型用法代码示例。如果您正苦于以下问题:C++ PolicyRule::getBranch方法的具体用法?C++ PolicyRule::getBranch怎么用?C++ PolicyRule::getBranch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolicyRule
的用法示例。
在下文中一共展示了PolicyRule::getBranch方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _findWhereObjectIsUsed
bool FWObjectDatabase::_findWhereObjectIsUsed(FWObject *o,
FWObject *p,
std::set<FWObject *> &resset,
int search_id)
{
bool res = false;
if ( _isInIgnoreList(p)) return res;
if (p->size()==0) return res;
if (p->getInt(".search_id")==search_id) return p->getBool(".searchResult");
// set flags to break indefinite recursion in case we encounter circular groups
p->setInt(".search_id", search_id);
p->setBool(".searchResult", false);
Interface *intf = Interface::cast(p);
if (intf)
{
string netzone_id = intf->getStr("network_zone");
FWObject *netzone = findInIndex(FWObjectDatabase::getIntId(netzone_id));
if (netzone == o)
{
resset.insert(p);
res = true;
}
}
PolicyRule *rule = PolicyRule::cast(p);
if (rule)
{
if (rule->getAction() == PolicyRule::Branch)
{
FWObject *ruleset = rule->getBranch();
if (o==ruleset)
{
resset.insert(p);
res = true;
}
}
if (rule->getTagging())
{
FWObject *tagobj = rule->getTagObject();
if (o==tagobj)
{
resset.insert(p);
res = true;
}
}
}
NATRule *nat_rule = NATRule::cast(p);
if (nat_rule && nat_rule->getAction() == NATRule::Branch)
{
FWObject *ruleset = nat_rule->getBranch();
if (o==ruleset)
{
resset.insert(p);
res = true;
}
}
if (Firewall::isA(o) && Cluster::isA(p))
{
if (Cluster::cast(p)->hasMember(Firewall::cast(o)))
{
resset.insert(p);
res = true;
}
}
FWObject::iterator i1 = p->begin();
for ( ; i1!=p->end(); ++i1)
{
FWReference *ref = FWReference::cast(*i1);
if (ref!=nullptr)
{ // child is a reference
FWObject *g = ref->getPointer();
if (o->getId() == g->getId())
{
resset.insert(*i1);
res = true;
}
}
else // child is a regular object, not a reference
{
if (o->getId() == (*i1)->getId())
{
resset.insert(p);
res = true;
// still run search recursively, the same object could be
// used in rules if it is a firewall
}
_findWhereObjectIsUsed(o, *i1, resset, search_id);
}
}
p->setBool(".searchResult", res);
return res;
}