📄 bgpd.h
字号:
/* BGP message definition header. Copyright (C) 1996, 97, 98, 99, 2000 Kunihiro IshiguroThis file is part of GNU Zebra.GNU Zebra is free software; you can redistribute it and/or modify itunder the terms of the GNU General Public License as published by theFree Software Foundation; either version 2, or (at your option) anylater version.GNU Zebra is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Zebra; see the file COPYING. If not, write to the FreeSoftware Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA02111-1307, USA. *//* For union sockunion. */#include "sockunion.h"/* ZEBRA BGPd Version */#define ZEBRA_BGPD_VERSION "0.95 build 25"/* Typedef BGP specific types. */typedef u_int16_t as_t;typedef u_int16_t bgp_size_t;/* BGP master for system wide configurations and variables. */struct bgp_master{ /* BGP instance list. */ struct list *bgp; /* BGP thread master. */ struct thread_master *master; /* BGP port number. */ u_int16_t port; /* BGP start time. */ time_t start_time; /* Various BGP global configuration. */ u_char options;#define BGP_OPT_NO_FIB (1 << 0)#define BGP_OPT_MULTIPLE_INSTANCE (1 << 1)#define BGP_OPT_CONFIG_CISCO (1 << 2)#ifdef HAVE_TCP_SIGNATURE /* bgp receive socket */ int sock;#endif /* HAVE_TCP_SIGNATURE */};/* BGP instance structure. */struct bgp { /* AS number of this BGP instance. */ as_t as; /* Name of this BGP instance. */ char *name; /* Self peer. */ struct peer *peer_self; /* BGP peer. */ struct list *peer; /* BGP peer group. */ struct list *group; /* BGP configuration. */ u_int16_t config;#define BGP_CONFIG_ROUTER_ID (1 << 0)#define BGP_CONFIG_CLUSTER_ID (1 << 1)#define BGP_CONFIG_CONFEDERATION (1 << 2) /* BGP router identifier. */ struct in_addr router_id; /* BGP route reflector cluster ID. */ struct in_addr cluster_id; /* BGP confederation information. */ as_t confed_id; as_t *confed_peers; int confed_peers_cnt; /* BGP flags. */ u_int16_t flags;#define BGP_FLAG_ALWAYS_COMPARE_MED (1 << 0)#define BGP_FLAG_DETERMINISTIC_MED (1 << 1)#define BGP_FLAG_MED_MISSING_AS_WORST (1 << 2)#define BGP_FLAG_MED_CONFED (1 << 3)#define BGP_FLAG_NO_DEFAULT_IPV4 (1 << 4)#define BGP_FLAG_NO_CLIENT_TO_CLIENT (1 << 5)#define BGP_FLAG_NO_ENFORCE_FIRST_AS (1 << 6)#define BGP_FLAG_COMPARE_ROUTER_ID (1 << 7)#define BGP_FLAG_ASPATH_IGNORE (1 << 8)#define BGP_FLAG_IMPORT_CHECK (1 << 9)#define BGP_FLAG_NO_FAST_EXT_FAILOVER (1 << 10)#define BGP_FLAG_LOG_NEIGHBOR_CHANGES (1 << 11)#define BGP_FLAG_GRACEFUL_RESTART (1 << 12)#define BGP_FLAG_COST_COMMUNITY_IGNORE (1 << 13) /* BGP Per AF flags */ u_int16_t af_flags[AFI_MAX][SAFI_MAX];#define BGP_CONFIG_DAMPENING (1 << 0) /* Static route configuration. */ struct bgp_table *route[AFI_MAX][SAFI_MAX]; /* Aggregate address configuration. */ struct bgp_table *aggregate[AFI_MAX][SAFI_MAX]; /* BGP routing information base. */ struct bgp_table *rib[AFI_MAX][SAFI_MAX]; /* BGP redistribute configuration. */ u_char redist[AFI_MAX][ZEBRA_ROUTE_MAX]; /* BGP redistribute metric configuration. */ u_char redist_metric_flag[AFI_MAX][ZEBRA_ROUTE_MAX]; u_int32_t redist_metric[AFI_MAX][ZEBRA_ROUTE_MAX]; /* BGP redistribute route-map. */ struct { char *name; struct route_map *map; } rmap[AFI_MAX][ZEBRA_ROUTE_MAX]; /* BGP distance configuration. */ u_char distance_ebgp; u_char distance_ibgp; u_char distance_local; /* BGP default local-preference. */ u_int32_t default_local_pref; /* BGP default timer. */ u_int32_t default_holdtime; u_int32_t default_keepalive; /* BGP graceful restart */ u_int32_t restart_time; u_int32_t stalepath_time;};/* BGP peer-group support. */struct peer_group{ /* Name of the peer-group. */ char *name; /* Pointer to BGP. */ struct bgp *bgp; /* Peer-group client list. */ struct list *peer; /* Peer-group config */ struct peer *conf;};/* BGP Notify message format. */struct bgp_notify { u_char code; u_char subcode; char *data; bgp_size_t length;};/* Next hop self address. */struct bgp_nexthop{ struct interface *ifp; struct in_addr v4;#ifdef HAVE_IPV6 struct in6_addr v6_global; struct in6_addr v6_local;#endif /* HAVE_IPV6 */ };/* BGP router distinguisher value. */#define BGP_RD_SIZE 8struct bgp_rd{ u_char val[BGP_RD_SIZE];};/* BGP filter structure. */struct bgp_filter{ /* Distribute-list. */ struct { char *name; struct access_list *alist; } dlist[FILTER_MAX]; /* Prefix-list. */ struct { char *name; struct prefix_list *plist; } plist[FILTER_MAX]; /* Filter-list. */ struct { char *name; struct as_list *aslist; } aslist[FILTER_MAX]; /* Route-map. */ struct { char *name; struct route_map *map; } map[FILTER_MAX]; /* Unsuppress-map. */ struct { char *name; struct route_map *map; } usmap;};/* BGP neighbor structure. */struct peer{ /* BGP structure. */ struct bgp *bgp; /* BGP peer group. */ struct peer_group *group; /* Peer's remote AS number. */ as_t as; /* Peer's local AS number. */ as_t local_as; /* Peer's Change local AS number. */ as_t change_local_as; /* Remote router ID. */ struct in_addr remote_id; /* Local router ID. */ struct in_addr local_id; /* Packet receive and send buffer. */ struct stream *ibuf; struct stream_fifo *obuf; struct stream *work; /* Status of the peer. */ int status; int ostatus; /* Peer information */ int fd; /* File descriptor */ int ttl; /* TTL of TCP connection to the peer. */ char *desc; /* Description of the peer. */ unsigned short port; /* Destination port for peer */ char *host; /* Printable address of the peer. */ union sockunion su; /* Sockunion address of the peer. */ time_t uptime; /* Last Up/Down time */ time_t readtime; /* Last read time */ time_t resettime; /* Last reset time */ unsigned int ifindex; /* ifindex of the BGP connection. */ char *ifname; /* bind interface name. */ char *update_if; union sockunion *update_source; struct zlog *log; union sockunion *su_local; /* Sockunion of local address. */ union sockunion *su_remote; /* Sockunion of remote address. */ int shared_network; /* Is this peer shared same network. */ struct bgp_nexthop nexthop; /* Nexthop */ /* Peer address family configuration. */ u_char afc[AFI_MAX][SAFI_MAX]; u_char afc_nego[AFI_MAX][SAFI_MAX]; u_char afc_adv[AFI_MAX][SAFI_MAX]; u_char afc_recv[AFI_MAX][SAFI_MAX]; /* Capability flags (reset in bgp_stop) */ u_char cap;#define PEER_CAP_REFRESH_ADV (1 << 0) /* refresh advertised */#define PEER_CAP_REFRESH_OLD_RCV (1 << 1) /* refresh old received */#define PEER_CAP_REFRESH_NEW_RCV (1 << 2) /* refresh rfc received */#define PEER_CAP_DYNAMIC_ADV (1 << 3) /* dynamic advertised */#define PEER_CAP_DYNAMIC_RCV (1 << 4) /* dynamic received */#define PEER_CAP_RESTART_ADV (1 << 5) /* restart advertised */#define PEER_CAP_RESTART_RCV (1 << 6) /* restart received */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -