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-06-04 02:06:09 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             :  */
       4             : 
       5             : #ifndef SRC_BGP_MESSAGE_BUILDER_H_
       6             : #define SRC_BGP_MESSAGE_BUILDER_H_
       7             : 
       8             : #include <string>
       9             : 
      10             : #include "bgp/bgp_rib_policy.h"
      11             : 
      12             : class BgpMessageBuilder;
      13             : class BgpRoute;
      14             : class BgpTable;
      15             : class BgpXmppMessageBuilder;
      16             : class IPeerUpdate;
      17             : class RibOutAttr;
      18             : class RibOut;
      19             : 
      20             : class Message {
      21             : public:
      22         300 :     Message() : num_reach_route_(0), num_unreach_route_(0) { }
      23         300 :     virtual ~Message() { }
      24             :     virtual bool Start(const RibOut *ribout, bool cache_routes,
      25             :         const RibOutAttr *roattr, const BgpRoute *route) = 0;
      26             :     virtual bool AddRoute(const BgpRoute *route, const RibOutAttr *roattr) = 0;
      27             :     virtual void Finish() = 0;
      28             :     virtual const uint8_t *GetData(IPeerUpdate *peer_update, size_t *lenp,
      29             :         const std::string **msg_str, std::string *temp) = 0;
      30     4025110 :     uint64_t num_reach_routes() const { return num_reach_route_; }
      31     4025277 :     uint64_t num_unreach_routes() const { return num_unreach_route_; }
      32             : 
      33             : protected:
      34             :     uint64_t num_reach_route_;
      35             :     uint64_t num_unreach_route_;
      36             : 
      37      632007 :     virtual void Reset() {
      38      632007 :         num_reach_route_ =  0;
      39      632007 :         num_unreach_route_ = 0;
      40      632007 :     }
      41             : 
      42             : private:
      43             :     DISALLOW_COPY_AND_ASSIGN(Message);
      44             : };
      45             : 
      46             : class MessageBuilder {
      47             : public:
      48         107 :     MessageBuilder(){};
      49             :     virtual Message *Create() const = 0;
      50             :     static MessageBuilder *GetInstance(RibExportPolicy::Encoding encoding);
      51           0 :     virtual ~MessageBuilder(){};
      52             : 
      53             : private:
      54             :     static BgpMessageBuilder *bgp_message_builder_;
      55             :     static BgpXmppMessageBuilder *xmpp_message_builder_;
      56             : 
      57             :     DISALLOW_COPY_AND_ASSIGN(MessageBuilder);
      58             : };
      59             : 
      60             : #endif  // SRC_BGP_MESSAGE_BUILDER_H_

Generated by: LCOV version 1.14