LCOV - code coverage report
Current view: top level - bgp - message_builder.h (source / functions) Hit Total Coverage
Test: OpenSDN C/C++ coverage (all TARGET_SET jobs) Lines: 9 10 90.0 %
Date: 2026-11-09 02:10:49 Functions: 6 9 66.7 %
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_MESSAGE_BUILDER_H_
       7             : #define SRC_BGP_MESSAGE_BUILDER_H_
       8             : 
       9             : #include <string>
      10             : 
      11             : #include "bgp/bgp_rib_policy.h"
      12             : 
      13             : class BgpMessageBuilder;
      14             : class BgpRoute;
      15             : class BgpTable;
      16             : class BgpXmppMessageBuilder;
      17             : class IPeerUpdate;
      18             : class RibOutAttr;
      19             : class RibOut;
      20             : 
      21             : class Message {
      22             : public:
      23         300 :     Message() : num_reach_route_(0), num_unreach_route_(0) { }
      24         300 :     virtual ~Message() { }
      25             :     virtual bool Start(const RibOut *ribout, bool cache_routes,
      26             :         const RibOutAttr *roattr, const BgpRoute *route) = 0;
      27             :     virtual bool AddRoute(const BgpRoute *route, const RibOutAttr *roattr) = 0;
      28             :     virtual void Finish() = 0;
      29             :     virtual const uint8_t *GetData(IPeerUpdate *peer_update, size_t *lenp,
      30             :         const std::string **msg_str, std::string *temp) = 0;
      31     3966767 :     uint64_t num_reach_routes() const { return num_reach_route_; }
      32     3967048 :     uint64_t num_unreach_routes() const { return num_unreach_route_; }
      33             : 
      34             : protected:
      35             :     uint64_t num_reach_route_;
      36             :     uint64_t num_unreach_route_;
      37             : 
      38      623637 :     virtual void Reset() {
      39      623637 :         num_reach_route_ =  0;
      40      623637 :         num_unreach_route_ = 0;
      41      623637 :     }
      42             : 
      43             : private:
      44             :     DISALLOW_COPY_AND_ASSIGN(Message);
      45             : };
      46             : 
      47             : class MessageBuilder {
      48             : public:
      49         107 :     MessageBuilder(){};
      50             :     virtual Message *Create() const = 0;
      51             :     static MessageBuilder *GetInstance(RibExportPolicy::Encoding encoding);
      52           0 :     virtual ~MessageBuilder(){};
      53             : 
      54             : private:
      55             :     static BgpMessageBuilder *bgp_message_builder_;
      56             :     static BgpXmppMessageBuilder *xmpp_message_builder_;
      57             : 
      58             :     DISALLOW_COPY_AND_ASSIGN(MessageBuilder);
      59             : };
      60             : 
      61             : #endif  // SRC_BGP_MESSAGE_BUILDER_H_

Generated by: LCOV version 1.14