libbgp  0.6
A C++ BGP Library.
route-event-bus.h
Go to the documentation of this file.
1 
11 #ifndef ROUTE_EV_BUS_H_
12 #define ROUTE_EV_BUS_H_
13 #include "route-event.h"
14 #include "route-event-receiver.h"
15 #include <vector>
16 namespace libbgp {
17 
18 class RouteEventReceiver;
19 
28 public:
29  RouteEventBus();
30 
31  // publish a route event. For non FSM (administratively/other proto), use fsm = NULL
32  // return number of subscriber reached, or -1 on error
33  int publish(RouteEventReceiver *recv, const RouteEvent &ev);
34 
35  // subscribe to event bus, return true if success
36  bool subscribe(RouteEventReceiver *recv);
37 
38  // unsubscribe from event bus, return true if success
39  bool unsubscribe(RouteEventReceiver *recv);
40 private:
41  std::vector<RouteEventReceiver *> subscribers;
42  int subscription_id;
43 };
44 
57 }
58 
59 #endif // ROUTE_EV_BUS_H_
int publish(RouteEventReceiver *recv, const RouteEvent &ev)
Publish a route event.
The RouteEventBus class.
Route event receiver.
bool subscribe(RouteEventReceiver *recv)
Subscribe from this event bus.
bool unsubscribe(RouteEventReceiver *recv)
Unsubscribe to this event bus.
Definition: bgp-afi.h:14
The route events.
The RouteEventReceiver interface.
The RouteEvent base.
Definition: route-event.h:39