Specialize protocol-framework to netconf
[netconf.git] / netconf / netconf-api / src / main / java / org / opendaylight / netconf / api / NetconfSessionListener.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.netconf.api;
9
10 // FIXME: NETCONF-554: rework this interface
11 public interface NetconfSessionListener<S extends NetconfSession> {
12     /**
13      * Fired when the session was established successfully.
14      *
15      * @param session New session
16      */
17     void onSessionUp(S session);
18
19     /**
20      * Fired when the session went down because of an IO error. Implementation should take care of closing underlying
21      * session.
22      *
23      * @param session that went down
24      * @param cause Exception that was thrown as the cause of session being down
25      */
26     void onSessionDown(S session, Exception cause);
27
28     /**
29      * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
30      * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
31      *
32      * @param reason the cause why the session went down
33      */
34     void onSessionTerminated(S session, NetconfTerminationReason reason);
35
36     /**
37      * Fired when a normal protocol message is received.
38      *
39      * @param message Protocol message
40      */
41     void onMessage(S session, NetconfMessage message);
42 }