LCOV - code coverage report
Current view: top level - bgp - bgp_sandesh.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 6 6 100.0 %
Date: 2026-11-09 02:10:49 Functions: 6 6 100.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 SRC_BGP_BGP_SANDESH_H_
       7             : #define SRC_BGP_BGP_SANDESH_H_
       8             : 
       9             : #include <boost/function.hpp>
      10             : #include <sandesh/sandesh.h>
      11             : 
      12             : #include <string>
      13             : #include <vector>
      14             : 
      15             : class BgpServer;
      16             : class BgpXmppChannelManager;
      17             : class BgpNeighborResp;
      18             : class BgpNeighborReq;
      19             : class ShowBgpNeighborSummaryReq;
      20             : class ShowNeighborStatisticsReq;
      21             : class ShowBgpPeeringConfigReq;
      22             : class ShowBgpPeeringConfigReqIterate;
      23             : 
      24             : struct BgpSandeshContext : public SandeshContext {
      25             :     typedef boost::function<bool(const BgpSandeshContext *, bool,
      26             :         uint32_t, uint32_t, const std::string &, const std::string &,
      27             :         std::vector<BgpNeighborResp> *, std::string *)> NeighborListExtension;
      28             : 
      29             :     typedef boost::function<void(size_t *, const BgpSandeshContext *,
      30             :         const ShowNeighborStatisticsReq *)> NeighborStatisticsExtension;
      31             : 
      32             :     typedef boost::function<void(const BgpSandeshContext *,
      33             :         const ShowBgpPeeringConfigReq *)> PeeringReqHandler;
      34             :     typedef boost::function<void(const BgpSandeshContext *,
      35             :         const ShowBgpPeeringConfigReqIterate *)> PeeringReqIterateHandler;
      36             : 
      37             :     BgpSandeshContext();
      38             : 
      39             :     void SetNeighborShowExtensions(
      40             :         const NeighborListExtension &show_neighbor,
      41             :         const NeighborStatisticsExtension &show_neighbor_statistics);
      42             : 
      43             :     void SetPeeringShowHandlers(
      44             :         const PeeringReqHandler &show_peering_req_handler,
      45             :         const PeeringReqIterateHandler &show_peering_req_iterate_handler);
      46             : 
      47             :     BgpServer *bgp_server;
      48             :     BgpXmppChannelManager *xmpp_peer_manager;
      49             : 
      50             :     bool ShowNeighborExtension(const BgpSandeshContext *bsc, bool summary,
      51             :         uint32_t page_limit, uint32_t iter_limit,
      52             :         const std::string &start_neighbor, const std::string &search_string,
      53             :         std::vector<BgpNeighborResp> *list, std::string *next_neighbor) const;
      54             :     void ShowNeighborStatisticsExtension(size_t *count,
      55             :         const ShowNeighborStatisticsReq *req) const;
      56             : 
      57             :     void PeeringShowReqHandler(const ShowBgpPeeringConfigReq *req);
      58             :     void PeeringShowReqIterateHandler(
      59             :         const ShowBgpPeeringConfigReqIterate *req_iterate);
      60             : 
      61             :     // For testing.
      62        1222 :     bool test_mode() const { return test_mode_; }
      63          29 :     void set_test_mode(bool test_mode) { test_mode_ = test_mode; }
      64        5070 :     uint32_t page_limit() const { return page_limit_; }
      65         882 :     void set_page_limit(uint32_t page_limit) { page_limit_ = page_limit; }
      66        6223 :     uint32_t iter_limit() const { return iter_limit_; }
      67         850 :     void set_iter_limit(uint32_t iter_limit) { iter_limit_ = iter_limit; }
      68             : 
      69             : private:
      70             :     bool test_mode_;
      71             :     uint32_t page_limit_;
      72             :     uint32_t iter_limit_;
      73             :     NeighborListExtension show_neighbor_ext_;
      74             :     NeighborStatisticsExtension show_neighbor_statistics_ext_;
      75             :     PeeringReqHandler show_peering_req_handler_;
      76             :     PeeringReqIterateHandler show_peering_req_iterate_handler_;
      77             : };
      78             : 
      79             : #endif  // SRC_BGP_BGP_SANDESH_H_

Generated by: LCOV version 1.14