akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 1 | #include<string> |
| 2 | #include<iostream> |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 3 | #include<sstream> |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 4 | #include<algorithm> |
| 5 | #include<cmath> |
| 6 | #include<limits> |
| 7 | |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 8 | #include "nlsr.hpp" |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 9 | #include "nlsr_lsa.hpp" |
| 10 | #include "nlsr_npl.hpp" |
| 11 | #include "nlsr_adjacent.hpp" |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 12 | #include "utility/nlsr_tokenizer.hpp" |
| 13 | |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 14 | |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 15 | namespace nlsr |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 16 | { |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 17 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 18 | using namespace std; |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 19 | |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 20 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 21 | string |
| 22 | NameLsa::getNameLsaKey() |
| 23 | { |
| 24 | string key; |
| 25 | key=origRouter + "/" + boost::lexical_cast<std::string>(1); |
| 26 | return key; |
| 27 | } |
| 28 | |
| 29 | NameLsa::NameLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, Npl npl) |
| 30 | { |
| 31 | origRouter=origR; |
| 32 | lsType=lst; |
| 33 | lsSeqNo=lsn; |
| 34 | lifeTime=lt; |
| 35 | std::list<string> nl=npl.getNameList(); |
| 36 | for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 37 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 38 | addNameToLsa((*it)); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 39 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 40 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 41 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 42 | string |
| 43 | NameLsa::getNameLsaData() |
| 44 | { |
| 45 | string nameLsaData; |
| 46 | nameLsaData=origRouter + "|" + boost::lexical_cast<std::string>(1) + "|" |
| 47 | + boost::lexical_cast<std::string>(lsSeqNo) + "|" |
| 48 | + boost::lexical_cast<std::string>(lifeTime); |
| 49 | nameLsaData+="|"; |
| 50 | nameLsaData+=boost::lexical_cast<std::string>(npl.getNplSize()); |
| 51 | std::list<string> nl=npl.getNameList(); |
| 52 | for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 53 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 54 | nameLsaData+="|"; |
| 55 | nameLsaData+=(*it); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 56 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 57 | return nameLsaData+"|"; |
| 58 | } |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 59 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 60 | bool |
| 61 | NameLsa::initNameLsaFromContent(string content) |
| 62 | { |
| 63 | uint32_t numName=0; |
| 64 | nlsrTokenizer nt(content, "|"); |
| 65 | origRouter=nt.getNextToken(); |
| 66 | if(origRouter.empty()) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 67 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 68 | return false; |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 69 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 70 | try |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 71 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 72 | lsType=boost::lexical_cast<uint8_t>(nt.getNextToken()); |
| 73 | lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
| 74 | lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
| 75 | numName=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 76 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 77 | catch(std::exception &e) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 78 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 79 | return false; |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 80 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 81 | for(int i=0; i<numName; i++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 82 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 83 | string name=nt.getNextToken(); |
| 84 | addNameToLsa(name); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 85 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 86 | return true; |
| 87 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 88 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 89 | std::ostream& |
| 90 | operator<<(std::ostream& os, NameLsa& nLsa) |
| 91 | { |
| 92 | os<<"Name Lsa: "<<endl; |
| 93 | os<<" Origination Router: "<<nLsa.getOrigRouter()<<endl; |
| 94 | os<<" Ls Type: "<<(unsigned short)nLsa.getLsType()<<endl; |
| 95 | os<<" Ls Seq No: "<<(unsigned int)nLsa.getLsSeqNo()<<endl; |
| 96 | os<<" Ls Lifetime: "<<(unsigned int)nLsa.getLifeTime()<<endl; |
| 97 | os<<" Names: "<<endl; |
| 98 | int i=1; |
| 99 | std::list<string> nl=nLsa.getNpl().getNameList(); |
| 100 | for( std::list<string>::iterator it=nl.begin(); it != nl.end(); it++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 101 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 102 | os<<" Name "<<i<<": "<<(*it)<<endl; |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 103 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 104 | return os; |
| 105 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 106 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 107 | |
| 108 | |
| 109 | CorLsa::CorLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt |
| 110 | , double r, double theta) |
| 111 | { |
| 112 | origRouter=origR; |
| 113 | lsType=lst; |
| 114 | lsSeqNo=lsn; |
| 115 | lifeTime=lt; |
| 116 | corRad=r; |
| 117 | corTheta=theta; |
| 118 | } |
| 119 | |
| 120 | string |
| 121 | CorLsa::getCorLsaKey() |
| 122 | { |
| 123 | string key; |
| 124 | key=origRouter + "/" + boost::lexical_cast<std::string>(3); |
| 125 | return key; |
| 126 | } |
| 127 | |
| 128 | bool |
| 129 | CorLsa::isLsaContentEqual(CorLsa& clsa) |
| 130 | { |
| 131 | return (std::abs(corRad - clsa.getCorRadius()) < |
| 132 | std::numeric_limits<double>::epsilon()) && |
| 133 | (std::abs(corTheta - clsa.getCorTheta()) < |
| 134 | std::numeric_limits<double>::epsilon()); |
| 135 | } |
| 136 | |
| 137 | string |
| 138 | CorLsa::getCorLsaData() |
| 139 | { |
| 140 | string corLsaData; |
| 141 | corLsaData=origRouter + "|"; |
| 142 | corLsaData+=(boost::lexical_cast<std::string>(3) + "|"); |
| 143 | corLsaData+=(boost::lexical_cast<std::string>(lsSeqNo) + "|"); |
| 144 | corLsaData+=(boost::lexical_cast<std::string>(lifeTime) + "|"); |
| 145 | corLsaData+=(boost::lexical_cast<std::string>(corRad) + "|"); |
| 146 | corLsaData+=(boost::lexical_cast<std::string>(corTheta) + "|"); |
| 147 | return corLsaData; |
| 148 | } |
| 149 | |
| 150 | bool |
| 151 | CorLsa::initCorLsaFromContent(string content) |
| 152 | { |
| 153 | nlsrTokenizer nt(content, "|"); |
| 154 | origRouter=nt.getNextToken(); |
| 155 | if(origRouter.empty()) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 156 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 157 | return false; |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 158 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 159 | try |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 160 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 161 | lsType=boost::lexical_cast<uint8_t>(nt.getNextToken()); |
| 162 | lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
| 163 | lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
| 164 | corRad=boost::lexical_cast<double>(nt.getNextToken()); |
| 165 | corTheta=boost::lexical_cast<double>(nt.getNextToken()); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 166 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 167 | catch(std::exception &e) |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 168 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 169 | return false; |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 170 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 171 | return true; |
| 172 | } |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 173 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 174 | std::ostream& |
| 175 | operator<<(std::ostream& os, CorLsa& cLsa) |
| 176 | { |
| 177 | os<<"Cor Lsa: "<<endl; |
| 178 | os<<" Origination Router: "<<cLsa.getOrigRouter()<<endl; |
| 179 | os<<" Ls Type: "<<(unsigned short)cLsa.getLsType()<<endl; |
| 180 | os<<" Ls Seq No: "<<(unsigned int)cLsa.getLsSeqNo()<<endl; |
| 181 | os<<" Ls Lifetime: "<<(unsigned int)cLsa.getLifeTime()<<endl; |
| 182 | os<<" Hyperbolic Radius: "<<cLsa.getCorRadius()<<endl; |
| 183 | os<<" Hyperbolic Theta: "<<cLsa.getCorTheta()<<endl; |
| 184 | return os; |
| 185 | } |
| 186 | |
| 187 | |
| 188 | AdjLsa::AdjLsa(string origR, uint8_t lst, uint32_t lsn, uint32_t lt, |
| 189 | uint32_t nl ,Adl padl) |
| 190 | { |
| 191 | origRouter=origR; |
| 192 | lsType=lst; |
| 193 | lsSeqNo=lsn; |
| 194 | lifeTime=lt; |
| 195 | noLink=nl; |
| 196 | std::list<Adjacent> al=padl.getAdjList(); |
| 197 | for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 198 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 199 | if((*it).getStatus()==1) |
| 200 | { |
| 201 | addAdjacentToLsa((*it)); |
| 202 | } |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 203 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | string |
| 207 | AdjLsa::getAdjLsaKey() |
| 208 | { |
| 209 | string key; |
| 210 | key=origRouter + "/" + boost::lexical_cast<std::string>(2); |
| 211 | return key; |
| 212 | } |
| 213 | |
| 214 | bool |
| 215 | AdjLsa::isLsaContentEqual(AdjLsa& alsa) |
| 216 | { |
| 217 | return adl.isAdlEqual(alsa.getAdl()); |
| 218 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 219 | |
| 220 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 221 | string |
| 222 | AdjLsa::getAdjLsaData() |
| 223 | { |
| 224 | string adjLsaData; |
| 225 | adjLsaData=origRouter + "|" + boost::lexical_cast<std::string>(2) + "|" |
| 226 | + boost::lexical_cast<std::string>(lsSeqNo) + "|" |
| 227 | + boost::lexical_cast<std::string>(lifeTime); |
| 228 | adjLsaData+="|"; |
| 229 | adjLsaData+=boost::lexical_cast<std::string>(adl.getAdlSize()); |
| 230 | std::list<Adjacent> al=adl.getAdjList(); |
| 231 | for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 232 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 233 | adjLsaData+="|"; |
| 234 | adjLsaData+=(*it).getAdjacentName(); |
| 235 | adjLsaData+="|"; |
| 236 | adjLsaData+=boost::lexical_cast<std::string>((*it).getConnectingFace()); |
| 237 | adjLsaData+="|"; |
| 238 | adjLsaData+=boost::lexical_cast<std::string>((*it).getLinkCost()); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 239 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 240 | return adjLsaData+"|"; |
| 241 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 242 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 243 | bool |
| 244 | AdjLsa::initAdjLsaFromContent(string content) |
| 245 | { |
| 246 | uint32_t numLink=0; |
| 247 | nlsrTokenizer nt(content, "|"); |
| 248 | origRouter=nt.getNextToken(); |
| 249 | if(origRouter.empty()) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 250 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 251 | return false; |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 252 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 253 | try |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 254 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 255 | lsType=boost::lexical_cast<uint8_t>(nt.getNextToken()); |
| 256 | lsSeqNo=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
| 257 | lifeTime=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
| 258 | numLink=boost::lexical_cast<uint32_t>(nt.getNextToken()); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 259 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 260 | catch(std::exception &e) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 261 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 262 | return false; |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 263 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 264 | for(int i=0; i< numLink; i++) |
akmhoque | 2bb198e | 2014-02-28 11:46:27 -0600 | [diff] [blame] | 265 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 266 | try |
| 267 | { |
| 268 | string adjName=nt.getNextToken(); |
| 269 | int connectingFace=boost::lexical_cast<int>(nt.getNextToken()); |
| 270 | double linkCost=boost::lexical_cast<double>(nt.getNextToken()); |
| 271 | Adjacent adjacent(adjName, connectingFace, linkCost, 0, 0); |
| 272 | addAdjacentToLsa(adjacent); |
| 273 | } |
| 274 | catch( std::exception &e ) |
| 275 | { |
| 276 | return false; |
| 277 | } |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 278 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 279 | return true; |
| 280 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 281 | |
| 282 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 283 | void |
| 284 | AdjLsa::addNptEntriesForAdjLsa(Nlsr& pnlsr) |
| 285 | { |
| 286 | if ( getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() ) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 287 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 288 | pnlsr.getNpt().addNpteByDestName(getOrigRouter(), getOrigRouter(),pnlsr); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 289 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 290 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 291 | |
| 292 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 293 | void |
| 294 | AdjLsa::removeNptEntriesForAdjLsa(Nlsr& pnlsr) |
| 295 | { |
| 296 | if ( getOrigRouter() !=pnlsr.getConfParameter().getRouterPrefix() ) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 297 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 298 | pnlsr.getNpt().removeNpte(getOrigRouter(), getOrigRouter(),pnlsr); |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 299 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 300 | } |
akmhoque | 298385a | 2014-02-13 14:13:09 -0600 | [diff] [blame] | 301 | |
| 302 | |
| 303 | |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 304 | std::ostream& |
| 305 | operator<<(std::ostream& os, AdjLsa& aLsa) |
| 306 | { |
| 307 | os<<"Adj Lsa: "<<endl; |
| 308 | os<<" Origination Router: "<<aLsa.getOrigRouter()<<endl; |
| 309 | os<<" Ls Type: "<<(unsigned short)aLsa.getLsType()<<endl; |
| 310 | os<<" Ls Seq No: "<<(unsigned int)aLsa.getLsSeqNo()<<endl; |
| 311 | os<<" Ls Lifetime: "<<(unsigned int)aLsa.getLifeTime()<<endl; |
| 312 | os<<" No Link: "<<(unsigned int)aLsa.getNoLink()<<endl; |
| 313 | os<<" Adjacents: "<<endl; |
| 314 | int i=1; |
| 315 | std::list<Adjacent> al=aLsa.getAdl().getAdjList(); |
| 316 | for( std::list<Adjacent>::iterator it=al.begin(); it != al.end(); it++) |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 317 | { |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 318 | os<<" Adjacent "<<i<<": "<<endl; |
| 319 | os<<" Adjacent Name: "<<(*it).getAdjacentName()<<endl; |
| 320 | os<<" Connecting Face: "<<(*it).getConnectingFace()<<endl; |
| 321 | os<<" Link Cost: "<<(*it).getLinkCost()<<endl; |
akmhoque | 1fd8c1e | 2014-02-19 19:41:49 -0600 | [diff] [blame] | 322 | } |
akmhoque | 5a44dd4 | 2014-03-12 18:11:32 -0500 | [diff] [blame] | 323 | return os; |
| 324 | } |
akmhoque | b1710aa | 2014-02-19 17:13:36 -0600 | [diff] [blame] | 325 | |
| 326 | }//namespace nlsr |