LCOV - code coverage report
Current view: top level - control-node - control_node.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 1 1 100.0 %
Date: 2026-06-22 02:21:21 Functions: 1 1 100.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 ctrlplane__ctrl_node_h
       6             : 
       7             : #define ctrlplane__ctrl_node_h
       8             : 
       9             : #include <malloc.h>
      10             : #include <string>
      11             : #include "base/sandesh/process_info_types.h"
      12             : #include "io/event_manager.h"
      13             : #include "sandesh/sandesh_trace.h"
      14             : 
      15             : class BgpServer;
      16             : class BgpXmppChannelManager;
      17             : class IFMapServer;
      18             : class TaskTrigger;
      19             : 
      20             : #define CONTROL_NODE_EXIT(message)                       \
      21             :     do {                                                 \
      22             :         LOG(ERROR, "Control-Node Terminated: " message); \
      23             :         ControlNode::Exit(false);                        \
      24             :     } while (false)
      25             : 
      26             : class ControlNode {
      27             : public:
      28             :     static void SetDefaultSchedulingPolicy();
      29             :     static void SetHostname(const std::string name) { hostname_ = name; }
      30             :     static const std::string GetHostname() { return hostname_; }
      31             :     static const std::string &GetProgramName() { return prog_name_; }
      32             :     static void SetProgramName(const char *name) { prog_name_ = name; }
      33         192 :     static std::string GetSelfIp() { return self_ip_; }
      34             :     static void SetSelfIp(std::string ip) { self_ip_ = ip; }
      35             :     static void SetTestMode(const bool flag) { test_mode_ = flag; }
      36             :     static bool GetTestMode() { return test_mode_; }
      37             :     static void StartControlNodeInfoLogger(
      38             :         EventManager &evm, uint64_t period_msecs, const BgpServer *server,
      39             :         const BgpXmppChannelManager *xmpp_channel_mgr,
      40             :         const IFMapServer *ifmap_server, const string &build_info);
      41             :     static void Shutdown();
      42             :     static void Exit(bool do_assert);
      43             :     static std::string GetProcessState(bool bgpHasSelfConfiguration,
      44             :         bool bgpIsAdminDown, bool configEndOfRibComputed,
      45             :         process::ProcessState::type *state, std::string *message);
      46             : 
      47             : private:
      48             :     static bool ControlNodeInfoLogger(const BgpServer *server,
      49             :         const BgpXmppChannelManager *xmpp_channel_mgr,
      50             :         const IFMapServer *ifmap_server, const std::string &build_info);
      51             :     static bool ControlNodeInfoLogTimer(TaskTrigger *node_info_trigger);
      52             : 
      53             :     static std::string hostname_;
      54             :     static std::string prog_name_;
      55             :     static std::string self_ip_;
      56             :     static bool test_mode_;
      57             : 
      58             : };
      59             : 
      60             : void ControlNodeShutdown();
      61             : 
      62             : #endif // ctrlplane__ctrl_node_h

Generated by: LCOV version 1.14