Skip to content

Commit

Permalink
Add bincode derives
Browse files Browse the repository at this point in the history
  • Loading branch information
density215 committed Jun 8, 2024
1 parent 2d279a2 commit dac6774
Show file tree
Hide file tree
Showing 19 changed files with 105 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ keywords = ["routing", "bgp"]
license = "BSD-3-Clause"

[dependencies]
inetnum = { version = "0.1.0", features = ["arbitrary", "serde"] }
# inetnum = { version = "0.1.0", features = ["arbitrary", "serde"] }
inetnum = { path = "../inetnum", features = ["arbitrary", "serde", "bincode"] }
arbitrary = { version = "1.3.1", optional = true, features = ["derive"] }
bytes = { version = "1.2", optional = true }
chrono = { version = "0.4.20", optional = true, default-features = false }
Expand All @@ -22,6 +23,7 @@ octseq = { version = "0.4.0", optional = true, features = ["bytes"] }
paste = { version = "1" }
serde = { version = "1.0.165", optional = true, features = ["derive"] }
tokio = { version = ">=1.24.2", optional = true, features = ["io-util", "macros", "net", "sync", "rt-multi-thread", "time"] }
bincode = { version = "2.0.0-rc.3", optional = true }

[dev-dependencies]
memmap2 = "0.9"
Expand Down
4 changes: 4 additions & 0 deletions src/bgp/aspath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub trait SerializeForOperators: Serialize {
///
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[derive(Clone, Debug, Default, Eq, PartialEq, Hash)]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct HopPath {
/// The hops in this HopPath.
hops: Vec<OwnedHop>,
Expand Down Expand Up @@ -803,6 +804,7 @@ impl<'a, Octs: Octets> Iterator for PathSegments<'a, Octs> {
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Segment<Octs> {
stype: SegmentType,
four_byte_asns: bool,
Expand Down Expand Up @@ -1028,6 +1030,7 @@ impl<Octs: Octets> fmt::Display for Segment<Octs> {
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub enum SegmentType {
Set,
Sequence,
Expand Down Expand Up @@ -1087,6 +1090,7 @@ impl fmt::Display for SegmentType {
#[derive(Copy, Clone, Debug)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub enum Hop<Octs> {
Asn(Asn),
Segment(Segment<Octs>),
Expand Down
6 changes: 6 additions & 0 deletions src/bgp/communities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ pub trait SerializeForOperators: Serialize {
/// Standard and Extended/Large Communities variants.
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub enum Community {
Standard(StandardCommunity),
Extended(ExtendedCommunity),
Expand Down Expand Up @@ -260,6 +261,7 @@ impl Display for Community {
/// serializing our Community type and in turn the contained routecore
/// Community type and its children.
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, )]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct HumanReadableCommunity(pub Community);

impl From<Community> for HumanReadableCommunity {
Expand Down Expand Up @@ -484,6 +486,7 @@ wellknown!(Wellknown,
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd )]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct StandardCommunity(pub(crate) [u8; 4]);

impl StandardCommunity {
Expand Down Expand Up @@ -754,6 +757,7 @@ impl Display for Tag {
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd )]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct ExtendedCommunity([u8; 8]);

impl ExtendedCommunity {
Expand Down Expand Up @@ -1313,6 +1317,7 @@ impl SerializeForOperators for ExtendedCommunity {
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd )]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv6ExtendedCommunity([u8; 20]);


Expand Down Expand Up @@ -1442,6 +1447,7 @@ impl Display for Ipv6ExtendedCommunity {
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd )]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct LargeCommunity([u8; 12]);

impl LargeCommunity {
Expand Down
7 changes: 7 additions & 0 deletions src/bgp/message/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use crate::util::parser::ParseError;
/// BGP UPDATE message, variant of the [`Message`] enum.
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct UpdateMessage<Octs: Octets> {
octets: Octs,
withdrawals: Range<usize>,
Expand Down Expand Up @@ -1053,6 +1054,7 @@ impl<Octs: Octets> UpdateMessage<Octs> {
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct SessionConfig {
four_octet_asns: FourOctetAsns,
ipv4unicast_in_mp: Ipv4UnicastInMp,
Expand All @@ -1067,6 +1069,7 @@ pub struct SessionConfig {
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct PduParseInfo {
four_octet_asns: FourOctetAsns,
pdu_addpaths: PduAddpaths,
Expand Down Expand Up @@ -1163,6 +1166,7 @@ impl Default for PduParseInfo {
#[derive(Copy, Clone, Default, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
struct PduAddpaths {
conventional: bool,
mp_reach: bool,
Expand Down Expand Up @@ -1193,6 +1197,7 @@ impl PduAddpaths {
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
struct SessionAddpaths(HashMap<AfiSafiType, AddpathDirection>);
impl SessionAddpaths {
fn new() -> Self {
Expand Down Expand Up @@ -1304,6 +1309,7 @@ impl SessionConfig {
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct FourOctetAsns(pub bool);

/// Indicates whether Ipv4Unicast NLRI are carried in the MP attribute.
Expand All @@ -1315,6 +1321,7 @@ pub struct FourOctetAsns(pub bool);
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4UnicastInMp(pub bool);

/// Iterator for BGP UPDATE Communities.
Expand Down
1 change: 1 addition & 0 deletions src/bgp/message/update_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1201,6 +1201,7 @@ impl<A: NlriCompose> MpUnreachNlriBuilder<A> {
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct StandardCommunitiesList {
communities: Vec<StandardCommunity>,
len: usize, // size of value, excluding path attribute flags+type_code+len
Expand Down
38 changes: 38 additions & 0 deletions src/bgp/nlri/afisafi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ macro_rules! addpath {
#[derive(Copy, Clone, Debug, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct [<$nlri AddpathNlri>](PathId, [<$nlri Nlri>]);
impl AfiSafiNlri for [<$nlri AddpathNlri>] {
type Nlri = <[<$nlri Nlri>] as AfiSafiNlri>::Nlri;
Expand All @@ -64,6 +65,7 @@ macro_rules! addpath {
#[derive(Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct [<$nlri AddpathNlri>]<$gen>(PathId, [<$nlri Nlri>]<$gen>);
impl<$gen> AfiSafiNlri for [<$nlri AddpathNlri>]<$gen> {
type Nlri = <[<$nlri Nlri>]<$gen> as AfiSafiNlri>::Nlri;
Expand Down Expand Up @@ -170,6 +172,7 @@ paste! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub enum AfiSafiType {
$( $( [<$afi_name $safi_name>] ,)+)+
Unsupported(u16, u8),
Expand Down Expand Up @@ -331,6 +334,7 @@ paste! {
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub enum NlriType {
$($(
[<$afi_name $safi_name>],
Expand Down Expand Up @@ -518,6 +522,27 @@ impl Nlri<&[u8]> {
}
}

#[cfg(feature = "bincode")]
impl<Octs: Octets> bincode::Encode for Nlri<Octs> {
fn encode<E: bincode::enc::Encoder>(&self, encoder: &mut E) -> Result<(), bincode::error::EncodeError> {
todo!()
}
}

#[cfg(feature = "bincode")]
impl<Octs: Octets> bincode::Decode for Nlri<Octs> {
fn decode<D: bincode::de::Decoder>(decoder: &mut D) -> Result<Self, bincode::error::DecodeError> {
todo!()
}
}

#[cfg(feature = "bincode")]
impl<'de, Octs: Octets> bincode::BorrowDecode<'de> for Nlri<Octs> {
fn borrow_decode<D: bincode::de::BorrowDecoder<'de>>(decoder: &mut D) -> Result<Self, bincode::error::DecodeError> {
todo!()
}
}

//------------ Traits ---------------------------------------------------------

/// A type characterized by an AFI and SAFI.
Expand Down Expand Up @@ -640,6 +665,7 @@ afisafi! {
#[derive(Copy, Clone, Debug, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4UnicastNlri(Prefix);

impl AfiSafiNlri for Ipv4UnicastNlri {
Expand Down Expand Up @@ -708,6 +734,7 @@ impl NlriCompose for Ipv4UnicastNlri {
#[derive(Copy, Clone, Debug, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4MulticastNlri(Prefix);

impl AfiSafiNlri for Ipv4MulticastNlri {
Expand Down Expand Up @@ -775,6 +802,7 @@ impl NlriCompose for Ipv4MulticastNlri {
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4MplsUnicastNlri<Octs>(MplsNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv4MplsUnicastNlri<Octs> {
Expand Down Expand Up @@ -850,6 +878,7 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv4MplsUnicastNlri<Octs> {
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4MplsVpnUnicastNlri<Octs>(MplsVpnNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv4MplsVpnUnicastNlri<Octs> {
Expand Down Expand Up @@ -924,6 +953,7 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv4MplsVpnUnicastNlri<Octs> {
#[derive(Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4RouteTargetNlri<Octs>(RouteTargetNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv4RouteTargetNlri<Octs> {
Expand Down Expand Up @@ -996,6 +1026,7 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv4RouteTargetNlri<Octs> {
#[derive(Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv4FlowSpecNlri<Octs>(FlowSpecNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv4FlowSpecNlri<Octs> {
Expand Down Expand Up @@ -1082,6 +1113,7 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv4FlowSpecNlri<Octs> {
#[derive(Copy, Clone, Debug, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv6UnicastNlri(Prefix);
impl AfiSafiNlri for Ipv6UnicastNlri {
type Nlri = Prefix;
Expand Down Expand Up @@ -1148,6 +1180,7 @@ impl NlriCompose for Ipv6UnicastNlri {
#[derive(Copy, Clone, Debug, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv6MulticastNlri(Prefix);

impl FromStr for Ipv6MulticastNlri {
Expand Down Expand Up @@ -1215,6 +1248,7 @@ impl NlriCompose for Ipv6MulticastNlri {
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv6MplsUnicastNlri<Octs>(MplsNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv6MplsUnicastNlri<Octs> {
Expand Down Expand Up @@ -1291,6 +1325,7 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv6MplsUnicastNlri<Octs> {
#[derive(Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv6MplsVpnUnicastNlri<Octs>(MplsVpnNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv6MplsVpnUnicastNlri<Octs> {
Expand Down Expand Up @@ -1366,6 +1401,7 @@ impl<Octs: AsRef<[u8]>> Ord for Ipv6MplsVpnUnicastNlri<Octs> {
#[derive(Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Ipv6FlowSpecNlri<Octs>(FlowSpecNlri<Octs>);

impl<Octs> AfiSafiNlri for Ipv6FlowSpecNlri<Octs> {
Expand Down Expand Up @@ -1474,6 +1510,7 @@ impl<Octs> Ipv4MplsUnicastNlri<Octs> {
#[derive(Copy, Clone, Debug, Hash, PartialEq, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct L2VpnVplsNlri(VplsNlri);

impl AfiSafiNlri for L2VpnVplsNlri {
Expand Down Expand Up @@ -1514,6 +1551,7 @@ impl NlriCompose for L2VpnVplsNlri {
#[derive(Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct L2VpnEvpnNlri<Octs>(EvpnNlri<Octs>);

impl<Octs> AfiSafiNlri for L2VpnEvpnNlri<Octs> {
Expand Down
2 changes: 2 additions & 0 deletions src/bgp/nlri/common.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@

use octseq::{Octets, OctetsBuilder, Parser};
use bincode::{Decode, Encode};
use crate::util::parser::ParseError;
use inetnum::addr::Prefix;
use super::afisafi::Afi;
Expand All @@ -12,6 +13,7 @@ use std::fmt;
///
/// Used in all AddpathNlri variants.
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
#[cfg_attr(feature = "bincode", derive(Decode,Encode))]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct PathId(pub u32);
Expand Down
1 change: 1 addition & 0 deletions src/bgp/nlri/evpn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ typeenum!(
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct EvpnNlri<Octs> {
#[allow(dead_code)]
route_type: EvpnRouteType,
Expand Down
1 change: 1 addition & 0 deletions src/bgp/nlri/flowspec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use super::afisafi::Afi;
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct FlowSpecNlri<Octs> {
#[allow(dead_code)]
afi: Afi,
Expand Down
2 changes: 2 additions & 0 deletions src/bgp/nlri/mpls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::afisafi::Afi;
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct MplsNlri<Octs> {
prefix: Prefix,
labels: Labels<Octs>,
Expand Down Expand Up @@ -150,6 +151,7 @@ impl<Octs, SrcOcts: Octets> OctetsFrom<MplsNlri<SrcOcts>> for MplsNlri<Octs>
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct Labels<Octs> {
octets: Octs
}
Expand Down
2 changes: 2 additions & 0 deletions src/bgp/nlri/mpls_vpn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use super::mpls::Labels;
#[derive(Copy, Clone, Debug, Hash)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct MplsVpnNlri<Octs> {
prefix: Prefix,
labels: Labels<Octs>,
Expand Down Expand Up @@ -148,6 +149,7 @@ impl<T> fmt::Display for MplsVpnNlri<T> {
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd)]
#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub struct RouteDistinguisher {
bytes: [u8; 8]
}
Expand Down
1 change: 1 addition & 0 deletions src/bgp/nlri/nexthop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ use super::afisafi::AfiSafiType as AfiSafi;
/// Conventional and BGP-MP Next Hop variants.
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "bincode", derive(bincode::Decode, bincode::Encode))]
pub enum NextHop {
Unicast(IpAddr),
Multicast(IpAddr),
Expand Down
Loading

0 comments on commit dac6774

Please sign in to comment.