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.yangtools.yang.binding.Notification;
17 * Common interface for message parser implementation.
19 public interface MessageParser {
21 * Parse BGP Message from buffer, potentially applying peer-specific constraints. Implementations are free
23 * @param body Encoded BGP message in ByteBuf.
24 * @param messageLength Length of the BGP message.
25 * @param constraint Peer specific constraints, implementations may ignore them.
26 * @return Parsed BGP Message body.
28 @Nonnull Notification parseMessageBody(@Nonnull ByteBuf body, int messageLength,
29 @Nullable PeerSpecificParserConstraint constraint) throws BGPDocumentedException;