6 #include <boost/foreach.hpp>
25 BgpRoute *rt, RTargetList::const_iterator it) {
26 pair<RTargetList::iterator, bool> result;
27 result =
list_.insert(*it);
28 assert(result.second);
34 BgpRoute *rt, RTargetList::const_iterator it) {
42 RTargetRoute *rt, RtGroup::InterestedPeerList::const_iterator it) {
43 pair<RtGroup::InterestedPeerList::iterator, bool> result;
44 result =
list_.insert(*it);
45 assert(result.second);
51 RTargetRoute *rt, RtGroup::InterestedPeerList::iterator it) {
60 TaskScheduler::GetInstance()->GetTaskId(
"bgp::RTFilter"), 0)),
63 TaskScheduler::GetInstance()->GetTaskId(
"bgp::RTFilter"), 0)),
64 rtarget_trigger_lists_(
DB::PartitionCount()),
65 master_instance_delete_ref_(this, NULL) {
89 if (dbstate->
GetList()->empty()) {
111 const BgpPath *best_ebgp_path = NULL;
112 for (Route::PathList::iterator it = rt->
GetPathList().begin();
122 if (!best_ebgp_path) {
123 best_ebgp_path = path;
129 std::pair<RtGroup::InterestedPeerList::iterator, bool> ret =
130 peer_list.insert(std::pair<
const BgpPeer *,
133 ret.first->second.insert(rt);
224 for (RoutingInstance::RouteTableList::const_iterator it =
225 table_list.begin(); it != table_list.end(); ++it) {
226 if (!it->second->IsVpnTable())
continue;
261 int part_id = root->
index();
268 if (dbstate->
GetList()->empty()) {
275 RtGroupMgrTableStateList::iterator loc =
table_state_.find(table);
354 tbb::mutex::scoped_lock lock(
mutex_);
370 tbb::mutex::scoped_lock lock(
mutex_);
387 for (RtGroupMgrTableStateList::iterator it =
table_state_.begin();
398 tbb::mutex::scoped_lock lock(
mutex_);
403 tbb::mutex::scoped_lock lock(
mutex_);
422 if (!rtgroup)
continue;
428 int current_index = iter.
index();
434 new_peerset->
reset(current_index);
446 if (master && master->
deleted()) {
447 for (RtGroupMgrTableStateList::iterator it =
493 : id_(id), table_delete_ref_(this, table->
deleter()) {
494 assert(table->
deleter() != NULL);
bool ProcessRTargetRouteList()
void EnableRtGroupProcessing()
RtGroupMgrTableStateList table_state_
std::map< const BgpPeer *, RTargetRouteList > InterestedPeerList
std::set< RTargetRoute * > RTargetRouteList
bool IsRouteTargetOnList(const RouteTarget &rtarget) const
void RemoveDepRoute(int part_id, BgpRoute *rt)
BgpTable * GetTable(Address::Family fmly)
void DisableRTargetRouteProcessing()
const BgpPath * BestPath() const
const RtGroup::InterestedPeerList * GetList() const
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
void NotifyRtGroup(const RouteTarget &rt)
void AddInterestedPeer(RTargetGroupMgr *mgr, RtGroup *rtgroup, RTargetRoute *rt, RtGroup::InterestedPeerList::const_iterator it)
DBState * GetState(DBTableBase *tbl_base, ListenerId listener) const
bool test(size_t pos) const
virtual bool IsXmppPeer() const =0
bool set_synchronize(const SetType *set1, const SetType *set2, AddFunctor add_fn, DelFunctor del_fn)
RouteTarget rtarget() const
virtual ~RTargetGroupMgr()
void RTargetPeerSync(BgpTable *table, RTargetRoute *rt, DBTableBase::ListenerId id, RTargetState *dbstate, const RtGroup::InterestedPeerList *future)
BitSet & reset(size_t pos)
virtual bool IsVpnTable() const
void SetState(DBTableBase *tbl_base, ListenerId listener, DBState *state)
bool ProcessRouteTargetList(int part_id)
std::vector< RouteTargetTriggerList > rtarget_trigger_lists_
RTargetRouteTriggerList rtarget_route_list_
RoutingInstanceMgr * routing_instance_mgr()
void AddRouteTargetToLists(const RouteTarget &rtarget)
RoutingInstance * GetDefaultRoutingInstance()
RtGroupRemoveList rtgroup_remove_list_
virtual BgpProto::BgpPeerType PeerType() const
const RTargetPrefix & GetPrefix() const
void AddDepRoute(int part_id, BgpRoute *rt)
void Unregister(ListenerId listener)
const RTargetList * GetList() const
const RtGroupInterestedPeerSet & GetInterestedPeers() const
RouteTableList & GetTables()
ListenerId Register(ChangeCallback callback, const std::string &name="unspecified")
void DisableRouteTargetProcessing()
LifetimeRef< RTargetGroupMgr > master_instance_delete_ref_
static RouteTarget null_rtarget
DBTableBase::ListenerId GetListenerId() const
RtGroup * LocateRtGroup(const RouteTarget &rt)
static TaskScheduler * GetInstance()
void Reset(LifetimeActor *actor)
void RemoveRtGroup(const RouteTarget &rt)
void EnableRouteTargetProcessing()
void NotifyRtGroupUnlocked(const RouteTarget &rt)
#define CHECK_CONCURRENCY(...)
RtGroupMgrTableState(BgpTable *table, DBTableBase::ListenerId id)
bool ProcessRtGroupList()
boost::scoped_ptr< TaskTrigger > remove_rtgroup_trigger_
boost::scoped_ptr< TaskTrigger > rtarget_route_trigger_
bool IsRTargetRouteOnList(RTargetRoute *rt) const
void DisableRtGroupProcessing()
void ClearState(DBTableBase *tbl_base, ListenerId listener)
LifetimeActor * deleter()
RTargetGroupMgr(BgpServer *server)
std::map< std::string, BgpTable * > RouteTableList
void DeleteRouteTarget(RTargetGroupMgr *mgr, int part_id, BgpRoute *rt, RTargetList::const_iterator it)
RTargetList * GetMutableList()
bool RTargetRouteNotify(DBTablePartBase *root, DBEntryBase *entry)
RtGroup * GetRtGroup(const RouteTarget &rt)
void BuildRTargetDistributionGraph(BgpTable *table, RTargetRoute *rt, DBTableBase::ListenerId id)
const ExtCommunity * ext_community() const
RtGroup::InterestedPeerList list_
void DeleteInterestedPeer(RTargetGroupMgr *mgr, RtGroup *rtgroup, RTargetRoute *rt, RtGroup::InterestedPeerList::iterator it)
const BgpAttr * GetAttr() const
static const int kInvalidId
void NotifyDepRoutes(int part_id)
RtGroup::InterestedPeerList * GetMutableList()
LifetimeActor * deleter()
void AddInterestedPeer(const BgpPeer *peer, RTargetRoute *rt)
DBTableBase::ListenerId GetListenerId(BgpTable *table)
void EnableRTargetRouteProcessing()
static int PartitionCount()
std::vector< boost::shared_ptr< TaskTrigger > > rtarget_dep_triggers_
bool IsFamilyNegotiated(Address::Family family)
void AddRouteTarget(RTargetGroupMgr *mgr, int part_id, BgpRoute *rt, RTargetList::const_iterator it)
bool IsRtGroupOnList(RtGroup *rtgroup) const
void RTargetDepSync(DBTablePartBase *root, BgpRoute *rt, DBTableBase::ListenerId id, VpnRouteState *dbstate, const VpnRouteState::RTargetList *future)
bool VpnRouteNotify(DBTablePartBase *root, DBEntryBase *entry)
virtual void GetRibOutInterestedPeers(RibOut *ribout, const ExtCommunity *ext_community, const RibPeerSet &peerset, RibPeerSet *new_peerset)
std::set< RouteTarget > RTargetList
void map_synchronize(MapType *map1, const MapType *map2, AddFunctor add_fn, DelFunctor del_fn)
bool PathSameNeighborAs(const BgpPath &rhs) const
const PathList & GetPathList() const
void RemoveInterestedPeer(const BgpPeer *peer, RTargetRoute *rt)