]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: hide internal prefix list structures
authorDavid Lamparter <equinox@opensourcerouting.org>
Mon, 13 Apr 2015 08:21:34 +0000 (10:21 +0200)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 3 Nov 2015 13:42:24 +0000 (05:42 -0800)
These are about to be touched and there's no point in other code
touching into prefix list's internas.  Add some isolation.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
bgpd/bgpd.c
lib/Makefile.am
lib/plist.c
lib/plist.h
ospfd/ospf_zebra.c

index 2d831acdd27214aab8f0321cb6f48e971b52ea9d..8ff16e07ac54370fbadfa93285dcef03dc83e2db 100644 (file)
@@ -13,7 +13,7 @@ WITHOUT ANY WARRANTY; without even the implied warranty of
 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
+You should have received a copy of the GN5U 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.  */
@@ -5144,7 +5144,7 @@ peer_prefix_list_update (struct prefix_list *plist)
        * Update the prefix-list on update groups.
        */
       update_group_policy_update(bgp, BGP_POLICY_PREFIX_LIST,
-                                plist ? plist->name : NULL, 0, 0);
+                                plist ? prefix_list_name(plist) : NULL, 0, 0);
 
       for (ALL_LIST_ELEMENTS (bgp->peer, node, nnode, peer))
        {
index 49a721f7f9a059e0dad0d686b6f677fea998b823..43fa9061282916d1422197e802c2ab8899051813 100644 (file)
@@ -32,6 +32,9 @@ pkginclude_HEADERS = \
        workqueue.h route_types.h libospf.h nexthop.h json.h \
        ptm_lib.h csv.h bfd.h vrf.h
 
+noinst_HEADERS = \
+       plist_int.h
+
 EXTRA_DIST = \
        regex.c regex-gnu.h \
        queue.h \
index 2418c8621dcb561639a1360c390d5da8b0879d9c..0174a53fec732c9713f65c508fa1025f451e1913 100644 (file)
 #include "log.h"
 #include "routemap.h"
 
-/* Each prefix-list's entry. */
-struct prefix_list_entry
-{
-  int seq;
-
-  int le;
-  int ge;
-
-  enum prefix_list_type type;
-
-  int any;
-  struct prefix prefix;
-
-  unsigned long refcnt;
-  unsigned long hitcnt;
-
-  struct prefix_list_entry *next;
-  struct prefix_list_entry *prev;
-};
+#include "plist_int.h"
 
 /* List of struct prefix_list. */
 struct prefix_list_list
@@ -127,6 +109,11 @@ prefix_master_get (afi_t afi)
   return NULL;
 }
 
+const char *prefix_list_name (struct prefix_list *plist)
+{
+  return plist->name;
+}
+
 /* Lookup prefix_list from list of prefix_list by name. */
 struct prefix_list *
 prefix_list_lookup (afi_t afi, const char *name)
index 4359a8935c216476cf1132b4fc16416d942d180a..cfc43c781ce8d07f43601e83db91d0bb35902fb8 100644 (file)
@@ -31,30 +31,7 @@ enum prefix_list_type
   PREFIX_PERMIT,
 };
 
-enum prefix_name_type
-{
-  PREFIX_TYPE_STRING,
-  PREFIX_TYPE_NUMBER
-};
-
-struct prefix_list
-{
-  char *name;
-  char *desc;
-
-  struct prefix_master *master;
-
-  enum prefix_name_type type;
-
-  int count;
-  int rangecount;
-
-  struct prefix_list_entry *head;
-  struct prefix_list_entry *tail;
-
-  struct prefix_list *next;
-  struct prefix_list *prev;
-};
+struct prefix_list;
 
 struct orf_prefix
 {
@@ -70,6 +47,7 @@ extern void prefix_list_reset (void);
 extern void prefix_list_add_hook (void (*func) (struct prefix_list *));
 extern void prefix_list_delete_hook (void (*func) (struct prefix_list *));
 
+extern const char *prefix_list_name (struct prefix_list *);
 extern struct prefix_list *prefix_list_lookup (afi_t, const char *);
 extern enum prefix_list_type prefix_list_apply (struct prefix_list *, void *);
 
index a95b2e1b676525c74cc819044774f807a2dd1d0e..8119dde5e84329e89eaabf5c4e22eb8b6ee87573 100644 (file)
@@ -1379,7 +1379,7 @@ ospf_prefix_list_update (struct prefix_list *plist)
     {
       /* Update filter-list in. */
       if (PREFIX_NAME_IN (area))
-        if (strcmp (PREFIX_NAME_IN (area), plist->name) == 0)
+        if (strcmp (PREFIX_NAME_IN (area), prefix_list_name (plist)) == 0)
           {
             PREFIX_LIST_IN (area) =
               prefix_list_lookup (AFI_IP, PREFIX_NAME_IN (area));
@@ -1388,7 +1388,7 @@ ospf_prefix_list_update (struct prefix_list *plist)
 
       /* Update filter-list out. */
       if (PREFIX_NAME_OUT (area))
-        if (strcmp (PREFIX_NAME_OUT (area), plist->name) == 0)
+        if (strcmp (PREFIX_NAME_OUT (area), prefix_list_name (plist)) == 0)
           {
             PREFIX_LIST_IN (area) =
               prefix_list_lookup (AFI_IP, PREFIX_NAME_OUT (area));