76f618b3391870c21aca61e253643f176b77f4ff
[bgpcep.git] / bgp / parser-api / src / main / java / org / opendaylight / protocol / bgp / parser / BGPSessionListener.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.bgp.parser;
9
10 import java.util.Set;
11
12 import org.opendaylight.protocol.bgp.concepts.BGPTableType;
13
14 import org.opendaylight.protocol.framework.SessionListener;
15
16 /**
17  * Listener that receives session informations from the session.
18  */
19 public abstract class BGPSessionListener implements SessionListener {
20
21         /**
22          * Fired when an Update or a non-fatal Notification message is received.
23          * 
24          * @param message BGPMessage
25          */
26         public abstract void onMessage(BGPMessage message);
27
28         /**
29          * Fired when the session was established successfully.
30          * 
31          * @param remoteParams Peer address families which we accepted
32          */
33         public abstract void onSessionUp(Set<BGPTableType> remoteParams);
34
35         /**
36          * Fired when the session went down because of an IO error. Implementation should take care of closing underlying
37          * session.
38          * 
39          * @param session that went down
40          * @param e Exception that was thrown as the cause of session being down
41          */
42         public abstract void onSessionDown(BGPSession session, Exception e);
43
44         /**
45          * Fired when the session is terminated locally. The session has already been closed and transitioned to IDLE state.
46          * Any outstanding queued messages were not sent. The user should not attempt to make any use of the session.
47          * 
48          * @param cause the cause why the session went down
49          */
50         public abstract void onSessionTerminated(BGPError cause);
51 }