LCOV - code coverage report
Current view: top level - vnsw/agent/oper - forwarding_class.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 2 25 8.0 %
Date: 2026-08-03 02:19:58 Functions: 1 15 6.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2013 Juniper Networks, Inc. All rights reserved.
       3             :  */
       4             : 
       5             : #ifndef __AGENT_OPER_FORWARDING_CLASS_H
       6             : #define __AGENT_OPER_FORWARDING_CLASS_H
       7             : 
       8             : #include <cmn/agent.h>
       9             : #include <oper_db.h>
      10             : #include <cmn/index_vector.h>
      11             : 
      12             : class Agent;
      13             : class DB;
      14             : class ForwardingClassTable;
      15             : 
      16             : struct ForwardingClassKey : public AgentOperDBKey {
      17           0 :     ForwardingClassKey(const boost::uuids::uuid &uuid):
      18           0 :         uuid_(uuid) {}
      19             : 
      20             :     ForwardingClassKey(const ForwardingClassKey &rhs):
      21             :         uuid_(rhs.uuid_) {}
      22             : 
      23             :     bool IsLess(const ForwardingClassKey &rhs) const {
      24             :         return uuid_ < rhs.uuid_;
      25             :     }
      26             : 
      27             :     boost::uuids::uuid uuid_;
      28             : };
      29             : 
      30             : struct ForwardingClassData : public AgentOperDBData {
      31             : 
      32           0 :     ForwardingClassData(const Agent *agent, IFMapNode *node,
      33             :                         uint32_t dscp, uint32_t vlan_priority,
      34             :                         uint32_t mpls_exp, uint32_t id,
      35             :                         const boost::uuids::uuid &qos_queue_uuid,
      36           0 :                         const std::string &name):
      37           0 :     AgentOperDBData(agent, node), dscp_(dscp), vlan_priority_(vlan_priority),
      38           0 :     mpls_exp_(mpls_exp), id_(id), qos_queue_uuid_(qos_queue_uuid) {}
      39             : 
      40             :     uint32_t dscp_;
      41             :     uint32_t vlan_priority_;
      42             :     uint32_t mpls_exp_;
      43             :     uint32_t id_;
      44             :     boost::uuids::uuid qos_queue_uuid_;
      45             :     std::string name_;
      46             : };
      47             : 
      48             : class ForwardingClass :
      49             :     AgentRefCount<ForwardingClass>, public AgentOperDBEntry {
      50             :         public:
      51             :     ForwardingClass(const boost::uuids::uuid &uuid);
      52             :     virtual ~ForwardingClass();
      53             : 
      54             :     KeyPtr GetDBRequestKey() const;
      55             :     std::string ToString() const;
      56             :     virtual bool IsLess(const DBEntry &rhs) const;
      57             :     virtual bool DBEntrySandesh(Sandesh *resp, std::string &name) const;
      58             : 
      59             :     virtual bool Change(const DBRequest *req);
      60             :     virtual void Delete(const DBRequest *req);
      61             :     virtual void SetKey(const DBRequestKey *key);
      62             : 
      63           0 :     virtual bool DeleteOnZeroRefCount() const {
      64           0 :         return false;
      65             :     }
      66           0 :     virtual void OnZeroRefCount() {};
      67           0 :     uint32_t GetRefCount() const {
      68           0 :         return AgentRefCount<ForwardingClass>::GetRefCount();
      69             :     }
      70             : 
      71           0 :     uint32_t dscp() const {return dscp_;}
      72           0 :     uint32_t vlan_priority() const {return vlan_priority_;}
      73           0 :     uint32_t mpls_exp() const { return mpls_exp_;}
      74           0 :     uint32_t id() const {return id_;}
      75           0 :     const QosQueue* qos_queue_ref() const {
      76           0 :         return qos_queue_ref_.get();
      77             :     }
      78           0 :     const boost::uuids::uuid& uuid() const {
      79           0 :         return uuid_;
      80             :     }
      81           0 :     const std::string& name() const {
      82           0 :         return name_;
      83             :     }
      84             : 
      85           2 :     uint16_t nic_queue_id() const {
      86           2 :         return nic_queue_id_;
      87             :     }
      88             : 
      89             : private:
      90             :     boost::uuids::uuid uuid_;
      91             :     uint32_t id_;
      92             :     uint32_t dscp_;
      93             :     uint32_t vlan_priority_;
      94             :     uint32_t mpls_exp_;
      95             :     QosQueueConstRef qos_queue_ref_;
      96             :     std::string name_;
      97             :     uint16_t nic_queue_id_;
      98             :     DISALLOW_COPY_AND_ASSIGN(ForwardingClass);
      99             : };
     100             : 
     101             : class ForwardingClassTable : public AgentOperDBTable {
     102             : public:
     103             :     ForwardingClassTable(Agent *agent, DB *db, const std::string &name);
     104             :     virtual ~ForwardingClassTable();
     105             :     static const uint32_t kInvalidIndex=0xFF;
     106             : 
     107             :     static DBTableBase *CreateTable(Agent *agent, DB *db,
     108             :                                     const std::string &name);
     109             : 
     110             :     virtual std::unique_ptr<DBEntry> AllocEntry(const DBRequestKey *k) const;
     111             : 
     112           0 :     virtual size_t Hash(const DBEntry *entry) const {return 0;}
     113           0 :     virtual size_t Hash(const DBRequestKey *key) const {return 0;}
     114             : 
     115             :     virtual DBEntry *OperDBAdd(const DBRequest *req);
     116             :     virtual bool OperDBOnChange(DBEntry *entry, const DBRequest *req);
     117             :     virtual bool OperDBDelete(DBEntry *entry, const DBRequest *req);
     118             :     virtual bool OperDBResync(DBEntry *entry, const DBRequest *req);
     119             : 
     120             :     virtual bool IFNodeToReq(IFMapNode *node, DBRequest &req,
     121             :                              const boost::uuids::uuid &u);
     122             :     virtual bool IFNodeToUuid(IFMapNode *node, boost::uuids::uuid &u);
     123             :     virtual bool ProcessConfig(IFMapNode *node, DBRequest &req,
     124             :                                const boost::uuids::uuid &u);
     125             :     virtual AgentSandeshPtr GetAgentSandesh(const AgentSandeshArguments *args,
     126             :                                             const std::string &context);
     127             :     ForwardingClassData* BuildData(IFMapNode *node);
     128             : private:
     129             :     DISALLOW_COPY_AND_ASSIGN(ForwardingClassTable);
     130             : };
     131             : #endif

Generated by: LCOV version 1.14