blob: f98f54cafeeea2356c5d80c17766b49c63901fa8 [file] [log] [blame]
Dhruv Dhody4d8943a2016-02-17 16:36:08 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2016-present Open Networking Foundation
Dhruv Dhody4d8943a2016-02-17 16:36:08 +05303 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.ospf.controller.impl;
17
18import org.jboss.netty.channel.ChannelPipeline;
19import org.jboss.netty.channel.ChannelPipelineFactory;
20import org.jboss.netty.channel.Channels;
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053021
22/**
sunishvkf7c56552016-07-18 16:02:39 +053023 * Creates a ChannelPipeline for a client-side OSPF channel.
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053024 */
sunishvkf7c56552016-07-18 16:02:39 +053025public class OspfPipelineFactory implements ChannelPipelineFactory {
26 private OspfInterfaceChannelHandler ospfChannelHandler;
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053027
28 /**
sunishvkf7c56552016-07-18 16:02:39 +053029 * Creates an instance of OSPF channel pipeline factory.
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053030 *
sunishvkf7c56552016-07-18 16:02:39 +053031 * @param ospfChannelHandler OSPF channel handler instance
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053032 */
sunishvkf7c56552016-07-18 16:02:39 +053033 public OspfPipelineFactory(OspfInterfaceChannelHandler ospfChannelHandler) {
34 this.ospfChannelHandler = ospfChannelHandler;
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053035 }
36
37 @Override
Ray Milkey019fba42018-01-31 14:07:47 -080038 public ChannelPipeline getPipeline() {
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053039 ChannelPipeline pipeline = Channels.pipeline();
sunishvkf7c56552016-07-18 16:02:39 +053040 pipeline.addLast("encoder", new OspfMessageDecoder());
41 pipeline.addLast("decoder", new OspfMessageEncoder());
42 pipeline.addLast("handler", ospfChannelHandler);
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053043
44 return pipeline;
45 }
Dhruv Dhody4d8943a2016-02-17 16:36:08 +053046}