5288f90392e4ebae23518561525fd7f40dd07bbb
[bgpcep.git] / pcep / api / src / main / java / org / opendaylight / protocol / pcep / PCEPSession.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 io.netty.util.concurrent.Future;
11 import java.net.InetAddress;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.open.Tlvs;
14
15 /**
16  * PCEP Session represents the finite state machine in PCEP, including timers and its purpose is to create a PCEP
17  * connection between PCE/PCC. Session is automatically started, when TCP connection is created, but can be stopped
18  * manually. If the session is up, it has to redirect messages to/from user. Handles also malformed messages and unknown
19  * requests.
20  */
21 public interface PCEPSession extends PCEPSessionState, AutoCloseable {
22
23     /**
24      * Sends message from user to PCE/PCC. If the user sends an Open Message, the session returns an error (open message
25      * is only allowed, when a PCEP handshake is in progress). Close message will close the session and free all the
26      * resources.
27      *
28      * @param message message to be sent
29      * @return Future promise which will be succeed when the message is enqueued in the socket.
30      */
31     Future<Void> sendMessage(Message message);
32
33     void close(TerminationReason reason);
34
35     Tlvs getRemoteTlvs();
36
37     InetAddress getRemoteAddress();
38
39     /**
40      * Returns session characteristics of the local PCEP Speaker
41      *
42      * @return Open message TLVs
43      */
44     Tlvs localSessionCharacteristics();
45 }