Browse Source

2005-05-23 Paul Jakma <paul@dishone.st>

	* bgp_fsm.h: Add extern qualifier to exported functions
	* bgp_nexthop.c: add static to nexthop specific globals
	* *.h: Add guard defines
paul 15 years ago
parent
commit
00d252cb5f

+ 3 - 0
bgpd/ChangeLog

@@ -1,6 +1,9 @@
 2005-05-23 Paul Jakma <paul@dishone.st>
 
 	* bgp_routemap.c: add semi-colons to VTY_GET_* to match vty.h change
+	* bgp_fsm.h: Add extern qualifier to exported functions
+	* bgp_nexthop.c: add static to nexthop specific globals
+	* *.h: Add guard defines
 
 2005-05-19 Paul Jakma <paul@dishone.st>
 

+ 5 - 33
bgpd/bgp_advertise.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_ADVERTISE_H
+#define _QUAGGA_BGP_ADVERTISE_H
+
 /* BGP advertise FIFO.  */
 struct bgp_advertise_fifo
 {
@@ -99,39 +102,6 @@ struct bgp_synchronize
   struct bgp_advertise_fifo withdraw_low;
 };
 
-/* FIFO -- first in first out structure and macros.  */
-struct fifo
-{
-  struct fifo *next;
-  struct fifo *prev;
-};
-
-#define FIFO_INIT(F)                                  \
-  do {                                                \
-    struct fifo *Xfifo = (struct fifo *)(F);          \
-    Xfifo->next = Xfifo->prev = Xfifo;                \
-  } while (0)
-
-#define FIFO_ADD(F,N)                                 \
-  do {                                                \
-    struct fifo *Xfifo = (struct fifo *)(F);          \
-    struct fifo *Xnode = (struct fifo *)(N);          \
-    Xnode->next = Xfifo;                              \
-    Xnode->prev = Xfifo->prev;                        \
-    Xfifo->prev = Xfifo->prev->next = Xnode;          \
-  } while (0)
-
-#define FIFO_DEL(N)                                   \
-  do {                                                \
-    struct fifo *Xnode = (struct fifo *)(N);          \
-    Xnode->prev->next = Xnode->next;                  \
-    Xnode->next->prev = Xnode->prev;                  \
-  } while (0)
-
-#define FIFO_HEAD(F)                                  \
-  ((((struct fifo *)(F))->next == (struct fifo *)(F)) \
-  ? NULL : (F)->next)
-
 /* BGP adjacency linked list.  */
 #define BGP_INFO_ADD(N,A,TYPE)                        \
   do {                                                \
@@ -176,3 +146,5 @@ bgp_advertise_clean (struct peer *, struct bgp_adj_out *, afi_t, safi_t);
 
 void bgp_sync_init (struct peer *);
 void bgp_sync_delete (struct peer *);
+
+#endif /* _QUAGGA_BGP_ADVERTISE_H */

+ 5 - 0
bgpd/bgp_aspath.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_ASPATH_H
+#define _QUAGGA_BGP_ASPATH_H
+
 /* AS path segment type.  */
 #define AS_SET                       1
 #define AS_SEQUENCE                  2
@@ -80,3 +83,5 @@ int aspath_loop_check (struct aspath *, as_t);
 int aspath_private_as_check (struct aspath *);
 int aspath_firstas_check (struct aspath *, as_t);
 unsigned long aspath_count ();
+
+#endif /* _QUAGGA_BGP_ASPATH_H */

+ 5 - 0
bgpd/bgp_attr.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_ATTR_H
+#define _QUAGGA_BGP_ATTR_H
+
 /* Simple bit mapping. */
 #define BITMAP_NBBY 8
 
@@ -132,3 +135,5 @@ void cluster_unintern (struct cluster_list *);
 
 /* Transit attribute prototypes. */
 void transit_unintern (struct transit *);
+
+#endif /* _QUAGGA_BGP_ATTR_H */

+ 5 - 0
bgpd/bgp_clist.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_CLIST_H
+#define _QUAGGA_BGP_CLIST_H
+
 /* Master Community-list. */
 #define COMMUNITY_LIST_MASTER          0
 #define EXTCOMMUNITY_LIST_MASTER       1
@@ -145,3 +148,5 @@ int community_list_exact_match (struct community *, struct community_list *);
 struct community *
 community_list_match_delete (struct community *,
 			     struct community_list *);
+
+#endif /* _QUAGGA_BGP_CLIST_H */

+ 5 - 0
bgpd/bgp_community.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_COMMUNITY_H
+#define _QUAGGA_BGP_COMMUNITY_H
+
 /* Communities attribute.  */
 struct community 
 {
@@ -66,3 +69,5 @@ int community_include (struct community *, u_int32_t);
 void community_del_val (struct community *, u_int32_t *);
 unsigned long community_count ();
 struct hash *community_hash ();
+
+#endif /* _QUAGGA_BGP_COMMUNITY_H */

+ 5 - 0
bgpd/bgp_damp.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_DAMP_H
+#define _QUAGGA_BGP_DAMP_H
+
 /* Structure maintained on a per-route basis. */
 struct bgp_damp_info
 {
@@ -140,3 +143,5 @@ int bgp_damp_decay (time_t, int);
 int bgp_config_write_damp (struct vty *);
 void bgp_damp_info_vty (struct vty *, struct bgp_info *);
 char * bgp_damp_reuse_time_vty (struct vty *, struct bgp_info *);
+
+#endif /* _QUAGGA_BGP_DAMP_H */

+ 5 - 0
bgpd/bgp_debug.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_DEBUG_H
+#define _QUAGGA_BGP_DEBUG_H
+
 /* sort of packet direction */
 #define DUMP_ON        1
 #define DUMP_SEND      2
@@ -111,3 +114,5 @@ void bgp_notify_print (struct peer *, struct bgp_notify *, const char *);
 
 extern struct message bgp_status_msg[];
 extern int bgp_status_msg_max;
+
+#endif /* _QUAGGA_BGP_DEBUG_H */

+ 5 - 0
bgpd/bgp_dump.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_DUMP_H
+#define _QUAGGA_BGP_DUMP_H
+
 /* MRT compatible packet dump values.  */
 /* type value */
 #define MSG_PROTOCOL_BGP4MP  16
@@ -33,3 +36,5 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 void bgp_dump_init ();
 void bgp_dump_state (struct peer *, int, int);
 void bgp_dump_packet (struct peer *, int, struct stream *);
+
+#endif /* _QUAGGA_BGP_DUMP_H */

+ 5 - 0
bgpd/bgp_ecommunity.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_ECOMMUNITY_H
+#define _QUAGGA_BGP_ECOMMUNITY_H
+
 /* High-order octet of the Extended Communities type field.  */
 #define ECOMMUNITY_ENCODE_AS                0x00
 #define ECOMMUNITY_ENCODE_IP                0x01
@@ -75,3 +78,5 @@ struct ecommunity *ecommunity_str2com (const char *, int, int);
 char *ecommunity_ecom2str (struct ecommunity *, int);
 int ecommunity_match (const struct ecommunity *, const struct ecommunity *);
 char *ecommunity_str (struct ecommunity *);
+
+#endif /* _QUAGGA_BGP_ECOMMUNITY_H */

+ 5 - 0
bgpd/bgp_filter.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_FILTER_H
+#define _QUAGGA_BGP_FILTER_H
+
 enum as_filter_type
 {
   AS_FILTER_DENY,
@@ -29,3 +32,5 @@ enum as_filter_type as_list_apply (struct as_list *, void *);
 struct as_list *as_list_lookup (const char *);
 void as_list_add_hook (void (*func) ());
 void as_list_delete_hook (void (*func) ());
+
+#endif /* _QUAGGA_BGP_FILTER_H */

+ 9 - 4
bgpd/bgp_fsm.h

@@ -19,6 +19,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_FSM_H
+#define _QUAGGA_BGP_FSM_H
+
 /* Macro for BGP read, write and timer thread.  */
 #define BGP_READ_ON(T,F,V)   THREAD_READ_ON(master,T,F,peer,V)
 #define BGP_READ_OFF(X)      THREAD_READ_OFF(X)
@@ -36,8 +39,10 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
     thread_cancel_event (master, (P))
 
 /* Prototypes. */
-int bgp_event (struct thread *);
-int bgp_stop (struct peer *peer);
-void bgp_timer_set (struct peer *);
-void bgp_fsm_change_status (struct peer *peer, int status);
+extern int bgp_event (struct thread *);
+extern int bgp_stop (struct peer *peer);
+extern void bgp_timer_set (struct peer *);
+extern void bgp_fsm_change_status (struct peer *peer, int status);
 extern const char *peer_down_str[];
+
+#endif /* _QUAGGA_BGP_FSM_H */

+ 5 - 0
bgpd/bgp_mplsvpn.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_MPLSVPN_H
+#define _QUAGGA_BGP_MPLSVPN_H
+
 #define RD_TYPE_AS      0
 #define RD_TYPE_IP      1
 
@@ -43,3 +46,5 @@ u_int32_t decode_label (u_char *);
 int str2prefix_rd (const char *, struct prefix_rd *);
 int str2tag (const char *, u_char *);
 char *prefix_rd2str (struct prefix_rd *, char *, size_t);
+
+#endif /* _QUAGGA_BGP_MPLSVPN_H */

+ 5 - 0
bgpd/bgp_network.h

@@ -18,6 +18,11 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_NETWORK_H
+#define _QUAGGA_BGP_NETWORK_H
+
 int bgp_socket (struct bgp *, unsigned short);
 int bgp_connect (struct peer *);
 void bgp_getsockname (struct peer *);
+
+#endif /* _QUAGGA_BGP_NETWORK_H */

+ 8 - 8
bgpd/bgp_nexthop.c

@@ -45,24 +45,24 @@ struct bgp_nexthop_cache *zlookup_query_ipv6 (struct in6_addr *);
 #endif /* HAVE_IPV6 */
 
 /* Only one BGP scan thread are activated at the same time. */
-struct thread *bgp_scan_thread = NULL;
+static struct thread *bgp_scan_thread = NULL;
 
 /* BGP import thread */
-struct thread *bgp_import_thread = NULL;
+static struct thread *bgp_import_thread = NULL;
 
 /* BGP scan interval. */
-int bgp_scan_interval;
+static int bgp_scan_interval;
 
 /* BGP import interval. */
-int bgp_import_interval;
+static int bgp_import_interval;
 
 /* Route table for next-hop lookup cache. */
-struct bgp_table *bgp_nexthop_cache_table[AFI_MAX];
-struct bgp_table *cache1_table[AFI_MAX];
-struct bgp_table *cache2_table[AFI_MAX];
+static struct bgp_table *bgp_nexthop_cache_table[AFI_MAX];
+static struct bgp_table *cache1_table[AFI_MAX];
+static struct bgp_table *cache2_table[AFI_MAX];
 
 /* Route table for connected route. */
-struct bgp_table *bgp_connected_table[AFI_MAX];
+static struct bgp_table *bgp_connected_table[AFI_MAX];
 
 /* BGP nexthop lookup query client. */
 static struct zclient *zlookup = NULL;

+ 5 - 0
bgpd/bgp_nexthop.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_NEXTHOP_H
+#define _QUAGGA_BGP_NEXTHOP_H
+
 #define BGP_SCAN_INTERVAL_DEFAULT   60
 #define BGP_IMPORT_INTERVAL_DEFAULT 15
 
@@ -50,3 +53,5 @@ int bgp_multiaccess_check_v4 (struct in_addr, char *);
 int bgp_config_write_scan_time (struct vty *);
 int bgp_nexthop_check_ebgp (afi_t, struct attr *);
 int bgp_nexthop_self (afi_t, struct attr *);
+
+#endif /* _QUAGGA_BGP_NEXTHOP_H */

+ 5 - 0
bgpd/bgp_open.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_OPEN_H
+#define _QUAGGA_BGP_OPEN_H
+
 /* MP Capability information. */
 struct capability_mp
 {
@@ -79,3 +82,5 @@ struct graceful_restart_af
 int bgp_open_option_parse (struct peer *, u_char, int *);
 void bgp_open_capability (struct stream *, struct peer *);
 void bgp_capability_vty_out (struct vty *, struct peer *);
+
+#endif /* _QUAGGA_BGP_OPEN_H */

+ 5 - 0
bgpd/bgp_packet.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_PACKET_H
+#define _QUAGGA_BGP_PACKET_H
+
 #define BGP_NLRI_LENGTH       1U
 #define BGP_TOTAL_ATTR_LEN    2U
 #define BGP_UNFEASIBLE_LEN    2U
@@ -48,3 +51,5 @@ void bgp_capability_send (struct peer *, afi_t, safi_t, int, int);
 void bgp_default_update_send (struct peer *, struct attr *,
 			      afi_t, safi_t, struct peer *);
 void bgp_default_withdraw_send (struct peer *, afi_t, safi_t);
+
+#endif /* _QUAGGA_BGP_PACKET_H */

+ 5 - 0
bgpd/bgp_regex.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_REGEX_H
+#define _QUAGGA_BGP_REGEX_H
+
 #include <zebra.h>
 
 #ifdef HAVE_GNU_REGEX
@@ -29,3 +32,5 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 void bgp_regex_free (regex_t *regex);
 regex_t *bgp_regcomp (const char *str);
 int bgp_regexec (regex_t *regex, struct aspath *aspath);
+
+#endif /* _QUAGGA_BGP_REGEX_H */

+ 5 - 0
bgpd/bgp_route.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_ROUTE_H
+#define _QUAGGA_BGP_ROUTE_H
+
 struct bgp_info
 {
   /* For linked list. */
@@ -173,3 +176,5 @@ safi_t bgp_node_safi (struct vty *);
 void route_vty_out (struct vty *, struct prefix *, struct bgp_info *, int, safi_t);
 void route_vty_out_tag (struct vty *, struct prefix *, struct bgp_info *, int, safi_t);
 void route_vty_out_tmp (struct vty *, struct prefix *, struct attr *, safi_t);
+
+#endif /* _QUAGGA_BGP_ROUTE_H */

+ 5 - 0
bgpd/bgp_snmp.h

@@ -18,6 +18,11 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_SNMP_H
+#define _QUAGGA_BGP_SNMP_H
+
 void bgp_snmp_init ();
 void bgpTrapEstablished (struct peer *);
 void bgpTrapBackwardTransition (struct peer *);
+
+#endif /* _QUAGGA_BGP_SNMP_H */

+ 5 - 0
bgpd/bgp_table.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_TABLE_H
+#define _QUAGGA_BGP_TABLE_H
+
 typedef enum
 {
   BGP_TABLE_MAIN,
@@ -74,3 +77,5 @@ struct bgp_node *bgp_node_match_ipv4 (struct bgp_table *,
 struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *,
 					  struct in6_addr *);
 #endif /* HAVE_IPV6 */
+
+#endif /* _QUAGGA_BGP_TABLE_H */

+ 5 - 0
bgpd/bgp_vty.h

@@ -18,5 +18,10 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_VTY_H
+#define _QUAGGA_BGP_VTY_H
+
 void bgp_vty_init ();
 char *afi_safi_print (afi_t, safi_t);
+
+#endif /* _QUAGGA_BGP_VTY_H */

+ 5 - 0
bgpd/bgp_zebra.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGP_ZEBRA_H
+#define _QUAGGA_BGP_ZEBRA_H
+
 int bgp_if_update_all ();
 int bgp_config_write_redistribute (struct vty *, struct bgp *, afi_t, safi_t,
 				   int *);
@@ -37,3 +40,5 @@ struct interface *if_lookup_by_ipv4_exact (struct in_addr *);
 struct interface *if_lookup_by_ipv6 (struct in6_addr *);
 struct interface *if_lookup_by_ipv6_exact (struct in6_addr *);
 #endif /* HAVE_IPV6 */
+
+#endif /* _QUAGGA_BGP_ZEBRA_H */

+ 5 - 0
bgpd/bgpd.h

@@ -18,6 +18,9 @@ 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.  */
 
+#ifndef _QUAGGA_BGPD_H
+#define _QUAGGA_BGPD_H
+
 /* For union sockunion.  */
 #include "sockunion.h"
 
@@ -905,3 +908,5 @@ int peer_clear (struct peer *);
 int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
 
 void peer_nsf_stop (struct peer *);
+
+#endif /* _QUAGGA_BGPD_H */