LCOV - code coverage report
Current view: top level - vnsw/agent/controller - controller_ifmap.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 6 9 66.7 %
Date: 2026-11-09 02:10:49 Functions: 6 8 75.0 %
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 __IFMAP_XMPP_H__
       7             : #define __IFMAP_XMPP_H__
       8             : 
       9             : #include <map>
      10             : #include <string>
      11             : 
      12             : #include <boost/function.hpp>
      13             : #include <boost/system/error_code.hpp>
      14             : 
      15             : #include <xmpp/xmpp_channel.h>
      16             : #include <cmn/agent_cmn.h>
      17             : 
      18             : class XmppChannel;
      19             : class AgentXmppChannel;
      20             : class ControllerVmiSubscribeData;
      21             : class ControllerWorkQueueData;
      22             : 
      23             : class EndOfConfigData : public ControllerWorkQueueData {
      24             : public:
      25             :     EndOfConfigData(AgentIfMapXmppChannel *ch);
      26          38 :     virtual ~EndOfConfigData() { }
      27             : 
      28          19 :     AgentIfMapXmppChannel *channel() {
      29          19 :         return channel_;
      30             :     }
      31             : 
      32             : private:
      33             :     AgentIfMapXmppChannel *channel_;
      34             :     DISALLOW_COPY_AND_ASSIGN(EndOfConfigData);
      35             : };
      36             : 
      37             : class AgentIfMapXmppChannel {
      38             : public:
      39             :     typedef boost::shared_ptr<EndOfConfigData> EndOfConfigDataPtr;
      40             :     explicit AgentIfMapXmppChannel(Agent *agent, XmppChannel *channel,
      41             :                                    uint8_t count);
      42             :     virtual ~AgentIfMapXmppChannel();
      43             : 
      44           0 :     virtual const std::string &identifier() const {
      45           0 :         return identifier_;
      46             :     }
      47             : 
      48             :     virtual std::string ToString() const;
      49             :     virtual bool SendUpdate(const std::string &msg);
      50             :     void ReceiveConfigMessage(std::unique_ptr<XmlBase> impl);
      51             :     virtual void ReceiveUpdate(const XmppStanza::XmppMessage *msg);
      52           0 :     uint8_t GetXmppServerIdx() { return xs_idx_; }
      53          76 :     static uint64_t GetSeqNumber() { return seq_number_; }
      54             :     static uint64_t NewSeqNumber();
      55             : 
      56             :     //config cleanup timer related routines
      57             :     ConfigCleanupTimer *config_cleanup_timer();
      58             :     void StartEndOfConfigTimer();
      59             :     void StopEndOfConfigTimer();
      60             :     void EnqueueEndOfConfig();
      61             :     void ProcessEndOfConfig();
      62             :     //End of config timer routines
      63             :     EndOfConfigTimer *end_of_config_timer();
      64             :     void StartConfigCleanupTimer();
      65             :     void StopConfigCleanupTimer();
      66             : 
      67             : protected:
      68             :     virtual void WriteReadyCb(const boost::system::error_code &ec);
      69             : 
      70             : private:
      71             :     void ReceiveInternal(const XmppStanza::XmppMessage *msg);
      72             :     XmppChannel *channel_;
      73             :     std::string identifier_;
      74             :     uint8_t xs_idx_;
      75             :     static uint64_t seq_number_;
      76             :     boost::scoped_ptr<ConfigCleanupTimer> config_cleanup_timer_;
      77             :     boost::scoped_ptr<EndOfConfigTimer> end_of_config_timer_;
      78             :     Agent *agent_;
      79             : };
      80             : 
      81             : class AgentIfMapVmExport {
      82             : public:
      83             :     typedef std::list<boost::uuids::uuid> UuidList;
      84             :     struct VmExportInfo {
      85             :         UuidList vmi_list_;
      86             :         uint64_t seq_number_;
      87             : 
      88         163 :         VmExportInfo(uint64_t seq_no) : vmi_list_(), seq_number_(seq_no) { }
      89         163 :         ~VmExportInfo() { }
      90             :     };
      91             : 
      92             :     AgentIfMapVmExport(Agent *agent);
      93             :     ~AgentIfMapVmExport();
      94             : 
      95             :     void VmiAdd(const ControllerVmiSubscribeData *entry);
      96             :     void VmiDelete(const ControllerVmiSubscribeData *entry);
      97             :     void VmiEvent(const ControllerVmiSubscribeData *entry);
      98             :     void NotifyAll(AgentXmppChannel *peer);
      99             :     typedef std::map<boost::uuids::uuid, struct VmExportInfo *> VmMap;
     100             :     Agent *agent() const {return agent_;}
     101             : 
     102             : private:
     103             :     DBTableBase::ListenerId vmi_list_id_;
     104             :     VmMap vm_map_;
     105             :     Agent *agent_;
     106             : };
     107             : #endif // __IFMAP_XMPP_H__

Generated by: LCOV version 1.14