|
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::AsExternalLsa::Update(const OspfAsExternalLsa6* 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::AsExternalLsa::DiffersFrom(const OspfAsExternalLsa6* asExternalLsa) const { 00031 00032 const OspfLsaHeader6& lsaHeader = asExternalLsa->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 (E_ExternalMetricType_var != asExternalLsa->getE_ExternalMetricType()){ 00042 return true; 00043 }else if (F_ForwardingAddress_var != asExternalLsa->getF_ForwardingAddress()){ 00044 return true; 00045 }else if (T_ExternalRouteTag_var != asExternalLsa->getT_ExternalRouteTag()){ 00046 return true; 00047 }else if (metric_var != asExternalLsa->getMetric()){ 00048 return true; 00049 }else if (prefixLenght_var != asExternalLsa->getPrefixLenght()){ 00050 return true; 00051 }else if (prefixOptions_var != asExternalLsa->getPrefixOptions()){ 00052 return true; 00053 }else if (referencedLsType_var != asExternalLsa->getReferencedLsType()){ 00054 return true; 00055 }else if (addressPrefix_var != asExternalLsa->getAddressPrefix()){ 00056 return true; 00057 }else if (forwardingAddress_var != asExternalLsa->getForwardingAddress()){ 00058 return true; 00059 }else if (externalRouteTag_var != asExternalLsa->getExternalRouteTag()){ 00060 return true; 00061 }else if (referencedLinkStateID_var != asExternalLsa->getReferencedLinkStateID()){ 00062 return true; 00063 } 00064 00065 return false; 00066 }