1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/// The 16-byte marker field (all 0xFF) that begins every BGP message.
pub const MARKER: = ;
/// Length of the BGP message header in bytes.
pub const HEADER_LEN: usize = 19;
/// Minimum valid BGP message length (header only, used by KEEPALIVE).
pub const MIN_MESSAGE_LEN: u16 = 19;
/// Maximum valid BGP message length per RFC 4271 §4.1.
pub const MAX_MESSAGE_LEN: u16 = 4096;
/// Maximum BGP message length with Extended Messages (RFC 8654).
pub const EXTENDED_MAX_MESSAGE_LEN: u16 = 65535;
/// Size of the marker field in the header.
pub const MARKER_LEN: usize = 16;
/// BGP protocol version.
pub const BGP_VERSION: u8 = 4;
/// `AS_TRANS` value for 4-byte ASN backward compatibility (RFC 6793).
pub const AS_TRANS: u16 = 23456;
/// Default BGP TCP port.
pub const BGP_PORT: u16 = 179;
/// Minimum non-zero hold time in seconds (RFC 4271 §4.2).
pub const MIN_HOLD_TIME: u16 = 3;
/// Minimum OPEN message length (header + version + AS + hold + ID + opt len).
pub const MIN_OPEN_LEN: u16 = 29;
/// Minimum UPDATE message length (header + withdrawn len + attrs len).
pub const MIN_UPDATE_LEN: u16 = 23;
/// Minimum NOTIFICATION message length (header + code + subcode).
pub const MIN_NOTIFICATION_LEN: u16 = 21;
/// Message type codes.
/// OPEN optional parameter type codes (RFC 5492).
/// Capability codes (IANA BGP Capability Codes registry).
/// Path attribute type codes (RFC 4271 §5).
/// Path attribute flag bits (RFC 4271 §4.3).
/// `AS_PATH` segment types (RFC 4271 §4.3).