Skip to content

Commit

Permalink
Rename trait AfiSafiParse to NlriParse
Browse files Browse the repository at this point in the history
  • Loading branch information
DRiKE committed May 28, 2024
1 parent 773a9f6 commit 0e791ba
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 28 deletions.
6 changes: 3 additions & 3 deletions src/bgp/message/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use crate::bgp::types::{
};

use crate::bgp::nlri::afisafi::{
AfiSafiNlri, AfiSafiParse, NlriIter, NlriEnumIter, Nlri, NlriType
AfiSafiNlri, NlriParse, NlriIter, NlriEnumIter, Nlri, NlriType
};

use crate::util::parser::ParseError;
Expand Down Expand Up @@ -293,7 +293,7 @@ impl<Octs: Octets> UpdateMessage<Octs> {
where
O: Octets,
Octs: Octets<Range<'a> = O>,
ASP: AfiSafiNlri + AfiSafiParse<'a, O, Octs>
ASP: AfiSafiNlri + NlriParse<'a, O, Octs>
{
if ASP::afi_safi() == AfiSafiType::Ipv4Unicast && !self.withdrawals.is_empty() {
return Ok(Some(NlriIter::<_, _, ASP>::new(
Expand Down Expand Up @@ -451,7 +451,7 @@ impl<Octs: Octets> UpdateMessage<Octs> {
where
O: Octets,
Octs: Octets<Range<'a> = O>,
ASP: AfiSafiNlri + AfiSafiParse<'a, O, Octs>
ASP: AfiSafiNlri + NlriParse<'a, O, Octs>
{
// If the requested announcements are of type Ipv4Unicast, and the
// conventional announcements range is non-zero, return that.
Expand Down
10 changes: 5 additions & 5 deletions src/bgp/message/update_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use log::warn;
use crate::bgp::aspath::HopPath;
use crate::bgp::communities::StandardCommunity;
use crate::bgp::message::{Header, MsgType, UpdateMessage, SessionConfig};
use crate::bgp::nlri::afisafi::{AfiSafiNlri, AfiSafiParse, NlriCompose};
use crate::bgp::nlri::afisafi::{AfiSafiNlri, NlriParse, NlriCompose};
use crate::bgp::path_attributes::{Attribute, PaMap, PathAttributeType};
use crate::bgp::types::{AfiSafiType, NextHop};
use crate::util::parser::ParseError;
Expand Down Expand Up @@ -217,7 +217,7 @@ where
_session_config: &SessionConfig
)
where
A: AfiSafiNlri + NlriCompose + AfiSafiParse<'a, O, Octs, Output = A>,
A: AfiSafiNlri + NlriCompose + NlriParse<'a, O, Octs, Output = A>,
Octs: Octets<Range<'a> = O>,
O: Octets,
{
Expand All @@ -239,7 +239,7 @@ where
_session_config: &SessionConfig
)
where
A: AfiSafiNlri + NlriCompose + AfiSafiParse<'a, O, Octs, Output = A>,
A: AfiSafiNlri + NlriCompose + NlriParse<'a, O, Octs, Output = A>,
Octs: Octets<Range<'a> = O>,
O: Octets,
{
Expand Down Expand Up @@ -770,7 +770,7 @@ impl<A> MpReachNlriBuilder<A> {
_session_config: &SessionConfig
)
where
A: AfiSafiNlri + NlriCompose + AfiSafiParse<'a, O, Octs, Output = A>,
A: AfiSafiNlri + NlriCompose + NlriParse<'a, O, Octs, Output = A>,
Octs: Octets<Range<'a> = O>,
O: Octets,
{
Expand Down Expand Up @@ -1136,7 +1136,7 @@ where
_session_config: &SessionConfig
)
where
A: AfiSafiNlri + NlriCompose + AfiSafiParse<'a, O, Octs, Output = A>,
A: AfiSafiNlri + NlriCompose + NlriParse<'a, O, Octs, Output = A>,
Octs: Octets<Range<'a> = O>,
O: Octets,
{
Expand Down
40 changes: 20 additions & 20 deletions src/bgp/nlri/afisafi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ macro_rules! addpath {
fn afi_safi() -> AfiSafiType { <[<$nlri Nlri>]$(<$gen>)? as AfiSafi>::afi_safi() }
}

impl<'a, Octs, P> AfiSafiParse<'a, Octs, P> for [<$nlri AddpathNlri>]$(<$gen>)?
impl<'a, Octs, P> NlriParse<'a, Octs, P> for [<$nlri AddpathNlri>]$(<$gen>)?
where
Octs: Octets,
P: 'a + Octets<Range<'a> = Octs>
Expand Down Expand Up @@ -539,7 +539,7 @@ pub trait AfiSafiNlri: AfiSafi + IsNlri { // + Clone + Hash + Debug {
//fn nexthop_compatible(&self, nh: &super::nexthop::NextHop) -> bool;
}

pub trait AfiSafiParse<'a, O, P>: Sized + IsNlri
pub trait NlriParse<'a, O, P>: Sized + IsNlri
where P: 'a + Octets<Range<'a> = O>
{
type Output: AfiSafi;
Expand Down Expand Up @@ -604,7 +604,7 @@ pub trait Addpath: AfiSafiNlri {

// adding AFI/SAFIs here requires some manual labor:
// - at the least, add a struct for $Afi$SafiNlri , deriving Clone,Debug,Hash
// - impl AfiSafiNlri, AfiSafiParse and Display
// - impl AfiSafiNlri, NlriParse and Display

afisafi! {
1_u16 => Ipv4 [
Expand Down Expand Up @@ -677,7 +677,7 @@ impl TryFrom<(Prefix, PathId)> for Ipv4UnicastAddpathNlri {
}


impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv4UnicastNlri
impl<'a, O, P> NlriParse<'a, O, P> for Ipv4UnicastNlri
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -744,7 +744,7 @@ impl TryFrom<(Prefix, PathId)> for Ipv4MulticastAddpathNlri {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv4MulticastNlri
impl<'a, O, P> NlriParse<'a, O, P> for Ipv4MulticastNlri
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -784,7 +784,7 @@ impl<Octs> AfiSafiNlri for Ipv4MplsUnicastNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv4MplsUnicastNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv4MplsUnicastNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -859,7 +859,7 @@ impl<Octs> AfiSafiNlri for Ipv4MplsVpnUnicastNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv4MplsVpnUnicastNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv4MplsVpnUnicastNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -933,7 +933,7 @@ impl<Octs> AfiSafiNlri for Ipv4RouteTargetNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv4RouteTargetNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv4RouteTargetNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1005,7 +1005,7 @@ impl<Octs> AfiSafiNlri for Ipv4FlowSpecNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv4FlowSpecNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv4FlowSpecNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1117,7 +1117,7 @@ impl TryFrom<(Prefix, PathId)> for Ipv6UnicastAddpathNlri {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv6UnicastNlri
impl<'a, O, P> NlriParse<'a, O, P> for Ipv6UnicastNlri
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1184,7 +1184,7 @@ impl AfiSafiNlri for Ipv6MulticastNlri {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv6MulticastNlri
impl<'a, O, P> NlriParse<'a, O, P> for Ipv6MulticastNlri
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1224,7 +1224,7 @@ impl<Octs> AfiSafiNlri for Ipv6MplsUnicastNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv6MplsUnicastNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv6MplsUnicastNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1300,7 +1300,7 @@ impl<Octs> AfiSafiNlri for Ipv6MplsVpnUnicastNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv6MplsVpnUnicastNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv6MplsVpnUnicastNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1375,7 +1375,7 @@ impl<Octs> AfiSafiNlri for Ipv6FlowSpecNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for Ipv6FlowSpecNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for Ipv6FlowSpecNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1483,7 +1483,7 @@ impl AfiSafiNlri for L2VpnVplsNlri {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for L2VpnVplsNlri
impl<'a, O, P> NlriParse<'a, O, P> for L2VpnVplsNlri
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1523,7 +1523,7 @@ impl<Octs> AfiSafiNlri for L2VpnEvpnNlri<Octs> {
}
}

impl<'a, O, P> AfiSafiParse<'a, O, P> for L2VpnEvpnNlri<O>
impl<'a, O, P> NlriParse<'a, O, P> for L2VpnEvpnNlri<O>
where
O: Octets,
P: 'a + Octets<Range<'a> = O>
Expand Down Expand Up @@ -1615,7 +1615,7 @@ impl<'a, O, P, ASP> NlriIter<'a, O, P, ASP>
where
O: Octets,
P: Octets<Range<'a> = O>,
ASP: AfiSafiParse<'a, O, P>
ASP: NlriParse<'a, O, P>
{
pub const fn new(parser: Parser<'a, P>) -> Self {
NlriIter {
Expand Down Expand Up @@ -1647,7 +1647,7 @@ where
}


impl<'a, O, P, ASP: AfiSafiParse<'a, O, P>> Iterator for NlriIter<'a, O, P, ASP>
impl<'a, O, P, ASP: NlriParse<'a, O, P>> Iterator for NlriIter<'a, O, P, ASP>
where
P: Octets<Range<'a> = O>
{
Expand Down Expand Up @@ -1731,7 +1731,7 @@ where
impl<'a, O, P, ASP> From<NlriIter<'a, O, P, ASP>> for NlriEnumIter<'a, P>
where
O: Octets,
ASP: AfiSafiParse<'a, O, P>,
ASP: NlriParse<'a, O, P>,
P: Octets<Range<'a> = O>,
{
fn from(iter: NlriIter<'a, O, P, ASP>) -> Self {
Expand All @@ -1742,7 +1742,7 @@ where
}
}

impl<'a, O, P, ASP: AfiSafiParse<'a, O, P>> NlriIter<'a, O, P, ASP>
impl<'a, O, P, ASP: NlriParse<'a, O, P>> NlriIter<'a, O, P, ASP>
where
O: Octets,
P: Octets<Range<'a> = O>
Expand Down

0 comments on commit 0e791ba

Please sign in to comment.