ee99c1e120bf4fc8332d7b6e0a2143ecbfdb2333
[bgpcep.git] / bgp / parser-spi / src / main / java / org / opendaylight / protocol / bgp / parser / spi / AttributeRegistry.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.parser.spi;
9
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.BGPParsingException;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
16 import org.opendaylight.yangtools.yang.binding.DataObject;
17
18 /**
19  *
20  */
21 public interface AttributeRegistry {
22     /**
23      * Parse BGP Attribute from buffer.
24      * @param buffer Input buffer.
25      * @param constraints Peer specific constraint.
26      * @return Decoded BGP Attribute.
27      * @throws BGPDocumentedException
28      * @throws BGPParsingException
29      */
30     @Nonnull Attributes parseAttributes(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraints)
31             throws BGPDocumentedException, BGPParsingException;
32
33     /**
34      * Serialize BGP Attribute to buffer.
35      * @param attribute Input BGP Attribute.
36      * @param byteAggregator Output buffer.
37      */
38     void serializeAttribute(@Nonnull DataObject attribute, @Nonnull ByteBuf byteAggregator);
39 }