|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // This program is free software: you can redistribute it and/or modify 00003 // it under the terms of the GNU Lesser General Public License as published by 00004 // the Free Software Foundation, either version 3 of the License, or 00005 // (at your option) any later version. 00006 // 00007 // This program is distributed in the hope that it will be useful, 00008 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 // GNU Lesser General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU Lesser General Public License 00013 // along with this program. If not, see http://www.gnu.org/licenses/. 00014 // 00015 00016 #include "ansaLsa6.h" 00017 00018 bool AnsaOspf6::InterAreaRouterLsa::Update(const OspfInterAreaRouterLsa6* lsa) { 00019 bool different = DiffersFrom(lsa); 00020 (*this) = (*lsa); 00021 ResetInstallTime(); 00022 if (different){ 00023 ClearNextHops(); 00024 return true; 00025 }else{ 00026 return false; 00027 } 00028 } 00029 00030 bool AnsaOspf6::InterAreaRouterLsa::DiffersFrom(const OspfInterAreaRouterLsa6* interAreaRouterLsa) const { 00031 00032 const OspfLsaHeader6& lsaHeader = interAreaRouterLsa->getHeader(); 00033 00034 if (((header_var.getLsAge() == MAX_AGE) && (lsaHeader.getLsAge() != MAX_AGE)) 00035 || ((header_var.getLsAge() != MAX_AGE) && (lsaHeader.getLsAge() == MAX_AGE)) 00036 || (header_var.getAdvertisingRouter() != lsaHeader.getAdvertisingRouter()) 00037 || (header_var.getLsSequenceNumber() != lsaHeader.getLsSequenceNumber())){ 00038 return true; 00039 00040 00041 }else if (options_var != interAreaRouterLsa->getOptions()){ 00042 return true; 00043 }else if (metric_var != interAreaRouterLsa->getMetric()){ 00044 return true; 00045 }else if (destinationRouterID_var != interAreaRouterLsa->getDestinationRouterID()){ 00046 return true; 00047 } 00048 00049 return false; 00050 }