LCOV - code coverage report
Current view: top level - vnsw/agent/oper - security_logging_object.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 0 23 0.0 %
Date: 2026-11-09 02:10:49 Functions: 0 11 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
       3             :  * Copyright Contributors to the OpenSDN project
       4             :  */
       5             : 
       6             : #ifndef __AGENT_OPER_SECURITY_LOGGING_OBJECT_H
       7             : #define __AGENT_OPER_SECURITY_LOGGING_OBJECT_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             : 
      16             : struct SloRuleInfo {
      17             :     boost::uuids::uuid uuid_;
      18             :     int rate_;
      19           0 :     SloRuleInfo(const boost::uuids::uuid &u, int rate) : uuid_(u), rate_(rate) {
      20           0 :     }
      21           0 :     bool operator==(const SloRuleInfo &rhs) const {
      22           0 :         if (uuid_ == rhs.uuid_) {
      23           0 :             return rate_ == rhs.rate_;
      24             :         }
      25           0 :         return false;
      26             :     }
      27             : };
      28             : 
      29             : typedef std::vector<SloRuleInfo> SloRuleList;
      30             : struct SecurityLoggingObjectKey : public AgentOperDBKey {
      31             : public:
      32           0 :     SecurityLoggingObjectKey(const boost::uuids::uuid &uuid):
      33           0 :         uuid_(uuid) {}
      34             : 
      35             :     SecurityLoggingObjectKey(const SecurityLoggingObjectKey &rhs):
      36             :         uuid_(rhs.uuid_) {}
      37             : 
      38             :     bool IsLess(const SecurityLoggingObjectKey &rhs) const {
      39             :         return uuid_ < rhs.uuid_;
      40             :     }
      41             : 
      42             :     boost::uuids::uuid uuid_;
      43             : };
      44             : 
      45             : struct SecurityLoggingObjectData : public AgentOperDBData {
      46             : public:
      47           0 :     SecurityLoggingObjectData(const Agent *agent, IFMapNode *node,
      48             :               const std::vector<autogen::SecurityLoggingObjectRuleEntryType> &lst,
      49           0 :               const int &rate, const bool status, const std::string &name):
      50           0 :     AgentOperDBData(agent, node), rules_(lst), status_(status), rate_(rate), name_(name),
      51           0 :         firewall_policy_list_(), firewall_rule_list_() {}
      52             : 
      53             :     std::vector<autogen::SecurityLoggingObjectRuleEntryType> rules_;
      54             :     bool status_;
      55             :     int rate_;
      56             :     std::string name_;
      57             :     SloRuleList firewall_policy_list_;
      58             :     SloRuleList firewall_rule_list_;
      59             : };
      60             : 
      61             : class SecurityLoggingObject:
      62             :     AgentRefCount<SecurityLoggingObject>, public AgentOperDBEntry {
      63             : public:
      64             :     SecurityLoggingObject(const boost::uuids::uuid &uuid);
      65             :     virtual ~SecurityLoggingObject();
      66             : 
      67             :     KeyPtr GetDBRequestKey() const;
      68             :     virtual void SetKey(const DBRequestKey *key);
      69             :     std::string ToString() const;
      70             :     virtual bool IsLess(const DBEntry &rhs) const;
      71             :     virtual bool DBEntrySandesh(Sandesh *resp, std::string &name) const;
      72             :     virtual bool Change(const DBRequest *req);
      73             :     bool IsEqual(const std::vector<autogen::SecurityLoggingObjectRuleEntryType>
      74             :                  &lhs,
      75             :                  const std::vector<autogen::SecurityLoggingObjectRuleEntryType>
      76             :                  &rhs) const;
      77             : 
      78           0 :     uint32_t GetRefCount() const {
      79           0 :         return AgentRefCount<SecurityLoggingObject>::GetRefCount();
      80             :     }
      81             : 
      82           0 :     bool status() const {
      83           0 :         return status_;
      84             :     }
      85           0 :     const boost::uuids::uuid& uuid() const {
      86           0 :         return uuid_;
      87             :     }
      88           0 :     const std::vector<autogen::SecurityLoggingObjectRuleEntryType> & rules()
      89             :         const {
      90           0 :         return rules_;
      91             :     }
      92           0 :     int rate() const { return rate_; }
      93             :     const std::string& name() const {
      94             :         return name_;
      95             :     }
      96           0 :     SloRuleList& firewall_policy_list() { return firewall_policy_list_;}
      97           0 :     SloRuleList& firewall_rule_list() { return firewall_rule_list_;}
      98             : 
      99             : private:
     100             :     bool status_;
     101             :     boost::uuids::uuid uuid_;
     102             :     std::vector<autogen::SecurityLoggingObjectRuleEntryType> rules_;
     103             :     int rate_;
     104             :     std::string name_;
     105             :     SloRuleList firewall_policy_list_;
     106             :     SloRuleList firewall_rule_list_;
     107             :     DISALLOW_COPY_AND_ASSIGN(SecurityLoggingObject);
     108             : };
     109             : 
     110             : class SecurityLoggingObjectTable : public AgentOperDBTable {
     111             : public:
     112             :     SecurityLoggingObjectTable(Agent *agent, DB *db, const std::string &name);
     113             :     virtual ~SecurityLoggingObjectTable();
     114             : 
     115             :     static DBTableBase *CreateTable(Agent *agent, DB *db,
     116             :                                     const std::string &name);
     117             :     virtual std::unique_ptr<DBEntry> AllocEntry(const DBRequestKey *k) const;
     118             :     virtual DBEntry *OperDBAdd(const DBRequest *req);
     119             :     virtual bool OperDBOnChange(DBEntry *entry, const DBRequest *req);
     120             :     virtual bool OperDBDelete(DBEntry *entry, const DBRequest *req);
     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             :     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             : 
     129             : private:
     130             :     SecurityLoggingObjectData* BuildData(IFMapNode *node) const;
     131             :     DISALLOW_COPY_AND_ASSIGN(SecurityLoggingObjectTable);
     132             : };
     133             : #endif

Generated by: LCOV version 1.14