akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 1 | #include <list> |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 2 | #include <cmath> |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 3 | |
| 4 | #include "nlsr.hpp" |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 5 | #include "nexthop-list.hpp" |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 6 | #include "fib.hpp" |
| 7 | |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 8 | |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 9 | |
| 10 | |
| 11 | namespace nlsr { |
| 12 | |
| 13 | using namespace std; |
| 14 | using namespace ndn; |
| 15 | |
| 16 | static bool |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 17 | fibEntryNameCompare(const FibEntry& fibEntry, const ndn::Name& name) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 18 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 19 | return fibEntry.getName() == name ; |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 20 | } |
| 21 | |
| 22 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 23 | Fib::cancelScheduledExpiringEvent(EventId eid) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 24 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 25 | m_nlsr.getScheduler().cancelEvent(eid); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | |
| 29 | ndn::EventId |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 30 | Fib::scheduleEntryRefreshing(const ndn::Name& name, int32_t feSeqNum, |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 31 | int32_t refreshTime) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 32 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 33 | std::cout << "Fib::scheduleEntryRefreshing Called" << std::endl; |
| 34 | std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 35 | return m_nlsr.getScheduler().scheduleEvent(ndn::time::seconds(refreshTime), |
| 36 | ndn::bind(&Fib::refreshEntry, this, |
| 37 | name, feSeqNum)); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 41 | Fib::refreshEntry(const ndn::Name& name, int32_t feSeqNum) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 42 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 43 | std::cout << "Fib::refreshEntry Called" << std::endl; |
| 44 | std::cout << "Name: " << name << " Seq Num: " << feSeqNum << std::endl; |
| 45 | std::list<FibEntry>::iterator it = std::find_if(m_table.begin(), |
| 46 | m_table.end(), |
| 47 | bind(&fibEntryNameCompare, _1, name)); |
| 48 | if (it != m_table.end()) |
| 49 | { |
| 50 | std::cout << "Entry found with Seq Num: " << feSeqNum << std::endl; |
| 51 | if (it->getSeqNo() == feSeqNum) |
| 52 | { |
| 53 | std::cout << "Refreshing the FIB entry" << std::endl; |
| 54 | for (std::list<NextHop>::iterator nhit = |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 55 | (*it).getNexthopList().getNextHops().begin(); |
| 56 | nhit != (*it).getNexthopList().getNextHops().end(); nhit++) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 57 | { |
| 58 | // add entry to NDN-FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 59 | registerPrefixInNfd(it->getName(), nhit->getConnectingFace(), |
| 60 | std::ceil(nhit->getRouteCost())); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 61 | } |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 62 | // increase sequence number and schedule refresh again |
| 63 | it->setSeqNo(feSeqNum + 1); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 64 | it->setExpiringEventId(scheduleEntryRefreshing(it->getName() , |
| 65 | it->getSeqNo(), |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 66 | m_refreshTime)); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 67 | } |
| 68 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 69 | } |
| 70 | |
| 71 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 72 | Fib::remove(const ndn::Name& name) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 73 | { |
| 74 | std::list<FibEntry>::iterator it = std::find_if(m_table.begin(), |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 75 | m_table.end(), |
akmhoque | c8a10f7 | 2014-04-25 18:42:55 -0500 | [diff] [blame] | 76 | bind(&fibEntryNameCompare, _1, name)); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 77 | if (it != m_table.end()) |
| 78 | { |
| 79 | for (std::list<NextHop>::iterator nhit = |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 80 | (*it).getNexthopList().getNextHops().begin(); |
| 81 | nhit != (*it).getNexthopList().getNextHops().end(); nhit++) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 82 | { |
| 83 | //remove entry from NDN-FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 84 | if (!m_nlsr.getAdjacencyList().isNeighbor(it->getName())) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 85 | { |
| 86 | unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace()); |
| 87 | } |
| 88 | else |
| 89 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 90 | if (m_nlsr.getAdjacencyList().getAdjacent(it->getName()).getConnectingFace() != |
| 91 | nhit->getConnectingFace()) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 92 | { |
| 93 | unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace()); |
| 94 | } |
| 95 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 96 | } |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 97 | std::cout << "Cancellling Scheduled event" << std::endl; |
| 98 | std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 99 | cancelScheduledExpiringEvent((*it).getExpiringEventId()); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 100 | m_table.erase(it); |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | |
| 105 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 106 | Fib::update(const ndn::Name& name, NexthopList& nextHopList) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 107 | { |
| 108 | std::cout << "Fib::updateFib Called" << std::endl; |
| 109 | int startFace = 0; |
| 110 | int endFace = getNumberOfFacesForName(nextHopList, |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 111 | m_nlsr.getConfParameter().getMaxFacesPerPrefix()); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 112 | std::list<FibEntry>::iterator it = std::find_if(m_table.begin(), |
| 113 | m_table.end(), |
| 114 | bind(&fibEntryNameCompare, _1, name)); |
| 115 | if (it == m_table.end()) |
| 116 | { |
| 117 | if (nextHopList.getSize() > 0) |
| 118 | { |
| 119 | nextHopList.sort(); |
| 120 | FibEntry newEntry(name); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 121 | std::list<NextHop> nhl = nextHopList.getNextHops(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 122 | std::list<NextHop>::iterator nhit = nhl.begin(); |
| 123 | for (int i = startFace; i < endFace && nhit != nhl.end(); ++nhit, i++) |
| 124 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 125 | newEntry.getNexthopList().addNextHop((*nhit)); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 126 | //Add entry to NDN-FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 127 | registerPrefixInNfd(name, nhit->getConnectingFace(), |
| 128 | std::ceil(nhit->getRouteCost())); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 129 | } |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 130 | newEntry.getNexthopList().sort(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 131 | newEntry.setTimeToRefresh(m_refreshTime); |
| 132 | newEntry.setSeqNo(1); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 133 | newEntry.setExpiringEventId(scheduleEntryRefreshing(name , 1, m_refreshTime)); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 134 | m_table.push_back(newEntry); |
| 135 | } |
| 136 | } |
| 137 | else |
| 138 | { |
| 139 | std::cout << "Old FIB Entry" << std::endl; |
| 140 | if (nextHopList.getSize() > 0) |
| 141 | { |
| 142 | nextHopList.sort(); |
| 143 | if (!it->isEqualNextHops(nextHopList)) |
| 144 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 145 | std::list<NextHop> nhl = nextHopList.getNextHops(); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 146 | std::list<NextHop>::iterator nhit = nhl.begin(); |
| 147 | // Add first Entry to NDN-FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 148 | registerPrefixInNfd(name, nhit->getConnectingFace(), |
| 149 | std::ceil(nhit->getRouteCost())); |
| 150 | removeHop(it->getNexthopList(), nhit->getConnectingFace(), name); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 151 | it->getNexthopList().reset(); |
| 152 | it->getNexthopList().addNextHop((*nhit)); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 153 | ++startFace; |
| 154 | ++nhit; |
| 155 | for (int i = startFace; i < endFace && nhit != nhl.end(); ++nhit, i++) |
| 156 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 157 | it->getNexthopList().addNextHop((*nhit)); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 158 | //Add Entry to NDN_FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 159 | registerPrefixInNfd(name, nhit->getConnectingFace(), |
| 160 | std::ceil(nhit->getRouteCost())); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 161 | } |
| 162 | } |
| 163 | it->setTimeToRefresh(m_refreshTime); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 164 | std::cout << "Cancellling Scheduled event" << std::endl; |
| 165 | std::cout << "Name: " << name << "Seq num: " << it->getSeqNo() << std::endl; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 166 | cancelScheduledExpiringEvent(it->getExpiringEventId()); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 167 | it->setSeqNo(it->getSeqNo() + 1); |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 168 | (*it).setExpiringEventId(scheduleEntryRefreshing(it->getName() , |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 169 | it->getSeqNo(), m_refreshTime)); |
| 170 | } |
| 171 | else |
| 172 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 173 | remove(name); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 174 | } |
| 175 | } |
| 176 | } |
| 177 | |
| 178 | |
| 179 | |
| 180 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 181 | Fib::clean() |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 182 | { |
| 183 | for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end(); |
| 184 | ++it) |
| 185 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 186 | std::cout << "Cancellling Scheduled event" << std::endl; |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 187 | std::cout << "Name: " << it->getName() << "Seq num: " << it->getSeqNo() << |
| 188 | std::endl; |
| 189 | cancelScheduledExpiringEvent((*it).getExpiringEventId()); |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 190 | for (std::list<NextHop>::iterator nhit = |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 191 | (*it).getNexthopList().getNextHops().begin(); |
| 192 | nhit != (*it).getNexthopList().getNextHops().end(); nhit++) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 193 | { |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 194 | //Remove entry from NDN-FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 195 | if (!m_nlsr.getAdjacencyList().isNeighbor(it->getName())) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 196 | { |
| 197 | unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace()); |
| 198 | } |
| 199 | else |
| 200 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 201 | if (m_nlsr.getAdjacencyList().getAdjacent(it->getName()).getConnectingFace() != |
| 202 | nhit->getConnectingFace()) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 203 | { |
| 204 | unregisterPrefixFromNfd(it->getName(), nhit->getConnectingFace()); |
| 205 | } |
| 206 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 207 | } |
| 208 | } |
| 209 | if (m_table.size() > 0) |
| 210 | { |
| 211 | m_table.clear(); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | int |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 216 | Fib::getNumberOfFacesForName(NexthopList& nextHopList, |
| 217 | uint32_t maxFacesPerPrefix) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 218 | { |
| 219 | int endFace = 0; |
| 220 | if ((maxFacesPerPrefix == 0) || (nextHopList.getSize() <= maxFacesPerPrefix)) |
| 221 | { |
| 222 | return nextHopList.getSize(); |
| 223 | } |
| 224 | else |
| 225 | { |
| 226 | return maxFacesPerPrefix; |
| 227 | } |
| 228 | return endFace; |
| 229 | } |
| 230 | |
| 231 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 232 | Fib::removeHop(NexthopList& nl, uint32_t doNotRemoveHopFaceId, |
| 233 | const ndn::Name& name) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 234 | { |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 235 | for (std::list<NextHop>::iterator it = nl.getNextHops().begin(); |
| 236 | it != nl.getNextHops().end(); ++it) |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 237 | { |
| 238 | if (it->getConnectingFace() != doNotRemoveHopFaceId) |
| 239 | { |
| 240 | //Remove FIB Entry from NDN-FIB |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 241 | if (!m_nlsr.getAdjacencyList().isNeighbor(name)) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 242 | { |
| 243 | unregisterPrefixFromNfd(name, it->getConnectingFace()); |
| 244 | } |
| 245 | else |
| 246 | { |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 247 | if (m_nlsr.getAdjacencyList().getAdjacent(name).getConnectingFace() != |
| 248 | it->getConnectingFace()) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 249 | { |
| 250 | unregisterPrefixFromNfd(name, it->getConnectingFace()); |
| 251 | } |
| 252 | } |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 258 | Fib::registerPrefixInNfd(const ndn::Name& namePrefix, uint64_t faceId, |
| 259 | uint64_t faceCost) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 260 | { |
| 261 | ndn::nfd::ControlParameters controlParameters; |
| 262 | controlParameters |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 263 | .setName(namePrefix) |
| 264 | .setCost(faceCost) |
| 265 | .setFaceId(faceId) |
| 266 | .setExpirationPeriod(ndn::time::milliseconds(m_refreshTime * 1000)) |
| 267 | .setOrigin(128); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 268 | m_controller.start<ndn::nfd::RibRegisterCommand>(controlParameters, |
| 269 | ndn::bind(&Fib::onSuccess, this, _1, |
| 270 | "Successful in name registration"), |
| 271 | ndn::bind(&Fib::onFailure, this, _1, _2, |
| 272 | "Failed in name registration")); |
| 273 | } |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 274 | |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 275 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 276 | Fib::unregisterPrefixFromNfd(const ndn::Name& namePrefix, uint64_t faceId) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 277 | { |
| 278 | ndn::nfd::ControlParameters controlParameters; |
| 279 | controlParameters |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 280 | .setName(namePrefix) |
| 281 | .setFaceId(faceId) |
| 282 | .setOrigin(128); |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 283 | m_controller.start<ndn::nfd::RibUnregisterCommand>(controlParameters, |
| 284 | ndn::bind(&Fib::onSuccess, this, _1, |
| 285 | "Successful in unregistering name"), |
| 286 | ndn::bind(&Fib::onFailure, this, _1, _2, |
| 287 | "Failed in unregistering name")); |
| 288 | } |
| 289 | |
| 290 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 291 | Fib::onSuccess(const ndn::nfd::ControlParameters& commandSuccessResult, |
| 292 | const std::string& message) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 293 | { |
| 294 | std::cout << message << ": " << commandSuccessResult << std::endl; |
| 295 | } |
| 296 | |
| 297 | void |
akmhoque | 31d1d4b | 2014-05-05 22:08:14 -0500 | [diff] [blame^] | 298 | Fib::onFailure(uint32_t code, const std::string& error, |
| 299 | const std::string& message) |
akmhoque | fdbddb1 | 2014-05-02 18:35:19 -0500 | [diff] [blame] | 300 | { |
| 301 | std::cout << message << ": " << error << " (code: " << code << ")"; |
| 302 | } |
| 303 | |
| 304 | |
| 305 | void |
akmhoque | 5335346 | 2014-04-22 08:43:45 -0500 | [diff] [blame] | 306 | Fib::print() |
| 307 | { |
| 308 | cout << "-------------------FIB-----------------------------" << endl; |
| 309 | for (std::list<FibEntry>::iterator it = m_table.begin(); it != m_table.end(); |
| 310 | ++it) |
| 311 | { |
| 312 | cout << (*it); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | } //namespace nlsr |