]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
lsa_cmp moved into lsalib.c
authorOndrej Filip <feela@network.cz>
Sun, 2 Apr 2000 19:04:23 +0000 (19:04 +0000)
committerOndrej Filip <feela@network.cz>
Sun, 2 Apr 2000 19:04:23 +0000 (19:04 +0000)
proto/ospf/dbdes.c
proto/ospf/dbdes.h
proto/ospf/lsalib.c
proto/ospf/lsalib.h

index 3a8a9a130b51d40d6384cb273ee858c1150a9fb2..ee2f96f9c51270c2ebc0e1c2dfa9470f5de5e5f8 100644 (file)
@@ -168,26 +168,6 @@ rxmt_timer_hook(timer *timer)
   }
 }
 
-int
-lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2)
-       /* 
-        *  1   l1 is newer
-        *  0   identical
-        * -1   l2 is newer
-        */
-{
-  if(l1->sn<l2->sn) return 1;
-  if(l1->sn==l2->sn)
-  {
-    if(l1->checksum=!l2->checksum) return l1->checksum<l2->checksum ? -1 :1;
-    if(l1->age==MAXAGE) return 1;
-    if(l2->age==MAXAGE) return -1;
-    if(abs(l1->age-l2->age)>MAXAGEDIFF) return l1->age<l2->age ? 1 : -1;
-  }
-  return 0;
-
-}
-
 void
 ospf_dbdes_reqladd(struct ospf_dbdes_packet *ps, struct proto *p,
   struct ospf_neighbor *n)
@@ -296,8 +276,6 @@ ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
             break;
           }
         }
-        //break;       /* I should probably continue processing packet */
-
     case NEIGHBOR_EXCHANGE:
        if((ps->imms.byte==n->imms.byte) && (ps->options=n->options) &&
          (ntohl(ps->ddseq)==n->ddr))
index 6cbad978b99fa00d3c63f38cc1377f17e25eec1b..09642ffc69fcaff020cfef3fac8de81ffe25ea74 100644 (file)
@@ -16,3 +16,4 @@ void ospf_dbdes_rx(struct ospf_dbdes_packet *ps, struct proto *p,
   struct ospf_iface *ifa, u16 size);
 
 #endif /* _BIRD_OSPF_DBDES_H_ */
+
index d7ae1c6e5590c98235c750a98a3e8c6e004a8029..72ca55c34b06e67ad68512641029ad3522b8155c 100644 (file)
@@ -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;
+}
+
index 0eb6dceea0da7eb344fb79f67189a0cf310cc333..b6547c761d814d0226fb0f2daa20d5833b1e8b40 100644 (file)
@@ -14,6 +14,11 @@ void htonlsah(struct ospf_lsa_header *h, struct ospf_lsa_header *n);
 void ntohlsah(struct ospf_lsa_header *n, struct ospf_lsa_header *h);
 void htonlsab(void *h, void *n, u8 type, u16 len);
 void ntohlsab(void *n, void *h, u8 type, u16 len);
-void lsasum_calculate(struct ospf_lsa_header *header, void *body, struct proto_ospf *p);
+void lsasum_calculate(struct ospf_lsa_header *header, void *body,
+  struct proto_ospf *p);
+#define CMP_NEWER 1
+#define CMP_SAME 0
+#define CMP_OLDER -1
+int lsa_comp(struct ospf_lsa_header *l1, struct ospf_lsa_header *l2);
 
 #endif /* _BIRD_OSPF_LSALIB_H_ */