本文整理汇总了C++中PolicyRule::getSrv方法的典型用法代码示例。如果您正苦于以下问题:C++ PolicyRule::getSrv方法的具体用法?C++ PolicyRule::getSrv怎么用?C++ PolicyRule::getSrv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolicyRule
的用法示例。
在下文中一共展示了PolicyRule::getSrv方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/*
* This rule processor is used to separate TCP service objects that
* match tcp flags when generated config uses object-group clause
*/
bool PolicyCompiler_iosacl::splitTCPServiceWithFlags::processNext()
{
PolicyRule *rule=getNext(); if (rule==nullptr) return false;
RuleElementSrv *srv = rule->getSrv();
if (srv->size() > 1)
{
std::list<FWObject*> cl;
for (list<FWObject*>::iterator i1=srv->begin(); i1!=srv->end(); ++i1)
{
FWObject *o = *i1;
FWObject *obj = nullptr;
if (FWReference::cast(o)!=nullptr) obj=FWReference::cast(o)->getPointer();
Service *s=Service::cast(obj);
assert(s!=nullptr);
TCPService *tcp_srv = TCPService::cast(s);
if (tcp_srv && (tcp_srv->inspectFlags() || tcp_srv->getEstablished()))
cl.push_back(s);
}
while (!cl.empty())
{
PolicyRule *r = compiler->dbcopy->createPolicyRule();
compiler->temp_ruleset->add(r);
r->duplicate(rule);
RuleElementSrv *nsrv = r->getSrv();
nsrv->clearChildren();
nsrv->addRef( cl.front() );
tmp_queue.push_back(r);
srv->removeRef( cl.front() );
cl.pop_front();
}
if (srv->size()>0) tmp_queue.push_back(rule);
} else
tmp_queue.push_back(rule);
return true;
}
示例2: if
bool PolicyCompiler::ConvertToAtomic::processNext()
{
PolicyRule *rule=getNext(); if (rule==NULL) return false;
RuleElementSrc *src=rule->getSrc(); assert(src);
RuleElementDst *dst=rule->getDst(); assert(dst);
RuleElementSrv *srv=rule->getSrv(); assert(srv);
for (FWObject::iterator i1=src->begin(); i1!=src->end(); i1++)
{
for (FWObject::iterator i2=dst->begin(); i2!=dst->end(); i2++)
{
for (FWObject::iterator i3=srv->begin(); i3!=srv->end(); i3++)
{
PolicyRule *r = compiler->dbcopy->createPolicyRule();
r->duplicate(rule);
compiler->temp_ruleset->add(r);
FWObject *s;
s=r->getSrc(); assert(s);
s->clearChildren();
s->addCopyOf( *i1 );
s=r->getDst(); assert(s);
s->clearChildren();
s->addCopyOf( *i2 );
s=r->getSrv(); assert(s);
s->clearChildren();
s->addCopyOf( *i3 );
tmp_queue.push_back(r);
}
}
}
return true;
}
示例3: addSrv
void PFImporter::addSrv()
{
PolicyRule *rule = PolicyRule::cast(current_rule);
addServiceObjectsToRE(rule->getSrv());
}
示例4: getNext
bool PolicyCompiler_pix::matchTranslatedAddresses::processNext()
{
PolicyRule *rule = getNext(); if (rule==nullptr) return false;
string version = compiler->fw->getStr("version");
transformed_rules.clear();
RuleElementSrc *srcrel = rule->getSrc();
RuleElementDst *dstrel = rule->getDst();
RuleElementSrv *srvrel = rule->getSrv();
for (list<FWObject*>::iterator i1=srcrel->begin(); i1!=srcrel->end(); ++i1)
{
for (list<FWObject*>::iterator i2=dstrel->begin(); i2!=dstrel->end(); ++i2)
{
for (list<FWObject*>::iterator i3=srvrel->begin(); i3!=srvrel->end(); ++i3)
{
FWObject *o1 = *i1;
FWObject *o2 = *i2;
FWObject *o3 = *i3;
FWObject *obj1 = nullptr;
FWObject *obj2 = nullptr;
FWObject *obj3 = nullptr;
obj1 = FWReference::getObject(o1);
Address *src = Address::cast(obj1);
assert(src!=nullptr);
obj2 = FWReference::getObject(o2);
Address *dst = Address::cast(obj2);
assert(dst!=nullptr);
obj3 = FWReference::getObject(o3);
Service *srv = Service::cast(obj3);
assert(srv!=nullptr);
list<NATRule*> tl = findMatchingNATRules(src, dst, srv);
for( list<NATRule*>::iterator t=tl.begin(); t!=tl.end(); ++t)
action(rule, *t, src, dst, srv);
}
}
}
/*
*list transformed_rules has all the atomic rules that have a matching
* NAT rule, with dst and srv already converted. We just add them to
* the policy on top of the original rule.
*/
list<PolicyRule*>::iterator i1;
for (i1=transformed_rules.begin(); i1!=transformed_rules.end(); ++i1)
{
PolicyRule *r=PolicyRule::cast( *i1 );
tmp_queue.push_back(r);
}
tmp_queue.push_back(rule);
return true;
}
示例5: assert
void PolicyCompiler_pix::replaceTranslatedAddresses::action(
PolicyRule* policy_rule,
NATRule* nat_rule, Address *src, Address*, Service *srv)
{
// FWObject *rule_iface = compiler->dbcopy->findInIndex(
// policy_rule->getInterfaceId());
RuleElementItf *intf_re = policy_rule->getItf();
FWObject *rule_iface = FWObjectReference::getObject(intf_re->front());
RuleElement *re = nat_rule->getOSrc();
FWObject *o = FWReference::getObject(re->front());
#ifndef NDEBUG
Address *osrc = Address::cast(o); assert(osrc);
#endif
re = nat_rule->getODst();
o = FWReference::getObject(re->front());
Address *odst = Address::cast(o); assert(odst);
re = nat_rule->getOSrv();
o = FWReference::getObject(re->front());
Service *osrv = Service::cast(o); assert(osrv);
#ifndef NDEBUG
re = nat_rule->getTSrc();
o = FWReference::getObject(re->front());
Address *tsrc = Address::cast(o); assert(tsrc);
re = nat_rule->getTDst();
o = FWReference::getObject(re->front());
Address *tdst = Address::cast(o); assert(tdst);
re = nat_rule->getTSrv();
o = FWReference::getObject(re->front());
Service *tsrv = Service::cast(o); assert(tsrv);
#endif
FWObject *p = odst->getParent();
if (odst->getId() == rule_iface->getId() ||
p->getId() == rule_iface->getId())
{
PolicyRule *r = compiler->dbcopy->createPolicyRule();
compiler->temp_ruleset->add(r);
r->duplicate(policy_rule);
RuleElementSrc *nsrc = r->getSrc();
nsrc->clearChildren();
nsrc->addRef( src );
RuleElementDst *ndst = r->getDst();
ndst->clearChildren();
ndst->addRef( odst );
RuleElementSrv *nsrv = r->getSrv();
nsrv->clearChildren();
if (osrv->isAny())
nsrv->addRef( srv );
else
nsrv->addRef( osrv );
transformed_rules.push_back(r);
}
}