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
OpenMessage— BGP OPEN with capability negotiationNotificationMessage— BGP NOTIFICATION with error codesUpdateMessage— BGP UPDATE (wire-level framing, raw bytes in M0)Keepalive— represented asMessage::Keepaliveunit variant
§Entry Points
decode_message— decode a complete BGP message from bytesencode_message— encode a BGP message to bytespeek_message_length— check if a complete message is available (for transport framing)
§Invariants
- Maximum message size: 4096 bytes (RFC 4271 §4.1)
- No panics on malformed input — all paths return
Result - No
unsafecode
Re-exports§
pub use capability::AddPathFamily;pub use capability::AddPathMode;pub use capability::Afi;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 update::ParsedUpdate;pub use validate::UpdateError;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;
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.
- flowspec
- FlowSpec NLRI types and codec (RFC 8955 / RFC 8956).
RFC 8955 / RFC 8956
FlowSpecNLRI 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.
- 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).
Enums§
- Rpki
Validation - RPKI origin validation state per RFC 6811.
Constants§
- COMMUNITY_
LLGR_ STALE LLGR_STALEcommunity (RFC 9494 §4.6): marks a route as long-lived stale.- COMMUNITY_
NO_ LLGR NO_LLGRcommunity (RFC 9494 §4.7): this route must not enter LLGR stale phase.