OpenSDN source code
message_builder.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_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;
17 class IPeerUpdate;
18 class RibOutAttr;
19 class RibOut;
20 
21 class Message {
22 public:
24  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  uint64_t num_reach_routes() const { return num_reach_route_; }
32  uint64_t num_unreach_routes() const { return num_unreach_route_; }
33 
34 protected:
35  uint64_t num_reach_route_;
37 
38  virtual void Reset() {
39  num_reach_route_ = 0;
41  }
42 
43 private:
45 };
46 
48 public:
50  virtual Message *Create() const = 0;
52  virtual ~MessageBuilder(){};
53 
54 private:
57 
59 };
60 
61 #endif // SRC_BGP_MESSAGE_BUILDER_H_
virtual ~MessageBuilder()
virtual Message * Create() const =0
static MessageBuilder * GetInstance(RibExportPolicy::Encoding encoding)
static BgpXmppMessageBuilder * xmpp_message_builder_
DISALLOW_COPY_AND_ASSIGN(MessageBuilder)
static BgpMessageBuilder * bgp_message_builder_
uint64_t num_reach_route_
virtual void Reset()
uint64_t num_unreach_routes() const
uint64_t num_reach_routes() const
virtual const uint8_t * GetData(IPeerUpdate *peer_update, size_t *lenp, const std::string **msg_str, std::string *temp)=0
DISALLOW_COPY_AND_ASSIGN(Message)
virtual bool Start(const RibOut *ribout, bool cache_routes, const RibOutAttr *roattr, const BgpRoute *route)=0
virtual bool AddRoute(const BgpRoute *route, const RibOutAttr *roattr)=0
virtual ~Message()
uint64_t num_unreach_route_
virtual void Finish()=0