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 AttributeParser
Common interface for attribute parser implementation. Implementations should consider deriving from
AbstractAttributeParser
and provide an RFC7606-compliant interface.-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
ignoreDuplicates
(@NonNull RevisedErrorHandling errorHandling) Determine whether a duplicate attribute should be ignored orBGPError.MALFORMED_ATTR_LIST
should be raised.default void
parseAttribute
(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @NonNull RevisedErrorHandling errorHandling, @Nullable PeerSpecificParserConstraint constraint) Parses attribute from ByteBuf buffer with the specifiedRevisedErrorHandling
.void
parseAttribute
(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @Nullable PeerSpecificParserConstraint constraint) Parses attribute from ByteBuf buffer.
-
Method Details
-
parseAttribute
void parseAttribute(@NonNull io.netty.buffer.ByteBuf buffer, @NonNull AttributesBuilder builder, @Nullable PeerSpecificParserConstraint constraint) throws BGPDocumentedException, BGPParsingException Parses 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 aBGPError
assignedBGPParsingException
- 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, BGPTreatAsWithdrawException Parses 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 aBGPError
assignedBGPParsingException
- when a general unspecified parsing error occurs.BGPTreatAsWithdrawException
- when parsing according to revised error handling indicates the message should be treated as withdraw.
-
ignoreDuplicates
Determine whether a duplicate attribute should be ignored orBGPError.MALFORMED_ATTR_LIST
should 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.
-