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>
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
{
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 { \
void bgp_sync_init (struct peer *);
void bgp_sync_delete (struct peer *);
+
+#endif /* _QUAGGA_BGP_ADVERTISE_H */
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
int aspath_private_as_check (struct aspath *);
int aspath_firstas_check (struct aspath *, as_t);
unsigned long aspath_count ();
+
+#endif /* _QUAGGA_BGP_ASPATH_H */
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
/* Transit attribute prototypes. */
void transit_unintern (struct transit *);
+
+#endif /* _QUAGGA_BGP_ATTR_H */
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
struct community *
community_list_match_delete (struct community *,
struct community_list *);
+
+#endif /* _QUAGGA_BGP_CLIST_H */
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
{
void community_del_val (struct community *, u_int32_t *);
unsigned long community_count ();
struct hash *community_hash ();
+
+#endif /* _QUAGGA_BGP_COMMUNITY_H */
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
{
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 */
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
extern struct message bgp_status_msg[];
extern int bgp_status_msg_max;
+
+#endif /* _QUAGGA_BGP_DEBUG_H */
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
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 */
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
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 */
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,
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 */
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)
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 */
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
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 */
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 */
#endif /* HAVE_IPV6 */
\f
/* 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;
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
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 */
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
{
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 */
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
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 */
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
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 */
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. */
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 */
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 */
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,
struct bgp_node *bgp_node_match_ipv6 (struct bgp_table *,
struct in6_addr *);
#endif /* HAVE_IPV6 */
+
+#endif /* _QUAGGA_BGP_TABLE_H */
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 */
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 *);
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 */
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"
int peer_clear_soft (struct peer *, afi_t, safi_t, enum bgp_clear_type);
void peer_nsf_stop (struct peer *);
+
+#endif /* _QUAGGA_BGPD_H */