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

Generated by: LCOV version 1.14