2003-03-25 Paul Jakma <paul@dishone.st>

	* sync to latest zebra CVS
	* spec file: updated and added define for ospf-api/client

NB: OSPF-API has been broken by the zebra.org changes, which
has added struct ospf * as a new arg to many functions
diff --git a/ospfd/ospf_opaque.c b/ospfd/ospf_opaque.c
index fa9c4db..b8ba518 100644
--- a/ospfd/ospf_opaque.c
+++ b/ospfd/ospf_opaque.c
@@ -545,7 +545,7 @@
       break;
     case OSPF_OPAQUE_AS_LSA:
       top = ospf_top;
-      if (new->area != NULL && (top = new->area->top) == NULL)
+      if (new->area != NULL && (top = new->area->ospf) == NULL)
         {
           free_opaque_info_per_type ((void *) oipt);
           oipt = NULL;
@@ -653,7 +653,7 @@
       break;
     case OSPF_OPAQUE_AS_LSA:
       top = ospf_top;
-      if ((area = lsa->area) != NULL && (top = area->top) == NULL)
+      if ((area = lsa->area) != NULL && (top = area->ospf) == NULL)
         {
           zlog_warn ("Type-11 Opaque-LSA: Reference to OSPF is missing?");
           break; /* Unlikely to happen. */
@@ -1572,7 +1572,7 @@
         }
       break;
     case OSPF_OPAQUE_AREA_LSA:
-      if (lsa->area == NULL || (top = lsa->area->top) == NULL)
+      if (lsa->area == NULL || (top = lsa->area->ospf) == NULL)
         {
           /* Above conditions must have passed. */
           zlog_warn ("ospf_opaque_lsa_install: Sonmething wrong?");
@@ -1581,7 +1581,7 @@
       break;
     case OSPF_OPAQUE_AS_LSA:
       top = ospf_top;
-      if (lsa->area != NULL && (top = lsa->area->top) == NULL)
+      if (lsa->area != NULL && (top = lsa->area->ospf) == NULL)
         {
           /* Above conditions must have passed. */
           zlog_warn ("ospf_opaque_lsa_install: Sonmething wrong?");
@@ -1603,6 +1603,7 @@
 void
 ospf_opaque_lsa_refresh (struct ospf_lsa *lsa)
 {
+  struct ospf *ospf = ospf_top;
   struct ospf_opaque_functab *functab;
 
   if ((functab = ospf_opaque_functab_lookup (lsa)) == NULL
@@ -1619,7 +1620,7 @@
         zlog_info ("LSA[Type%d:%s]: Flush stray Opaque-LSA", lsa->data->type, inet_ntoa (lsa->data->id));
 
       lsa->data->ls_age = htons (OSPF_LSA_MAXAGE);
-      ospf_lsa_maxage (lsa);
+      ospf_lsa_maxage (ospf, lsa);
     }
   else
     (* functab->lsa_refresher)(lsa);
@@ -1683,7 +1684,7 @@
           zlog_warn ("ospf_opaque_lsa_reoriginate_schedule: Type-10 Opaque-LSA: Invalid parameter?");
           goto out;
         }
-      if ((top = area->top) == NULL)
+      if ((top = area->ospf) == NULL)
         {
           zlog_warn ("ospf_opaque_lsa_reoriginate_schedule: AREA(%s) -> TOP?", inet_ntoa (area->area_id));
           goto out;
@@ -1712,7 +1713,7 @@
         }
 
       /* Fake "area" to pass "ospf" to a lookup function later. */
-      dummy.top = top;
+      dummy.ospf = top;
       area = &dummy;
 
       func = ospf_opaque_type11_lsa_reoriginate_timer;
@@ -1826,7 +1827,7 @@
 
   if (! CHECK_FLAG (top->config, OSPF_OPAQUE_CAPABLE)
   ||  ! ospf_if_is_enable (oi)
-  ||    ospf_opaque_capable_nbr_count (oi->nbrs, NSM_Full) == 0)
+  ||    ospf_nbr_count_opaque_capable (oi) == 0)
     {
       if (IS_DEBUG_OSPF_EVENT)
         zlog_info ("Suspend re-origination of Type-9 Opaque-LSAs (opaque-type=%u) for a while...", oipt->opaque_type);
@@ -1866,7 +1867,7 @@
     }
 
   area = (struct ospf_area *) oipt->owner;
-  if (area == NULL || (top = area->top) == NULL)
+  if (area == NULL || (top = area->ospf) == NULL)
     {
       zlog_warn ("ospf_opaque_type10_lsa_reoriginate_timer: Something wrong?");
       goto out;
@@ -1878,7 +1879,7 @@
     {
       if ((oi = getdata (node)) == NULL)
         continue;
-      if ((n = ospf_opaque_capable_nbr_count (oi->nbrs, NSM_Full)) > 0)
+      if ((n = ospf_nbr_count_opaque_capable (oi)) > 0)
         break;
     }
 
@@ -1947,6 +1948,7 @@
 void
 ospf_opaque_lsa_refresh_schedule (struct ospf_lsa *lsa0)
 {
+  struct ospf *ospf = ospf_top;
   struct opaque_info_per_type *oipt;
   struct opaque_info_per_id *oipi;
   struct ospf_lsa *lsa;
@@ -1978,10 +1980,10 @@
     {
     case OSPF_OPAQUE_LINK_LSA:
     case OSPF_OPAQUE_AREA_LSA:
-      ospf_ls_retransmit_delete_nbr_all (lsa->area, lsa);
+      ospf_ls_retransmit_delete_nbr_area (lsa->area, lsa);
       break;
     case OSPF_OPAQUE_AS_LSA:
-      ospf_ls_retransmit_delete_nbr_all (NULL, lsa);
+      ospf_ls_retransmit_delete_nbr_as (ospf, lsa);
       break;
     default:
       zlog_warn ("ospf_opaque_lsa_refresh_schedule: Unexpected LSA-type(%u)", lsa->data->type);
@@ -2023,6 +2025,7 @@
 void
 ospf_opaque_lsa_flush_schedule (struct ospf_lsa *lsa0)
 {
+  struct ospf *ospf = ospf_top;
   struct opaque_info_per_type *oipt;
   struct opaque_info_per_id *oipi;
   struct ospf_lsa *lsa;
@@ -2046,10 +2049,10 @@
     {
     case OSPF_OPAQUE_LINK_LSA:
     case OSPF_OPAQUE_AREA_LSA:
-      ospf_ls_retransmit_delete_nbr_all (lsa->area, lsa);
+      ospf_ls_retransmit_delete_nbr_area (lsa->area, lsa);
       break;
     case OSPF_OPAQUE_AS_LSA:
-      ospf_ls_retransmit_delete_nbr_all (NULL, lsa);
+      ospf_ls_retransmit_delete_nbr_as (ospf, lsa);
       break;
     default:
       zlog_warn ("ospf_opaque_lsa_flush_schedule: Unexpected LSA-type(%u)", lsa->data->type);
@@ -2074,7 +2077,7 @@
     zlog_info ("Schedule Type-%u Opaque-LSA to FLUSH: [opaque-type=%u, opaque-id=%x]", lsa->data->type, GET_OPAQUE_TYPE (ntohl (lsa->data->id.s_addr)), GET_OPAQUE_ID (ntohl (lsa->data->id.s_addr)));
 
   /* This lsa will be flushed and removed eventually. */
-  ospf_lsa_maxage (lsa);
+  ospf_lsa_maxage (ospf, lsa);
 
 out:
   return;
@@ -2241,7 +2244,7 @@
           break;
         case OSPF_OPAQUE_AS_LSA:
           SET_FLAG (top->opaque, OPAQUE_BLOCK_TYPE_11_LSA_BIT);
-          ospf_flood_through_as (NULL/*inbr*/, lsa);
+          ospf_flood_through_as (top, NULL/*inbr*/, lsa);
           break;
         default:
           zlog_warn ("ospf_opaque_self_originated_lsa_received: Unexpected LSA-type(%u)", lsa->data->type);
@@ -2331,7 +2334,7 @@
             continue;
 
           if (! ospf_if_is_enable (oi)
-          ||    ospf_opaque_capable_nbr_count (oi->nbrs, NSM_Full) == 0)
+          ||    ospf_nbr_count_opaque_capable (oi) == 0)
             continue;
 
           ospf_opaque_lsa_originate_schedule (oi, &delay);
@@ -2353,7 +2356,7 @@
       if (IS_DEBUG_OSPF_EVENT)
         zlog_info ("Self-originated type-9 Opaque-LSAs: OI(%s): Flush completed", IF_NAME (oi));
 
-      UNSET_FLAG (oi->area->top->opaque, OPAQUE_BLOCK_TYPE_09_LSA_BIT);
+      UNSET_FLAG (oi->area->ospf->opaque, OPAQUE_BLOCK_TYPE_09_LSA_BIT);
     }
   return;
 }
@@ -2384,7 +2387,7 @@
       if (IS_DEBUG_OSPF_EVENT)
         zlog_info ("Self-originated type-10 Opaque-LSAs: AREA(%s): Flush completed", inet_ntoa (area->area_id));
 
-      UNSET_FLAG (area->top->opaque, OPAQUE_BLOCK_TYPE_10_LSA_BIT);
+      UNSET_FLAG (area->ospf->opaque, OPAQUE_BLOCK_TYPE_10_LSA_BIT);
     }
 
   return;
@@ -2481,7 +2484,7 @@
   struct ospf *top = NULL;
   struct ospf_area *area;
 
-  if (oi == NULL || (area = oi->area) == NULL || (top = area->top) == NULL)
+  if (oi == NULL || (area = oi->area) == NULL || (top = area->ospf) == NULL)
     zlog_warn ("Broken relationship for \"OI -> AREA -> OSPF\"?");
 
   return top;