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.BGPParsingException;
15 import org.opendaylight.yangtools.yang.binding.Notification;
18 * BGP Message codec registry, provides services
19 * to encode/decode messages.
21 public interface MessageRegistry {
23 * Decode input buffer to BGP Message.
24 * @param bytes Input buffer with encoded message.
25 * @param constraint Peer specific constraint.
26 * @return Parsed BGP message.
27 * @throws BGPDocumentedException
28 * @throws BGPParsingException
30 @Nonnull Notification parseMessage(@Nonnull ByteBuf bytes, @Nullable PeerSpecificParserConstraint constraint)
31 throws BGPDocumentedException, BGPParsingException;
34 * Encode input BGP Message to output buffer.
35 * @param message Input BGP Message to be serialized.
36 * @param buffer Output buffer where message is to be written.
38 void serializeMessage(@Nonnull Notification message, @Nonnull ByteBuf buffer);