cc568f39135ce8c812e47cdb894c535ef530396e
[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.PCEPCloseObject;
13 import org.opendaylight.protocol.pcep.object.PCEPOpenObject;
14
15 /**
16  *      Listener that receives session informations from the session.
17  */
18 public abstract class PCEPSessionListener implements SessionListener {
19
20         /**
21          * Fired when a message is received.
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
38          * to tear it down.
39          * Implementation should take care of closing underlying session.
40          *
41          * @param session Session which went down
42          * @param reason Reason for termination, may be null when the underlying
43          *               channel was closed without a specific reason.
44          * @param e exception that caused session down
45          */
46         public abstract void onSessionDown(PCEPSession session, PCEPCloseObject reason, Exception e);
47
48         /**
49          * Fired when the session is terminated locally. The session has already
50          * been closed and transitioned to IDLE state. Any outstanding queued
51          * messages were not sent. The user should not attempt to make any use
52          * of the session.
53          *
54          * @param session Session which went down
55          * @param cause the cause why the session went down
56          */
57         public abstract void onSessionTerminated(PCEPSession session, TerminationReason cause);
58 }