OpenSDN source code
bgp_sandesh.h
Go to the documentation of this file.
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;
17 class BgpNeighborResp;
18 class BgpNeighborReq;
19 class ShowBgpNeighborSummaryReq;
20 class ShowNeighborStatisticsReq;
21 class ShowBgpPeeringConfigReq;
22 class ShowBgpPeeringConfigReqIterate;
23 
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 
38 
40  const NeighborListExtension &show_neighbor,
41  const NeighborStatisticsExtension &show_neighbor_statistics);
42 
44  const PeeringReqHandler &show_peering_req_handler,
45  const PeeringReqIterateHandler &show_peering_req_iterate_handler);
46 
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);
59  const ShowBgpPeeringConfigReqIterate *req_iterate);
60 
61  // For testing.
62  bool test_mode() const { return test_mode_; }
64  uint32_t page_limit() const { return page_limit_; }
66  uint32_t iter_limit() const { return iter_limit_; }
68 
69 private:
70  bool test_mode_;
71  uint32_t page_limit_;
72  uint32_t iter_limit_;
77 };
78 
79 #endif // SRC_BGP_BGP_SANDESH_H_
void SetPeeringShowHandlers(const PeeringReqHandler &show_peering_req_handler, const PeeringReqIterateHandler &show_peering_req_iterate_handler)
Definition: bgp_sandesh.cc:689
void SetNeighborShowExtensions(const NeighborListExtension &show_neighbor, const NeighborStatisticsExtension &show_neighbor_statistics)
Definition: bgp_sandesh.cc:664
NeighborStatisticsExtension show_neighbor_statistics_ext_
Definition: bgp_sandesh.h:74
void ShowNeighborStatisticsExtension(size_t *count, const ShowNeighborStatisticsReq *req) const
Definition: bgp_sandesh.cc:682
BgpXmppChannelManager * xmpp_peer_manager
Definition: bgp_sandesh.h:48
bool ShowNeighborExtension(const BgpSandeshContext *bsc, bool summary, uint32_t page_limit, uint32_t iter_limit, const std::string &start_neighbor, const std::string &search_string, std::vector< BgpNeighborResp > *list, std::string *next_neighbor) const
Definition: bgp_sandesh.cc:671
PeeringReqIterateHandler show_peering_req_iterate_handler_
Definition: bgp_sandesh.h:76
uint32_t iter_limit() const
Definition: bgp_sandesh.h:66
bool test_mode() const
Definition: bgp_sandesh.h:62
boost::function< bool(const BgpSandeshContext *, bool, uint32_t, uint32_t, const std::string &, const std::string &, std::vector< BgpNeighborResp > *, std::string *)> NeighborListExtension
Definition: bgp_sandesh.h:27
uint32_t iter_limit_
Definition: bgp_sandesh.h:72
boost::function< void(size_t *, const BgpSandeshContext *, const ShowNeighborStatisticsReq *)> NeighborStatisticsExtension
Definition: bgp_sandesh.h:30
boost::function< void(const BgpSandeshContext *, const ShowBgpPeeringConfigReq *)> PeeringReqHandler
Definition: bgp_sandesh.h:33
uint32_t page_limit() const
Definition: bgp_sandesh.h:64
boost::function< void(const BgpSandeshContext *, const ShowBgpPeeringConfigReqIterate *)> PeeringReqIterateHandler
Definition: bgp_sandesh.h:35
PeeringReqHandler show_peering_req_handler_
Definition: bgp_sandesh.h:75
void PeeringShowReqHandler(const ShowBgpPeeringConfigReq *req)
Definition: bgp_sandesh.cc:696
void set_page_limit(uint32_t page_limit)
Definition: bgp_sandesh.h:65
uint32_t page_limit_
Definition: bgp_sandesh.h:71
void set_iter_limit(uint32_t iter_limit)
Definition: bgp_sandesh.h:67
NeighborListExtension show_neighbor_ext_
Definition: bgp_sandesh.h:73
BgpServer * bgp_server
Definition: bgp_sandesh.h:47
void set_test_mode(bool test_mode)
Definition: bgp_sandesh.h:63
void PeeringShowReqIterateHandler(const ShowBgpPeeringConfigReqIterate *req_iterate)
Definition: bgp_sandesh.cc:706