|
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::NetworkLsa::Update(const OspfNetworkLsa6* 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::NetworkLsa::DiffersFrom(const OspfNetworkLsa6* networkLsa) const { 00031 00032 const OspfLsaHeader6& lsaHeader = networkLsa->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 != networkLsa->getOptions()){ 00042 return true; 00043 }else{ 00044 00045 unsigned int routerCount = attachedRouters_arraysize; 00046 for (unsigned int i = 0; i < routerCount; i++){ 00047 if (attachedRouters_var[i] != networkLsa->getAttachedRouters(i)){ 00048 return true; 00049 } 00050 } 00051 } 00052 00053 return false; 00054 }