[Xorp-hackers] [PATCH 1/2] trivial: ws fixes
igorm at etf.rs
igorm at etf.rs
Tue Apr 10 05:59:01 PDT 2012
From: Igor Maravic <igorm at etf.rs>
Signed-off-by: Igor Maravic <igorm at etf.rs>
---
xorp/policy/backend/policy_redist_map.cc | 10 +-
xorp/policy/backend/single_varrw.cc | 8 +-
xorp/policy/code.cc | 4 +-
xorp/policy/code.hh | 6 +-
xorp/policy/code_list.cc | 4 +-
xorp/policy/code_list.hh | 4 +-
xorp/policy/configuration.cc | 116 ++++++++++++++--------------
xorp/policy/filter_manager.cc | 88 +++++++++++-----------
xorp/policy/policy_list.cc | 62 ++++++++--------
xorp/policy/source_match_code_generator.cc | 26 +++---
xorp/rib/rt_tab_pol_conn.cc | 38 +++++-----
xorp/rib/rt_tab_pol_redist.cc | 30 ++++----
xorp/rib/xrl_target.cc | 12 ++--
13 files changed, 204 insertions(+), 204 deletions(-)
diff --git a/xorp/policy/backend/policy_redist_map.cc b/xorp/policy/backend/policy_redist_map.cc
index 1f8bf37..6829b44 100644
--- a/xorp/policy/backend/policy_redist_map.cc
+++ b/xorp/policy/backend/policy_redist_map.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -35,7 +35,7 @@ PolicyRedistMap::~PolicyRedistMap() {
void
PolicyRedistMap::insert(const string& protocol, const PolicyTags& tags) {
PolicyTags* ptags;
-
+
Map::iterator i = _map.find(protocol);
// create new policytags [first time we insert]
@@ -44,7 +44,7 @@ PolicyRedistMap::insert(const string& protocol, const PolicyTags& tags) {
_map[protocol] = ptags;
return;
}
-
+
ptags = (*i).second;
// just append the tags
@@ -62,7 +62,7 @@ PolicyRedistMap::get_protocols(set<string>& out, const PolicyTags& tags) {
// XXX: maybe caller would like to control this
out.clear();
-
+
// go through all our tags.
for(Map::iterator i = _map.begin(); i != _map.end(); ++i) {
PolicyTags* ptags = (*i).second;
diff --git a/xorp/policy/backend/single_varrw.cc b/xorp/policy/backend/single_varrw.cc
index 4937020..5cf3cc7 100644
--- a/xorp/policy/backend/single_varrw.cc
+++ b/xorp/policy/backend/single_varrw.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -125,7 +125,7 @@ SingleVarRW::sync()
// clear cache
memset(&_elems, 0, sizeof(_elems));
-
+
// delete all garbage
for (unsigned i = 0; i < _trashc; i++)
delete _trash[i];
@@ -152,7 +152,7 @@ SingleVarRW::initialize(const Id& id, Element* e)
// particular case].
if(!e)
e = new ElemNull();
-
+
_elems[id] = e;
// we own the pointers.
diff --git a/xorp/policy/code.cc b/xorp/policy/code.cc
index ce80f70..ce8593c 100644
--- a/xorp/policy/code.cc
+++ b/xorp/policy/code.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
diff --git a/xorp/policy/code.hh b/xorp/policy/code.hh
index f3bda5c..8189857 100644
--- a/xorp/policy/code.hh
+++ b/xorp/policy/code.hh
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -65,7 +65,7 @@ public:
*
* @return true if target is less than argument
* @param rhs target to compare with
- */
+ */
bool operator<(const Target& rhs) const;
bool operator==(const Target& rhs) const;
diff --git a/xorp/policy/code_list.cc b/xorp/policy/code_list.cc
index 80a12a2..7057ac6 100644
--- a/xorp/policy/code_list.cc
+++ b/xorp/policy/code_list.cc
@@ -7,13 +7,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
diff --git a/xorp/policy/code_list.hh b/xorp/policy/code_list.hh
index 15062cf..2ae2d9f 100644
--- a/xorp/policy/code_list.hh
+++ b/xorp/policy/code_list.hh
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
diff --git a/xorp/policy/configuration.cc b/xorp/policy/configuration.cc
index c61392b..00b524e 100644
--- a/xorp/policy/configuration.cc
+++ b/xorp/policy/configuration.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -30,7 +30,7 @@
using namespace policy_utils;
-Configuration::Configuration(ProcessWatchBase& pw) :
+Configuration::Configuration(ProcessWatchBase& pw) :
_currtag(0), _varmap(pw), _filter_manager(NULL)
{
}
@@ -53,15 +53,15 @@ Configuration::~Configuration()
//
_policies.clear();
}
-
-Term&
+
+Term&
Configuration::find_term(const string& policy, const string& term)
{
const PolicyStatement& ps = _policies.find(policy);
return ps.find_term(term);
}
-void
+void
Configuration::delete_term(const string& policy, const string& term)
{
PolicyStatement& ps = _policies.find(policy);
@@ -71,12 +71,12 @@ Configuration::delete_term(const string& policy, const string& term)
policy_modified(policy);
return;
- }
+ }
xorp_throw(ConfError, "TERM NOT FOUND " + policy + " " + term);
}
-
-void
+
+void
Configuration::update_term_block(const string& policy,
const string& term,
const uint32_t& block,
@@ -91,9 +91,9 @@ Configuration::update_term_block(const string& policy,
string err = "In policy " + policy + ": " + e.why();
xorp_throw(ConfError, err);
}
-}
+}
-void
+void
Configuration::create_term(const string& policy, const ConfigNodeId& order,
const string& term)
{
@@ -117,7 +117,7 @@ Configuration::create_policy(const string& policy)
_modified_policies.insert(policy);
}
-void
+void
Configuration::delete_policy(const string& policy)
{
_policies.delete_policy(policy);
@@ -126,27 +126,27 @@ Configuration::delete_policy(const string& policy)
_modified_policies.erase(policy);
}
-void
+void
Configuration::create_set(const string& set)
{
_sets.create(set);
-}
+}
-void
-Configuration::update_set(const string& type, const string& set,
+void
+Configuration::update_set(const string& type, const string& set,
const string& elements)
{
// policies affected will be marked as modified.
_sets.update_set(type, set, elements, _modified_policies);
-}
+}
-void
+void
Configuration::delete_set(const string& set)
{
// if we manage to delete a set, it is not in use, so no updates are
// necessary to filters / configuration.
_sets.delete_set(set);
-}
+}
void
Configuration::add_to_set(const string& type, const string& set,
@@ -164,7 +164,7 @@ Configuration::delete_from_set(const string& type, const string& set,
_sets.delete_from_set(type, set, element, _modified_policies);
}
-void
+void
Configuration::update_imports(const string& protocol, const POLICIES& imports,
const string& mod)
{
@@ -176,8 +176,8 @@ Configuration::update_imports(const string& protocol, const POLICIES& imports,
_modified_targets.insert(Code::Target(protocol, filter::IMPORT));
}
-void
-Configuration::update_exports(const string& protocol,
+void
+Configuration::update_exports(const string& protocol,
const POLICIES& exports,
const string& mod)
{
@@ -224,8 +224,8 @@ Configuration::clear_exports(const string& protocol)
_modified_targets.insert(Code::Target(protocol, filter::EXPORT));
}
-string
-Configuration::str()
+string
+Configuration::str()
{
ostringstream conf;
/*
@@ -233,7 +233,7 @@ for(PolicyMap::iterator i = _policies.begin();
i != _policies.end(); ++i) {
conf += ((*i).second)->str();
-}
+}
for(SetMap::iterator i = _sets.begin();
i != _sets.end(); ++i) {
@@ -280,7 +280,7 @@ return conf;
return conf.str();
}
-void
+void
Configuration::update_dependencies(PolicyStatement& policy)
{
// check if used sets & policies exist, and mark dependencies.
@@ -289,7 +289,7 @@ Configuration::update_dependencies(PolicyStatement& policy)
policy.accept(dep);
}
-void
+void
Configuration::compile_policy(const string& name)
{
PolicyStatement& policy = _policies.find(name);
@@ -301,7 +301,7 @@ Configuration::compile_policy(const string& name)
update_dependencies(policy);
// save old tag to check for integer overflow
- tag_t old_currtag = _currtag;
+ tag_t old_currtag = _currtag;
// go through all the import statements
_imports.compile(policy, _modified_targets, _currtag, _protocol_tags);
@@ -315,11 +315,11 @@ Configuration::compile_policy(const string& name)
XLOG_FATAL("The un-avoidable occurred: We ran out of policy tags");
}
-void
+void
Configuration::compile_policies()
{
// integer overflow check
- tag_t old_currtag = _currtag;
+ tag_t old_currtag = _currtag;
// compile all modified policies
for (PolicySet::iterator i = _modified_policies.begin();
@@ -345,7 +345,7 @@ Configuration::compile_policies()
}
}
-void
+void
Configuration::link_sourcematch_code(const Code::Target& target)
{
// create empty code but only with target set.
@@ -367,14 +367,14 @@ Configuration::link_sourcematch_code(const Code::Target& target)
// if there is nothing, keep it deleted and empty.
- if(code->code() == "")
+ if(code->code() == "")
delete code;
else {
_sourcematch_filters[target.protocol()] = code;
- }
+ }
}
-void
+void
Configuration::update_tagmap(const string& protocol)
{
// delete previous tags if present
@@ -397,7 +397,7 @@ Configuration::update_tagmap(const string& protocol)
delete tagset;
}
-void
+void
Configuration::link_code()
{
// go through all modified targets and relink them.
@@ -410,11 +410,11 @@ Configuration::link_code()
case filter::IMPORT:
link_code(t,_imports,_import_filters);
break;
-
+
case filter::EXPORT_SOURCEMATCH:
link_sourcematch_code(t);
break;
-
+
case filter::EXPORT:
link_code(t,_exports,_export_filters);
// export policies produce tags, update them.
@@ -432,7 +432,7 @@ Configuration::link_code()
}
-void
+void
Configuration::commit(uint32_t msec)
{
// recompile and link
@@ -446,10 +446,10 @@ Configuration::commit(uint32_t msec)
_filter_manager->flush_updates(msec);
}
-void
+void
Configuration::add_varmap(const string& protocol, const string& variable,
const string& type, const string& access,
- const VarRW::Id& id)
+ const VarRW::Id& id)
{
// figure out access...
VarMap::Access acc = VarMap::READ;
@@ -462,26 +462,26 @@ Configuration::add_varmap(const string& protocol, const string& variable,
acc = VarMap::WRITE;
else
xorp_throw(PolicyException,
- "Unknown access (" + access + ") for protocol: "
+ "Unknown access (" + access + ") for protocol: "
+ protocol + " variable: " + variable);
- _varmap.add_protocol_variable(protocol,
- new VarMap::Variable(variable, type, acc, id));
+ _varmap.add_protocol_variable(protocol,
+ new VarMap::Variable(variable, type, acc, id));
}
void
Configuration::set_filter_manager(FilterManagerBase& fm)
-{
+{
// cannot reassign
XLOG_ASSERT(!_filter_manager);
_filter_manager = &fm;
}
-void
-Configuration::update_ie(const string& protocol,
- const POLICIES& policies,
- IEMap& iemap,
+void
+Configuration::update_ie(const string& protocol,
+ const POLICIES& policies,
+ IEMap& iemap,
PolicyList::PolicyType pt,
const string& mod)
{
@@ -494,7 +494,7 @@ Configuration::update_ie(const string& protocol,
i != policies.end(); ++i) {
pl->push_back(*i);
- }
+ }
// if there were policies, get their targets [no longer have policies]
iemap.get_targets(protocol, mod, _modified_targets);
@@ -503,9 +503,9 @@ Configuration::update_ie(const string& protocol,
iemap.insert(protocol, mod, pl);
}
-void
-Configuration::link_code(const Code::Target& target,
- IEMap& iemap,
+void
+Configuration::link_code(const Code::Target& target,
+ IEMap& iemap,
CodeMap& codemap)
{
// create new code and set target, so code may be linked properly
@@ -520,23 +520,23 @@ Configuration::link_code(const Code::Target& target,
if(iter != codemap.end()) {
delete (*iter).second;
codemap.erase(iter);
- }
+ }
// if code is empty [no-op filter] just erase it, and keep no entry.
- if(code->code() == "")
+ if(code->code() == "")
delete code;
- else
+ else
codemap[target.protocol()] = code;
}
-
-string
+
+string
Configuration::codemap_str(CodeMap& cm)
{
string ret = "";
for(CodeMap::iterator i = cm.begin();
i != cm.end(); ++i) {
-
+
Code* c= (*i).second;
ret += "PROTO: " + (*i).first + "\n";
diff --git a/xorp/policy/filter_manager.cc b/xorp/policy/filter_manager.cc
index d22e380..8c4d6c7 100644
--- a/xorp/policy/filter_manager.cc
+++ b/xorp/policy/filter_manager.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -29,28 +29,28 @@
#include "backend/policytags.hh"
#include "filter_manager.hh"
-FilterManager::FilterManager(const CodeMap& imp,
- const CodeMap& sm,
+FilterManager::FilterManager(const CodeMap& imp,
+ const CodeMap& sm,
const CodeMap& exp,
- const SetMap& sets,
- const TagMap& tagmap,
- XrlStdRouter& rtr,
+ const SetMap& sets,
+ const TagMap& tagmap,
+ XrlStdRouter& rtr,
ProcessWatch& pw,
ProtocolMap& pmap) :
- _import(imp), _sourcematch(sm), _export(exp),
- _sets(sets), _tagmap(tagmap),
+ _import(imp), _sourcematch(sm), _export(exp),
+ _sets(sets), _tagmap(tagmap),
_eventloop(rtr.eventloop()),
_push_timeout(2000),
- _process_watch(pw),
- _policy_backend(&rtr),
+ _process_watch(pw),
+ _policy_backend(&rtr),
_rib(&rtr),
_rib_name("rib"), // FIXME: rib name hardcoded
_pmap(pmap)
{
}
-void
+void
FilterManager::update_filter(const Code::Target& t)
{
switch (t.filter()) {
@@ -68,25 +68,25 @@ FilterManager::update_filter(const Code::Target& t)
}
}
-void
+void
FilterManager::update_import_filter(const string& protocol)
{
update_queue(protocol,_import,_import_queue);
}
-
-void
+
+void
FilterManager::update_sourcematch_filter(const string& protocol)
{
update_queue(protocol,_sourcematch,_sourcematch_queue);
}
-void
+void
FilterManager::update_export_filter(const string& protocol)
{
update_queue(protocol,_export,_export_queue);
}
-void
+void
FilterManager::update_tagmap(const string& protocol)
{
TagMap::const_iterator i = _tagmap.find(protocol);
@@ -101,7 +101,7 @@ FilterManager::update_tagmap(const string& protocol)
PolicyTags pt;
for (TagSet::const_iterator iter = ts->begin(); iter != ts->end(); ++iter)
- pt.insert(*iter);
+ pt.insert(*iter);
XrlAtomList al = pt.xrl_atomlist();
@@ -114,7 +114,7 @@ FilterManager::update_tagmap(const string& protocol)
callback(this,&FilterManager::policy_backend_cb));
}
-void
+void
FilterManager::policy_backend_cb(const XrlError& e)
{
string error_msg;
@@ -125,10 +125,10 @@ FilterManager::policy_backend_cb(const XrlError& e)
e.str().c_str());
XLOG_ERROR("%s", error_msg.c_str());
// xorp_throw(FMException, error_msg); // XXX: what else can we do ?
- }
+ }
}
-void
+void
FilterManager::flush_export_queue()
{
debug_msg("[POLICY] Flushing export filter queue...\n");
@@ -148,12 +148,12 @@ FilterManager::flush_export_queue()
_policy_backend.send_reset(_pmap.xrl_target(protocol).c_str(),
filter::EXPORT,callback(this,&FilterManager::policy_backend_cb));
}
- // else configure it
+ // else configure it
else {
- _policy_backend.send_configure(_pmap.xrl_target(protocol).c_str(),
+ _policy_backend.send_configure(_pmap.xrl_target(protocol).c_str(),
filter::EXPORT, conf,
callback(this, &FilterManager::policy_backend_cb));
- }
+ }
// export filters may change tagmap
update_tagmap(protocol);
@@ -165,7 +165,7 @@ FilterManager::flush_export_queue()
_export_queue.clear();
}
-void
+void
FilterManager::flush_queue(ConfQueue& queue, filter::Filter f)
{
debug_msg("[POLICY] Flushing %s queue...\n",
@@ -183,10 +183,10 @@ FilterManager::flush_queue(ConfQueue& queue, filter::Filter f)
if(!conf.length()) {
_policy_backend.send_reset(_pmap.xrl_target(protocol).c_str(),
f, callback(this,&FilterManager::policy_backend_cb));
- }
- // else configure filter normally.
+ }
+ // else configure filter normally.
else {
- _policy_backend.send_configure(_pmap.xrl_target(protocol).c_str(),
+ _policy_backend.send_configure(_pmap.xrl_target(protocol).c_str(),
f, conf, callback(this,&FilterManager::policy_backend_cb));
}
// need to push routes for protocol [filters changed].
@@ -204,7 +204,7 @@ FilterManager::push_routes_now()
{
for(set<string>::iterator i = _push_queue.begin();
i != _push_queue.end(); ++i) {
-
+
const string& proto = *i;
debug_msg("[POLICY] Pushing routes for %s\n",
@@ -217,7 +217,7 @@ FilterManager::push_routes_now()
_push_queue.clear();
}
-void
+void
FilterManager::flush_updates_now()
{
// flush all queues
@@ -230,7 +230,7 @@ FilterManager::flush_updates_now()
callback(this,&FilterManager::push_routes_now));
}
-void
+void
FilterManager::flush_updates(uint32_t msec)
{
// delayed flush
@@ -238,7 +238,7 @@ FilterManager::flush_updates(uint32_t msec)
callback(this,&FilterManager::flush_updates_now));
}
-void
+void
FilterManager::birth(const string& protocol)
{
debug_msg("[POLICY] Protocol born: %s\n",protocol.c_str());
@@ -248,12 +248,12 @@ FilterManager::birth(const string& protocol)
update_sourcematch_filter(protocol);
update_import_filter(protocol);
-
+
// FIXME: need a mechanism to make routes from RIB reach the new born
// process. Consider if source match filter was setup before the export
// filter was alive... the routes will be sitting in the RIB, and never go
// to the process.
-
+
// This is a HACK [as this problem was discovered quite late]. So it looks
// ugly on purpose.
CodeMap::const_iterator cmi = _export.find(protocol);
@@ -265,10 +265,10 @@ FilterManager::birth(const string& protocol)
i != export_code->source_protocols().end(); ++i) {
const string& push_proto = *i;
-
+
if(push_proto == protocol)
continue;
-
+
if(!_process_watch.alive(push_proto))
continue;
@@ -278,12 +278,12 @@ FilterManager::birth(const string& protocol)
XLOG_WARNING("XXX HACK: PUSHING ROUTES OF %s FOR %s",
push_proto.c_str(),protocol.c_str());
-
+
_push_queue.insert(push_proto);
}
}
// EOH [end of hack]
-
+
// perhaps we can delay the flush. Consider boot-time. A lot of processes
// are coming up, so we will always be flushing. At boot, the commit is
// delayed by ~2 seconds I think, so if we delay the flush ~2 seconds here
@@ -299,7 +299,7 @@ FilterManager::birth(const string& protocol)
// rather than overloading the meaning of route push.
}
-void
+void
FilterManager::death(const string& protocol)
{
// do not send any updates to dead process.
@@ -314,8 +314,8 @@ FilterManager::death(const string& protocol)
debug_msg("[POLICY] Protocol death: %s\n",protocol.c_str());
}
-void
-FilterManager::delete_queue_protocol(ConfQueue& queue,
+void
+FilterManager::delete_queue_protocol(ConfQueue& queue,
const string& protocol)
{
ConfQueue::iterator i = queue.find(protocol);
@@ -323,11 +323,11 @@ FilterManager::delete_queue_protocol(ConfQueue& queue,
if(i == queue.end())
return;
- queue.erase(i);
+ queue.erase(i);
}
-void
-FilterManager::update_queue(const string& protocol,
+void
+FilterManager::update_queue(const string& protocol,
const CodeMap& cm,
ConfQueue& queue)
{
diff --git a/xorp/policy/policy_list.cc b/xorp/policy/policy_list.cc
index ab0651d..d08b02d 100644
--- a/xorp/policy/policy_list.cc
+++ b/xorp/policy/policy_list.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -32,7 +32,7 @@
uint32_t PolicyList::_pe = 0;
-PolicyList::PolicyList(const string& p, PolicyType pt,
+PolicyList::PolicyList(const string& p, PolicyType pt,
PolicyMap& pmap, SetMap& smap, VarMap& vmap,
string mod)
: _protocol(p), _type(pt), _pmap(pmap),
@@ -68,7 +68,7 @@ PolicyList::create_mod(Term::BLOCKS block)
PolicyList::~PolicyList()
{
- for (PolicyCodeList::iterator i = _policies.begin();
+ for (PolicyCodeList::iterator i = _policies.begin();
i != _policies.end(); ++i) {
PolicyCode& pc = *i;
@@ -86,7 +86,7 @@ PolicyList::~PolicyList()
delete _mod_term_export;
}
-void
+void
PolicyList::push_back(const string& policyname)
{
if (!policyname.empty() && policyname.at(0) == '(') {
@@ -159,8 +159,8 @@ PolicyList::add_policy_expression(const string& exp)
push_back(name);
}
-void
-PolicyList::compile_policy(PolicyStatement& ps,Code::TargetSet& mod,
+void
+PolicyList::compile_policy(PolicyStatement& ps,Code::TargetSet& mod,
uint32_t& tagstart,
map<string, set<uint32_t> >& ptags)
{
@@ -179,10 +179,10 @@ PolicyList::compile_policy(PolicyStatement& ps,Code::TargetSet& mod,
break;
}
}
- }
+ }
}
-void
+void
PolicyList::compile(Code::TargetSet& mod, uint32_t& tagstart, map<string, set<uint32_t> >& ptags)
{
// go throw all policies in the list
@@ -193,35 +193,35 @@ PolicyList::compile(Code::TargetSet& mod, uint32_t& tagstart, map<string, set<ui
// deal only with non compiled policies [i.e. policies without
// associated code].
- if (pc.second)
+ if (pc.second)
continue;
// find the policy statement and compile it.
PolicyStatement& ps = _pmap.find(pc.first);
-
+
switch(_type) {
case IMPORT:
compile_import(i, ps, mod);
break;
-
+
case EXPORT:
compile_export(i, ps, mod, tagstart, ptags);
break;
}
- }
+ }
}
-string
+string
PolicyList::str()
{
string ret = "Policy Type: ";
-
+
switch(_type) {
case IMPORT:
ret += "import";
break;
-
+
case EXPORT:
ret += "export";
break;
@@ -247,7 +247,7 @@ PolicyList::str()
return ret;
}
-void
+void
PolicyList::link_code(Code& ret)
{
// go through all the policies, and link the code
@@ -262,7 +262,7 @@ PolicyList::link_code(Code& ret)
}
}
-void
+void
PolicyList::get_targets(Code::TargetSet& targets)
{
// go through all the policies in the list, and return the targets affected
@@ -271,32 +271,32 @@ PolicyList::get_targets(Code::TargetSet& targets)
_policies.end(); ++i) {
CodeList* cl = (*i).second;
-
+
// get all the targets in this code list [a single policy may have more
// than one targets -- such as source match filters].
cl->get_targets(targets);
}
}
-void
+void
PolicyList::get_redist_tags(const string& protocol, Code::TagSet& ts)
{
// go through all policies and return tags associated with the requested
// protocol.
for(PolicyCodeList::iterator i = _policies.begin(); i !=
_policies.end(); ++i) {
-
+
CodeList* cl = (*i).second;
cl->get_redist_tags(protocol,ts);
- }
+ }
}
-void
-PolicyList::semantic_check(PolicyStatement& ps,
+void
+PolicyList::semantic_check(PolicyStatement& ps,
VisitorSemantic::PolicyType type)
{
- // check if policy makes sense with this instantiation
+ // check if policy makes sense with this instantiation
// [i.e. protocol and import/export pair].
SemanticVarRW varrw(_varmap);
@@ -311,8 +311,8 @@ PolicyList::semantic_check(PolicyStatement& ps,
ps.accept(sem_check);
}
-void
-PolicyList::compile_import(PolicyCodeList::iterator& iter,
+void
+PolicyList::compile_import(PolicyCodeList::iterator& iter,
PolicyStatement& ps,
Code::TargetSet& modified_targets)
{
@@ -350,9 +350,9 @@ PolicyList::compile_import(PolicyCodeList::iterator& iter,
modified_targets.insert(code->target());
}
-void
-PolicyList::compile_export(PolicyCodeList::iterator& iter, PolicyStatement& ps,
- Code::TargetSet& modified_targets,
+void
+PolicyList::compile_export(PolicyCodeList::iterator& iter, PolicyStatement& ps,
+ Code::TargetSet& modified_targets,
uint32_t& tagstart,
map<string, set<uint32_t> >& ptags)
{
@@ -363,7 +363,7 @@ PolicyList::compile_export(PolicyCodeList::iterator& iter, PolicyStatement& ps,
// generate source match code
SourceMatchCodeGenerator smcg(tagstart, _varmap, _pmap, ptags);
-
+
// check modifier [a bit of a hack]
if (_mod_term)
_mod_term->accept(smcg);
diff --git a/xorp/policy/source_match_code_generator.cc b/xorp/policy/source_match_code_generator.cc
index 3b68cf3..e9309ba 100644
--- a/xorp/policy/source_match_code_generator.cc
+++ b/xorp/policy/source_match_code_generator.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -28,13 +28,13 @@
SourceMatchCodeGenerator::SourceMatchCodeGenerator(uint32_t tagstart,
const VarMap& varmap,
PolicyMap& pmap,
- map<string, set<uint32_t> > & ptags)
+ map<string, set<uint32_t> > & ptags)
: CodeGenerator(varmap, pmap), _currtag(tagstart),
_protocol_tags(ptags)
{
}
-const Element*
+const Element*
SourceMatchCodeGenerator::visit_policy(PolicyStatement& policy)
{
PolicyStatement::TermContainer& terms = policy.terms();
@@ -78,7 +78,7 @@ SourceMatchCodeGenerator::visit_policy(PolicyStatement& policy)
return NULL;
}
-void
+void
SourceMatchCodeGenerator::addTerm()
{
// copy the code for the term
@@ -178,7 +178,7 @@ SourceMatchCodeGenerator::do_term(Term& term)
_protocol_statement = false;
(i->second)->accept(*this);
-
+
// if it was a protocol statement, no need for "ONFALSE_EXIT", if its
// any other statement, then yes. The protocol is not read as a variable
// by the backend filters... it is only used by the policy manager.
@@ -187,8 +187,8 @@ SourceMatchCodeGenerator::do_term(Term& term)
}
// XXX: we can assume _protocol = PROTOCOL IN EXPORT STATEMENT
- if(_protocol == "")
- xorp_throw(NoProtoSpec, "No protocol specified in term " + term.name() +
+ if(_protocol == "")
+ xorp_throw(NoProtoSpec, "No protocol specified in term " + term.name() +
" in export policy source match");
// ignore any destination block [that is dealt with in the export code
@@ -244,12 +244,12 @@ SourceMatchCodeGenerator::do_term(Term& term)
_currtag++;
}
-const Element*
+const Element*
SourceMatchCodeGenerator::visit_proto(NodeProto& node)
{
// check for protocol redifinition
if(_protocol != "") {
- ostringstream err;
+ ostringstream err;
err << "PROTOCOL REDEFINED FROM " << _protocol << " TO " <<
node.proto() << " AT LINE " << node.line();
xorp_throw(ProtoRedefined, err.str());
@@ -261,10 +261,10 @@ SourceMatchCodeGenerator::visit_proto(NodeProto& node)
return NULL;
}
-vector<Code*>&
+vector<Code*>&
SourceMatchCodeGenerator::codes()
-{
- return _codes_vect;
+{
+ return _codes_vect;
}
const SourceMatchCodeGenerator::Tags&
diff --git a/xorp/rib/rt_tab_pol_conn.cc b/xorp/rib/rt_tab_pol_conn.cc
index 7ac9e9e..57db978 100644
--- a/xorp/rib/rt_tab_pol_conn.cc
+++ b/xorp/rib/rt_tab_pol_conn.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -65,12 +65,12 @@ PolicyConnectedTable<A>::~PolicyConnectedTable ()
template <class A>
int
-PolicyConnectedTable<A>::add_route(const IPRouteEntry<A>& route,
+PolicyConnectedTable<A>::add_route(const IPRouteEntry<A>& route,
RouteTable<A>* caller)
{
XLOG_ASSERT(caller == _parent);
- debug_msg("[RIB] PolicyConnectedTable ADD ROUTE: %s\n",
+ debug_msg("[RIB] PolicyConnectedTable ADD ROUTE: %s\n",
route.str().c_str());
@@ -80,19 +80,19 @@ PolicyConnectedTable<A>::add_route(const IPRouteEntry<A>& route,
// make a copy so we may modify it
IPRouteEntry<A> route_copy(*original);
- do_filtering(route_copy);
-
-
+ do_filtering(route_copy);
+
+
RouteTable<A>* next = this->next_table();
XLOG_ASSERT(next);
// Send the possibly modified route down
return next->add_route(route_copy, this);
-}
+}
template <class A>
-int
-PolicyConnectedTable<A>::delete_route(const IPRouteEntry<A>* route,
+int
+PolicyConnectedTable<A>::delete_route(const IPRouteEntry<A>* route,
RouteTable<A>* caller)
{
XLOG_ASSERT(caller == _parent);
@@ -116,14 +116,14 @@ PolicyConnectedTable<A>::delete_route(const IPRouteEntry<A>* route,
// make a copy so we may modify it (e.g., by setting its policy tags)
IPRouteEntry<A> route_copy(*route);
- do_filtering(route_copy);
+ do_filtering(route_copy);
// propagate the delete
return next->delete_route(&route_copy, this);
}
template <class A>
-const IPRouteEntry<A>*
+const IPRouteEntry<A>*
PolicyConnectedTable<A>::lookup_route(const IPNet<A>& net) const
{
XLOG_ASSERT(_parent);
@@ -134,13 +134,13 @@ PolicyConnectedTable<A>::lookup_route(const IPNet<A>& net) const
// check if we have route [we should have same routes as origin table].
if (i == _route_table.end())
return _parent->lookup_route(net); // should return null probably
-
+
return i.payload();
}
template <class A>
-const IPRouteEntry<A>*
+const IPRouteEntry<A>*
PolicyConnectedTable<A>::lookup_route(const A& addr) const
{
XLOG_ASSERT(_parent);
@@ -157,7 +157,7 @@ PolicyConnectedTable<A>::lookup_route(const A& addr) const
template <class A>
-RouteRange<A>*
+RouteRange<A>*
PolicyConnectedTable<A>::lookup_route_range(const A& addr) const
{
XLOG_ASSERT(_parent);
@@ -169,13 +169,13 @@ PolicyConnectedTable<A>::lookup_route_range(const A& addr) const
template <class A>
void
-PolicyConnectedTable<A>::replumb(RouteTable<A>* old_parent,
+PolicyConnectedTable<A>::replumb(RouteTable<A>* old_parent,
RouteTable<A>* new_parent)
{
XLOG_ASSERT(old_parent == _parent);
_parent = new_parent;
-}
+}
template <class A>
@@ -190,7 +190,7 @@ void
PolicyConnectedTable<A>::push_routes()
{
debug_msg("[RIB] PolicyConnectedTable PUSH ROUTES\n");
-
+
RouteTable<A>* next = this->next_table();
XLOG_ASSERT(next);
@@ -227,7 +227,7 @@ PolicyConnectedTable<A>::push_routes()
IPRouteEntry<A>* route = *i;
_route_table.erase(route->net());
_route_table.insert(route->net(), route);
- }
+ }
}
diff --git a/xorp/rib/rt_tab_pol_redist.cc b/xorp/rib/rt_tab_pol_redist.cc
index a0be9aa..0ffd6a7 100644
--- a/xorp/rib/rt_tab_pol_redist.cc
+++ b/xorp/rib/rt_tab_pol_redist.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -42,7 +42,7 @@ PolicyRedistTable<A>::PolicyRedistTable(RouteTable<A>* parent, XrlRouter& rtr,
bool multicast)
: RouteTable<A>(table_name),
_parent(parent),
- _xrl_router(rtr),
+ _xrl_router(rtr),
_eventloop(_xrl_router.eventloop()),
_redist_map(rmap),
_redist4_client(&_xrl_router),
@@ -59,7 +59,7 @@ PolicyRedistTable<A>::PolicyRedistTable(RouteTable<A>* parent, XrlRouter& rtr,
template <class A>
int
-PolicyRedistTable<A>::add_route(const IPRouteEntry<A>& route,
+PolicyRedistTable<A>::add_route(const IPRouteEntry<A>& route,
RouteTable<A>* caller)
{
XLOG_ASSERT(caller == _parent);
@@ -79,11 +79,11 @@ PolicyRedistTable<A>::add_route(const IPRouteEntry<A>& route,
XLOG_ASSERT(next != NULL);
return next->add_route(route, this);
-}
+}
template <class A>
-int
-PolicyRedistTable<A>::delete_route(const IPRouteEntry<A>* route,
+int
+PolicyRedistTable<A>::delete_route(const IPRouteEntry<A>* route,
RouteTable<A>* caller)
{
XLOG_ASSERT(caller == _parent);
@@ -107,7 +107,7 @@ PolicyRedistTable<A>::delete_route(const IPRouteEntry<A>* route,
}
template <class A>
-const IPRouteEntry<A>*
+const IPRouteEntry<A>*
PolicyRedistTable<A>::lookup_route(const IPNet<A>& net) const
{
XLOG_ASSERT(_parent != NULL);
@@ -117,7 +117,7 @@ PolicyRedistTable<A>::lookup_route(const IPNet<A>& net) const
template <class A>
-const IPRouteEntry<A>*
+const IPRouteEntry<A>*
PolicyRedistTable<A>::lookup_route(const A& addr) const
{
XLOG_ASSERT(_parent != NULL);
@@ -127,7 +127,7 @@ PolicyRedistTable<A>::lookup_route(const A& addr) const
template <class A>
-RouteRange<A>*
+RouteRange<A>*
PolicyRedistTable<A>::lookup_route_range(const A& addr) const
{
XLOG_ASSERT(_parent != NULL);
@@ -138,13 +138,13 @@ PolicyRedistTable<A>::lookup_route_range(const A& addr) const
template <class A>
void
-PolicyRedistTable<A>::replumb(RouteTable<A>* old_parent,
+PolicyRedistTable<A>::replumb(RouteTable<A>* old_parent,
RouteTable<A>* new_parent)
{
XLOG_ASSERT(old_parent == _parent);
_parent = new_parent;
-}
+}
template <class A>
@@ -157,7 +157,7 @@ PolicyRedistTable<A>::str() const
template <class A>
void
-PolicyRedistTable<A>::add_redist(const IPRouteEntry<A>& route,
+PolicyRedistTable<A>::add_redist(const IPRouteEntry<A>& route,
const Set& protos)
{
// send a redistribution request for all protocols in the set.
@@ -184,7 +184,7 @@ PolicyRedistTable<A>::xrl_cb(const XrlError& e, string action) {
if (e != XrlError::OKAY()) {
XLOG_WARNING("Unable to complete XRL: %s", action.c_str());
}
-}
+}
template <>
void
@@ -246,7 +246,7 @@ PolicyRedistTable<A>::replace_policytags(const IPRouteEntry<A>& route,
del_redist(route, del_protos);
if (!add_protos.empty())
add_redist(route, add_protos);
-}
+}
template class PolicyRedistTable<IPv4>;
diff --git a/xorp/rib/xrl_target.cc b/xorp/rib/xrl_target.cc
index c8af7fe..c7cfe44 100644
--- a/xorp/rib/xrl_target.cc
+++ b/xorp/rib/xrl_target.cc
@@ -8,13 +8,13 @@
// 1991 as published by the Free Software Foundation. Redistribution
// and/or modification of this program under the terms of any other
// version of the GNU General Public License is not permitted.
-//
+//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For more details,
// see the GNU General Public License, Version 2, a copy of which can be
// found in the XORP LICENSE.gpl file.
-//
+//
// XORP Inc, 2953 Bunker Hill Lane, Suite 204, Santa Clara, CA 95054, USA;
// http://xorp.net
@@ -285,7 +285,7 @@ XrlRibTarget::rib_0_1_add_route4(const string& protocol,
network.str().c_str(),
nexthop.str().c_str(),
XORP_UINT_CAST(metric));
-
+
#ifndef XORP_DISABLE_PROFILE
if (_rib_manager->profile().enabled(profile_route_ribin)) {
_rib_manager->profile().log(profile_route_ribin,
@@ -298,7 +298,7 @@ XrlRibTarget::rib_0_1_add_route4(const string& protocol,
XORP_UINT_CAST(metric)));
}
#endif
-
+
if (unicast &&
_urib4.add_route(protocol, network, nexthop, "", "", metric, policytags)
!= XORP_OK) {
@@ -1012,7 +1012,7 @@ XrlRibTarget::profile_0_1_disable(const string& pname)
}
-XrlCmdError
+XrlCmdError
XrlRibTarget::profile_0_1_get_entries(const string& pname,
const string& instance_name)
{
@@ -1055,7 +1055,7 @@ XrlCmdError
XrlRibTarget::profile_0_1_list(string& info)
{
debug_msg("\n");
-
+
info = _rib_manager->profile().get_list();
return XrlCmdError::OKAY();
}
--
1.7.5.4
More information about the Xorp-hackers
mailing list