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

Generated by: LCOV version 1.14