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