2 * Copyright (c) 2015 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
9 package org.opendaylight.protocol.bgp.parser.spi;
11 import io.netty.buffer.ByteBuf;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.bgp.concepts.NextHopUtil;
14 import org.opendaylight.protocol.bgp.parser.BGPParsingException;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.next.hop.CNextHop;
18 * Handles Next Hop, by default use {@link NextHopUtil}
19 * which is handles Ipv4 and Ipv6 Next hop.
21 public interface NextHopParserSerializer {
23 * Parse Next hop from buffer,
25 * @param buffer Encoded Next Hop in ByteBuf.
27 * @throws BGPParsingException
29 default CNextHop parseNextHop(@Nonnull ByteBuf buffer) throws BGPParsingException {
30 return NextHopUtil.parseNextHop(buffer);
36 * @param cNextHop Next Hop container
37 * @param byteAggregator return Encoded Next Hop in ByteBuf
39 default void serializeNextHop(@Nonnull CNextHop cNextHop, @Nonnull final ByteBuf byteAggregator) {
40 NextHopUtil.serializeNextHop(cNextHop, byteAggregator);