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.netconf.api;
10 import java.io.EOFException;
12 // FIXME: NETCONF-554: rework this interface
13 public interface NetconfSessionListener<S extends NetconfSession> {
15 * Fired when the session was established successfully.
17 * @param session New session
19 void onSessionUp(S session);
22 * Fired when the session went down because of an IO error. Implementation should take care of closing underlying
25 * @param session that went down
26 * @param cause Exception that was thrown as the cause of session being down. A common cause is
27 * {@link EOFException}, which indicates the remote end has shut down the communication channel.
29 void onSessionDown(S session, Exception cause);
32 * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
33 * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
35 * @param reason the cause why the session went down
37 void onSessionTerminated(S session, NetconfTerminationReason reason);
40 * Fired when a normal protocol message is received.
42 * @param message Protocol message
44 void onMessage(S session, NetconfMessage message);