X-Git-Url: http://git.sameswireless.fr/l2tpns.git/blobdiff_plain/6b1075b65c4239e97629f3a891f49f5ae9ef3d4b..d7e506baf457af512f47bbe7a4d50dfd9bab087c:/bgp.h diff --git a/bgp.h b/bgp.h index 6559566..28b315b 100644 --- a/bgp.h +++ b/bgp.h @@ -1,5 +1,5 @@ /* BGPv4 (RFC1771) */ -/* $Id: bgp.h,v 1.4 2004/12/16 08:49:52 bodea Exp $ */ +/* $Id: bgp.h,v 1.5 2005/06/04 15:42:35 bodea Exp $ */ #ifndef __BGP_H__ #define __BGP_H__ @@ -43,6 +43,34 @@ struct bgp_data_open { char opt_params[sizeof(((struct bgp_packet *)0)->data) - BGP_DATA_OPEN_SIZE]; /* variable */ } __attribute__ ((packed)); +struct bgp_opt_param { + uint8_t type; + uint8_t len; +#define BGP_MAX_OPT_PARAM_SIZE 256 + char value[BGP_MAX_OPT_PARAM_SIZE]; +} __attribute__ ((packed)); + +#define BGP_CAPABILITY_PARAM_TYPE 2 +struct bgp_capability { + uint8_t code; + uint8_t len; +#define BGP_MAX_CAPABILITY_SIZE 256 + char value[BGP_MAX_CAPABILITY_SIZE]; +} __attribute__ ((packed)); + +/* RFC4760 Multiprotocol extension */ +#define BGP_CAP_CODE_MP 1 + +struct bgp_mp_cap_param { + uint16_t afi; /* sa_family_t */ + uint8_t reserved; /* SHOULD be 0 */ + uint8_t safi; +} __attribute__ ((packed)); + +/* bgp_mp_cap_param.safi */ +#define BGP_MP_SAFI_UNICAST 1 +#define BGP_MP_SAFI_MULTICAST 2 + struct bgp_ip_prefix { uint8_t len; uint32_t prefix; /* variable */ @@ -101,6 +129,7 @@ struct bgp_data_notification { } __attribute__ ((packed)); /* bgp_data_notification.error_code, .error_subcode */ +#define BGP_ERR_UNSPEC 0 #define BGP_ERR_HEADER 1 # define BGP_ERR_HDR_NOT_SYNC 1 # define BGP_ERR_HDR_BAD_LEN 2 @@ -112,6 +141,7 @@ struct bgp_data_notification { # define BGP_ERR_OPN_UNSUP_PARAM 4 # define BGP_ERR_OPN_AUTH_FAILURE 5 # define BGP_ERR_OPN_HOLD_TIME 6 +# define BGP_ERR_OPN_UNSUP_CAP 7 #define BGP_ERR_UPDATE 3 # define BGP_ERR_UPD_BAD_ATTR_LIST 1 # define BGP_ERR_UPD_UNKN_WK_ATTR 2 @@ -173,6 +203,8 @@ struct bgp_peer { int cli_flag; /* updates requested from CLI */ char *path_attrs; /* path attrs to send in UPDATE message */ int path_attr_len; /* length of path attrs */ + uint32_t events; /* events to poll */ + struct event_data edata; /* poll data */ }; /* bgp_peer.cli_flag */ @@ -194,8 +226,8 @@ int bgp_restart(struct bgp_peer *peer); int bgp_add_route(in_addr_t ip, in_addr_t mask); int bgp_del_route(in_addr_t ip, in_addr_t mask); void bgp_enable_routing(int enable); -int bgp_select_state(struct bgp_peer *peer); -int bgp_process(struct bgp_peer *peer, int readable, int writable); +int bgp_set_poll(void); +int bgp_process(uint32_t events[]); char const *bgp_state_str(enum bgp_state state); extern char const *cvs_id_bgp;