1a262404b05b96a72d758939555149fe6f901f5d
[bgpcep.git] / bgp / parser-spi / src / main / java / org / opendaylight / protocol / bgp / parser / spi / extended / community / ExtendedCommunityRegistry.java
1 /*
2  * Copyright (c) 2015 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
9 package org.opendaylight.protocol.bgp.parser.spi.extended.community;
10
11 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
13 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.attributes.ExtendedCommunities;
15
16 /**
17  * The Extended Communities registry.
18  *
19  */
20 public interface ExtendedCommunityRegistry {
21
22     /**
23      * Parses the Extended Community.
24      * @param buffer ByteBuf
25      * @return Decoded ExtendedCommunity or null if the parser for such Extended Community type/sub-type is not present.
26      * @throws BGPDocumentedException
27      * @throws BGPParsingException
28      */
29     ExtendedCommunities parseExtendedCommunity(ByteBuf buffer) throws BGPDocumentedException, BGPParsingException;
30
31     /**
32      * Serializes the Extended Community.
33      * @param extendedCommunity ExtendedCommunity to be encoded.
34      * @param byteAggregator ByteBuf, where the Extended Community is serialized,
35      *  if a serialized is not present for such Extended Community type, no bytes are written into output buffer.
36      */
37     void serializeExtendedCommunity(ExtendedCommunities extendedCommunity, ByteBuf byteAggregator);
38
39 }