2 * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.protocol.bgp.parser.spi;
10 import io.netty.buffer.ByteBuf;
11 import javax.annotation.Nonnull;
12 import javax.annotation.Nullable;
13 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
14 import org.opendaylight.protocol.bgp.parser.BGPError;
15 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
19 * Attribute serializer/deserializer registry, exposing the capability to parse BGP attributes as a whole.
21 public interface AttributeRegistry {
23 * Parse BGP Attribute from buffer.
25 * @param buffer Input buffer.
26 * @param constraints Peer specific constraint.
27 * @return Decoded BGP Attribute.
28 * @throws BGPDocumentedException when an unrecoverable error occurs, which is documented via {@link BGPError}
29 * @throws BGPParsingException when a general unrecoverable parsing error occurs
31 @Nonnull ParsedAttributes parseAttributes(@Nonnull ByteBuf buffer,
32 @Nullable PeerSpecificParserConstraint constraints) throws BGPDocumentedException, BGPParsingException;
35 * Serialize BGP Attribute to buffer.
37 * @param attribute Input BGP Attribute.
38 * @param byteAggregator Output buffer.
40 void serializeAttribute(@Nonnull Attributes attribute, @Nonnull ByteBuf byteAggregator);