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.rib.impl;
11 import static java.util.Objects.requireNonNull;
13 import io.netty.channel.ChannelHandler;
14 import io.netty.channel.ChannelOutboundHandler;
16 import org.opendaylight.protocol.bgp.parser.spi.MessageRegistry;
19 * BGP specific factory for protocol inbound/outbound handlers.
21 public class BGPHandlerFactory {
22 private final ChannelOutboundHandler encoder;
23 private final MessageRegistry registry;
25 public BGPHandlerFactory(final MessageRegistry registry) {
26 this.registry = requireNonNull(registry);
27 this.encoder = new BGPMessageToByteEncoder(registry);
30 public ChannelHandler[] getEncoders() {
31 return new ChannelHandler[] { this.encoder, };
34 public ChannelHandler[] getDecoders() {
35 return new ChannelHandler[] { BGPMessageHeaderDecoder.getBGPMessageHeaderDecoder(), new BGPByteToMessageDecoder(this.registry), };