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 to encode/decode messages.
20 public interface MessageRegistry {
22 * Decode input buffer to BGP Message.
23 * @param bytes Input buffer with encoded message.
24 * @param constraint Peer specific constraint.
25 * @return Parsed BGP message.
27 @Nonnull Notification parseMessage(@Nonnull ByteBuf bytes, @Nullable PeerSpecificParserConstraint constraint)
28 throws BGPDocumentedException, BGPParsingException;
31 * Encode input BGP Message to output buffer.
32 * @param message Input BGP Message to be serialized.
33 * @param buffer Output buffer where message is to be written.
35 void serializeMessage(@Nonnull Notification message, @Nonnull ByteBuf buffer);