OpenSDN source code
nexthop_client.h
Go to the documentation of this file.
1
/*
2
* NexthopDBClient class: represents a client connecting to the nexthop-server
3
* interface for nexthop notifications.
4
*/
5
#ifndef _AGENT_NHS_NEXTHOP_CLIENT_H_
6
#define _AGENT_NHS_NEXTHOP_CLIENT_H_
7
8
#include <boost/array.hpp>
9
#include <boost/asio.hpp>
10
#include <boost/asio/signal_set.hpp>
11
#include <boost/bind/bind.hpp>
12
#include <boost/enable_shared_from_this.hpp>
13
#include <boost/shared_ptr.hpp>
14
#include <cstdio>
15
#include <iostream>
16
#include "
io/usock_server.h
"
17
#include "
nexthop_entry.h
"
18
19
using namespace
boost::placeholders;
20
21
class
NexthopDBServer
;
22
23
/*
24
* Class to represent each client that connects to nexthop-server to
25
* receive nexthop notifications.
26
*/
27
class
NexthopDBClient
28
{
29
public
:
30
31
typedef
boost::shared_ptr <NexthopDBClient>
ClientPtr
;
32
typedef
std::vector <NexthopDBEntry::NexthopPtr>
NexthopList
;
33
typedef
std::vector <NexthopDBEntry::NexthopPtr>::iterator
34
NexthopListIterator
;
35
36
NexthopDBClient
(UnixDomainSocketSession *session,
NexthopDBServer
*server);
37
~
NexthopDBClient
();
38
39
void
AddNexthop(
NexthopDBEntry::NexthopPtr
nh);
40
void
RemoveNexthop(
NexthopDBEntry::NexthopPtr
nh);
41
bool
FindNexthop(
NexthopDBEntry::NexthopPtr
nh);
42
43
/*
44
* Handle events from the underlying (unix socket) session to this client
45
*/
46
void
EventHandler(UnixDomainSocketSession *,
47
UnixDomainSocketSession::Event
);
48
49
protected
:
50
friend
class
NexthopDBServer
;
51
52
private
:
53
UnixDomainSocketSession *
session_
;
54
NexthopDBServer
*
server_
;
55
56
/*
57
* Each client object maintains its own vector of nexthops that need to be
58
* dispatched. The nexthop pointer is removed from the vector after the
59
* dispatch.
60
*/
61
NexthopList
nexthop_list_
;
62
63
void
WriteMessage();
64
uint8_t *NextMessage(
int
*length);
65
};
66
67
#endif
NexthopDBClient
Definition:
nexthop_client.h:28
NexthopDBClient::nexthop_list_
NexthopList nexthop_list_
Definition:
nexthop_client.h:61
NexthopDBClient::NexthopListIterator
std::vector< NexthopDBEntry::NexthopPtr >::iterator NexthopListIterator
Definition:
nexthop_client.h:34
NexthopDBClient::ClientPtr
boost::shared_ptr< NexthopDBClient > ClientPtr
Definition:
nexthop_client.h:31
NexthopDBClient::session_
UnixDomainSocketSession * session_
Definition:
nexthop_client.h:53
NexthopDBClient::server_
NexthopDBServer * server_
Definition:
nexthop_client.h:54
NexthopDBClient::NexthopList
std::vector< NexthopDBEntry::NexthopPtr > NexthopList
Definition:
nexthop_client.h:32
NexthopDBEntry::NexthopPtr
boost::shared_ptr< NexthopDBEntry > NexthopPtr
Definition:
nexthop_entry.h:26
NexthopDBServer
Definition:
nexthop_server.h:29
Event
Event
Definition:
http_client.h:29
nexthop_entry.h
usock_server.h
contrail
controller
src
vnsw
agent
nexthop_server
nexthop_client.h
Generated by
1.9.1