Skip to main content

Crate rustbgpd_wire

Crate rustbgpd_wire 

Source
Expand description

rustbgpd-wire — BGP message codec

Pure codec library for BGP message encoding and decoding. Zero internal dependencies. This crate is independently publishable.

§Message Types

§Entry Points

§Invariants

  • Maximum message size: 4096 bytes (RFC 4271 §4.1)
  • No panics on malformed input — all paths return Result
  • No unsafe code

Re-exports§

pub use capability::AddPathFamily;
pub use capability::AddPathMode;
pub use capability::Afi;
pub use capability::BgpRole;
pub use capability::Capability;
pub use capability::ExtendedNextHopFamily;
pub use capability::GracefulRestartFamily;
pub use capability::LlgrFamily;
pub use capability::Safi;
pub use constants::EXTENDED_MAX_MESSAGE_LEN;
pub use constants::MAX_MESSAGE_LEN;
pub use error::DecodeError;
pub use error::EncodeError;
pub use header::BgpHeader;
pub use header::MessageType;
pub use header::peek_message_length;
pub use message::Message;
pub use message::decode_message;
pub use message::encode_message;
pub use message::encode_message_with_limit;
pub use notification::NotificationCode;
pub use notification_msg::NotificationMessage;
pub use open::OpenMessage;
pub use route_refresh::RouteRefreshMessage;
pub use route_refresh::RouteRefreshSubtype;
pub use update::Ipv4UnicastMode;
pub use update::UpdateMessage;
pub use attribute::AsPath;
pub use attribute::AsPathSegment;
pub use attribute::ExtendedCommunity;
pub use attribute::LargeCommunity;
pub use attribute::MpReachNlri;
pub use attribute::MpUnreachNlri;
pub use attribute::Origin;
pub use attribute::PathAttribute;
pub use attribute::RawAttribute;
pub use attribute::is_private_asn;
pub use nlri::Ipv4NlriEntry;
pub use nlri::Ipv4Prefix;
pub use nlri::Ipv6Prefix;
pub use nlri::NlriEntry;
pub use nlri::Prefix;
pub use orf::AddressPrefixOrf;
pub use orf::OrfAction;
pub use orf::OrfCapEntry;
pub use orf::OrfCapType;
pub use orf::OrfEntries;
pub use orf::OrfEntryGroup;
pub use orf::OrfMatch;
pub use orf::OrfPayload;
pub use orf::OrfSendReceive;
pub use orf::OrfType;
pub use orf::WhenToRefresh;
pub use pmsi::PmsiTunnel;
pub use pmsi::PmsiTunnelIdentifier;
pub use pmsi::PmsiTunnelType;
pub use update::ParsedUpdate;
pub use validate::UpdateError;
pub use validate::UpdateValidationOptions;
pub use validate::is_valid_ipv6_nexthop;
pub use flowspec::BitmaskMatch;
pub use flowspec::FlowSpecAction;
pub use flowspec::FlowSpecComponent;
pub use flowspec::FlowSpecPrefix;
pub use flowspec::FlowSpecRule;
pub use flowspec::Ipv6PrefixOffset;
pub use flowspec::NumericMatch;
pub use evpn::EthernetSegmentIdentifier;
pub use evpn::EthernetTagId;
pub use evpn::EvpnEadPerEs;
pub use evpn::EvpnEadPerEvi;
pub use evpn::EvpnEs;
pub use evpn::EvpnImet;
pub use evpn::EvpnIpPrefixRoute;
pub use evpn::EvpnIpPrefixValue;
pub use evpn::EvpnMacIp;
pub use evpn::EvpnRoute;
pub use evpn::EvpnRouteKey;
pub use evpn::MacAddress;
pub use evpn::MplsLabel;
pub use evpn::RouteDistinguisher;
pub use evpn::RouteDistinguisherParseError;
pub use evpn::decode_evpn_nlri;
pub use evpn::encode_evpn_nlri;

Modules§

attribute
Path attribute types and codec (ORIGIN, AS_PATH, NEXT_HOP, etc.).
capability
BGP capability negotiation types and codec (RFC 5492).
constants
Wire-format constants: markers, lengths, type codes.
error
Decode and encode error types.
evpn
EVPN NLRI types and codec (RFC 7432 + RFC 9136). RFC 7432 EVPN NLRI codec and types.
flowspec
FlowSpec NLRI types and codec (RFC 8955 / RFC 8956). RFC 8955 / RFC 8956 FlowSpec NLRI codec and types.
header
BGP message header codec (RFC 4271 §4.1).
keepalive
KEEPALIVE message encoding and validation.
message
Top-level BGP message enum and codec dispatch.
nlri
NLRI prefix types and codec (IPv4, IPv6, Add-Path).
notification
NOTIFICATION error codes, subcodes, and shutdown communication.
notification_msg
NOTIFICATION message struct and codec.
open
OPEN message struct and codec.
orf
Outbound Route Filtering (ORF) types and codec (RFC 5291 + RFC 5292). Outbound Route Filtering (ORF) types and codec — RFC 5291 + RFC 5292.
pmsi
PMSI Tunnel path attribute (RFC 6514 §5) — used by EVPN Type 3 IMET for ingress-replication BUM. P-Multicast Service Interface (PMSI) Tunnel attribute — RFC 6514 §5.
route_refresh
ROUTE-REFRESH message struct and codec (RFC 2918 / RFC 7313).
update
UPDATE message struct, codec, and builder.
validate
UPDATE attribute semantic validation (RFC 4271 §6.3).

Structs§

AspaValidationContext
Session context needed to choose and replay ASPA path verification.

Enums§

AspaValidation
ASPA path verification state per draft-ietf-sidrops-aspa-verification.
RpkiValidation
RPKI origin validation state per RFC 6811.

Constants§

COMMUNITY_BLACKHOLE
BLACKHOLE community (RFC 7999 §5): advisory signal that traffic destined toward the tagged prefix should be discarded by receivers that explicitly opted in to honoring the request.
COMMUNITY_GRACEFUL_SHUTDOWN
GRACEFUL_SHUTDOWN community (RFC 8326 §3): tags routes on a session being brought down for maintenance so receivers de-prefer them by setting LOCAL_PREF to a low value (canonical: 0).
COMMUNITY_LLGR_STALE
LLGR_STALE community (RFC 9494 §4.6): marks a route as long-lived stale.
COMMUNITY_NO_ADVERTISE
NO_ADVERTISE community (RFC 1997): routes carrying this community must not be advertised to any other BGP peer.
COMMUNITY_NO_EXPORT
NO_EXPORT community (RFC 1997): routes carrying this community must not be advertised outside a BGP confederation boundary.
COMMUNITY_NO_EXPORT_SUBCONFED
NO_EXPORT_SUBCONFED community (RFC 1997): routes carrying this community must not be advertised to external BGP peers, including confederation external peers.
COMMUNITY_NO_LLGR
NO_LLGR community (RFC 9494 §4.7): this route must not enter LLGR stale phase.