libbgp  0.6
A C++ BGP Library.
route-event.h
Go to the documentation of this file.
1 
11 #ifndef ROUTE_EV_H_
12 #define ROUTE_EV_H_
13 #include <vector>
14 #include "bgp-path-attrib.h"
15 #include "bgp-update-message.h"
16 
17 namespace libbgp {
18 
19 /* forward */
20 class BgpRib4Entry;
21 class BgpRib6Entry;
22 
28  ADD4,
29  WITHDRAW4,
30  ADD6,
31  WITHDRAW6,
32  COLLISION
33 };
34 
39 class RouteEvent {
40 public:
41 
47  virtual ~RouteEvent() {}
48 };
49 
54 class Route4AddEvent : public RouteEvent {
55 public:
56  Route4AddEvent () {
57  type = ADD4;
58  ibgp_peer_asn = 0;
59  shared_attribs = NULL;
60  new_routes = NULL;
61  replaced_entries = NULL;
62  }
63 
68  const std::vector<std::shared_ptr<BgpPathAttrib>> *shared_attribs;
69 
74  const std::vector<Prefix4> *new_routes;
75 
80  const std::vector<BgpRib4Entry> *replaced_entries;
81 
88  uint32_t ibgp_peer_asn;
89 };
90 
96 public:
98  type = WITHDRAW4;
99  routes = NULL;
100  }
101 
106  std::vector<Prefix4> *routes;
107 };
108 
113 class Route6AddEvent : public RouteEvent {
114 public:
115  Route6AddEvent () {
116  type = ADD6;
117  ibgp_peer_asn = 0;
118  shared_attribs = NULL;
119  new_routes = NULL;
120  replaced_entries = NULL;
121  }
122 
127  std::vector<std::shared_ptr<BgpPathAttrib>> *shared_attribs;
128 
133  std::vector<Prefix6> *new_routes;
134 
139  const std::vector<BgpRib6Entry> *replaced_entries;
140 
145  uint8_t nexthop_global[16];
146 
151  uint8_t nexthop_linklocal[16];
152 
159  uint32_t ibgp_peer_asn;
160 };
161 
167 public:
168  Route6WithdrawEvent () { type = WITHDRAW6; }
169 
174  std::vector<Prefix6> *routes;
175 };
176 
185 public:
186  RouteCollisionEvent () { type = COLLISION; }
187  uint32_t peer_bgp_id;
188 };
189 
198 }
199 
200 #endif // ROUTE_EV_H_
RouteEventType
Type of route events.
Definition: route-event.h:27
std::vector< std::shared_ptr< BgpPathAttrib > > * shared_attribs
Path attribues of the route.
Definition: route-event.h:127
const std::vector< BgpRib4Entry > * replaced_entries
Pointer to the route replacement entries vector.
Definition: route-event.h:80
The BGP path attributes.
const std::vector< Prefix4 > * new_routes
Newly added routes.
Definition: route-event.h:74
const std::vector< std::shared_ptr< BgpPathAttrib > > * shared_attribs
Shared attributes for the new routes.
Definition: route-event.h:68
RouteEventType type
Type of this event.
Definition: route-event.h:46
Probe for collision detection.
Definition: route-event.h:184
An Route6WithdrawEvent.
Definition: route-event.h:166
std::vector< Prefix6 > * routes
Routes to withdraw.
Definition: route-event.h:174
An Route4WithdrawEvent.
Definition: route-event.h:95
An Route4AddEvent.
Definition: route-event.h:54
An Route6AddEvent.
Definition: route-event.h:113
Definition: bgp-afi.h:14
The BGP update message.
std::vector< Prefix6 > * new_routes
Routes to add.
Definition: route-event.h:133
std::vector< Prefix4 > * routes
Routes to withdraw.
Definition: route-event.h:106
uint32_t ibgp_peer_asn
ASN of the IBGP peer if the originating session is a IBGP session.
Definition: route-event.h:159
uint32_t ibgp_peer_asn
ASN of the IBGP peer if the originating session is a IBGP session.
Definition: route-event.h:88
const std::vector< BgpRib6Entry > * replaced_entries
Pointer to the route replacement entries vector.
Definition: route-event.h:139
The RouteEvent base.
Definition: route-event.h:39