lib: bring some changes over from bgp_table to table

  * lib/table.c

    - Maintain table node count. Expose it via the route_table_count()
      function (from revision cbdfbaa5).

    - route_unlock_node(): Add assertion (from revision 228da428).

    - route_table_free(): Make static and fix up cleanup code (from
      revision 228da428).

    - route_node_delete(): Change to be static.

    - Add 'const' qualifier in a couple places.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/lib/table.h b/lib/table.h
index 41d1fa7..1e8df46 100644
--- a/lib/table.h
+++ b/lib/table.h
@@ -27,6 +27,8 @@
 struct route_table
 {
   struct route_node *top;
+
+  unsigned long count;
 };
 
 /* Each routing entry. */
@@ -56,14 +58,13 @@
 extern struct route_table *route_table_init (void);
 extern void route_table_finish (struct route_table *);
 extern void route_unlock_node (struct route_node *node);
-extern void route_node_delete (struct route_node *node);
 extern struct route_node *route_top (struct route_table *);
 extern struct route_node *route_next (struct route_node *);
 extern struct route_node *route_next_until (struct route_node *,
                                             struct route_node *);
-extern struct route_node *route_node_get (struct route_table *,
+extern struct route_node *route_node_get (struct route_table *const,
                                           struct prefix *);
-extern struct route_node *route_node_lookup (struct route_table *,
+extern struct route_node *route_node_lookup (const struct route_table *,
                                              struct prefix *);
 extern struct route_node *route_lock_node (struct route_node *node);
 extern struct route_node *route_node_match (const struct route_table *,
@@ -75,4 +76,5 @@
 						 const struct in6_addr *);
 #endif /* HAVE_IPV6 */
 
+extern unsigned long route_table_count (const struct route_table *);
 #endif /* _ZEBRA_TABLE_H */