OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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.hpp>
13 #include <boost/enable_shared_from_this.hpp>
14 #include <boost/shared_ptr.hpp>
15 #include <cstdio>
16 #include <iostream>
17 #include <tbb/mutex.h>
18 
20 
21  static const int kNexthopEntryOverhead = 32;
22 
23  public:
24 
25  typedef boost::shared_ptr<NexthopDBEntry> NexthopPtr;
26 
31  };
32 
33  NexthopDBEntry(const std::string& nh)
34  : nexthop_string_(nh) {}
35 
37  }
38 
39  int EncodedLength() {
40  return (nexthop_string_.length() + kNexthopEntryOverhead);
41  }
42 
44  state_ = state;
45  }
46 
48  return state_;
49  }
50 
51  std::string& nexthop_string() {
52  return nexthop_string_;
53  }
54 
56  {
57  return (nexthop_string_ == other.nexthop_string());
58  }
59 
60  private:
61  std::string nexthop_string_;
63 };
64 
65 #endif
bool operator==(NexthopDBEntry &other)
Definition: nexthop_entry.h:55
boost::shared_ptr< NexthopDBEntry > NexthopPtr
Definition: nexthop_entry.h:25
static const int kNexthopEntryOverhead
Definition: nexthop_entry.h:21
std::string nexthop_string_
Definition: nexthop_entry.h:61
NexthopDBEntryState state()
Definition: nexthop_entry.h:47
std::string & nexthop_string()
Definition: nexthop_entry.h:51
NexthopDBEntryState state_
Definition: nexthop_entry.h:62
NexthopDBEntry(const std::string &nh)
Definition: nexthop_entry.h:33
void set_state(NexthopDBEntryState state)
Definition: nexthop_entry.h:43