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 SRC_BGP_L3VPN_INETVPN_TABLE_H_ 7 : #define SRC_BGP_L3VPN_INETVPN_TABLE_H_ 8 : 9 : #include <string> 10 : 11 : #include "bgp/bgp_attr.h" 12 : #include "bgp/bgp_table.h" 13 : #include "bgp/l3vpn/inetvpn_address.h" 14 : #include "bgp/l3vpn/inetvpn_route.h" 15 : 16 : class BgpServer; 17 : class BgpRoute; 18 : 19 : class InetVpnTable : public BgpTable { 20 : public: 21 : struct RequestKey : BgpTable::RequestKey { 22 168052 : RequestKey(const InetVpnPrefix &prefix, const IPeer *ipeer) 23 168052 : : prefix(prefix), peer(ipeer) { 24 168048 : } 25 : InetVpnPrefix prefix; 26 : const IPeer *peer; 27 78612 : virtual const IPeer *GetPeer() const { return peer; } 28 : }; 29 : 30 : InetVpnTable(DB *db, const std::string &name); 31 : 32 : virtual std::unique_ptr<DBEntry> AllocEntry(const DBRequestKey *key) const; 33 : virtual std::unique_ptr<DBEntry> AllocEntryStr(const std::string &key) const; 34 : 35 654619 : virtual Address::Family family() const { return Address::INETVPN; } 36 1092972 : virtual bool IsVpnTable() const { return true; } 37 : 38 : virtual size_t Hash(const DBEntry *entry) const; 39 : virtual size_t Hash(const DBRequestKey *key) const; 40 : 41 : virtual BgpRoute *RouteReplicate(BgpServer *server, BgpTable *src_table, 42 : BgpRoute *src_rt, const BgpPath *path, 43 : ExtCommunityPtr ptr); 44 : 45 : virtual bool Export(RibOut *ribout, Route *route, 46 : const RibPeerSet &peerset, 47 : UpdateInfoSList &info_slist); 48 : static DBTableBase *CreateTable(DB *db, const std::string &name); 49 : virtual BgpRoute *TableFind(DBTablePartition *rtp, 50 : const DBRequestKey *prefix); 51 : 52 : private: 53 : 54 : DISALLOW_COPY_AND_ASSIGN(InetVpnTable); 55 : }; 56 : 57 : #endif // SRC_BGP_L3VPN_INETVPN_TABLE_H_