OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bgp_rib_policy.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #include "bgp/bgp_rib_policy.h"
6 
7 using std::string;
8 using std::vector;
9 
11  : enabled(false),
12  all(false),
13  replace(false),
14  peer_loop_check(false) {
15 }
16 
18  : type(BgpProto::IBGP),
19  encoding(BGP),
20  as_number(0),
21  local_as_number(0),
22  as_override(false),
23  affinity(-1),
24  llgr(false),
25  as4_supported(false),
26  cluster_id(0) {
27 }
28 
30  : type(BgpProto::IBGP),
31  encoding(BGP),
32  as_number(0),
33  local_as_number(0),
34  as_override(false),
35  affinity(-1),
36  llgr(false),
37  as4_supported(false),
38  cluster_id(cluster_id) {
39 }
40 
42  int affinity, uint32_t cluster_id)
43  : type(type),
44  encoding(encoding),
45  as_number(0),
46  local_as_number(0),
47  as_override(false),
48  affinity(affinity),
49  llgr(false),
50  as4_supported(false),
51  cluster_id(cluster_id) {
52  if (encoding == XMPP)
53  assert(type == BgpProto::XMPP);
54  if (encoding == BGP)
55  assert(type == BgpProto::IBGP || type == BgpProto::EBGP);
56 }
57 
59  as_t as_number, bool as_override, bool llgr, bool as4, int affinity,
60  uint32_t cluster_id, as_t local_as_number)
61  : type(type),
62  encoding(encoding),
63  as_number(as_number),
64  local_as_number(local_as_number),
65  as_override(as_override),
66  affinity(affinity),
67  llgr(llgr),
68  as4_supported(as4),
69  cluster_id(cluster_id) {
70  if (encoding == XMPP)
71  assert(type == BgpProto::XMPP);
72  if (encoding == BGP)
73  assert(type == BgpProto::IBGP || type == BgpProto::EBGP);
74 }
75 
76 
78  as_t as_number, bool as_override, bool llgr, bool as4, IpAddress nexthop,
79  int affinity, uint32_t cluster_id,
80  vector<string> &default_tunnel_encap_list, as_t local_as_number) :
81  type(type),
82  encoding(BGP),
83  as_number(as_number),
84  local_as_number(local_as_number),
85  as_override(as_override),
86  nexthop(nexthop),
87  affinity(affinity),
88  llgr(llgr),
89  as4_supported(as4),
90  cluster_id(cluster_id),
91  default_tunnel_encap_list(default_tunnel_encap_list) {
92  assert(type == BgpProto::IBGP || type == BgpProto::EBGP);
93  assert(encoding == BGP);
94 }
95 
96 void RibExportPolicy::SetRemovePrivatePolicy(bool all, bool replace,
97  bool peer_loop_check) {
98  remove_private.enabled = true;
99  remove_private.all = all;
100  remove_private.replace = replace;
101  remove_private.peer_loop_check = peer_loop_check;
102 }
103 
104 //
105 // Implement operator< for RibExportPolicy by comparing each of the fields.
106 //
109  BOOL_KEY_COMPARE(type, rhs.type);
115  BOOL_KEY_COMPARE(llgr, rhs.llgr);
124  return false;
125 }
IpAddress nexthop
boost::asio::ip::address IpAddress
Definition: address.h:13
void SetRemovePrivatePolicy(bool all, bool replace, bool peer_loop_check)
uint32_t as_t
Definition: bgp_common.h:21
bool operator<(const RibExportPolicy &rhs) const
uint8_t type
Definition: load_balance.h:109
#define BOOL_KEY_COMPARE(x, y)
Definition: util.h:64
BgpProto::BgpPeerType type
uint32_t cluster_id
RemovePrivatePolicy remove_private
std::vector< std::string > default_tunnel_encap_list