Line data Source code
1 : /* 2 : * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved. 3 : */ 4 : 5 : #ifndef __CONTROLLER_EXPORT_H__ 6 : #define __CONTROLLER_EXPORT_H__ 7 : 8 : #include <boost/uuid/uuid_io.hpp> 9 : #include <cmn/agent_cmn.h> 10 : #include <cmn/agent.h> 11 : #include <oper/nexthop.h> 12 : #include <oper/agent_path.h> 13 : 14 : class AgentPath; 15 : class EcmpLoadBalance; 16 : 17 : class RouteExport { 18 : public: 19 : struct State : DBState { 20 : State(); 21 124 : virtual ~State() {}; 22 : 23 : bool exported_; 24 : bool ingress_replication_exported_; //Used by multicast 25 : bool multicast_exported_; //Used by multicast 26 : bool force_chg_; 27 : uint32_t label_; 28 : std::string vn_; 29 : SecurityGroupList sg_list_; 30 : TagList tag_list_; 31 : CommunityList communities_; 32 : TunnelType::Type tunnel_type_; 33 : PathPreference path_preference_; 34 : //destination and source are valid for tunnel NH. 35 : std::string destination_; 36 : std::string source_; 37 : EcmpLoadBalance ecmp_load_balance_; 38 : bool etree_leaf_; 39 : uint32_t isid_; 40 : TunnelType::TypeBmap tunnel_bmap_; 41 : 42 : bool Changed(const AgentRoute *route, const AgentPath *path) const; 43 : void Update(const AgentRoute *route, const AgentPath *path); 44 : }; 45 : RouteExport(AgentRouteTable *rt); 46 : ~RouteExport(); 47 : 48 : void Notify(const Agent *agent, 49 : AgentXmppChannel *bgp_xmpp_peer, 50 : bool associate, 51 : Agent::RouteTableType type, 52 : DBTablePartBase *partition, 53 : DBEntryBase *e); 54 : void ManagedDelete(); 55 354 : DBTableBase::ListenerId GetListenerId() const {return id_;}; 56 : void Unregister(); 57 : bool DeleteState(DBTablePartBase *partition, DBEntryBase *entry); 58 : 59 : bool MulticastRouteCanDissociate(const AgentRoute *route); 60 : static void Walkdone(DBTable::DBTableWalkRef walk_ref, DBTableBase *table, 61 : RouteExport *rt); 62 : static RouteExport* Init(AgentRouteTable *table, 63 : AgentXmppChannel *bgp_xmpp_peer); 64 : private: 65 : DBTableBase::ListenerId id_; 66 : AgentRouteTable *rt_table_; 67 : bool marked_delete_; 68 : uint32_t state_added_; 69 : void MulticastNotify(AgentXmppChannel *bgp_xmpp_peer, bool associate, 70 : DBTablePartBase *partition, DBEntryBase *e); 71 : void UnicastNotify(AgentXmppChannel *bgp_xmpp_peer, 72 : DBTablePartBase *partition, DBEntryBase *e, 73 : Agent::RouteTableType type); 74 : void SubscribeMulticastRouting(const Agent *agent, 75 : AgentXmppChannel *bgp_xmpp_peer, 76 : AgentRoute *route, 77 : RouteExport::State *state); 78 : void SubscribeIngressReplication(Agent *agent, 79 : AgentXmppChannel *bgp_xmpp_peer, 80 : AgentRoute *route, 81 : RouteExport::State *state); 82 : LifetimeRef<RouteExport> table_delete_ref_; 83 : DBTable::DBTableWalkRef walk_ref_; 84 : }; 85 : 86 : #endif // __CONTROLLER_EXPORT_H__