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 
21 
22  static const int kNexthopEntryOverhead = 32;
23 
24  public:
25 
26  typedef boost::shared_ptr<NexthopDBEntry> NexthopPtr;
27 
31  NEXTHOP_STATE_DELETED
32  };
33 
34  NexthopDBEntry(const std::string& nh)
35  : nexthop_string_(nh) {}
36 
38  }
39 
40  int EncodedLength() {
41  return (nexthop_string_.length() + kNexthopEntryOverhead);
42  }
43 
45  state_ = state;
46  }
47 
49  return state_;
50  }
51 
52  std::string& nexthop_string() {
53  return nexthop_string_;
54  }
55 
57  {
58  return (nexthop_string_ == other.nexthop_string());
59  }
60 
61  private:
62  std::string nexthop_string_;
64 };
65 
66 #endif
std::string & nexthop_string()
Definition: nexthop_entry.h:52
NexthopDBEntryState state()
Definition: nexthop_entry.h:48
boost::shared_ptr< NexthopDBEntry > NexthopPtr
Definition: nexthop_entry.h:26
void set_state(NexthopDBEntryState state)
Definition: nexthop_entry.h:44
std::string nexthop_string_
Definition: nexthop_entry.h:62
NexthopDBEntry(const std::string &nh)
Definition: nexthop_entry.h:34
NexthopDBEntryState state_
Definition: nexthop_entry.h:63
bool operator==(const WaterMarkInfo &lhs, const WaterMarkInfo &rhs)
Definition: watermark.h:36