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.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;
18 * The codec registry for BGP NLRI, offers
19 * services for NLRI encoding/decoding.
22 public interface NlriRegistry {
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
30 @Nonnull MpReachNlri parseMpReach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
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
39 @Nonnull MpUnreachNlri parseMpUnreach(@Nonnull ByteBuf buffer, @Nullable PeerSpecificParserConstraint constraint) throws BGPParsingException;
42 * Encode BGP MP REACH NLRI Attribute.
43 * @param mpReachNlri Input reach NLRI.
44 * @param byteAggregator Output buffer.
46 void serializeMpReach(@Nonnull MpReachNlri mpReachNlri, @Nonnull ByteBuf byteAggregator);
49 * Encode BGP MP UNREACH NLRI Attribute.
50 * @param mpUnreachNlri Input unreach NLRI.
51 * @param byteAggregator Output buffer.
53 void serializeMpUnReach(@Nonnull MpUnreachNlri mpUnreachNlri, @Nonnull ByteBuf byteAggregator);
56 * Get all available NLRI encoders.
57 * @return Iterable of NLRI serializers.
59 Iterable<NlriSerializer> getSerializers();