#include <IPv6InterfaceData.h>
|
|
|
|
|
|
00310 {}
|
|
00437 {return nodeConstants.delayFirstProbeTime;}
|
|
00433 {return nodeConstants.maxAnycastDelayTime;}
|
|
00409 {return routerConstants.maxFinalRtrAdvertisements;}
|
|
Getters/Setters for all variables and constants defined in RFC 2461/2462 can be found here. Operations responsible for protocol constants are marked with a "_" prefix. Constants in this class are stored as instance variables. Default values for certain variables are defined at the top of this file, while certain variables have to be generated. Protocol constants are subject to change as specified in RFC2461:section 10 depending on different link layer operation. Getters and setters have been implemented for protocol constants so that a wireless interface may be set to a different set of constant values. (ie. changed by the FlatNetworkConfigurator) Such a design allows both wired and wireless networks to co-exist within a simulation run. 00407 {return routerConstants.maxInitialRtrAdvertInterval;}
|
|
00408 {return routerConstants.maxInitialRtrAdvertisements;}
|
|
00431 {return nodeConstants.maxMulticastSolicit;}
|
|
00434 {return nodeConstants.maxNeighbourAdvertisement;}
|
|
00411 {return routerConstants.maxRADelayTime;}
|
|
00439 {return nodeConstants.maxRandomFactor;}
|
|
00421 {return hostConstants.maxRtrSolicitationDelay;}
|
|
00423 {return hostConstants.maxRtrSolicitations;}
|
|
00432 {return nodeConstants.maxUnicastSolicit;}
|
|
00410 {return routerConstants.minDelayBetweenRAs;}
|
|
00438 {return nodeConstants.minRandomFactor;}
|
|
00435 {return nodeConstants.reachableTime;}
|
|
00436 {return nodeConstants.retransTimer;}
|
|
00422 {return hostConstants.rtrSolicitationInterval;}
|
|
00447 {nodeConstants.delayFirstProbeTime = d;}
|
|
00443 {nodeConstants.maxAnycastDelayTime = d;}
|
|
00415 {routerConstants.maxFinalRtrAdvertisements = d;}
|
|
00413 {routerConstants.maxInitialRtrAdvertInterval = d;}
|
|
00414 {routerConstants.maxInitialRtrAdvertisements = d;}
|
|
00441 {nodeConstants.maxMulticastSolicit = d;}
|
|
00444 {nodeConstants.maxNeighbourAdvertisement = d;}
|
|
00417 {routerConstants.maxRADelayTime = d;}
|
|
00449 {nodeConstants.maxRandomFactor = d;}
|
|
00425 {hostConstants.maxRtrSolicitationDelay = d;}
|
|
00427 {hostConstants.maxRtrSolicitations = d;}
|
|
00442 {nodeConstants.maxUnicastSolicit = d;}
|
|
00416 {routerConstants.minDelayBetweenRAs = d;}
|
|
00448 {nodeConstants.minRandomFactor = d;}
|
|
00445 {nodeConstants.reachableTime = d;}
|
|
00446 {nodeConstants.retransTimer = d;}
|
|
00426 {hostConstants.rtrSolicitationInterval = d;}
|
|
Adds the given advertised prefix to the interface. 00256 { 00257 rtrVars.advPrefixList.push_back(advPrefix); 00258 }
|
|
Returns ith address of the interface.
|
|
00224 { 00225 // This method is used in choosePreferredAddress(). 00226 // sort() produces increasing order, so "better" addresses should 00227 // compare as "less", to make them appear first in the array 00228 if (a.tentative!=b.tentative) 00229 return !a.tentative; // tentative=false is better 00230 if (a.address.scope()!=b.address.scope()) 00231 return a.address.scope()>b.address.scope(); // bigger scope is better 00232 return (a.expiryTime==0 && b.expiryTime!=0) || a.expiryTime>b.expiryTime; // longer expiry time is better 00233 }
|
|
00481 {return rtrVars.advCurHopLimit;}
|
|
00482 {return rtrVars.advDefaultLifetime;}
|
|
00478 {return rtrVars.advLinkMTU;}
|
|
00476 {return rtrVars.advManagedFlag;}
|
|
00477 {return rtrVars.advOtherConfigFlag;}
|
|
Returns the ith advertised prefix on the interface. 00261 { 00262 ASSERT(i>=0 && i<rtrVars.advPrefixList.size()); 00263 return rtrVars.advPrefixList[i]; 00264 }
|
|
00479 {return rtrVars.advReachableTime;}
|
|
00480 {return rtrVars.advRetransTimer;}
|
|
00473 {return rtrVars.advSendAdvertisements;}
|
|
Assigns the given address to the interface. 00136 { 00137 addresses.push_back(AddressData()); 00138 AddressData& a = addresses.back(); 00139 a.address = addr; 00140 a.tentative = tentative; 00141 a.expiryTime = expiryTime; 00142 a.prefExpiryTime = prefExpiryTime; 00143 choosePreferredAddress(); 00144 }
|
|
00461 {return hostVars.baseReachableTime;}
|
|
00236 { 00237 // do we have addresses? 00238 if (addresses.size()==0) 00239 { 00240 preferredAddr = IPv6Address(); 00241 return; 00242 } 00243 00244 // FIXME shouldn't we stick to the current preferredAddress if its prefLifetime 00245 // hasn't expired yet? 00246 00247 // FIXME TBD throw out expired addresses! 0 should be treated as infinity 00248 00249 // sort addresses by scope and expiry time, then pick the first one 00250 std::sort(addresses.begin(), addresses.end(), addrLess); 00251 preferredAddr = addresses[0].address; 00252 preferredAddrExpiryTime = addresses[0].expiryTime; 00253 }
|
|
00460 {return hostVars.curHopLimit;}
|
|
00130 { 00131 return info(); // TBD this could be improved: multi-line text, etc 00132 }
|
|
00453 {return nodeVars.dupAddrDetectTransmits;}
|
|
00161 { 00162 for (AddressDataVector::const_iterator it=addresses.begin(); it!=addresses.end(); it++) 00163 if (it->address==addr) 00164 return it-addresses.begin(); 00165 return -1; 00166 }
|
|
Arg-less version. 00287 { 00288 return uniform(_minRandomFactor(), _maxRandomFactor()) * baseReachableTime(); 00289 }
|
|
This method randomly generates a reachableTime given the MIN_RANDOM_FACTOR MAX_RANDOM_FACTOR and baseReachableTime. Refer to RFC 2461: Section 6.3.2 00282 {
00283 return uniform(MIN_RANDOM_FACTOR, MAX_RANDOM_FACTOR) * baseReachableTime;
00284 }
|
|
Returns true if the given address is one of the addresses assigned, regardless whether it is tentative or not. 00181 { 00182 return findAddress(addr)!=-1; 00183 }
|
|
00075 { 00076 // FIXME FIXME FIXME FIXME info() should never print a newline 00077 std::ostringstream os; 00078 os << "IPv6:{" << endl; 00079 for (int i=0; i<numAddresses(); i++) 00080 os << (i?"\t , ":"\tAddrs:") << address(i) 00081 << "(" << IPv6Address::scopeName(address(i).scope()) 00082 << (isTentativeAddress(i)?" tent":"") << ") " 00083 << " expiryTime: " << (addresses[i].expiryTime==0?"inf":simtimeToStr(addresses[i].expiryTime)) 00084 << " prefExpiryTime: " << (addresses[i].prefExpiryTime==0?"inf":simtimeToStr(addresses[i].prefExpiryTime)) 00085 << endl; 00086 00087 for (int i=0; i<numAdvPrefixes(); i++) 00088 { 00089 const AdvPrefix& a = advPrefix(i); 00090 os << (i?", ":"\tAdvPrefixes: ") << a.prefix << "/" << a.prefixLength << "(" 00091 << (a.advOnLinkFlag?"":"off-link ") 00092 << (a.advAutonomousFlag?"":"non-auto "); 00093 if (a.advValidLifetime==0) 00094 os << "lifetime:inf"; 00095 else if (a.advValidLifetime>0) 00096 os << "expires:" << simtimeToStr(a.advValidLifetime); 00097 else 00098 os << "lifetime:+" << (-a.advValidLifetime); 00099 os << ")" << endl; 00100 } 00101 os << " "; 00102 00103 // uncomment the following as needed! 00104 os << "\tNode:"; 00105 os << " dupAddrDetectTrans=" << nodeVars.dupAddrDetectTransmits; 00106 //os << " curHopLimit=" << hostVars.curHopLimit; 00107 //os << " retransTimer=" << hostVars.retransTimer; 00108 //os << " baseReachableTime=" << hostVars.baseReachableTime; 00109 os << " reachableTime=" << hostVars.reachableTime << endl; 00110 00111 if (rtrVars.advSendAdvertisements) 00112 { 00113 os << "\tRouter:"; 00114 os << " maxRtrAdvInt=" << rtrVars.maxRtrAdvInterval; 00115 os << " minRtrAdvInt=" << rtrVars.minRtrAdvInterval << endl; 00116 //os << " advManagedFlag=" << rtrVars.advManagedFlag; 00117 //os << " advOtherFlag=" << rtrVars.advOtherFlag; 00118 //os << " advLinkMTU=" << rtrVars.advLinkMTU; 00119 //os << " advReachableTime=" << rtrVars.advReachableTime; 00120 //os << " advRetransTimer=" << rtrVars.advRetransTimer; 00121 //os << " advCurHopLimit=" << rtrVars.advCurHopLimit; 00122 //os << " advDefaultLifetime=" << rtrVars.advDefaultLifetime; 00123 } 00124 00125 os << " }" << endl; 00126 return os.str(); 00127 }
|
|
Returns true if the interface has the given address and it is tentative. 00194 { 00195 int k = findAddress(addr); 00196 return k!=-1 && addresses[k].tentative; 00197 }
|
|
Returns true if the ith address of the interface is tentative.
|
|
Returns the first valid link-local address of the interface, or UNSPECIFIED_ADDRESS if there's none. 00208 { 00209 for (AddressDataVector::const_iterator it=addresses.begin(); it!=addresses.end(); it++) 00210 if (it->address.isLinkLocal()) // FIXME and valid 00211 return it->address; 00212 return IPv6Address::UNSPECIFIED_ADDRESS; 00213 }
|
|
|
|
Returns true if the interface has an address matching the given solicited-node multicast addresses. 00186 { 00187 for (AddressDataVector::const_iterator it=addresses.begin(); it!=addresses.end(); it++) 00188 if (it->address.formSolicitedNodeMulticastAddress()==solNodeAddr) 00189 return true; 00190 return false; 00191 }
|
|
00474 {return rtrVars.maxRtrAdvInterval;}
|
|
00475 {return rtrVars.minRtrAdvInterval;}
|
|
Returns the number of addresses the interface has. 00334 {return addresses.size();}
|
|
Returns the number of advertised prefixes on the interface. 00506 {return rtrVars.advPrefixList.size();}
|
|
Clears the "tentative" flag of an existing interface address. 00200 { 00201 int k = findAddress(addr); 00202 ASSERT(k!=-1); 00203 addresses[k].tentative = false; 00204 choosePreferredAddress(); 00205 }
|
|
Chooses a preferred address for the interface and returns it. This is the address that should be used as source address for outgoing datagrams, if one is not explicitly specified. Selection is based on scope (globally routable addresses are preferred), then on lifetime (the one that expires last is chosen). See private choosePreferredAddress() function. FIXME turn into preferredGLOBALAddress()! 00381 {return preferredAddr;} // FIXME TBD check expiry time!
|
|
00462 {return hostVars.reachableTime;}
|
|
Removes the address. Called when the valid lifetime expires. 00216 { 00217 int k = findAddress(address); 00218 ASSERT(k!=-1); 00219 addresses.erase(addresses.begin()+k); 00220 choosePreferredAddress(); 00221 }
|
|
Remove the ith advertised prefix on the interface. Prefixes at larger indices will shift down. 00275 { 00276 ASSERT(i>=0 && i<rtrVars.advPrefixList.size()); 00277 rtrVars.advPrefixList.erase(rtrVars.advPrefixList.begin()+i); 00278 }
|
|
00463 {return hostVars.retransTimer;}
|
|
00492 {rtrVars.advCurHopLimit = d;}
|
|
00493 {rtrVars.advDefaultLifetime = d;}
|
|
00489 {rtrVars.advLinkMTU = d;}
|
|
00487 {rtrVars.advManagedFlag = d;}
|
|
00488 {rtrVars.advOtherConfigFlag = d;}
|
|
Changes the configuration of the ith advertised prefix on the interface. The prefix itself should stay the same. 00267 { 00268 ASSERT(i>=0 && i<rtrVars.advPrefixList.size()); 00269 ASSERT(rtrVars.advPrefixList[i].prefix == advPrefix.prefix); 00270 ASSERT(rtrVars.advPrefixList[i].prefixLength == advPrefix.prefixLength); 00271 rtrVars.advPrefixList[i] = advPrefix; 00272 }
|
|
00490 {rtrVars.advReachableTime = d;}
|
|
00491 {rtrVars.advRetransTimer = d;}
|
|
00484 {rtrVars.advSendAdvertisements = d;}
|
|
00467 {hostVars.baseReachableTime = d;}
|
|
00466 {hostVars.curHopLimit = d;}
|
|
00455 {nodeVars.dupAddrDetectTransmits = d;}
|
|
|
|
00485 {rtrVars.maxRtrAdvInterval = d;}
|
|
00486 {rtrVars.minRtrAdvInterval = d;}
|
|
00468 {hostVars.reachableTime = d;}
|
|
00469 {hostVars.retransTimer = d;}
|
|
Update expiry times of addresses. Expiry times possibly come from prefixes (with on-link flag set to either zero or one) in Router Advertisements. Zero expiry time means infinity. 00148 { 00149 for (AddressDataVector::iterator it=addresses.begin(); it!=addresses.end(); it++) 00150 { 00151 if (it->address.matches(prefix,length)) 00152 { 00153 it->expiryTime = expiryTime; 00154 it->prefExpiryTime = prefExpiryTime; 00155 } 00156 } 00157 choosePreferredAddress(); 00158 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|