4bb014b0930a6b7207674457c6cd02bd5ffb172f
[bgpcep.git] / bgp / parser-spi / src / main / java / org / opendaylight / protocol / bgp / parser / spi / NlriRegistry.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.BGPParsingException;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlri;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpUnreachNlri;
16
17 /**
18  * The codec registry for BGP NLRI, offers
19  * services for NLRI encoding/decoding.
20  *
21  */
22 public interface NlriRegistry {
23     /**
24      * Decode MP REACH NLRI Attribute.
25      * @param buffer Input buffer.
26      * @param constraint Peer specific constraint.
27      * @return Parsed reach NLRI.
28      * @throws BGPParsingException
29      */
30     @Nonnull MpReachNlri parseMpReach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
31
32     /**
33      * Decode MP REACH NLRI Attribute.
34      * @param buffer Input buffer.
35      * @param constraint Peer specific constraint.
36      * @return Parsed unreach NLRI.
37      * @throws BGPParsingException
38      */
39     @Nonnull MpUnreachNlri parseMpUnreach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
40
41     /**
42      * Encode BGP MP REACH NLRI Attribute.
43      * @param mpReachNlri Input reach NLRI.
44      * @param byteAggregator Output buffer.
45      */
46     void serializeMpReach(@Nonnull MpReachNlri mpReachNlri, @Nonnull ByteBuf byteAggregator);
47
48     /**
49      * Encode BGP MP UNREACH NLRI Attribute.
50      * @param mpUnreachNlri Input unreach NLRI.
51      * @param byteAggregator Output buffer.
52      */
53     void serializeMpUnReach(@Nonnull MpUnreachNlri mpUnreachNlri, @Nonnull ByteBuf byteAggregator);
54
55     /**
56      * Get all available NLRI encoders.
57      * @return Iterable of NLRI serializers.
58      */
59     Iterable<NlriSerializer> getSerializers();
60 }