Implemented closing operations for PCEP Netty.
[bgpcep.git] / framework / src / main / java / org / opendaylight / protocol / framework / Dispatcher.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.framework;
9
10 import java.io.IOException;
11 import java.net.InetSocketAddress;
12
13 /**
14  * Dispatcher class for creating protocol servers and clients.
15  */
16 public interface Dispatcher {
17         /**
18          * Creates server. Each server needs factories to pass their instances to client sessions.
19          * 
20          * @param connectionFactory factory for connection specific attributes
21          * @param sfactory to create specific session
22          * @param handlerFactory protocol specific channel handlers factory
23          * 
24          * @return instance of ProtocolServer
25          */
26         public ProtocolServer createServer(final InetSocketAddress address, final ProtocolConnectionFactory connectionFactory,
27                         final ProtocolSessionFactory sfactory) throws IOException;
28
29         /**
30          * Creates a client.
31          * 
32          * @param connection connection specific attributes
33          * @param sfactory protocol session factory to create a specific session
34          * @param handlerFactory protocol-specific channel handlers factory
35          * 
36          * @return session associated with this client
37          */
38         public ProtocolSession createClient(final ProtocolConnection connection, final ProtocolSessionFactory sfactory) throws IOException;
39 }