OpenSDN source code
nexthop_entry.h
Go to the documentation of this file.
1
/*
2
* A simple representation of a nexthop entry: the nexthop string and
3
* its current state in the Nexthop DB. Used to send nexthop notifications
4
* to registered clients.
5
*/
6
#ifndef _AGENT_NHS_NEXTHOP_ENTRY_H_
7
#define _AGENT_NHS_NEXTHOP_ENTRY_H_
8
9
#include <boost/array.hpp>
10
#include <boost/asio.hpp>
11
#include <boost/asio/signal_set.hpp>
12
#include <boost/bind/bind.hpp>
13
#include <boost/enable_shared_from_this.hpp>
14
#include <boost/shared_ptr.hpp>
15
#include <cstdio>
16
#include <iostream>
17
18
using namespace
boost::placeholders;
19
20
class
NexthopDBEntry
{
21
22
static
const
int
kNexthopEntryOverhead = 32;
23
24
public
:
25
26
typedef
boost::shared_ptr<NexthopDBEntry>
NexthopPtr
;
27
28
enum
NexthopDBEntryState
{
29
NEXTHOP_STATE_CLEAN
,
30
NEXTHOP_STATE_MARKED
,
31
NEXTHOP_STATE_DELETED
32
};
33
34
NexthopDBEntry
(
const
std::string& nh)
35
: nexthop_string_(nh) {}
36
37
~NexthopDBEntry
() {
38
}
39
40
int
EncodedLength
() {
41
return
(nexthop_string_.length() + kNexthopEntryOverhead);
42
}
43
44
void
set_state
(
NexthopDBEntryState
state) {
45
state_ = state;
46
}
47
48
NexthopDBEntryState
state
() {
49
return
state_;
50
}
51
52
std::string&
nexthop_string
() {
53
return
nexthop_string_;
54
}
55
56
bool
operator==
(
NexthopDBEntry
& other)
57
{
58
return
(nexthop_string_ == other.
nexthop_string
());
59
}
60
61
private
:
62
std::string
nexthop_string_
;
63
NexthopDBEntryState
state_
;
64
};
65
66
#endif
NexthopDBEntry
Definition:
nexthop_entry.h:20
NexthopDBEntry::NexthopDBEntryState
NexthopDBEntryState
Definition:
nexthop_entry.h:28
NexthopDBEntry::NEXTHOP_STATE_MARKED
@ NEXTHOP_STATE_MARKED
Definition:
nexthop_entry.h:30
NexthopDBEntry::NEXTHOP_STATE_CLEAN
@ NEXTHOP_STATE_CLEAN
Definition:
nexthop_entry.h:29
NexthopDBEntry::nexthop_string
std::string & nexthop_string()
Definition:
nexthop_entry.h:52
NexthopDBEntry::state
NexthopDBEntryState state()
Definition:
nexthop_entry.h:48
NexthopDBEntry::~NexthopDBEntry
~NexthopDBEntry()
Definition:
nexthop_entry.h:37
NexthopDBEntry::NexthopPtr
boost::shared_ptr< NexthopDBEntry > NexthopPtr
Definition:
nexthop_entry.h:26
NexthopDBEntry::set_state
void set_state(NexthopDBEntryState state)
Definition:
nexthop_entry.h:44
NexthopDBEntry::nexthop_string_
std::string nexthop_string_
Definition:
nexthop_entry.h:62
NexthopDBEntry::NexthopDBEntry
NexthopDBEntry(const std::string &nh)
Definition:
nexthop_entry.h:34
NexthopDBEntry::state_
NexthopDBEntryState state_
Definition:
nexthop_entry.h:63
NexthopDBEntry::EncodedLength
int EncodedLength()
Definition:
nexthop_entry.h:40
operator==
bool operator==(const WaterMarkInfo &lhs, const WaterMarkInfo &rhs)
Definition:
watermark.h:36
contrail
controller
src
vnsw
agent
nexthop_server
nexthop_entry.h
Generated by
1.9.1