summaryrefslogtreecommitdiff
path: root/proto/ospf/lsalib.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-04-02 19:04:23 +0000
committerOndrej Filip <feela@network.cz>2000-04-02 19:04:23 +0000
commitdb9fb727699a6244afcff28dcc2320a3e66ee269 (patch)
treef81683841124581decd4229a5f00018f26a5cf2c /proto/ospf/lsalib.c
parent10be74da202b20a7d502724ef8e7a9787b7eba0a (diff)
lsa_cmp moved into lsalib.c
Diffstat (limited to 'proto/ospf/lsalib.c')
-rw-r--r--proto/ospf/lsalib.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c
index d7ae1c6e..72ca55c3 100644
--- a/proto/ospf/lsalib.c
+++ b/proto/ospf/lsalib.c
@@ -283,3 +283,20 @@ lsasum_calculate(struct ospf_lsa_header *h,void *body,struct proto_ospf *po)
ntohlsab(b,b,h->type,length+2);
}
+int
+lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2)
+ /* Return codes form view of l1 */
+{
+ if(l1->sn<l2->sn) return CMP_NEWER;
+ if(l1->sn==l2->sn)
+ {
+ if(l1->checksum=!l2->checksum)
+ return l1->checksum<l2->checksum ? CMP_OLDER : CMP_NEWER;
+ if(l1->age==MAXAGE) return CMP_NEWER;
+ if(l2->age==MAXAGE) return CMP_OLDER;
+ if(abs(l1->age-l2->age)>MAXAGEDIFF)
+ return l1->age<l2->age ? CMP_NEWER : CMP_OLDER;
+ }
+ return CMP_SAME;
+}
+