Implemented closing operations for PCEP Netty.
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPSessionListener.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.pcep;
9
10 import org.opendaylight.protocol.framework.SessionListener;
11 import org.opendaylight.protocol.framework.TerminationReason;
12 import org.opendaylight.protocol.pcep.object.PCEPOpenObject;
13
14 /**
15  * Listener that receives session informations from the session.
16  */
17 public abstract class PCEPSessionListener implements SessionListener {
18
19         /**
20          * Fired when a message is received.
21          * 
22          * @param session session which received the message
23          * @param message PCEPMessage
24          */
25         public abstract void onMessage(PCEPSession session, PCEPMessage message);
26
27         /**
28          * Fired when the session is in state UP.
29          * 
30          * @param session Session which went up
31          * @param local Local open proposal which the peer accepted
32          * @param remote Peer open proposal which we accepted
33          */
34         public abstract void onSessionUp(PCEPSession session, PCEPOpenObject local, PCEPOpenObject remote);
35
36         /**
37          * Fired when the session went down as a result of peer's decision to tear it down. Implementation should take care
38          * of closing underlying session.
39          * 
40          * @param session Session which went down
41          * @param cause Reason for termination
42          * @param e exception that caused session down
43          */
44         public abstract void onSessionDown(PCEPSession session, TerminationReason cause, Exception e);
45
46         /**
47          * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
48          * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
49          * 
50          * @param session Session which went down
51          * @param cause the cause why the session went down
52          */
53         public abstract void onSessionTerminated(PCEPSession session, TerminationReason cause);
54 }