]>
git.proxmox.com Git - mirror_frr.git/blob - bgpd/bgp_packet.h
1 /* BGP packet management header.
2 * Copyright (C) 1999 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef _QUAGGA_BGP_PACKET_H
22 #define _QUAGGA_BGP_PACKET_H
26 DECLARE_HOOK(bgp_packet_dump
,
27 (struct peer
*peer
, uint8_t type
, bgp_size_t size
,
29 (peer
, type
, size
, s
));
31 DECLARE_HOOK(bgp_packet_send
,
32 (struct peer
*peer
, uint8_t type
, bgp_size_t size
,
34 (peer
, type
, size
, s
));
36 #define BGP_NLRI_LENGTH 1U
37 #define BGP_TOTAL_ATTR_LEN 2U
38 #define BGP_UNFEASIBLE_LEN 2U
41 #define REFRESH_IMMEDIATE 1
42 #define REFRESH_DEFER 2
44 /* ORF Common part flag */
45 #define ORF_COMMON_PART_ADD 0x00
46 #define ORF_COMMON_PART_REMOVE 0x80
47 #define ORF_COMMON_PART_REMOVE_ALL 0xC0
48 #define ORF_COMMON_PART_PERMIT 0x00
49 #define ORF_COMMON_PART_DENY 0x20
51 #define BGP_UPDATE_EOR_PKT(_peer, _afi, _safi, _s) \
53 _s = bgp_update_packet_eor(_peer, _afi, _safi); \
55 bgp_packet_add(_peer, _s); \
59 /* Packet send and receive function prototypes. */
60 extern void bgp_keepalive_send(struct peer
*);
61 extern void bgp_open_send(struct peer
*);
62 extern void bgp_notify_send(struct peer
*, uint8_t, uint8_t);
63 extern void bgp_notify_send_with_data(struct peer
*, uint8_t, uint8_t,
65 void bgp_notify_io_invalid(struct peer
*peer
, uint8_t code
, uint8_t sub_code
,
66 uint8_t *data
, size_t datalen
);
67 extern void bgp_route_refresh_send(struct peer
*peer
, afi_t afi
, safi_t safi
,
68 uint8_t orf_type
, uint8_t when_to_refresh
,
69 int remove
, uint8_t subtype
);
70 extern void bgp_capability_send(struct peer
*, afi_t
, safi_t
, int, int);
72 extern int bgp_capability_receive(struct peer
*, bgp_size_t
);
74 extern int bgp_nlri_parse(struct peer
*, struct attr
*, struct bgp_nlri
*,
77 extern void bgp_update_restarted_peers(struct peer
*);
78 extern void bgp_update_implicit_eors(struct peer
*);
79 extern void bgp_check_update_delay(struct bgp
*);
81 extern int bgp_packet_set_marker(struct stream
*s
, uint8_t type
);
82 extern void bgp_packet_set_size(struct stream
*s
);
84 extern void bgp_generate_updgrp_packets(struct thread
*);
85 extern void bgp_process_packet(struct thread
*);
87 extern void bgp_send_delayed_eor(struct bgp
*bgp
);
89 /* Task callback to handle socket error encountered in the io pthread */
90 void bgp_packet_process_error(struct thread
*thread
);
91 extern struct bgp_notify
92 bgp_notify_decapsulate_hard_reset(struct bgp_notify
*notify
);
93 extern bool bgp_has_graceful_restart_notification(struct peer
*peer
);
94 extern bool bgp_notify_send_hard_reset(struct peer
*peer
, uint8_t code
,
96 extern bool bgp_notify_received_hard_reset(struct peer
*peer
, uint8_t code
,
99 #endif /* _QUAGGA_BGP_PACKET_H */