]> git.proxmox.com Git - mirror_frr.git/blobdiff - ospfd/ospf_lsdb.h
lib: enforce vrf_name_to_id by returning default_vrf when name is null
[mirror_frr.git] / ospfd / ospf_lsdb.h
index 8ae66a1573c00ab0e9608bb26c38b2879870b5a6..65c7e28fed37751f59e3daf4868c8147d49f7fd2 100644 (file)
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with GNU Zebra; see the file COPYING.  If not, write to the Free
- * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
+ * You should have received a copy of the GNU General Public License along
+ * with this program; see the file COPYING; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #ifndef _ZEBRA_OSPF_LSDB_H
 #define _ZEBRA_OSPF_LSDB_H
 
 /* OSPF LSDB structure. */
-struct ospf_lsdb
-{
-  struct
-  {
-    unsigned long count;
-    unsigned long count_self;
-    unsigned int checksum;
-    struct route_table *db;
-  } type[OSPF_MAX_LSA];
-  unsigned long total;
+struct ospf_lsdb {
+       struct {
+               unsigned long count;
+               unsigned long count_self;
+               unsigned int checksum;
+               struct route_table *db;
+       } type[OSPF_MAX_LSA];
+       unsigned long total;
 #define MONITOR_LSDB_CHANGE 1 /* XXX */
 #ifdef MONITOR_LSDB_CHANGE
-  /* Hooks for callback functions to catch every add/del event. */
-  int (* new_lsa_hook)(struct ospf_lsa *);
-  int (* del_lsa_hook)(struct ospf_lsa *);
+       /* Hooks for callback functions to catch every add/del event. */
+       int (*new_lsa_hook)(struct ospf_lsa *);
+       int (*del_lsa_hook)(struct ospf_lsa *);
 #endif /* MONITOR_LSDB_CHANGE */
 };
 
 /* Macros. */
-#define LSDB_LOOP(T,N,L)                                                      \
-  if ((T) != NULL)                                                            \
-  for ((N) = route_top ((T)); ((N)); ((N)) = route_next ((N)))                \
-    if (((L) = (N)->info))
+#define LSDB_LOOP(T, N, L)                                                     \
+       if ((T) != NULL)                                                       \
+               for ((N) = route_top((T)); ((N)); ((N)) = route_next((N)))     \
+                       if (((L) = (N)->info))
 
 #define ROUTER_LSDB(A)       ((A)->lsdb->type[OSPF_ROUTER_LSA].db)
 #define NETWORK_LSDB(A)             ((A)->lsdb->type[OSPF_NETWORK_LSA].db)
@@ -62,23 +59,26 @@ struct ospf_lsdb
 #define AS_LSDB(O,T)         ((O)->lsdb->type[(T)].db)
 
 /* OSPF LSDB related functions. */
-struct ospf_lsdb *ospf_lsdb_new ();
-void ospf_lsdb_init (struct ospf_lsdb *);
-void ospf_lsdb_free (struct ospf_lsdb *);
-void ospf_lsdb_cleanup (struct ospf_lsdb *);
-void ospf_lsdb_add (struct ospf_lsdb *, struct ospf_lsa *);
-void ospf_lsdb_delete (struct ospf_lsdb *, struct ospf_lsa *);
-void ospf_lsdb_delete_all (struct ospf_lsdb *);
-struct ospf_lsa *ospf_lsdb_lookup (struct ospf_lsdb *, struct ospf_lsa *);
-struct ospf_lsa *ospf_lsdb_lookup_by_id (struct ospf_lsdb *, u_char,
-                                       struct in_addr, struct in_addr);
-struct ospf_lsa *ospf_lsdb_lookup_by_id_next (struct ospf_lsdb *, u_char,
-                                            struct in_addr, struct in_addr,
-                                            int);
-unsigned long ospf_lsdb_count_all (struct ospf_lsdb *);
-unsigned long ospf_lsdb_count (struct ospf_lsdb *, int);
-unsigned long ospf_lsdb_count_self (struct ospf_lsdb *, int);
-unsigned int ospf_lsdb_checksum (struct ospf_lsdb *, int);
-unsigned long ospf_lsdb_isempty (struct ospf_lsdb *);
+extern struct ospf_lsdb *ospf_lsdb_new(void);
+extern void ospf_lsdb_init(struct ospf_lsdb *);
+extern void ospf_lsdb_free(struct ospf_lsdb *);
+extern void ospf_lsdb_cleanup(struct ospf_lsdb *);
+extern void ls_prefix_set(struct prefix_ls *lp, struct ospf_lsa *lsa);
+extern void ospf_lsdb_add(struct ospf_lsdb *, struct ospf_lsa *);
+extern void ospf_lsdb_delete(struct ospf_lsdb *, struct ospf_lsa *);
+extern void ospf_lsdb_delete_all(struct ospf_lsdb *);
+/* Set all stats to -1 (LSA_SPF_NOT_EXPLORED). */
+extern void ospf_lsdb_clean_stat(struct ospf_lsdb *lsdb);
+extern struct ospf_lsa *ospf_lsdb_lookup(struct ospf_lsdb *, struct ospf_lsa *);
+extern struct ospf_lsa *ospf_lsdb_lookup_by_id(struct ospf_lsdb *, uint8_t,
+                                              struct in_addr, struct in_addr);
+extern struct ospf_lsa *ospf_lsdb_lookup_by_id_next(struct ospf_lsdb *, uint8_t,
+                                                   struct in_addr,
+                                                   struct in_addr, int);
+extern unsigned long ospf_lsdb_count_all(struct ospf_lsdb *);
+extern unsigned long ospf_lsdb_count(struct ospf_lsdb *, int);
+extern unsigned long ospf_lsdb_count_self(struct ospf_lsdb *, int);
+extern unsigned int ospf_lsdb_checksum(struct ospf_lsdb *, int);
+extern unsigned long ospf_lsdb_isempty(struct ospf_lsdb *);
 
 #endif /* _ZEBRA_OSPF_LSDB_H */