|
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::LinkLsa::Update(const OspfLinkLsa6* 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::LinkLsa::DiffersFrom(const OspfLinkLsa6* linkLsa) const { 00031 00032 const OspfLsaHeader6& lsaHeader = linkLsa->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 (rtrPriority_var != linkLsa->getRtrPriority()){ 00042 return true; 00043 }else if (options_var != linkLsa->getOptions()){ 00044 return true; 00045 }else if (linkLocalAddress_var != linkLsa->getLinkLocalAddress()){ 00046 return true; 00047 }else{ 00048 00049 unsigned int prefixesCount = prefixes_arraysize; 00050 for (unsigned int i = 0; i < prefixesCount; i++){ 00051 if (prefixes_var[i] != linkLsa->getPrefixes(i)){ 00052 return true; 00053 } 00054 } 00055 } 00056 00057 return false; 00058 }