Interface AttributeParser
-
- All Known Implementing Classes:
AbstractAttributeParser,AggregatorAttributeParser,AigpAttributeParser,AS4AggregatorAttributeParser,AS4PathAttributeParser,AsPathAttributeParser,AtomicAggregateAttributeParser,BgpPrefixSidAttributeParser,ClusterIdAttributeParser,CommunitiesAttributeParser,ExtendedCommunitiesAttributeParser,LinkstateAttributeParser,LocalPreferenceAttributeParser,MPReachAttributeParser,MPUnreachAttributeParser,MultiExitDiscriminatorAttributeParser,NextHopAttributeParser,OriginatorIdAttributeParser,OriginAttributeParser,PEDistinguisherLabelsAttributeHandler,PMSITunnelAttributeHandler,ReachAttributeParser
public interface AttributeParserCommon interface for attribute parser implementation. Implementations should consider deriving fromAbstractAttributeParserand provide an RFC7606-compliant interface.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default booleanignoreDuplicates(@NonNull RevisedErrorHandling errorHandling)Determine whether a duplicate attribute should be ignored orBGPError.MALFORMED_ATTR_LISTshould be raised.default voidparseAttribute(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @NonNull RevisedErrorHandling errorHandling, @Nullable PeerSpecificParserConstraint constraint)Parses attribute from ByteBuf buffer with the specifiedRevisedErrorHandling.voidparseAttribute(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @Nullable PeerSpecificParserConstraint constraint)Parses attribute from ByteBuf buffer.
-
-
-
Method Detail
-
parseAttribute
void parseAttribute(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @Nullable PeerSpecificParserConstraint constraint) throws BGPDocumentedException, BGPParsingExceptionParses attribute from ByteBuf buffer.- Parameters:
buffer- Encoded attribute body in ByteBuf.builder- Path attributes builder. Guaranteed to contain all valid attributes whose type is numerically lower than this attribute's type.constraint- Peer specific constraints, may be null- Throws:
BGPDocumentedException- when an irrecoverable error occurred which has aBGPErrorassignedBGPParsingException- when a general unspecified parsing error occurs.
-
parseAttribute
default void parseAttribute(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @NonNull RevisedErrorHandling errorHandling, @Nullable PeerSpecificParserConstraint constraint) throws BGPDocumentedException, BGPParsingException, BGPTreatAsWithdrawExceptionParses attribute from ByteBuf buffer with the specifiedRevisedErrorHandling. Default implementation ignores error handling and defers toparseAttribute(ByteBuf, AttributesBuilder, PeerSpecificParserConstraint).- Parameters:
buffer- Encoded attribute body in ByteBuf.builder- Path attributes builder. Guaranteed to contain all valid attributes whose type is numerically lower than this attribute's type.errorHandling- RFC7606 error handling typeconstraint- Peer specific constraints, may be null- Throws:
BGPDocumentedException- when an irrecoverable error occurred which has aBGPErrorassignedBGPParsingException- when a general unspecified parsing error occurs.BGPTreatAsWithdrawException- when parsing according to revised error handling indicates the message should be treated as withdraw.
-
ignoreDuplicates
default boolean ignoreDuplicates(@NonNull RevisedErrorHandling errorHandling)
Determine whether a duplicate attribute should be ignored orBGPError.MALFORMED_ATTR_LISTshould be raised. This is useful for MP_REACH/MP_UNREACH attributes, which need to emit a Notification under RFC7606 rules.- Parameters:
errorHandling- Revised error handling type- Returns:
- True if the duplicate attribute should be ignored, false if a BGPError should be raised.
-
-